Skip to content

Commit 7fd701a

Browse files
authored
Fix Rage (diasurgical#7873)
1 parent 96112e6 commit 7fd701a

1 file changed

Lines changed: 16 additions & 17 deletions

File tree

Source/missiles.cpp

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,9 +1149,8 @@ void InitMissiles()
11491149
for (auto &missile : Missiles) {
11501150
if (missile._mitype == MissileID::Rage) {
11511151
if (missile.sourcePlayer() == MyPlayer) {
1152-
int missingHP = myPlayer._pMaxHP - myPlayer._pHitPoints;
11531152
CalcPlrItemVals(myPlayer, true);
1154-
ApplyPlrDamage(DamageType::Physical, myPlayer, 0, 1, missingHP + missile.var2);
1153+
ApplyPlrDamage(DamageType::Physical, myPlayer, missile._midam, 1);
11551154
}
11561155
}
11571156
}
@@ -2506,14 +2505,12 @@ void AddRage(Missile &missile, AddMissileParameter &parameter)
25062505
return;
25072506
}
25082507

2509-
int tmp = 3 * player.getCharacterLevel();
2510-
tmp <<= 7;
2508+
missile._midam = player.getCharacterLevel() * 6;
2509+
missile.duration = 245 + (player.getCharacterLevel() * 2);
2510+
missile.var1 = missile.duration;
2511+
25112512
player._pSpellFlags |= SpellFlag::RageActive;
2512-
missile.var2 = tmp;
2513-
int lvl = player.getCharacterLevel() * 2;
2514-
missile.duration = lvl + 10 * missile._mispllvl + 245;
25152513
CalcPlrItemVals(player, true);
2516-
RedrawEverything();
25172514
player.Say(HeroSpeech::Aaaaargh);
25182515
}
25192516

@@ -3850,29 +3847,31 @@ void ProcessRage(Missile &missile)
38503847
{
38513848
missile.duration--;
38523849

3853-
if (missile.duration != 0) {
3850+
if (missile.duration != 0)
38543851
return;
3855-
}
38563852

38573853
Player &player = Players[missile._misource];
38583854

3859-
int hpdif = player._pMaxHP - player._pHitPoints;
3860-
38613855
if (HasAnyOf(player._pSpellFlags, SpellFlag::RageActive)) {
38623856
player._pSpellFlags &= ~SpellFlag::RageActive;
38633857
player._pSpellFlags |= SpellFlag::RageCooldown;
3864-
int lvl = player.getCharacterLevel() * 2;
3865-
missile.duration = lvl + 10 * missile._mispllvl + 245;
3866-
} else {
3858+
missile.duration = missile.var1; // Start timer over
3859+
} else if (HasAnyOf(player._pSpellFlags, SpellFlag::RageCooldown)) {
38673860
player._pSpellFlags &= ~SpellFlag::RageCooldown;
38683861
missile._miDelFlag = true;
3869-
hpdif += missile.var2;
38703862
}
38713863

38723864
CalcPlrItemVals(player, true);
3873-
ApplyPlrDamage(DamageType::Physical, player, 0, 1, hpdif);
3865+
3866+
// Prevent the player from dying as a result of recalculating their current life
3867+
if ((player._pHitPoints >> 6) <= 0)
3868+
SetPlayerHitPoints(player, 64);
3869+
38743870
RedrawEverything();
38753871
player.Say(HeroSpeech::HeavyBreathing);
3872+
3873+
if (missile._miDelFlag)
3874+
ApplyPlrDamage(DamageType::Physical, player, missile._midam, 1); // Prevent penalty from killing the player
38763875
}
38773876

38783877
void ProcessInferno(Missile &missile)

0 commit comments

Comments
 (0)