[BACK]Return to potions.c CVS log [TXT][DIR] Up to [contributed] / early-roguelike / arogue5

Annotation of early-roguelike/arogue5/potions.c, Revision 1.1

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

CVSweb