Skip to content

Commit ff85b06

Browse files
committed
Add Heaven or Hell/Hell or Hell modes.
Ignore-this: d788cd3d7764813c95055d74c203675 Breaks save compatibility. Add options hell_or_hell and heaven_or_hell. The latter makes the player and the monsters have 1 maxhp at all times. The first is the same, but monsters have their normal maxhp. When either of modes is turned on, most damaging traps don't do anything and potions throws don't do damage. darcs-hash:20110428213825-40dd4-f5a966244c06176d2a606d45837d58327fd16497
1 parent 553a589 commit ff85b06

File tree

15 files changed

+143
-19
lines changed

15 files changed

+143
-19
lines changed

include/display.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@
4040
* vicinity, and a glyph representing the warning level is displayed.
4141
*/
4242

43-
#define mon_warning(mon) (Warning && !(mon)->mpeaceful && \
43+
#define mon_warning(mon) ((Warning || heaven_or_hell_mode) && \
44+
!(mon)->mpeaceful && \
4445
(distu((mon)->mx, (mon)->my) < 100) && \
45-
(((int) ((mon)->m_lev / 4)) >= flags.warnlevel))
46+
((((int) ((mon)->m_lev / 4)) >= flags.warnlevel) || \
47+
heaven_or_hell_mode))
4648

4749
/*
4850
* mon_visible()

include/flag.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ struct flag {
4545
boolean forcefight;
4646
boolean friday13; /* it's Friday the 13th */
4747
boolean help; /* look in data file for info about stuff */
48+
boolean heaven_or_hell; /* die in one hit/enemies die in one hit */
49+
boolean hell_or_hell; /* die in one hit */
50+
#define heaven_or_hell_mode (flags.heaven_or_hell || flags.hell_or_hell)
51+
#define hell_or_hell_mode flags.hell_or_hell
4852
boolean ignintr; /* ignore interrupts */
4953
#ifdef INSURANCE
5054
boolean ins_chkpt; /* checkpoint as appropriate */

include/you.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,8 @@ struct you {
272272
int uhunger; /* refd only in eat.c and shk.c */
273273
unsigned uhs; /* hunger state - see eat.c */
274274

275+
int ulives; /* heaven or hell mode, number of lives */
276+
275277
struct prop uprops[LAST_PROP+1];
276278

277279
unsigned umconf;

src/allmain.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,13 @@ moveloop()
134134
break; /* it's now your action or the next turn */
135135
} while (monscanmove);
136136
flags.mon_moving = FALSE;
137+
/* heaven or hell mode: player always has 1 maxhp */
138+
if (heaven_or_hell_mode)
139+
{
140+
u.uhpmax = 1;
141+
if (u.uhp > u.uhpmax)
142+
u.uhp = u.uhpmax;
143+
}
137144

138145
if (((!monscanmove && youmonst.movement < NORMAL_SPEED) ||
139146
turns_behind) && (!iflags.multiplayer || !u.ustuck)) {

src/cmd.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,6 +1121,16 @@ int final; /* 0 => still in progress; 1 => over, survived; 2 => dead */
11211121
you_are(hofe_titles[u.uevent.uhand_of_elbereth - 1]);
11221122
}
11231123
#endif
1124+
/* heaven or hell modes */
1125+
if (heaven_or_hell_mode) {
1126+
if (u.ulives > 1)
1127+
Sprintf(buf, "%d lives", u.ulives);
1128+
else if (u.ulives == 0)
1129+
Sprintf(buf, "no lives");
1130+
else
1131+
Sprintf(buf, "%d life", u.ulives);
1132+
you_have(buf);
1133+
}
11241134

11251135
/* note: piousness 20 matches MIN_QUEST_ALIGN (quest.h) */
11261136
if (u.ualign.record >= 20) you_are("piously aligned");
@@ -1676,6 +1686,14 @@ int final;
16761686
putstr_or_dump(en_win, 0, "Voluntary challenges:");
16771687
putstr_or_dump(en_win, 0, "");
16781688

