Skip to content

Commit

Permalink
Implement SPELL_ATTR_EX4_CAN_CAST_WHILE_CASTING
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife authored and Cyberium committed Aug 13, 2016
1 parent b6d818d commit 8b23696
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/game/SharedDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ enum SpellAttributesEx4
SPELL_ATTR_EX4_UNK4 = 0x00000010,// 4 This will no longer cause guards to attack on use??
SPELL_ATTR_EX4_UNK5 = 0x00000020,// 5
SPELL_ATTR_EX4_NOT_STEALABLE = 0x00000040,// 6 although such auras might be dispellable, they cannot be stolen
SPELL_ATTR_EX4_UNK7 = 0x00000080,// 7
SPELL_ATTR_EX4_CAN_CAST_WHILE_CASTING = 0x00000080,// 7 In theory, can use this spell while another is channeled/cast/autocast
SPELL_ATTR_EX4_STACK_DOT_MODIFIER = 0x00000100,// 8 no effect on non DoTs?
SPELL_ATTR_EX4_UNK9 = 0x00000200,// 9
SPELL_ATTR_EX4_SPELL_VS_EXTEND_COST = 0x00000400,// 10 Rogue Shiv have this flag
Expand Down
4 changes: 2 additions & 2 deletions src/game/Spell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2996,7 +2996,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
SpellCastResult Spell::PreCastCheck(Aura* triggeredByAura /*= nullptr*/)
{
// Prevent casting at cast another spell (ServerSide check)
if (m_caster->IsNonMeleeSpellCasted(false, true, true) && m_cast_count)
if (m_caster->IsNonMeleeSpellCasted(false, true, true) && m_cast_count && !m_spellInfo->HasAttribute(SPELL_ATTR_EX4_CAN_CAST_WHILE_CASTING))
return SPELL_FAILED_SPELL_IN_PROGRESS;

SpellCastResult result = CheckCast(true);
Expand Down Expand Up @@ -6156,7 +6156,7 @@ SpellCastResult Spell::CheckPetCast(Unit* target)
if (!m_caster->isAlive())
return SPELL_FAILED_CASTER_DEAD;

if (m_caster->IsNonMeleeSpellCasted(false)) // prevent spellcast interruption by another spellcast
if (m_caster->IsNonMeleeSpellCasted(false) && !m_spellInfo->HasAttribute(SPELL_ATTR_EX4_CAN_CAST_WHILE_CASTING)) // prevent spellcast interruption by another spellcast
return SPELL_FAILED_SPELL_IN_PROGRESS;
if (m_caster->isInCombat() && IsNonCombatSpell(m_spellInfo))
return SPELL_FAILED_AFFECTING_COMBAT;
Expand Down

7 comments on commit 8b23696

@boxa
Copy link
Contributor

@boxa boxa commented on 8b23696 Aug 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good.
on R2 named as SPELL_ATTR_EX4_FORCE_TRIGGERED and also used to "force" trigger spell with this attr:

Spell::Spell(...)
{
    ...
    m_IsTriggeredSpell = m_spellInfo->HasAttribute(SPELL_ATTR_EX4_FORCE_TRIGGERED) ? true : triggered;

@Phatcat
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Phatcat
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have the messages anymore sadly, but @cyberium explained to me why SPELL_ATTR_EX4_FORCE_TRIGGERED was wrong, @killerwife should be able to tell you more about this as well.

@killerwife
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@boxa Triggered does many shenanigans, amongst which, ignore manacost, ignore casting, ignore checks, etc. This is undesirable for a spell that is initiated by the player, as this could create scenarios where spells with this attribute could be exploited. That is why I tailored the usage of this attribute as close to the chest as possible to work.

@boxa
Copy link
Contributor

@boxa boxa commented on 8b23696 Aug 14, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when look into TC code we see:

TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_CAST_DIRECTLY
https://github.com/TrinityCore/TrinityCore/blob/6.x/src/server/game/Spells/Spell.cpp#L566

don't check for casting at cast another spell:
https://github.com/TrinityCore/TrinityCore/blob/6.x/src/server/game/Spells/Spell.cpp#L2926

and casted imeaditelly in Spell::prepare(...)
https://github.com/TrinityCore/TrinityCore/blob/6.x/src/server/game/Spells/Spell.cpp#L3042

so, at the moment "triggered" in mangos-style core close to it.

@killerwife
Copy link
Contributor Author

@killerwife killerwife commented on 8b23696 Aug 14, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I actually read that, but unless someone pulls out a sniff or something that tells me otherwise, I do not mind doing it a bit differently. I love the research trinitycore did, but I try not to copy it straight away and try to think for myself for a change.

If you find a bug with my implementation, thats a different matter alltogether.

@Shauren
Copy link
Contributor

@Shauren Shauren commented on 8b23696 Aug 15, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CAN_CAST_WHILE_CASTING name is correct, in leaked client debug binaries this attribute is checked in a function called CanCastWhileCasting.
Generally attribute meaning does not change in client patches - in legion there are several mage spells present in the spellbook (not hidden internal spells!) that explicitly state this in their tooltips (they all have this attribute)

Please sign in to comment.