aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities/Unit
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2022-04-25 22:16:56 +0200
committerShauren <shauren.trinity@gmail.com>2022-04-25 22:16:56 +0200
commitc88b602a2c7eda598a4205dd0ec9f562c31f21b0 (patch)
tree3b7fb3cd3f3959f1b0e6765175642cfdd239c4b3 /src/server/game/Entities/Unit
parentb83e10321dc4b2e58823a3a27a589e478d42ba56 (diff)
Core/Spells: Rename SpellAttr1 to use official attribute names
* Implemented SPELL_ATTR1_NO_SKILL_INCREASE, SPELL_ATTR1_AURA_STAYS_AFTER_COMBAT, SPELL_ATTR1_DISPEL_ALL_STACKS
Diffstat (limited to 'src/server/game/Entities/Unit')
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp36
-rw-r--r--src/server/game/Entities/Unit/Unit.h6
2 files changed, 31 insertions, 11 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 30577190507..332ac0e21f1 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -3743,7 +3743,7 @@ void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId
}
}
-void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, ObjectGuid casterGUID, WorldObject* stealer)
+void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, ObjectGuid casterGUID, WorldObject* stealer, int32 stolenCharges /*= 1*/)
{
AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
for (AuraMap::iterator iter = range.first; iter != range.second;)
@@ -3782,9 +3782,9 @@ void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, ObjectGuid casterGUID, W
if (Aura* oldAura = unitStealer->GetAura(aura->GetId(), aura->GetCasterGUID()))
{
if (stealCharge)
- oldAura->ModCharges(1);
+ oldAura->ModCharges(stolenCharges);
else
- oldAura->ModStackAmount(1);
+ oldAura->ModStackAmount(stolenCharges);
oldAura->SetDuration(int32(dur));
}
else
@@ -3809,16 +3809,16 @@ void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, ObjectGuid casterGUID, W
caster->GetSingleCastAuras().push_back(aura);
}
// FIXME: using aura->GetMaxDuration() maybe not blizzlike but it fixes stealing of spells like Innervate
- newAura->SetLoadedState(aura->GetMaxDuration(), int32(dur), stealCharge ? 1 : aura->GetCharges(), 1, recalculateMask, &damage[0]);
+ newAura->SetLoadedState(aura->GetMaxDuration(), int32(dur), stealCharge ? stolenCharges : aura->GetCharges(), stolenCharges, recalculateMask, &damage[0]);
newAura->ApplyForTargets();
}
}
}
if (stealCharge)
- aura->ModCharges(-1, AURA_REMOVE_BY_ENEMY_SPELL);
+ aura->ModCharges(-stolenCharges, AURA_REMOVE_BY_ENEMY_SPELL);
else
- aura->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
+ aura->ModStackAmount(-stolenCharges, AURA_REMOVE_BY_ENEMY_SPELL);
return;
}
@@ -4143,7 +4143,27 @@ void Unit::RemoveAurasOnEvade()
// don't remove vehicle auras, passengers aren't supposed to drop off the vehicle
// don't remove clone caster on evade (to be verified)
- RemoveAllAurasExceptType(SPELL_AURA_CONTROL_VEHICLE, SPELL_AURA_CLONE_CASTER);
+ auto evadeAuraCheck = [](Aura const* aura)
+ {
+ if (aura->HasEffectType(SPELL_AURA_CONTROL_VEHICLE))
+ return false;
+
+ if (aura->HasEffectType(SPELL_AURA_CLONE_CASTER))
+ return false;
+
+ if (aura->GetSpellInfo()->HasAttribute(SPELL_ATTR1_AURA_STAYS_AFTER_COMBAT))
+ return false;
+
+ return true;
+ };
+
+ auto evadeAuraApplicationCheck = [&evadeAuraCheck](AuraApplication const* aurApp)
+ {
+ return evadeAuraCheck(aurApp->GetBase());
+ };
+
+ RemoveAppliedAuras(evadeAuraApplicationCheck);
+ RemoveOwnedAuras(evadeAuraCheck);
}
void Unit::RemoveAllAurasOnDeath()
@@ -7149,7 +7169,7 @@ bool Unit::IsImmunedToDamage(SpellInfo const* spellInfo) const
if (spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) && spellInfo->HasAttribute(SPELL_ATTR3_IGNORE_HIT_RESULT))
return false;
- if (spellInfo->HasAttribute(SPELL_ATTR1_UNAFFECTED_BY_SCHOOL_IMMUNE) || spellInfo->HasAttribute(SPELL_ATTR2_UNAFFECTED_BY_AURA_SCHOOL_IMMUNE))
+ if (spellInfo->HasAttribute(SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS) || spellInfo->HasAttribute(SPELL_ATTR2_UNAFFECTED_BY_AURA_SCHOOL_IMMUNE))
return false;
if (uint32 schoolMask = spellInfo->GetSchoolMask())
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 0fbb844891d..b1dc82c6421 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -123,12 +123,12 @@ class TC_GAME_API DispelableAura
uint8 GetDispelCharges() const { return _charges; }
void IncrementCharges() { ++_charges; }
- bool DecrementCharge()
+ bool DecrementCharge(uint8 charges)
{
if (!_charges)
return false;
- --_charges;
+ _charges -= charges;
return _charges > 0;
}
@@ -1377,7 +1377,7 @@ class TC_GAME_API Unit : public WorldObject
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, uint32 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
void RemoveAuraFromStack(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT, uint16 num = 1);
void RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId, ObjectGuid casterGUID, WorldObject* dispeller, uint8 chargesRemoved = 1);
- void RemoveAurasDueToSpellBySteal(uint32 spellId, ObjectGuid casterGUID, WorldObject* stealer);
+ void RemoveAurasDueToSpellBySteal(uint32 spellId, ObjectGuid casterGUID, WorldObject* stealer, int32 stolenCharges = 1);
void RemoveAurasDueToItemSpell(uint32 spellId, ObjectGuid castItemGuid);
void RemoveAurasByType(AuraType auraType, ObjectGuid casterGUID = ObjectGuid::Empty, Aura* except = nullptr, bool negative = true, bool positive = true);
void RemoveNotOwnSingleTargetAuras(bool onPhaseChange = false);