Mercurial > hg > early-roguelike
comparison arogue7/potions.c @ 225:4f6e056438eb
Merge the GCC5 and build fix branches.
| author | John "Elwin" Edwards |
|---|---|
| date | Wed, 02 Mar 2016 21:28:34 -0500 |
| parents | f9ef86cf22b2 |
| children | e1cd27c5464f |
comparison
equal
deleted
inserted
replaced
| 224:4d0f53998e8a | 225:4f6e056438eb |
|---|---|
| 44 /* | 44 /* |
| 45 * Increase player's constitution | 45 * Increase player's constitution |
| 46 */ | 46 */ |
| 47 | 47 |
| 48 void | 48 void |
| 49 add_constitution(change) | 49 add_constitution(int change) |
| 50 int change; | |
| 51 { | 50 { |
| 52 /* Do the potion */ | 51 /* Do the potion */ |
| 53 if (change < 0) { | 52 if (change < 0) { |
| 54 msg("You feel less healthy now."); | 53 msg("You feel less healthy now."); |
| 55 pstats.s_const += change; | 54 pstats.s_const += change; |
| 69 /* | 68 /* |
| 70 * Increase player's charisma | 69 * Increase player's charisma |
| 71 */ | 70 */ |
| 72 | 71 |
| 73 void | 72 void |
| 74 add_charisma(change) | 73 add_charisma(int change) |
| 75 int change; | |
| 76 { | 74 { |
| 77 /* Do the potion */ | 75 /* Do the potion */ |
| 78 if (change < 0) msg("You feel less attractive now."); | 76 if (change < 0) msg("You feel less attractive now."); |
| 79 else msg("You feel more attractive now."); | 77 else msg("You feel more attractive now."); |
| 80 | 78 |
| 90 /* | 88 /* |
| 91 * Increase player's dexterity | 89 * Increase player's dexterity |
| 92 */ | 90 */ |
| 93 | 91 |
| 94 void | 92 void |
| 95 add_dexterity(change) | 93 add_dexterity(int change) |
| 96 int change; | |
| 97 { | 94 { |
| 98 int ring_str; /* Value of ring strengths */ | 95 int ring_str; /* Value of ring strengths */ |
| 99 | 96 |
| 100 /* Undo any ring changes */ | 97 /* Undo any ring changes */ |
| 101 ring_str = ring_value(R_ADDHIT); | 98 ring_str = ring_value(R_ADDHIT); |
| 121 /* | 118 /* |
| 122 * add_haste: | 119 * add_haste: |
| 123 * add a haste to the player | 120 * add a haste to the player |
| 124 */ | 121 */ |
| 125 | 122 |
| 126 add_haste(blessed) | 123 void |
| 127 bool blessed; | 124 add_haste(bool blessed) |
| 128 { | 125 { |
| 129 int hasttime; | 126 int hasttime; |
| 130 | 127 |
| 131 if (player.t_ctype == C_MONK) { /* monks cannot be slowed or hasted */ | 128 if (player.t_ctype == C_MONK) { /* monks cannot be slowed or hasted */ |
| 132 msg(nothing); | 129 msg(nothing); |
| 159 | 156 |
| 160 /* | 157 /* |
| 161 * Increase player's intelligence | 158 * Increase player's intelligence |
| 162 */ | 159 */ |
| 163 void | 160 void |
| 164 add_intelligence(change) | 161 add_intelligence(int change) |
| 165 int change; | |
| 166 { | 162 { |
| 167 int ring_str; /* Value of ring strengths */ | 163 int ring_str; /* Value of ring strengths */ |
| 168 | 164 |
| 169 /* Undo any ring changes */ | 165 /* Undo any ring changes */ |
| 170 ring_str = ring_value(R_ADDINTEL); | 166 ring_str = ring_value(R_ADDINTEL); |
| 188 } | 184 } |
| 189 | 185 |
| 190 /* | 186 /* |
| 191 * this routine makes the hero move slower | 187 * this routine makes the hero move slower |
| 192 */ | 188 */ |
| 193 add_slow() | 189 void |
| 190 add_slow(void) | |
| 194 { | 191 { |
| 195 /* monks cannot be slowed or hasted */ | 192 /* monks cannot be slowed or hasted */ |
| 196 if (player.t_ctype == C_MONK || ISWEARING(R_FREEDOM)) { | 193 if (player.t_ctype == C_MONK || ISWEARING(R_FREEDOM)) { |
| 197 msg(nothing); | 194 msg(nothing); |
| 198 return; | 195 return; |
| 217 /* | 214 /* |
| 218 * Increase player's strength | 215 * Increase player's strength |
| 219 */ | 216 */ |
| 220 | 217 |
| 221 void | 218 void |
| 222 add_strength(change) | 219 add_strength(int change) |
| 223 int change; | |
| 224 { | 220 { |
| 225 | 221 |
| 226 if (change < 0) { | 222 if (change < 0) { |
| 227 msg("You feel slightly weaker now."); | 223 msg("You feel slightly weaker now."); |
| 228 chg_str(change); | 224 chg_str(change); |
| 236 /* | 232 /* |
| 237 * Increase player's wisdom | 233 * Increase player's wisdom |
| 238 */ | 234 */ |
| 239 | 235 |
| 240 void | 236 void |
| 241 add_wisdom(change) | 237 add_wisdom(int change) |
| 242 int change; | |
| 243 { | 238 { |
| 244 int ring_str; /* Value of ring strengths */ | 239 int ring_str; /* Value of ring strengths */ |
| 245 | 240 |
| 246 /* Undo any ring changes */ | 241 /* Undo any ring changes */ |
| 247 ring_str = ring_value(R_ADDWISDOM); | 242 ring_str = ring_value(R_ADDWISDOM); |
| 262 /* Now put back the ring changes */ | 257 /* Now put back the ring changes */ |
| 263 if (ring_str) | 258 if (ring_str) |
| 264 pstats.s_wisdom += ring_str; | 259 pstats.s_wisdom += ring_str; |
| 265 } | 260 } |
| 266 | 261 |
| 267 quaff(which, kind, flags, is_potion) | 262 void |
| 268 int which; | 263 quaff(int which, int kind, int flags, bool is_potion) |
| 269 int kind; | |
| 270 int flags; | |
| 271 bool is_potion; | |
| 272 { | 264 { |
| 273 register struct object *obj; | 265 register struct object *obj; |
| 274 register struct linked_list *item, *titem; | 266 register struct linked_list *item, *titem; |
| 275 register struct thing *th; | 267 register struct thing *th; |
| 276 bool cursed, blessed; | 268 bool cursed, blessed; |
| 867 * Restore player's dexterity | 859 * Restore player's dexterity |
| 868 * if called with zero the restore fully | 860 * if called with zero the restore fully |
| 869 */ | 861 */ |
| 870 | 862 |
| 871 void | 863 void |
| 872 res_dexterity(howmuch) | 864 res_dexterity(int howmuch) |
| 873 int howmuch; | |
| 874 { | 865 { |
| 875 short save_max; | 866 short save_max; |
| 876 int ring_str; | 867 int ring_str; |
| 877 | 868 |
| 878 if (howmuch < 0) return; | 869 if (howmuch < 0) return; |
| 901 * res_intelligence: | 892 * res_intelligence: |
| 902 * Restore player's intelligence | 893 * Restore player's intelligence |
| 903 */ | 894 */ |
| 904 | 895 |
| 905 void | 896 void |
| 906 res_intelligence(howmuch) | 897 res_intelligence(int howmuch) |
| 907 int howmuch; | |
| 908 { | 898 { |
| 909 short save_max; | 899 short save_max; |
| 910 int ring_str; | 900 int ring_str; |
| 911 | 901 |
| 912 if (howmuch <= 0) return; | 902 if (howmuch <= 0) return; |
| 929 * res_wisdom: | 919 * res_wisdom: |
| 930 * Restore player's wisdom | 920 * Restore player's wisdom |
| 931 */ | 921 */ |
| 932 | 922 |
| 933 void | 923 void |
| 934 res_wisdom(howmuch) | 924 res_wisdom(int howmuch) |
| 935 int howmuch; | |
| 936 { | 925 { |
| 937 short save_max; | 926 short save_max; |
| 938 int ring_str; | 927 int ring_str; |
| 939 | 928 |
| 940 if (howmuch <= 0) return; | 929 if (howmuch <= 0) return; |
| 957 * res_constitution: | 946 * res_constitution: |
| 958 * Restore the players constitution. | 947 * Restore the players constitution. |
| 959 */ | 948 */ |
| 960 | 949 |
| 961 void | 950 void |
| 962 res_constitution(howmuch) | 951 res_constitution(int howmuch) |
| 963 int howmuch; | |
| 964 { | 952 { |
| 965 if (howmuch > 0) | 953 if (howmuch > 0) |
| 966 pstats.s_const = min(pstats.s_const + howmuch, max_stats.s_const); | 954 pstats.s_const = min(pstats.s_const + howmuch, max_stats.s_const); |
| 967 } | 955 } |
| 968 | 956 |
| 970 * res_charisma: | 958 * res_charisma: |
| 971 * Restore the players charisma. | 959 * Restore the players charisma. |
| 972 */ | 960 */ |
| 973 | 961 |
| 974 void | 962 void |
| 975 res_charisma(howmuch) | 963 res_charisma(int howmuch) |
| 976 int howmuch; | |
| 977 { | 964 { |
| 978 if (howmuch > 0) | 965 if (howmuch > 0) |
| 979 pstats.s_charisma = | 966 pstats.s_charisma = |
| 980 min(pstats.s_charisma + howmuch, max_stats.s_charisma); | 967 min(pstats.s_charisma + howmuch, max_stats.s_charisma); |
| 981 } | 968 } |
