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

Function addinv_core1

src/invent.c:959–1005  ·  view source on GitHub ↗

* Adjust hero intrinsics as if this object was being added to the hero's * inventory. Called _before_ the object has been added to the hero's * inventory. * * This is called when adding objects to the hero's inventory normally (via * addinv) or when an object in the hero's inventory has been polymorphed * in-place. */

Source from the content-addressed store, hash-verified

957 * in-place.
958 */
959void
960addinv_core1(struct obj *obj)
961{
962 if (obj->oclass == COIN_CLASS) {
963 disp.botl = TRUE;
964 } else if (obj->otyp == AMULET_OF_YENDOR) {
965 if (u.uhave.amulet)
966 impossible("already have amulet?");
967 u.uhave.amulet = 1;
968 record_achievement(ACH_AMUL);
969 } else if (obj->otyp == CANDELABRUM_OF_INVOCATION) {
970 if (u.uhave.menorah)
971 impossible("already have candelabrum?");
972 u.uhave.menorah = 1;
973 record_achievement(ACH_CNDL);
974 } else if (obj->otyp == BELL_OF_OPENING) {
975 if (u.uhave.bell)
976 impossible("already have silver bell?");
977 u.uhave.bell = 1;
978 record_achievement(ACH_BELL);
979 } else if (obj->otyp == SPE_BOOK_OF_THE_DEAD) {
980 if (u.uhave.book)
981 impossible("already have the book?");
982 u.uhave.book = 1;
983 record_achievement(ACH_BOOK);
984 } else if (obj->oartifact) {
985 if (is_quest_artifact(obj)) {
986 if (u.uhave.questart)
987 impossible("already have quest artifact?");
988 u.uhave.questart = 1;
989 artitouch(obj);
990 }
991 set_artifact_intrinsic(obj, 1, W_ART);
992 }
993
994 /* "special achievements"; revealed in end of game disclosure and
995 dumplog, originally just recorded in XLOGFILE */
996 if (is_mines_prize(obj)) {
997 record_achievement(ACH_MINE_PRIZE);
998 svc.context.achieveo.mines_prize_oid = 0; /* done w/ luckstone o_id */
999 obj->nomerge = 0; /* was set in create_object(sp_lev.c) */
1000 } else if (is_soko_prize(obj)) {
1001 record_achievement(ACH_SOKO_PRIZE);
1002 svc.context.achieveo.soko_prize_oid = 0; /* done w/ bag/amulet o_id */
1003 obj->nomerge = 0; /* (got set in sp_lev.c) */
1004 }
1005}
1006
1007/*
1008 * Adjust hero intrinsics (and perform other side effects) as if this

Callers 2

addinv_core0Function · 0.85
poly_objFunction · 0.85

Calls 5

record_achievementFunction · 0.85
is_quest_artifactFunction · 0.85
artitouchFunction · 0.85
set_artifact_intrinsicFunction · 0.85
impossibleFunction · 0.70

Tested by

no test coverage detected