secondary damage for monster spell attacks

Have monster spells
| "shower of missiles" (AT_MAGC+AD_MAGM: Angels, Yeenoghu)
scuff an engraving at the hero's spot if there is one,
| "frost" (AT_MAGC+AD_COLD: only Asmodeus)
freeze water and lava terrain,
| "flames" (AT_MAGC+AD_FIRE: moot, no monster has this attack)
burn items on the floor at the hero's spot and melt ice terrain,
| "pillar of flame" (AT_MAGC+AD_CLRC+randomly chosen clerical spell)
which already burns floor items, melt ice too, and
| "lightning" (same casters as pillar of flame)
give a tiny chance of destroying iron bars.  The chance to hit bars
is low and the hero has to be targeted while located on an iron bars
spot so probably won't happen before the sun burns out, but only
needed one extra line of code.

Only the first two have been thoroughly tested.
This commit is contained in:
PatR
2024-01-16 14:01:38 -08:00
parent a5c7fede99
commit 6b8079a16f
3 changed files with 83 additions and 18 deletions

View File

@@ -5302,6 +5302,42 @@ zap_over_floor(
return rangemod;
}
/* monster has cast flames or frost at target on <x,y>; called by mcastu() */
void
mon_spell_hits_spot(
struct monst *caster UNUSED,
int adtyp, /* canonical damage type */
coordxy x, coordxy y) /* so far, only used for targeting <u.ux,u.uy> */
{
/* "shower of missiles" or [hypothetical] "acid rain" attack:
thoroughly clobber an engraving (unless its type makes it be
scuff-protected); zap_over_floor() doesn't handle this */
if (adtyp == AD_MAGM || adtyp == AD_ACID) {
struct engr *ep = engr_at(x, y);
char *etext = ep ? ep->engr_txt[actual_text] : NULL;
if (etext)
wipe_engr_at(x, y, (int) strlen(etext) + d(6, 6), TRUE);
/* hero and player will still remember prior text until the spot
is re-examined (lookhere or move off and back on) */
}
/* hit items and/or terrain; only matters for AD_FIRE and AD_COLD but
accept any basic damage type that zap_over_floor() might handle */
if (adtyp >= AD_MAGM && adtyp <= AD_ACID) {
boolean shopdummy = FALSE; /* zap_over_floor() requires this even
* though it's only used when zapdmgtyp
* is non-negative (hero's fault) */
int zt_typ = adtyp - 1, /* convert AD_xxxx to ZT_xxxx */
zapdmgtyp = -ZT_SPELL(zt_typ); /* damage is from monster spell */
(void) zap_over_floor(x, y, zapdmgtyp, &shopdummy, TRUE, 0);
} else {
impossible("Unsupported damage type (%d) for mon_spell_hits_spot.",
adtyp);
}
}
/* fractured by pick-axe or wand of striking or by vault guard */
void
fracture_rock(struct obj *obj) /* no texts here! */