*Update to Mangos 6995.

--HG--
branch : trunk
This commit is contained in:
megamage
2008-12-31 10:05:45 -06:00
parent ba58ddac9c
commit 9149d6aa94
8 changed files with 74 additions and 49 deletions

View File

@@ -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