guardian angel
Move the guardian angel creation and removal code to minion.c.
This commit is contained in:
@@ -1033,6 +1033,8 @@ E int FDECL(dlord, (ALIGNTYP_P));
|
|||||||
E int NDECL(llord);
|
E int NDECL(llord);
|
||||||
E int FDECL(ndemon, (ALIGNTYP_P));
|
E int FDECL(ndemon, (ALIGNTYP_P));
|
||||||
E int NDECL(lminion);
|
E int NDECL(lminion);
|
||||||
|
E void FDECL(lose_guardian_angel, (struct monst *));
|
||||||
|
E void NDECL(gain_guardian_angel);
|
||||||
|
|
||||||
/* ### mklev.c ### */
|
/* ### mklev.c ### */
|
||||||
|
|
||||||
|
|||||||
@@ -1405,64 +1405,18 @@ STATIC_OVL void
|
|||||||
final_level()
|
final_level()
|
||||||
{
|
{
|
||||||
struct monst *mtmp;
|
struct monst *mtmp;
|
||||||
struct obj *otmp;
|
|
||||||
coord mm;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
/* reset monster hostility relative to player */
|
/* reset monster hostility relative to player */
|
||||||
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
|
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
|
||||||
if (!DEADMONSTER(mtmp)) reset_hostility(mtmp);
|
if (DEADMONSTER(mtmp)) continue;
|
||||||
|
reset_hostility(mtmp);
|
||||||
|
}
|
||||||
|
|
||||||
/* create some player-monsters */
|
/* create some player-monsters */
|
||||||
create_mplayers(rn1(4, 3), TRUE);
|
create_mplayers(rn1(4, 3), TRUE);
|
||||||
|
|
||||||
/* create a guardian angel next to player, if worthy */
|
/* create a guardian angel next to player, if worthy */
|
||||||
if (Conflict) {
|
gain_guardian_angel();
|
||||||
pline(
|
|
||||||
"A voice booms: \"Thy desire for conflict shall be fulfilled!\"");
|
|
||||||
for (i = rnd(4); i > 0; --i) {
|
|
||||||
mm.x = u.ux;
|
|
||||||
mm.y = u.uy;
|
|
||||||
if (enexto(&mm, mm.x, mm.y, &mons[PM_ANGEL]))
|
|
||||||
(void) mk_roamer(&mons[PM_ANGEL], u.ualign.type,
|
|
||||||
mm.x, mm.y, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (u.ualign.record > 8) { /* fervent */
|
|
||||||
pline("A voice whispers: \"Thou hast been worthy of me!\"");
|
|
||||||
mm.x = u.ux;
|
|
||||||
mm.y = u.uy;
|
|
||||||
if (enexto(&mm, mm.x, mm.y, &mons[PM_ANGEL])) {
|
|
||||||
if ((mtmp = mk_roamer(&mons[PM_ANGEL], u.ualign.type,
|
|
||||||
mm.x, mm.y, TRUE)) != 0) {
|
|
||||||
if (!Blind)
|
|
||||||
pline("An angel appears near you.");
|
|
||||||
else
|
|
||||||
You_feel("the presence of a friendly angel near you.");
|
|
||||||
/* guardian angel -- the one case mtame doesn't
|
|
||||||
* imply an edog structure, so we don't want to
|
|
||||||
* call tamedog().
|
|
||||||
*/
|
|
||||||
mtmp->mtame = 10;
|
|
||||||
/* make him strong enough vs. endgame foes */
|
|
||||||
mtmp->m_lev = rn1(8,15);
|
|
||||||
mtmp->mhp = mtmp->mhpmax =
|
|
||||||
d((int)mtmp->m_lev,10) + 30 + rnd(30);
|
|
||||||
if ((otmp = select_hwep(mtmp)) == 0) {
|
|
||||||
otmp = mksobj(SILVER_SABER, FALSE, FALSE);
|
|
||||||
if (mpickobj(mtmp, otmp))
|
|
||||||
panic("merged weapon?");
|
|
||||||
}
|
|
||||||
bless(otmp);
|
|
||||||
if (otmp->spe < 4) otmp->spe += rnd(4);
|
|
||||||
if ((otmp = which_armor(mtmp, W_ARMS)) == 0 ||
|
|
||||||
otmp->otyp != SHIELD_OF_REFLECTION) {
|
|
||||||
(void) mongets(mtmp, AMULET_OF_REFLECTION);
|
|
||||||
m_dowear(mtmp, TRUE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *dfr_pre_msg = 0, /* pline() before level change */
|
static char *dfr_pre_msg = 0, /* pline() before level change */
|
||||||
|
|||||||
+2
-16
@@ -629,25 +629,11 @@ register int after; /* this is extra fast monster movement */
|
|||||||
if (Conflict && !resist(mtmp, RING_CLASS, 0, 0)) {
|
if (Conflict && !resist(mtmp, RING_CLASS, 0, 0)) {
|
||||||
allowflags |= ALLOW_U;
|
allowflags |= ALLOW_U;
|
||||||
if (!has_edog) {
|
if (!has_edog) {
|
||||||
coord mm;
|
|
||||||
/* Guardian angel refuses to be conflicted; rather,
|
/* Guardian angel refuses to be conflicted; rather,
|
||||||
* it disappears, angrily, and sends in some nasties
|
* it disappears, angrily, and sends in some nasties
|
||||||
*/
|
*/
|
||||||
if (canspotmon(mtmp)) {
|
lose_guardian_angel(mtmp);
|
||||||
pline("%s rebukes you, saying:", Monnam(mtmp));
|
return 2; /* current monster is gone */
|
||||||
verbalize("Since you desire conflict, have some more!");
|
|
||||||
}
|
|
||||||
mongone(mtmp);
|
|
||||||
i = rnd(4);
|
|
||||||
while(i--) {
|
|
||||||
mm.x = u.ux;
|
|
||||||
mm.y = u.uy;
|
|
||||||
if(enexto(&mm, mm.x, mm.y, &mons[PM_ANGEL]))
|
|
||||||
(void) mk_roamer(&mons[PM_ANGEL], u.ualign.type,
|
|
||||||
mm.x, mm.y, FALSE);
|
|
||||||
}
|
|
||||||
return(2);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!Conflict && !mtmp->mconf &&
|
if (!Conflict && !mtmp->mconf &&
|
||||||
|
|||||||
+81
-1
@@ -1,4 +1,4 @@
|
|||||||
/* SCCS Id: @(#)minion.c 3.5 2004/12/20 */
|
/* SCCS Id: @(#)minion.c 3.5 2005/11/01 */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -321,4 +321,84 @@ aligntyp atyp;
|
|||||||
return NON_PM;
|
return NON_PM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* guardian angel has been affected by conflict so is abandoning hero */
|
||||||
|
void
|
||||||
|
lose_guardian_angel(mon)
|
||||||
|
struct monst *mon; /* if null, angel hasn't been created yet */
|
||||||
|
{
|
||||||
|
coord mm;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (mon) {
|
||||||
|
if (canspotmon(mon)) {
|
||||||
|
if (!Deaf) {
|
||||||
|
pline("%s rebukes you, saying:", Monnam(mon));
|
||||||
|
verbalize("Since you desire conflict, have some more!");
|
||||||
|
} else {
|
||||||
|
pline("%s vanishes!", Monnam(mon));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mongone(mon);
|
||||||
|
}
|
||||||
|
/* create 1 to 4 hostile angels to replace the lost guardian */
|
||||||
|
for (i = rnd(4); i > 0; --i) {
|
||||||
|
mm.x = u.ux;
|
||||||
|
mm.y = u.uy;
|
||||||
|
if (enexto(&mm, mm.x, mm.y, &mons[PM_ANGEL]))
|
||||||
|
(void) mk_roamer(&mons[PM_ANGEL], u.ualign.type,
|
||||||
|
mm.x, mm.y, FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* just entered the Astral Plane; receive tame guardian angel if worthy */
|
||||||
|
void
|
||||||
|
gain_guardian_angel()
|
||||||
|
{
|
||||||
|
struct monst *mtmp;
|
||||||
|
struct obj *otmp;
|
||||||
|
coord mm;
|
||||||
|
|
||||||
|
Hear_again(); /* attempt to cure any deafness now (divine
|
||||||
|
message will be heard even if that fails) */
|
||||||
|
if (Conflict) {
|
||||||
|
pline("A voice booms:");
|
||||||
|
verbalize("Thy desire for conflict shall be fulfilled!");
|
||||||
|
/* send in some hostile angels instead */
|
||||||
|
lose_guardian_angel((struct monst *)0);
|
||||||
|
} else if (u.ualign.record > 8) { /* fervent */
|
||||||
|
pline("A voice whispers:");
|
||||||
|
verbalize("Thou hast been worthy of me!");
|
||||||
|
mm.x = u.ux;
|
||||||
|
mm.y = u.uy;
|
||||||
|
if (enexto(&mm, mm.x, mm.y, &mons[PM_ANGEL]) &&
|
||||||
|
(mtmp = mk_roamer(&mons[PM_ANGEL], u.ualign.type,
|
||||||
|
mm.x, mm.y, TRUE)) != 0) {
|
||||||
|
if (!Blind)
|
||||||
|
pline("An angel appears near you.");
|
||||||
|
else
|
||||||
|
You_feel("the presence of a friendly angel near you.");
|
||||||
|
/* guardian angel -- the one case mtame doesn't
|
||||||
|
* imply an edog structure, so we don't want to
|
||||||
|
* call tamedog().
|
||||||
|
*/
|
||||||
|
mtmp->mtame = 10;
|
||||||
|
/* make him strong enough vs. endgame foes */
|
||||||
|
mtmp->m_lev = rn1(8,15);
|
||||||
|
mtmp->mhp = mtmp->mhpmax = d((int)mtmp->m_lev,10) + 30 + rnd(30);
|
||||||
|
if ((otmp = select_hwep(mtmp)) == 0) {
|
||||||
|
otmp = mksobj(SILVER_SABER, FALSE, FALSE);
|
||||||
|
if (mpickobj(mtmp, otmp))
|
||||||
|
panic("merged weapon?");
|
||||||
|
}
|
||||||
|
bless(otmp);
|
||||||
|
if (otmp->spe < 4) otmp->spe += rnd(4);
|
||||||
|
if ((otmp = which_armor(mtmp, W_ARMS)) == 0 ||
|
||||||
|
otmp->otyp != SHIELD_OF_REFLECTION) {
|
||||||
|
(void) mongets(mtmp, AMULET_OF_REFLECTION);
|
||||||
|
m_dowear(mtmp, TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*minion.c*/
|
/*minion.c*/
|
||||||
|
|||||||
Reference in New Issue
Block a user