[Rules] Add rule to allow you to cast invis on already invis'd players (#1361)

This commit is contained in:
splose 2021-05-24 21:29:27 -04:00 committed by GitHub
parent 7458b5f32f
commit e8b94a11f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 22 deletions

View File

@ -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)

View File

@ -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;
}
}
}