U1039 passive() stoning check tweak

>If you hit a cockatrice with a weapon that immediately breaks
>(like a potion, mirror, or cockatrice egg) you get stoned,

Add a parameter to passive() to make it possible to pass
additional information that indicates that the weapon was
there at the start of the turn, but destroyed during the turn.
This commit is contained in:
nethack.allison
2004-05-09 16:53:16 +00:00
parent c25746f0bf
commit 3ad4bf5b3a
3 changed files with 17 additions and 15 deletions
+1 -1
View File
@@ -2108,7 +2108,7 @@ E boolean FDECL(attack, (struct monst *));
E boolean FDECL(hmon, (struct monst *,struct obj *,int)); E boolean FDECL(hmon, (struct monst *,struct obj *,int));
E int FDECL(damageum, (struct monst *,struct attack *)); E int FDECL(damageum, (struct monst *,struct attack *));
E void FDECL(missum, (struct monst *,struct attack *,BOOLEAN_P)); E void FDECL(missum, (struct monst *,struct attack *,BOOLEAN_P));
E int FDECL(passive, (struct monst *,BOOLEAN_P,int,UCHAR_P)); E int FDECL(passive, (struct monst *,BOOLEAN_P,int,UCHAR_P,BOOLEAN_P));
E void FDECL(passive_obj, (struct monst *,struct obj *,struct attack *)); E void FDECL(passive_obj, (struct monst *,struct obj *,struct attack *));
E void FDECL(stumble_onto_mimic, (struct monst *)); E void FDECL(stumble_onto_mimic, (struct monst *));
E int FDECL(flash_hits_mon, (struct monst *,struct obj *)); E int FDECL(flash_hits_mon, (struct monst *,struct obj *));
+7 -7
View File
@@ -106,7 +106,7 @@ register boolean clumsy;
} }
} }
(void) passive(mon, TRUE, mon->mhp > 0, AT_KICK); (void) passive(mon, TRUE, mon->mhp > 0, AT_KICK, FALSE);
if (mon->mhp <= 0 && !trapkilled) killed(mon); if (mon->mhp <= 0 && !trapkilled) killed(mon);
/* may bring up a dialog, so put this after all messages */ /* may bring up a dialog, so put this after all messages */
@@ -157,12 +157,12 @@ register xchar x, y;
} else if (tmp > (kickdieroll = rnd(20))) { } else if (tmp > (kickdieroll = rnd(20))) {
You("kick %s.", mon_nam(mon)); You("kick %s.", mon_nam(mon));
sum = damageum(mon, uattk); sum = damageum(mon, uattk);
(void)passive(mon, (boolean)(sum > 0), (sum != 2), AT_KICK); (void)passive(mon, (boolean)(sum > 0), (sum != 2), AT_KICK, FALSE);
if (sum == 2) if (sum == 2)
break; /* Defender died */ break; /* Defender died */
} else { } else {
missum(mon, uattk, (tmp + armorpenalty > kickdieroll)); missum(mon, uattk, (tmp + armorpenalty > kickdieroll));
(void)passive(mon, 0, 1, AT_KICK); (void)passive(mon, 0, 1, AT_KICK,FALSE);
} }
} }
return; return;
@@ -172,7 +172,7 @@ register xchar x, y;
!is_flyer(mon->data)) { !is_flyer(mon->data)) {
pline("Floating in the air, you miss wildly!"); pline("Floating in the air, you miss wildly!");
exercise(A_DEX, FALSE); exercise(A_DEX, FALSE);
(void) passive(mon, FALSE, 1, AT_KICK); (void) passive(mon, FALSE, 1, AT_KICK, FALSE);
return; return;
} }
@@ -183,7 +183,7 @@ register xchar x, y;
if(!rn2((i < j/10) ? 2 : (i < j/5) ? 3 : 4)) { if(!rn2((i < j/10) ? 2 : (i < j/5) ? 3 : 4)) {
if(martial() && !rn2(2)) goto doit; if(martial() && !rn2(2)) goto doit;
Your("clumsy kick does no damage."); Your("clumsy kick does no damage.");
(void) passive(mon, FALSE, 1, AT_KICK); (void) passive(mon, FALSE, 1, AT_KICK, FALSE);
return; return;
} }
if(i < j/10) clumsy = TRUE; if(i < j/10) clumsy = TRUE;
@@ -204,7 +204,7 @@ doit:
if(!nohands(mon->data) && !rn2(martial() ? 5 : 3)) { if(!nohands(mon->data) && !rn2(martial() ? 5 : 3)) {
pline("%s blocks your %skick.", Monnam(mon), pline("%s blocks your %skick.", Monnam(mon),
clumsy ? "clumsy " : ""); clumsy ? "clumsy " : "");
(void) passive(mon, FALSE, 1, AT_KICK); (void) passive(mon, FALSE, 1, AT_KICK, FALSE);
return; return;
} else { } else {
mnexto(mon); mnexto(mon);
@@ -221,7 +221,7 @@ doit:
"slides" : "jumps"), "slides" : "jumps"),
clumsy ? "easily" : "nimbly", clumsy ? "easily" : "nimbly",
clumsy ? "clumsy " : ""); clumsy ? "clumsy " : "");
(void) passive(mon, FALSE, 1, AT_KICK); (void) passive(mon, FALSE, 1, AT_KICK, FALSE);
return; return;
} }
} }
+9 -7
View File
@@ -482,7 +482,8 @@ hitum(mon, uattk)
struct monst *mon; struct monst *mon;
struct attack *uattk; struct attack *uattk;
{ {
boolean malive; boolean malive, wep_was_destroyed = FALSE;
struct obj *wepbefore = uwep;
int armorpenalty, attknum = 0, int armorpenalty, attknum = 0,
x = u.ux + u.dx, y = u.uy + u.dy, x = u.ux + u.dx, y = u.uy + u.dy,
tmp = find_roll_to_hit(mon, uattk->aatyp, uwep, tmp = find_roll_to_hit(mon, uattk->aatyp, uwep,
@@ -502,8 +503,8 @@ struct attack *uattk;
malive = known_hitum(mon, uswapwep, &mhit, malive = known_hitum(mon, uswapwep, &mhit,
tmp, armorpenalty, uattk); tmp, armorpenalty, uattk);
} }
if (wepbefore && !uwep) wep_was_destroyed = TRUE;
(void) passive(mon, mhit, malive, AT_WEAP); (void) passive(mon, mhit, malive, AT_WEAP, wep_was_destroyed);
return(malive); return(malive);
} }
@@ -2153,10 +2154,10 @@ use_weapon:
rehumanize(); rehumanize();
} }
if (sum[i] == 2) if (sum[i] == 2)
return((boolean)passive(mon, 1, 0, mattk->aatyp)); return((boolean)passive(mon, 1, 0, mattk->aatyp, FALSE));
/* defender dead */ /* defender dead */
else { else {
(void) passive(mon, sum[i], 1, mattk->aatyp); (void) passive(mon, sum[i], 1, mattk->aatyp, FALSE);
nsum |= sum[i]; nsum |= sum[i];
} }
if (!Upolyd) if (!Upolyd)
@@ -2170,11 +2171,12 @@ use_weapon:
/* Special (passive) attacks on you by monsters done here. */ /* Special (passive) attacks on you by monsters done here. */
int int
passive(mon, mhit, malive, aatyp) passive(mon, mhit, malive, aatyp, wep_was_destroyed)
register struct monst *mon; register struct monst *mon;
register boolean mhit; register boolean mhit;
register int malive; register int malive;
uchar aatyp; uchar aatyp;
boolean wep_was_destroyed;
{ {
register struct permonst *ptr = mon->data; register struct permonst *ptr = mon->data;
register int i, tmp; register int i, tmp;
@@ -2224,7 +2226,7 @@ uchar aatyp;
if (aatyp == AT_MAGC) protector = W_ARMG; if (aatyp == AT_MAGC) protector = W_ARMG;
if (protector == 0L || /* no protection */ if (protector == 0L || /* no protection */
(protector == W_ARMG && !uarmg && !uwep) || (protector == W_ARMG && !uarmg && !uwep && !wep_was_destroyed) ||
(protector == W_ARMF && !uarmf) || (protector == W_ARMF && !uarmf) ||
(protector == W_ARMH && !uarmh) || (protector == W_ARMH && !uarmh) ||
(protector == (W_ARMC|W_ARMG) && (!uarmc || !uarmg))) { (protector == (W_ARMC|W_ARMG) && (!uarmc || !uarmg))) {