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

Function addinv_core2

src/invent.c:1024–1049  ·  view source on GitHub ↗

* Adjust hero intrinsics (and perform other side effects) as if this * object was being added to the hero's inventory. Called _after_ the * object has been added to the hero's inventory. * * This can be used either for updating intrinsics, or to allow the hero to * react to objects that are now in inventory. * * This is called when adding objects to the hero's inventory normally (via * ad

Source from the content-addressed store, hash-verified

1022 * (e.g. do not assume that the object was not in inventory already).
1023 */
1024void
1025addinv_core2(struct obj *obj)
1026{
1027 if (confers_luck(obj)) {
1028 /* new luckstone must be in inventory by this point
1029 for correct calculation */
1030 set_moreluck();
1031 }
1032
1033 /* Archeologists can decipher the writing on a scroll label to work out
1034 what they are (exception: unlabeled scrolls don't have a label to
1035 decipher) */
1036 if (Role_if(PM_ARCHEOLOGIST) && obj->oclass == SCROLL_CLASS &&
1037 obj->otyp != SCR_BLANK_PAPER && !Blind &&
1038 !objects[obj->otyp].oc_name_known) {
1039 observe_object(obj);
1040 pline("You decipher the label on %s.", yname(obj));
1041 makeknown(obj->otyp);
1042
1043 /* conduct: this is avoidable via not picking up / wishing for
1044 scrolls */
1045 if (!u.uconduct.literate++)
1046 livelog_printf(LL_CONDUCT,
1047 "became literate by deciphering a scroll label");
1048 }
1049}
1050
1051/*
1052 * Add obj to the hero's inventory. Make sure the object is "free".

Callers 3

addinv_core0Function · 0.85
learn_unseen_inventFunction · 0.85
poly_objFunction · 0.85

Calls 6

confers_luckFunction · 0.85
set_moreluckFunction · 0.85
observe_objectFunction · 0.85
ynameFunction · 0.85
livelog_printfFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected