comparison arogue7/eat.c @ 125:adfa37e67084

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