diff options
Diffstat (limited to 'src/server/game/Entities')
| -rw-r--r-- | src/server/game/Entities/Object/Object.cpp | 11 | ||||
| -rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 8 | ||||
| -rw-r--r-- | src/server/game/Entities/Player/Player.h | 2 | ||||
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 13 | ||||
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.h | 2 |
5 files changed, 24 insertions, 12 deletions
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index f736bb676c0..d36f19f4c5f 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -2479,7 +2479,9 @@ void WorldObject::ModSpellDurationTime(SpellInfo const* spellInfo, int32& durati if (!spellInfo || duration < 0) return; - if (spellInfo->IsChanneled() && !spellInfo->HasAttribute(SPELL_ATTR5_SPELL_HASTE_AFFECTS_PERIODIC)) + if (spellInfo->IsChanneled() + && !spellInfo->HasAttribute(SPELL_ATTR5_SPELL_HASTE_AFFECTS_PERIODIC) + && !spellInfo->HasAttribute(SPELL_ATTR8_MELEE_HASTE_AFFECTS_PERIODIC)) return; // called from caster @@ -3103,7 +3105,10 @@ bool WorldObject::IsValidAttackTarget(WorldObject const* target, SpellInfo const // PvP case - can't attack when attacker or target are in sanctuary // however, 13850 client doesn't allow to attack when one of the unit's has sanctuary flag and is pvp - if (unitTarget && unitTarget->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && unitOrOwner && unitOrOwner->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && (unitTarget->IsInSanctuary() || unitOrOwner->IsInSanctuary())) + if (unitTarget && unitTarget->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) + && unitOrOwner && unitOrOwner->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) + && (unitTarget->IsInSanctuary() || unitOrOwner->IsInSanctuary()) + && (!bySpell || bySpell->HasAttribute(SPELL_ATTR8_IGNORE_SANCTUARY))) return false; // additional checks - only PvP case @@ -3210,7 +3215,7 @@ bool WorldObject::IsValidAssistTarget(WorldObject const* target, SpellInfo const return false; // can't assist player out of sanctuary from sanctuary if has pvp enabled - if (unitTarget->IsPvP()) + if (unitTarget->IsPvP() && (!bySpell || bySpell->HasAttribute(SPELL_ATTR8_IGNORE_SANCTUARY))) if (unit->IsInSanctuary() && !unitTarget->IsInSanctuary()) return false; } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 62a1dc258d5..4a780774155 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -25138,7 +25138,7 @@ bool Player::HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item cons } case ITEM_CLASS_ARMOR: { - if (!spellInfo->HasAttribute(SPELL_ATTR8_ARMOR_SPECIALIZATION)) + if (!spellInfo->HasAttribute(SPELL_ATTR8_REQUIRES_EQUIPPED_INV_TYPES)) { // most used check: shield only if (spellInfo->EquippedItemSubClassMask & (1 << ITEM_SUBCLASS_ARMOR_SHIELD)) @@ -29301,15 +29301,15 @@ Difficulty Player::CheckLoadedLegacyRaidDifficultyID(Difficulty difficulty) return difficulty; } -SpellInfo const* Player::GetCastSpellInfo(SpellInfo const* spellInfo) const +SpellInfo const* Player::GetCastSpellInfo(SpellInfo const* spellInfo, TriggerCastFlags& triggerFlag) const { auto overrides = m_overrideSpells.find(spellInfo->Id); if (overrides != m_overrideSpells.end()) for (uint32 spellId : overrides->second) if (SpellInfo const* newInfo = sSpellMgr->GetSpellInfo(spellId, GetMap()->GetDifficultyID())) - return Unit::GetCastSpellInfo(newInfo); + return Unit::GetCastSpellInfo(newInfo, triggerFlag); - return Unit::GetCastSpellInfo(spellInfo); + return Unit::GetCastSpellInfo(spellInfo, triggerFlag); } void Player::AddOverrideSpell(uint32 overridenSpellId, uint32 newSpellId) diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 52cf7d7ffa7..6709fa70617 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1780,7 +1780,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player> void SendRemoveControlBar() const; bool HasSpell(uint32 spell) const override; bool HasActiveSpell(uint32 spell) const; // show in spellbook - SpellInfo const* GetCastSpellInfo(SpellInfo const* spellInfo) const override; + SpellInfo const* GetCastSpellInfo(SpellInfo const* spellInfo, TriggerCastFlags& triggerFlag) const override; bool IsSpellFitByClassAndRace(uint32 spell_id) const; bool HandlePassiveSpellLearn(SpellInfo const* spellInfo); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index d5e611f4906..da0b51eeb5b 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -2469,7 +2469,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spellInfo bool canDodge = !spellInfo->HasAttribute(SPELL_ATTR7_NO_ATTACK_DODGE); bool canParry = !spellInfo->HasAttribute(SPELL_ATTR7_NO_ATTACK_PARRY); - bool canBlock = true; // all melee and ranged attacks can be blocked + bool canBlock = !spellInfo->HasAttribute(SPELL_ATTR8_NO_ATTACK_BLOCK); // if victim is casting or cc'd it can't avoid attacks if (victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED)) @@ -13714,16 +13714,23 @@ void Unit::Whisper(uint32 textId, Player* target, bool isBossWhisper /*= false*/ target->SendDirectMessage(packet.Write()); } -SpellInfo const* Unit::GetCastSpellInfo(SpellInfo const* spellInfo) const +SpellInfo const* Unit::GetCastSpellInfo(SpellInfo const* spellInfo, TriggerCastFlags& triggerFlag) const { - auto findMatchingAuraEffectIn = [this, spellInfo](AuraType type) -> SpellInfo const* + auto findMatchingAuraEffectIn = [this, spellInfo, &triggerFlag](AuraType type) -> SpellInfo const* { for (AuraEffect const* auraEffect : GetAuraEffectsByType(type)) { bool matches = auraEffect->GetMiscValue() ? uint32(auraEffect->GetMiscValue()) == spellInfo->Id : auraEffect->IsAffectingSpell(spellInfo); if (matches) + { if (SpellInfo const* newInfo = sSpellMgr->GetSpellInfo(auraEffect->GetAmount(), GetMap()->GetDifficultyID())) + { + if (auraEffect->GetSpellInfo()->HasAttribute(SPELL_ATTR8_IGNORE_SPELLCAST_OVERRIDE_COST)) + triggerFlag |= TRIGGERED_IGNORE_POWER_AND_REAGENT_COST; + return newInfo; + } + } } return nullptr; diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 04be57e1837..2d4d482de45 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1550,7 +1550,7 @@ class TC_GAME_API Unit : public WorldObject Spell* GetCurrentSpell(uint32 spellType) const { return m_currentSpells[spellType]; } Spell* FindCurrentSpellBySpellId(uint32 spell_id) const; int32 GetCurrentSpellCastTime(uint32 spell_id) const; - virtual SpellInfo const* GetCastSpellInfo(SpellInfo const* spellInfo) const; + virtual SpellInfo const* GetCastSpellInfo(SpellInfo const* spellInfo, TriggerCastFlags& triggerFlag) const; uint32 GetCastSpellXSpellVisualId(SpellInfo const* spellInfo) const override; virtual bool HasSpellFocus(Spell const* /*focusSpell*/ = nullptr) const { return false; } |
