From: nethack.allison Date: Fri, 7 Nov 2003 18:42:59 +0000 (+0000) Subject: Acknowledge Schroedinger's cat (trunk only) X-Git-Tag: MOVE2GIT~1606 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=da80c0572e77b366064fe891ef28e0da35b1490e;p=nethack Acknowledge Schroedinger's cat (trunk only) Acknowledge Schroedinger's cat at end of game. - determine cat's status: - give points for the animal which accompanied you. or - include dead cat in the box contents. Schroedinger's cat is the only ordinary creature that could actually ascend with you. This patch doesn't deal with any supernatural creatures including: - djinn in bottles - ghosts in bottles --- diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 185c6ef9b..d9b2b8b69 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -49,6 +49,7 @@ healers notice when a wand of undead turning revives a monster so the wand is then identified update display if bestowed a spellbook while unable to see invisible self use small pool of static buffers for mon_nam() and Monnam() +Acknowledge Schroedinger's cat at end of game Platform- and/or Interface-Specific Fixes diff --git a/src/end.c b/src/end.c index c9331430b..cf33ef4b7 100644 --- a/src/end.c +++ b/src/end.c @@ -39,6 +39,7 @@ STATIC_DCL void FDECL(disclose,(int,BOOLEAN_P)); STATIC_DCL void FDECL(get_valuables, (struct obj *)); STATIC_DCL void FDECL(sort_valuables, (struct valuable_data *,int)); STATIC_DCL void FDECL(artifact_score, (struct obj *,BOOLEAN_P,winid)); +STATIC_DCL boolean FDECL(odds_and_ends, (struct obj *,int)); STATIC_DCL void FDECL(savelife, (int)); STATIC_DCL void FDECL(list_vanquished, (CHAR_P,BOOLEAN_P)); STATIC_DCL void FDECL(list_genocided, (CHAR_P,BOOLEAN_P)); @@ -85,6 +86,8 @@ static NEARDATA const char *ends[] = { /* "when you..." */ "quit", "escaped", "ascended" }; +static boolean Schroedingers_cat = FALSE; + extern const char * const killed_by_prefix[]; /* from topten.c */ /*ARGSUSED*/ @@ -493,6 +496,28 @@ int size; /* max value is less than 20 */ return; } +#define CAT_CHECK 2 + +STATIC_OVL boolean +odds_and_ends(list, what) +struct obj *list; +int what; +{ + struct obj *otmp; + for (otmp = list; otmp; otmp = otmp->nobj) { + switch(what) { + case CAT_CHECK: /* Schroedinger's Cat */ + /* Ascending is deterministic */ + if (otmp->otyp == LARGE_BOX && otmp->spe == 1) + return rn2(2); + break; + } + if (Has_contents(otmp)) + return odds_and_ends(otmp->cobj, what); + } + return FALSE; +} + /* called twice; first to calculate total, then to list relevant items */ STATIC_OVL void artifact_score(list, counting, endwin) @@ -800,6 +825,15 @@ die: viz_array[0][0] |= IN_SIGHT; /* need visibility for naming */ mtmp = mydogs; if (!done_stopprint) Strcpy(pbuf, "You"); + if (!Schroedingers_cat) /* check here in case disclosure was off */ + Schroedingers_cat = odds_and_ends(invent, CAT_CHECK); + if (Schroedingers_cat) { + int mhp, m_lev = adj_lev(&mons[PM_HOUSECAT]); + mhp = d(m_lev, 8); + u.urexp += mhp; + if (!done_stopprint) + Strcat(eos(pbuf), " and Schroedinger's cat"); + } if (mtmp) { while (mtmp) { if (!done_stopprint) @@ -916,9 +950,19 @@ boolean identified, all_containers; { register struct obj *box, *obj; char buf[BUFSZ]; + boolean cat, deadcat; for (box = list; box; box = box->nobj) { if (Is_container(box) || box->otyp == STATUE) { + cat = deadcat = FALSE; + if (box->otyp == LARGE_BOX && + box->spe == 1 && !Schroedingers_cat) { + /* Schroedinger's Cat? */ + cat = odds_and_ends(box, CAT_CHECK); + if (cat) Schroedingers_cat = TRUE; + else deadcat = TRUE; + box->spe = 0; + } if (box->otyp == BAG_OF_TRICKS) { continue; /* wrong type of container */ } else if (box->cobj) { @@ -934,12 +978,20 @@ boolean identified, all_containers; } putstr(tmpwin, 0, doname(obj)); } + if (cat) putstr(tmpwin, 0, "Schroedinger's cat"); + else if (deadcat) putstr(tmpwin, 0, "Schroedinger's dead cat"); display_nhwindow(tmpwin, TRUE); destroy_nhwindow(tmpwin); if (all_containers) container_contents(box->cobj, identified, TRUE); } else { - pline("%s empty.", Tobjnam(box, "are")); + if (cat || deadcat) + pline("%s%s contains Schroedinger's %scat!", + (box->quan > 1) ? "One of the " : "", + (box->quan > 1) ? xname(box) : upstart(xname(box)), + (deadcat) ? "dead " : ""); + else + pline("%s empty.", Tobjnam(box, "are")); display_nhwindow(WIN_MESSAGE, FALSE); } }