From e7ef0ee0b935c2b9e06ccfa20b7df2ab6085cf13 Mon Sep 17 00:00:00 2001 From: Erik Lunna Date: Sun, 1 Oct 2023 21:23:25 +0200 Subject: [PATCH] The see invisible property is now known as insight. While in effect, it also grants the user the ability to see if items are magical (as wizards do). While implementing this, I also formalized the Magic_sense attribute so it is easier to expand on. --- include/obj.h | 4 ++-- include/prop.h | 5 +++-- include/youprop.h | 4 ++++ src/attrib.c | 3 ++- src/cmd.c | 4 +++- src/do_wear.c | 10 ++++++---- src/objnam.c | 8 ++++---- src/pager.c | 2 +- src/wield.c | 12 ++++++++---- 9 files changed, 33 insertions(+), 19 deletions(-) diff --git a/include/obj.h b/include/obj.h index 0dcca3b83..5d6b952b2 100644 --- a/include/obj.h +++ b/include/obj.h @@ -605,7 +605,7 @@ struct obj { #define ITEM_SLOW 0x00010000L /* extrinsic slowness */ #define ITEM_SUSTAIN 0x00020000L /* extrinsic sustain ability */ #define ITEM_STEALTH 0x00040000L /* extrinsic stealth */ -#define ITEM_SEEINV 0x00080000L /* extrinsic see invisible */ +#define ITEM_INSIGHT 0x00080000L /* extrinsic see invisible */ #define ITEM_SLEEP 0x00100000L /* extrinsic sleep resistance */ #define ITEM_STONE 0x00200000L /* extrinsic stoning resistance */ #define ITEM_SICK 0x00400000L /* extrinsic sickness resistance */ @@ -628,7 +628,7 @@ struct obj { /* Positive properties */ #define ITEM_GOOD_PROPS (ITEM_OILSKIN | ITEM_ESP | ITEM_SEARCHING \ | ITEM_VIGIL | ITEM_EXCEL | ITEM_SUSTAIN \ - | ITEM_STEALTH | ITEM_SEEINV | ITEM_STABLE \ + | ITEM_STEALTH | ITEM_INSIGHT | ITEM_STABLE \ | ITEM_WWALK | ITEM_SWIM | ITEM_BRAVE) /* Negative properties */ #define ITEM_BAD_PROPS (ITEM_FUMBLING | ITEM_HUNGER | ITEM_STENCH \ diff --git a/include/prop.h b/include/prop.h index d8693bbcf..c6b7608a4 100644 --- a/include/prop.h +++ b/include/prop.h @@ -101,9 +101,10 @@ enum prop_types { VULN_ELEC = 81, VULN_ACID = 82, BREATHLESS = 83, - STABLE = 84 + STABLE = 84, + MAGIC_SENSE = 85, }; -#define LAST_PROP (STABLE) +#define LAST_PROP (MAGIC_SENSE) /*** Where the properties come from ***/ /* Definitions were moved here from obj.h and you.h */ diff --git a/include/youprop.h b/include/youprop.h index 166655ad0..56a164244 100644 --- a/include/youprop.h +++ b/include/youprop.h @@ -478,6 +478,10 @@ #define EStable u.uprops[STABLE].extrinsic #define Stable (EStable || HStable) +#define HMagic_sense u.uprops[MAGIC_SENSE].intrinsic +#define EMagic_sense u.uprops[MAGIC_SENSE].extrinsic +#define Magic_sense (HMagic_sense || EMagic_sense) + #define Free_action u.uprops[FREE_ACTION].extrinsic /* [Tom] */ #define Fixed_abil u.uprops[FIXED_ABIL].extrinsic /* KMH */ diff --git a/src/attrib.c b/src/attrib.c index e63cef231..bac226d0e 100644 --- a/src/attrib.c +++ b/src/attrib.c @@ -138,7 +138,8 @@ static const struct innate { { 7, &(HFast), "quick", "slow" }, { 0, 0, 0, 0 } }, - wiz_abil[] = { { 15, &(HWarning), "sensitive", "" }, + wiz_abil[] = { { 1, &(HMagic_sense), "", "" }, + { 15, &(HWarning), "sensitive", "" }, { 17, &(HTeleport_control), "controlled", "uncontrolled" }, { 0, 0, 0, 0 } }, diff --git a/src/cmd.c b/src/cmd.c index 1f3678536..1b82f3b06 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -3409,7 +3409,9 @@ int final; you_are("telepathic", from_what(TELEPAT)); if (Warning) you_are("warned", from_what(WARNING)); - + if (Magic_sense) + enl_msg(You_, "sense", "sensed", " magic", from_what(MAGIC_SENSE)); + /* Need to walk all potential in-use artifacts that glow on warning since * it is possible to have multiple artifacts that warn of the same monster type * as well as artifacts that warn of multiple monster types. */ diff --git a/src/do_wear.c b/src/do_wear.c index a888613bd..bb99144df 100644 --- a/src/do_wear.c +++ b/src/do_wear.c @@ -154,8 +154,8 @@ boolean on; if (discovered) { if (obj->otyp == RIN_SEE_INVISIBLE) learnring(obj, TRUE); - else if (obj->oprops & ITEM_SEEINV) - obj->oprops_known |= ITEM_SEEINV; + else if (obj->oprops & ITEM_INSIGHT) + obj->oprops_known |= ITEM_INSIGHT; else makeknown(obj->otyp); } @@ -252,8 +252,9 @@ long mask; if (props & ITEM_SEARCHING) ESearching |= mask; - if (props & ITEM_SEEINV) { + if (props & ITEM_INSIGHT) { ESee_invisible |= mask; + EMagic_sense |= mask; toggle_seeinv(otmp, (ESee_invisible & ~mask), TRUE); } if (props & ITEM_EXCEL) { @@ -350,8 +351,9 @@ long mask; } if (props & ITEM_SEARCHING) ESearching &= ~mask; - if (props & ITEM_SEEINV) { + if (props & ITEM_INSIGHT) { ESee_invisible &= ~mask; + EMagic_sense &= ~mask; toggle_seeinv(otmp, (ESee_invisible & ~mask), FALSE); } if (props & ITEM_EXCEL) { diff --git a/src/objnam.c b/src/objnam.c index dcd9be112..bb938e93f 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -618,8 +618,8 @@ boolean has_of; Strcpy(of, " and"); } } - if (props & ITEM_SEEINV) { - if ((props_known & ITEM_SEEINV) || dump_prop_flag) { + if (props & ITEM_INSIGHT) { + if ((props_known & ITEM_INSIGHT) || dump_prop_flag) { Strcat(buf, of), Strcat(buf, " insight"), Strcpy(of, " and"); } @@ -779,7 +779,7 @@ unsigned cxn_flags; /* bitmask of CXN_xxx values */ obj->dknown = 1; if (is_soko_prize_flag(obj)) obj->dknown = 1; - if (Role_if(PM_WIZARD) + if (Magic_sense && ((obj->oprops & ITEM_PROP_MASK) || (objects[obj->otyp].oc_magic && !nn) || obj->oartifact)) @@ -4326,7 +4326,7 @@ struct obj *no_wish; objpropcount++; } else if (!strncmpi((p + of), "insight", l = strlen("insight"))) { if (!objpropcount || wizard) - objprops |= ITEM_SEEINV; + objprops |= ITEM_INSIGHT; objpropcount++; } else if (!strncmpi((p + of), "excellence", l = strlen("excellence"))) { if (!objpropcount || wizard) diff --git a/src/pager.c b/src/pager.c index 76d07f72e..6ea7f0a95 100644 --- a/src/pager.c +++ b/src/pager.c @@ -1300,7 +1300,7 @@ char *usr_text; && (oc.oc_class == WEAPON_CLASS || oc.oc_class == ARMOR_CLASS)) { if (obj->oprops & ITEM_ESP) OBJPUTSTR("Grants telepathy"); if (obj->oprops & ITEM_SEARCHING) OBJPUTSTR("Grants searching"); - if (obj->oprops & ITEM_SEEINV) OBJPUTSTR("Grants see invisible"); + if (obj->oprops & ITEM_INSIGHT) OBJPUTSTR("Grants see invisible"); if (obj->oprops & ITEM_EXCEL) OBJPUTSTR("Grants luck/CHA adjustment"); if (obj->oprops & ITEM_VIGIL) OBJPUTSTR("Grants warning/DEX adjustment"); if (obj->oprops & ITEM_HUNGER) OBJPUTSTR("Grants hunger"); diff --git a/src/wield.c b/src/wield.c index d2144fca9..28728ac0e 100644 --- a/src/wield.c +++ b/src/wield.c @@ -133,8 +133,9 @@ register struct obj *obj; see_monsters(); (void) changes_stat(olduwep, ITEM_VIGIL); } - if (olduwep->oprops & ITEM_SEEINV) { + if (olduwep->oprops & ITEM_INSIGHT) { ESee_invisible &= ~W_WEP; + EMagic_sense &= ~W_WEP; toggle_seeinv(olduwep, (ESee_invisible & ~W_WEP), FALSE); } if (olduwep->oprops & ITEM_FUMBLING) { @@ -212,8 +213,9 @@ register struct obj *obj; see_monsters(); (void) changes_stat(uwep, ITEM_VIGIL); } - if (uwep->oprops & ITEM_SEEINV) { + if (uwep->oprops & ITEM_INSIGHT) { ESee_invisible |= W_WEP; + EMagic_sense |= W_WEP; toggle_seeinv(uwep, (ESee_invisible & ~W_WEP), TRUE); } if (uwep->oprops & ITEM_FUMBLING) { @@ -511,12 +513,14 @@ register struct obj *obj; /* Insight property */ if (uswapwep == obj - && (u.twoweap && (uswapwep->oprops & ITEM_SEEINV))) { + && (u.twoweap && (uswapwep->oprops & ITEM_INSIGHT))) { ESee_invisible |= W_SWAPWEP; + EMagic_sense |= W_SWAPWEP; toggle_seeinv(uswapwep, (ESee_invisible & ~W_SWAPWEP), TRUE); } - if (!u.twoweap && olduswapwep && (olduswapwep->oprops & ITEM_SEEINV)) { + if (!u.twoweap && olduswapwep && (olduswapwep->oprops & ITEM_INSIGHT)) { ESee_invisible &= ~W_SWAPWEP; + EMagic_sense &= ~W_SWAPWEP; toggle_seeinv(olduswapwep, (ESee_invisible & ~W_SWAPWEP), FALSE); }