Skip to content

Commit

Permalink
The see invisible property is now known as insight. While in effect, …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
elunna committed Oct 1, 2023
1 parent 8cc13fb commit e7ef0ee
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 19 deletions.
4 changes: 2 additions & 2 deletions include/obj.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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 \
Expand Down
5 changes: 3 additions & 2 deletions include/prop.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
4 changes: 4 additions & 0 deletions include/youprop.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
3 changes: 2 additions & 1 deletion src/attrib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 } },

Expand Down
4 changes: 3 additions & 1 deletion src/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
10 changes: 6 additions & 4 deletions src/do_wear.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions src/objnam.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/pager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
12 changes: 8 additions & 4 deletions src/wield.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit e7ef0ee

Please sign in to comment.