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

Annotation of early-roguelike/arogue7/eat.c, Revision 1.1.1.1

1.1       rubenllo    1: /*
                      2:  * eat.c  -  Functions for dealing with digestion
                      3:  *
                      4:  * Advanced Rogue
                      5:  * Copyright (C) 1984, 1985, 1986 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:  * eat:
                     20:  *     He wants to eat something, so let him try
                     21:  */
                     22:
                     23: void
                     24: eat(void)
                     25: {
                     26:     register struct linked_list *item;
                     27:     int which;
                     28:     unsigned long temp;
                     29:
                     30:     if (player.t_action != C_EAT) {
                     31:        if ((item = get_item(pack, "eat", FOOD, FALSE, FALSE)) == NULL)
                     32:            return;
                     33:
                     34:        player.t_using = item;  /* Remember what it is */
                     35:        player.t_action = C_EAT;        /* We are eating */
                     36:        which = (OBJPTR(item))->o_which;
                     37:        player.t_no_move = max(foods[which].mi_food/100, 1) * movement(&player);
                     38:        return;
                     39:     }
                     40:
                     41:     /* We have waited our time, let's eat the food */
                     42:     item = player.t_using;
                     43:     player.t_using = NULL;
                     44:     player.t_action = A_NIL;
                     45:
                     46:     which = (OBJPTR(item))->o_which;
                     47:     if ((food_left += foods[which].mi_food) > STOMACHSIZE)
                     48:        food_left = STOMACHSIZE;
                     49:     del_pack(item);
                     50:     if (hungry_state == F_SATIATED && food_left == STOMACHSIZE && rnd(4) == 1) {
                     51:        pstats.s_hpt = 0;
                     52:        msg ("You choke on all that food and die! -- More --");
                     53:        wait_for(' ');
                     54:        death(D_FOOD_CHOKE);
                     55:     }
                     56:     if (food_left >= STOMACHSIZE-MORETIME) {
                     57:        hungry_state = F_SATIATED;
                     58:        msg ("You have trouble getting all that food down.");
                     59:        msg ("Your stomach feels like its about to burst!");
                     60:     }
                     61:     else {
                     62:        hungry_state = F_OKAY;
                     63:        switch (rnd(3)) {
                     64:        case 0: msg("My, that was a yummy %s", foods[which].mi_name);
                     65:        when 1: msg("Mmmm, that was a tasty %s", foods[which].mi_name);
                     66:        when 2: msg("Wow, that was a scrumptious %s", foods[which].mi_name);
                     67:        }
                     68:     }
                     69:     updpack(TRUE, &player);
                     70:     switch(which) {
                     71:     case E_WHORTLEBERRY:
                     72:        add_abil[A_INTELLIGENCE](1);
                     73:
                     74:     when E_SWEETSOP:
                     75:        add_abil[A_DEXTERITY](1);
                     76:
                     77:     when E_SOURSOP:
                     78:        add_abil[A_STRENGTH](1);
                     79:
                     80:     when E_SAPODILLA:
                     81:        add_abil[A_WISDOM](1);
                     82:
                     83:     when E_RAMBUTAN:
                     84:        add_abil[A_CONSTITUTION](1);
                     85:
                     86:     when E_PEACH:
                     87:        add_abil[A_CHARISMA](1);
                     88:
                     89:     when E_STRAWBERRY:
                     90:        temp = pstats.s_exp/100;
                     91:        pstats.s_exp += temp;
                     92:        if (temp > 0)
                     93:            msg("You feel slightly more experienced now");
                     94:        check_level();
                     95:
                     96:     when E_PITANGA:
                     97:        max_stats.s_hpt++;
                     98:        pstats.s_hpt++;
                     99:        if (terse)
                    100:            msg("You feel a bit tougher now");
                    101:        else
                    102:            msg("You feel a bit tougher now. Go get 'em!");
                    103:
                    104:     when E_HAGBERRY:
                    105:        pstats.s_arm--;
                    106:        msg("Your skin feels more resilient now");
                    107:
                    108:     when E_DEWBERRY:
                    109:        if (chant_time > 0) {
                    110:            chant_time -= 50;
                    111:            if (chant_time < 0)
                    112:                chant_time = 0;
                    113:            msg("You feel you have more chant ability");
                    114:        }
                    115:        if (pray_time > 0) {
                    116:            pray_time -= 50;
                    117:            if (pray_time < 0)
                    118:                pray_time = 0;
                    119:            msg("You feel you have more prayer ability");
                    120:        }
                    121:        if (spell_power > 0) {
                    122:            spell_power -= 50;
                    123:            if (spell_power < 0)
                    124:                spell_power = 0;
                    125:            msg("You feel you have more spell casting ability");
                    126:        }
                    127:
                    128:     otherwise: /* all the foods don't have to do something */
                    129:        break;
                    130:     }
                    131: }

CVSweb