[8428] Implement proper amount absorbed damage for spell 62600.

Other change jus move code under "if(apply) else"
This commit is contained in:
VladimirMangos 2009-08-27 14:50:51 +04:00
parent beae3fe00f
commit a3207da3d9
2 changed files with 105 additions and 95 deletions

View file

@ -5981,93 +5981,102 @@ void Aura::HandleSchoolAbsorb(bool apply, bool Real)
if(!caster)
return;
// prevent double apply bonuses
if(apply && (m_target->GetTypeId()!=TYPEID_PLAYER || !((Player*)m_target)->GetSession()->PlayerLoading()))
if (apply)
{
float DoneActualBenefit = 0.0f;
switch(m_spellProto->SpellFamilyName)
// prevent double apply bonuses
if (m_target->GetTypeId()!=TYPEID_PLAYER || !((Player*)m_target)->GetSession()->PlayerLoading())
{
case SPELLFAMILY_PRIEST:
// Power Word: Shield
if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000001))
//+80.68% from +spell bonus
DoneActualBenefit = caster->SpellBaseHealingBonus(GetSpellSchoolMask(m_spellProto)) * 0.8068f;
break;
case SPELLFAMILY_MAGE:
// Frost Ward, Fire Ward
if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000108))
//+10% from +spell bonus
DoneActualBenefit = caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellProto)) * 0.1f;
// Ice Barrier
else if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000100000000))
//+80.67% from +spell bonus
DoneActualBenefit = caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellProto)) * 0.8067f;
break;
case SPELLFAMILY_WARLOCK:
// Shadow Ward
if (m_spellProto->SpellFamilyFlags2 & 0x00000040)
//+30% from +spell bonus
DoneActualBenefit = caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellProto)) * 0.30f;
break;
default:
break;
}
DoneActualBenefit *= caster->CalculateLevelPenalty(GetSpellProto());
m_modifier.m_amount += (int32)DoneActualBenefit;
}
// Ice Barrier (remove effect from Shattered Barrier)
if(!apply && m_spellProto->SpellIconID == 32 && m_spellProto->SpellFamilyName == SPELLFAMILY_MAGE)
{
if (!((m_removeMode == AURA_REMOVE_BY_DEFAULT && !m_modifier.m_amount) || m_removeMode == AURA_REMOVE_BY_DISPEL))
return;
if (m_target->HasAura(44745,0)) // Shattered Barrier, rank 1
{
if(roll_chance_i(50))
m_target->CastSpell(m_target, 55080, true, NULL, this);
}
else if (m_target->HasAura(54787,0)) // Shattered Barrier, rank 2
{
m_target->CastSpell(m_target, 55080, true, NULL, this);
}
}
if (!apply && caster &&
// Power Word: Shield
m_spellProto->SpellFamilyName == SPELLFAMILY_PRIEST && m_spellProto->Mechanic == MECHANIC_SHIELD &&
(m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000001)) &&
// completely absorbed or dispelled
((m_removeMode == AURA_REMOVE_BY_DEFAULT && !m_modifier.m_amount) || m_removeMode == AURA_REMOVE_BY_DISPEL))
{
Unit::AuraList const& vDummyAuras = caster->GetAurasByType(SPELL_AURA_DUMMY);
for(Unit::AuraList::const_iterator itr = vDummyAuras.begin(); itr != vDummyAuras.end(); itr++)
{
SpellEntry const* vSpell = (*itr)->GetSpellProto();
// Rapture (main spell)
if(vSpell->SpellFamilyName == SPELLFAMILY_PRIEST && vSpell->SpellIconID == 2894 && vSpell->Effect[1])
float DoneActualBenefit = 0.0f;
switch(m_spellProto->SpellFamilyName)
{
switch((*itr)->GetEffIndex())
{
case 0:
{
// energize caster
int32 manapct1000 = 5 * ((*itr)->GetModifier()->m_amount + spellmgr.GetSpellRank(vSpell->Id));
int32 basepoints0 = caster->GetMaxPower(POWER_MANA) * manapct1000 / 1000;
caster->CastCustomSpell(caster, 47755, &basepoints0, NULL, NULL, true);
break;
}
case 1:
{
// energize target
if (!roll_chance_i((*itr)->GetModifier()->m_amount) || caster->HasAura(63853))
break;
case SPELLFAMILY_PRIEST:
// Power Word: Shield
if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000001))
//+80.68% from +spell bonus
DoneActualBenefit = caster->SpellBaseHealingBonus(GetSpellSchoolMask(m_spellProto)) * 0.8068f;
break;
case SPELLFAMILY_MAGE:
// Frost Ward, Fire Ward
if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000108))
//+10% from +spell bonus
DoneActualBenefit = caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellProto)) * 0.1f;
// Ice Barrier
else if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000100000000))
//+80.67% from +spell bonus
DoneActualBenefit = caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellProto)) * 0.8067f;
break;
case SPELLFAMILY_WARLOCK:
// Shadow Ward
if (m_spellProto->SpellFamilyFlags2 & 0x00000040)
//+30% from +spell bonus
DoneActualBenefit = caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellProto)) * 0.30f;
break;
case SPELLFAMILY_DRUID:
// Savage Defense (amount store original percent of attack power applied)
if (m_spellProto->SpellIconID == 50) // only spell with this aura fit
m_modifier.m_amount = int32(m_modifier.m_amount * m_target->GetTotalAttackPowerValue(BASE_ATTACK) / 100);
break;
default:
break;
}
switch(m_target->getPowerType())
DoneActualBenefit *= caster->CalculateLevelPenalty(GetSpellProto());
m_modifier.m_amount += (int32)DoneActualBenefit;
}
}
else
{
// Ice Barrier (remove effect from Shattered Barrier)
if (m_spellProto->SpellIconID == 32 && m_spellProto->SpellFamilyName == SPELLFAMILY_MAGE)
{
if (!((m_removeMode == AURA_REMOVE_BY_DEFAULT && !m_modifier.m_amount) || m_removeMode == AURA_REMOVE_BY_DISPEL))
return;
if (m_target->HasAura(44745,0)) // Shattered Barrier, rank 1
{
if(roll_chance_i(50))
m_target->CastSpell(m_target, 55080, true, NULL, this);
}
else if (m_target->HasAura(54787,0)) // Shattered Barrier, rank 2
{
m_target->CastSpell(m_target, 55080, true, NULL, this);
}
}
if (caster &&
// Power Word: Shield
m_spellProto->SpellFamilyName == SPELLFAMILY_PRIEST && m_spellProto->Mechanic == MECHANIC_SHIELD &&
(m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000001)) &&
// completely absorbed or dispelled
((m_removeMode == AURA_REMOVE_BY_DEFAULT && !m_modifier.m_amount) || m_removeMode == AURA_REMOVE_BY_DISPEL))
{
Unit::AuraList const& vDummyAuras = caster->GetAurasByType(SPELL_AURA_DUMMY);
for(Unit::AuraList::const_iterator itr = vDummyAuras.begin(); itr != vDummyAuras.end(); itr++)
{
SpellEntry const* vSpell = (*itr)->GetSpellProto();
// Rapture (main spell)
if(vSpell->SpellFamilyName == SPELLFAMILY_PRIEST && vSpell->SpellIconID == 2894 && vSpell->Effect[1])
{
switch((*itr)->GetEffIndex())
{
case 0:
{
// energize caster
int32 manapct1000 = 5 * ((*itr)->GetModifier()->m_amount + spellmgr.GetSpellRank(vSpell->Id));
int32 basepoints0 = caster->GetMaxPower(POWER_MANA) * manapct1000 / 1000;
caster->CastCustomSpell(caster, 47755, &basepoints0, NULL, NULL, true);
break;
}
case 1:
{
// energize target
if (!roll_chance_i((*itr)->GetModifier()->m_amount) || caster->HasAura(63853))
break;
switch(m_target->getPowerType())
{
case POWER_RUNIC_POWER:
m_target->CastSpell(m_target, 63652, true, NULL, NULL, m_caster_guid);
break;
@ -6075,25 +6084,26 @@ void Aura::HandleSchoolAbsorb(bool apply, bool Real)
m_target->CastSpell(m_target, 63653, true, NULL, NULL, m_caster_guid);
break;
case POWER_MANA:
{
int32 basepoints0 = m_target->GetMaxPower(POWER_MANA) * 2 / 100;
m_target->CastCustomSpell(m_target, 63654, &basepoints0, NULL, NULL, true);
break;
}
{
int32 basepoints0 = m_target->GetMaxPower(POWER_MANA) * 2 / 100;
m_target->CastCustomSpell(m_target, 63654, &basepoints0, NULL, NULL, true);
break;
}
case POWER_ENERGY:
m_target->CastSpell(m_target, 63655, true, NULL, NULL, m_caster_guid);
break;
default:
break;
}
}
//cooldwon aura
caster->CastSpell(caster, 63853, true);
break;
//cooldwon aura
caster->CastSpell(caster, 63853, true);
break;
}
default:
sLog.outError("Changes in R-dummy spell???: effect 3");
break;
}
default:
sLog.outError("Changes in R-dummy spell???: effect 3");
break;
}
}
}

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "8427"
#define REVISION_NR "8428"
#endif // __REVISION_NR_H__