MCPcopy Create free account
hub / github.com/NetHack/NetHack / sink_into_lava

Function sink_into_lava

src/trap.c:6990–7034  ·  view source on GitHub ↗

called each turn when trapped in lava */

Source from the content-addressed store, hash-verified

6988
6989/* called each turn when trapped in lava */
6990void
6991sink_into_lava(void)
6992{
6993 static const char sink_deeper[] = "You sink deeper into the lava.";
6994
6995 if (!u.utrap || u.utraptype != TT_LAVA) {
6996 ; /* do nothing; this usually won't happen but could after
6997 * polymorphing from a flier into a ceiling hider and then hiding;
6998 * allmain() only checks whether the hero is at a lava location,
6999 * not whether he or she is currently sinking */
7000 } else if (!is_lava(u.ux, u.uy)) {
7001 reset_utrap(FALSE); /* this shouldn't happen either */
7002 } else if (!u.uinvulnerable) {
7003 /* ordinarily we'd have to be fire resistant to survive long
7004 enough to become stuck in lava, but it can happen without
7005 resistance if water walking boots allow survival and then
7006 get burned up; u.utrap time will be quite short in that case */
7007 if (!Fire_resistance)
7008 u.uhp = (u.uhp + 2) / 3;
7009
7010 u.utrap -= (1 << 8);
7011 if (u.utrap < (1 << 8)) {
7012 svk.killer.format = KILLED_BY;
7013 Strcpy(svk.killer.name, "molten lava");
7014 urgent_pline("You sink below the surface and die.");
7015 burn_away_slime(); /* add insult to injury? */
7016 done(DISSOLVED);
7017 /* can only get here via life-saving; try to get away from lava */
7018 reset_utrap(TRUE);
7019 /* levitation or flight have become unblocked, otherwise Tport */
7020 if (!Levitation && !Flying)
7021 (void) safe_teleds(TELEDS_ALLOW_DRAG | TELEDS_TELEPORT);
7022 } else if (!u.umoved) {
7023 /* can't fully turn into slime while in lava, but might not
7024 have it be burned away until you've come awfully close */
7025 if (Slimed && rnd(10 - 1) >= (int) (Slimed & TIMEOUT)) {
7026 pline(sink_deeper);
7027 burn_away_slime();
7028 } else {
7029 Norep(sink_deeper);
7030 }
7031 u.utrap += rnd(4);
7032 }
7033 }
7034}
7035
7036/* called when something has been done (breaking a boulder, for instance)
7037 which entails a luck penalty if performed on a sokoban level */

Callers 1

allmain.cFile · 0.85

Calls 9

is_lavaFunction · 0.85
reset_utrapFunction · 0.85
urgent_plineFunction · 0.85
burn_away_slimeFunction · 0.85
doneFunction · 0.85
safe_teledsFunction · 0.85
rndFunction · 0.85
NorepFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected