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

Function forget

src/read.c:1019–1040  ·  view source on GitHub ↗

* Forget some things (e.g. after reading a scroll of amnesia). When called, * the following are always forgotten: * - felt ball & chain * - skill training * * Other things are subject to flags: * howmuch & ALL_SPELLS = forget all spells */

Source from the content-addressed store, hash-verified

1017 * howmuch & ALL_SPELLS = forget all spells
1018 */
1019staticfn void
1020forget(int howmuch)
1021{
1022 struct monst *mtmp;
1023
1024 if (Punished)
1025 u.bc_felt = 0; /* forget felt ball&chain */
1026
1027 if (howmuch & ALL_SPELLS)
1028 losespells();
1029
1030 /* Forget some skills. */
1031 drain_weapon_skill(rnd(howmuch ? 5 : 3));
1032
1033 /* forget having seen monsts (affects recognizing unseen ones by sound) */
1034 for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
1035 if (mtmp != u.usteed && mtmp != u.ustuck)
1036 mtmp->meverseen = 0;
1037 /* [perhaps ought to forget having seen every monster on every level] */
1038 for (mtmp = gm.migrating_mons; mtmp; mtmp = mtmp->nmon)
1039 mtmp->meverseen = 0;
1040}
1041
1042/* monster is hit by scroll of taming's effect */
1043staticfn int

Callers 1

seffect_amnesiaFunction · 0.85

Calls 3

losespellsFunction · 0.85
drain_weapon_skillFunction · 0.85
rndFunction · 0.85

Tested by

no test coverage detected