diff options
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r-- | src/game/Unit.cpp | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 56284ca5f6b..5526e3a7002 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -72,20 +72,6 @@ static bool isNonTriggerAura[TOTAL_AURAS]; // Prepare lists static bool procPrepared = InitTriggerAuraData(); -bool IsPassiveStackableSpell( uint32 spellId ) -{ - if(!IsPassiveSpell(spellId)) - return false; - - SpellEntry const* spellProto = sSpellStore.LookupEntry(spellId); - if(!spellProto) - return false; - if (spellProto->procFlags) - return false; - - return true; -} - Unit::Unit() : WorldObject(), i_motionMaster(this), m_ThreatManager(this), m_HostilRefManager(this) , m_IsInNotifyList(false), m_Notified(false) @@ -2293,6 +2279,12 @@ bool Unit::isSpellBlocked(Unit *pVictim, SpellEntry const *spellProto, WeaponAtt return false; } */ + + // Check creatures flags_extra for disable block + if(pVictim->GetTypeId()==TYPEID_UNIT && + ((Creature*)pVictim)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK ) + return false; + float blockChance = GetUnitBlockChance(); blockChance += (GetWeaponSkillValue(attackType) - pVictim->GetMaxSkillValueForLevel() )*0.04; if (roll_chance_f(blockChance)) @@ -2387,7 +2379,13 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit *pVictim, SpellEntry const *spell) // Can`t parry canParry = false; } - + // Check creatures flags_extra for disable parry + if(pVictim->GetTypeId()==TYPEID_UNIT) + { + uint32 flagEx = ((Creature*)pVictim)->GetCreatureInfo()->flags_extra; + if( flagEx & CREATURE_FLAG_EXTRA_NO_PARRY ) + canParry = false; + } // Ignore combat result aura AuraList const& ignore = GetAurasByType(SPELL_AURA_IGNORE_COMBAT_RESULT); for(AuraList::const_iterator i = ignore.begin(); i != ignore.end(); ++i) @@ -3410,9 +3408,8 @@ bool Unit::AddAura(Aura *Aur) } } - // passive auras stack with all (except passive spell proc auras) - if ((!Aur->IsPassive() || !IsPassiveStackableSpell(Aur->GetId())) && - !(Aur->GetId() == 20584 || Aur->GetId() == 8326)) + // passive auras not stacable with other ranks + if (!IsPassiveSpellStackableWithRanks(aurSpellInfo)) { if (!RemoveNoStackAurasDueToAura(Aur)) { @@ -3516,6 +3513,14 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur) return false; uint32 spellId = Aur->GetId(); + + // passive spell special case (only non stackable with ranks) + if(IsPassiveSpell(spellId)) + { + if(IsPassiveSpellStackableWithRanks(spellProto)) + return true; + } + uint32 effIndex = Aur->GetEffIndex(); SpellSpecific spellId_spec = GetSpellSpecific(spellId); @@ -3534,9 +3539,11 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur) uint32 i_spellId = i_spellProto->Id; + // early checks that spellId is passive non stackable spell if(IsPassiveSpell(i_spellId)) { - if(IsPassiveStackableSpell(i_spellId)) + // passive non-stackable spells not stackable only for same caster + if(Aur->GetCasterGUID()!=i->second->GetCasterGUID()) continue; // passive non-stackable spells not stackable only with another rank of same spell @@ -6443,7 +6450,7 @@ bool Unit::IsHostileTo(Unit const* unit) const return false; // PvP FFA state - if(pTester->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_FFA_PVP) && pTarget->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_FFA_PVP)) + if(pTester->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP) && pTarget->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP)) return true; //= PvP states @@ -6552,7 +6559,7 @@ bool Unit::IsFriendlyTo(Unit const* unit) const return true; // PvP FFA state - if(pTester->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_FFA_PVP) && pTarget->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_FFA_PVP)) + if(pTester->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP) && pTarget->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP)) return false; //= PvP states |