From c71e8ec8d4e6cac70249a1780cf57746ff1e3669 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sun, 31 Mar 2024 19:43:33 +0300 Subject: [PATCH] Sunsword can be invoked to create a blinding ray --- doc/fixes3-7-0.txt | 1 + include/artifact.h | 3 ++- include/artilist.h | 4 ++-- include/extern.h | 1 + src/apply.c | 27 ++++++++++++++++----------- src/artifact.c | 4 ++++ 6 files changed, 26 insertions(+), 14 deletions(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 3955ecd79..6fb7953a4 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1388,6 +1388,7 @@ if hero shattered an unseen monster's weapon, the [also unseen] weapon was described in the feedback don't self-genocide if a monk picks "master-lich" or "masterlich" as target (was matching "Master" rank) +Sunsword can be invoked to create a blinding ray Fixes to 3.7.0-x General Problems Exposed Via git Repository diff --git a/include/artifact.h b/include/artifact.h index 3085c6eb5..c564eba66 100644 --- a/include/artifact.h +++ b/include/artifact.h @@ -64,7 +64,8 @@ enum invoke_prop_types { CREATE_PORTAL, ENLIGHTENING, CREATE_AMMO, - BANISH + BANISH, + BLINDING_RAY }; /* clang-format on */ diff --git a/include/artilist.h b/include/artilist.h index a542024a3..735ee95a2 100644 --- a/include/artilist.h +++ b/include/artilist.h @@ -179,8 +179,8 @@ static NEARDATA struct artifact artilist[] = { /* Sunsword emits light when wielded (handled in the core rather than via artifact fields), but that light has no particular color */ A("Sunsword", LONG_SWORD, (SPFX_RESTR | SPFX_DFLAG2), 0, M2_UNDEAD, - PHYS(5, 0), DFNS(AD_BLND), NO_CARY, 0, A_LAWFUL, NON_PM, NON_PM, 1500L, - NO_COLOR, SUNSWORD), + PHYS(5, 0), DFNS(AD_BLND), NO_CARY, BLINDING_RAY, A_LAWFUL, NON_PM, + NON_PM, 1500L, NO_COLOR, SUNSWORD), /* * The artifacts for the quest dungeon, all self-willed. diff --git a/include/extern.h b/include/extern.h index 0c5056614..a2b6e1ea1 100644 --- a/include/extern.h +++ b/include/extern.h @@ -103,6 +103,7 @@ extern long timet_delta(time_t, time_t); /* ### apply.c ### */ +extern void do_blinding_ray(struct obj *) NONNULLPTRS; extern int doapply(void); extern int dorub(void); extern int dojump(void); diff --git a/src/apply.c b/src/apply.c index 4a7db4897..034d10d1d 100644 --- a/src/apply.c +++ b/src/apply.c @@ -54,11 +54,24 @@ staticfn boolean find_poleable_mon(coord *, int, int); static const char no_elbow_room[] = "don't have enough elbow-room to maneuver."; +void +do_blinding_ray(struct obj *obj) +{ + struct monst *mtmp = bhit(u.dx, u.dy, COLNO, FLASHED_LIGHT, + (int (*) (MONST_P, OBJ_P)) 0, + (int (*) (OBJ_P, OBJ_P)) 0, &obj); + + obj->ox = u.ux, obj->oy = u.uy; /* flash_hits_mon() wants this */ + if (mtmp) + (void) flash_hits_mon(mtmp, obj); + /* normally bhit() would do this but for FLASHED_LIGHT we want it + to be deferred until after flash_hits_mon() */ + transient_light_cleanup(); +} + staticfn int use_camera(struct obj *obj) { - struct monst *mtmp; - if (Underwater) { pline("Using your camera underwater would void the warranty."); return ECMD_OK; @@ -83,15 +96,7 @@ use_camera(struct obj *obj) } else if (!u.dx && !u.dy) { (void) zapyourself(obj, TRUE); } else { - mtmp = bhit(u.dx, u.dy, COLNO, FLASHED_LIGHT, - (int (*) (MONST_P, OBJ_P)) 0, - (int (*) (OBJ_P, OBJ_P)) 0, &obj); - obj->ox = u.ux, obj->oy = u.uy; /* flash_hits_mon() wants this */ - if (mtmp) - (void) flash_hits_mon(mtmp, obj); - /* normally bhit() would do this but for FLASHED_LIGHT we want it - to be deferred until after flash_hits_mon() */ - transient_light_cleanup(); + do_blinding_ray(obj); } return ECMD_TIME; } diff --git a/src/artifact.c b/src/artifact.c index eb9a3b335..21664234a 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -1916,6 +1916,10 @@ arti_invoke(struct obj *obj) } break; } + case BLINDING_RAY: + if (getdir((char *) 0)) + do_blinding_ray(obj); + break; } } else { long eprop = (u.uprops[oart->inv_prop].extrinsic ^= W_ARTI),