1999-09-09 01:57:16 +04:00
|
|
|
/* $NetBSD: fight.c,v 1.5 1999/09/08 21:57:18 jsm Exp $ */
|
1995-03-24 06:58:08 +03:00
|
|
|
|
1994-10-22 00:19:39 +03:00
|
|
|
/*
|
|
|
|
* fight.c Phantasia monster fighting routines
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "include.h"
|
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
void
|
1994-10-22 00:19:39 +03:00
|
|
|
encounter(particular)
|
1997-10-13 06:18:06 +04:00
|
|
|
int particular;
|
1994-10-22 00:19:39 +03:00
|
|
|
{
|
1997-10-13 06:18:06 +04:00
|
|
|
bool firsthit = Player.p_blessing; /* set if player gets the
|
|
|
|
* first hit */
|
|
|
|
int flockcnt = 1; /* how many time flocked */
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
/* let others know what we are doing */
|
|
|
|
Player.p_status = S_MONSTER;
|
|
|
|
writerecord(&Player, Fileloc);
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
#if __GNUC__
|
|
|
|
(void)&firsthit; /* XXX shut up gcc */
|
1994-10-22 00:19:39 +03:00
|
|
|
#endif
|
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
#ifdef SYS5
|
|
|
|
flushinp();
|
|
|
|
#endif
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
Shield = 0.0; /* no shield up yet */
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
if (particular >= 0)
|
|
|
|
/* monster is specified */
|
|
|
|
Whichmonster = particular;
|
|
|
|
else
|
|
|
|
/* pick random monster */
|
|
|
|
Whichmonster = pickmonster();
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
setjmp(Fightenv); /* this is to enable changing fight state */
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
move(6, 0);
|
|
|
|
clrtobot(); /* clear bottom area of screen */
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
Lines = 9;
|
|
|
|
callmonster(Whichmonster); /* set up monster to fight */
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
Luckout = FALSE; /* haven't tried to luckout yet */
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
if (Curmonster.m_type == SM_MORGOTH)
|
|
|
|
mvprintw(4, 0, "You've encountered %s, Bane of the Council and Valar.\n",
|
|
|
|
Enemyname);
|
|
|
|
|
|
|
|
if (Curmonster.m_type == SM_UNICORN) {
|
|
|
|
if (Player.p_virgin) {
|
|
|
|
printw("You just subdued %s, thanks to the virgin.\n", Enemyname);
|
|
|
|
Player.p_virgin = FALSE;
|
|
|
|
} else {
|
|
|
|
printw("You just saw %s running away!\n", Enemyname);
|
|
|
|
Curmonster.m_experience = 0.0;
|
|
|
|
Curmonster.m_treasuretype = 0;
|
1994-10-22 00:19:39 +03:00
|
|
|
}
|
1997-10-13 06:18:06 +04:00
|
|
|
} else
|
|
|
|
/* not a special monster */
|
|
|
|
for (;;)
|
|
|
|
/* print header, and arbitrate between player and
|
|
|
|
* monster */
|
1994-10-22 00:19:39 +03:00
|
|
|
{
|
1997-10-13 06:18:06 +04:00
|
|
|
mvprintw(6, 0, "You are being attacked by %s, EXP: %.0f (Size: %.0f)\n",
|
|
|
|
Enemyname, Curmonster.m_experience, Circle);
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
displaystats();
|
|
|
|
mvprintw(1, 26, "%20.0f", Player.p_energy + Shield); /* overprint energy */
|
|
|
|
readmessage();
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
if (Curmonster.m_type == SM_DARKLORD
|
|
|
|
&& Player.p_blessing
|
|
|
|
&& Player.p_charms > 0)
|
|
|
|
/* overpower Dark Lord with blessing and charm */
|
|
|
|
{
|
|
|
|
mvprintw(7, 0, "You just overpowered %s!", Enemyname);
|
|
|
|
Lines = 8;
|
|
|
|
Player.p_blessing = FALSE;
|
|
|
|
--Player.p_charms;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* allow paralyzed monster to wake up */
|
|
|
|
Curmonster.m_speed = MIN(Curmonster.m_speed + 1.0, Curmonster.m_maxspeed);
|
|
|
|
|
|
|
|
if (drandom() * Curmonster.m_speed > drandom() * Player.p_speed
|
|
|
|
/* monster is faster */
|
|
|
|
&& Curmonster.m_type != SM_DARKLORD
|
|
|
|
/* not D. L. */
|
|
|
|
&& Curmonster.m_type != SM_SHRIEKER
|
|
|
|
/* not mimic */
|
|
|
|
&& !firsthit)
|
|
|
|
/* monster gets a hit */
|
|
|
|
monsthits();
|
|
|
|
else
|
|
|
|
/* player gets a hit */
|
|
|
|
{
|
|
|
|
firsthit = FALSE;
|
|
|
|
playerhits();
|
|
|
|
}
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
refresh();
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
if (Lines > LINES - 2)
|
|
|
|
/* near bottom of screen - pause */
|
|
|
|
{
|
|
|
|
more(Lines);
|
|
|
|
move(Lines = 8, 0);
|
|
|
|
clrtobot();
|
|
|
|
}
|
|
|
|
if (Player.p_energy <= 0.0)
|
|
|
|
/* player died */
|
|
|
|
{
|
|
|
|
more(Lines);
|
|
|
|
death(Enemyname);
|
|
|
|
cancelmonster();
|
|
|
|
break; /* fight ends if the player is saved
|
|
|
|
* from death */
|
|
|
|
}
|
|
|
|
if (Curmonster.m_energy <= 0.0)
|
|
|
|
/* monster died */
|
|
|
|
break;
|
|
|
|
}
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
/* give player credit for killing monster */
|
|
|
|
Player.p_experience += Curmonster.m_experience;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
if (drandom() < Curmonster.m_flock / 100.0)
|
|
|
|
/* monster flocks */
|
1994-10-22 00:19:39 +03:00
|
|
|
{
|
1997-10-13 06:18:06 +04:00
|
|
|
more(Lines);
|
|
|
|
++flockcnt;
|
|
|
|
longjmp(Fightenv, 0);
|
|
|
|
/* NOTREACHED */
|
|
|
|
} else
|
|
|
|
if (Circle > 1.0
|
|
|
|
&& Curmonster.m_treasuretype > 0
|
|
|
|
&& drandom() > 0.2 + pow(0.4, (double) (flockcnt / 3 + Circle / 3.0)))
|
|
|
|
/* monster has treasure; this takes # of flocks and
|
|
|
|
* size into account */
|
|
|
|
{
|
|
|
|
more(Lines);
|
|
|
|
awardtreasure();
|
|
|
|
}
|
|
|
|
/* pause before returning */
|
|
|
|
getyx(stdscr, Lines, flockcnt);
|
|
|
|
more(Lines + 1);
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
Player.p_ring.ring_inuse = FALSE; /* not using ring */
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
/* clean up the screen */
|
|
|
|
move(4, 0);
|
|
|
|
clrtobot();
|
1994-10-22 00:19:39 +03:00
|
|
|
}
|
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
int
|
1994-10-22 00:19:39 +03:00
|
|
|
pickmonster()
|
|
|
|
{
|
1997-10-13 06:18:06 +04:00
|
|
|
if (Player.p_specialtype == SC_VALAR)
|
|
|
|
/* even chance of any monster */
|
|
|
|
return ((int) ROLL(0.0, 100.0));
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
if (Marsh)
|
|
|
|
/* water monsters */
|
|
|
|
return ((int) ROLL(0.0, 15.0));
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
else
|
|
|
|
if (Circle > 24)
|
|
|
|
/* even chance of all non-water monsters */
|
|
|
|
return ((int) ROLL(14.0, 86.0));
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
else
|
|
|
|
if (Circle > 15)
|
|
|
|
/* chance of all non-water monsters, weighted
|
|
|
|
* toward middle */
|
|
|
|
return ((int) (ROLL(0.0, 50.0) + ROLL(14.0, 37.0)));
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
else
|
|
|
|
if (Circle > 8)
|
|
|
|
/* not all non-water monsters,
|
|
|
|
* weighted toward middle */
|
|
|
|
return ((int) (ROLL(0.0, 50.0) + ROLL(14.0, 26.0)));
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
else
|
|
|
|
if (Circle > 3)
|
|
|
|
/* even chance of some tamer
|
|
|
|
* non-water monsters */
|
|
|
|
return ((int) ROLL(14.0, 50.0));
|
|
|
|
|
|
|
|
else
|
|
|
|
/* even chance of some of the
|
|
|
|
* tamest non-water monsters */
|
|
|
|
return ((int) ROLL(14.0, 25.0));
|
1994-10-22 00:19:39 +03:00
|
|
|
}
|
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
void
|
1994-10-22 00:19:39 +03:00
|
|
|
playerhits()
|
|
|
|
{
|
1997-10-13 06:18:06 +04:00
|
|
|
double inflict; /* damage inflicted */
|
|
|
|
int ch; /* input */
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
mvaddstr(7, 0, "1:Melee 2:Skirmish 3:Evade 4:Spell 5:Nick ");
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1998-08-30 13:19:36 +04:00
|
|
|
if (!Luckout) {
|
1997-10-13 06:18:06 +04:00
|
|
|
/* haven't tried to luckout yet */
|
|
|
|
if (Curmonster.m_type == SM_MORGOTH)
|
|
|
|
/* cannot luckout against Morgoth */
|
|
|
|
addstr("6:Ally ");
|
|
|
|
else
|
|
|
|
addstr("6:Luckout ");
|
1998-08-30 13:19:36 +04:00
|
|
|
}
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
if (Player.p_ring.ring_type != R_NONE)
|
|
|
|
/* player has a ring */
|
|
|
|
addstr("7:Use Ring ");
|
|
|
|
else
|
|
|
|
clrtoeol();
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
ch = inputoption();
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
move(8, 0);
|
|
|
|
clrtobot(); /* clear any messages from before */
|
|
|
|
Lines = 9;
|
|
|
|
mvaddstr(4, 0, "\n\n"); /* clear status area */
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
switch (ch) {
|
1994-10-22 00:19:39 +03:00
|
|
|
case 'T': /* timeout; lose turn */
|
1997-10-13 06:18:06 +04:00
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
|
|
|
case ' ':
|
|
|
|
case '1': /* melee */
|
1997-10-13 06:18:06 +04:00
|
|
|
/* melee affects monster's energy and strength */
|
|
|
|
inflict = ROLL(Player.p_might / 2.0 + 5.0, 1.3 * Player.p_might)
|
|
|
|
+ (Player.p_ring.ring_inuse ? Player.p_might : 0.0);
|
|
|
|
|
|
|
|
Curmonster.m_melee += inflict;
|
|
|
|
Curmonster.m_strength = Curmonster.m_o_strength
|
|
|
|
- Curmonster.m_melee / Curmonster.m_o_energy
|
|
|
|
* Curmonster.m_o_strength / 4.0;
|
|
|
|
hitmonster(inflict);
|
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
|
|
|
case '2': /* skirmish */
|
1997-10-13 06:18:06 +04:00
|
|
|
/* skirmish affects monter's energy and speed */
|
|
|
|
inflict = ROLL(Player.p_might / 3.0 + 3.0, 1.1 * Player.p_might)
|
|
|
|
+ (Player.p_ring.ring_inuse ? Player.p_might : 0.0);
|
|
|
|
|
|
|
|
Curmonster.m_skirmish += inflict;
|
|
|
|
Curmonster.m_maxspeed = Curmonster.m_o_speed
|
|
|
|
- Curmonster.m_skirmish / Curmonster.m_o_energy
|
|
|
|
* Curmonster.m_o_speed / 4.0;
|
|
|
|
hitmonster(inflict);
|
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
|
|
|
case '3': /* evade */
|
1997-10-13 06:18:06 +04:00
|
|
|
/* use brains and speed to try to evade */
|
|
|
|
if ((Curmonster.m_type == SM_DARKLORD
|
|
|
|
|| Curmonster.m_type == SM_SHRIEKER
|
1994-10-22 00:19:39 +03:00
|
|
|
/* can always run from D. L. and shrieker */
|
1997-10-13 06:18:06 +04:00
|
|
|
|| drandom() * Player.p_speed * Player.p_brains
|
|
|
|
> drandom() * Curmonster.m_speed * Curmonster.m_brains)
|
|
|
|
&& (Curmonster.m_type != SM_MIMIC))
|
|
|
|
/* cannot run from mimic */
|
1994-10-22 00:19:39 +03:00
|
|
|
{
|
1997-10-13 06:18:06 +04:00
|
|
|
mvaddstr(Lines++, 0, "You got away!");
|
|
|
|
cancelmonster();
|
|
|
|
altercoordinates(0.0, 0.0, A_NEAR);
|
|
|
|
} else
|
|
|
|
mvprintw(Lines++, 0, "%s is still after you!", Enemyname);
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
|
|
|
case 'M':
|
|
|
|
case '4': /* magic spell */
|
1997-10-13 06:18:06 +04:00
|
|
|
throwspell();
|
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
|
|
|
case '5': /* nick */
|
1997-10-13 06:18:06 +04:00
|
|
|
/* hit 1 plus sword; give some experience */
|
|
|
|
inflict = 1.0 + Player.p_sword;
|
|
|
|
Player.p_experience += floor(Curmonster.m_experience / 10.0);
|
|
|
|
Curmonster.m_experience *= 0.92;
|
|
|
|
/* monster gets meaner */
|
|
|
|
Curmonster.m_maxspeed += 2.0;
|
|
|
|
Curmonster.m_speed = (Curmonster.m_speed < 0.0) ? 0.0 : Curmonster.m_speed + 2.0;
|
|
|
|
if (Curmonster.m_type == SM_DARKLORD)
|
|
|
|
/* Dark Lord; doesn't like to be nicked */
|
1994-10-22 00:19:39 +03:00
|
|
|
{
|
1997-10-13 06:18:06 +04:00
|
|
|
mvprintw(Lines++, 0,
|
|
|
|
"You hit %s %.0f times, and made him mad!", Enemyname, inflict);
|
|
|
|
Player.p_quickness /= 2.0;
|
|
|
|
altercoordinates(0.0, 0.0, A_FAR);
|
|
|
|
cancelmonster();
|
|
|
|
} else
|
|
|
|
hitmonster(inflict);
|
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
|
|
|
case 'B':
|
1997-10-13 06:18:06 +04:00
|
|
|
case '6': /* luckout */
|
|
|
|
if (Luckout)
|
|
|
|
mvaddstr(Lines++, 0, "You already tried that.");
|
|
|
|
else {
|
|
|
|
Luckout = TRUE;
|
|
|
|
if (Curmonster.m_type == SM_MORGOTH)
|
|
|
|
/* Morgoth; ally */
|
1994-10-22 00:19:39 +03:00
|
|
|
{
|
1997-10-13 06:18:06 +04:00
|
|
|
if (drandom() < Player.p_sin / 100.0) {
|
|
|
|
mvprintw(Lines++, 0, "%s accepted!", Enemyname);
|
|
|
|
cancelmonster();
|
|
|
|
} else
|
|
|
|
mvaddstr(Lines++, 0, "Nope, he's not interested.");
|
|
|
|
} else
|
|
|
|
/* normal monster; use brains for success */
|
1994-10-22 00:19:39 +03:00
|
|
|
{
|
1997-10-13 06:18:06 +04:00
|
|
|
if ((drandom() + 0.333) * Player.p_brains
|
|
|
|
< (drandom() + 0.333) * Curmonster.m_brains)
|
|
|
|
mvprintw(Lines++, 0, "You blew it, %s.", Player.p_name);
|
|
|
|
else {
|
|
|
|
mvaddstr(Lines++, 0, "You made it!");
|
|
|
|
Curmonster.m_energy = 0.0;
|
|
|
|
}
|
1994-10-22 00:19:39 +03:00
|
|
|
}
|
|
|
|
}
|
1997-10-13 06:18:06 +04:00
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
|
|
|
case '7': /* use ring */
|
1997-10-13 06:18:06 +04:00
|
|
|
if (Player.p_ring.ring_type != R_NONE) {
|
|
|
|
mvaddstr(Lines++, 0, "Now using ring.");
|
|
|
|
Player.p_ring.ring_inuse = TRUE;
|
|
|
|
if (Player.p_ring.ring_type != R_DLREG)
|
|
|
|
/* age ring */
|
|
|
|
--Player.p_ring.ring_duration;
|
1994-10-22 00:19:39 +03:00
|
|
|
}
|
1997-10-13 06:18:06 +04:00
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
void
|
1994-10-22 00:19:39 +03:00
|
|
|
monsthits()
|
|
|
|
{
|
1997-10-13 06:18:06 +04:00
|
|
|
double inflict; /* damage inflicted */
|
|
|
|
int ch; /* input */
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
switch (Curmonster.m_type)
|
|
|
|
/* may be a special monster */
|
1994-10-22 00:19:39 +03:00
|
|
|
{
|
|
|
|
case SM_DARKLORD:
|
1997-10-13 06:18:06 +04:00
|
|
|
/* hits just enough to kill player */
|
|
|
|
inflict = (Player.p_energy + Shield) * 1.02;
|
|
|
|
goto SPECIALHIT;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
|
|
|
case SM_SHRIEKER:
|
1997-10-13 06:18:06 +04:00
|
|
|
/* call a big monster */
|
|
|
|
mvaddstr(Lines++, 0,
|
|
|
|
"Shrieeeek!! You scared it, and it called one of its friends.");
|
|
|
|
more(Lines);
|
|
|
|
Whichmonster = (int) ROLL(70.0, 30.0);
|
|
|
|
longjmp(Fightenv, 0);
|
|
|
|
/* NOTREACHED */
|
1994-10-22 00:19:39 +03:00
|
|
|
|
|
|
|
case SM_BALROG:
|
1997-10-13 06:18:06 +04:00
|
|
|
/* take experience away */
|
|
|
|
inflict = ROLL(10.0, Curmonster.m_strength);
|
|
|
|
inflict = MIN(Player.p_experience, inflict);
|
|
|
|
mvprintw(Lines++, 0,
|
|
|
|
"%s took away %.0f experience points.", Enemyname, inflict);
|
|
|
|
Player.p_experience -= inflict;
|
|
|
|
return;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
|
|
|
case SM_FAERIES:
|
1997-10-13 06:18:06 +04:00
|
|
|
if (Player.p_holywater > 0)
|
|
|
|
/* holy water kills when monster tries to hit */
|
1994-10-22 00:19:39 +03:00
|
|
|
{
|
1997-10-13 06:18:06 +04:00
|
|
|
mvprintw(Lines++, 0, "Your holy water killed it!");
|
|
|
|
--Player.p_holywater;
|
|
|
|
Curmonster.m_energy = 0.0;
|
|
|
|
return;
|
1994-10-22 00:19:39 +03:00
|
|
|
}
|
1997-10-13 06:18:06 +04:00
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
|
|
|
case SM_NONE:
|
|
|
|
/* normal hit */
|
|
|
|
break;
|
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
default:
|
|
|
|
if (drandom() > 0.2)
|
|
|
|
/* normal hit */
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* else special things */
|
|
|
|
switch (Curmonster.m_type) {
|
1994-10-22 00:19:39 +03:00
|
|
|
case SM_LEANAN:
|
1997-10-13 06:18:06 +04:00
|
|
|
/* takes some of the player's strength */
|
|
|
|
inflict = ROLL(1.0, (Circle - 1.0) / 2.0);
|
|
|
|
inflict = MIN(Player.p_strength, inflict);
|
|
|
|
mvprintw(Lines++, 0, "%s sapped %0.f of your strength!",
|
|
|
|
Enemyname, inflict);
|
|
|
|
Player.p_strength -= inflict;
|
|
|
|
Player.p_might -= inflict;
|
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
|
|
|
case SM_SARUMAN:
|
1997-10-13 06:18:06 +04:00
|
|
|
if (Player.p_palantir)
|
|
|
|
/* take away palantir */
|
1994-10-22 00:19:39 +03:00
|
|
|
{
|
1997-10-13 06:18:06 +04:00
|
|
|
mvprintw(Lines++, 0, "Wormtongue stole your palantir!");
|
|
|
|
Player.p_palantir = FALSE;
|
|
|
|
} else
|
|
|
|
if (drandom() > 0.5)
|
|
|
|
/* gems turn to gold */
|
|
|
|
{
|
|
|
|
mvprintw(Lines++, 0,
|
|
|
|
"%s transformed your gems into gold!", Enemyname);
|
|
|
|
Player.p_gold += Player.p_gems;
|
|
|
|
Player.p_gems = 0.0;
|
|
|
|
} else
|
|
|
|
/* scramble some stats */
|
|
|
|
{
|
|
|
|
mvprintw(Lines++, 0, "%s scrambled your stats!", Enemyname);
|
|
|
|
scramblestats();
|
|
|
|
}
|
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
|
|
|
case SM_THAUMATURG:
|
1997-10-13 06:18:06 +04:00
|
|
|
/* transport player */
|
|
|
|
mvprintw(Lines++, 0, "%s transported you!", Enemyname);
|
|
|
|
altercoordinates(0.0, 0.0, A_FAR);
|
|
|
|
cancelmonster();
|
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
|
|
|
case SM_VORTEX:
|
1997-10-13 06:18:06 +04:00
|
|
|
/* suck up some mana */
|
|
|
|
inflict = ROLL(0, 7.5 * Circle);
|
|
|
|
inflict = MIN(Player.p_mana, floor(inflict));
|
|
|
|
mvprintw(Lines++, 0,
|
|
|
|
"%s sucked up %.0f of your mana!", Enemyname, inflict);
|
|
|
|
Player.p_mana -= inflict;
|
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
|
|
|
case SM_NAZGUL:
|
1997-10-13 06:18:06 +04:00
|
|
|
/* try to take ring if player has one */
|
|
|
|
if (Player.p_ring.ring_type != R_NONE)
|
|
|
|
/* player has a ring */
|
1994-10-22 00:19:39 +03:00
|
|
|
{
|
1997-10-13 06:18:06 +04:00
|
|
|
mvaddstr(Lines++, 0, "Will you relinguish your ring ? ");
|
|
|
|
ch = getanswer("YN", FALSE);
|
|
|
|
if (ch == 'Y')
|
|
|
|
/* take ring away */
|
|
|
|
{
|
|
|
|
Player.p_ring.ring_type = R_NONE;
|
|
|
|
Player.p_ring.ring_inuse = FALSE;
|
|
|
|
cancelmonster();
|
|
|
|
break;
|
|
|
|
}
|
1994-10-22 00:19:39 +03:00
|
|
|
}
|
1997-10-13 06:18:06 +04:00
|
|
|
/* otherwise, take some brains */
|
|
|
|
mvprintw(Lines++, 0,
|
|
|
|
"%s neutralized 1/5 of your brain!", Enemyname);
|
|
|
|
Player.p_brains *= 0.8;
|
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
|
|
|
case SM_TIAMAT:
|
1997-10-13 06:18:06 +04:00
|
|
|
/* take some gold and gems */
|
|
|
|
mvprintw(Lines++, 0,
|
|
|
|
"%s took half your gold and gems and flew off.", Enemyname);
|
|
|
|
Player.p_gold /= 2.0;
|
|
|
|
Player.p_gems /= 2.0;
|
|
|
|
cancelmonster();
|
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
|
|
|
case SM_KOBOLD:
|
1997-10-13 06:18:06 +04:00
|
|
|
/* steal a gold piece and run */
|
|
|
|
mvprintw(Lines++, 0,
|
|
|
|
"%s stole one gold piece and ran away.", Enemyname);
|
|
|
|
Player.p_gold = MAX(0.0, Player.p_gold - 1.0);
|
|
|
|
cancelmonster();
|
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
|
|
|
case SM_SHELOB:
|
1997-10-13 06:18:06 +04:00
|
|
|
/* bite and (medium) poison */
|
|
|
|
mvprintw(Lines++, 0,
|
|
|
|
"%s has bitten and poisoned you!", Enemyname);
|
|
|
|
Player.p_poison -= 1.0;
|
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
|
|
|
case SM_LAMPREY:
|
1997-10-13 06:18:06 +04:00
|
|
|
/* bite and (small) poison */
|
|
|
|
mvprintw(Lines++, 0, "%s bit and poisoned you!", Enemyname);
|
|
|
|
Player.p_poison += 0.25;
|
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
|
|
|
case SM_BONNACON:
|
1997-10-13 06:18:06 +04:00
|
|
|
/* fart and run */
|
|
|
|
mvprintw(Lines++, 0, "%s farted and scampered off.", Enemyname);
|
|
|
|
Player.p_energy /= 2.0; /* damage from fumes */
|
|
|
|
cancelmonster();
|
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
|
|
|
case SM_SMEAGOL:
|
1997-10-13 06:18:06 +04:00
|
|
|
if (Player.p_ring.ring_type != R_NONE)
|
|
|
|
/* try to steal ring */
|
1994-10-22 00:19:39 +03:00
|
|
|
{
|
1997-10-13 06:18:06 +04:00
|
|
|
mvprintw(Lines++, 0,
|
|
|
|
"%s tried to steal your ring, ", Enemyname);
|
|
|
|
if (drandom() > 0.1)
|
|
|
|
addstr("but was unsuccessful.");
|
|
|
|
else {
|
|
|
|
addstr("and ran away with it!");
|
|
|
|
Player.p_ring.ring_type = R_NONE;
|
|
|
|
cancelmonster();
|
|
|
|
}
|
1994-10-22 00:19:39 +03:00
|
|
|
}
|
1997-10-13 06:18:06 +04:00
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
|
|
|
case SM_SUCCUBUS:
|
1997-10-13 06:18:06 +04:00
|
|
|
/* inflict damage through shield */
|
|
|
|
inflict = ROLL(15.0, Circle * 10.0);
|
|
|
|
inflict = MIN(inflict, Player.p_energy);
|
|
|
|
mvprintw(Lines++, 0, "%s sapped %.0f of your energy.",
|
|
|
|
Enemyname, inflict);
|
|
|
|
Player.p_energy -= inflict;
|
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
|
|
|
case SM_CERBERUS:
|
1997-10-13 06:18:06 +04:00
|
|
|
/* take all metal treasures */
|
|
|
|
mvprintw(Lines++, 0,
|
|
|
|
"%s took all your metal treasures!", Enemyname);
|
|
|
|
Player.p_crowns = 0;
|
|
|
|
Player.p_sword =
|
|
|
|
Player.p_shield =
|
|
|
|
Player.p_gold = 0.0;
|
|
|
|
cancelmonster();
|
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
|
|
|
case SM_UNGOLIANT:
|
1997-10-13 06:18:06 +04:00
|
|
|
/* (large) poison and take a quickness */
|
|
|
|
mvprintw(Lines++, 0,
|
|
|
|
"%s poisoned you, and took one quik.", Enemyname);
|
|
|
|
Player.p_poison += 5.0;
|
|
|
|
Player.p_quickness -= 1.0;
|
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
|
|
|
case SM_JABBERWOCK:
|
1997-10-13 06:18:06 +04:00
|
|
|
/* fly away, and leave either a Jubjub bird or
|
|
|
|
* Bonnacon */
|
|
|
|
mvprintw(Lines++, 0,
|
|
|
|
"%s flew away, and left you to contend with one of its friends.",
|
|
|
|
Enemyname);
|
|
|
|
Whichmonster = 55 + (drandom() > 0.5) ? 22 : 0;
|
|
|
|
longjmp(Fightenv, 0);
|
|
|
|
/* NOTREACHED */
|
1994-10-22 00:19:39 +03:00
|
|
|
|
|
|
|
case SM_TROLL:
|
1997-10-13 06:18:06 +04:00
|
|
|
/* partially regenerate monster */
|
|
|
|
mvprintw(Lines++, 0,
|
|
|
|
"%s partially regenerated his energy.!", Enemyname);
|
|
|
|
Curmonster.m_energy +=
|
|
|
|
floor((Curmonster.m_o_energy - Curmonster.m_energy) / 2.0);
|
|
|
|
Curmonster.m_strength = Curmonster.m_o_strength;
|
|
|
|
Curmonster.m_melee = Curmonster.m_skirmish = 0.0;
|
|
|
|
Curmonster.m_maxspeed = Curmonster.m_o_speed;
|
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
|
|
|
case SM_WRAITH:
|
1997-10-13 06:18:06 +04:00
|
|
|
if (!Player.p_blindness)
|
|
|
|
/* make blind */
|
1994-10-22 00:19:39 +03:00
|
|
|
{
|
1997-10-13 06:18:06 +04:00
|
|
|
mvprintw(Lines++, 0, "%s blinded you!", Enemyname);
|
|
|
|
Player.p_blindness = TRUE;
|
|
|
|
Enemyname = "A monster";
|
1994-10-22 00:19:39 +03:00
|
|
|
}
|
1997-10-13 06:18:06 +04:00
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
}
|
1997-10-13 06:18:06 +04:00
|
|
|
return;
|
1994-10-22 00:19:39 +03:00
|
|
|
}
|
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
/* fall through to here if monster inflicts a normal hit */
|
|
|
|
inflict = drandom() * Curmonster.m_strength + 0.5;
|
1994-10-22 00:19:39 +03:00
|
|
|
SPECIALHIT:
|
1997-10-13 06:18:06 +04:00
|
|
|
mvprintw(Lines++, 0, "%s hit you %.0f times!", Enemyname, inflict);
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
if ((Shield -= inflict) < 0) {
|
|
|
|
Player.p_energy += Shield;
|
|
|
|
Shield = 0.0;
|
1994-10-22 00:19:39 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
void
|
1994-10-22 00:19:39 +03:00
|
|
|
cancelmonster()
|
|
|
|
{
|
1997-10-13 06:18:06 +04:00
|
|
|
Curmonster.m_energy = 0.0;
|
|
|
|
Curmonster.m_experience = 0.0;
|
|
|
|
Curmonster.m_treasuretype = 0;
|
|
|
|
Curmonster.m_flock = 0.0;
|
1994-10-22 00:19:39 +03:00
|
|
|
}
|
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
void
|
1994-10-22 00:19:39 +03:00
|
|
|
hitmonster(inflict)
|
1997-10-13 06:18:06 +04:00
|
|
|
double inflict;
|
1994-10-22 00:19:39 +03:00
|
|
|
{
|
1997-10-13 06:18:06 +04:00
|
|
|
mvprintw(Lines++, 0, "You hit %s %.0f times!", Enemyname, inflict);
|
|
|
|
Curmonster.m_energy -= inflict;
|
|
|
|
if (Curmonster.m_energy > 0.0) {
|
|
|
|
if (Curmonster.m_type == SM_DARKLORD || Curmonster.m_type == SM_SHRIEKER)
|
|
|
|
/* special monster didn't die */
|
|
|
|
monsthits();
|
|
|
|
} else
|
|
|
|
/* monster died. print message. */
|
1994-10-22 00:19:39 +03:00
|
|
|
{
|
1997-10-13 06:18:06 +04:00
|
|
|
if (Curmonster.m_type == SM_MORGOTH)
|
|
|
|
mvaddstr(Lines++, 0, "You have defeated Morgoth, but he may return. . .");
|
|
|
|
else
|
|
|
|
/* all other types of monsters */
|
|
|
|
{
|
|
|
|
mvprintw(Lines++, 0, "You killed it. Good work, %s.", Player.p_name);
|
|
|
|
|
|
|
|
if (Curmonster.m_type == SM_MIMIC
|
|
|
|
&& strcmp(Curmonster.m_name, "A Mimic") != 0
|
|
|
|
&& !Player.p_blindness)
|
|
|
|
mvaddstr(Lines++, 0, "The body slowly changes into the form of a mimic.");
|
|
|
|
}
|
1994-10-22 00:19:39 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
void
|
1994-10-22 00:19:39 +03:00
|
|
|
throwspell()
|
|
|
|
{
|
1997-10-13 06:18:06 +04:00
|
|
|
double inflict; /* damage inflicted */
|
|
|
|
double dtemp; /* for dtemporary calculations */
|
|
|
|
int ch; /* input */
|
|
|
|
|
|
|
|
inflict = 0;
|
|
|
|
mvaddstr(7, 0, "\n\n"); /* clear menu area */
|
|
|
|
|
|
|
|
if (Player.p_magiclvl >= ML_ALLORNOTHING)
|
|
|
|
mvaddstr(7, 0, "1:All or Nothing ");
|
|
|
|
if (Player.p_magiclvl >= ML_MAGICBOLT)
|
|
|
|
addstr("2:Magic Bolt ");
|
|
|
|
if (Player.p_magiclvl >= ML_FORCEFIELD)
|
|
|
|
addstr("3:Force Field ");
|
|
|
|
if (Player.p_magiclvl >= ML_XFORM)
|
|
|
|
addstr("4:Transform ");
|
|
|
|
if (Player.p_magiclvl >= ML_INCRMIGHT)
|
|
|
|
addstr("5:Increase Might\n");
|
|
|
|
if (Player.p_magiclvl >= ML_INVISIBLE)
|
|
|
|
mvaddstr(8, 0, "6:Invisibility ");
|
|
|
|
if (Player.p_magiclvl >= ML_XPORT)
|
|
|
|
addstr("7:Transport ");
|
|
|
|
if (Player.p_magiclvl >= ML_PARALYZE)
|
|
|
|
addstr("8:Paralyze ");
|
|
|
|
if (Player.p_specialtype >= SC_COUNCIL)
|
|
|
|
addstr("9:Specify");
|
|
|
|
mvaddstr(4, 0, "Spell ? ");
|
|
|
|
|
|
|
|
ch = getanswer(" ", TRUE);
|
|
|
|
|
|
|
|
mvaddstr(7, 0, "\n\n"); /* clear menu area */
|
|
|
|
|
|
|
|
if (Curmonster.m_type == SM_MORGOTH && ch != '3')
|
|
|
|
/* can only throw force field against Morgoth */
|
|
|
|
ILLSPELL();
|
|
|
|
else
|
|
|
|
switch (ch) {
|
|
|
|
case '1': /* all or nothing */
|
|
|
|
if (drandom() < 0.25)
|
|
|
|
/* success */
|
|
|
|
{
|
|
|
|
inflict = Curmonster.m_energy * 1.01 + 1.0;
|
|
|
|
|
|
|
|
if (Curmonster.m_type == SM_DARKLORD)
|
|
|
|
/* all or nothing doesn't quite work
|
|
|
|
* against D. L. */
|
|
|
|
inflict *= 0.9;
|
|
|
|
} else
|
|
|
|
/* failure -- monster gets stronger and
|
|
|
|
* quicker */
|
|
|
|
{
|
|
|
|
Curmonster.m_o_strength = Curmonster.m_strength *= 2.0;
|
|
|
|
Curmonster.m_maxspeed *= 2.0;
|
|
|
|
Curmonster.m_o_speed *= 2.0;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
/* paralyzed monsters wake up a bit */
|
|
|
|
Curmonster.m_speed = MAX(1.0, Curmonster.m_speed * 2.0);
|
|
|
|
}
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
if (Player.p_mana >= MM_ALLORNOTHING)
|
|
|
|
/* take a mana if player has one */
|
|
|
|
Player.p_mana -= MM_ALLORNOTHING;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
hitmonster(inflict);
|
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
case '2': /* magic bolt */
|
|
|
|
if (Player.p_magiclvl < ML_MAGICBOLT)
|
|
|
|
ILLSPELL();
|
|
|
|
else {
|
|
|
|
do
|
|
|
|
/* prompt for amount to expend */
|
|
|
|
{
|
|
|
|
mvaddstr(4, 0, "How much mana for bolt? ");
|
|
|
|
dtemp = floor(infloat());
|
|
|
|
}
|
|
|
|
while (dtemp < 0.0 || dtemp > Player.p_mana);
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
Player.p_mana -= dtemp;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
if (Curmonster.m_type == SM_DARKLORD)
|
|
|
|
/* magic bolts don't work against D.
|
|
|
|
* L. */
|
|
|
|
inflict = 0.0;
|
|
|
|
else
|
|
|
|
inflict = dtemp * ROLL(15.0, sqrt(Player.p_magiclvl / 3.0 + 1.0));
|
|
|
|
mvaddstr(5, 0, "Magic Bolt fired!\n");
|
|
|
|
hitmonster(inflict);
|
|
|
|
}
|
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
case '3': /* force field */
|
|
|
|
if (Player.p_magiclvl < ML_FORCEFIELD)
|
|
|
|
ILLSPELL();
|
|
|
|
else
|
|
|
|
if (Player.p_mana < MM_FORCEFIELD)
|
|
|
|
NOMANA();
|
|
|
|
else {
|
|
|
|
Player.p_mana -= MM_FORCEFIELD;
|
|
|
|
Shield = (Player.p_maxenergy + Player.p_shield) * 4.2 + 45.0;
|
|
|
|
mvaddstr(5, 0, "Force Field up.\n");
|
|
|
|
}
|
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
case '4': /* transform */
|
|
|
|
if (Player.p_magiclvl < ML_XFORM)
|
|
|
|
ILLSPELL();
|
|
|
|
else
|
|
|
|
if (Player.p_mana < MM_XFORM)
|
|
|
|
NOMANA();
|
|
|
|
else {
|
|
|
|
Player.p_mana -= MM_XFORM;
|
|
|
|
Whichmonster = (int) ROLL(0.0, 100.0);
|
|
|
|
longjmp(Fightenv, 0);
|
|
|
|
/* NOTREACHED */
|
|
|
|
}
|
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
case '5': /* increase might */
|
|
|
|
if (Player.p_magiclvl < ML_INCRMIGHT)
|
|
|
|
ILLSPELL();
|
|
|
|
else
|
|
|
|
if (Player.p_mana < MM_INCRMIGHT)
|
|
|
|
NOMANA();
|
|
|
|
else {
|
|
|
|
Player.p_mana -= MM_INCRMIGHT;
|
|
|
|
Player.p_might +=
|
|
|
|
(1.2 * (Player.p_strength + Player.p_sword)
|
|
|
|
+ 5.0 - Player.p_might) / 2.0;
|
|
|
|
mvprintw(5, 0, "New strength: %.0f\n", Player.p_might);
|
|
|
|
}
|
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
case '6': /* invisible */
|
|
|
|
if (Player.p_magiclvl < ML_INVISIBLE)
|
|
|
|
ILLSPELL();
|
|
|
|
else
|
|
|
|
if (Player.p_mana < MM_INVISIBLE)
|
|
|
|
NOMANA();
|
|
|
|
else {
|
|
|
|
Player.p_mana -= MM_INVISIBLE;
|
|
|
|
Player.p_speed +=
|
|
|
|
(1.2 * (Player.p_quickness + Player.p_quksilver)
|
|
|
|
+ 5.0 - Player.p_speed) / 2.0;
|
|
|
|
mvprintw(5, 0, "New quickness: %.0f\n", Player.p_speed);
|
|
|
|
}
|
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
case '7': /* transport */
|
|
|
|
if (Player.p_magiclvl < ML_XPORT)
|
|
|
|
ILLSPELL();
|
|
|
|
else
|
|
|
|
if (Player.p_mana < MM_XPORT)
|
|
|
|
NOMANA();
|
|
|
|
else {
|
|
|
|
Player.p_mana -= MM_XPORT;
|
|
|
|
if (Player.p_brains + Player.p_magiclvl
|
|
|
|
< Curmonster.m_experience / 200.0 * drandom()) {
|
|
|
|
mvaddstr(5, 0, "Transport backfired!\n");
|
|
|
|
altercoordinates(0.0, 0.0, A_FAR);
|
|
|
|
cancelmonster();
|
|
|
|
} else {
|
|
|
|
mvprintw(5, 0, "%s is transported.\n", Enemyname);
|
|
|
|
if (drandom() < 0.3)
|
|
|
|
/* monster didn't drop
|
|
|
|
* its treasure */
|
|
|
|
Curmonster.m_treasuretype = 0;
|
|
|
|
|
|
|
|
Curmonster.m_energy = 0.0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
case '8': /* paralyze */
|
|
|
|
if (Player.p_magiclvl < ML_PARALYZE)
|
|
|
|
ILLSPELL();
|
|
|
|
else
|
|
|
|
if (Player.p_mana < MM_PARALYZE)
|
|
|
|
NOMANA();
|
|
|
|
else {
|
|
|
|
Player.p_mana -= MM_PARALYZE;
|
|
|
|
if (Player.p_magiclvl >
|
|
|
|
Curmonster.m_experience / 1000.0 * drandom()) {
|
|
|
|
mvprintw(5, 0, "%s is held.\n", Enemyname);
|
|
|
|
Curmonster.m_speed = -2.0;
|
|
|
|
} else
|
|
|
|
mvaddstr(5, 0, "Monster unaffected.\n");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '9': /* specify */
|
|
|
|
if (Player.p_specialtype < SC_COUNCIL)
|
|
|
|
ILLSPELL();
|
|
|
|
else
|
|
|
|
if (Player.p_mana < MM_SPECIFY)
|
|
|
|
NOMANA();
|
|
|
|
else {
|
|
|
|
Player.p_mana -= MM_SPECIFY;
|
|
|
|
mvaddstr(5, 0, "Which monster do you want [0-99] ? ");
|
|
|
|
Whichmonster = (int) infloat();
|
|
|
|
Whichmonster = MAX(0, MIN(99, Whichmonster));
|
|
|
|
longjmp(Fightenv, 0);
|
|
|
|
/* NOTREACHED */
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
1994-10-22 00:19:39 +03:00
|
|
|
}
|
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
void
|
1994-10-22 00:19:39 +03:00
|
|
|
callmonster(which)
|
1997-10-13 06:18:06 +04:00
|
|
|
int which;
|
1994-10-22 00:19:39 +03:00
|
|
|
{
|
1997-10-13 06:18:06 +04:00
|
|
|
struct monster Othermonster; /* to find a name for mimics */
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
which = MIN(which, 99); /* make sure within range */
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
/* fill structure */
|
1999-09-09 01:57:16 +04:00
|
|
|
fseek(Monstfp, (long) which * (long) SZ_MONSTERSTRUCT, SEEK_SET);
|
1997-10-13 06:18:06 +04:00
|
|
|
fread((char *) &Curmonster, SZ_MONSTERSTRUCT, 1, Monstfp);
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
/* handle some special monsters */
|
|
|
|
if (Curmonster.m_type == SM_MODNAR) {
|
|
|
|
if (Player.p_specialtype < SC_COUNCIL)
|
|
|
|
/* randomize some stats */
|
|
|
|
{
|
|
|
|
Curmonster.m_strength *= drandom() + 0.5;
|
|
|
|
Curmonster.m_brains *= drandom() + 0.5;
|
|
|
|
Curmonster.m_speed *= drandom() + 0.5;
|
|
|
|
Curmonster.m_energy *= drandom() + 0.5;
|
|
|
|
Curmonster.m_experience *= drandom() + 0.5;
|
|
|
|
Curmonster.m_treasuretype =
|
|
|
|
(int) ROLL(0.0, (double) Curmonster.m_treasuretype);
|
|
|
|
} else
|
|
|
|
/* make Modnar into Morgoth */
|
|
|
|
{
|
|
|
|
strcpy(Curmonster.m_name, "Morgoth");
|
|
|
|
Curmonster.m_strength = drandom() * (Player.p_maxenergy + Player.p_shield) / 1.4
|
|
|
|
+ drandom() * (Player.p_maxenergy + Player.p_shield) / 1.5;
|
|
|
|
Curmonster.m_brains = Player.p_brains;
|
|
|
|
Curmonster.m_energy = Player.p_might * 30.0;
|
|
|
|
Curmonster.m_type = SM_MORGOTH;
|
|
|
|
Curmonster.m_speed = Player.p_speed * 1.1
|
|
|
|
+ (Player.p_specialtype == SC_EXVALAR) ? Player.p_speed : 0.0;
|
|
|
|
Curmonster.m_flock = 0.0;
|
|
|
|
Curmonster.m_treasuretype = 0;
|
|
|
|
Curmonster.m_experience = 0.0;
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
if (Curmonster.m_type == SM_MIMIC)
|
|
|
|
/* pick another name */
|
|
|
|
{
|
|
|
|
which = (int) ROLL(0.0, 100.0);
|
1999-09-09 01:57:16 +04:00
|
|
|
fseek(Monstfp, (long) which * (long) SZ_MONSTERSTRUCT, SEEK_SET);
|
1997-10-13 06:18:06 +04:00
|
|
|
fread(&Othermonster, SZ_MONSTERSTRUCT, 1, Monstfp);
|
|
|
|
strcpy(Curmonster.m_name, Othermonster.m_name);
|
|
|
|
}
|
|
|
|
truncstring(Curmonster.m_name);
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
if (Curmonster.m_type != SM_MORGOTH)
|
|
|
|
/* adjust stats based on which circle player is in */
|
1994-10-22 00:19:39 +03:00
|
|
|
{
|
1997-10-13 06:18:06 +04:00
|
|
|
Curmonster.m_strength *= (1.0 + Circle / 2.0);
|
|
|
|
Curmonster.m_brains *= Circle;
|
|
|
|
Curmonster.m_speed += Circle * 1.e-9;
|
|
|
|
Curmonster.m_energy *= Circle;
|
|
|
|
Curmonster.m_experience *= Circle;
|
1994-10-22 00:19:39 +03:00
|
|
|
}
|
1997-10-13 06:18:06 +04:00
|
|
|
if (Player.p_blindness)
|
|
|
|
/* cannot see monster if blind */
|
|
|
|
Enemyname = "A monster";
|
|
|
|
else
|
|
|
|
Enemyname = Curmonster.m_name;
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
if (Player.p_speed <= 0.0)
|
|
|
|
/* make Player.p_speed positive */
|
1994-10-22 00:19:39 +03:00
|
|
|
{
|
1997-10-13 06:18:06 +04:00
|
|
|
Curmonster.m_speed += -Player.p_speed;
|
|
|
|
Player.p_speed = 1.0;
|
1994-10-22 00:19:39 +03:00
|
|
|
}
|
1997-10-13 06:18:06 +04:00
|
|
|
/* fill up the rest of the structure */
|
|
|
|
Curmonster.m_o_strength = Curmonster.m_strength;
|
|
|
|
Curmonster.m_o_speed = Curmonster.m_maxspeed = Curmonster.m_speed;
|
|
|
|
Curmonster.m_o_energy = Curmonster.m_energy;
|
|
|
|
Curmonster.m_melee = Curmonster.m_skirmish = 0.0;
|
1994-10-22 00:19:39 +03:00
|
|
|
}
|
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
void
|
1994-10-22 00:19:39 +03:00
|
|
|
awardtreasure()
|
|
|
|
{
|
1997-10-13 06:18:06 +04:00
|
|
|
int whichtreasure; /* calculated treasure to grant */
|
|
|
|
int temp; /* temporary */
|
|
|
|
int ch; /* input */
|
|
|
|
double treasuretype; /* monster's treasure type */
|
|
|
|
double gold = 0.0; /* gold awarded */
|
|
|
|
double gems = 0.0; /* gems awarded */
|
|
|
|
double dtemp; /* for temporary calculations */
|
|
|
|
|
|
|
|
whichtreasure = (int) ROLL(1.0, 3.0); /* pick a treasure */
|
|
|
|
treasuretype = (double) Curmonster.m_treasuretype;
|
|
|
|
|
|
|
|
move(4, 0);
|
|
|
|
clrtobot();
|
|
|
|
move(6, 0);
|
|
|
|
|
|
|
|
if (drandom() > 0.65)
|
|
|
|
/* gold and gems */
|
1994-10-22 00:19:39 +03:00
|
|
|
{
|
1997-10-13 06:18:06 +04:00
|
|
|
if (Curmonster.m_treasuretype > 7)
|
|
|
|
/* gems */
|
1994-10-22 00:19:39 +03:00
|
|
|
{
|
1997-10-13 06:18:06 +04:00
|
|
|
gems = ROLL(1.0, (treasuretype - 7.0)
|
|
|
|
* (treasuretype - 7.0) * (Circle - 1.0) / 4.0);
|
|
|
|
printw("You have discovered %.0f gems!", gems);
|
|
|
|
} else
|
|
|
|
/* gold */
|
1994-10-22 00:19:39 +03:00
|
|
|
{
|
1997-10-13 06:18:06 +04:00
|
|
|
gold = ROLL(treasuretype * 10.0, treasuretype
|
|
|
|
* treasuretype * 10.0 * (Circle - 1.0));
|
|
|
|
printw("You have found %.0f gold pieces.", gold);
|
1994-10-22 00:19:39 +03:00
|
|
|
}
|
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
addstr(" Do you want to pick them up ? ");
|
|
|
|
ch = getanswer("NY", FALSE);
|
|
|
|
addstr("\n\n");
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1998-08-30 13:19:36 +04:00
|
|
|
if (ch == 'Y') {
|
1997-10-13 06:18:06 +04:00
|
|
|
if (drandom() < treasuretype / 35.0 + 0.04)
|
|
|
|
/* cursed */
|
|
|
|
{
|
|
|
|
addstr("They were cursed!\n");
|
|
|
|
cursedtreasure();
|
|
|
|
} else
|
|
|
|
collecttaxes(gold, gems);
|
1998-08-30 13:19:36 +04:00
|
|
|
}
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
return;
|
|
|
|
} else
|
|
|
|
/* other treasures */
|
|
|
|
{
|
|
|
|
addstr("You have found some treasure. Do you want to inspect it ? ");
|
|
|
|
ch = getanswer("NY", FALSE);
|
|
|
|
addstr("\n\n");
|
1994-10-22 00:19:39 +03:00
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
if (ch != 'Y')
|
|
|
|
return;
|
|
|
|
else
|
|
|
|
if (drandom() < 0.08 && Curmonster.m_treasuretype != 4) {
|
|
|
|
addstr("It was cursed!\n");
|
|
|
|
cursedtreasure();
|
|
|
|
return;
|
|
|
|
} else
|
|
|
|
switch (Curmonster.m_treasuretype) {
|
|
|
|
case 1: /* treasure type 1 */
|
|
|
|
switch (whichtreasure) {
|
|
|
|
case 1:
|
|
|
|
addstr("You've discovered a power booster!\n");
|
|
|
|
Player.p_mana += ROLL(Circle * 4.0, Circle * 30.0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
addstr("You have encountered a druid.\n");
|
|
|
|
Player.p_experience +=
|
|
|
|
ROLL(0.0, 2000.0 + Circle * 400.0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
addstr("You have found a holy orb.\n");
|
|
|
|
Player.p_sin = MAX(0.0, Player.p_sin - 0.25);
|
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
}
|
1997-10-13 06:18:06 +04:00
|
|
|
break;
|
|
|
|
/* end treasure type 1 */
|
|
|
|
|
|
|
|
case 2: /* treasure type 2 */
|
|
|
|
switch (whichtreasure) {
|
|
|
|
case 1:
|
|
|
|
addstr("You have found an amulet.\n");
|
|
|
|
++Player.p_amulets;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
addstr("You've found some holy water!\n");
|
|
|
|
++Player.p_holywater;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
addstr("You've met a hermit!\n");
|
|
|
|
Player.p_sin *= 0.75;
|
|
|
|
Player.p_mana += 12.0 * Circle;
|
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
}
|
|
|
|
break;
|
1997-10-13 06:18:06 +04:00
|
|
|
/* end treasure type 2 */
|
|
|
|
|
|
|
|
case 3: /* treasure type 3 */
|
|
|
|
switch (whichtreasure) {
|
|
|
|
case 1:
|
|
|
|
dtemp = ROLL(7.0, 30.0 + Circle / 10.0);
|
|
|
|
printw("You've found a +%.0f shield!\n", dtemp);
|
|
|
|
if (dtemp >= Player.p_shield)
|
|
|
|
Player.p_shield = dtemp;
|
|
|
|
else
|
|
|
|
SOMEBETTER();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
addstr("You have rescued a virgin. Will you be honorable ? ");
|
|
|
|
ch = getanswer("NY", FALSE);
|
|
|
|
addstr("\n\n");
|
|
|
|
if (ch == 'Y')
|
|
|
|
Player.p_virgin = TRUE;
|
|
|
|
else {
|
|
|
|
Player.p_experience += 2000.0 * Circle;
|
|
|
|
++Player.p_sin;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
addstr("You've discovered some athelas!\n");
|
|
|
|
--Player.p_poison;
|
|
|
|
break;
|
1994-10-22 00:19:39 +03:00
|
|
|
}
|
1997-10-13 06:18:06 +04:00
|
|
|
break;
|
|
|
|
/* end treasure type 3 */
|
|
|
|
|
|
|
|
case 4: /* treasure type 4 */
|
|
|
|
addstr("You've found a scroll. Will you read it ? ");
|
|
|
|
ch = getanswer("NY", FALSE);
|
|
|
|
addstr("\n\n");
|
|
|
|
|
|
|
|
if (ch == 'Y')
|
|
|
|
switch ((int) ROLL(1, 6)) {
|
|
|
|
case 1:
|
|
|
|
addstr("It throws up a shield for you next monster.\n");
|
|
|
|
getyx(stdscr, whichtreasure, ch);
|
|
|
|
more(whichtreasure);
|
|
|
|
Shield =
|
|
|
|
(Player.p_maxenergy + Player.p_energy) * 5.5 + Circle * 50.0;
|
|
|
|
Whichmonster = pickmonster();
|
|
|
|
longjmp(Fightenv, 0);
|
|
|
|
/* NOTREACHED */
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
addstr("It makes you invisible for you next monster.\n");
|
|
|
|
getyx(stdscr, whichtreasure, ch);
|
|
|
|
more(whichtreasure);
|
|
|
|
Player.p_speed = 1e6;
|
|
|
|
Whichmonster = pickmonster();
|
|
|
|
longjmp(Fightenv, 0);
|
|
|
|
/* NOTREACHED */
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
addstr("It increases your strength ten fold to fight your next monster.\n");
|
|
|
|
getyx(stdscr, whichtreasure, ch);
|
|
|
|
more(whichtreasure);
|
|
|
|
Player.p_might *= 10.0;
|
|
|
|
Whichmonster = pickmonster();
|
|
|
|
longjmp(Fightenv, 0);
|
|
|
|
/* NOTREACHED */
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
addstr("It is a general knowledge scroll.\n");
|
|
|
|
Player.p_brains += ROLL(2.0, Circle);
|
|
|
|
Player.p_magiclvl += ROLL(1.0, Circle / 2.0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 5:
|
|
|
|
addstr("It tells you how to pick your next monster.\n");
|
|
|
|
addstr("Which monster do you want [0-99] ? ");
|
|
|
|
Whichmonster = (int) infloat();
|
|
|
|
Whichmonster = MIN(99, MAX(0, Whichmonster));
|
|
|
|
longjmp(Fightenv, 0);
|
|
|
|
|
|
|
|
case 6:
|
|
|
|
addstr("It was cursed!\n");
|
|
|
|
cursedtreasure();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
/* end treasure type 4 */
|
|
|
|
|
|
|
|
case 5: /* treasure type 5 */
|
|
|
|
switch (whichtreasure) {
|
|
|
|
case 1:
|
|
|
|
dtemp = ROLL(Circle / 4.0 + 5.0, Circle / 2.0 + 9.0);
|
|
|
|
printw("You've discovered a +%.0f dagger.\n", dtemp);
|
|
|
|
if (dtemp >= Player.p_sword)
|
|
|
|
Player.p_sword = dtemp;
|
|
|
|
else
|
|
|
|
SOMEBETTER();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
dtemp = ROLL(7.5 + Circle * 3.0, Circle * 2.0 + 160.0);
|
|
|
|
printw("You have found some +%.0f armour!\n", dtemp);
|
|
|
|
if (dtemp >= Player.p_shield)
|
|
|
|
Player.p_shield = dtemp;
|
|
|
|
else
|
|
|
|
SOMEBETTER();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
addstr("You've found a tablet.\n");
|
|
|
|
Player.p_brains += 4.5 * Circle;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
/* end treasure type 5 */
|
|
|
|
|
|
|
|
case 6: /* treasure type 6 */
|
|
|
|
switch (whichtreasure) {
|
|
|
|
case 1:
|
|
|
|
addstr("You've found a priest.\n");
|
|
|
|
Player.p_energy = Player.p_maxenergy + Player.p_shield;
|
|
|
|
Player.p_sin /= 2.0;
|
|
|
|
Player.p_mana += 24.0 * Circle;
|
|
|
|
Player.p_brains += Circle;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
addstr("You have come upon Robin Hood!\n");
|
|
|
|
Player.p_shield += Circle * 2.0;
|
|
|
|
Player.p_strength += Circle / 2.5 + 1.0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
dtemp = ROLL(2.0 + Circle / 4.0, Circle / 1.2 + 10.0);
|
|
|
|
printw("You have found a +%.0f axe!\n", dtemp);
|
|
|
|
if (dtemp >= Player.p_sword)
|
|
|
|
Player.p_sword = dtemp;
|
|
|
|
else
|
|
|
|
SOMEBETTER();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
/* end treasure type 6 */
|
|
|
|
|
|
|
|
case 7: /* treasure type 7 */
|
|
|
|
switch (whichtreasure) {
|
|
|
|
case 1:
|
|
|
|
addstr("You've discovered a charm!\n");
|
|
|
|
++Player.p_charms;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
addstr("You have encountered Merlyn!\n");
|
|
|
|
Player.p_brains += Circle + 5.0;
|
|
|
|
Player.p_magiclvl += Circle / 3.0 + 5.0;
|
|
|
|
Player.p_mana += Circle * 10.0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
dtemp = ROLL(5.0 + Circle / 3.0, Circle / 1.5 + 20.0);
|
|
|
|
printw("You have found a +%.0f war hammer!\n", dtemp);
|
|
|
|
if (dtemp >= Player.p_sword)
|
|
|
|
Player.p_sword = dtemp;
|
|
|
|
else
|
|
|
|
SOMEBETTER();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
/* end treasure type 7 */
|
|
|
|
|
|
|
|
case 8: /* treasure type 8 */
|
|
|
|
switch (whichtreasure) {
|
|
|
|
case 1:
|
|
|
|
addstr("You have found a healing potion.\n");
|
|
|
|
Player.p_poison = MIN(-2.0, Player.p_poison - 2.0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
addstr("You have discovered a transporter. Do you wish to go anywhere ? ");
|
|
|
|
ch = getanswer("NY", FALSE);
|
|
|
|
addstr("\n\n");
|
|
|
|
if (ch == 'Y') {
|
|
|
|
double x, y;
|
|
|
|
|
|
|
|
addstr("X Y Coordinates ? ");
|
|
|
|
getstring(Databuf, SZ_DATABUF);
|
|
|
|
sscanf(Databuf, "%lf %lf", &x, &y);
|
|
|
|
altercoordinates(x, y, A_FORCED);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
dtemp = ROLL(10.0 + Circle / 1.2, Circle * 3.0 + 30.0);
|
|
|
|
printw("You've found a +%.0f sword!\n", dtemp);
|
|
|
|
if (dtemp >= Player.p_sword)
|
|
|
|
Player.p_sword = dtemp;
|
|
|
|
else
|
|
|
|
SOMEBETTER();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
/* end treasure type 8 */
|
|
|
|
|
|
|
|
case 10:
|
|
|
|
case 11:
|
|
|
|
case 12:
|
|
|
|
case 13: /* treasure types 10 - 13 */
|
|
|
|
if (drandom() < 0.33) {
|
|
|
|
if (Curmonster.m_treasuretype == 10) {
|
|
|
|
addstr("You've found a pair of elven boots!\n");
|
|
|
|
Player.p_quickness += 2.0;
|
|
|
|
break;
|
|
|
|
} else
|
|
|
|
if (Curmonster.m_treasuretype == 11
|
|
|
|
&& !Player.p_palantir) {
|
|
|
|
addstr("You've acquired Saruman's palantir.\n");
|
|
|
|
Player.p_palantir = TRUE;
|
|
|
|
break;
|
|
|
|
} else
|
|
|
|
if (Player.p_ring.ring_type == R_NONE
|
|
|
|
&& Player.p_specialtype < SC_COUNCIL
|
|
|
|
&& (Curmonster.m_treasuretype == 12
|
|
|
|
|| Curmonster.m_treasuretype == 13))
|
|
|
|
/* roll
|
|
|
|
* up
|
|
|
|
* a
|
|
|
|
* ring
|
|
|
|
* */
|
|
|
|
{
|
|
|
|
if (drandom() < 0.8)
|
|
|
|
/* r
|
|
|
|
* e
|
|
|
|
* g
|
|
|
|
* u
|
|
|
|
* l
|
|
|
|
* a
|
|
|
|
* r
|
|
|
|
*
|
|
|
|
* ri
|
|
|
|
* n
|
|
|
|
* g
|
|
|
|
* s
|
|
|
|
* */
|
|
|
|
{
|
|
|
|
if (Curmonster.m_treasuretype == 12) {
|
|
|
|
whichtreasure = R_NAZREG;
|
|
|
|
temp = 35;
|
|
|
|
} else {
|
|
|
|
whichtreasure = R_DLREG;
|
|
|
|
temp = 0;
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
/* b
|
|
|
|
* a
|
|
|
|
* d
|
|
|
|
*
|
|
|
|
* ri
|
|
|
|
* n
|
|
|
|
* g
|
|
|
|
* s
|
|
|
|
* */
|
|
|
|
{
|
|
|
|
whichtreasure = R_BAD;
|
|
|
|
temp = 15 + Statptr->c_ringduration + (int) ROLL(0, 5);
|
|
|
|
}
|
|
|
|
|
|
|
|
addstr("You've discovered a ring. Will you pick it up ? ");
|
|
|
|
ch = getanswer("NY", FALSE);
|
|
|
|
addstr("\n\n");
|
|
|
|
|
|
|
|
if (ch == 'Y') {
|
|
|
|
Player.p_ring.ring_type = whichtreasure;
|
|
|
|
Player.p_ring.ring_duration = temp;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* end treasure types 10 - 13 */
|
|
|
|
/* fall through to treasure type 9 if
|
|
|
|
* no treasure from above */
|
|
|
|
|
|
|
|
case 9: /* treasure type 9 */
|
|
|
|
switch (whichtreasure) {
|
|
|
|
case 1:
|
|
|
|
if (Player.p_level <= 1000.0
|
|
|
|
&& Player.p_crowns <= 3
|
|
|
|
&& Player.p_level >= 10.0) {
|
|
|
|
addstr("You have found a golden crown!\n");
|
|
|
|
++Player.p_crowns;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* fall through otherwise */
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
addstr("You've been blessed!\n");
|
|
|
|
Player.p_blessing = TRUE;
|
|
|
|
Player.p_sin /= 3.0;
|
|
|
|
Player.p_energy = Player.p_maxenergy + Player.p_shield;
|
|
|
|
Player.p_mana += 100.0 * Circle;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
dtemp = ROLL(1.0, Circle / 5.0 + 5.0);
|
|
|
|
dtemp = MIN(dtemp, 99.0);
|
|
|
|
printw("You have discovered some +%.0f quicksilver!\n", dtemp);
|
|
|
|
if (dtemp >= Player.p_quksilver)
|
|
|
|
Player.p_quksilver = dtemp;
|
|
|
|
else
|
|
|
|
SOMEBETTER();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
/* end treasure type 9 */
|
1994-10-22 00:19:39 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
void
|
1994-10-22 00:19:39 +03:00
|
|
|
cursedtreasure()
|
|
|
|
{
|
1997-10-13 06:18:06 +04:00
|
|
|
if (Player.p_charms > 0) {
|
|
|
|
addstr("But your charm saved you!\n");
|
|
|
|
--Player.p_charms;
|
|
|
|
} else
|
|
|
|
if (Player.p_amulets > 0) {
|
|
|
|
addstr("But your amulet saved you!\n");
|
|
|
|
--Player.p_amulets;
|
|
|
|
} else {
|
|
|
|
Player.p_energy =
|
|
|
|
(Player.p_maxenergy + Player.p_shield) / 10.0;
|
|
|
|
Player.p_poison += 0.25;
|
|
|
|
}
|
1994-10-22 00:19:39 +03:00
|
|
|
}
|
|
|
|
|
1997-10-13 06:18:06 +04:00
|
|
|
void
|
1994-10-22 00:19:39 +03:00
|
|
|
scramblestats()
|
|
|
|
{
|
1997-10-13 06:18:06 +04:00
|
|
|
double dbuf[6]; /* to put statistic in */
|
|
|
|
double dtemp1, dtemp2; /* for swapping values */
|
|
|
|
int first, second; /* indices for swapping */
|
|
|
|
double *dptr; /* pointer for filling and emptying buf[] */
|
|
|
|
|
|
|
|
/* fill buffer */
|
|
|
|
dptr = &dbuf[0];
|
|
|
|
*dptr++ = Player.p_strength;
|
|
|
|
*dptr++ = Player.p_mana;
|
|
|
|
*dptr++ = Player.p_brains;
|
|
|
|
*dptr++ = Player.p_magiclvl;
|
|
|
|
*dptr++ = Player.p_energy;
|
|
|
|
*dptr = Player.p_sin;
|
|
|
|
|
|
|
|
/* pick values to swap */
|
|
|
|
first = (int) ROLL(0, 5);
|
|
|
|
second = (int) ROLL(0, 5);
|
|
|
|
|
|
|
|
/* swap values */
|
|
|
|
dptr = &dbuf[0];
|
|
|
|
dtemp1 = dptr[first];
|
|
|
|
/* this expression is split to prevent a compiler loop on some
|
|
|
|
* compilers */
|
|
|
|
dtemp2 = dptr[second];
|
|
|
|
dptr[first] = dtemp2;
|
|
|
|
dptr[second] = dtemp1;
|
|
|
|
|
|
|
|
/* empty buffer */
|
|
|
|
Player.p_strength = *dptr++;
|
|
|
|
Player.p_mana = *dptr++;
|
|
|
|
Player.p_brains = *dptr++;
|
|
|
|
Player.p_magiclvl = *dptr++;
|
|
|
|
Player.p_energy = *dptr++;
|
|
|
|
Player.p_sin = *dptr;
|
1994-10-22 00:19:39 +03:00
|
|
|
}
|