rendered paste body// based of vampiric embrace code
void Unit::VampiricTouch(uint32 dmg,Unit* tgt)
{
if(!IsPlayer() || this->getClass()==WARRIOR || this->getClass() == ROGUE)
return;//just in case
int32 perc = 5;
SM_FIValue(SM_FDummy,&perc,4); // need fixing if required
uint32 man = (dmg*perc) / 100;
uint32 cm=this->GetUInt32Value(UNIT_FIELD_POWER1);
uint32 mm=this->GetUInt32Value(UNIT_FIELD_MAXPOWER1);
this->ModUInt32Value(UNIT_FIELD_POWER1,man);
if(this->GetUInt32Value(UNIT_FIELD_POWER1) > this->GetUInt32Value(UNIT_FIELD_MAXPOWER1))
this->SetUInt32Value(UNIT_FIELD_POWER1,this->GetUInt32Value(UNIT_FIELD_MAXPOWER1));
if(SubGroup* pGroup = static_cast<Player*>(this)->GetSubGroup())
{
GroupMembersSet::iterator itr;
for(itr = pGroup->GetGroupMembersBegin(); itr != pGroup->GetGroupMembersEnd(); ++itr)
{
if((*itr) == this)
continue;
Player *p = (*itr);
if(!p->isAlive() || this->getClass()==WARRIOR || this->getClass() == ROGUE)
continue;
uint32 cm=p->GetUInt32Value(UNIT_FIELD_POWER1);
uint32 mm=p->GetUInt32Value(UNIT_FIELD_MAXPOWER1);
p->ModUInt32Value(UNIT_FIELD_POWER1,man);
if(p->GetUInt32Value(UNIT_FIELD_POWER1) > p->GetUInt32Value(UNIT_FIELD_MAXPOWER1))
p->SetUInt32Value(UNIT_FIELD_POWER1,p->GetUInt32Value(UNIT_FIELD_MAXPOWER1));
}
}
}