Skip to content

Commit

Permalink
Fix: digesting rings of fire/cold/shock/poison resistance would not c…
Browse files Browse the repository at this point in the history
…onfer any resistance.

This bug has most likely existed since the very beginning of EvilHack
development when partial resistances were ported over from SporkHack
(and this bug exists there as well). Was noticed recently during a game
of Hack'EM, which shares a lot of EvilHack code. A fix was made for that
variant; the fix here is similar, but not exactly the same.

It was pointed out by terrapin that a more elegant fix would be to
change a bit in how_resistant() in potion.c from
u.uprops[which].intrinsic & (FROMEXPER | FROMRACE | FROMFORM) to
u.uprops[which].intrinsic & INTRINSIC, but doing so would break a lot of
the functionality of ice traps. So we've made specific cases for each of
the rings affected instead. Eating any of these rings has a chance to
grant 50% resistance for that type of ring (one third of that for fire
res if Draugr race).
  • Loading branch information
k21971 committed Aug 17, 2024
1 parent 3b8e18f commit f4d4ac1
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doc/evilhack-changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3601,4 +3601,6 @@ The following changes to date are:
- Fix: feedback when having to drop a worn shield vs worn bracers
- Fix: Tortle archeologists could never throw Xiuhcoatl
- Fix: Possible crash when saving bones after second death
- Fix: digesting rings of fire/cold/shock/poison resistance would not
confer any resistance

50 changes: 50 additions & 0 deletions src/eat.c
Original file line number Diff line number Diff line change
Expand Up @@ -2339,6 +2339,56 @@ struct obj *otmp;
}
incr_resistance(&HSleep_resistance, 100);
break;
case RIN_FIRE_RESISTANCE:
/* Due to their undead nature, Draugr only gain intrinsic
fire resistance a third as much as other races per source,
and is capped at 50% resistance (see how_resistant() in
potion.c) */
if ((HFire_resistance & (TIMEOUT | FROMRACE | FROMEXPER)) < 100) {
accessory_has_effect(otmp);
incr_resistance(&HFire_resistance,
(Race_if(PM_DRAUGR) ? (50 / 3) : 50));
if ((HFire_resistance & TIMEOUT) == 100)
You_feel(Hallucination ? "like... so chill."
: "completely chilled.");
else if (Race_if(PM_DRAUGR) && (HFire_resistance & TIMEOUT) >= 50)
; /* no feedback */
else
You_feel("%s more chill.",
Race_if(PM_DRAUGR) ? "considerably" : "much");
}
break;
case RIN_COLD_RESISTANCE:
if ((HCold_resistance & (TIMEOUT | FROMRACE | FROMEXPER)) < 100) {
accessory_has_effect(otmp);
incr_resistance(&HCold_resistance, 50);
if ((HCold_resistance & TIMEOUT) == 100)
You_feel("full of hot air.");
else
You_feel("much warmer.");
}
break;
case RIN_SHOCK_RESISTANCE:
if ((HShock_resistance & (TIMEOUT | FROMRACE | FROMEXPER)) < 100) {
accessory_has_effect(otmp);
incr_resistance(&HShock_resistance, 50);
if ((HShock_resistance & TIMEOUT) == 100)
pline(Hallucination ? "You feel grounded in reality."
: "Your health feels completely amplified!");
else
Your("health is much more amplified!");
}
break;
case RIN_POISON_RESISTANCE:
if ((HPoison_resistance & (TIMEOUT | FROMRACE | FROMEXPER)) < 100) {
accessory_has_effect(otmp);
incr_resistance(&HPoison_resistance, 50);
if ((HPoison_resistance & TIMEOUT) == 100)
You_feel("completely healthy.");
else
You_feel("much healthier.");
}
break;
case AMULET_OF_CHANGE:
accessory_has_effect(otmp);
makeknown(typ);
Expand Down

0 comments on commit f4d4ac1

Please sign in to comment.