Mercurial > hg > early-roguelike
comparison xrogue/potions.c @ 220:f54901b9c39b
XRogue: convert to ANSI-style function declarations.
author | John "Elwin" Edwards |
---|---|
date | Wed, 02 Mar 2016 21:13:26 -0500 |
parents | ce0cf824c192 |
children | b67b99f6c92b |
comparison
equal
deleted
inserted
replaced
219:f9ef86cf22b2 | 220:f54901b9c39b |
---|---|
18 | 18 |
19 #include <stdlib.h> | 19 #include <stdlib.h> |
20 #include <curses.h> | 20 #include <curses.h> |
21 #include "rogue.h" | 21 #include "rogue.h" |
22 | 22 |
23 int add_charisma(int change); | |
24 int add_constitution(int change); | |
25 int add_dexterity(int change); | |
26 int add_intelligence(int change); | |
27 int add_strength(int change); | |
28 int add_wisdom(int change); | |
29 | |
30 int res_charisma(int howmuch); | |
31 int res_constitution(int howmuch); | |
32 int res_dexterity(int howmuch); | |
33 int res_intelligence(int howmuch); | |
34 int res_wisdom(int howmuch); | |
35 | |
23 /* | 36 /* |
24 * add_abil is an array of functions used to change attributes. It must be | 37 * add_abil is an array of functions used to change attributes. It must be |
25 * ordered according to the attribute definitions in rogue.h. | 38 * ordered according to the attribute definitions in rogue.h. |
26 */ | 39 */ |
27 | 40 |
43 /* | 56 /* |
44 * Increase player's constitution | 57 * Increase player's constitution |
45 */ | 58 */ |
46 | 59 |
47 int | 60 int |
48 add_constitution(change) | 61 add_constitution(int change) |
49 int change; | |
50 { | 62 { |
51 /* Do the potion */ | 63 /* Do the potion */ |
52 if (change < 0) { | 64 if (change < 0) { |
53 msg("You feel less healthy now."); | 65 msg("You feel less healthy now."); |
54 pstats.s_const += change; | 66 pstats.s_const += change; |
74 /* | 86 /* |
75 * Increase player's charisma | 87 * Increase player's charisma |
76 */ | 88 */ |
77 | 89 |
78 int | 90 int |
79 add_charisma(change) | 91 add_charisma(int change) |
80 int change; | |
81 { | 92 { |
82 /* Do the potion */ | 93 /* Do the potion */ |
83 if (change < 0) msg("You feel less attractive now."); | 94 if (change < 0) msg("You feel less attractive now."); |
84 else msg("You feel more attractive now."); | 95 else msg("You feel more attractive now."); |
85 | 96 |
97 /* | 108 /* |
98 * Increase player's dexterity | 109 * Increase player's dexterity |
99 */ | 110 */ |
100 | 111 |
101 int | 112 int |
102 add_dexterity(change) | 113 add_dexterity(int change) |
103 int change; | |
104 { | 114 { |
105 int ring_str; /* Value of ring strengths */ | 115 int ring_str; /* Value of ring strengths */ |
106 | 116 |
107 /* Undo any ring changes */ | 117 /* Undo any ring changes */ |
108 ring_str = ring_value(R_ADDHIT); | 118 ring_str = ring_value(R_ADDHIT); |
130 /* | 140 /* |
131 * add_haste: | 141 * add_haste: |
132 * add a haste to the player | 142 * add a haste to the player |
133 */ | 143 */ |
134 | 144 |
135 add_haste(blessed) | 145 void |
136 bool blessed; | 146 add_haste(bool blessed) |
137 { | 147 { |
138 int hasttime; | 148 int hasttime; |
139 | 149 |
140 if (player.t_ctype == C_MONK) { /* monks cannot be slowed or hasted */ | 150 if (player.t_ctype == C_MONK) { /* monks cannot be slowed or hasted */ |
141 msg(nothing); | 151 msg(nothing); |
169 /* | 179 /* |
170 * Increase player's intelligence | 180 * Increase player's intelligence |
171 */ | 181 */ |
172 | 182 |
173 int | 183 int |
174 add_intelligence(change) | 184 add_intelligence(int change) |
175 int change; | |
176 { | 185 { |
177 int ring_str; /* Value of ring strengths */ | 186 int ring_str; /* Value of ring strengths */ |
178 | 187 |
179 /* Undo any ring changes */ | 188 /* Undo any ring changes */ |
180 ring_str = ring_value(R_ADDINTEL); | 189 ring_str = ring_value(R_ADDINTEL); |
201 | 210 |
202 /* | 211 /* |
203 * this routine makes the hero move slower | 212 * this routine makes the hero move slower |
204 */ | 213 */ |
205 | 214 |
206 add_slow() | 215 void |
216 add_slow(void) | |
207 { | 217 { |
208 /* monks cannot be slowed or hasted */ | 218 /* monks cannot be slowed or hasted */ |
209 if (player.t_ctype == C_MONK || ISWEARING(R_FREEDOM)) { | 219 if (player.t_ctype == C_MONK || ISWEARING(R_FREEDOM)) { |
210 msg(nothing); | 220 msg(nothing); |
211 return; | 221 return; |
230 /* | 240 /* |
231 * Increase player's strength | 241 * Increase player's strength |
232 */ | 242 */ |
233 | 243 |
234 int | 244 int |
235 add_strength(change) | 245 add_strength(int change) |
236 int change; | |
237 { | 246 { |
238 | 247 |
239 if (change < 0) { | 248 if (change < 0) { |
240 msg("You feel slightly weaker now."); | 249 msg("You feel slightly weaker now."); |
241 chg_str(change); | 250 chg_str(change); |
250 /* | 259 /* |
251 * Increase player's wisdom | 260 * Increase player's wisdom |
252 */ | 261 */ |
253 | 262 |
254 int | 263 int |
255 add_wisdom(change) | 264 add_wisdom(int change) |
256 int change; | |
257 { | 265 { |
258 int ring_str; /* Value of ring strengths */ | 266 int ring_str; /* Value of ring strengths */ |
259 | 267 |
260 /* Undo any ring changes */ | 268 /* Undo any ring changes */ |
261 ring_str = ring_value(R_ADDWISDOM); | 269 ring_str = ring_value(R_ADDWISDOM); |
278 pstats.s_wisdom += ring_str; | 286 pstats.s_wisdom += ring_str; |
279 | 287 |
280 return(0); | 288 return(0); |
281 } | 289 } |
282 | 290 |
283 quaff(which, kind, flags, is_potion) | 291 void |
284 int which; | 292 quaff(int which, int kind, int flags, bool is_potion) |
285 int kind; | |
286 int flags; | |
287 bool is_potion; | |
288 { | 293 { |
289 register struct object *obj; | 294 register struct object *obj; |
290 register struct linked_list *item, *titem; | 295 register struct linked_list *item, *titem; |
291 register struct thing *th; | 296 register struct thing *th; |
292 bool cursed, blessed; | 297 bool cursed, blessed; |
585 else { | 590 else { |
586 msg("You suddenly feel %smore skillful", | 591 msg("You suddenly feel %smore skillful", |
587 blessed ? "much " : ""); | 592 blessed ? "much " : ""); |
588 p_know[P_RAISE] = TRUE; | 593 p_know[P_RAISE] = TRUE; |
589 raise_level(); | 594 raise_level(); |
590 do_panic(NULL); /* this startles them */ | 595 do_panic(0); /* this startles them */ |
591 if (blessed) raise_level(); | 596 if (blessed) raise_level(); |
592 } | 597 } |
593 when P_HASTE: | 598 when P_HASTE: |
594 if (cursed) { /* Slow player down */ | 599 if (cursed) { /* Slow player down */ |
595 add_slow(); | 600 add_slow(); |
939 * Restore player's dexterity | 944 * Restore player's dexterity |
940 * if called with zero the restore fully | 945 * if called with zero the restore fully |
941 */ | 946 */ |
942 | 947 |
943 int | 948 int |
944 res_dexterity(howmuch) | 949 res_dexterity(int howmuch) |
945 int howmuch; | |
946 { | 950 { |
947 short save_max; | 951 short save_max; |
948 int ring_str; | 952 int ring_str; |
949 | 953 |
950 if (howmuch < 0) return(0); | 954 if (howmuch < 0) return(0); |
973 * res_intelligence: | 977 * res_intelligence: |
974 * Restore player's intelligence | 978 * Restore player's intelligence |
975 */ | 979 */ |
976 | 980 |
977 int | 981 int |
978 res_intelligence(howmuch) | 982 res_intelligence(int howmuch) |
979 int howmuch; | |
980 { | 983 { |
981 short save_max; | 984 short save_max; |
982 int ring_str; | 985 int ring_str; |
983 | 986 |
984 if (howmuch <= 0) return(0); | 987 if (howmuch <= 0) return(0); |
1002 * res_wisdom: | 1005 * res_wisdom: |
1003 * Restore player's wisdom | 1006 * Restore player's wisdom |
1004 */ | 1007 */ |
1005 | 1008 |
1006 int | 1009 int |
1007 res_wisdom(howmuch) | 1010 res_wisdom(int howmuch) |
1008 int howmuch; | |
1009 { | 1011 { |
1010 short save_max; | 1012 short save_max; |
1011 int ring_str; | 1013 int ring_str; |
1012 | 1014 |
1013 if (howmuch <= 0) return(0); | 1015 if (howmuch <= 0) return(0); |
1031 * res_constitution: | 1033 * res_constitution: |
1032 * Restore the players constitution. | 1034 * Restore the players constitution. |
1033 */ | 1035 */ |
1034 | 1036 |
1035 int | 1037 int |
1036 res_constitution(howmuch) | 1038 res_constitution(int howmuch) |
1037 int howmuch; | |
1038 { | 1039 { |
1039 if (howmuch > 0) | 1040 if (howmuch > 0) |
1040 pstats.s_const = min(pstats.s_const + howmuch, max_stats.s_const); | 1041 pstats.s_const = min(pstats.s_const + howmuch, max_stats.s_const); |
1041 | 1042 |
1042 return(0); | 1043 return(0); |
1046 * res_charisma: | 1047 * res_charisma: |
1047 * Restore the players charisma. | 1048 * Restore the players charisma. |
1048 */ | 1049 */ |
1049 | 1050 |
1050 int | 1051 int |
1051 res_charisma(howmuch) | 1052 res_charisma(int howmuch) |
1052 int howmuch; | |
1053 { | 1053 { |
1054 if (howmuch > 0) | 1054 if (howmuch > 0) |
1055 pstats.s_charisma = | 1055 pstats.s_charisma = |
1056 min(pstats.s_charisma + howmuch, max_stats.s_charisma); | 1056 min(pstats.s_charisma + howmuch, max_stats.s_charisma); |
1057 | 1057 |