mirror of
https://github.com/mangosfour/server.git
synced 2025-12-17 07:37:03 +00:00
[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:
parent
3d6c7e59a7
commit
0f6b2ab9ae
10 changed files with 91 additions and 103 deletions
|
|
@ -3306,6 +3306,7 @@ void Aura::HandleFeignDeath(bool apply, bool Real)
|
|||
|
||||
m_target->addUnitState(UNIT_STAT_DIED);
|
||||
m_target->CombatStop();
|
||||
m_target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
|
||||
|
||||
// prevent interrupt message
|
||||
if(m_caster_guid==m_target->GetGUID() && m_target->m_currentSpells[CURRENT_GENERIC_SPELL])
|
||||
|
|
@ -3488,9 +3489,7 @@ void Aura::HandleModStealth(bool apply, bool Real)
|
|||
if(apply)
|
||||
{
|
||||
// drop flag at stealth in bg
|
||||
if(Real && m_target->GetTypeId()==TYPEID_PLAYER && ((Player*)m_target)->InBattleGround())
|
||||
if(BattleGround *bg = ((Player*)m_target)->GetBattleGround())
|
||||
bg->EventPlayerDroppedFlag((Player*)m_target);
|
||||
m_target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
|
||||
|
||||
// only at real aura add
|
||||
if(Real)
|
||||
|
|
@ -3555,15 +3554,13 @@ void Aura::HandleInvisibility(bool apply, bool Real)
|
|||
{
|
||||
m_target->m_invisibilityMask |= (1 << m_modifier.m_miscvalue);
|
||||
|
||||
m_target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
|
||||
|
||||
if(Real && m_target->GetTypeId()==TYPEID_PLAYER)
|
||||
{
|
||||
// apply glow vision
|
||||
m_target->SetFlag(PLAYER_FIELD_BYTES2,PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW);
|
||||
|
||||
// drop flag at invisible in bg
|
||||
if(((Player*)m_target)->InBattleGround())
|
||||
if(BattleGround *bg = ((Player*)m_target)->GetBattleGround())
|
||||
bg->EventPlayerDroppedFlag((Player*)m_target);
|
||||
}
|
||||
|
||||
// apply only if not in GM invisibility and not stealth
|
||||
|
|
@ -4010,44 +4007,15 @@ void Aura::HandleModMechanicImmunity(bool apply, bool Real)
|
|||
}
|
||||
}
|
||||
|
||||
//this method is called whenever we add / remove aura which gives m_target some imunity to some spell effect
|
||||
void Aura::HandleAuraModEffectImmunity(bool apply, bool Real)
|
||||
{
|
||||
if(!apply)
|
||||
// when removing flag aura, handle flag drop
|
||||
if( !apply && m_target->GetTypeId() == TYPEID_PLAYER
|
||||
&& (GetSpellProto()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION) )
|
||||
{
|
||||
if(m_target->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if(((Player*)m_target)->InBattleGround())
|
||||
{
|
||||
BattleGround *bg = ((Player*)m_target)->GetBattleGround();
|
||||
if(bg)
|
||||
{
|
||||
switch(bg->GetTypeID())
|
||||
{
|
||||
case BATTLEGROUND_AV:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case BATTLEGROUND_WS:
|
||||
{
|
||||
// Warsong Flag, horde // Silverwing Flag, alliance
|
||||
if(GetId() == 23333 || GetId() == 23335)
|
||||
bg->EventPlayerDroppedFlag(((Player*)m_target));
|
||||
break;
|
||||
}
|
||||
case BATTLEGROUND_AB:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case BATTLEGROUND_EY:
|
||||
{
|
||||
if(GetId() == 34976)
|
||||
bg->EventPlayerDroppedFlag(((Player*)m_target));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if( BattleGround *bg = ((Player*)m_target)->GetBattleGround() )
|
||||
bg->EventPlayerDroppedFlag(((Player*)m_target));
|
||||
}
|
||||
|
||||
m_target->ApplySpellImmune(GetId(),IMMUNITY_EFFECT,m_modifier.m_miscvalue,apply);
|
||||
|
|
@ -4077,28 +4045,33 @@ void Aura::HandleAuraModSchoolImmunity(bool apply, bool Real)
|
|||
{
|
||||
m_target->ApplySpellImmune(GetId(),IMMUNITY_SCHOOL,m_modifier.m_miscvalue,apply);
|
||||
|
||||
if(Real && apply && GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY)
|
||||
// remove all flag auras (they are positive, but they must be removed when you are immune)
|
||||
if( this->GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY
|
||||
&& this->GetSpellProto()->AttributesEx2 & SPELL_ATTR_EX2_DAMAGE_REDUCED_SHIELD )
|
||||
m_target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
|
||||
|
||||
// TODO: optimalize this cycle - use RemoveAurasWithInterruptFlags call or something else
|
||||
if( Real && apply
|
||||
&& GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY
|
||||
&& IsPositiveSpell(GetId()) ) //Only positive immunity removes auras
|
||||
{
|
||||
if(IsPositiveSpell(GetId())) //Only positive immunity removes auras
|
||||
uint32 school_mask = m_modifier.m_miscvalue;
|
||||
Unit::AuraMap& Auras = m_target->GetAuras();
|
||||
for(Unit::AuraMap::iterator iter = Auras.begin(), next; iter != Auras.end(); iter = next)
|
||||
{
|
||||
uint32 school_mask = m_modifier.m_miscvalue;
|
||||
Unit::AuraMap& Auras = m_target->GetAuras();
|
||||
for(Unit::AuraMap::iterator iter = Auras.begin(), next; iter != Auras.end(); iter = next)
|
||||
next = iter;
|
||||
++next;
|
||||
SpellEntry const *spell = iter->second->GetSpellProto();
|
||||
if((GetSpellSchoolMask(spell) & school_mask)//Check for school mask
|
||||
&& !( spell->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) //Spells unaffected by invulnerability
|
||||
&& !iter->second->IsPositive() //Don't remove positive spells
|
||||
&& spell->Id != GetId() ) //Don't remove self
|
||||
{
|
||||
next = iter;
|
||||
++next;
|
||||
SpellEntry const *spell = iter->second->GetSpellProto();
|
||||
if((GetSpellSchoolMask(spell) & school_mask)//Check for school mask
|
||||
&& !( spell->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) //Spells unaffected by invulnerability
|
||||
&& !iter->second->IsPositive() //Don't remove positive spells
|
||||
&& spell->Id != GetId() ) //Don't remove self
|
||||
{
|
||||
m_target->RemoveAurasDueToSpell(spell->Id);
|
||||
if(Auras.empty())
|
||||
break;
|
||||
else
|
||||
next = Auras.begin();
|
||||
}
|
||||
m_target->RemoveAurasDueToSpell(spell->Id);
|
||||
if(Auras.empty())
|
||||
break;
|
||||
else
|
||||
next = Auras.begin();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5559,8 +5532,10 @@ void Aura::HandleAuraRetainComboPoints(bool apply, bool Real)
|
|||
void Aura::HandleModUnattackable( bool Apply, bool Real )
|
||||
{
|
||||
if(Real && Apply)
|
||||
{
|
||||
m_target->CombatStop();
|
||||
|
||||
m_target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
|
||||
}
|
||||
m_target->ApplyModFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE,Apply);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue