Skip to content

Commit

Permalink
Spell: Implement TRIGGERED_FORCE_COSTS and aura triggerflag support
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Aug 23, 2024
1 parent 618cfc7 commit b48537f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/game/Spells/Scripts/SpellScript.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ struct PeriodicTriggerData
Unit* caster; Unit* target; WorldObject* targetObject;
SpellEntry const* spellInfo;
int32* basePoints;
uint32 triggerFlags;
PeriodicTriggerData(WorldObject* trueCaster, Unit* caster, Unit* target, WorldObject* targetObject, SpellEntry const* spellInfo, int32* basePoints) :
trueCaster(trueCaster), caster(caster), target(target), targetObject(targetObject), spellInfo(spellInfo), basePoints(basePoints) {}
trueCaster(trueCaster), caster(caster), target(target), targetObject(targetObject), spellInfo(spellInfo), basePoints(basePoints), triggerFlags(TRIGGERED_OLD_TRIGGERED) {}
};

struct SpellScript
Expand Down
2 changes: 1 addition & 1 deletion src/game/Spells/Spell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ Spell::Spell(WorldObject* caster, SpellEntry const* info, uint32 triggeredFlags,
m_petCast = (triggeredFlags & TRIGGERED_PET_CAST) != 0;
m_notifyAI = (triggeredFlags & TRIGGERED_NORMAL_COMBAT_CAST) != 0;
m_ignoreGCD = m_IsTriggeredSpell || ((triggeredFlags & TRIGGERED_IGNORE_GCD) != 0);
m_ignoreCosts = m_IsTriggeredSpell || ((triggeredFlags & TRIGGERED_IGNORE_COSTS) != 0);
m_ignoreCosts = (m_IsTriggeredSpell && (triggeredFlags & TRIGGERED_FORCE_COSTS) == 0) || ((triggeredFlags & TRIGGERED_IGNORE_COSTS) != 0);
m_ignoreCooldowns = m_IsTriggeredSpell || ((triggeredFlags & TRIGGERED_IGNORE_COOLDOWNS) != 0);
m_ignoreConcurrentCasts = m_IsTriggeredSpell || ((triggeredFlags & TRIGGERED_IGNORE_CURRENT_CASTED_SPELL) != 0) || m_spellInfo->HasAttribute(SPELL_ATTR_EX4_ALLOW_CAST_WHILE_CASTING);
m_ignoreCasterAuraState = m_IsTriggeredSpell || ((triggeredFlags & TRIGGERED_IGNORE_CASTER_AURA_STATE) != 0 || m_spellInfo->HasAttribute(SPELL_ATTR_EX5_IGNORE_CASTER_REQUIREMENTS));
Expand Down
2 changes: 1 addition & 1 deletion src/game/Spells/SpellAuras.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,7 @@ void Aura::PickTargetsForSpellTrigger(Unit*& triggerCaster, Unit*& triggerTarget

void Aura::CastTriggeredSpell(PeriodicTriggerData& data)
{
Spell* spell = new Spell(data.trueCaster ? data.trueCaster : data.caster, data.spellInfo, TRIGGERED_OLD_TRIGGERED, data.trueCaster ? data.trueCaster->GetObjectGuid() : data.caster->GetObjectGuid(), GetSpellProto());
Spell* spell = new Spell(data.trueCaster ? data.trueCaster : data.caster, data.spellInfo, data.triggerFlags, data.trueCaster ? data.trueCaster->GetObjectGuid() : data.caster->GetObjectGuid(), GetSpellProto());
if (data.spellInfo->HasAttribute(SPELL_ATTR_EX2_RETAIN_ITEM_CAST)) // forward guid to at least spell go
spell->SetForwardedCastItem(GetCastItemGuid());
if (data.trueCaster && data.caster)
Expand Down
1 change: 1 addition & 0 deletions src/game/Spells/SpellDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,7 @@ enum TriggerCastFlags : uint32
TRIGGERED_DO_NOT_RESET_LEASH = 0x00004000, // Does not reset leash on cast
TRIGGERED_CHANNEL_ONLY = 0x00008000, // Only starts channel and no effects - used for summoning portal GO anims
TRIGGERED_IGNORE_CASTER_AURA_STATE = 0x00010000, // Ignores the Aurastate of the caster
TRIGGERED_FORCE_COSTS = 0x00020000, // Forces costs for triggered spells
TRIGGERED_FULL_MASK = 0xFFFFFFFF
};

Expand Down

0 comments on commit b48537f

Please sign in to comment.