From e8b94a11f1d4b1115e6738297079dcfe3bcc68f7 Mon Sep 17 00:00:00 2001 From: splose Date: Mon, 24 May 2021 21:29:27 -0400 Subject: [PATCH] [Rules] Add rule to allow you to cast invis on already invis'd players (#1361) --- common/ruletypes.h | 1 + zone/spells.cpp | 47 ++++++++++++++++++++++++---------------------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/common/ruletypes.h b/common/ruletypes.h index 22ea02741..524898fa5 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -369,6 +369,7 @@ RULE_BOOL(Spells, OldRainTargets, false, "Use old incorrectly implemented maximu RULE_BOOL(Spells, NPCSpellPush, false, "Enable spell push on NPCs") RULE_BOOL(Spells, July242002PetResists, true, "Enable Pets using PCs resist change from July 24 2002") RULE_INT(Spells, AOEMaxTargets, 0, "Max number of targets a Targeted AOE spell can cast on. Set to 0 for no limit.") +RULE_BOOL(Spells, AllowDoubleInvis, false, "Allows you to cast invisibility spells on a player that is already invisible") RULE_CATEGORY_END() RULE_CATEGORY(Combat) diff --git a/zone/spells.cpp b/zone/spells.cpp index 13c7ff1cf..f7536cd04 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -3607,33 +3607,36 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, bool reflect, bool use_r // Prevent double invising, which made you uninvised // Not sure if all 3 should be stacking - if(IsEffectInSpell(spell_id, SE_Invisibility)) - { - if(spelltar->invisible) - { - spelltar->MessageString(Chat::SpellFailure, ALREADY_INVIS, GetCleanName()); - safe_delete(action_packet); - return false; - } - } - if(IsEffectInSpell(spell_id, SE_InvisVsUndead)) - { - if(spelltar->invisible_undead) + if (!RuleB(Spells, AllowDoubleInvis)) { + if (IsEffectInSpell(spell_id, SE_Invisibility)) { - spelltar->MessageString(Chat::SpellFailure, ALREADY_INVIS, GetCleanName()); - safe_delete(action_packet); - return false; + if (spelltar->invisible) + { + spelltar->MessageString(Chat::SpellFailure, ALREADY_INVIS, GetCleanName()); + safe_delete(action_packet); + return false; + } } - } - if(IsEffectInSpell(spell_id, SE_InvisVsAnimals)) - { - if(spelltar->invisible_animals) + if (IsEffectInSpell(spell_id, SE_InvisVsUndead)) { - spelltar->MessageString(Chat::SpellFailure, ALREADY_INVIS, GetCleanName()); - safe_delete(action_packet); - return false; + if (spelltar->invisible_undead) + { + spelltar->MessageString(Chat::SpellFailure, ALREADY_INVIS, GetCleanName()); + safe_delete(action_packet); + return false; + } + } + + if (IsEffectInSpell(spell_id, SE_InvisVsAnimals)) + { + if (spelltar->invisible_animals) + { + spelltar->MessageString(Chat::SpellFailure, ALREADY_INVIS, GetCleanName()); + safe_delete(action_packet); + return false; + } } }