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

View File

@@ -119,6 +119,7 @@ E void FDECL(uchangealign, (int,int));
/* ### ball.c ### */
E void FDECL(ballrelease, (boolean));
E void NDECL(ballfall);
E void NDECL(placebc);
E void NDECL(unplacebc);

View File

@@ -10,6 +10,23 @@
STATIC_DCL int NDECL(bc_order);
STATIC_DCL void NDECL(litter);
void
ballrelease(showmsg)
boolean showmsg;
{
if (carried(uball)) {
if (showmsg) pline("Startled, you drop the iron ball.");
if (uwep == uball)
setuwep((struct obj *)0);
if (uswapwep == uball)
setuswapwep((struct obj *)0);
if (uquiver == uball)
setuqwep((struct obj *)0);;
if (uwep != uball)
freeinv(uball);
}
}
void
ballfall()
{
@@ -17,17 +34,7 @@ ballfall()
gets_hit = (((uball->ox != u.ux) || (uball->oy != u.uy)) &&
((uwep == uball)? FALSE : (boolean)rn2(5)));
if (carried(uball)) {
pline("Startled, you drop the iron ball.");
if (uwep == uball)
setuwep((struct obj *)0);
if (uswapwep == uball)
setuswapwep((struct obj *)0);
if (uquiver == uball)
setuqwep((struct obj *)0);;
if (uwep != uball)
freeinv(uball);
}
ballrelease(TRUE);
if(gets_hit){
int dmg = rn1(7,25);
pline_The("iron ball falls on your %s.",

View File

@@ -1282,16 +1282,8 @@ boolean at_stairs, falling, portal;
Punished || Fumbling) {
You("fall down the %s.", at_ladder ? "ladder" : "stairs");
if (Punished) {
drag_down();
if (carried(uball)) {
if (uwep == uball)
setuwep((struct obj *)0);
if (uswapwep == uball)
setuswapwep((struct obj *)0);
if (uquiver == uball)
setuqwep((struct obj *)0);
freeinv(uball);
}
drag_down();
ballrelease(FALSE);
}
/* falling off steed has its own losehp() call */
if (u.usteed)