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

Function peffect_gain_level

src/potion.c:1082–1116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1080}
1081
1082staticfn void
1083peffect_gain_level(struct obj *otmp)
1084{
1085 if (otmp->cursed) {
1086 boolean on_lvl_1 = (ledger_no(&u.uz) == 1);
1087
1088 gp.potion_unkn++;
1089 /* they went up a level */
1090 if (on_lvl_1 ? u.uhave.amulet : Can_rise_up(u.ux, u.uy, &u.uz)) {
1091 int newlev;
1092 d_level newlevel;
1093
1094 if (on_lvl_1) {
1095 assign_level(&newlevel, &earth_level);
1096 } else {
1097 newlev = depth(&u.uz) - 1;
1098 get_level(&newlevel, newlev);
1099 if (on_level(&newlevel, &u.uz)) {
1100 pline("It tasted bad.");
1101 return;
1102 }
1103 }
1104 You("rise up, through the %s!", ceiling(u.ux, u.uy));
1105 goto_level(&newlevel, FALSE, FALSE, FALSE);
1106 } else {
1107 You("have an uneasy feeling.");
1108 }
1109 return;
1110 }
1111 pluslvl(FALSE);
1112 /* blessed potions place you at a random spot in the
1113 middle of the new level instead of the low point */
1114 if (otmp->blessed)
1115 u.uexp = rndexp(TRUE);
1116}
1117
1118staticfn void
1119peffect_healing(struct obj *otmp)

Callers 1

peffectsFunction · 0.85

Calls 12

ledger_noFunction · 0.85
Can_rise_upFunction · 0.85
assign_levelFunction · 0.85
depthFunction · 0.85
get_levelFunction · 0.85
on_levelFunction · 0.85
YouFunction · 0.85
ceilingFunction · 0.85
goto_levelFunction · 0.85
pluslvlFunction · 0.85
rndexpFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected