[Bug Fix] Add required distance to CoTH before aggro wipe (#2253)

* Add required distance to CoTH before aggro wipe

This should fix eqemu/master#2205

* Remove implied this->

* Adjustments to rules per PR discussion.
This commit is contained in:
Michael
2022-07-02 22:51:57 -04:00
committed by GitHub
parent d107226ced
commit 68d28bcd3e
4 changed files with 27 additions and 7 deletions
+17 -7
View File
@@ -2130,20 +2130,30 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
case SE_SummonPC:
{
if (!caster)
if (!caster) {
break;
}
if (IsClient()) {
if (caster->IsClient()) {
if (!entity_list.IsInSameGroupOrRaidGroup(caster->CastToClient(), CastToClient())) {
caster->Message(Chat::Red, "Your target must be a group member for this spell.");
break;
}
// clear aggro when summoned in zone and further than aggro clear distance rule.
if (RuleR(Spells, CallOfTheHeroAggroClearDist) == 0 || caster->CalculateDistance(GetX(), GetY(), GetZ()) >= RuleR(Spells, CallOfTheHeroAggroClearDist)) {
entity_list.ClearAggro(this);
}
}
CastToClient()->MovePC(zone->GetZoneID(), zone->GetInstanceID(), caster->GetX(),
caster->GetY(), caster->GetZ(), caster->GetHeading(), 2,
SummonPC);
Message(Chat::Yellow, "You have been summoned!");
// only for beneficial spells like Call of the Hero
// This clear probably isn't actually needed, but need to investigate more
if (IsBeneficialSpell(spell_id))
entity_list.ClearAggro(this);
} else
} else {
caster->Message(Chat::Red, "This spell can only be cast on players.");
}
break;
}