1689+
if (heaven_or_hell_mode) {
1690+
if (flags.hell_or_hell) {
1691+
you_have_been("following the path of Hell or Hell");
1692+
}
1693+
else
1694+
you_have_been("following the path of Heaven or Hell");
1695+
}
1696+
16791697
if (!u.uconduct.food)
16801698
enl_msg(You_, "have gone", "went", " without food");
16811699
/* But beverages are okay */

src/display.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,9 @@ display_warning(mon)
462462
int wl = (int) (mon->m_lev / 4);
463463
int glyph;
464464

465+
if (heaven_or_hell_mode && wl == 0)
466+
wl = 1;
467+
465468
if (mon_warning(mon)) {
466469
if (wl > WARNCOUNT - 1) wl = WARNCOUNT - 1;
467470
/* 3.4.1: this really ought to be rn2(WARNCOUNT), but value "0"

src/end.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ STATIC_PTR void FDECL(done_intr, (int));
4141
static void FDECL(done_hangup, (int));
4242
# endif
4343
#endif
44+
STATIC_PTR int NDECL(heaven_or_hell_lifesave_end);
4445
STATIC_DCL void FDECL(disclose,(int,BOOLEAN_P,long));
4546
STATIC_DCL void FDECL(get_valuables, (struct obj *));
4647
STATIC_DCL void FDECL(sort_valuables, (struct valuable_data *,int));
@@ -960,6 +961,24 @@ int how;
960961
killer = kilbuf;
961962

962963
if (how < PANICKED) u.umortality++;
964+
/* Save life when under heaven or hell mode, but not when
965+
* self-genociding. */
966+
if (u.ulives > 0 && how < GENOCIDED) {
967+
pline("But wait...");
968+
You("suddenly start to feel better!");
969+
savelife(how);
970+
u.ulives--;
971+
if (!u.ulives)
972+
You_feel("death is waiting for you just around the corner...");
973+
/* Set invulnerability and wait until player gets another action. */
974+
nomul(-5);
975+
u.uinvulnerable = TRUE;
976+
nomovemsg = You_can_move_again;
977+
afternmv = heaven_or_hell_lifesave_end;
978+
killer = 0;
979+
killer_format = 0;
980+
return;
981+
}
963982
if (Lifesaved && (how <= GENOCIDED)) {
964983
pline("But wait...");
965984
makeknown(AMULET_OF_LIFE_SAVING);
@@ -1263,6 +1282,12 @@ int how;
12631282
terminate(EXIT_SUCCESS);
12641283
}
12651284

1285+
STATIC_PTR int
1286+
heaven_or_hell_lifesave_end()
1287+
{
1288+
u.uinvulnerable = FALSE;
1289+
return(1);
1290+
}
12661291

12671292
void
12681293
container_contents(list, identified, all_containers)

src/exper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ const char *drainer; /* cause of death, if drain should be fatal */
142142
}
143143
num = newhp();
144144
u.uhpmax -= num;
145-
if (u.uhpmax < 1) u.uhpmax = 1;
145+
if (u.uhpmax < 1 || heaven_or_hell_mode) u.uhpmax = 1;
146146
u.uhp -= num;
147147
if (u.uhp < 1) u.uhp = 1;
148148
else if (u.uhp > u.uhpmax) u.uhp = u.uhpmax;

src/makemon.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,6 +1136,13 @@ register int mmflags;
11361136
mtmp->mstrategy |= STRAT_CLOSE;
11371137
}
11381138

1139+
/* heaven or hell mode */
1140+
if (heaven_or_hell_mode && !hell_or_hell_mode)
1141+
{
1142+
mtmp->mhpmax = 1;
1143+
mtmp->mhp = 1;
1144+
}
1145+
11391146
if (!in_mklev)
11401147
newsym(mtmp->mx,mtmp->my); /* make sure the mon shows up */
11411148

src/monmove.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ mon_regen(mon, digest_meal)
168168
struct monst *mon;
169169
boolean digest_meal;
170170
{
171-
if (is_mp_player(mon)) return; /* regeneration handled separately */
172171
if (mon->mhp < mon->mhpmax &&
173172
(monstermoves % 20 == 0 || regenerates(mon->data))) mon->mhp++;
174173
if (mon->mspec_used) mon->mspec_used--;

0 commit comments

Comments
 (0)