Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Core/Spell): Recklessness + Juggernaut causes non-critical mortal… #21038

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 42 additions & 2 deletions src/server/game/Entities/Player/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9780,9 +9780,49 @@ void Player::ApplySpellMod(uint32 spellId, SpellModOp op, T& basevalue, Spell* s
if (mod->type == SPELLMOD_FLAT)
{
// xinef: do not allow to consume more than one 100% crit increasing spell
if (mod->op == SPELLMOD_CRITICAL_CHANCE && totalflat >= 100)
if (mod->op == SPELLMOD_CRITICAL_CHANCE)
{
return;
// Checks if the Juggernaut and Recklessness buffs are active
bool hasJuggernaut = HasAura(65156); // Buff Juggernaut
bool hasRecklessness = HasAura(1719); // Buff Recklessness

// List of IDs for Mortal Strike and Slam (Including multiple ranks)
uint32 mortalStrikeRanks[] = { 12294, 21551, 21552, 21553, 25248, 30330, 47485, 47486 }; // Mortal Strike Rank IDs
uint32 slamRanks[] = { 1464, 8820, 11604, 11605, 25241, 25242, 47474, 47475 }; // Slam Rank IDs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. we use english
  2. Just no. Do not ever hardcode raw values
  3. Try to fix the issue in a spellscript

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry. Ok


// Identifies the ID of the spell being processed
uint32 spellId = spellInfo->Id;

// Checks if the spell is Mortal Strike or Slam
bool isMortalStrike = std::find(std::begin(mortalStrikeRanks), std::end(mortalStrikeRanks), spellId) != std::end(mortalStrikeRanks);
bool isSlam = std::find(std::begin(slamRanks), std::end(slamRanks), spellId) != std::end(slamRanks);

// Check if it is Mortal Strike or Slam
bool isMortalStrikeOrSlam = isMortalStrike || isSlam;

// Critical chance adjustment
if (hasJuggernaut && hasRecklessness)
{
// Combines effects: 25% (Juggernaut) + 100% (Recklessness)
totalflat = 125; // Sets final crit chance to 125%
}
else if (hasJuggernaut)
{
totalflat = std::max(totalflat, 25); // Only Juggernaut active
}
else if (hasRecklessness)
{
totalflat = std::max(totalflat, 100); // Only Recklessness active
}

// Limits the maximum critical value to 100%
totalflat = std::min(totalflat, 100);

// Removes Juggernaut buff only after critical from Slam or Mortal Strike
if (isMortalStrikeOrSlam && roll_chance_i(totalflat))
{
RemoveAurasDueToSpell(65156);
}
}

int32 flatValue = mod->value;
Expand Down
Loading