From afbcf3f9a9b122c5e47ac17c4d55cc203e9fe45e Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 20 Jul 2020 03:00:28 -0700 Subject: [PATCH] monk's to-hit penalty for wearing a suit If hero is a monk who is wearing a suit, have ^X mention the to-hit penalty for that in the status section even though it isn't a normal status line item. Combat feedback makes it annoyingly obvious, but player might forget if MSGTYPE=hide is used to suppress the "Your armor is rather cumbersome..." message. --- doc/fixes37.0 | 1 + include/flag.h | 1 + src/insight.c | 18 ++++++++++++++++-- src/worn.c | 11 ++++++++--- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index b942f6c9e..54eaa0d11 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -391,6 +391,7 @@ for !fixinv option where inventory letters normally don't stick, try to put thrown from; only works if it does return and is successfully caught wizard mode #wizborn command include more skill information in ^X output when dual-wielding +include monk's to-hit penalty for worn suit in the status section of ^X output item-using monsters will zap wand of undead turning at corpse-wielding hero when the corpse is harmful boiling a pool or fountain now creates a temporary cloud of steam diff --git a/include/flag.h b/include/flag.h index 3439cc5b1..6750e336f 100644 --- a/include/flag.h +++ b/include/flag.h @@ -238,6 +238,7 @@ struct instance_flags { * disable to avoid excessive noise when using * a screen reader (use ^X to review status) */ boolean toptenwin; /* ending list in window instead of stdout */ + boolean tux_penalty; /* True iff hero is a monk and wearing a suit */ boolean use_background_glyph; /* use background glyph when appropriate */ boolean use_menu_color; /* use color in menus; only if wc_color */ #ifdef STATUS_HILITES diff --git a/src/insight.c b/src/insight.c index b26e1efbf..a110c1cea 100644 --- a/src/insight.c +++ b/src/insight.c @@ -1018,6 +1018,15 @@ int final; } /* current weapon(s) and corresponding skill level(s) */ weapon_insight(final); + /* unlike ring of increase accuracy's effect, the monk's suit penalty + is too blatant to be restricted to magical enlightenment */ + if (iflags.tux_penalty && !Upolyd) { + (void) enlght_combatinc("to hit", -g.urole.spelarmr, final, buf); + /* if from_what() ever gets extended from wizard mode to normal + play, it could be adapted to handled this */ + Sprintf(eos(buf), " due to your %s", suit_simple_name(uarm)); + you_have(buf, ""); + } /* report 'nudity' */ if (!uarm && !uarmu && !uarmc && !uarms && !uarmg && !uarmf && !uarmh) { if (u.uroleplay.nudist) @@ -1467,8 +1476,13 @@ int final; enl_msg("You regenerate", "", "d", "", from_what(REGENERATION)); if (Slow_digestion) you_have("slower digestion", from_what(SLOW_DIGESTION)); - if (u.uhitinc) - you_have(enlght_combatinc("to hit", u.uhitinc, final, buf), ""); + if (u.uhitinc) { + (void) enlght_combatinc("to hit", u.uhitinc, final, buf); + if (iflags.tux_penalty && !Upolyd) + Sprintf(eos(buf), " %s your suit penalty", + (u.uhitinc < 0) ? "increasing" : "offsetting"); + you_have(buf, ""); + } if (u.udaminc) you_have(enlght_combatinc("damage", u.udaminc, final, buf), ""); if (u.uspellprot || Protection) { diff --git a/src/worn.c b/src/worn.c index 231df0961..918a3b143 100644 --- a/src/worn.c +++ b/src/worn.c @@ -57,9 +57,7 @@ long mask; uskin = obj; /* assert( !uarm ); */ } else { - if ((mask & W_ARMOR)) - u.uroleplay.nudist = FALSE; - for (wp = worn; wp->w_mask; wp++) + for (wp = worn; wp->w_mask; wp++) { if (wp->w_mask & mask) { oobj = *(wp->w_obj); if (oobj && !(oobj->owornmask & wp->w_mask)) @@ -105,6 +103,11 @@ long mask; } } } + } + if (obj && (obj->owornmask & W_ARMOR) != 0L) + u.uroleplay.nudist = FALSE; + /* tux -> tuxedo -> "monkey suit" -> monk's suit */ + iflags.tux_penalty = (uarm && Role_if(PM_MONK) && g.urole.spelarmr); } update_inventory(); } @@ -137,6 +140,8 @@ register struct obj *obj; if ((p = w_blocks(obj, wp->w_mask)) != 0) u.uprops[p].blocked &= ~wp->w_mask; } + if (!uarm) + iflags.tux_penalty = FALSE; update_inventory(); }