From df92c578d2e0909de1714d05f5e39d83e1a43bec Mon Sep 17 00:00:00 2001 From: Trent Date: Sat, 8 Apr 2023 16:04:17 -0600 Subject: [PATCH] [Rules] Optional summoning when already in melee range (#3204) * Add summon melee range rule * Fix compilation * Remove redundant range check for HateSummon --- common/ruletypes.h | 1 + zone/spell_effects.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/common/ruletypes.h b/common/ruletypes.h index 457546c88..f7b9f4288 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -518,6 +518,7 @@ RULE_BOOL(Combat, HeadshotOnlyHumanoids, true, "Enable or disable Headshot only RULE_BOOL(Combat, EnableWarriorShielding, true, "Enable or disable Warrior Shielding Ability (/shield), true by default.") RULE_BOOL(Combat, BackstabIgnoresElemental, false, "Enable or disable Elemental weapon damage affecting backstab damage, false by default.") RULE_BOOL(Combat, BackstabIgnoresBane, false, "Enable or disable Bane weapon damage affecting backstab damage, false by default.") +RULE_BOOL(Combat, SummonMeleeRange, true, "Enable or disable summoning of a player when already in melee range of the summoner.") RULE_CATEGORY_END() RULE_CATEGORY(NPC) diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 68318b641..6fb8271c1 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -2189,6 +2189,8 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove if (RuleR(Spells, CallOfTheHeroAggroClearDist) == 0 || caster->CalculateDistance(GetX(), GetY(), GetZ()) >= RuleR(Spells, CallOfTheHeroAggroClearDist)) { entity_list.ClearAggro(this); } + } else if (!RuleB(Combat, SummonMeleeRange) && caster->GetZoneID() == GetZoneID() && caster->CombatRange(this)) { + break; } CastToClient()->MovePC(zone->GetZoneID(), zone->GetInstanceID(), caster->GetX(),