Skip to content

Instantly share code, notes, and snippets.

@tobmaps
Created July 17, 2011 21:46
Show Gist options
  • Save tobmaps/1088109 to your computer and use it in GitHub Desktop.
Save tobmaps/1088109 to your computer and use it in GitHub Desktop.
Deep Wounds (partially by DrTenma)
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 0000000..ea3b73e
--- /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 895d836..3f49bdc 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -8692,6 +8692,30 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
// Custom triggered spells
switch (auraSpellInfo->Id)
{
+ // Deep Wounds
+ case 12834:
+ case 12849:
+ case 12867:
+ {
+ // 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,7 +10409,7 @@ void Unit::EnergizeBySpell(Unit* victim, uint32 SpellID, uint32 Damage, Powers p
uint32 Unit::SpellDamageBonus(Unit* victim, SpellEntry const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack)
{
- if (!spellProto || !victim || damagetype == DIRECT_DAMAGE)
+ if (!spellProto || !victim || damagetype == DIRECT_DAMAGE || (spellProto->AttributesEx6 & SPELL_ATTR6_STATIC_DAMAGE))
return pdamage;
// For totems get damage bonus from owner
diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h
index a65eaaa..2417b48 100755
--- a/src/server/game/Miscellaneous/SharedDefines.h
+++ b/src/server/game/Miscellaneous/SharedDefines.h
@@ -508,7 +508,7 @@ enum SpellAttr6
SPELL_ATTR6_UNK26 = 0x04000000, // 26
SPELL_ATTR6_UNK27 = 0x08000000, // 27
SPELL_ATTR6_UNK28 = 0x10000000, // 28
- SPELL_ATTR6_UNK29 = 0x20000000, // 29
+ SPELL_ATTR6_STATIC_DAMAGE = 0x20000000, // 29 Damage without any modifiers
SPELL_ATTR6_UNK30 = 0x40000000, // 30
SPELL_ATTR6_UNK31 = 0x80000000 // 31
};
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 47d187f..2021a32 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];
+
+ // TODO: find how old aura that triggered by mainhand weapon should be calculated in case we attacking with offhand now
+ 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
@kbinside
Copy link

possible to add this to offcl. commit, revision to see changes? and again thanks for work.

@tobmaps
Copy link
Author

tobmaps commented Jul 18, 2011

you still didn't report results of your tests, i will not add untested patch

@kbinside
Copy link

damage is now closer to its normal damage, i mean ticks are bigger now.
it would be nice if someone else could confirm that too, maybe you can test or Pitcrawler could do some testing, couse he know much about it.

@tobmaps
Copy link
Author

tobmaps commented Jul 22, 2011

you should test again because it's updated

@Pitcrawler
Copy link

I tested your updated patch and compared the values to DrDamage Addon:

DrDamage said for the first tick of DW 135,9 * 1,3 (Trauma) * 1,1 (Wrecking Crew) = 194,3. I got the first tick of 194 on a boss dummy. => correct
Next test was with ICC buff and raid buffs DrDamage said for the first tick 158,1 * 2 (Essence of the Blood Queen) * 1,3 (Strength of Wrynn) * 1,3 (Trauma) * 1,1 (Wrecking Crew) = 587,8. My first tick on the boss dummy was 587. => I'd say correct

The tests were done in Lvl 226 equipment so numbers should increase for icc equip. I calculated the average DW ticks with Excel and it resulted in the following maximum values:
without buffs (first value with a crit every 2 secs, second with a crit every sec): 582, 1761
with buffs: 1159, 3507

As stated above keep in mind that the tests were done with Lvl 226 equip. Perhaps I'll redo the tests with 264 equip. But so far everthing seems fine and numbers are correct compared to DrDamage. In recount DW moved to second position just as it is in the vids from retail.
So I didnt find any errors in your fix Tobmaps and guess it can be applied to off. repo.

@tobmaps
Copy link
Author

tobmaps commented Jul 22, 2011

i only unsure about attribute used, think they should be implemented in other way, there also wrongly implemented SPELL_ATTR4_FIXED_DAMAGE that cause our spell to ignore resilience

@Pitcrawler
Copy link

Im sorry but Im not used to spell attributes. I cannot help with these.
What do you like to change. It seems to work as intended doesnt it?

@kbinside
Copy link

what can i say about resilience, it does very low damage to pvp equipment.
but i take some time for more tests in pvp. (resilience cap).

Little Notice, do not always trust the info from DrDamage, couse i noticed that in some cases it does not always add talents and so on, remember the case with divine hymn spell power coefficient, in DrDamage it was wrong.

byt the way, great work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment