aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2023-10-21 14:49:42 +0200
committerShauren <shauren.trinity@gmail.com>2023-10-21 14:49:42 +0200
commit4e87bd7942d932225436940f62e26d48719a42dd (patch)
treedc03209881d6a12ecc7bd02ca441ef6251d9729d /src/server/game/Entities
parent42e6a1045690cb536d11610b01bf2331ebb033e0 (diff)
Core/Spells: Named and implemented most of SpellAttr7
Diffstat (limited to 'src/server/game/Entities')
-rw-r--r--src/server/game/Entities/Object/Object.cpp4
-rw-r--r--src/server/game/Entities/Pet/Pet.cpp18
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp33
-rw-r--r--src/server/game/Entities/Unit/Unit.h2
4 files changed, 25 insertions, 32 deletions
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index 1a141a7203d..f736bb676c0 100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -2392,7 +2392,7 @@ int32 WorldObject::ModSpellDuration(SpellInfo const* spellInfo, WorldObject cons
return duration;
// some auras are not affected by duration modifiers
- if (spellInfo->HasAttribute(SPELL_ATTR7_IGNORE_DURATION_MODS))
+ if (spellInfo->HasAttribute(SPELL_ATTR7_NO_TARGET_DURATION_MOD))
return duration;
// cut duration only of negative effects
@@ -2633,7 +2633,7 @@ SpellMissInfo WorldObject::SpellHitResult(Unit* victim, SpellInfo const* spellIn
reflectchance += victim->GetTotalAuraModifierByMiscMask(SPELL_AURA_REFLECT_SPELLS_SCHOOL, spellInfo->GetSchoolMask());
if (reflectchance > 0 && roll_chance_i(reflectchance))
- return SPELL_MISS_REFLECT;
+ return spellInfo->HasAttribute(SPELL_ATTR7_REFLECTION_ONLY_DEFENDS) ? SPELL_MISS_DEFLECT : SPELL_MISS_REFLECT;
}
if (spellInfo->HasAttribute(SPELL_ATTR3_ALWAYS_HIT))
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index dd66132f216..067b2f6b74f 100644
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -371,24 +371,6 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c
petStable->SetCurrentActivePetIndex(newPetIndex);
}
- // Send fake summon spell cast - this is needed for correct cooldown application for spells
- // Example: 46584 - without this cooldown (which should be set always when pet is loaded) isn't set clientside
- /// @todo pets should be summoned from real cast instead of just faking it?
- if (petInfo->CreatedBySpellId)
- {
- WorldPackets::Spells::SpellGo spellGo;
- WorldPackets::Spells::SpellCastData& castData = spellGo.Cast;
-
- castData.CasterGUID = owner->GetGUID();
- castData.CasterUnit = owner->GetGUID();
- castData.CastID = ObjectGuid::Create<HighGuid::Cast>(SPELL_CAST_SOURCE_NORMAL, petInfo->CreatedBySpellId, map->GenerateLowGuid<HighGuid::Cast>());
- castData.SpellID = petInfo->CreatedBySpellId;
- castData.CastFlags = CAST_FLAG_UNKNOWN_9;
- castData.CastTime = getMSTime();
-
- owner->SendMessageToSet(spellGo.Write(), true);
- }
-
owner->SetMinion(this, true);
if (!isTemporarySummon)
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 530f459f45c..d5e611f4906 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -917,7 +917,7 @@ bool Unit::HasBreakableByDamageCrowdControlAura(Unit* excludeCasterChannel) cons
if (Player* killer = attacker->ToPlayer())
{
// in bg, count dmg if victim is also a player
- if (victim->GetTypeId() == TYPEID_PLAYER)
+ if (victim->GetTypeId() == TYPEID_PLAYER && !(spellProto && spellProto->HasAttribute(SPELL_ATTR7_DO_NOT_COUNT_FOR_PVP_SCOREBOARD)))
if (Battleground* bg = killer->GetBattleground())
bg->UpdatePlayerScore(killer, SCORE_DAMAGE_DONE, damageDone);
@@ -1054,7 +1054,7 @@ bool Unit::HasBreakableByDamageCrowdControlAura(Unit* excludeCasterChannel) cons
if (damagetype != NODAMAGE && damagetype != DOT)
{
- if (victim != attacker && (!spellProto || !(spellProto->HasAttribute(SPELL_ATTR6_NO_PUSHBACK) || spellProto->HasAttribute(SPELL_ATTR7_NO_PUSHBACK_ON_DAMAGE) || spellProto->HasAttribute(SPELL_ATTR3_TREAT_AS_PERIODIC))))
+ if (victim != attacker && (!spellProto || !(spellProto->HasAttribute(SPELL_ATTR6_NO_PUSHBACK) || spellProto->HasAttribute(SPELL_ATTR7_DONT_CAUSE_SPELL_PUSHBACK) || spellProto->HasAttribute(SPELL_ATTR3_TREAT_AS_PERIODIC))))
{
if (Spell* spell = victim->m_currentSpells[CURRENT_GENERIC_SPELL])
{
@@ -3783,7 +3783,7 @@ void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId
// Call OnDispel hook on AuraScript
aura->CallScriptDispel(&dispelInfo);
- if (aura->GetSpellInfo()->HasAttribute(SPELL_ATTR7_DISPEL_CHARGES))
+ if (aura->GetSpellInfo()->HasAttribute(SPELL_ATTR7_DISPEL_REMOVES_CHARGES))
aura->ModCharges(-dispelInfo.GetRemovedCharges(), AURA_REMOVE_BY_ENEMY_SPELL);
else
aura->ModStackAmount(-dispelInfo.GetRemovedCharges(), AURA_REMOVE_BY_ENEMY_SPELL);
@@ -3828,7 +3828,7 @@ void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, ObjectGuid casterGUID, W
}
}
- bool stealCharge = aura->GetSpellInfo()->HasAttribute(SPELL_ATTR7_DISPEL_CHARGES);
+ bool stealCharge = aura->GetSpellInfo()->HasAttribute(SPELL_ATTR7_DISPEL_REMOVES_CHARGES);
// Cast duration to unsigned to prevent permanent aura's such as Righteous Fury being permanently added to caster
uint32 dur = std::min(2u * MINUTE * IN_MILLISECONDS, uint32(aura->GetDuration()));
@@ -4532,7 +4532,7 @@ void Unit::GetDispellableAuraList(WorldObject const* caster, uint32 dispelMask,
// The charges / stack amounts don't count towards the total number of auras that can be dispelled.
// Ie: A dispel on a target with 5 stacks of Winters Chill and a Polymorph has 1 / (1 + 1) -> 50% chance to dispell
// Polymorph instead of 1 / (5 + 1) -> 16%.
- bool const dispelCharges = aura->GetSpellInfo()->HasAttribute(SPELL_ATTR7_DISPEL_CHARGES);
+ bool const dispelCharges = aura->GetSpellInfo()->HasAttribute(SPELL_ATTR7_DISPEL_REMOVES_CHARGES);
uint8 charges = dispelCharges ? aura->GetCharges() : aura->GetStackAmount();
if (charges > 0)
dispelList.emplace_back(aura, chance, charges);
@@ -5327,10 +5327,20 @@ void Unit::SendSpellNonMeleeDamageLog(SpellNonMeleeDamage const* log)
}
WeaponAttackType attType = damageInfo ? damageInfo->GetAttackType() : BASE_ATTACK;
- if (typeMaskActor && actor)
+ SpellInfo const* spellInfo = [&]() -> SpellInfo const*
+ {
+ if (spell)
+ return spell->GetSpellInfo();
+ if (damageInfo)
+ return damageInfo->GetSpellInfo();
+ if (healInfo)
+ return healInfo->GetSpellInfo();
+ return nullptr;
+ }();
+ if (typeMaskActor && actor && !(spellInfo && spellInfo->HasAttribute(SPELL_ATTR3_SUPPRESS_CASTER_PROCS)))
actor->ProcSkillsAndReactives(false, actionTarget, typeMaskActor, hitMask, attType);
- if (typeMaskActionTarget && actionTarget)
+ if (typeMaskActionTarget && actionTarget && !(spellInfo && spellInfo->HasAttribute(SPELL_ATTR3_SUPPRESS_TARGET_PROCS)))
actionTarget->ProcSkillsAndReactives(true, actor, typeMaskActionTarget, hitMask, attType);
if (actor)
@@ -6250,8 +6260,9 @@ void Unit::SetCharm(Unit* charm, bool apply)
{
if (Player* player = unit->ToPlayer())
{
- if (Battleground* bg = player->GetBattleground())
- bg->UpdatePlayerScore(player, SCORE_HEALING_DONE, gain);
+ if (!healInfo.GetSpellInfo() || !healInfo.GetSpellInfo()->HasAttribute(SPELL_ATTR7_DO_NOT_COUNT_FOR_PVP_SCOREBOARD))
+ if (Battleground* bg = player->GetBattleground())
+ bg->UpdatePlayerScore(player, SCORE_HEALING_DONE, gain);
// use the actual gain, as the overheal shall not be counted, skip gain 0 (it ignored anyway in to criteria)
if (gain)
@@ -11847,10 +11858,10 @@ bool Unit::CanApplyResilience() const
*damage -= target->GetDamageReduction(*damage);
}
-int32 Unit::CalculateAOEAvoidance(int32 damage, uint32 schoolMask, ObjectGuid const& casterGuid) const
+int32 Unit::CalculateAOEAvoidance(int32 damage, uint32 schoolMask, bool npcCaster) const
{
damage = int32(float(damage) * GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE, schoolMask));
- if (casterGuid.IsAnyTypeCreature())
+ if (npcCaster)
damage = int32(float(damage) * GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE, schoolMask));
return damage;
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 32d56807dab..04be57e1837 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1074,7 +1074,7 @@ class TC_GAME_API Unit : public WorldObject
virtual bool CanApplyResilience() const;
static void ApplyResilience(Unit const* victim, int32* damage);
- int32 CalculateAOEAvoidance(int32 damage, uint32 schoolMask, ObjectGuid const& casterGuid) const;
+ int32 CalculateAOEAvoidance(int32 damage, uint32 schoolMask, bool npcCaster) const;
float MeleeSpellMissChance(Unit const* victim, WeaponAttackType attType, SpellInfo const* spellInfo) const override;
SpellMissInfo MeleeSpellHitResult(Unit* victim, SpellInfo const* spellInfo) const override;