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

Function more_experienced

src/exper.c:168–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168void
169more_experienced(int exper, int rexp)
170{
171 long oldexp = u.uexp,
172 oldrexp = u.urexp,
173 newexp = oldexp + exper,
174 rexpincr = 4 * exper + rexp,
175 newrexp = oldrexp + rexpincr;
176
177 /* cap experience and score on wraparound */
178 if (newexp < 0 && exper > 0)
179 newexp = LONG_MAX;
180 if (newrexp < 0 && rexpincr > 0)
181 newrexp = LONG_MAX;
182
183 if (newexp != oldexp) {
184 u.uexp = newexp;
185 if (flags.showexp)
186 disp.botl = TRUE;
187 /* even when experience points aren't being shown, experience level
188 might be highlighted with a percentage highlight rule and that
189 percentage depends upon experience points */
190 if (!disp.botl && exp_percent_changing())
191 disp.botl = TRUE;
192 }
193 /* newrexp will always differ from oldrexp unless they're LONG_MAX */
194 if (newrexp != oldrexp) {
195 u.urexp = newrexp;
196#ifdef SCORE_ON_BOTL
197 if (flags.showscore)
198 disp.botl = TRUE;
199#endif
200 }
201 if (u.urexp >= (Role_if(PM_WIZARD) ? 1000 : 2000))
202 flags.beginner = FALSE;
203}
204
205/* e.g., hit by drain life attack */
206void

Callers 15

dopotionFunction · 0.85
goto_levelFunction · 0.85
domove_swap_with_petFunction · 0.85
doengraveFunction · 0.85
observe_quantum_catFunction · 0.85
fprefxFunction · 0.85
xkilledFunction · 0.85
see_monster_closeupFunction · 0.85
disarm_squeaky_boardFunction · 0.85
disarm_boxFunction · 0.85
untrapFunction · 0.85
bhitmFunction · 0.85

Calls 1

exp_percent_changingFunction · 0.85

Tested by

no test coverage detected