so I'm working on a script for the spell Necrotic plague and I'm stuck, basically the spell works like this: if the spell kills its target or it expires it will jump to the closest unit within 10 yards and gain a stack, if Necrotic Plague is dispelled it will jump to the closest unit but lose a stack, but will never have fewer then one stack. after some time working at the script i came up with
Code:
void OnRemove(AuraEffect* const aurEff, AuraApplication const* aurApp, AuraEffectHandleModes /*mode*/)
{
if(aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE || aurApp->GetRemoveMode() == AURA_REMOVE_BY_DEATH)
{
uint32 Stacks = this->GetAura()->GetStackAmount();
if(this->GetOwner())
{
if(Creature* nextTarget = this->GetOwner()->FindNearestCreature(this->GetOwner()->GetEntry(),10))
{
if(Aura* Plague = nextTarget->AddAura(this->GetId(),nextTarget))
{
Plague->SetStackAmount(Stacks+1);
}
}
}
}
else if(aurApp->GetRemoveMode() == AURA_REMOVE_BY_ENEMY_SPELL)
{
uint32 Stacks = this->GetAura()->GetStackAmount() - 1;
if((Stacks <= 1))
Stacks == 1;
else
Stacks -= 1;
if(this->GetOwner())
{
if(Creature* nextTarget = this->GetOwner()->FindNearestCreature(this->GetOwner()->GetEntry(),10))
{
if(Aura* Plague = nextTarget->AddAura(this->GetId(),nextTarget))
{
Plague->SetStackAmount(Stacks);
}
}
}
}
}
the problem is that the plague only jumps to creatures with the same entry. sure I could make a statement for each creature i expect to be infected(there's only 8 ) but this still doesnt solve the problem with going from a creature to a player of vise verse.