From 01bb79cc7d11449a916b628e5d4c7145bb22f225 Mon Sep 17 00:00:00 2001 From: Xanadu Date: Thu, 21 Jan 2010 02:02:35 +0100 Subject: [PATCH] Fix SPELLMOD_PCT spell mods to stack in a truly multiplicative way --HG-- branch : trunk --- src/game/Player.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game/Player.h b/src/game/Player.h index 208f5d990d4..f82f4848414 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -2590,7 +2590,7 @@ template T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &bas { SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); if (!spellInfo) return 0; - int32 totalpct = 0; + float totalmul = 1.0f; int32 totalflat = 0; // Drop charges for triggering spells instead of triggered ones @@ -2620,12 +2620,12 @@ template T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &bas if( mod->op==SPELLMOD_CASTING_TIME && basevalue >= T(10000) && mod->value <= -100) continue; - totalpct += mod->value; + totalmul *= 1.0f + (float)mod->value / 100.0f; } DropModCharge(mod, spell); } - float diff = (float)basevalue*(float)totalpct/100.0f + (float)totalflat; + float diff = (float)basevalue * (totalmul - 1.0f) + (float)totalflat; basevalue = T((float)basevalue + diff); return T(diff); }