*Always remove aura when charge becomes 0 in dropcharge.
--HG-- branch : trunk
This commit is contained in:
@@ -1260,14 +1260,16 @@ void Aura::SetAuraCharges(uint8 charges)
|
|||||||
SendAuraUpdate();
|
SendAuraUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Aura::DropAuraCharge()
|
void Aura::DropAuraCharge()
|
||||||
{
|
{
|
||||||
if (m_procCharges == 0)
|
if(m_procCharges) //auras without charges always have charge = 0
|
||||||
return false;
|
{
|
||||||
m_procCharges--;
|
--m_procCharges;
|
||||||
|
if(m_procCharges) // Send charge change
|
||||||
SendAuraUpdate();
|
SendAuraUpdate();
|
||||||
// return true if last charge dropped
|
else // Last charge dropped
|
||||||
return m_procCharges == 0;
|
m_target->RemoveAura(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Aura::IsPersistent() const
|
bool Aura::IsPersistent() const
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ class TRINITY_DLL_SPEC Aura
|
|||||||
void SetAuraSlot(uint8 slot) { m_auraSlot = slot; }
|
void SetAuraSlot(uint8 slot) { m_auraSlot = slot; }
|
||||||
uint8 GetAuraCharges() const { return m_procCharges; }
|
uint8 GetAuraCharges() const { return m_procCharges; }
|
||||||
void SetAuraCharges(uint8 charges);
|
void SetAuraCharges(uint8 charges);
|
||||||
bool DropAuraCharge();
|
void DropAuraCharge();
|
||||||
void SetProcDamage(uint32 val) { m_procDamage = val; }
|
void SetProcDamage(uint32 val) { m_procDamage = val; }
|
||||||
uint32 GetProcDamage() const { return m_procDamage; }
|
uint32 GetProcDamage() const { return m_procDamage; }
|
||||||
|
|
||||||
|
|||||||
+15
-15
@@ -6297,8 +6297,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
|
|||||||
{
|
{
|
||||||
uint32 spell = (*itr)->GetSpellProto()->EffectTriggerSpell[(*itr)->GetEffIndex()];
|
uint32 spell = (*itr)->GetSpellProto()->EffectTriggerSpell[(*itr)->GetEffIndex()];
|
||||||
CastSpell(this, spell, true, castItem, triggeredByAura);
|
CastSpell(this, spell, true, castItem, triggeredByAura);
|
||||||
if ((*itr)->GetParentAura()->DropAuraCharge())
|
(*itr)->GetParentAura()->DropAuraCharge();
|
||||||
RemoveAurasDueToSpell((*itr)->GetId());
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6382,8 +6381,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
CastSpell(this, spell, true, castItem, triggeredByAura);
|
CastSpell(this, spell, true, castItem, triggeredByAura);
|
||||||
if ((*itr)->GetParentAura()->DropAuraCharge())
|
(*itr)->GetParentAura()->DropAuraCharge();
|
||||||
RemoveAurasDueToSpell((*itr)->GetId());
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8190,24 +8188,28 @@ Unit* Unit::SelectMagnetTarget(Unit *victim, SpellEntry const *spellInfo)
|
|||||||
if(spellInfo->DmgClass == SPELL_DAMAGE_CLASS_NONE)
|
if(spellInfo->DmgClass == SPELL_DAMAGE_CLASS_NONE)
|
||||||
return victim;
|
return victim;
|
||||||
|
|
||||||
//if((*itr)->GetParentAura()->DropAuraCharge())
|
Unit::AuraEffectList const& magnetAuras = victim->GetAurasByType(SPELL_AURA_SPELL_MAGNET);
|
||||||
|
for(Unit::AuraEffectList::const_iterator itr = magnetAuras.begin(); itr != magnetAuras.end(); ++itr)
|
||||||
Unit::AuraList const& magnetAuras = victim->GetAurasByType(SPELL_AURA_SPELL_MAGNET);
|
|
||||||
for(Unit::AuraList::const_iterator itr = magnetAuras.begin(); itr != magnetAuras.end(); ++itr)
|
|
||||||
if(Unit* magnet = (*itr)->GetCaster())
|
if(Unit* magnet = (*itr)->GetCaster())
|
||||||
if(magnet->isAlive())
|
if(magnet->isAlive())
|
||||||
|
{
|
||||||
|
(*itr)->GetParentAura()->DropAuraCharge();
|
||||||
return magnet;
|
return magnet;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Melee && ranged case
|
// Melee && ranged case
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AuraList const& hitTriggerAuras = victim->GetAurasByType(SPELL_AURA_ADD_CASTER_HIT_TRIGGER);
|
AuraEffectList const& hitTriggerAuras = victim->GetAurasByType(SPELL_AURA_ADD_CASTER_HIT_TRIGGER);
|
||||||
for(AuraList::const_iterator i = hitTriggerAuras.begin(); i != hitTriggerAuras.end(); ++i)
|
for(AuraEffectList::const_iterator i = hitTriggerAuras.begin(); i != hitTriggerAuras.end(); ++i)
|
||||||
if(Unit* magnet = (*i)->GetCaster())
|
if(Unit* magnet = (*i)->GetCaster())
|
||||||
if(magnet->isAlive() && magnet->IsWithinLOSInMap(this))
|
if(magnet->isAlive() && magnet->IsWithinLOSInMap(this))
|
||||||
if(roll_chance_i((*i)->GetModifier()->m_amount))
|
if(roll_chance_i((*i)->GetAmount()))
|
||||||
|
{
|
||||||
|
(*i)->GetParentAura()->DropAuraCharge();
|
||||||
return magnet;
|
return magnet;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return victim;
|
return victim;
|
||||||
}
|
}
|
||||||
@@ -8820,8 +8822,7 @@ bool Unit::isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM
|
|||||||
// Fingers of Frost
|
// Fingers of Frost
|
||||||
// TODO: Change this code to less hacky
|
// TODO: Change this code to less hacky
|
||||||
if (Aura * aur = GetAura(44544))
|
if (Aura * aur = GetAura(44544))
|
||||||
if (aur->DropAuraCharge())
|
aur->DropAuraCharge();
|
||||||
RemoveAura(aur);
|
|
||||||
break;
|
break;
|
||||||
case 7917: // Glyph of Shadowburn
|
case 7917: // Glyph of Shadowburn
|
||||||
if (pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
|
if (pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
|
||||||
@@ -11805,8 +11806,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
|
|||||||
// Remove charge (aura can be removed by triggers)
|
// Remove charge (aura can be removed by triggers)
|
||||||
if(useCharges && takeCharges)
|
if(useCharges && takeCharges)
|
||||||
{
|
{
|
||||||
if (i->aura->DropAuraCharge())
|
i->aura->DropAuraCharge();
|
||||||
RemoveAura(i->aura);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1174,6 +1174,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
|
|||||||
uint32 SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage, bool isTriggeredSpell = false, bool useSpellDamage = true);
|
uint32 SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage, bool isTriggeredSpell = false, bool useSpellDamage = true);
|
||||||
void CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
|
void CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
|
||||||
void CastSpell(Unit* Victim, SpellEntry const *spellInfo, bool triggered, Item *castItem= NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
|
void CastSpell(Unit* Victim, SpellEntry const *spellInfo, bool triggered, Item *castItem= NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
|
||||||
|
void CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
|
||||||
void CastCustomSpell(Unit* Victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem= NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
|
void CastCustomSpell(Unit* Victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem= NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
|
||||||
void CastCustomSpell(uint32 spellId, SpellValueMod mod, uint32 value, Unit* Victim = NULL, bool triggered = true, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
|
void CastCustomSpell(uint32 spellId, SpellValueMod mod, uint32 value, Unit* Victim = NULL, bool triggered = true, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
|
||||||
void CastCustomSpell(uint32 spellId, CustomSpellValues const &value, Unit* Victim = NULL, bool triggered = true, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
|
void CastCustomSpell(uint32 spellId, CustomSpellValues const &value, Unit* Victim = NULL, bool triggered = true, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user