From 0473fff5b5908896ac12829afb523ad6d614af4f Mon Sep 17 00:00:00 2001 From: Michael Meyer Date: Wed, 15 Nov 2023 13:50:39 -0500 Subject: [PATCH] Make destruction of altar incite its god's wrath This is for completely destroying an altar with extra-powerful magical digging -- the normal altar_wrath() punishment didn't seem sufficient for such an outrage to me, so skip straight to slinging the lightning bolts. Destroying an altar is unlikely to happen by accident (though it's possible with poorly timed usage of a drum of earthquake). --- include/extern.h | 1 + src/dig.c | 10 +++++++++- src/music.c | 1 + src/pray.c | 29 +++++++++++++++++++---------- 4 files changed, 30 insertions(+), 11 deletions(-) diff --git a/include/extern.h b/include/extern.h index a592d1293..e4974fe9c 100644 --- a/include/extern.h +++ b/include/extern.h @@ -2291,6 +2291,7 @@ extern void speed_up(long); extern boolean critically_low_hp(boolean); extern boolean stuck_in_wall(void); +extern void desecrate_altar(boolean, aligntyp); extern int dosacrifice(void); extern boolean can_pray(boolean); extern int dopray(void); diff --git a/src/dig.c b/src/dig.c index 95348bb90..5a1960d40 100644 --- a/src/dig.c +++ b/src/dig.c @@ -569,7 +569,7 @@ digactualhole(coordxy x, coordxy y, struct monst *madeby, int ttyp) boolean madeby_obj = (madeby == BY_OBJECT); boolean at_u = u_at(x, y); boolean wont_fall = Levitation || Flying; - int old_typ; + int old_typ, old_aligntyp = A_NONE; if (at_u && u.utrap) { if (u.utraptype == TT_BURIEDBALL) @@ -592,6 +592,8 @@ digactualhole(coordxy x, coordxy y, struct monst *madeby, int ttyp) surface_type = (IS_ROOM(old_typ) && !Is_earthlevel(&u.uz) ? "floor" : "ground"); furniture = surface(x, y); + if (IS_ALTAR(lev->typ)) + old_aligntyp = Amask2align(levl[x][y].altarmask & AM_MASK); } else { surface_type = surface(x, y); } @@ -626,6 +628,9 @@ digactualhole(coordxy x, coordxy y, struct monst *madeby, int ttyp) } if (furniture && cansee(x, y)) pline_The("%s falls into the pit!", furniture); + /* wrath should immediately follow altar destruction message */ + if ((madeby_u || madeby_obj) && old_typ == ALTAR) + desecrate_altar(FALSE, old_aligntyp); /* in case we're digging down while encased in solid rock which is blocking levitation or flight */ switch_terrain(); @@ -659,6 +664,9 @@ digactualhole(coordxy x, coordxy y, struct monst *madeby, int ttyp) } if (furniture && cansee(x, y)) pline_The("%s falls through the hole!", furniture); + /* wrath should immediately follow altar destruction message */ + if ((madeby_u || madeby_obj) && old_typ == ALTAR) + desecrate_altar(FALSE, old_aligntyp); if (at_u) { /* in case we're digging down while encased in solid rock diff --git a/src/music.c b/src/music.c index 963e87db0..0883f6d54 100644 --- a/src/music.c +++ b/src/music.c @@ -308,6 +308,7 @@ do_earthquake(int force) if (cansee(x, y)) pline_The("%s altar falls%s.", align_str(algn), into_a_chasm); + desecrate_altar(FALSE, algn); goto do_pit; case GRAVE: if (cansee(x, y)) diff --git a/src/pray.c b/src/pray.c index 87c1b1282..4884f686f 100644 --- a/src/pray.c +++ b/src/pray.c @@ -21,7 +21,6 @@ static void gods_angry(aligntyp); static void gods_upset(aligntyp); static void consume_offering(struct obj *); static void offer_too_soon(aligntyp); -static void desecrate_high_altar(aligntyp); static void offer_real_amulet(struct obj *, aligntyp); /* NORETURN */ static void offer_fake_amulet(struct obj *, boolean, aligntyp); static void offer_different_alignment_altar(struct obj *, aligntyp); @@ -1474,17 +1473,27 @@ offer_too_soon(aligntyp altaralign) : "ashamed"); } -static void -desecrate_high_altar(aligntyp altaralign) +void +desecrate_altar(boolean highaltar, aligntyp altaralign) { + char gvbuf[BUFSZ]; + /* * REAL BAD NEWS!!! High altars cannot be converted. Even an attempt - * gets the god who owns it truly pissed off. + * gets the god who owns it truly pissed off. The same effect for + * deliberately destroying a normal altar. */ + /* if you did this to your own altar, your god will hold a grudge... */ + if (altaralign == u.ualign.type) { + adjalign(-20); + u.ugangr += 5; + } You_feel("the air around you grow charged..."); - pline("Suddenly, you realize that %s has noticed you...", a_gname()); - godvoice(altaralign, - "So, mortal! You dare desecrate my High Temple!"); + pline("Suddenly, you realize that %s has noticed you...", + align_gname(altaralign)); + Sprintf(gvbuf, "So, mortal! You dare desecrate my %s!", + highaltar ? "High Temple" : "altar"); + godvoice(altaralign, gvbuf); /* Throw everything we have at the player */ god_zaps_you(altaralign); } @@ -1581,7 +1590,7 @@ offer_fake_amulet( u.ugangr += 3; /* value = -3; */ if (altaralign != u.ualign.type && highaltar) { - desecrate_high_altar(altaralign); + desecrate_altar(highaltar, altaralign); } else { /* value < 0 */ gods_upset(altaralign); } @@ -1674,7 +1683,7 @@ sacrifice_your_race( if (highaltar && (altaralign != A_CHAOTIC || u.ualign.type != A_CHAOTIC)) { - desecrate_high_altar(altaralign); + desecrate_altar(highaltar, altaralign); return; } else if (altaralign != A_CHAOTIC && altaralign != A_NONE) { /* curse the lawful/neutral altar */ @@ -1928,7 +1937,7 @@ dosacrifice(void) } if (altaralign != u.ualign.type && highaltar) { - desecrate_high_altar(altaralign); + desecrate_altar(highaltar, altaralign); } else if (value < 0) { /* don't think the gods are gonna like this... */ gods_upset(altaralign); } else if (u.ualign.type != altaralign) {