*Add new column to spell_bonus_data table to store ap bonus for periodic auras.

*Use -1 to mark entries, for which default spell bonus calculation should be used.
*Move periodic auras ap bonuses from core to db.
*Add coefficient for Black Arrow.

--HG--
branch : trunk
This commit is contained in:
QAston
2009-07-18 22:18:47 +02:00
parent 91c309387a
commit bc4d862263
7 changed files with 528 additions and 377 deletions
-64
View File
@@ -4702,17 +4702,6 @@ void AuraEffect::HandlePeriodicDamage(bool apply, bool Real, bool changeAmount)
switch (m_spellProto->SpellFamilyName)
{
case SPELLFAMILY_GENERIC:
{
// Pounce Bleed
if ( m_spellProto->SpellIconID == 147 && m_spellProto->SpellVisual[0] == 0 )
{
// 0.18*$AP / number of ticks
m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.18f / GetTotalTicks());
return;
}
break;
}
case SPELLFAMILY_WARRIOR:
{
// Rend
@@ -4741,20 +4730,6 @@ void AuraEffect::HandlePeriodicDamage(bool apply, bool Real, bool changeAmount)
}
case SPELLFAMILY_DRUID:
{
// Rake
if (m_spellProto->SpellFamilyFlags[0] & 0x1000)
{
// $AP*0.18 bonus per tick
m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 18 / 100);
return;
}
// Lacerate
if (m_spellProto->SpellFamilyFlags[1] & 0x0000000100)
{
// $AP*0.05/5 bonus per tick
m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) / 100);
return;
}
// Rip
if (m_spellProto->SpellVisual[0] == 3941)
{
@@ -4777,13 +4752,6 @@ void AuraEffect::HandlePeriodicDamage(bool apply, bool Real, bool changeAmount)
m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * cp / 100);
return;
}
// Lock Jaw
if (m_spellProto->SpellFamilyFlags[1] & 0x10000000)
{
// 0.15*$AP
m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 15 / 100);
return;
}
break;
}
case SPELLFAMILY_ROGUE:
@@ -4804,38 +4772,6 @@ void AuraEffect::HandlePeriodicDamage(bool apply, bool Real, bool changeAmount)
m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * AP_per_combo[cp]);
return;
}
// Garrote
if (m_spellProto->SpellFamilyFlags[0] & 0x100)
{
// $AP*0.07 bonus per tick
m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 7 / 100);
return;
}
// Deadly Poison
if (m_spellProto->SpellFamilyFlags[0] & 0x10000)
{
// 0.12*$AP * amount of stack / number of ticks
m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.12f * GetParentAura()->GetStackAmount() / GetTotalTicks());
return;
}
break;
}
case SPELLFAMILY_HUNTER:
{
// Serpent Sting
if (m_spellProto->SpellFamilyFlags[0] & 0x4000)
{
// $RAP*0.2 / number of ticks
m_amount += int32(caster->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.02f / GetTotalTicks());
return;
}
// Immolation Trap
if (m_spellProto->SpellFamilyFlags[2] & 0x00020000)
{
// $RAP*0.1 / number of ticks
m_amount += int32(caster->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.01f / GetTotalTicks());
return;
}
break;
}
default:
+15 -7
View File
@@ -1228,8 +1228,8 @@ void SpellMgr::LoadSpellBonusess()
{
mSpellBonusMap.clear(); // need for reload case
uint32 count = 0;
// 0 1 2 3
QueryResult *result = WorldDatabase.Query("SELECT entry, direct_bonus, dot_bonus, ap_bonus FROM spell_bonus_data");
// 0 1 2 3 4
QueryResult *result = WorldDatabase.Query("SELECT entry, direct_bonus, dot_bonus, ap_bonus, ap_dot_bonus FROM spell_bonus_data");
if( !result )
{
barGoLink bar( 1 );
@@ -1258,8 +1258,10 @@ void SpellMgr::LoadSpellBonusess()
sbe.direct_damage = fields[1].GetFloat();
sbe.dot_damage = fields[2].GetFloat();
sbe.ap_bonus = fields[3].GetFloat();
sbe.ap_dot_bonus = fields[4].GetFloat();
mSpellBonusMap[entry] = sbe;
++count;
} while( result->NextRow() );
delete result;
@@ -1281,12 +1283,14 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellPr
/* Check Periodic Auras
* Both hots and dots can trigger if spell has no PROC_FLAG_SUCCESSFUL_DAMAGING_SPELL_HIT
nor PROC_FLAG_SUCCESSFUL_HEALING_SPELL
*Dots can trigger if spell has no PROC_FLAG_SUCCESSFUL_NEGATIVE_MAGIC_SPELL
nor PROC_FLAG_TAKEN_POSITIVE_MAGIC_SPELL
*Only Hots can trigger if spell has PROC_FLAG_SUCCESSFUL_HEALING_SPELL
*Only Hots can trigger if spell has PROC_FLAG_TAKEN_POSITIVE_MAGIC_SPELL
*Only dots can trigger if spell has both positivity flags or PROC_FLAG_SUCCESSFUL_DAMAGING_SPELL_HIT
*Only dots can trigger if spell has both positivity flags or PROC_FLAG_SUCCESSFUL_NEGATIVE_MAGIC_SPELL
*Aura has to have PROC_FLAG_TAKEN_POSITIVE_MAGIC_SPELL or spellfamily specified to trigger from Hot
*/
@@ -1300,6 +1304,8 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellPr
else if (EventProcFlag & PROC_FLAG_TAKEN_POSITIVE_MAGIC_SPELL
&& !(procExtra & PROC_EX_INTERNAL_HOT))
return false;
else if (procExtra & PROC_EX_INTERNAL_HOT)
procExtra |= PROC_EX_INTERNAL_REQ_FAMILY;
}
if (procFlags & PROC_FLAG_ON_TAKE_PERIODIC)
@@ -1312,6 +1318,8 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellPr
else if (EventProcFlag & PROC_FLAG_TAKEN_POSITIVE_MAGIC_SPELL
&& !(procExtra & PROC_EX_INTERNAL_HOT))
return false;
else if (procExtra & PROC_EX_INTERNAL_HOT)
procExtra |= PROC_EX_INTERNAL_REQ_FAMILY;
}
// Trap casts are active by default
if (procFlags & PROC_FLAG_ON_TRAP_ACTIVATION)
@@ -1356,7 +1364,7 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellPr
}
}
if (procExtra & (PROC_EX_INTERNAL_REQ_FAMILY | PROC_EX_INTERNAL_HOT))
if (procExtra & (PROC_EX_INTERNAL_REQ_FAMILY))
{
if (!hasFamilyMask)
return false;
+1
View File
@@ -500,6 +500,7 @@ struct SpellBonusEntry
float direct_damage;
float dot_damage;
float ap_bonus;
float ap_dot_bonus;
};
typedef UNORDERED_MAP<uint32, SpellProcEventEntry> SpellProcEventMap;
+24 -8
View File
@@ -9318,21 +9318,29 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
DoneAdvertisedBenefit += ((Guardian*)this)->GetBonusDamage();
// Check for table values
float coeff;
float coeff = 0;
SpellBonusEntry const* bonus = spellmgr.GetSpellBonusData(spellProto->Id);
if (bonus)
{
if (damagetype == DOT)
{
coeff = bonus->dot_damage;
if (bonus->ap_dot_bonus > 0)
DoneTotal+=bonus->ap_dot_bonus * stack * ApCoeffMod *
GetTotalAttackPowerValue(IsRangedWeaponSpell(spellProto) ? RANGED_ATTACK: BASE_ATTACK);
}
else
{
coeff = bonus->direct_damage;
if (bonus->ap_bonus)
DoneTotal+=bonus->ap_bonus * GetTotalAttackPowerValue(BASE_ATTACK) * stack * ApCoeffMod;
if (bonus->ap_bonus > 0)
DoneTotal+=bonus->ap_bonus * stack * ApCoeffMod *
GetTotalAttackPowerValue(IsRangedWeaponSpell(spellProto) ? RANGED_ATTACK: BASE_ATTACK);
}
}
// Default calculation
if (DoneAdvertisedBenefit || TakenAdvertisedBenefit)
{
if(!bonus)
if(!bonus || coeff < 0)
{
// Damage Done from spell damage bonus
int32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto);
@@ -9785,16 +9793,24 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint
// Check for table values
SpellBonusEntry const* bonus = !scripted ? spellmgr.GetSpellBonusData(spellProto->Id) : NULL;
float coeff;
float coeff = 0;
float factorMod = 1.0f;
if (bonus)
{
if (damagetype == DOT)
{
coeff = bonus->dot_damage;
if (bonus->ap_dot_bonus > 0)
DoneTotal+=bonus->ap_dot_bonus * stack *
GetTotalAttackPowerValue(IsRangedWeaponSpell(spellProto) ? RANGED_ATTACK: BASE_ATTACK);
}
else
{
coeff = bonus->direct_damage;
if (bonus->ap_bonus)
DoneTotal+=bonus->ap_bonus * GetTotalAttackPowerValue(BASE_ATTACK) * stack;
if (bonus->ap_bonus > 0)
DoneTotal+=bonus->ap_bonus * stack *
GetTotalAttackPowerValue(IsRangedWeaponSpell(spellProto) ? RANGED_ATTACK: BASE_ATTACK);
}
}
else // scripted bonus
{
@@ -9828,7 +9844,7 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint
// Default calculation
if (DoneAdvertisedBenefit || TakenAdvertisedBenefit)
{
if(!bonus && !scripted)
if((!bonus && !scripted) || coeff < 0)
{
// Damage Done from spell damage bonus
int32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto);