Mercurial > hg > early-roguelike
comparison xrogue/eat.c @ 142:6b5fbd7c3ece
Merge arogue7 and xrogue trees.
| author | John "Elwin" Edwards |
|---|---|
| date | Tue, 12 May 2015 21:39:39 -0400 |
| parents | e6179860cb76 |
| children | f54901b9c39b |
comparison
equal
deleted
inserted
replaced
| 132:66b0263af424 | 142:6b5fbd7c3ece |
|---|---|
| 1 /* | |
| 2 eat.c - Functions for dealing with digestion | |
| 3 | |
| 4 XRogue: Expeditions into the Dungeons of Doom | |
| 5 Copyright (C) 1991 Robert Pietkivitch | |
| 6 All rights reserved. | |
| 7 | |
| 8 Based on "Advanced Rogue" | |
| 9 Copyright (C) 1984, 1985 Michael Morgan, Ken Dalka and AT&T | |
| 10 All rights reserved. | |
| 11 | |
| 12 Based on "Rogue: Exploring the Dungeons of Doom" | |
| 13 Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman | |
| 14 All rights reserved. | |
| 15 | |
| 16 See the file LICENSE.TXT for full copyright and licensing information. | |
| 17 */ | |
| 18 | |
| 19 #include <curses.h> | |
| 20 #include "rogue.h" | |
| 21 | |
| 22 /* | |
| 23 * eat: | |
| 24 * He wants to eat something, so let him try | |
| 25 */ | |
| 26 | |
| 27 eat() | |
| 28 { | |
| 29 register struct linked_list *item; | |
| 30 int which; | |
| 31 unsigned long temp; | |
| 32 | |
| 33 if (player.t_action != C_EAT) { | |
| 34 if ((item = get_item(pack, "eat", FOOD, FALSE, FALSE)) == NULL) | |
| 35 return; | |
| 36 | |
| 37 player.t_using = item; /* Remember what it is */ | |
| 38 player.t_action = C_EAT; /* We are eating */ | |
| 39 which = (OBJPTR(item))->o_which; | |
| 40 player.t_no_move = max(foods[which].mi_food/100, 1) * movement(&player); | |
| 41 return; | |
| 42 } | |
| 43 | |
| 44 /* We have waited our time, let's eat the food */ | |
| 45 item = player.t_using; | |
| 46 player.t_using = NULL; | |
| 47 player.t_action = A_NIL; | |
| 48 | |
| 49 which = (OBJPTR(item))->o_which; | |
| 50 if ((food_left += foods[which].mi_food) > STOMACHSIZE) | |
| 51 food_left = STOMACHSIZE; | |
| 52 del_pack(item); | |
| 53 if (hungry_state == F_SATIATED && food_left == STOMACHSIZE && rnd(4) == 1) { | |
| 54 pstats.s_hpt = -1; | |
| 55 msg ("Cough! Ack! You choke on all that food and die! --More--"); | |
| 56 wait_for(' '); | |
| 57 death(D_FOOD_CHOKE); | |
| 58 } | |
| 59 if (food_left >= STOMACHSIZE-MORETIME) { | |
| 60 hungry_state = F_SATIATED; | |
| 61 msg ("You have trouble getting that food down!"); | |
| 62 msg ("Your stomach feels like it's about to burst!"); | |
| 63 } | |
| 64 else if (which != E_SLIMEMOLD) { | |
| 65 hungry_state = F_OKAY; | |
| 66 switch (rnd(10)) { | |
| 67 case 0: msg("Yuck, what a foul tasting %s! ", foods[which].mi_name); | |
| 68 when 1: msg("Mmmm, what a tasty %s. ", foods[which].mi_name); | |
| 69 when 2: msg("Wow, what a scrumptious %s! ", foods[which].mi_name); | |
| 70 when 3: msg("Hmmm, %s heaven! ", foods[which].mi_name); | |
| 71 when 4: msg("You've eaten better %s. ", foods[which].mi_name); | |
| 72 when 5: msg("You smack your lips "); | |
| 73 when 6: msg("Yum-yum-yum "); | |
| 74 when 7: msg("Gulp! "); | |
| 75 when 8: msg("Your tongue flips out! "); | |
| 76 when 9: msg("You lick your chin "); | |
| 77 } | |
| 78 } | |
| 79 updpack(TRUE, &player); | |
| 80 switch(which) { | |
| 81 case E_WHORTLEBERRY: /* add 1 to intelligence */ | |
| 82 (*add_abil[A_INTELLIGENCE])(1); | |
| 83 when E_SWEETSOP: /* add 1 to strength */ | |
| 84 case E_SOURSOP: /* add 1 to strength */ | |
| 85 (*add_abil[A_STRENGTH])(1); | |
| 86 when E_SAPODILLA: /* add 1 to wisdom */ | |
| 87 (*add_abil[A_WISDOM])(1); | |
| 88 when E_APPLE: /* add 1 to dexterity */ | |
| 89 (*add_abil[A_DEXTERITY])(1); | |
| 90 when E_PRICKLEY: /* add 1 to constitution */ | |
| 91 (*add_abil[A_CONSTITUTION])(1); | |
| 92 when E_PEACH: /* add 1 to charisma */ | |
| 93 (*add_abil[A_CHARISMA])(1); | |
| 94 when E_PITANGA: /* add 1 hit point */ | |
| 95 max_stats.s_hpt++; | |
| 96 pstats.s_hpt = max_stats.s_hpt; | |
| 97 msg("You feel a bit tougher now. "); | |
| 98 when E_HAGBERRY: /* armor class */ | |
| 99 case E_JABOTICABA: /* armor class */ | |
| 100 pstats.s_arm--; | |
| 101 msg("Your skin feels more resilient now. "); | |
| 102 when E_STRAWBERRY: /* add 10% experience points */ | |
| 103 case E_RAMBUTAN: /* add 10% experience points */ | |
| 104 temp = pstats.s_exp/100 + 10; | |
| 105 pstats.s_exp += temp; | |
| 106 msg("You feel slightly more experienced now. "); | |
| 107 check_level(); | |
| 108 when E_DEWBERRY: /* encourage him to do more magic */ | |
| 109 if (chant_time > 0) { | |
| 110 chant_time -= 80; | |
| 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 -= 80; | |
| 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 -= 80; | |
| 123 if (spell_power < 0) | |
| 124 spell_power = 0; | |
| 125 msg("You feel you have more spell casting ability. "); | |
| 126 } | |
| 127 when E_CANDLEBERRY: /* cure him */ | |
| 128 if (on(player, HASINFEST) || | |
| 129 on(player, HASDISEASE)|| | |
| 130 on(player, DOROT)) { | |
| 131 if (on(player, HASDISEASE)) { | |
| 132 extinguish(cure_disease); | |
| 133 cure_disease(); | |
| 134 } | |
| 135 if (on(player, HASINFEST)) { | |
| 136 msg("You feel yourself improving. "); | |
| 137 turn_off(player, HASINFEST); | |
| 138 infest_dam = 0; | |
| 139 } | |
| 140 if (on(player, DOROT)) { | |
| 141 msg("You feel your skin returning to normal. "); | |
| 142 turn_off(player, DOROT); | |
| 143 } | |
| 144 } | |
| 145 when E_SLIMEMOLD: /* monster food */ | |
| 146 msg("The slime-mold quivers around in your mouth. "); | |
| 147 player.t_no_move = 3*movement(&player); | |
| 148 if (off(player, HASDISEASE)) { | |
| 149 if (ISWEARING(R_HEALTH) || player.t_ctype == C_PALADIN || | |
| 150 player.t_ctype == C_RANGER) { | |
| 151 msg("You feel lousy. "); | |
| 152 } | |
| 153 else { | |
| 154 turn_on(player, HASDISEASE); | |
| 155 fuse(cure_disease, (VOID *)NULL, roll(HEALTIME,SICKTIME),AFTER); | |
| 156 msg("You become ill. "); | |
| 157 } | |
| 158 } | |
| 159 pstats.s_const -= rnd(2)+1; | |
| 160 if (pstats.s_const <= 3) pstats.s_const = 3; | |
| 161 | |
| 162 otherwise: /* not all the foods have to do something */ | |
| 163 break; | |
| 164 } | |
| 165 } | |
| 166 |
