[7523] Fixed: players will now drop flag in battleground if they cast immunity buff on themselves.

TODO: players who carry flag in bg are imune to immunity buffs casted by friendly players. (todo added to code).
Bug: if paladin casts Hand of protection on flag carrier - flag will be dropped, but he should get "target is immune" message.
Fixed: Do not call Battleground::Update for battleground template objects.
Fixed: Do not allow immune player to click on object in battleground (not sure if this is correct in all cases).

Signed-off-by: Triply <triply@getmangos.com>
This commit is contained in:
`win 2009-03-23 10:12:15 +01:00 committed by Triply
parent 3d6c7e59a7
commit 0f6b2ab9ae
10 changed files with 91 additions and 103 deletions

View file

@ -18794,6 +18794,7 @@ void Player::SummonIfPossible(bool agree)
}
// drop flag at summon
// this code can be reached only when GM is summoning player who carries flag, because player should be immune to summoning spells when he carries flag
if(BattleGround *bg = GetBattleGround())
bg->EventPlayerDroppedFlag(this);
@ -19440,6 +19441,7 @@ bool Player::CanUseBattleGroundObject()
return ( //InBattleGround() && // in battleground - not need, check in other cases
//!IsMounted() && - not correct, player is dismounted when he clicks on flag
//i'm not sure if these two are correct, because invisible players should get visible when they click on flag
!isTotalImmune() && // not totally immune
!HasStealthAura() && // not stealthed
!HasInvisibilityAura() && // not invisible
!HasAura(SPELL_RECENTLY_DROPPED_FLAG, 0) && // can't pickup
@ -19607,6 +19609,20 @@ void Player::ExitVehicle(Vehicle *vehicle)
CastSpell(this, 45472, true); // Parachute
}
bool Player::isTotalImmune()
{
AuraList const& immune = GetAurasByType(SPELL_AURA_SCHOOL_IMMUNITY);
uint32 immuneMask = 0;
for(AuraList::const_iterator itr = immune.begin(); itr != immune.end(); ++itr)
{
immuneMask |= (*itr)->GetModifier()->m_miscvalue;
if( immuneMask & SPELL_SCHOOL_MASK_ALL ) // total immunity
return true;
}
return false;
}
bool Player::HasTitle(uint32 bitIndex)
{
if (bitIndex > 128)