From d1700ba5faf7b692472ab2c536cfdbf7a0ca2277 Mon Sep 17 00:00:00 2001 From: Shauren Date: Fri, 30 Sep 2022 01:30:14 +0200 Subject: [PATCH] Core/Spells: Rename SpellAttr5 to use official attribute names * Implemented SPELL_ATTR8_HASTE_AFFECTS_DURATION --- .../game/Entities/Creature/Creature.cpp | 2 +- src/server/game/Entities/Player/Player.cpp | 2 +- src/server/game/Miscellaneous/SharedDefines.h | 66 +++++++++---------- .../game/Spells/Auras/SpellAuraEffects.cpp | 6 +- src/server/game/Spells/Auras/SpellAuras.cpp | 4 +- src/server/game/Spells/Spell.cpp | 14 ++-- src/server/game/Spells/SpellInfo.cpp | 34 +++++----- src/server/game/Spells/SpellMgr.cpp | 8 +-- 8 files changed, 70 insertions(+), 66 deletions(-) diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 276d210a4e..9692b92534 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -3116,7 +3116,7 @@ void Creature::SetSpellFocus(Spell const* focusSpell, WorldObject const* target) _spellFocusInfo.FocusSpell = focusSpell; // Focusing behaves different based on the given spell attributes. Tracking channel spells only face the target's direction and stay there. Normal spell casts fixate on their target instead - bool const noTurnDuringCast = spellInfo->HasAttribute(SPELL_ATTR5_DONT_TURN_DURING_CAST); + bool const noTurnDuringCast = spellInfo->HasAttribute(SPELL_ATTR5_AI_DOESNT_FACE_TARGET); bool const turnDisabled = HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISABLE_TURN); ObjectGuid newTarget = [&]() diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index f8934192fc..7d473493a9 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -24562,7 +24562,7 @@ bool Player::HasAllItemsToFitToSpellRequirements(SpellInfo const* spellInfo) bool Player::CanNoReagentCast(SpellInfo const* spellInfo) const { // don't take reagents for spells with SPELL_ATTR5_NO_REAGENT_WHILE_PREP - if (spellInfo->HasAttribute(SPELL_ATTR5_NO_REAGENT_WHILE_PREP) && + if (spellInfo->HasAttribute(SPELL_ATTR5_NO_REAGENT_COST_WITH_AURA) && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREPARATION)) return true; diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index 1672c2f7eb..77a529c749 100644 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -532,40 +532,40 @@ enum SpellAttr4 : uint32 SPELL_ATTR4_USE_FACING_FROM_SPELL = 0x80000000 // TITLE Use Facing From Spell }; -enum SpellAttr5 +enum SpellAttr5 : uint32 { - SPELL_ATTR5_ALLOW_ACTIONS_DURING_CHANNEL = 0x00000001, // 0 Allow Actions During Channel - SPELL_ATTR5_NO_REAGENT_WHILE_PREP = 0x00000002, // 1 not need reagents if UNIT_FLAG_PREPARATION - SPELL_ATTR5_REMOVE_ON_ARENA_ENTER = 0x00000004, // 2 remove this aura on arena enter - SPELL_ATTR5_USABLE_WHILE_STUNNED = 0x00000008, // 3 usable while stunned - SPELL_ATTR5_UNK4 = 0x00000010, // 4 - SPELL_ATTR5_SINGLE_TARGET_SPELL = 0x00000020, // 5 Only one target can be apply at a time - SPELL_ATTR5_UNK6 = 0x00000040, // 6 - SPELL_ATTR5_DONT_TARGET_PLAYERS = 0x00000080, // 7 Not On Player - SPELL_ATTR5_DONT_ALLOW_PET_TARGET = 0x00000100, // 8 do not allow the following spell to affect or target pets - SPELL_ATTR5_START_PERIODIC_AT_APPLY = 0x00000200, // 9 begin periodic tick at aura apply - SPELL_ATTR5_HIDE_DURATION = 0x00000400, // 10 do not send duration to client - SPELL_ATTR5_ALLOW_TARGET_OF_TARGET_AS_TARGET = 0x00000800, // 11 (NYI) uses target's target as target if original target not valid (intervene for example) - SPELL_ATTR5_MELEE_CHAIN_TARGETING = 0x00001000, // 12 Cleave related? - SPELL_ATTR5_SPELL_HASTE_AFFECTS_PERIODIC = 0x00002000, // 13 Spell Haste Affects Periodic - SPELL_ATTR5_NOT_USABLE_WHILE_CHARMED = 0x00004000, // 14 Charmed units cannot cast this spell - SPELL_ATTR5_TREAT_AS_AREA_EFFECT = 0x00008000, // 15 Treat As Area Effect - SPELL_ATTR5_UNK16 = 0x00010000, // 16 - SPELL_ATTR5_USABLE_WHILE_FEARED = 0x00020000, // 17 usable while feared - SPELL_ATTR5_USABLE_WHILE_CONFUSED = 0x00040000, // 18 usable while confused - SPELL_ATTR5_DONT_TURN_DURING_CAST = 0x00080000, // 19 Blocks caster's turning when casting (client does not automatically turn caster's model to face UNIT_FIELD_TARGET) - SPELL_ATTR5_UNK20 = 0x00100000, // 20 - SPELL_ATTR5_UNK21 = 0x00200000, // 21 - SPELL_ATTR5_UNK22 = 0x00400000, // 22 - SPELL_ATTR5_UNK23 = 0x00800000, // 23 - SPELL_ATTR5_UNK24 = 0x01000000, // 24 - SPELL_ATTR5_UNK25 = 0x02000000, // 25 - SPELL_ATTR5_SKIP_CHECKCAST_LOS_CHECK = 0x04000000, // 26 aoe related - Boulder, Cannon, Corpse Explosion, Fire Nova, Flames, Frost Bomb, Living Bomb, Seed of Corruption, Starfall, Thunder Clap, Volley - SPELL_ATTR5_DONT_SHOW_AURA_IF_SELF_CAST = 0x08000000, // 27 Auras with this attribute are not visible on units that are the caster - SPELL_ATTR5_DONT_SHOW_AURA_IF_NOT_SELF_CAST = 0x10000000, // 28 Auras with this attribute are not visible on units that are not the caster - SPELL_ATTR5_UNK29 = 0x20000000, // 29 - SPELL_ATTR5_UNK30 = 0x40000000, // 30 - SPELL_ATTR5_UNK31 = 0x80000000 // 31 Forces all nearby enemies to focus attacks caster + SPELL_ATTR5_ALLOW_ACTIONS_DURING_CHANNEL = 0x00000001, // TITLE Allow Actions During Channel + SPELL_ATTR5_NO_REAGENT_COST_WITH_AURA = 0x00000002, // TITLE No Reagent Cost With Aura + SPELL_ATTR5_REMOVE_ENTERING_ARENA = 0x00000004, // TITLE Remove Entering Arena DESCRIPTION Force this aura to be removed on entering arena, regardless of other properties + SPELL_ATTR5_ALLOW_WHILE_STUNNED = 0x00000008, // TITLE Allow While Stunned + SPELL_ATTR5_TRIGGERS_CHANNELING = 0x00000010, // TITLE Triggers Channeling + SPELL_ATTR5_LIMIT_N = 0x00000020, /*INCOMPLETE IMPL*/ // TITLE Limit N DESCRIPTION Remove previous application to another unit if applied + SPELL_ATTR5_IGNORE_AREA_EFFECT_PVP_CHECK = 0x00000040, /*NYI*/ // TITLE Ignore Area Effect PvP Check + SPELL_ATTR5_NOT_ON_PLAYER = 0x00000080, /*NYI*/ // TITLE Not On Player + SPELL_ATTR5_NOT_ON_PLAYER_CONTROLLED_NPC = 0x00000100, /*NYI*/ // TITLE Not On Player Controlled NPC + SPELL_ATTR5_EXTRA_INITIAL_PERIOD = 0x00000200, // TITLE Extra Initial Period DESCRIPTION Immediately do periodic tick on apply + SPELL_ATTR5_DO_NOT_DISPLAY_DURATION = 0x00000400, // TITLE Do Not Display Duration + SPELL_ATTR5_IMPLIED_TARGETING = 0x00000800, // TITLE Implied Targeting (client only) + SPELL_ATTR5_MELEE_CHAIN_TARGETING = 0x00001000, // TITLE Melee Chain Targeting + SPELL_ATTR5_SPELL_HASTE_AFFECTS_PERIODIC = 0x00002000, // TITLE Spell Haste Affects Periodic + SPELL_ATTR5_NOT_AVAILABLE_WHILE_CHARMED = 0x00004000, /*NYI*/ // TITLE Not Available While Charmed + SPELL_ATTR5_TREAT_AS_AREA_EFFECT = 0x00008000, /*NYI*/ // TITLE Treat as Area Effect + SPELL_ATTR5_AURA_AFFECTS_NOT_JUST_REQ_EQUIPPED_ITEM = 0x00010000, // TITLE Aura Affects Not Just Req. Equipped Item + SPELL_ATTR5_ALLOW_WHILE_FLEEING = 0x00020000, // TITLE Allow While Fleeing + SPELL_ATTR5_ALLOW_WHILE_CONFUSED = 0x00040000, // TITLE Allow While Confused + SPELL_ATTR5_AI_DOESNT_FACE_TARGET = 0x00080000, // TITLE AI Doesn't Face Target + SPELL_ATTR5_DO_NOT_ATTEMPT_A_PET_RESUMMON_WHEN_DISMOUNTING = 0x00100000, /*NYI*/ // TITLE Do Not Attempt a Pet Resummon When Dismounting + SPELL_ATTR5_IGNORE_TARGET_REQUIREMENTS = 0x00200000, /*NYI*/ // TITLE Ignore Target Requirements + SPELL_ATTR5_NOT_ON_TRIVIAL = 0x00400000, /*NYI*/ // TITLE Not On Trivial + SPELL_ATTR5_NO_PARTIAL_RESISTS = 0x00800000, /*NYI*/ // TITLE No Partial Resists + SPELL_ATTR5_IGNORE_CASTER_REQUIREMENTS = 0x01000000, /*NYI*/ // TITLE Ignore Caster Requirements + SPELL_ATTR5_ALWAYS_LINE_OF_SIGHT = 0x02000000, /*NYI*/ // TITLE Always Line of Sight + SPELL_ATTR5_ALWAYS_AOE_LINE_OF_SIGHT = 0x04000000, /*WRONG IMPL*/ // TITLE Always AOE Line of Sight DESCRIPTION Requires line of sight between caster and target in addition to between dest and target + SPELL_ATTR5_NO_CASTER_AURA_ICON = 0x08000000, // TITLE No Caster Aura Icon (client only) + SPELL_ATTR5_NO_TARGET_AURA_ICON = 0x10000000, // TITLE No Target Aura Icon (client only) + SPELL_ATTR5_AURA_UNIQUE_PER_CASTER = 0x20000000, /*NYI*/ // TITLE Aura Unique Per Caster + SPELL_ATTR5_ALWAYS_SHOW_GROUND_TEXTURE = 0x40000000, // TITLE Always Show Ground Texture + SPELL_ATTR5_ADD_MELEE_HIT_RATING = 0x80000000 /*NYI*/ // TITLE Add Melee Hit Rating }; enum SpellAttr6 diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index c23fdbe3d5..d2eec5ad5e 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -630,7 +630,7 @@ uint32 AuraEffect::GetTotalTicks() const if (_period && !GetBase()->IsPermanent()) { totalTicks = static_cast(GetBase()->GetMaxDuration() / _period); - if (m_spellInfo->HasAttribute(SPELL_ATTR5_START_PERIODIC_AT_APPLY)) + if (m_spellInfo->HasAttribute(SPELL_ATTR5_EXTRA_INITIAL_PERIOD)) ++totalTicks; } @@ -644,7 +644,7 @@ void AuraEffect::ResetPeriodic(bool resetPeriodicTimer /*= false*/) { _periodicTimer = 0; // Start periodic on next tick or at aura apply - if (m_spellInfo->HasAttribute(SPELL_ATTR5_START_PERIODIC_AT_APPLY)) + if (m_spellInfo->HasAttribute(SPELL_ATTR5_EXTRA_INITIAL_PERIOD)) _periodicTimer = _period; } } @@ -709,7 +709,7 @@ void AuraEffect::CalculatePeriodic(Unit* caster, bool resetPeriodicTimer, bool l _periodicTimer = elapsedTime % uint32(_period); } - if (m_spellInfo->HasAttribute(SPELL_ATTR5_START_PERIODIC_AT_APPLY)) + if (m_spellInfo->HasAttribute(SPELL_ATTR5_EXTRA_INITIAL_PERIOD)) ++_ticksDone; } else // aura just created or reapplied diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index baea918c5c..7a931fe9fe 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -249,7 +249,7 @@ void AuraApplication::BuildUpdatePacket(WorldPackets::Spells::AuraInfo& auraInfo Aura const* aura = GetBase(); auraData.SpellID = aura->GetId(); auraData.Flags = GetFlags(); - if (aura->GetType() != DYNOBJ_AURA_TYPE && aura->GetMaxDuration() > 0 && !aura->GetSpellInfo()->HasAttribute(SPELL_ATTR5_HIDE_DURATION)) + if (aura->GetType() != DYNOBJ_AURA_TYPE && aura->GetMaxDuration() > 0 && !aura->GetSpellInfo()->HasAttribute(SPELL_ATTR5_DO_NOT_DISPLAY_DURATION)) auraData.Flags |= AFLAG_DURATION; auraData.CastLevel = uint16(aura->GetCasterLevel()); @@ -916,7 +916,7 @@ void Aura::RefreshDuration(bool withMods) { int32 duration = m_spellInfo->GetMaxDuration(); // Calculate duration of periodics affected by haste. - if (caster->HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, m_spellInfo) || m_spellInfo->HasAttribute(SPELL_ATTR8_HASTE_AFFECTS_DURATION)) + if (m_spellInfo->HasAttribute(SPELL_ATTR8_HASTE_AFFECTS_DURATION)) duration = int32(duration * caster->GetFloatValue(UNIT_MOD_CAST_SPEED)); SetMaxDuration(duration); diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 95021b1264..2f523e2d08 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -1965,7 +1965,7 @@ uint32 Spell::GetSearcherTypeMask(SpellTargetObjectTypes objType, ConditionConta retMask &= GRID_MAP_TYPE_MASK_CORPSE | GRID_MAP_TYPE_MASK_PLAYER; if (m_spellInfo->HasAttribute(SPELL_ATTR3_ONLY_ON_GHOSTS)) retMask &= GRID_MAP_TYPE_MASK_PLAYER; - if (m_spellInfo->HasAttribute(SPELL_ATTR5_DONT_TARGET_PLAYERS)) + if (m_spellInfo->HasAttribute(SPELL_ATTR5_NOT_ON_PLAYER)) retMask &= ~(GRID_MAP_TYPE_MASK_CORPSE | GRID_MAP_TYPE_MASK_PLAYER); if (condList) @@ -3328,7 +3328,7 @@ SpellCastResult Spell::prepare(SpellCastTargets const& targets, AuraEffect const m_casttime = m_spellInfo->CalcCastTime(m_caster->IsUnit() ? m_caster->ToUnit()->getLevel() : 0, this); // don't allow channeled spells / spells with cast time to be cast while moving - // exception are only channeled spells that have no casttime and SPELL_ATTR5_CAN_CHANNEL_WHEN_MOVING + // exception are only channeled spells that have no casttime and dont have movement interrupt flag // (even if they are interrupted on moving, spells with almost immediate effect get to have their effect processed before movement interrupter kicks in) // don't cancel spells which are affected by a SPELL_AURA_CAST_WHILE_WALKING effect if (((m_spellInfo->IsChanneled() || m_casttime) && m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->isMoving() && @@ -5778,7 +5778,7 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint if (DynamicObject* dynObj = m_caster->ToUnit()->GetDynObject(m_triggeredByAuraSpell->Id)) losTarget = dynObj; - if (!m_spellInfo->HasAttribute(SPELL_ATTR2_IGNORE_LINE_OF_SIGHT) && !m_spellInfo->HasAttribute(SPELL_ATTR5_SKIP_CHECKCAST_LOS_CHECK) && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, m_spellInfo->Id, nullptr, SPELL_DISABLE_LOS) && !target->IsWithinLOSInMap(losTarget, LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags::M2)) + if (!m_spellInfo->HasAttribute(SPELL_ATTR2_IGNORE_LINE_OF_SIGHT) && !m_spellInfo->HasAttribute(SPELL_ATTR5_ALWAYS_AOE_LINE_OF_SIGHT) && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, m_spellInfo->Id, nullptr, SPELL_DISABLE_LOS) && !target->IsWithinLOSInMap(losTarget, LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags::M2)) return SPELL_FAILED_LINE_OF_SIGHT; } } @@ -5790,7 +5790,7 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint float x, y, z; m_targets.GetDstPos()->GetPosition(x, y, z); - if (!m_spellInfo->HasAttribute(SPELL_ATTR2_IGNORE_LINE_OF_SIGHT) && !m_spellInfo->HasAttribute(SPELL_ATTR5_SKIP_CHECKCAST_LOS_CHECK) && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, m_spellInfo->Id, nullptr, SPELL_DISABLE_LOS) && !m_caster->IsWithinLOS(x, y, z, LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags::M2)) + if (!m_spellInfo->HasAttribute(SPELL_ATTR2_IGNORE_LINE_OF_SIGHT) && !m_spellInfo->HasAttribute(SPELL_ATTR5_ALWAYS_AOE_LINE_OF_SIGHT) && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, m_spellInfo->Id, nullptr, SPELL_DISABLE_LOS) && !m_caster->IsWithinLOS(x, y, z, LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags::M2)) return SPELL_FAILED_LINE_OF_SIGHT; } @@ -6555,13 +6555,13 @@ SpellCastResult Spell::CheckCasterAuras(uint32* param1) const // still they need to be checked against certain mechanics // SPELL_ATTR5_USABLE_WHILE_STUNNED by default only MECHANIC_STUN (ie no sleep, knockout, freeze, etc.) - bool usableWhileStunned = m_spellInfo->HasAttribute(SPELL_ATTR5_USABLE_WHILE_STUNNED); + bool usableWhileStunned = m_spellInfo->HasAttribute(SPELL_ATTR5_ALLOW_WHILE_STUNNED); // SPELL_ATTR5_USABLE_WHILE_FEARED by default only fear (ie no horror) - bool usableWhileFeared = m_spellInfo->HasAttribute(SPELL_ATTR5_USABLE_WHILE_FEARED); + bool usableWhileFeared = m_spellInfo->HasAttribute(SPELL_ATTR5_ALLOW_WHILE_FLEEING); // SPELL_ATTR5_USABLE_WHILE_CONFUSED by default only disorient (ie no polymorph) - bool usableWhileConfused = m_spellInfo->HasAttribute(SPELL_ATTR5_USABLE_WHILE_CONFUSED); + bool usableWhileConfused = m_spellInfo->HasAttribute(SPELL_ATTR5_ALLOW_WHILE_CONFUSED); // Glyph of Pain Suppression // Allow Pain Suppression and Guardian Spirit to be cast while stunned diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 64310c841a..71d008068b 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -1465,7 +1465,7 @@ bool SpellInfo::IsChanneled() const bool SpellInfo::IsMoveAllowedChannel() const { - return IsChanneled() && ((HasAttribute(SPELL_ATTR5_ALLOW_ACTIONS_DURING_CHANNEL) && !ChannelInterruptFlags.HasFlag(SpellAuraInterruptFlags::Moving | SpellAuraInterruptFlags::Turning))); + return IsChanneled() && !ChannelInterruptFlags.HasFlag(SpellAuraInterruptFlags::Moving | SpellAuraInterruptFlags::Turning); } bool SpellInfo::NeedsComboPoints() const @@ -1600,7 +1600,7 @@ bool SpellInfo::CanDispelAura(SpellInfo const* auraSpellInfo) const bool SpellInfo::IsSingleTarget() const { // all other single target spells have if it has AttributesEx5 - if (HasAttribute(SPELL_ATTR5_SINGLE_TARGET_SPELL)) + if (HasAttribute(SPELL_ATTR5_LIMIT_N)) return true; switch (GetSpellSpecific()) @@ -1963,7 +1963,7 @@ SpellCastResult SpellInfo::CheckTarget(WorldObject const* caster, WorldObject co return SPELL_FAILED_BAD_TARGETS; // Do not allow pet or guardian targets if the spell is a raid buff or may not target pets at all - if ((HasAttribute(SPELL_ATTR7_CONSOLIDATED_RAID_BUFF) || HasAttribute(SPELL_ATTR5_DONT_ALLOW_PET_TARGET)) && (caster->IsCreature() && !caster->ToCreature()->IsPet() && !caster->ToCreature()->IsGuardian())) + if ((HasAttribute(SPELL_ATTR7_CONSOLIDATED_RAID_BUFF) || HasAttribute(SPELL_ATTR5_NOT_ON_PLAYER_CONTROLLED_NPC)) && (caster->IsCreature() && !caster->ToCreature()->IsPet() && !caster->ToCreature()->IsGuardian())) if ((unitTarget->IsPet() || unitTarget->IsGuardian())) return SPELL_FAILED_BAD_TARGETS; @@ -3060,7 +3060,7 @@ void SpellInfo::_LoadImmunityInfo() _allowedMechanicMask |= immuneInfo.MechanicImmuneMask; } - if (HasAttribute(SPELL_ATTR5_USABLE_WHILE_STUNNED)) + if (HasAttribute(SPELL_ATTR5_ALLOW_WHILE_STUNNED)) { switch (Id) { @@ -3080,10 +3080,10 @@ void SpellInfo::_LoadImmunityInfo() } } - if (HasAttribute(SPELL_ATTR5_USABLE_WHILE_CONFUSED)) + if (HasAttribute(SPELL_ATTR5_ALLOW_WHILE_CONFUSED)) _allowedMechanicMask |= (1 << MECHANIC_DISORIENTED); - if (HasAttribute(SPELL_ATTR5_USABLE_WHILE_FEARED)) + if (HasAttribute(SPELL_ATTR5_ALLOW_WHILE_FLEEING)) { switch (Id) { @@ -3400,17 +3400,13 @@ uint32 SpellInfo::CalcCastTime(uint8 level, Spell* spell /*= nullptr*/) const uint32 SpellInfo::GetMaxTicks() const { + uint32 totalTicks = 0; int32 DotDuration = GetDuration(); - if (DotDuration == 0) - return 1; - - // 200% limit - if (DotDuration > 30000) - DotDuration = 30000; for (uint8 x = 0; x < MAX_SPELL_EFFECTS; x++) { if (Effects[x].Effect == SPELL_EFFECT_APPLY_AURA || Effects[x].Effect == SPELL_EFFECT_APPLY_AURA_2) + { switch (Effects[x].ApplyAuraName) { case SPELL_AURA_PERIODIC_DAMAGE: @@ -3427,13 +3423,21 @@ uint32 SpellInfo::GetMaxTicks() const case SPELL_AURA_PERIODIC_TRIGGER_SPELL: case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE: case SPELL_AURA_PERIODIC_HEALTH_FUNNEL: - if (Effects[x].AuraPeriod != 0) - return DotDuration / Effects[x].AuraPeriod; + // skip infinite periodics + if (Effects[x].AuraPeriod > 0 && DotDuration > 0) + { + totalTicks = static_cast(DotDuration) / Effects[x].AuraPeriod; + if (HasAttribute(SPELL_ATTR5_EXTRA_INITIAL_PERIOD)) + ++totalTicks; + } + break; + default: break; } + } } - return 6; + return totalTicks; } uint32 SpellInfo::GetRecoveryTime() const diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 28f3d0b371..1a22e789b0 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -3360,13 +3360,13 @@ void SpellMgr::LoadSpellInfoCorrections() ApplySpellFix({ 8145 }, [](SpellInfo* spellInfo) { spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; - spellInfo->AttributesEx5 |= SPELL_ATTR5_START_PERIODIC_AT_APPLY; + spellInfo->AttributesEx5 |= SPELL_ATTR5_EXTRA_INITIAL_PERIOD; }); // Earthbind Totem (instant pulse) ApplySpellFix({ 6474 }, [](SpellInfo* spellInfo) { - spellInfo->AttributesEx5 |= SPELL_ATTR5_START_PERIODIC_AT_APPLY; + spellInfo->AttributesEx5 |= SPELL_ATTR5_EXTRA_INITIAL_PERIOD; }); // Marked for Death @@ -5828,7 +5828,7 @@ void SpellMgr::LoadSpellInfoCorrections() // Lifebloom ApplySpellFix({ 33763 }, [](SpellInfo* spellInfo) { - spellInfo->AttributesEx5 |= SPELL_ATTR5_SINGLE_TARGET_SPELL; + spellInfo->AttributesEx5 |= SPELL_ATTR5_LIMIT_N; }); // Tree of Life (Passive) @@ -6023,7 +6023,7 @@ void SpellMgr::LoadSpellInfoCorrections() // due to the way spell system works, unit would change orientation in Spell::_cast if (spellInfo->HasAura(SPELL_AURA_CONTROL_VEHICLE)) - spellInfo->AttributesEx5 |= SPELL_ATTR5_DONT_TURN_DURING_CAST; + spellInfo->AttributesEx5 |= SPELL_ATTR5_AI_DOESNT_FACE_TARGET; if (spellInfo->ActiveIconID == 2158) // flight spellInfo->Attributes |= SPELL_ATTR0_PASSIVE;