1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400
|
/* SCCS Id: @(#)do.c 3.2 96/06/28 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
/* Contains code for 'd', 'D' (drop), '>', '<' (up, down) */
#include "hack.h"
#include "lev.h"
#include <errno.h>
#ifdef _MSC_VER /* MSC 6.0 defines errno quite differently */
# if (_MSC_VER >= 600)
# define SKIP_ERRNO
# endif
#endif
#ifndef SKIP_ERRNO
#ifdef _DCC
const
#endif
extern int errno;
#endif
#ifdef SINKS
# ifdef OVLB
static void FDECL(trycall, (struct obj *));
# endif /* OVLB */
STATIC_DCL void FDECL(dosinkring, (struct obj *));
#endif /* SINKS */
STATIC_PTR int FDECL(drop, (struct obj *));
STATIC_PTR int NDECL(wipeoff);
#ifdef OVL0
static int FDECL(menu_drop, (int));
#endif
#ifdef OVL2
static int NDECL(currentlevel_rewrite);
/* static boolean FDECL(badspot, (XCHAR_P,XCHAR_P)); */
#endif
#ifdef OVLB
static NEARDATA const char drop_types[] =
{ ALLOW_COUNT, GOLD_CLASS, ALL_CLASSES, 0 };
/* 'd' command: drop one inventory item */
int
dodrop()
{
int result, i = (invent || u.ugold) ? 0 : (SIZE(drop_types) - 1);
if (*u.ushops) sellobj_state(TRUE);
result = drop(getobj(&drop_types[i], "drop"));
if (*u.ushops) sellobj_state(FALSE);
reset_occupations();
return result;
}
#endif /* OVLB */
#ifdef OVL0
/* Called when a boulder is dropped, thrown, or pushed. If it ends up
* in a pool, it either fills the pool up or sinks away. In either case,
* it's gone for good... If the destination is not a pool, returns FALSE.
*/
boolean
boulder_hits_pool(otmp, rx, ry, pushing)
struct obj *otmp;
register int rx, ry;
boolean pushing;
{
if (!otmp || otmp->otyp != BOULDER)
impossible("Not a boulder?");
else if (!Is_waterlevel(&u.uz) && (is_pool(rx,ry) || is_lava(rx,ry))) {
boolean lava = is_lava(rx,ry), fills_up;
const char *what = lava ? "lava" : "water";
schar ltyp = levl[rx][ry].typ;
int chance = rn2(10); /* water: 90%; lava: 10% */
fills_up = lava ? chance == 0 : chance != 0;
if (fills_up) {
if (ltyp == DRAWBRIDGE_UP) {
levl[rx][ry].drawbridgemask &= ~DB_UNDER; /* clear lava */
levl[rx][ry].drawbridgemask |= DB_FLOOR;
} else
levl[rx][ry].typ = ROOM;
bury_objs(rx, ry);
newsym(rx,ry);
if (pushing) {
You("push %s into the %s.", the(xname(otmp)), what);
if (flags.verbose && !Blind)
pline("Now you can cross it!");
/* no splashing in this case */
}
}
if (!fills_up || !pushing) { /* splashing occurs */
if (!u.uinwater) {
if (pushing ? !Blind : cansee(rx,ry)) {
boolean moat = (ltyp != WATER) &&
!Is_medusa_level(&u.uz) && !Is_waterlevel(&u.uz);
pline("There is a large splash as %s %s the %s.",
the(xname(otmp)), fills_up? "fills":"falls into",
lava ? "lava" : ltyp==POOL ? "pool" :
moat ? "moat" : "water");
} else if (flags.soundok)
You_hear("a%s splash.", lava ? " sizzling" : "");
wake_nearto(rx, ry, 40);
}
if (fills_up && u.uinwater && distu(rx,ry) == 0) {
u.uinwater = 0;
docrt();
vision_full_recalc = 1;
You("find yourself on dry land again!");
} else if (lava && distu(rx,ry) <= 2) {
You("are hit by molten lava%c",
Fire_resistance ? '.' : '!');
losehp(d((Fire_resistance ? 1 : 3), 6),
"molten lava", KILLED_BY);
} else if (!fills_up && flags.verbose &&
(pushing ? !Blind : cansee(rx,ry)))
pline("It sinks without a trace!");
}
/* boulder is now gone */
if (pushing) delobj(otmp);
else obfree(otmp, (struct obj *)0);
return TRUE;
}
return FALSE;
}
/* Used for objects which sometimes do special things when dropped; must be
* called with the object not in any chain. Returns TRUE if the object goes
* away.
*/
boolean
flooreffects(obj,x,y,verb)
struct obj *obj;
int x,y;
const char *verb;
{
struct trap *t;
struct monst *mtmp;
if (obj->where != OBJ_FREE)
panic("flooreffects: obj not free");
/* make sure things like water_damage() have no pointers to follow */
obj->nobj = obj->nexthere = (struct obj *)0;
if (obj->otyp == BOULDER && boulder_hits_pool(obj, x, y, FALSE))
return TRUE;
else if (obj->otyp == BOULDER && (t = t_at(x,y)) != 0 &&
(t->ttyp==PIT || t->ttyp==SPIKED_PIT
|| t->ttyp==TRAPDOOR || t->ttyp==HOLE)) {
if (((mtmp = m_at(x, y)) && mtmp->mtrapped) ||
(u.utrap && u.ux == x && u.uy == y)) {
if (*verb)
pline_The("boulder %ss into the pit%s.", verb,
(mtmp) ? "" : " with you");
if (mtmp) {
if (!passes_walls(mtmp->data) &&
!throws_rocks(mtmp->data)) {
if (hmon(mtmp, obj, TRUE))
return FALSE; /* still alive */
} else mtmp->mtrapped = 0;
} else {
if (!passes_walls(uasmon) && !throws_rocks(uasmon)) {
losehp(rnd(15), "squished under a boulder",
NO_KILLER_PREFIX);
return FALSE; /* player remains trapped */
} else u.utrap = 0;
}
}
if (*verb) {
if (Blind) {
if ((x == u.ux) && (y == u.uy))
You_hear("a CRASH! beneath you.");
else
You_hear("the boulder %s.", verb);
} else if (cansee(x, y)) {
pline_The("boulder %s%s.",
t->tseen ? "" : "triggers and ",
t->ttyp == TRAPDOOR ? "plugs a trap door" :
t->ttyp == HOLE ? "plugs a hole" :
"fills a pit");
}
}
deltrap(t);
obfree(obj, (struct obj *)0);
bury_objs(x, y);
newsym(x,y);
return TRUE;
} else if (is_pool(x, y)) {
water_damage(obj, FALSE, FALSE);
}
return FALSE;
}
#endif /* OVL0 */
#ifdef OVLB
void
doaltarobj(obj) /* obj is an object dropped on an altar */
register struct obj *obj;
{
if (Blind) return;
if (obj->blessed || obj->cursed) {
pline("There is %s flash as %s hit%s the altar.",
an(hcolor(obj->blessed ? amber : Black)),
doname(obj),
(obj->quan == 1L) ? "s" : "");
if (!Hallucination) obj->bknown = 1;
} else {
pline("%s land%s on the altar.", Doname2(obj),
(obj->quan == 1L) ? "s" : "");
obj->bknown = 1;
}
}
#ifdef SINKS
static
void
trycall(obj)
register struct obj *obj;
{
if(!objects[obj->otyp].oc_name_known &&
!objects[obj->otyp].oc_uname)
docall(obj);
}
STATIC_OVL
void
dosinkring(obj) /* obj is a ring being dropped over a kitchen sink */
register struct obj *obj;
{
register struct obj *otmp,*otmp2;
register boolean ideed = TRUE;
You("drop %s down the drain.", doname(obj));
#ifndef NO_SIGNAL
obj->in_use = TRUE; /* block free identification via interrupt */
#endif
switch(obj->otyp) { /* effects that can be noticed without eyes */
case RIN_SEARCHING:
You("thought your %s got lost in the sink, but there it is!",
xname(obj));
#ifndef NO_SIGNAL
obj->in_use = FALSE;
#endif
dropx(obj);
trycall(obj);
return;
case RIN_LEVITATION:
pline_The("sink quivers upward for a moment.");
break;
case RIN_POISON_RESISTANCE:
You("smell rotten %s.", makeplural(pl_fruit));
break;
case RIN_AGGRAVATE_MONSTER:
pline("Several flies buzz angrily around the sink.");
break;
case RIN_SHOCK_RESISTANCE:
pline("Static electricity surrounds the sink.");
break;
case RIN_CONFLICT:
You_hear("loud noises coming from the drain.");
break;
case RIN_GAIN_STRENGTH:
pline_The("water flow seems %ser now.",
(obj->spe<0) ? "weak" : "strong");
break;
case RIN_INCREASE_DAMAGE:
pline_The("water's force seems %ser now.",
(obj->spe<0) ? "small" : "great");
break;
case RIN_HUNGER:
ideed = FALSE;
for(otmp = level.objects[u.ux][u.uy]; otmp; otmp = otmp2) {
otmp2 = otmp->nexthere;
if(otmp != uball && otmp != uchain) {
if (!Blind) {
pline("Suddenly, %s vanishes from the sink!",
doname(otmp));
ideed = TRUE;
}
delobj(otmp);
}
}
break;
default:
ideed = FALSE;
break;
}
if(!Blind && !ideed && obj->otyp != RIN_HUNGER) {
ideed = TRUE;
switch(obj->otyp) { /* effects that need eyes */
case RIN_ADORNMENT:
pline_The("faucets flash brightly for a moment.");
break;
case RIN_REGENERATION:
pline_The("sink looks as good as new.");
break;
case RIN_INVISIBILITY:
You("don't see anything happen to the sink.");
break;
case RIN_SEE_INVISIBLE:
You("see some air in the sink.");
break;
case RIN_STEALTH:
pline_The("sink seems to blend into the floor for a moment.");
break;
case RIN_FIRE_RESISTANCE:
pline_The("hot water faucet flashes brightly for a moment.");
break;
case RIN_COLD_RESISTANCE:
pline_The("cold water faucet flashes brightly for a moment.");
break;
case RIN_PROTECTION_FROM_SHAPE_CHAN:
pline_The("sink looks nothing like a fountain.");
break;
case RIN_PROTECTION:
pline_The("sink glows %s for a moment.",
hcolor((obj->spe<0) ? Black : silver));
break;
case RIN_WARNING:
pline_The("sink glows %s for a moment.", hcolor(White));
break;
case RIN_TELEPORTATION:
pline_The("sink momentarily vanishes.");
break;
case RIN_TELEPORT_CONTROL:
pline_The("sink looks like it is being beamed aboard somewhere.");
break;
case RIN_POLYMORPH:
pline_The("sink momentarily looks like a fountain.");
break;
case RIN_POLYMORPH_CONTROL:
pline_The("sink momentarily looks like a regularly erupting geyser.");
break;
}
}
if(ideed)
trycall(obj);
else
You_hear("the ring bouncing down the drainpipe.");
if (!rn2(20)) {
pline_The("sink backs up, leaving %s.", doname(obj));
#ifndef NO_SIGNAL
obj->in_use = FALSE;
#endif
dropx(obj);
}
else
useup(obj);
}
#endif
#endif /* OVLB */
#ifdef OVL0
/* some common tests when trying to drop or throw items */
boolean
canletgo(obj,word)
register struct obj *obj;
register const char *word;
{
if(obj->owornmask & (W_ARMOR | W_RING | W_AMUL | W_TOOL)){
if (*word)
Norep("You cannot %s %s you are wearing.",word,
something);
return(FALSE);
}
if (obj->otyp == LOADSTONE && obj->cursed) {
if (*word)
pline("For some reason, you cannot %s the stone%s!",
word, plur(obj->quan));
/* Kludge -- see invent.c */
if (obj->corpsenm) {
struct obj *otmp;
otmp = obj;
obj = obj->nobj;
obj->quan += otmp->quan;
obj->owt = weight(obj);
freeinv(otmp);
obfree(otmp, obj);
}
obj->bknown = 1;
return(FALSE);
}
if (obj->otyp == LEASH && obj->leashmon != 0) {
if (*word)
pline ("The leash is tied around your %s.",
body_part(HAND));
return(FALSE);
}
return(TRUE);
}
STATIC_PTR
int
drop(obj)
register struct obj *obj;
{
if(!obj) return(0);
if(!canletgo(obj,"drop"))
return(0);
if(obj == uwep) {
if(welded(uwep)) {
weldmsg(obj);
return(0);
}
setuwep((struct obj *)0);
if(uwep) return 0; /* lifesaved and rewielded */
}
if (u.uswallow) {
/* barrier between you and the floor */
if(flags.verbose)
You("drop %s into %s %s.", doname(obj),
s_suffix(mon_nam(u.ustuck)),
is_animal(u.ustuck->data) ?
"stomach" : "interior");
} else {
#ifdef SINKS
if((obj->oclass == RING_CLASS) && IS_SINK(levl[u.ux][u.uy].typ)) {
dosinkring(obj);
return(1);
}
#endif
if (!can_reach_floor()) {
if(flags.verbose) You("drop %s.", doname(obj));
if (obj->oclass != GOLD_CLASS || obj == invent) freeinv(obj);
hitfloor(obj);
return(1);
}
if (IS_ALTAR(levl[u.ux][u.uy].typ)) {
doaltarobj(obj); /* set bknown */
} else
if(flags.verbose) You("drop %s.", doname(obj));
}
dropx(obj);
return(1);
}
/* Called in several places - should not produce texts */
void
dropx(obj)
register struct obj *obj;
{
/* Money is usually not in our inventory */
if (obj->oclass != GOLD_CLASS || obj == invent) freeinv(obj);
if (!u.uswallow && ship_object(obj, u.ux, u.uy, FALSE)) return;
dropy(obj);
}
void
dropy(obj)
register struct obj *obj;
{
if (!u.uswallow && flooreffects(obj,u.ux,u.uy,"drop")) return;
if(obj->otyp == CRYSKNIFE)
obj->otyp = WORM_TOOTH;
/* uswallow check done by GAN 01/29/87 */
if(u.uswallow) {
if (obj != uball) { /* mon doesn't pick up ball */
mpickobj(u.ustuck,obj);
}
} else {
place_object(obj, u.ux, u.uy);
if (obj == uball)
drop_ball(u.ux,u.uy);
else
sellobj(obj, u.ux, u.uy);
stackobj(obj);
if(Blind && Levitation)
map_object(obj, 0);
newsym(u.ux,u.uy); /* remap location under self */
}
}
/* 'D' command: drop several things */
int
doddrop()
{
int result = 0;
add_valid_menu_class(0); /* clear any classes already there */
if (*u.ushops) sellobj_state(TRUE);
if (flags.menu_style != MENU_TRADITIONAL ||
(result = ggetobj("drop", drop, 0, FALSE)) < -1)
result = menu_drop(result);
if (*u.ushops) sellobj_state(FALSE);
reset_occupations();
return result;
}
/* Drop things from the hero's inventory, using a menu. */
static int
menu_drop(retry)
int retry;
{
int n, i, n_dropped = 0;
long cnt;
struct obj *otmp, *otmp2, *u_gold = 0;
menu_item *pick_list;
boolean all_categories = TRUE;
boolean drop_everything = FALSE;
if (u.ugold) {
/* Hack: gold is not in the inventory, so make a gold object
and put it at the head of the inventory list. */
u_gold = mkgoldobj(u.ugold); /* removes from u.ugold */
u.ugold = u_gold->quan; /* put the gold back */
assigninvlet(u_gold); /* might end up as NOINVSYM */
u_gold->nobj = invent;
invent = u_gold;
}
if (retry) {
all_categories = (retry == -2);
} else if (flags.menu_style == MENU_FULL) {
all_categories = FALSE;
n = query_category("Drop what type of items?",
invent,
UNPAID_TYPES | ALL_TYPES | CHOOSE_ALL,
&pick_list, PICK_ANY);
if (!n) goto drop_done;
for (i = 0; i < n; i++) {
if (pick_list[i].item.a_int == ALL_TYPES_SELECTED)
all_categories = TRUE;
else if (pick_list[i].item.a_int == 'A')
drop_everything = TRUE;
else
add_valid_menu_class(pick_list[i].item.a_int);
}
free((genericptr_t) pick_list);
} else if (flags.menu_style == MENU_COMBINATION) {
all_categories = FALSE;
/* Gather valid classes via traditional NetHack method */
i = ggetobj("drop", drop, 0, TRUE);
if (i == -2) all_categories = TRUE;
}
if (drop_everything) {
for(otmp = invent; otmp; otmp = otmp2) {
otmp2 = otmp->nobj;
n_dropped += drop(otmp);
}
} else {
/* should coordinate with perm invent, maybe not show worn items */
n = query_objlist("What would you like to drop?", invent,
USE_INVLET|INVORDER_SORT, &pick_list,
PICK_ANY, all_categories ? allow_all : allow_category);
if (n > 0) {
for (i = 0; i < n; i++) {
otmp = pick_list[i].item.a_obj;
cnt = pick_list[i].count;
if (cnt < otmp->quan && !welded(otmp) &&
(!otmp->cursed || otmp->otyp != LOADSTONE)) {
otmp2 = splitobj(otmp, cnt);
/* assume other worn items aren't mergable */
if (otmp == uwep) setuwep(otmp2);
}
n_dropped += drop(otmp);
}
free((genericptr_t) pick_list);
}
}
drop_done:
if (u_gold && invent && invent->oclass == GOLD_CLASS) {
/* didn't drop [all of] it */
u_gold = invent;
invent = u_gold->nobj;
dealloc_obj(u_gold);
}
return n_dropped;
}
#endif /* OVL0 */
#ifdef OVL2
/* on a ladder, used in goto_level */
static NEARDATA boolean at_ladder = FALSE;
int
dodown()
{
struct trap *trap = 0;
boolean stairs_down = ((u.ux == xdnstair && u.uy == ydnstair) ||
(u.ux == sstairs.sx && u.uy == sstairs.sy && !sstairs.up)),
ladder_down = (u.ux == xdnladder && u.uy == ydnladder);
if (Levitation) {
if ((HLevitation & (I_SPECIAL|W_ARTI)) != 0) {
/* end controlled levitation */
if (float_down(I_SPECIAL|W_ARTI|TIMEOUT))
return 1; /* came down, so moved */
}
floating_above(stairs_down ? "stairs" : ladder_down ?
"ladder" : surface(u.ux, u.uy));
return 0; /* didn't move */
}
if (!stairs_down && !ladder_down) {
if (!(trap = t_at(u.ux,u.uy)) ||
(trap->ttyp != TRAPDOOR && trap->ttyp != HOLE)
|| !Can_fall_thru(&u.uz) || !trap->tseen) {
You_cant("go down here.");
return(0);
}
}
if(u.ustuck) {
You("are being held, and cannot go down.");
return(1);
}
if (on_level(&valley_level, &u.uz) && !u.uevent.gehennom_entered) {
You("are standing at the gate to Gehennom.");
pline("Unspeakable cruelty and harm lurk down there.");
if (yn("Are you sure you want to enter?") != 'y')
return(0);
else pline("So be it.");
u.uevent.gehennom_entered = 1; /* don't ask again */
}
if(!next_to_u()) {
You("are held back by your pet!");
return(0);
}
if (trap)
You("%s %s.", locomotion(uasmon, "jump"),
trap->ttyp == HOLE ? "down the hole" : "through the trap door");
if (trap && Is_stronghold(&u.uz)) {
goto_hell(TRUE, TRUE);
} else {
at_ladder = (boolean) (levl[u.ux][u.uy].typ == LADDER);
next_level(!trap);
at_ladder = FALSE;
}
return(1);
}
int
doup()
{
if( (u.ux != xupstair || u.uy != yupstair)
&& (!xupladder || u.ux != xupladder || u.uy != yupladder)
&& (!sstairs.sx || u.ux != sstairs.sx || u.uy != sstairs.sy
|| !sstairs.up)
) {
You_cant("go up here.");
return(0);
}
if(u.ustuck) {
You("are being held, and cannot go up.");
return(1);
}
if(near_capacity() > SLT_ENCUMBER) {
/* No levitation check; inv_weight() already allows for it */
Your("load is too heavy to climb the %s.",
levl[u.ux][u.uy].typ == STAIRS ? "stairs" : "ladder");
return(1);
}
if(ledger_no(&u.uz) == 1) {
if (yn("Beware, there will be no return! Still climb?") != 'y')
return(0);
}
if(!next_to_u()) {
You("are held back by your pet!");
return(0);
}
if (levl[u.ux][u.uy].typ == LADDER) at_ladder = TRUE;
prev_level(TRUE);
at_ladder = FALSE;
return(1);
}
d_level save_dlevel = {0, 0};
/* check that we can write out the current level */
static int
currentlevel_rewrite()
{
register int fd;
/* since level change might be a bit slow, flush any buffered screen
* output (like "you fall through a trapdoor") */
mark_synch();
fd = create_levelfile(ledger_no(&u.uz));
if(fd < 0) {
/*
* This is not quite impossible: e.g., we may have
* exceeded our quota. If that is the case then we
* cannot leave this level, and cannot save either.
* Another possibility is that the directory was not
* writable.
*/
pline("Cannot create level file for level %d.",
ledger_no(&u.uz));
return -1;
}
#ifdef MFLOPPY
if (!savelev(fd, ledger_no(&u.uz), COUNT_SAVE)) {
(void) close(fd);
delete_levelfile(ledger_no(&u.uz));
pline("NetHack is out of disk space for making levels!");
You("can save, quit, or continue playing.");
return -1;
}
#endif
return fd;
}
#ifdef INSURANCE
void
save_currentstate()
{
int fd;
if (flags.ins_chkpt) {
/* write out just-attained level, with pets and everything */
fd = currentlevel_rewrite();
if(fd < 0) return;
bufon(fd);
savelev(fd,ledger_no(&u.uz), WRITE_SAVE);
bclose(fd);
}
/* write out non-level state */
savestateinlock();
}
#endif
/*
static boolean
badspot(x, y)
register xchar x, y;
{
return((levl[x][y].typ != ROOM && levl[x][y].typ != AIR &&
levl[x][y].typ != CORR) || MON_AT(x, y));
}
*/
void
goto_level(newlevel, at_stairs, falling, portal)
d_level *newlevel;
boolean at_stairs, falling, portal;
{
int fd, l_idx;
xchar new_ledger;
boolean cant_go_back,
up = (depth(newlevel) < depth(&u.uz)),
newdungeon = (u.uz.dnum != newlevel->dnum),
was_in_W_tower = In_W_tower(u.ux, u.uy, &u.uz),
familiar = FALSE;
boolean new = FALSE; /* made a new level? */
if (dunlev(newlevel) > dunlevs_in_dungeon(newlevel))
newlevel->dlevel = dunlevs_in_dungeon(newlevel);
if (newdungeon && In_endgame(newlevel)) { /* 1st Endgame Level !!! */
if (u.uhave.amulet)
assign_level(newlevel, &earth_level);
else return;
}
new_ledger = ledger_no(newlevel);
if (new_ledger <= 0)
done(ESCAPED); /* in fact < 0 is impossible */
/* If you have the amulet and are trying to get out of Gehennom, going
* up a set of stairs sometimes does some very strange things!
* Biased against law and towards chaos, but not nearly as strongly
* as it used to be (prior to 3.2.0).
* Odds: old new
* "up" L N C "up" L N C
* +1 75.0 75.0 75.0 +1 75.0 75.0 75.0
* 0 0.0 12.5 25.0 0 6.25 8.33 12.5
* -1 8.33 4.17 0.0 -1 6.25 8.33 12.5
* -2 8.33 4.17 0.0 -2 6.25 8.33 0.0
* -3 8.33 4.17 0.0 -3 6.25 0.0 0.0
*/
if (Inhell && up && u.uhave.amulet && !newdungeon && !portal &&
(dunlev(&u.uz) < dunlevs_in_dungeon(&u.uz)-3)) {
if (!rn2(4)) {
int odds = 3 + (int)u.ualign.type, /* 2..4 */
diff = odds <= 1 ? 0 : rn2(odds); /* paranoia */
if (diff != 0) {
assign_rnd_level(newlevel, &u.uz, diff);
/* if inside the tower, stay inside */
if (was_in_W_tower &&
!On_W_tower_level(newlevel)) diff = 0;
}
if (diff == 0)
assign_level(newlevel, &u.uz);
new_ledger = ledger_no(newlevel);
pline("A mysterious force momentarily surrounds you...");
if (on_level(newlevel, &u.uz)) {
(void) safe_teleds();
(void) next_to_u();
return;
} else
at_stairs = at_ladder = FALSE;
}
}
/* Prevent the player from going past the first quest level unless
* (s)he has been given the go-ahead by the leader.
*/
if (on_level(&u.uz, &qstart_level) && !newdungeon && !ok_to_quest()) {
pline("A mysterious force prevents you from descending.");
return;
}
if (on_level(newlevel, &u.uz)) return; /* this can happen */
fd = currentlevel_rewrite();
if (fd < 0) return;
if (falling) /* assuming this is only trapdoor or hole */
impact_drop((struct obj *)0, u.ux, u.uy, newlevel->dlevel);
check_special_room(TRUE); /* probably was a trap door */
if (Punished) unplacebc();
u.utrap = 0; /* needed in level_tele */
fill_pit(u.ux, u.uy);
u.ustuck = 0; /* idem */
u.uinwater = 0;
keepdogs(FALSE);
if (u.uswallow) /* idem */
u.uswldtim = u.uswallow = 0;
/*
* We no longer see anything on the level. Make sure that this
* follows u.uswallow set to null since uswallow overrides all
* normal vision.
*/
vision_recalc(2);
/*
* Save the level we're leaving. If we're entering the endgame,
* we can get rid of all existing levels because they cannot be
* reached any more. We still need to use savelev()'s cleanup
* for the level being left, to recover dynamic memory in use and
* to avoid dangling timers and light sources.
*/
cant_go_back = (newdungeon && In_endgame(newlevel));
if (!cant_go_back) bufon(fd); /* use buffered output */
savelev(fd, ledger_no(&u.uz),
cant_go_back ? FREE_SAVE : (WRITE_SAVE | FREE_SAVE));
bclose(fd);
if (cant_go_back) {
/* discard unreachable levels; keep #0 */
for (l_idx = maxledgerno(); l_idx > 0; --l_idx)
delete_levelfile(l_idx);
}
#ifdef REINCARNATION
if (Is_rogue_level(newlevel) || Is_rogue_level(&u.uz))
assign_rogue_graphics(Is_rogue_level(newlevel));
#endif
#ifdef USE_TILES
substitute_tiles(newlevel);
#endif
assign_level(&u.uz0, &u.uz);
assign_level(&u.uz, newlevel);
assign_level(&u.utolev, newlevel);
u.utotype = 0;
if (dunlev_reached(&u.uz) < dunlev(&u.uz))
dunlev_reached(&u.uz) = dunlev(&u.uz);
reset_rndmonst(NON_PM); /* u.uz change affects monster generation */
/* set default level change destination areas */
/* the special level code may override these */
(void) memset((genericptr_t) &updest, 0, sizeof updest);
(void) memset((genericptr_t) &dndest, 0, sizeof dndest);
if (!(level_info[new_ledger].flags & LFILE_EXISTS)) {
/* entering this level for first time; make it now */
if (level_info[new_ledger].flags & (FORGOTTEN|VISITED)) {
impossible("goto_level: returning to discarded level?");
level_info[new_ledger].flags &= ~(FORGOTTEN|VISITED);
}
mklev();
new = TRUE; /* made the level */
} else {
/* returning to previously visited level; reload it */
fd = open_levelfile(new_ledger);
if (fd < 0) {
pline("Cannot open file (#%d) for level %d (errno %d).",
(int) new_ledger, depth(&u.uz), errno);
pline("Probably someone removed it.");
done(TRICKED);
}
minit(); /* ZEROCOMP */
getlev(fd, hackpid, new_ledger, FALSE);
(void) close(fd);
}
/* do this prior to level-change pline messages */
vision_reset(); /* clear old level's line-of-sight */
vision_full_recalc = 0; /* don't let that reenable vision yet */
if (portal && !In_endgame(&u.uz)) {
/* find the portal on the new level */
register struct trap *ttrap;
for (ttrap = ftrap; ttrap; ttrap = ttrap->ntrap)
if (ttrap->ttyp == MAGIC_PORTAL) break;
if (!ttrap) panic("goto_level: no corresponding portal!");
u_on_newpos(ttrap->tx, ttrap->ty);
} else if (at_stairs && !In_endgame(&u.uz)) {
if (up) {
if (at_ladder) {
u_on_newpos(xdnladder, ydnladder);
} else {
if (newdungeon) {
if (Is_stronghold(&u.uz)) {
register xchar x, y;
do {
x = (COLNO - 2 - rnd(5));
y = rn1(ROWNO - 4, 3);
} while(occupied(x, y) ||
IS_WALL(levl[x][y].typ));
u_on_newpos(x, y);
} else u_on_sstairs();
} else u_on_dnstairs();
}
/* Remove bug which crashes with levitation/punishment KAA */
if (Punished && !Levitation) {
pline("With great effort you climb the %s.",
at_ladder ? "ladder" : "stairs");
} else if (at_ladder)
You("climb up the ladder.");
} else { /* down */
if (at_ladder) {
u_on_newpos(xupladder, yupladder);
} else {
if (newdungeon) u_on_sstairs();
else u_on_upstairs();
}
if (u.dz &&
(near_capacity() > UNENCUMBERED || 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);
freeinv(uball);
}
}
losehp(rnd(3), "falling downstairs", KILLED_BY);
selftouch("Falling, you");
} else if (u.dz && at_ladder)
You("climb down the ladder.");
}
} else { /* trap door or level_tele or In_endgame */
if (was_in_W_tower && On_W_tower_level(&u.uz))
/* Stay inside the Wizard's tower when feasible. */
/* Note: up vs down doesn't really matter in this case. */
place_lregion(dndest.nlx, dndest.nly,
dndest.nhx, dndest.nhy,
0,0, 0,0, LR_DOWNTELE, (d_level *) 0);
else if (up)
place_lregion(updest.lx, updest.ly,
updest.hx, updest.hy,
updest.nlx, updest.nly,
updest.nhx, updest.nhy,
LR_UPTELE, (d_level *) 0);
else
place_lregion(dndest.lx, dndest.ly,
dndest.hx, dndest.hy,
dndest.nlx, dndest.nly,
dndest.nhx, dndest.nhy,
LR_DOWNTELE, (d_level *) 0);
if (falling) {
if (Punished) ballfall();
selftouch("Falling, you");
}
}
if (Punished) placebc();
obj_delivery(); /* before killing geno'd monsters' eggs */
losedogs();
kill_genocided_monsters(); /* for those wiped out while in limbo */
/*
* Expire all timers that have gone off while away. Must be
* after migrating monsters and objects are delivered
* (losedogs and obj_delivery).
*/
run_timers();
initrack();
if(MON_AT(u.ux, u.uy)) mnexto(m_at(u.ux, u.uy));
if(MON_AT(u.ux, u.uy)) {
impossible("mnexto failed (do.c)?");
rloc(m_at(u.ux, u.uy));
}
/* initial movement of bubbles just before vision_recalc */
if (Is_waterlevel(&u.uz))
movebubbles();
if (level_info[new_ledger].flags & FORGOTTEN) {
forget_map(ALL_MAP); /* forget the map */
forget_traps(); /* forget all traps too */
familiar = TRUE;
level_info[new_ledger].flags &= ~FORGOTTEN;
}
/* Reset the screen. */
vision_reset(); /* reset the blockages */
docrt(); /* does a full vision recalc */
/*
* Move all plines beyond the screen reset.
*/
/* give room entrance message, if any */
check_special_room(FALSE);
/* Check whether we just entered Gehennom. */
if (!In_hell(&u.uz0) && Inhell) {
if (Is_valley(&u.uz)) {
You("arrive at the Valley of the Dead...");
pline_The("odor of burnt flesh and decay pervades the air.");
#ifdef MICRO
display_nhwindow(WIN_MESSAGE, FALSE);
#endif
You_hear("groans and moans everywhere.");
} else pline("It is hot here. You smell smoke...");
}
if (familiar) {
static const char *fam_msgs[4] = {
"You have a sense of deja vu.",
"You feel like you've been here before.",
"This place looks familiar...",
0 /* no message */
};
static const char *halu_fam_msgs[4] = {
"Whoa! Everything looks different.",
"You are surrounded by twisty little passages, all alike.",
"Gee, this looks like uncle Conan's place...",
0 /* no message */
};
const char *mesg;
int which = rn2(4);
if (Hallucination)
mesg = halu_fam_msgs[which];
else
mesg = fam_msgs[which];
if (mesg) pline(mesg);
}
#ifdef REINCARNATION
if (new && Is_rogue_level(&u.uz))
You("enter what seems to be an older, more primitive world.");
#endif
/* Final confrontation */
if (In_endgame(&u.uz) && newdungeon && u.uhave.amulet)
resurrect();
if (newdungeon && In_V_tower(&u.uz) && In_hell(&u.uz0))
pline_The("heat and smoke are gone.");
/* the message from your quest leader */
if (!In_quest(&u.uz0) && at_dgn_entrance("The Quest") &&
!(u.uevent.qexpelled || u.uevent.qcompleted || leaderless())) {
if (u.uevent.qcalled) {
com_pager(Role_is('R') ? 4 : 3);
} else {
com_pager(2);
u.uevent.qcalled = TRUE;
}
}
/* once Croesus is dead, his alarm doesn't work any more */
if (Is_knox(&u.uz) && (new || !mvitals[PM_CROESUS].died)) {
register struct monst *mtmp;
You("penetrated a high security area!");
pline("An alarm sounds!");
for(mtmp = fmon; mtmp; mtmp = mtmp->nmon)
if(mtmp->msleep) mtmp->msleep = 0;
}
if(on_level(&u.uz, &astral_level)) {
register struct monst *mtmp;
/* reset monster hostility relative to player */
for(mtmp = fmon; mtmp; mtmp = mtmp->nmon)
reset_hostility(mtmp);
/* create some player-monsters */
create_mplayers(rn1(4, 3), TRUE);
/* create a guardian angel next to player, if worthy */
if (Conflict) {
coord mm;
int i = rnd(4);
pline("A voice booms: \"Thy desire for conflict shall be fulfilled!\"");
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);
}
} else if(u.ualign.record > 8 /* fervent */) {
coord mm;
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) {
register struct obj *otmp;
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);
mpickobj(mtmp, otmp);
}
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);
}
}
}
}
}
onquest();
assign_level(&u.uz0, &u.uz); /* reset u.uz0 */
#ifdef INSURANCE
save_currentstate();
#endif
pickup(1);
}
static char *dfr_pre_msg = 0, /* pline() before level change */
*dfr_post_msg = 0; /* pline() after level change */
/* change levels at the end of this turn, after monsters finish moving */
void
schedule_goto(tolev, at_stairs, falling, portal_flag, pre_msg, post_msg)
d_level *tolev;
boolean at_stairs, falling;
int portal_flag;
const char *pre_msg, *post_msg;
{
int typmask = 0100; /* non-zero triggers `deferred_goto' */
/* destination flags (`goto_level' args) */
if (at_stairs) typmask |= 1;
if (falling) typmask |= 2;
if (portal_flag) typmask |= 4;
if (portal_flag < 0) typmask |= 0200; /* flag for portal removal */
u.utotype = typmask;
/* destination level */
assign_level(&u.utolev, tolev);
if (pre_msg)
dfr_pre_msg = strcpy((char *)alloc(strlen(pre_msg) + 1), pre_msg);
if (post_msg)
dfr_post_msg = strcpy((char *)alloc(strlen(post_msg)+1), post_msg);
/* we don't actually have to wait unless this is a monster's move */
if (!flags.mon_moving) deferred_goto();
}
/* handle something like portal ejection */
void
deferred_goto()
{
if (!on_level(&u.uz, &u.utolev)) {
d_level dest;
int typmask = u.utotype; /* save it; goto_level zeroes u.utotype */
assign_level(&dest, &u.utolev);
if (dfr_pre_msg) pline(dfr_pre_msg);
goto_level(&dest, !!(typmask&1), !!(typmask&2), !!(typmask&4));
if (typmask & 0200) { /* remove portal */
struct trap *t = t_at(u.ux, u.uy);
if (t) {
deltrap(t);
newsym(u.ux, u.uy);
}
}
if (dfr_post_msg) pline(dfr_post_msg);
}
u.utotype = 0; /* our caller keys off of this */
if (dfr_pre_msg)
free((genericptr_t)dfr_pre_msg), dfr_pre_msg = 0;
if (dfr_post_msg)
free((genericptr_t)dfr_post_msg), dfr_post_msg = 0;
}
#endif /* OVL2 */
#ifdef OVL3
/*
* Return TRUE if we created a monster for the corpse. If successful, the
* corpse is gone.
*/
boolean
revive_corpse(corpse)
struct obj *corpse;
{
struct monst *mtmp, *mcarry;
boolean is_uwep, chewed;
xchar where;
char *cname, cname_buf[BUFSZ];
where = corpse->where;
is_uwep = corpse == uwep;
cname = eos(strcpy(cname_buf, "bite-covered "));
Strcpy(cname, corpse_xname(corpse, TRUE));
mcarry = (where == OBJ_MINVENT) ? corpse->ocarry : 0;
mtmp = revive(corpse); /* corpse is gone if successful */
if (mtmp) {
chewed = (mtmp->mhp < mtmp->mhpmax);
if (chewed) cname = cname_buf; /* include "bite-covered" prefix */
switch (where) {
case OBJ_INVENT:
if (is_uwep)
pline_The("%s writhes out of your grasp!", cname);
else
You_feel("squirming in your backpack!");
break;
case OBJ_FLOOR:
if (cansee(mtmp->mx, mtmp->my))
pline("%s rises from the dead!", chewed ?
Adjmonnam(mtmp, "bite-covered") : Monnam(mtmp));
break;
case OBJ_MINVENT: /* probably a nymph's */
if (cansee(mtmp->mx, mtmp->my)) {
if (canseemon(mcarry))
pline("Startled, %s drops %s as it revives!",
mon_nam(mcarry), an(cname));
else
pline("%s suddenly appears!", chewed ?
Adjmonnam(mtmp, "bite-covered") : Monnam(mtmp));
}
break;
default:
/* we should be able to handle the other cases... */
impossible("revive_corpse: lost corpse @ %d", where);
break;
}
return TRUE;
}
return FALSE;
}
/* Revive the corpse via a timeout. */
/*ARGSUSED*/
void
revive_mon(arg, timeout)
genericptr_t arg;
long timeout;
{
struct obj *body = (struct obj *) arg;
/* if we succeed, the corpse is gone, otherwise, rot it away */
if (!revive_corpse(body)) {
if (is_rider(&mons[body->corpsenm]))
You_feel("less hassled.");
(void) start_timer(250L - (monstermoves-body->age),
TIMER_OBJECT, ROT_CORPSE, arg);
}
}
int
donull()
{
return(1); /* Do nothing, but let other things happen */
}
#endif /* OVL3 */
#ifdef OVLB
STATIC_PTR int
wipeoff()
{
if(u.ucreamed < 4) u.ucreamed = 0;
else u.ucreamed -= 4;
if (Blinded < 4) Blinded = 0;
else Blinded -= 4;
if (!Blinded) {
pline("You've got the glop off.");
u.ucreamed = 0;
Blinded = 1;
make_blinded(0L,TRUE);
return(0);
} else if (!u.ucreamed) {
Your("%s feels clean now.", body_part(FACE));
return(0);
}
return(1); /* still busy */
}
int
dowipe()
{
if(u.ucreamed) {
static NEARDATA char buf[39];
Sprintf(buf, "wiping off your %s", body_part(FACE));
set_occupation(wipeoff, buf, 0);
/* Not totally correct; what if they change back after now
* but before they're finished wiping?
*/
return(1);
}
Your("%s is already clean.", body_part(FACE));
return(1);
}
void
set_wounded_legs(side, timex)
register long side;
register int timex;
{
if(!Wounded_legs) {
ATEMP(A_DEX)--;
flags.botl = 1;
}
if(!Wounded_legs || (Wounded_legs & TIMEOUT))
Wounded_legs |= side + timex;
else
Wounded_legs |= side;
(void)encumber_msg();
}
void
heal_legs()
{
if(Wounded_legs) {
if (ATEMP(A_DEX) < 0) {
ATEMP(A_DEX)++;
flags.botl = 1;
}
if((Wounded_legs & BOTH_SIDES) == BOTH_SIDES) {
Your("%s feel somewhat better.",
makeplural(body_part(LEG)));
} else {
Your("%s feels somewhat better.",
body_part(LEG));
}
Wounded_legs = 0;
}
(void)encumber_msg();
}
#endif /* OVLB */
/*do.c*/
|