Fix for bolt spell targeting self if target zone/died while casting.

Fix for bolt spell targeting self if target zone/died while casting. Despite the name being "ST_TargetOptional", this target type is reserved for projectile spells which all require a target, thus should be treated like any other targeted spell.
This commit is contained in:
KayenEQ
2021-07-18 22:04:07 -04:00
parent cf25f5f1e2
commit 5e049d41e0
2 changed files with 8 additions and 5 deletions
+7 -4
View File
@@ -406,8 +406,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot,
spell.targettype == ST_Self ||
spell.targettype == ST_AECaster ||
spell.targettype == ST_Ring ||
spell.targettype == ST_Beam ||
spell.targettype == ST_TargetOptional) && target_id == 0)
spell.targettype == ST_Beam) && target_id == 0)
{
LogSpells("Spell [{}] auto-targeted the caster. Group? [{}], target type [{}]", spell_id, IsGroupSpell(spell_id), spell.targettype);
target_id = GetID();
@@ -1585,8 +1584,12 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce
case ST_TargetOptional:
{
if(!spell_target)
spell_target = this;
if (!spell_target)
{
LogSpells("Spell [{}] canceled: invalid target (normal)", spell_id);
MessageString(Chat::Red, SPELL_NEED_TAR);
return false; // can't cast these unless we have a target
}
CastAction = SingleTarget;
break;
}