Mercurial > hg > early-roguelike
comparison arogue5/potions.c @ 63:0ed67132cf10
Import Advanced Rogue 5.8 from the Roguelike Restoration Project (r1490)
| author | elwin |
|---|---|
| date | Thu, 09 Aug 2012 22:58:48 +0000 |
| parents | |
| children | c49f7927b0fa |
comparison
equal
deleted
inserted
replaced
| 62:0ef99244acb8 | 63:0ed67132cf10 |
|---|---|
| 1 /* | |
| 2 * Function(s) for dealing with potions | |
| 3 * | |
| 4 * Advanced Rogue | |
| 5 * Copyright (C) 1984, 1985 Michael Morgan, Ken Dalka and AT&T | |
| 6 * All rights reserved. | |
| 7 * | |
| 8 * Based on "Rogue: Exploring the Dungeons of Doom" | |
| 9 * Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman | |
| 10 * All rights reserved. | |
| 11 * | |
| 12 * See the file LICENSE.TXT for full copyright and licensing information. | |
| 13 */ | |
| 14 | |
| 15 #include "curses.h" | |
| 16 #include "rogue.h" | |
| 17 | |
| 18 | |
| 19 | |
| 20 /* | |
| 21 * Increase player's constitution | |
| 22 */ | |
| 23 | |
| 24 add_const(cursed) | |
| 25 bool cursed; | |
| 26 { | |
| 27 /* Do the potion */ | |
| 28 if (cursed) { | |
| 29 msg("You feel less healthy now."); | |
| 30 pstats.s_const--; | |
| 31 if (pstats.s_const <= 0) | |
| 32 death(D_CONSTITUTION); | |
| 33 } | |
| 34 else { | |
| 35 msg("You feel healthier now."); | |
| 36 pstats.s_const = min(pstats.s_const + 1, 25); | |
| 37 } | |
| 38 | |
| 39 /* Adjust the maximum */ | |
| 40 if (max_stats.s_const < pstats.s_const) | |
| 41 max_stats.s_const = pstats.s_const; | |
| 42 } | |
| 43 | |
| 44 /* | |
| 45 * Increase player's dexterity | |
| 46 */ | |
| 47 | |
| 48 add_dexterity(cursed) | |
| 49 bool cursed; | |
| 50 { | |
| 51 int ring_str; /* Value of ring strengths */ | |
| 52 | |
| 53 /* Undo any ring changes */ | |
| 54 ring_str = ring_value(R_ADDHIT); | |
| 55 pstats.s_dext -= ring_str; | |
| 56 | |
| 57 /* Now do the potion */ | |
| 58 if (cursed) { | |
| 59 msg("You feel less dextrous now."); | |
| 60 pstats.s_dext--; | |
| 61 } | |
| 62 else { | |
| 63 msg("You feel more dextrous now. Watch those hands!"); | |
| 64 pstats.s_dext = min(pstats.s_dext + 1, 25); | |
| 65 } | |
| 66 | |
| 67 /* Adjust the maximum */ | |
| 68 if (max_stats.s_dext < pstats.s_dext) | |
| 69 max_stats.s_dext = pstats.s_dext; | |
| 70 | |
| 71 /* Now put back the ring changes */ | |
| 72 if (ring_str) | |
| 73 pstats.s_dext += ring_str; | |
| 74 } | |
| 75 | |
| 76 /* | |
| 77 * add_haste: | |
| 78 * add a haste to the player | |
| 79 */ | |
| 80 | |
| 81 add_haste(blessed) | |
| 82 bool blessed; | |
| 83 { | |
| 84 int hasttime; | |
| 85 | |
| 86 if (blessed) hasttime = HASTETIME*2; | |
| 87 else hasttime = HASTETIME; | |
| 88 | |
| 89 if (on(player, ISSLOW)) { /* Is person slow? */ | |
| 90 extinguish(noslow); | |
| 91 noslow(); | |
| 92 | |
| 93 if (blessed) hasttime = HASTETIME/2; | |
| 94 else return; | |
| 95 } | |
| 96 | |
| 97 if (on(player, ISHASTE)) { | |
| 98 msg("You faint from exhaustion."); | |
| 99 no_command += rnd(hasttime); | |
| 100 lengthen(nohaste, roll(hasttime,hasttime)); | |
| 101 } | |
| 102 else { | |
| 103 turn_on(player, ISHASTE); | |
| 104 fuse(nohaste, 0, roll(hasttime, hasttime), AFTER); | |
| 105 } | |
| 106 } | |
| 107 | |
| 108 /* | |
| 109 * Increase player's intelligence | |
| 110 */ | |
| 111 add_intelligence(cursed) | |
| 112 bool cursed; | |
| 113 { | |
| 114 int ring_str; /* Value of ring strengths */ | |
| 115 | |
| 116 /* Undo any ring changes */ | |
| 117 ring_str = ring_value(R_ADDINTEL); | |
| 118 pstats.s_intel -= ring_str; | |
| 119 | |
| 120 /* Now do the potion */ | |
| 121 if (cursed) { | |
| 122 msg("You feel slightly less intelligent now."); | |
| 123 pstats.s_intel--; | |
| 124 } | |
| 125 else { | |
| 126 msg("You feel more intelligent now. What a mind!"); | |
| 127 pstats.s_intel = min(pstats.s_intel + 1, 25); | |
| 128 } | |
| 129 | |
| 130 /* Adjust the maximum */ | |
| 131 if (max_stats.s_intel < pstats.s_intel) | |
| 132 max_stats.s_intel = pstats.s_intel; | |
| 133 | |
| 134 /* Now put back the ring changes */ | |
| 135 if (ring_str) | |
| 136 pstats.s_intel += ring_str; | |
| 137 } | |
| 138 | |
| 139 /* | |
| 140 * this routine makes the hero move slower | |
| 141 */ | |
| 142 add_slow() | |
| 143 { | |
| 144 if (on(player, ISHASTE)) { /* Already sped up */ | |
| 145 extinguish(nohaste); | |
| 146 nohaste(); | |
| 147 } | |
| 148 else { | |
| 149 msg("You feel yourself moving %sslower.", | |
| 150 on(player, ISSLOW) ? "even " : ""); | |
| 151 if (on(player, ISSLOW)) | |
| 152 lengthen(noslow, roll(HASTETIME,HASTETIME)); | |
| 153 else { | |
| 154 turn_on(player, ISSLOW); | |
| 155 player.t_turn = TRUE; | |
| 156 fuse(noslow, 0, roll(HASTETIME,HASTETIME), AFTER); | |
| 157 } | |
| 158 } | |
| 159 } | |
| 160 | |
| 161 /* | |
| 162 * Increase player's strength | |
| 163 */ | |
| 164 | |
| 165 add_strength(cursed) | |
| 166 bool cursed; | |
| 167 { | |
| 168 | |
| 169 if (cursed) { | |
| 170 msg("You feel slightly weaker now."); | |
| 171 chg_str(-1); | |
| 172 } | |
| 173 else { | |
| 174 msg("You feel stronger now. What bulging muscles!"); | |
| 175 chg_str(1); | |
| 176 } | |
| 177 } | |
| 178 | |
| 179 /* | |
| 180 * Increase player's wisdom | |
| 181 */ | |
| 182 | |
| 183 add_wisdom(cursed) | |
| 184 bool cursed; | |
| 185 { | |
| 186 int ring_str; /* Value of ring strengths */ | |
| 187 | |
| 188 /* Undo any ring changes */ | |
| 189 ring_str = ring_value(R_ADDWISDOM); | |
| 190 pstats.s_wisdom -= ring_str; | |
| 191 | |
| 192 /* Now do the potion */ | |
| 193 if (cursed) { | |
| 194 msg("You feel slightly less wise now."); | |
| 195 pstats.s_wisdom--; | |
| 196 } | |
| 197 else { | |
| 198 msg("You feel wiser now. What a sage!"); | |
| 199 pstats.s_wisdom = min(pstats.s_wisdom + 1, 25); | |
| 200 } | |
| 201 | |
| 202 /* Adjust the maximum */ | |
| 203 if (max_stats.s_wisdom < pstats.s_wisdom) | |
| 204 max_stats.s_wisdom = pstats.s_wisdom; | |
| 205 | |
| 206 /* Now put back the ring changes */ | |
| 207 if (ring_str) | |
| 208 pstats.s_wisdom += ring_str; | |
| 209 } | |
| 210 | |
| 211 | |
| 212 /* | |
| 213 * Lower a level of experience | |
| 214 */ | |
| 215 | |
| 216 lower_level(who) | |
| 217 short who; | |
| 218 { | |
| 219 int fewer, nsides = 0; | |
| 220 | |
| 221 if (--pstats.s_lvl == 0) | |
| 222 death(who); /* All levels gone */ | |
| 223 msg("You suddenly feel less skillful."); | |
| 224 pstats.s_exp /= 2; | |
| 225 switch (player.t_ctype) { | |
| 226 case C_FIGHTER: nsides = HIT_FIGHTER; | |
| 227 when C_MAGICIAN:nsides = HIT_MAGICIAN; | |
| 228 when C_CLERIC: nsides = HIT_CLERIC; | |
| 229 when C_THIEF: nsides = HIT_THIEF; | |
| 230 } | |
| 231 fewer = max(1, roll(1,nsides) + const_bonus()); | |
| 232 pstats.s_hpt -= fewer; | |
| 233 max_stats.s_hpt -= fewer; | |
| 234 if (pstats.s_hpt < 1) | |
| 235 pstats.s_hpt = 1; | |
| 236 if (max_stats.s_hpt < 1) | |
| 237 death(who); | |
| 238 } | |
| 239 | |
| 240 quaff(which, flag, is_potion) | |
| 241 int which; | |
| 242 int flag; | |
| 243 bool is_potion; | |
| 244 { | |
| 245 register struct object *obj = NULL; | |
| 246 register struct linked_list *item, *titem; | |
| 247 register struct thing *th; | |
| 248 bool cursed, blessed; | |
| 249 char buf[LINELEN]; | |
| 250 | |
| 251 blessed = FALSE; | |
| 252 cursed = FALSE; | |
| 253 item = NULL; | |
| 254 | |
| 255 if (which < 0) { /* figure out which ourselves */ | |
| 256 item = get_item(pack, "quaff", POTION); | |
| 257 /* | |
| 258 * Make certain that it is somethings that we want to drink | |
| 259 */ | |
| 260 if (item == NULL) | |
| 261 return; | |
| 262 | |
| 263 obj = OBJPTR(item); | |
| 264 /* remove it from the pack */ | |
| 265 inpack--; | |
| 266 detach(pack, item); | |
| 267 | |
| 268 /* | |
| 269 * Calculate the effect it has on the poor guy. | |
| 270 */ | |
| 271 cursed = (obj->o_flags & ISCURSED) != 0; | |
| 272 blessed = (obj->o_flags & ISBLESSED) != 0; | |
| 273 | |
| 274 which = obj->o_which; | |
| 275 } | |
| 276 else { | |
| 277 cursed = flag & ISCURSED; | |
| 278 blessed = flag & ISBLESSED; | |
| 279 } | |
| 280 | |
| 281 switch(which) | |
| 282 { | |
| 283 case P_CLEAR: | |
| 284 if (cursed) { | |
| 285 if (off(player, ISCLEAR)) | |
| 286 { | |
| 287 msg("Wait, what's going on here. Huh? What? Who?"); | |
| 288 if (find_slot(unconfuse)) | |
| 289 lengthen(unconfuse, rnd(8)+HUHDURATION); | |
| 290 else | |
| 291 fuse(unconfuse, 0, rnd(8)+HUHDURATION, AFTER); | |
| 292 turn_on(player, ISHUH); | |
| 293 } | |
| 294 else msg("You feel dizzy for a moment, but it quickly passes."); | |
| 295 } | |
| 296 else { | |
| 297 if (blessed) { /* Make player immune for the whole game */ | |
| 298 extinguish(unclrhead); /* If we have a fuse, put it out */ | |
| 299 msg("A strong blue aura surrounds your head."); | |
| 300 } | |
| 301 else { /* Just light a fuse for how long player is safe */ | |
| 302 if (off(player, ISCLEAR)) { | |
| 303 fuse(unclrhead, 0, CLRDURATION, AFTER); | |
| 304 msg("A faint blue aura surrounds your head."); | |
| 305 } | |
| 306 else { /* If we have a fuse lengthen it, else we | |
| 307 * are permanently clear. | |
| 308 */ | |
| 309 if (find_slot(unclrhead) == FALSE) | |
| 310 msg("Your blue aura continues to glow strongly."); | |
| 311 else { | |
| 312 lengthen(unclrhead, CLRDURATION); | |
| 313 msg("Your blue aura brightens for a moment."); | |
| 314 } | |
| 315 } | |
| 316 } | |
| 317 turn_on(player, ISCLEAR); | |
| 318 /* If player is confused, unconfuse him */ | |
| 319 if (on(player, ISHUH)) { | |
| 320 extinguish(unconfuse); | |
| 321 unconfuse(); | |
| 322 } | |
| 323 } | |
| 324 when P_HEALING: | |
| 325 if (cursed) { | |
| 326 if (!save(VS_POISON, &player, 0)) { | |
| 327 msg("You feel very sick now."); | |
| 328 pstats.s_hpt /= 2; | |
| 329 pstats.s_const--; | |
| 330 if (pstats.s_const <= 0 || pstats.s_hpt <= 0) | |
| 331 death(D_POISON); | |
| 332 } | |
| 333 else msg("You feel momentarily sick."); | |
| 334 } | |
| 335 else { | |
| 336 if (blessed) { | |
| 337 if ((pstats.s_hpt += roll(pstats.s_lvl, 8)) > max_stats.s_hpt) | |
| 338 pstats.s_hpt = ++max_stats.s_hpt; | |
| 339 if (on(player, ISHUH)) { | |
| 340 extinguish(unconfuse); | |
| 341 unconfuse(); | |
| 342 } | |
| 343 } | |
| 344 else { | |
| 345 if ((pstats.s_hpt += roll(pstats.s_lvl, 4)) > max_stats.s_hpt) | |
| 346 pstats.s_hpt = ++max_stats.s_hpt; | |
| 347 } | |
| 348 msg("You begin to feel %sbetter.", | |
| 349 blessed ? "much " : ""); | |
| 350 sight(); | |
| 351 if (is_potion) p_know[P_HEALING] = TRUE; | |
| 352 } | |
| 353 when P_ABIL: | |
| 354 { | |
| 355 int ctype; | |
| 356 | |
| 357 /* | |
| 358 * if blessed then fix all attributes | |
| 359 */ | |
| 360 if (blessed) { | |
| 361 add_intelligence(FALSE); | |
| 362 add_dexterity(FALSE); | |
| 363 add_strength(FALSE); | |
| 364 add_wisdom(FALSE); | |
| 365 add_const(FALSE); | |
| 366 } | |
| 367 /* probably will be own ability */ | |
| 368 else { | |
| 369 if (rnd(100) < 70) | |
| 370 ctype = player.t_ctype; | |
| 371 else do { | |
| 372 ctype = rnd(4); | |
| 373 } while (ctype == player.t_ctype); | |
| 374 | |
| 375 /* Small chance of doing constitution instead */ | |
| 376 if (rnd(100) < 10) | |
| 377 add_const(cursed); | |
| 378 else switch (ctype) { | |
| 379 case C_FIGHTER: add_strength(cursed); | |
| 380 when C_MAGICIAN: add_intelligence(cursed); | |
| 381 when C_CLERIC: add_wisdom(cursed); | |
| 382 when C_THIEF: add_dexterity(cursed); | |
| 383 otherwise: msg("You're a strange type!"); | |
| 384 } | |
| 385 } | |
| 386 if (is_potion) p_know[P_ABIL] = TRUE; | |
| 387 } | |
| 388 when P_MFIND: | |
| 389 /* | |
| 390 * Potion of monster detection, if there are monters, detect them | |
| 391 */ | |
| 392 if (mlist != NULL) | |
| 393 { | |
| 394 msg("You begin to sense the presence of monsters."); | |
| 395 waddstr(cw, morestr); | |
| 396 overlay(mw, cw); | |
| 397 draw(cw); | |
| 398 wait_for(cw,' '); | |
| 399 msg(""); | |
| 400 if (is_potion) p_know[P_MFIND] = TRUE; | |
| 401 } | |
| 402 else | |
| 403 msg("You have a strange feeling for a moment, then it passes."); | |
| 404 when P_TFIND: | |
| 405 /* | |
| 406 * Potion of magic detection. Show the potions and scrolls | |
| 407 */ | |
| 408 if (lvl_obj != NULL) | |
| 409 { | |
| 410 register struct linked_list *mobj; | |
| 411 register struct object *tp; | |
| 412 bool show; | |
| 413 | |
| 414 show = FALSE; | |
| 415 wclear(hw); | |
| 416 for (mobj = lvl_obj; mobj != NULL; mobj = next(mobj)) { | |
| 417 tp = OBJPTR(mobj); | |
| 418 if (is_magic(tp)) { | |
| 419 char mag_type=MAGIC; | |
| 420 | |
| 421 /* Mark cursed items or bad weapons */ | |
| 422 if ((tp->o_flags & ISCURSED) || | |
| 423 (tp->o_type == WEAPON && | |
| 424 (tp->o_hplus < 0 || tp->o_dplus < 0))) | |
| 425 mag_type = CMAGIC; | |
| 426 else if ((tp->o_flags & ISBLESSED) || | |
| 427 (tp->o_type == WEAPON && | |
| 428 (tp->o_hplus > 0 || tp->o_dplus > 0))) | |
| 429 mag_type = BMAGIC; | |
| 430 show = TRUE; | |
| 431 mvwaddch(hw, tp->o_pos.y, tp->o_pos.x, mag_type); | |
| 432 } | |
| 433 if (is_potion) p_know[P_TFIND] = TRUE; | |
| 434 } | |
| 435 for (titem = mlist; titem != NULL; titem = next(titem)) { | |
| 436 register struct linked_list *pitem; | |
| 437 | |
| 438 th = THINGPTR(titem); | |
| 439 for(pitem = th->t_pack; pitem != NULL; pitem = next(pitem)){ | |
| 440 tp = OBJPTR(pitem); | |
| 441 if (is_magic(tp)) { | |
| 442 char mag_type=MAGIC; | |
| 443 | |
| 444 /* Mark cursed items or bad weapons */ | |
| 445 if ((tp->o_flags & ISCURSED) || | |
| 446 (tp->o_type == WEAPON && | |
| 447 (tp->o_hplus < 0 || tp->o_dplus < 0))) | |
| 448 mag_type = CMAGIC; | |
| 449 else if ((tp->o_flags & ISBLESSED) || | |
| 450 (tp->o_type == WEAPON && | |
| 451 (tp->o_hplus > 0 || tp->o_dplus > 0))) | |
| 452 mag_type = BMAGIC; | |
| 453 show = TRUE; | |
| 454 mvwaddch(hw, th->t_pos.y, th->t_pos.x, mag_type); | |
| 455 } | |
| 456 if (is_potion) p_know[P_TFIND] = TRUE; | |
| 457 } | |
| 458 } | |
| 459 if (show) { | |
| 460 msg("You sense the presence of magic on this level."); | |
| 461 waddstr(cw, morestr); | |
| 462 overlay(hw,cw); | |
| 463 draw(cw); | |
| 464 wait_for(cw,' '); | |
| 465 msg(""); | |
| 466 break; | |
| 467 } | |
| 468 } | |
| 469 msg("You have a strange feeling for a moment, then it passes."); | |
| 470 when P_SEEINVIS: | |
| 471 if (cursed) { | |
| 472 if (!find_slot(sight)) | |
| 473 { | |
| 474 msg("A cloak of darkness falls around you."); | |
| 475 turn_on(player, ISBLIND); | |
| 476 fuse(sight, 0, SEEDURATION, AFTER); | |
| 477 light(&hero); | |
| 478 } | |
| 479 else | |
| 480 lengthen(sight, SEEDURATION); | |
| 481 } | |
| 482 else { | |
| 483 if (off(player, CANSEE)) { | |
| 484 turn_on(player, CANSEE); | |
| 485 msg("Your eyes begin to tingle."); | |
| 486 fuse(unsee, 0, blessed ? SEEDURATION*3 :SEEDURATION, AFTER); | |
| 487 light(&hero); | |
| 488 } | |
| 489 else if (find_slot(unsee) != FALSE) | |
| 490 lengthen(unsee, blessed ? SEEDURATION*3 : SEEDURATION); | |
| 491 sight(); | |
| 492 } | |
| 493 when P_PHASE: | |
| 494 if (cursed) { | |
| 495 msg("You can't move."); | |
| 496 no_command = FREEZETIME; | |
| 497 } | |
| 498 else { | |
| 499 int duration; | |
| 500 | |
| 501 if (blessed) duration = 3; | |
| 502 else duration = 1; | |
| 503 | |
| 504 if (on(player, CANINWALL)) | |
| 505 lengthen(unphase, duration*PHASEDURATION); | |
| 506 else { | |
| 507 fuse(unphase, 0, duration*PHASEDURATION, AFTER); | |
| 508 turn_on(player, CANINWALL); | |
| 509 } | |
| 510 msg("You feel %slight-headed!", | |
| 511 blessed ? "very " : ""); | |
| 512 } | |
| 513 when P_FLY: { | |
| 514 int duration; | |
| 515 bool say_message; | |
| 516 | |
| 517 say_message = TRUE; | |
| 518 | |
| 519 if (blessed) duration = 3; | |
| 520 else duration = 1; | |
| 521 | |
| 522 if (on(player, ISFLY)) { | |
| 523 if (find_slot(land)) | |
| 524 lengthen(land, duration*FLYTIME); | |
| 525 else { | |
| 526 msg("Nothing happens."); /* Flying by cloak */ | |
| 527 say_message = FALSE; | |
| 528 } | |
| 529 } | |
| 530 else { | |
| 531 fuse(land, 0, duration*FLYTIME, AFTER); | |
| 532 turn_on(player, ISFLY); | |
| 533 } | |
| 534 if (say_message) | |
| 535 msg("You feel %slighter than air!", blessed ? "much " : ""); | |
| 536 } | |
| 537 when P_RAISE: | |
| 538 if (cursed) lower_level(D_POTION); | |
| 539 else { | |
| 540 msg("You suddenly feel %smore skillful", | |
| 541 blessed ? "much " : ""); | |
| 542 p_know[P_RAISE] = TRUE; | |
| 543 raise_level(TRUE); | |
| 544 if (blessed) raise_level(TRUE); | |
| 545 } | |
| 546 when P_HASTE: | |
| 547 if (cursed) { /* Slow player down */ | |
| 548 add_slow(); | |
| 549 } | |
| 550 else { | |
| 551 if (off(player, ISSLOW)) | |
| 552 msg("You feel yourself moving %sfaster.", | |
| 553 blessed ? "much " : ""); | |
| 554 add_haste(blessed); | |
| 555 if (is_potion) p_know[P_HASTE] = TRUE; | |
| 556 } | |
| 557 when P_RESTORE: { | |
| 558 register int i; | |
| 559 | |
| 560 msg("Hey, this tastes great. It make you feel warm all over."); | |
| 561 if (lost_str) { | |
| 562 extinguish(res_strength); | |
| 563 lost_str = 0; | |
| 564 } | |
| 565 for (i=0; i<lost_dext; i++) | |
| 566 extinguish(un_itch); | |
| 567 lost_dext = 0; | |
| 568 res_strength(); | |
| 569 res_wisdom(); | |
| 570 res_dexterity(0); | |
| 571 res_intelligence(); | |
| 572 pstats.s_const = max_stats.s_const; | |
| 573 } | |
| 574 when P_INVIS: | |
| 575 if (off(player, ISINVIS)) { | |
| 576 turn_on(player, ISINVIS); | |
| 577 msg("You have a tingling feeling all over your body"); | |
| 578 fuse(appear, 0, blessed ? GONETIME*3 : GONETIME, AFTER); | |
| 579 PLAYER = IPLAYER; | |
| 580 light(&hero); | |
| 581 } | |
| 582 else { | |
| 583 if (find_slot(appear)) { | |
| 584 msg("Your tingling feeling surges."); | |
| 585 lengthen(appear, blessed ? GONETIME*3 : GONETIME); | |
| 586 } | |
| 587 else msg("Nothing happens."); /* Using cloak */ | |
| 588 } | |
| 589 | |
| 590 otherwise: | |
| 591 msg("What an odd tasting potion!"); | |
| 592 return; | |
| 593 } | |
| 594 status(FALSE); | |
| 595 if (is_potion && p_know[which] && p_guess[which]) | |
| 596 { | |
| 597 free(p_guess[which]); | |
| 598 p_guess[which] = NULL; | |
| 599 } | |
| 600 else if (is_potion && | |
| 601 !p_know[which] && | |
| 602 askme && | |
| 603 (obj->o_flags & ISKNOW) == 0 && | |
| 604 (obj->o_flags & ISPOST) == 0 && | |
| 605 p_guess[which] == NULL) | |
| 606 { | |
| 607 msg(terse ? "Call it: " : "What do you want to call it? "); | |
| 608 if (get_str(buf, cw) == NORM) | |
| 609 { | |
| 610 p_guess[which] = new((unsigned int) strlen(buf) + 1); | |
| 611 strcpy(p_guess[which], buf); | |
| 612 } | |
| 613 } | |
| 614 if (item != NULL) o_discard(item); | |
| 615 updpack(TRUE); | |
| 616 } | |
| 617 | |
| 618 | |
| 619 /* | |
| 620 * res_dexterity: | |
| 621 * Restore player's dexterity | |
| 622 * if called with zero the restore fully | |
| 623 */ | |
| 624 | |
| 625 res_dexterity(howmuch) | |
| 626 int howmuch; | |
| 627 { | |
| 628 short save_max; | |
| 629 int ring_str; | |
| 630 | |
| 631 /* Discount the ring value */ | |
| 632 ring_str = ring_value(R_ADDHIT); | |
| 633 pstats.s_dext -= ring_str; | |
| 634 | |
| 635 if (pstats.s_dext < max_stats.s_dext ) { | |
| 636 if (howmuch == 0) | |
| 637 pstats.s_dext = max_stats.s_dext; | |
| 638 else | |
| 639 pstats.s_dext = min(pstats.s_dext+howmuch, max_stats.s_dext); | |
| 640 } | |
| 641 | |
| 642 /* Redo the rings */ | |
| 643 if (ring_str) { | |
| 644 save_max = max_stats.s_dext; | |
| 645 pstats.s_dext += ring_str; | |
| 646 max_stats.s_dext = save_max; | |
| 647 } | |
| 648 } | |
| 649 | |
| 650 | |
| 651 /* | |
| 652 * res_intelligence: | |
| 653 * Restore player's intelligence | |
| 654 */ | |
| 655 | |
| 656 res_intelligence() | |
| 657 { | |
| 658 short save_max; | |
| 659 int ring_str; | |
| 660 | |
| 661 /* Discount the ring value */ | |
| 662 ring_str = ring_value(R_ADDINTEL); | |
| 663 pstats.s_intel -= ring_str; | |
| 664 | |
| 665 if (pstats.s_intel < max_stats.s_intel ) pstats.s_intel = max_stats.s_intel; | |
| 666 | |
| 667 /* Redo the rings */ | |
| 668 if (ring_str) { | |
| 669 save_max = max_stats.s_intel; | |
| 670 pstats.s_intel += ring_str; | |
| 671 max_stats.s_intel = save_max; | |
| 672 } | |
| 673 } | |
| 674 | |
| 675 /* | |
| 676 * res_wisdom: | |
| 677 * Restore player's wisdom | |
| 678 */ | |
| 679 | |
| 680 res_wisdom() | |
| 681 { | |
| 682 short save_max; | |
| 683 int ring_str; | |
| 684 | |
| 685 /* Discount the ring value */ | |
| 686 ring_str = ring_value(R_ADDWISDOM); | |
| 687 pstats.s_wisdom -= ring_str; | |
| 688 | |
| 689 if (pstats.s_wisdom < max_stats.s_wisdom ) | |
| 690 pstats.s_wisdom = max_stats.s_wisdom; | |
| 691 | |
| 692 /* Redo the rings */ | |
| 693 if (ring_str) { | |
| 694 save_max = max_stats.s_wisdom; | |
| 695 pstats.s_wisdom += ring_str; | |
| 696 max_stats.s_wisdom = save_max; | |
| 697 } | |
| 698 } |
