azerothcore / azerothcore-wotlk

Complete Open Source and Modular solution for MMO
http://www.azerothcore.org
GNU Affero General Public License v3.0
6.62k stars 2.64k forks source link

Cold Blood & Mutilate #20027

Open alecsci opened 2 months ago

alecsci commented 2 months ago

Current Behaviour

Reported by: https://github.com/chromiecraft/chromiecraft/issues/6512 Using Cold Blood with Mutilate won't crit with both weapons.

Expected Blizzlike Behaviour

Should crit with both weapons

Source

https://vanilla-wow-archive.fandom.com/wiki/Mutilate

Because mutilate attacks with both weapons, both attacks have a chance to crit.

https://www.wowhead.com/spell=1329/mutilate#comments:id=300634

https://www.wowhead.com/wotlk/de/forums/topic/my-mutilate-theory-59255

Mutilate can crit twice (once from each weapon) and so with you open up from stealth your first attack can net you 4 combo points.add this net ability.

Steps to reproduce the problem

  1. level 70 rogue (basic weps, use detailed damaged meter addon)
  2. learn all my spells/talents
  3. npc add temp 32667
  4. use cold blood + mutilate
  5. look at addon (crit only with offhand)

Extra Notes

https://github.com/TrinityCore/TrinityCore/issues/20421

AC rev. hash/commit

b67a409badf5d41300bf0c9948cf54c3d7292385

Operating system

Windows 11 x64

Custom changes or Modules

None

sogladev commented 2 months ago

I managed to have Mutilate crit with both weapons, but... the combo points are still calculated as 3 instead of expected 4. During debugging, I found I can make it calculate 4 sometimes when setting break points

setup

human rogue
.level 69
.learn 1329
cold blood
.learn 14177
.level 69
.add 19314 2
.maxskill
dummies
.tele darn

press cold blood mutilate on a expert dummy

observed combo points

breakpoint in Unit::SendComboPoints() where SMSG_UPDATE_COMBO_POINTS is set. CP goes 1->2->4

count: combo points gained from Unit::AddComboPoints() m_comboPoints: total combo points on target count m_comboPoints source
1 1 seal fate 14189
1 2 seal fate 14189
2 4 mutilate base 1329
0 reset combat

When using a single breakpoint at the start of `creature::update``, combo points will also show 4

I suspect creature::update messes with the proc handling system somehow. I haven't tried logging as I don't know which specific logger masks/options could work for this case, any ideas?

crit patch

by not having MH trigger spell consume cold blood, so the OH will crit and then consume the mod.

diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index b53ef50cb5..d33c802640 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -9721,2 +9721,8 @@ void Player::ApplySpellMod(uint32 spellId, SpellModOp op, T& basevalue, Spell* s
             totalflat += flatValue;
+
+            // special case for Mutilate, do not consume if main hand
+            if (spellInfo->GetFirstRankSpell()->Id == 5374)
+            {
+                return;
+            }
         }