diff options
| -rw-r--r-- | sql/base/world_database.sql | 1 | ||||
| -rw-r--r-- | sql/updates/world/2011_07_22_01_world_spell_bonus_data.sql | 3 | ||||
| -rwxr-xr-x | src/server/game/Entities/Unit/Unit.cpp | 34 | ||||
| -rwxr-xr-x | src/server/game/Spells/SpellEffects.cpp | 35 |
4 files changed, 51 insertions, 22 deletions
diff --git a/sql/base/world_database.sql b/sql/base/world_database.sql index 387e644fbff..d2e7781cf63 100644 --- a/sql/base/world_database.sql +++ b/sql/base/world_database.sql @@ -17111,6 +17111,7 @@ INSERT INTO `spell_bonus_data` (`entry`,`direct_bonus`,`dot_bonus`,`ap_bonus`,`a (30294, 0, 0, 0, 0, 'Warlock - Soul Leech'), (30108, -1, 0.2, -1, -1, 'Warlock - Unstable Affliction'), (31117, 1.8, -1, -1, -1, 'Warlock - Unstable Affliction Dispell'), +(12162, 0, 0, 0, 0, 'Warrior - Deep Wounds'), (57755, -1, -1, 0.5, -1, 'Warrior - Heroic Throw'), (20253, -1, -1, 0.12, -1, 'Warrior - Intercept'), (61491, -1, -1, 0.12, -1, 'Warrior - Intercept'), diff --git a/sql/updates/world/2011_07_22_01_world_spell_bonus_data.sql b/sql/updates/world/2011_07_22_01_world_spell_bonus_data.sql new file mode 100644 index 00000000000..bd70f6e5e45 --- /dev/null +++ b/sql/updates/world/2011_07_22_01_world_spell_bonus_data.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_bonus_data` WHERE `entry` = 12162; +INSERT INTO `spell_bonus_data` VALUES +(12162, 0, 0, 0, 0, 'Warrior - Deep Wounds'); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index f6db458e270..719331f610d 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -8689,6 +8689,33 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg // Custom triggered spells switch (auraSpellInfo->Id) { + // Deep Wounds + case 12834: + case 12849: + case 12867: + { + if (GetTypeId() != TYPEID_PLAYER) + return false; + + // now compute approximate weapon damage by formula from wowwiki.com + Item* item = NULL; + if (procFlags & PROC_FLAG_DONE_OFFHAND_ATTACK) + item = ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND); + else + item = ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND); + + // dunno if it's really needed but will prevent any possible crashes + if (!item) + return false; + + ItemTemplate const* weapon = item->GetTemplate(); + + float weaponDPS = weapon->getDPS(); + float attackPower = GetTotalAttackPowerValue(BASE_ATTACK) / 14.0f; + float weaponSpeed = float(weapon->Delay) / 1000.0f; + basepoints0 = int32((weaponDPS + attackPower) * weaponSpeed); + break; + } // Persistent Shield (Scarab Brooch trinket) // This spell originally trigger 13567 - Dummy Trigger (vs dummy efect) case 26467: @@ -10385,6 +10412,11 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellEntry const* spellProto, uint32 if (!spellProto || !victim || damagetype == DIRECT_DAMAGE) return pdamage; + // small exception for Deep Wounds, can't find any general rule + // should ignore ALL damage mods, they already calculated in trigger spell + if (spellProto->Id == 12721) // Deep Wounds + return pdamage; + // For totems get damage bonus from owner if (GetTypeId() == TYPEID_UNIT && ToCreature()->isTotem()) if (Unit* owner = GetOwner()) @@ -10898,7 +10930,7 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellEntry const* spellProto, uint32 DoneTotalMod = 1.0f; } - // Some spells don't benefit from from pct done mods + // Some spells don't benefit from pct done mods // maybe should be implemented like SPELL_ATTR3_NO_DONE_BONUS, // but then it may break spell power coeffs work on spell 31117 if (spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS) diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 47d187f6505..ec274b41ba8 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -784,35 +784,28 @@ void Spell::EffectDummy(SpellEffIndex effIndex) if (!unitTarget) return; - float damage; - // DW should benefit of attack power, damage percent mods etc. - // TODO: check if using offhand damage is correct and if it should be divided by 2 - if (m_caster->haveOffhandWeapon() && m_caster->getAttackTimer(BASE_ATTACK) > m_caster->getAttackTimer(OFF_ATTACK)) - damage = (m_caster->GetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE) + m_caster->GetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE))/2; - else - damage = (m_caster->GetFloatValue(UNIT_FIELD_MINDAMAGE) + m_caster->GetFloatValue(UNIT_FIELD_MAXDAMAGE))/2; + // apply damage percent mods + damage = m_caster->SpellDamageBonus(unitTarget, m_spellInfo, damage, SPELL_DIRECT_DAMAGE); switch (m_spellInfo->Id) { - case 12162: damage *= 0.16f; break; // Rank 1 - case 12850: damage *= 0.32f; break; // Rank 2 - case 12868: damage *= 0.48f; break; // Rank 3 + case 12162: ApplyPctN(damage, 16); break; // Rank 1 + case 12850: ApplyPctN(damage, 32); break; // Rank 2 + case 12868: ApplyPctN(damage, 48); break; // Rank 3 default: sLog->outError("Spell::EffectDummy: Spell %u not handled in DW", m_spellInfo->Id); return; - }; - - // get remaining damage of old Deep Wound aura - AuraEffect* deepWound = unitTarget->GetAuraEffect(12721, 0, m_caster->GetGUID()); - if (deepWound) - { - int32 remainingTicks = deepWound->GetBase()->GetDuration() / deepWound->GetAmplitude(); - damage += remainingTicks * deepWound->GetAmount(); } - // 1 tick/sec * 6 sec = 6 ticks - int32 deepWoundsDotBasePoints0 = int32(damage / 6); - m_caster->CastCustomSpell(unitTarget, 12721, &deepWoundsDotBasePoints0, NULL, NULL, true, NULL); + SpellEntry const* spellInfo = sSpellStore.LookupEntry(12721); + uint32 ticks = GetSpellDuration(spellInfo) / spellInfo->EffectAmplitude[0]; + + // Add remaining ticks to damage done + if (AuraEffect const* aurEff = unitTarget->GetAuraEffect(12721, EFFECT_0, m_caster->GetGUID())) + damage += aurEff->GetAmount() * (ticks - aurEff->GetTickNumber()); + + damage = damage / ticks; + m_caster->CastCustomSpell(unitTarget, 12721, &damage, NULL, NULL, true); return; } case 13567: // Dummy Trigger |
