From: PatR Date: Mon, 2 Mar 2020 23:16:50 +0000 (-0800) Subject: conditional status condition tracking X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=661570f7a9ce441f87a3550d960660d18500b070;p=nethack conditional status condition tracking If 'sinking-into-lava' is disabled as a displayed status condition but general 'trapped' is enabled, then display 'trapped' when in lava. Similarly, if 'grabbed-by-eel' is disabled but more general 'held' is enabled, display 'held' when grabbed. --- diff --git a/src/botl.c b/src/botl.c index 4a80ed43b..3b29e348b 100644 --- a/src/botl.c +++ b/src/botl.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 botl.c $NHDT-Date: 1573178085 2019/11/08 01:54:45 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.148 $ */ +/* NetHack 3.6 botl.c $NHDT-Date: 1583190980 2020/03/02 23:16:20 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.185 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -835,38 +835,57 @@ bot_via_windowport() #define test_if_enabled(c) if (condtests[(c)].enabled) condtests[(c)].test + condtests[bl_foodpois].test = condtests[bl_termill].test = FALSE; + if (Sick) { + test_if_enabled(bl_foodpois) = (u.usick_type & SICK_VOMITABLE) != 0; + test_if_enabled(bl_termill) = (u.usick_type & SICK_NONVOMITABLE) != 0; + } + condtests[bl_inlava].test = condtests[bl_tethered].test + = condtests[bl_trapped].test = FALSE; + if (u.utrap) { + test_if_enabled(bl_inlava) = (u.utraptype == TT_LAVA); + test_if_enabled(bl_tethered) = (u.utraptype == TT_BURIEDBALL); + /* if in-lava or tethered is disabled and the condition applies, + lump it in with trapped */ + test_if_enabled(bl_trapped) = (!condtests[bl_inlava].test + && !condtests[bl_tethered].test); + } + condtests[bl_grab].test = condtests[bl_held].test + = condtests[bl_holding].test = FALSE; + if (u.ustuck) { + if (Upolyd && sticks(g.youmonst.data)) { + test_if_enabled(bl_holding) = TRUE; + } else { + test_if_enabled(bl_grab) = (u.ustuck->data->mlet == S_EEL); +#if 0 + test_if_enabled(bl_engulfed) = u.uswallow ? TRUE : FALSE; + test_if_enabled(bl_held) = (!condtests[bl_grab].test + && !condtests[bl_engulfed].test); +#else + test_if_enabled(bl_held) = (!condtests[bl_grab].test + /* engulfed/swallowed isn't currently a tracked condition + and showing "held" when in that state looks a bit odd, + so suppress "held" if swallowed */ + && !u.uswallow); +#endif + } + } condtests[bl_blind].test = (Blind); condtests[bl_conf].test = (Confusion) ? TRUE : FALSE; condtests[bl_deaf].test = (Deaf); condtests[bl_fly].test = (Flying); - condtests[bl_foodpois].test = (Sick - && (u.usick_type & SICK_VOMITABLE) != 0); condtests[bl_glowhands].test = (u.umconf); - condtests[bl_grab].test = (u.ustuck && u.ustuck->data->mlet == S_EEL); condtests[bl_hallu].test = (Hallucination); - condtests[bl_inlava].test = (u.utrap && u.utraptype == TT_LAVA); condtests[bl_lev].test = (Levitation); condtests[bl_ride].test = (u.usteed) ? TRUE : FALSE; condtests[bl_slime].test = (Slimed) ? TRUE : FALSE; condtests[bl_stone].test = (Stoned) ? TRUE : FALSE; condtests[bl_strngl].test = (Strangled) ? TRUE : FALSE; condtests[bl_stun].test = (Stunned) ? TRUE : FALSE; - condtests[bl_termill].test = (Sick - && (u.usick_type & SICK_NONVOMITABLE) - != 0); test_if_enabled(bl_elf_iron) = (FALSE); test_if_enabled(bl_bareh) = (!uarmg && !uwep); - /* do this next one before bl_held */ - condtests[bl_holding].test = (u.ustuck && !u.uswallow - && Upolyd && sticks(g.youmonst.data)); - test_if_enabled(bl_held) = (u.ustuck && !u.uswallow - && !condtests[bl_holding].test - && !condtests[bl_grab].test); test_if_enabled(bl_icy) = levl[u.ux][u.uy].typ == ICE; test_if_enabled(bl_slippery) = (Glib) ? TRUE : FALSE; - test_if_enabled(bl_trapped) = (u.utrap && u.utraptype != TT_BURIEDBALL - && u.utraptype != TT_LAVA); - test_if_enabled(bl_tethered) = (u.utrap && u.utraptype == TT_BURIEDBALL); test_if_enabled(bl_woundedl) = (Wounded_legs); if (g.multi < 0) {