[7904] Change creature damage calculation formula.

* Add new creature_template field `dmg_multiplier`
* Make attackpower include in creature damage not dependent from attack speed.

NOTE: included in sql update recalculation for creature damage related fields only make
temporary possible usable values. Real values need revisited by DB devs for correctness.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
Seizerkiller 2009-05-28 19:35:52 +04:00 committed by VladimirMangos
parent 0614a9eb75
commit 2fc277fdb6
7 changed files with 21 additions and 9 deletions

View file

@ -796,18 +796,17 @@ void Creature::UpdateDamagePhysical(WeaponAttackType attType)
UnitMods unitMod = UNIT_MOD_DAMAGE_MAINHAND;
float att_speed = float(GetAttackTime(BASE_ATTACK))/1000.0f;
float base_value = GetModifierValue(unitMod, BASE_VALUE) + GetTotalAttackPowerValue(attType)/ 14.0f * att_speed;
float base_value = GetModifierValue(unitMod, BASE_VALUE) + GetTotalAttackPowerValue(attType);
float base_pct = GetModifierValue(unitMod, BASE_PCT);
float total_value = GetModifierValue(unitMod, TOTAL_VALUE);
float total_pct = GetModifierValue(unitMod, TOTAL_PCT);
float dmg_multiplier = GetCreatureInfo()->dmg_multiplier;
float weapon_mindamage = GetWeaponDamageRange(BASE_ATTACK, MINDAMAGE);
float weapon_maxdamage = GetWeaponDamageRange(BASE_ATTACK, MAXDAMAGE);
float mindamage = ((base_value + weapon_mindamage) * base_pct + total_value) * total_pct ;
float maxdamage = ((base_value + weapon_maxdamage) * base_pct + total_value) * total_pct ;
float mindamage = ((base_value + weapon_mindamage) * base_pct + total_value) * total_pct * dmg_multiplier;
float maxdamage = ((base_value + weapon_maxdamage) * base_pct + total_value) * total_pct * dmg_multiplier;
SetStatFloatValue(UNIT_FIELD_MINDAMAGE, mindamage);
SetStatFloatValue(UNIT_FIELD_MAXDAMAGE, maxdamage);