[10762] Implement SPELL_AURA_IGNORE_UNIT_STATE (252).

Original patch provided by Wojta

Note: From patch excluded talent 44543 and ranks stacking code.
      It look like need another implemention different from suggested,
      or at least more research.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>

In patch added enum IgnoreUnitState and related checks now more cheating protected.
This commit is contained in:
insider42 2010-11-21 01:36:18 +03:00 committed by VladimirMangos
parent 16cd545df8
commit f7b4b88e02
11 changed files with 70 additions and 20 deletions

View file

@ -6329,7 +6329,7 @@ uint32 Unit::SpellDamageBonusDone(Unit *pVictim, SpellEntry const *spellProto, u
// Ice Lance
if (spellProto->SpellIconID == 186)
{
if (pVictim->isFrozen())
if (pVictim->isFrozen() || IsIgnoreUnitState(spellProto, IGNORE_UNIT_TARGET_NON_FROZEN))
{
float multiplier = 3.0f;
@ -6626,9 +6626,18 @@ bool Unit::IsSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM
continue;
switch((*i)->GetModifier()->m_miscvalue)
{
case 849: if (pVictim->isFrozen()) crit_chance+= 17.0f; break; //Shatter Rank 1
case 910: if (pVictim->isFrozen()) crit_chance+= 34.0f; break; //Shatter Rank 2
case 911: if (pVictim->isFrozen()) crit_chance+= 50.0f; break; //Shatter Rank 3
case 849: //Shatter Rank 1
if (pVictim->isFrozen() || IsIgnoreUnitState(spellProto, IGNORE_UNIT_TARGET_NON_FROZEN))
crit_chance+= 17.0f;
break;
case 910: //Shatter Rank 2
if (pVictim->isFrozen() || IsIgnoreUnitState(spellProto, IGNORE_UNIT_TARGET_NON_FROZEN))
crit_chance+= 34.0f;
break;
case 911: //Shatter Rank 3
if (pVictim->isFrozen() || IsIgnoreUnitState(spellProto, IGNORE_UNIT_TARGET_NON_FROZEN))
crit_chance+= 50.0f;
break;
case 7917: // Glyph of Shadowburn
if (pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT))
crit_chance+=(*i)->GetModifier()->m_amount;
@ -10693,6 +10702,25 @@ void Unit::StopAttackFaction(uint32 faction_id)
CallForAllControlledUnits(StopAttackFactionHelper(faction_id), CONTROLLED_PET|CONTROLLED_GUARDIANS|CONTROLLED_CHARM);
}
bool Unit::IsIgnoreUnitState(SpellEntry const *spell, IgnoreUnitState ignoreState)
{
Unit::AuraList const& stateAuras = GetAurasByType(SPELL_AURA_IGNORE_UNIT_STATE);
for(Unit::AuraList::const_iterator itr = stateAuras.begin(); itr != stateAuras.end(); ++itr)
{
if ((*itr)->GetModifier()->m_miscvalue == ignoreState)
{
// frozen state absent ignored for all spells
if (ignoreState == IGNORE_UNIT_TARGET_NON_FROZEN)
return true;
if ((*itr)->isAffectedOnSpell(spell))
return true;
}
}
return false;
}
void Unit::CleanupDeletedAuras()
{
for (SpellAuraHolderList::const_iterator iter = m_deletedHolders.begin(); iter != m_deletedHolders.end(); ++iter)