From e947acd59ca91df352af2a6405292bb5df8c8a45 Mon Sep 17 00:00:00 2001 From: Lynx3d Date: Fri, 24 Jul 2009 16:48:44 +0400 Subject: [PATCH] [8237] Apply attack power multiplier to creature bonus attackpower. Note: mindmg/maxdmg in creature_template expected including attackpower part in its. attackpower field only show part of attackpower not affected by AP multiplier. Thanks also to Seizer for take part in reseach and patch review. Signed-off-by: VladimirMangos --- sql/mangos.sql | 2 +- sql/updates/8237_01_mangos_creature_template.sql | 4 ++++ sql/updates/Makefile.am | 2 ++ src/game/StatSystem.cpp | 4 +++- src/shared/revision_nr.h | 2 +- 5 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 sql/updates/8237_01_mangos_creature_template.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index c4eecbabd..b29f4d989 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -23,7 +23,7 @@ DROP TABLE IF EXISTS `db_version`; CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, - `required_8227_01_mangos_spell_proc_event` bit(1) default NULL + `required_8237_01_mangos_creature_template` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- diff --git a/sql/updates/8237_01_mangos_creature_template.sql b/sql/updates/8237_01_mangos_creature_template.sql new file mode 100644 index 000000000..89b433cc2 --- /dev/null +++ b/sql/updates/8237_01_mangos_creature_template.sql @@ -0,0 +1,4 @@ +ALTER TABLE db_version CHANGE COLUMN required_8227_01_mangos_spell_proc_event required_8237_01_mangos_creature_template bit; + +UPDATE creature_template + SET mindmg = ROUND(mindmg + attackpower), maxdmg=ROUND(maxdmg+attackpower); \ No newline at end of file diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index e7ef2fc44..69c34b2ad 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -250,6 +250,7 @@ pkgdata_DATA = \ 8212_01_mangos_spell_proc_event.sql \ 8213_01_mangos_spell_bonus_data.sql \ 8227_01_mangos_spell_proc_event.sql \ + 8237_01_mangos_creature_template.sql \ README ## Additional files to include when running 'make dist' @@ -480,4 +481,5 @@ EXTRA_DIST = \ 8212_01_mangos_spell_proc_event.sql \ 8213_01_mangos_spell_bonus_data.sql \ 8227_01_mangos_spell_proc_event.sql \ + 8237_01_mangos_creature_template.sql \ README diff --git a/src/game/StatSystem.cpp b/src/game/StatSystem.cpp index 2e512c35c..f21555543 100644 --- a/src/game/StatSystem.cpp +++ b/src/game/StatSystem.cpp @@ -803,7 +803,9 @@ void Creature::UpdateDamagePhysical(WeaponAttackType attType) UnitMods unitMod = UNIT_MOD_DAMAGE_MAINHAND; - float base_value = GetModifierValue(unitMod, BASE_VALUE) + GetTotalAttackPowerValue(attType); + /* difference in AP between current attack power and base value from DB */ + float att_pwr_change = GetTotalAttackPowerValue(attType) - GetCreatureInfo()->attackpower; + float base_value = GetModifierValue(unitMod, BASE_VALUE) + (att_pwr_change * GetAPMultiplier(attType, false) / 14.0f); float base_pct = GetModifierValue(unitMod, BASE_PCT); float total_value = GetModifierValue(unitMod, TOTAL_VALUE); float total_pct = GetModifierValue(unitMod, TOTAL_PCT); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index d889aa33a..a81ff3d28 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8236" + #define REVISION_NR "8237" #endif // __REVISION_NR_H__