Unify iron ball unwielding

This commit is contained in:
Pasi Kallinen
2015-04-22 08:53:13 +03:00
parent 34d5a4c1f9
commit 3bf2d17e2c
3 changed files with 21 additions and 21 deletions
+1
View File
@@ -119,6 +119,7 @@ E void FDECL(uchangealign, (int,int));
/* ### ball.c ### */ /* ### ball.c ### */
E void FDECL(ballrelease, (boolean));
E void NDECL(ballfall); E void NDECL(ballfall);
E void NDECL(placebc); E void NDECL(placebc);
E void NDECL(unplacebc); E void NDECL(unplacebc);
+13 -6
View File
@@ -11,14 +11,11 @@ STATIC_DCL int NDECL(bc_order);
STATIC_DCL void NDECL(litter); STATIC_DCL void NDECL(litter);
void void
ballfall() ballrelease(showmsg)
boolean showmsg;
{ {
boolean gets_hit;
gets_hit = (((uball->ox != u.ux) || (uball->oy != u.uy)) &&
((uwep == uball)? FALSE : (boolean)rn2(5)));
if (carried(uball)) { if (carried(uball)) {
pline("Startled, you drop the iron ball."); if (showmsg) pline("Startled, you drop the iron ball.");
if (uwep == uball) if (uwep == uball)
setuwep((struct obj *)0); setuwep((struct obj *)0);
if (uswapwep == uball) if (uswapwep == uball)
@@ -28,6 +25,16 @@ ballfall()
if (uwep != uball) if (uwep != uball)
freeinv(uball); freeinv(uball);
} }
}
void
ballfall()
{
boolean gets_hit;
gets_hit = (((uball->ox != u.ux) || (uball->oy != u.uy)) &&
((uwep == uball)? FALSE : (boolean)rn2(5)));
ballrelease(TRUE);
if(gets_hit){ if(gets_hit){
int dmg = rn1(7,25); int dmg = rn1(7,25);
pline_The("iron ball falls on your %s.", pline_The("iron ball falls on your %s.",
+1 -9
View File
@@ -1283,15 +1283,7 @@ boolean at_stairs, falling, portal;
You("fall down the %s.", at_ladder ? "ladder" : "stairs"); You("fall down the %s.", at_ladder ? "ladder" : "stairs");
if (Punished) { if (Punished) {
drag_down(); drag_down();
if (carried(uball)) { ballrelease(FALSE);
if (uwep == uball)
setuwep((struct obj *)0);
if (uswapwep == uball)
setuswapwep((struct obj *)0);
if (uquiver == uball)
setuqwep((struct obj *)0);
freeinv(uball);
}
} }
/* falling off steed has its own losehp() call */ /* falling off steed has its own losehp() call */
if (u.usteed) if (u.usteed)