* Apply aura SPELL_AURA_ABILITY_IGNORE_AURASTATE for damage bonuses.
--HG-- branch : trunk
This commit is contained in:
+11
-14
@@ -3515,23 +3515,24 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
}
|
||||
}
|
||||
|
||||
bool reqAuraState=true;
|
||||
bool reqCombat=true;
|
||||
Unit::AuraList const& stateAuras = m_caster->GetAurasByType(SPELL_AURA_ABILITY_IGNORE_AURASTATE);
|
||||
for(Unit::AuraList::const_iterator j = stateAuras.begin();j != stateAuras.end(); ++j)
|
||||
{
|
||||
if((*j)->isAffectedOnSpell(m_spellInfo))
|
||||
{
|
||||
reqAuraState=false;
|
||||
if ((*j)->GetModifier()->m_miscvalue==1)
|
||||
{
|
||||
reqCombat=false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (reqAuraState)
|
||||
{
|
||||
// caster state requirements
|
||||
if(m_spellInfo->CasterAuraState && !m_caster->HasAuraState(AuraState(m_spellInfo->CasterAuraState)))
|
||||
if(m_spellInfo->CasterAuraState && !m_caster->HasAuraState(AuraState(m_spellInfo->CasterAuraState), m_spellInfo, m_caster))
|
||||
return SPELL_FAILED_CASTER_AURASTATE;
|
||||
if(m_spellInfo->CasterAuraStateNot && m_caster->HasAuraState(AuraState(m_spellInfo->CasterAuraStateNot)))
|
||||
if(m_spellInfo->CasterAuraStateNot && m_caster->HasAuraState(AuraState(m_spellInfo->CasterAuraStateNot), m_spellInfo, m_caster))
|
||||
return SPELL_FAILED_CASTER_AURASTATE;
|
||||
|
||||
if(m_spellInfo->casterAuraSpell && !m_caster->HasAura(m_spellInfo->casterAuraSpell))
|
||||
@@ -3539,10 +3540,8 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
if(m_spellInfo->excludeCasterAuraSpell && m_caster->HasAura(m_spellInfo->excludeCasterAuraSpell))
|
||||
return SPELL_FAILED_CASTER_AURASTATE;
|
||||
|
||||
if(m_caster->isInCombat() && IsNonCombatSpell(m_spellInfo))
|
||||
if(reqCombat && m_caster->isInCombat() && IsNonCombatSpell(m_spellInfo))
|
||||
return SPELL_FAILED_AFFECTING_COMBAT;
|
||||
}
|
||||
|
||||
|
||||
// cancel autorepeat spells if cast start when moving
|
||||
// (not wand currently autorepeat cast delayed to moving stop anyway in spell update code)
|
||||
@@ -3556,10 +3555,9 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
|
||||
if(Unit *target = m_targets.getUnitTarget())
|
||||
{
|
||||
if (reqAuraState)
|
||||
{
|
||||
|
||||
// target state requirements (not allowed state), apply to self also
|
||||
if(m_spellInfo->TargetAuraStateNot && target->HasAuraState(AuraState(m_spellInfo->TargetAuraStateNot)))
|
||||
if(m_spellInfo->TargetAuraStateNot && target->HasAuraState(AuraState(m_spellInfo->TargetAuraStateNot), m_spellInfo, m_caster))
|
||||
return SPELL_FAILED_TARGET_AURASTATE;
|
||||
|
||||
if(m_spellInfo->targetAuraSpell && !target->HasAura(m_spellInfo->targetAuraSpell))
|
||||
@@ -3567,12 +3565,11 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
|
||||
if(m_spellInfo->excludeTargetAuraSpell && target->HasAura(m_spellInfo->excludeTargetAuraSpell))
|
||||
return SPELL_FAILED_TARGET_AURASTATE;
|
||||
}
|
||||
|
||||
if(target != m_caster)
|
||||
{
|
||||
// target state requirements (apply to non-self only), to allow cast affects to self like Dirty Deeds
|
||||
if(reqAuraState && m_spellInfo->TargetAuraState && !target->HasAuraState(AuraState(m_spellInfo->TargetAuraState)))
|
||||
if(m_spellInfo->TargetAuraState && !target->HasAuraState(AuraState(m_spellInfo->TargetAuraState), m_spellInfo, m_caster))
|
||||
return SPELL_FAILED_TARGET_AURASTATE;
|
||||
|
||||
// Not allow casting on flying player
|
||||
|
||||
@@ -437,7 +437,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
|
||||
if((m_spellInfo->SpellFamilyFlags[1] & 0x000040) && m_spellInfo->SpellIconID==2128)
|
||||
{
|
||||
// Incinerate does more dmg (dmg*0.25) if the target is Immolated.
|
||||
if(unitTarget->HasAuraState(AURA_STATE_IMMOLATE))
|
||||
if(unitTarget->HasAuraState(AURA_STATE_IMMOLATE, m_spellInfo, m_caster))
|
||||
damage += int32(damage*0.25f);
|
||||
}
|
||||
// Haunt
|
||||
@@ -2606,7 +2606,7 @@ void Spell::SpellDamageHeal(uint32 /*i*/)
|
||||
addhealth += damageAmount;
|
||||
}
|
||||
// Swiftmend - consumes Regrowth or Rejuvenation
|
||||
else if (m_spellInfo->TargetAuraState == AURA_STATE_SWIFTMEND && unitTarget->HasAuraState(AURA_STATE_SWIFTMEND))
|
||||
else if (m_spellInfo->TargetAuraState == AURA_STATE_SWIFTMEND && unitTarget->HasAuraState(AURA_STATE_SWIFTMEND, m_spellInfo, m_caster))
|
||||
{
|
||||
Unit::AuraList const& RejorRegr = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_HEAL);
|
||||
// find most short by duration
|
||||
@@ -4411,7 +4411,7 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
|
||||
{
|
||||
bool found = false;
|
||||
// fast check
|
||||
if(unitTarget->HasAuraState(AURA_STATE_DEADLY_POISON))
|
||||
if(unitTarget->HasAuraState(AURA_STATE_DEADLY_POISON, m_spellInfo, m_caster))
|
||||
found = true;
|
||||
// full aura scan
|
||||
else
|
||||
|
||||
+21
-9
@@ -8145,6 +8145,18 @@ void Unit::ModifyAuraState(AuraState flag, bool apply)
|
||||
ApplyModFlag(UNIT_FIELD_AURASTATE, 1<<(flag-1), apply);
|
||||
}
|
||||
|
||||
bool Unit::HasAuraState(AuraState flag, SpellEntry const *spellProto, Unit * Caster) const
|
||||
{
|
||||
if (Caster && spellProto)
|
||||
{
|
||||
AuraList const& stateAuras = Caster->GetAurasByType(SPELL_AURA_ABILITY_IGNORE_AURASTATE);
|
||||
for(AuraList::const_iterator j = stateAuras.begin();j != stateAuras.end(); ++j)
|
||||
if((*j)->isAffectedOnSpell(spellProto))
|
||||
return true;
|
||||
}
|
||||
return HasFlag(UNIT_FIELD_AURASTATE, 1<<(flag-1));
|
||||
}
|
||||
|
||||
Unit *Unit::GetOwner() const
|
||||
{
|
||||
uint64 ownerid = GetOwnerGUID();
|
||||
@@ -8399,7 +8411,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
|
||||
case 6926:
|
||||
case 6928:
|
||||
{
|
||||
if(pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT))
|
||||
if(pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
|
||||
DoneTotalMod *= (100.0f+(*i)->GetModifier()->m_amount)/100.0f;
|
||||
break;
|
||||
}
|
||||
@@ -8432,7 +8444,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
|
||||
case 6916: // Death's Embrace
|
||||
case 6925:
|
||||
case 6927:
|
||||
if (HasAuraState(AURA_STATE_HEALTHLESS_20_PERCENT))
|
||||
if (HasAuraState(AURA_STATE_HEALTHLESS_20_PERCENT, spellProto, this))
|
||||
DoneTotalMod *= (100.0f+(*i)->GetModifier()->m_amount)/100.0f;
|
||||
break;
|
||||
case 5481: // Starfire Bonus
|
||||
@@ -8459,7 +8471,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
|
||||
// Merciless Combat
|
||||
if ((*i)->GetSpellProto()->SpellIconID == 2656)
|
||||
{
|
||||
if(pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT))
|
||||
if(pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
|
||||
DoneTotalMod *= (100.0f+(*i)->GetModifier()->m_amount)/100.0f;
|
||||
}
|
||||
else // Tundra Stalker
|
||||
@@ -8694,7 +8706,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
|
||||
// Ice Lance
|
||||
if (spellProto->SpellFamilyName == SPELLFAMILY_MAGE && spellProto->SpellIconID == 186)
|
||||
{
|
||||
if (pVictim->isFrozen())
|
||||
if (pVictim->HasAuraState(AURA_STATE_FROZEN, spellProto, this))
|
||||
DoneTotalMod *= 3.0f;
|
||||
}
|
||||
|
||||
@@ -8954,11 +8966,11 @@ 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: if (pVictim->HasAuraState(AURA_STATE_FROZEN, spellProto, this)) crit_chance+= 17.0f; break; //Shatter Rank 1
|
||||
case 910: if (pVictim->HasAuraState(AURA_STATE_FROZEN, spellProto, this)) crit_chance+= 34.0f; break; //Shatter Rank 2
|
||||
case 911: if (pVictim->HasAuraState(AURA_STATE_FROZEN, spellProto, this)) crit_chance+= 50.0f; break; //Shatter Rank 3
|
||||
case 7917: // Glyph of Shadowburn
|
||||
if (pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT))
|
||||
if (pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
|
||||
crit_chance+=(*i)->GetModifier()->m_amount;
|
||||
break;
|
||||
case 7997: // Renewed Hope
|
||||
@@ -9666,7 +9678,7 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT
|
||||
switch((*i)->GetMiscValue())
|
||||
{
|
||||
case 6427: case 6428: // Dirty Deeds
|
||||
if(pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT))
|
||||
if(pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
|
||||
{
|
||||
Aura* eff0 = GetAura((*i)->GetId(),0);
|
||||
if(!eff0 || (*i)->GetEffIndex()!=1)
|
||||
|
||||
+1
-1
@@ -1443,7 +1443,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
|
||||
uint32 CalculateDamage(WeaponAttackType attType, bool normalized);
|
||||
float GetAPMultiplier(WeaponAttackType attType, bool normalized);
|
||||
void ModifyAuraState(AuraState flag, bool apply);
|
||||
bool HasAuraState(AuraState flag) const { return HasFlag(UNIT_FIELD_AURASTATE, 1<<(flag-1)); }
|
||||
bool HasAuraState(AuraState flag, SpellEntry const *spellProto = NULL, Unit * Caster = NULL) const ;
|
||||
void UnsummonAllTotems();
|
||||
int32 SpellBaseDamageBonus(SpellSchoolMask schoolMask);
|
||||
int32 SpellBaseHealingBonus(SpellSchoolMask schoolMask);
|
||||
|
||||
Reference in New Issue
Block a user