変愚蛮怒のメインリポジトリです
Revision | 523b83723be272221cc130ba984b2054683f43c7 (tree) |
---|---|
Time | 2019-01-22 00:02:24 |
Author | Deskull <deskull@user...> |
Commiter | Deskull |
[Refactor] #37353 view-mainwindow.c から player-status.cへ移動。 / Move functions of view-mainwindow.c to player-status.c.
@@ -1,5 +1,7 @@ | ||
1 | 1 | #include "angband.h" |
2 | +#include "artifact.h" | |
2 | 3 | #include "player-status.h" |
4 | +#include "avatar.h" | |
3 | 5 | |
4 | 6 | /* |
5 | 7 | * Return alignment title |
@@ -54,3 +56,3759 @@ int spell_exp_level(int spell_exp) | ||
54 | 56 | else return EXP_LEVEL_MASTER; |
55 | 57 | } |
56 | 58 | |
59 | +/*! | |
60 | + * @brief プレイヤーの全ステータスを更新する / | |
61 | + * Calculate the players current "state", taking into account | |
62 | + * not only race/class intrinsics, but also objects being worn | |
63 | + * and temporary spell effects. | |
64 | + * @return なし | |
65 | + * @details | |
66 | + * <pre> | |
67 | + * See also calc_mana() and calc_hitpoints(). | |
68 | + * | |
69 | + * Take note of the new "speed code", in particular, a very strong | |
70 | + * player will start slowing down as soon as he reaches 150 pounds, | |
71 | + * but not until he reaches 450 pounds will he be half as fast as | |
72 | + * a normal kobold. This both hurts and helps the player, hurts | |
73 | + * because in the old days a player could just avoid 300 pounds, | |
74 | + * and helps because now carrying 300 pounds is not very painful. | |
75 | + * | |
76 | + * The "weapon" and "bow" do *not* add to the bonuses to hit or to | |
77 | + * damage, since that would affect non-combat things. These values | |
78 | + * are actually added in later, at the appropriate place. | |
79 | + * | |
80 | + * This function induces various "status" messages. | |
81 | + * </pre> | |
82 | + */ | |
83 | +void calc_bonuses(void) | |
84 | +{ | |
85 | + int i, j, hold, neutral[2]; | |
86 | + int new_speed; | |
87 | + int default_hand = 0; | |
88 | + int empty_hands_status = empty_hands(TRUE); | |
89 | + int extra_blows[2]; | |
90 | + object_type *o_ptr; | |
91 | + BIT_FLAGS flgs[TR_FLAG_SIZE]; | |
92 | + bool omoi = FALSE; | |
93 | + bool yoiyami = FALSE; | |
94 | + bool down_saving = FALSE; | |
95 | +#if 0 | |
96 | + bool have_dd_s = FALSE, have_dd_t = FALSE; | |
97 | +#endif | |
98 | + bool have_sw = FALSE, have_kabe = FALSE; | |
99 | + bool easy_2weapon = FALSE; | |
100 | + bool riding_levitation = FALSE; | |
101 | + OBJECT_IDX this_o_idx, next_o_idx = 0; | |
102 | + const player_race *tmp_rp_ptr; | |
103 | + | |
104 | + /* Save the old vision stuff */ | |
105 | + bool old_telepathy = p_ptr->telepathy; | |
106 | + bool old_esp_animal = p_ptr->esp_animal; | |
107 | + bool old_esp_undead = p_ptr->esp_undead; | |
108 | + bool old_esp_demon = p_ptr->esp_demon; | |
109 | + bool old_esp_orc = p_ptr->esp_orc; | |
110 | + bool old_esp_troll = p_ptr->esp_troll; | |
111 | + bool old_esp_giant = p_ptr->esp_giant; | |
112 | + bool old_esp_dragon = p_ptr->esp_dragon; | |
113 | + bool old_esp_human = p_ptr->esp_human; | |
114 | + bool old_esp_evil = p_ptr->esp_evil; | |
115 | + bool old_esp_good = p_ptr->esp_good; | |
116 | + bool old_esp_nonliving = p_ptr->esp_nonliving; | |
117 | + bool old_esp_unique = p_ptr->esp_unique; | |
118 | + bool old_see_inv = p_ptr->see_inv; | |
119 | + bool old_mighty_throw = p_ptr->mighty_throw; | |
120 | + | |
121 | + /* Current feature under player. */ | |
122 | + feature_type *f_ptr = &f_info[cave[p_ptr->y][p_ptr->x].feat]; | |
123 | + | |
124 | + /* Save the old armor class */ | |
125 | + ARMOUR_CLASS old_dis_ac = p_ptr->dis_ac; | |
126 | + ARMOUR_CLASS old_dis_to_a = p_ptr->dis_to_a; | |
127 | + | |
128 | + | |
129 | + /* Clear extra blows/shots */ | |
130 | + extra_blows[0] = extra_blows[1] = 0; | |
131 | + | |
132 | + /* Clear the stat modifiers */ | |
133 | + for (i = 0; i < A_MAX; i++) p_ptr->stat_add[i] = 0; | |
134 | + | |
135 | + | |
136 | + /* Clear the Displayed/Real armor class */ | |
137 | + p_ptr->dis_ac = p_ptr->ac = 0; | |
138 | + | |
139 | + /* Clear the Displayed/Real Bonuses */ | |
140 | + p_ptr->dis_to_h[0] = p_ptr->to_h[0] = 0; | |
141 | + p_ptr->dis_to_h[1] = p_ptr->to_h[1] = 0; | |
142 | + p_ptr->dis_to_d[0] = p_ptr->to_d[0] = 0; | |
143 | + p_ptr->dis_to_d[1] = p_ptr->to_d[1] = 0; | |
144 | + p_ptr->dis_to_h_b = p_ptr->to_h_b = 0; | |
145 | + p_ptr->dis_to_a = p_ptr->to_a = 0; | |
146 | + p_ptr->to_h_m = 0; | |
147 | + p_ptr->to_d_m = 0; | |
148 | + | |
149 | + p_ptr->to_m_chance = 0; | |
150 | + | |
151 | + /* Clear the Extra Dice Bonuses */ | |
152 | + p_ptr->to_dd[0] = p_ptr->to_ds[0] = 0; | |
153 | + p_ptr->to_dd[1] = p_ptr->to_ds[1] = 0; | |
154 | + | |
155 | + /* Start with "normal" speed */ | |
156 | + new_speed = 110; | |
157 | + | |
158 | + /* Start with a single blow per turn */ | |
159 | + p_ptr->num_blow[0] = 1; | |
160 | + p_ptr->num_blow[1] = 1; | |
161 | + | |
162 | + /* Start with a single shot per turn */ | |
163 | + p_ptr->num_fire = 100; | |
164 | + | |
165 | + /* Reset the "xtra" tval */ | |
166 | + p_ptr->tval_xtra = 0; | |
167 | + | |
168 | + /* Reset the "ammo" tval */ | |
169 | + p_ptr->tval_ammo = 0; | |
170 | + | |
171 | + /* Clear all the flags */ | |
172 | + p_ptr->cursed = 0L; | |
173 | + p_ptr->bless_blade = FALSE; | |
174 | + p_ptr->xtra_might = FALSE; | |
175 | + p_ptr->impact[0] = FALSE; | |
176 | + p_ptr->impact[1] = FALSE; | |
177 | + p_ptr->pass_wall = FALSE; | |
178 | + p_ptr->kill_wall = FALSE; | |
179 | + p_ptr->dec_mana = FALSE; | |
180 | + p_ptr->easy_spell = FALSE; | |
181 | + p_ptr->heavy_spell = FALSE; | |
182 | + p_ptr->see_inv = FALSE; | |
183 | + p_ptr->free_act = FALSE; | |
184 | + p_ptr->slow_digest = FALSE; | |
185 | + p_ptr->regenerate = FALSE; | |
186 | + p_ptr->can_swim = FALSE; | |
187 | + p_ptr->levitation = FALSE; | |
188 | + p_ptr->hold_exp = FALSE; | |
189 | + p_ptr->telepathy = FALSE; | |
190 | + p_ptr->esp_animal = FALSE; | |
191 | + p_ptr->esp_undead = FALSE; | |
192 | + p_ptr->esp_demon = FALSE; | |
193 | + p_ptr->esp_orc = FALSE; | |
194 | + p_ptr->esp_troll = FALSE; | |
195 | + p_ptr->esp_giant = FALSE; | |
196 | + p_ptr->esp_dragon = FALSE; | |
197 | + p_ptr->esp_human = FALSE; | |
198 | + p_ptr->esp_evil = FALSE; | |
199 | + p_ptr->esp_good = FALSE; | |
200 | + p_ptr->esp_nonliving = FALSE; | |
201 | + p_ptr->esp_unique = FALSE; | |
202 | + p_ptr->lite = FALSE; | |
203 | + p_ptr->sustain_str = FALSE; | |
204 | + p_ptr->sustain_int = FALSE; | |
205 | + p_ptr->sustain_wis = FALSE; | |
206 | + p_ptr->sustain_con = FALSE; | |
207 | + p_ptr->sustain_dex = FALSE; | |
208 | + p_ptr->sustain_chr = FALSE; | |
209 | + p_ptr->resist_acid = FALSE; | |
210 | + p_ptr->resist_elec = FALSE; | |
211 | + p_ptr->resist_fire = FALSE; | |
212 | + p_ptr->resist_cold = FALSE; | |
213 | + p_ptr->resist_pois = FALSE; | |
214 | + p_ptr->resist_conf = FALSE; | |
215 | + p_ptr->resist_sound = FALSE; | |
216 | + p_ptr->resist_lite = FALSE; | |
217 | + p_ptr->resist_dark = FALSE; | |
218 | + p_ptr->resist_chaos = FALSE; | |
219 | + p_ptr->resist_disen = FALSE; | |
220 | + p_ptr->resist_shard = FALSE; | |
221 | + p_ptr->resist_nexus = FALSE; | |
222 | + p_ptr->resist_blind = FALSE; | |
223 | + p_ptr->resist_neth = FALSE; | |
224 | + p_ptr->resist_time = FALSE; | |
225 | + p_ptr->resist_water = FALSE; | |
226 | + p_ptr->resist_fear = FALSE; | |
227 | + p_ptr->reflect = FALSE; | |
228 | + p_ptr->sh_fire = FALSE; | |
229 | + p_ptr->sh_elec = FALSE; | |
230 | + p_ptr->sh_cold = FALSE; | |
231 | + p_ptr->anti_magic = FALSE; | |
232 | + p_ptr->anti_tele = FALSE; | |
233 | + p_ptr->warning = FALSE; | |
234 | + p_ptr->mighty_throw = FALSE; | |
235 | + p_ptr->see_nocto = FALSE; | |
236 | + | |
237 | + p_ptr->immune_acid = FALSE; | |
238 | + p_ptr->immune_elec = FALSE; | |
239 | + p_ptr->immune_fire = FALSE; | |
240 | + p_ptr->immune_cold = FALSE; | |
241 | + | |
242 | + p_ptr->ryoute = FALSE; | |
243 | + p_ptr->migite = FALSE; | |
244 | + p_ptr->hidarite = FALSE; | |
245 | + p_ptr->no_flowed = FALSE; | |
246 | + | |
247 | + p_ptr->align = friend_align; | |
248 | + | |
249 | + if (p_ptr->mimic_form) tmp_rp_ptr = &mimic_info[p_ptr->mimic_form]; | |
250 | + else tmp_rp_ptr = &race_info[p_ptr->prace]; | |
251 | + | |
252 | + /* Base infravision (purely racial) */ | |
253 | + p_ptr->see_infra = tmp_rp_ptr->infra; | |
254 | + | |
255 | + /* Base skill -- disarming */ | |
256 | + p_ptr->skill_dis = tmp_rp_ptr->r_dis + cp_ptr->c_dis + ap_ptr->a_dis; | |
257 | + | |
258 | + /* Base skill -- magic devices */ | |
259 | + p_ptr->skill_dev = tmp_rp_ptr->r_dev + cp_ptr->c_dev + ap_ptr->a_dev; | |
260 | + | |
261 | + /* Base skill -- saving throw */ | |
262 | + p_ptr->skill_sav = tmp_rp_ptr->r_sav + cp_ptr->c_sav + ap_ptr->a_sav; | |
263 | + | |
264 | + /* Base skill -- stealth */ | |
265 | + p_ptr->skill_stl = tmp_rp_ptr->r_stl + cp_ptr->c_stl + ap_ptr->a_stl; | |
266 | + | |
267 | + /* Base skill -- searching ability */ | |
268 | + p_ptr->skill_srh = tmp_rp_ptr->r_srh + cp_ptr->c_srh + ap_ptr->a_srh; | |
269 | + | |
270 | + /* Base skill -- searching frequency */ | |
271 | + p_ptr->skill_fos = tmp_rp_ptr->r_fos + cp_ptr->c_fos + ap_ptr->a_fos; | |
272 | + | |
273 | + /* Base skill -- combat (normal) */ | |
274 | + p_ptr->skill_thn = tmp_rp_ptr->r_thn + cp_ptr->c_thn + ap_ptr->a_thn; | |
275 | + | |
276 | + /* Base skill -- combat (shooting) */ | |
277 | + p_ptr->skill_thb = tmp_rp_ptr->r_thb + cp_ptr->c_thb + ap_ptr->a_thb; | |
278 | + | |
279 | + /* Base skill -- combat (throwing) */ | |
280 | + p_ptr->skill_tht = tmp_rp_ptr->r_thb + cp_ptr->c_thb + ap_ptr->a_thb; | |
281 | + | |
282 | + /* Base skill -- digging */ | |
283 | + p_ptr->skill_dig = 0; | |
284 | + | |
285 | + if (buki_motteruka(INVEN_RARM)) p_ptr->migite = TRUE; | |
286 | + if (buki_motteruka(INVEN_LARM)) | |
287 | + { | |
288 | + p_ptr->hidarite = TRUE; | |
289 | + if (!p_ptr->migite) default_hand = 1; | |
290 | + } | |
291 | + | |
292 | + if (CAN_TWO_HANDS_WIELDING()) | |
293 | + { | |
294 | + if (p_ptr->migite && (empty_hands(FALSE) == EMPTY_HAND_LARM) && | |
295 | + object_allow_two_hands_wielding(&inventory[INVEN_RARM])) | |
296 | + { | |
297 | + p_ptr->ryoute = TRUE; | |
298 | + } | |
299 | + else if (p_ptr->hidarite && (empty_hands(FALSE) == EMPTY_HAND_RARM) && | |
300 | + object_allow_two_hands_wielding(&inventory[INVEN_LARM])) | |
301 | + { | |
302 | + p_ptr->ryoute = TRUE; | |
303 | + } | |
304 | + else | |
305 | + { | |
306 | + switch (p_ptr->pclass) | |
307 | + { | |
308 | + case CLASS_MONK: | |
309 | + case CLASS_FORCETRAINER: | |
310 | + case CLASS_BERSERKER: | |
311 | + if (empty_hands(FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM)) | |
312 | + { | |
313 | + p_ptr->migite = TRUE; | |
314 | + p_ptr->ryoute = TRUE; | |
315 | + } | |
316 | + break; | |
317 | + } | |
318 | + } | |
319 | + } | |
320 | + | |
321 | + if (!p_ptr->migite && !p_ptr->hidarite) | |
322 | + { | |
323 | + if (empty_hands_status & EMPTY_HAND_RARM) p_ptr->migite = TRUE; | |
324 | + else if (empty_hands_status == EMPTY_HAND_LARM) | |
325 | + { | |
326 | + p_ptr->hidarite = TRUE; | |
327 | + default_hand = 1; | |
328 | + } | |
329 | + } | |
330 | + | |
331 | + if (p_ptr->special_defense & KAMAE_MASK) | |
332 | + { | |
333 | + if (!(empty_hands_status & EMPTY_HAND_RARM)) | |
334 | + { | |
335 | + set_action(ACTION_NONE); | |
336 | + } | |
337 | + } | |
338 | + | |
339 | + switch (p_ptr->pclass) | |
340 | + { | |
341 | + case CLASS_WARRIOR: | |
342 | + if (p_ptr->lev > 29) p_ptr->resist_fear = TRUE; | |
343 | + if (p_ptr->lev > 44) p_ptr->regenerate = TRUE; | |
344 | + break; | |
345 | + case CLASS_PALADIN: | |
346 | + if (p_ptr->lev > 39) p_ptr->resist_fear = TRUE; | |
347 | + break; | |
348 | + case CLASS_CHAOS_WARRIOR: | |
349 | + if (p_ptr->lev > 29) p_ptr->resist_chaos = TRUE; | |
350 | + if (p_ptr->lev > 39) p_ptr->resist_fear = TRUE; | |
351 | + break; | |
352 | + case CLASS_MINDCRAFTER: | |
353 | + if (p_ptr->lev > 9) p_ptr->resist_fear = TRUE; | |
354 | + if (p_ptr->lev > 19) p_ptr->sustain_wis = TRUE; | |
355 | + if (p_ptr->lev > 29) p_ptr->resist_conf = TRUE; | |
356 | + if (p_ptr->lev > 39) p_ptr->telepathy = TRUE; | |
357 | + break; | |
358 | + case CLASS_MONK: | |
359 | + case CLASS_FORCETRAINER: | |
360 | + /* Unencumbered Monks become faster every 10 levels */ | |
361 | + if (!(heavy_armor())) | |
362 | + { | |
363 | + if (!(prace_is_(RACE_KLACKON) || | |
364 | + prace_is_(RACE_SPRITE) || | |
365 | + (p_ptr->pseikaku == SEIKAKU_MUNCHKIN))) | |
366 | + new_speed += (p_ptr->lev) / 10; | |
367 | + | |
368 | + /* Free action if unencumbered at level 25 */ | |
369 | + if (p_ptr->lev > 24) | |
370 | + p_ptr->free_act = TRUE; | |
371 | + } | |
372 | + break; | |
373 | + case CLASS_SORCERER: | |
374 | + p_ptr->to_a -= 50; | |
375 | + p_ptr->dis_to_a -= 50; | |
376 | + break; | |
377 | + case CLASS_BARD: | |
378 | + p_ptr->resist_sound = TRUE; | |
379 | + break; | |
380 | + case CLASS_SAMURAI: | |
381 | + if (p_ptr->lev > 29) p_ptr->resist_fear = TRUE; | |
382 | + break; | |
383 | + case CLASS_BERSERKER: | |
384 | + p_ptr->shero = 1; | |
385 | + p_ptr->sustain_str = TRUE; | |
386 | + p_ptr->sustain_dex = TRUE; | |
387 | + p_ptr->sustain_con = TRUE; | |
388 | + p_ptr->regenerate = TRUE; | |
389 | + p_ptr->free_act = TRUE; | |
390 | + new_speed += 2; | |
391 | + if (p_ptr->lev > 29) new_speed++; | |
392 | + if (p_ptr->lev > 39) new_speed++; | |
393 | + if (p_ptr->lev > 44) new_speed++; | |
394 | + if (p_ptr->lev > 49) new_speed++; | |
395 | + p_ptr->to_a += 10 + p_ptr->lev / 2; | |
396 | + p_ptr->dis_to_a += 10 + p_ptr->lev / 2; | |
397 | + p_ptr->skill_dig += (100 + p_ptr->lev * 8); | |
398 | + if (p_ptr->lev > 39) p_ptr->reflect = TRUE; | |
399 | + p_ptr->redraw |= PR_STATUS; | |
400 | + break; | |
401 | + case CLASS_MIRROR_MASTER: | |
402 | + if (p_ptr->lev > 39) p_ptr->reflect = TRUE; | |
403 | + break; | |
404 | + case CLASS_NINJA: | |
405 | + /* Unencumbered Ninjas become faster every 10 levels */ | |
406 | + if (heavy_armor()) | |
407 | + { | |
408 | + new_speed -= (p_ptr->lev) / 10; | |
409 | + p_ptr->skill_stl -= (p_ptr->lev) / 10; | |
410 | + } | |
411 | + else if ((!inventory[INVEN_RARM].k_idx || p_ptr->migite) && | |
412 | + (!inventory[INVEN_LARM].k_idx || p_ptr->hidarite)) | |
413 | + { | |
414 | + new_speed += 3; | |
415 | + if (!(prace_is_(RACE_KLACKON) || | |
416 | + prace_is_(RACE_SPRITE) || | |
417 | + (p_ptr->pseikaku == SEIKAKU_MUNCHKIN))) | |
418 | + new_speed += (p_ptr->lev) / 10; | |
419 | + p_ptr->skill_stl += (p_ptr->lev) / 10; | |
420 | + | |
421 | + /* Free action if unencumbered at level 25 */ | |
422 | + if (p_ptr->lev > 24) | |
423 | + p_ptr->free_act = TRUE; | |
424 | + } | |
425 | + if ((!inventory[INVEN_RARM].k_idx || p_ptr->migite) && | |
426 | + (!inventory[INVEN_LARM].k_idx || p_ptr->hidarite)) | |
427 | + { | |
428 | + p_ptr->to_a += p_ptr->lev / 2 + 5; | |
429 | + p_ptr->dis_to_a += p_ptr->lev / 2 + 5; | |
430 | + } | |
431 | + p_ptr->slow_digest = TRUE; | |
432 | + p_ptr->resist_fear = TRUE; | |
433 | + if (p_ptr->lev > 19) p_ptr->resist_pois = TRUE; | |
434 | + if (p_ptr->lev > 24) p_ptr->sustain_dex = TRUE; | |
435 | + if (p_ptr->lev > 29) p_ptr->see_inv = TRUE; | |
436 | + if (p_ptr->lev > 44) | |
437 | + { | |
438 | + p_ptr->oppose_pois = 1; | |
439 | + p_ptr->redraw |= PR_STATUS; | |
440 | + } | |
441 | + p_ptr->see_nocto = TRUE; | |
442 | + break; | |
443 | + } | |
444 | + | |
445 | + /***** Races ****/ | |
446 | + if (p_ptr->mimic_form) | |
447 | + { | |
448 | + switch (p_ptr->mimic_form) | |
449 | + { | |
450 | + case MIMIC_DEMON: | |
451 | + p_ptr->hold_exp = TRUE; | |
452 | + p_ptr->resist_chaos = TRUE; | |
453 | + p_ptr->resist_neth = TRUE; | |
454 | + p_ptr->resist_fire = TRUE; | |
455 | + p_ptr->oppose_fire = 1; | |
456 | + p_ptr->see_inv = TRUE; | |
457 | + new_speed += 3; | |
458 | + p_ptr->redraw |= PR_STATUS; | |
459 | + p_ptr->to_a += 10; | |
460 | + p_ptr->dis_to_a += 10; | |
461 | + p_ptr->align -= 200; | |
462 | + break; | |
463 | + case MIMIC_DEMON_LORD: | |
464 | + p_ptr->hold_exp = TRUE; | |
465 | + p_ptr->resist_chaos = TRUE; | |
466 | + p_ptr->resist_neth = TRUE; | |
467 | + p_ptr->immune_fire = TRUE; | |
468 | + p_ptr->resist_acid = TRUE; | |
469 | + p_ptr->resist_fire = TRUE; | |
470 | + p_ptr->resist_cold = TRUE; | |
471 | + p_ptr->resist_elec = TRUE; | |
472 | + p_ptr->resist_pois = TRUE; | |
473 | + p_ptr->resist_conf = TRUE; | |
474 | + p_ptr->resist_disen = TRUE; | |
475 | + p_ptr->resist_nexus = TRUE; | |
476 | + p_ptr->resist_fear = TRUE; | |
477 | + p_ptr->sh_fire = TRUE; | |
478 | + p_ptr->see_inv = TRUE; | |
479 | + p_ptr->telepathy = TRUE; | |
480 | + p_ptr->levitation = TRUE; | |
481 | + p_ptr->kill_wall = TRUE; | |
482 | + new_speed += 5; | |
483 | + p_ptr->to_a += 20; | |
484 | + p_ptr->dis_to_a += 20; | |
485 | + p_ptr->align -= 200; | |
486 | + break; | |
487 | + case MIMIC_VAMPIRE: | |
488 | + p_ptr->resist_dark = TRUE; | |
489 | + p_ptr->hold_exp = TRUE; | |
490 | + p_ptr->resist_neth = TRUE; | |
491 | + p_ptr->resist_cold = TRUE; | |
492 | + p_ptr->resist_pois = TRUE; | |
493 | + p_ptr->see_inv = TRUE; | |
494 | + new_speed += 3; | |
495 | + p_ptr->to_a += 10; | |
496 | + p_ptr->dis_to_a += 10; | |
497 | + if (p_ptr->pclass != CLASS_NINJA) p_ptr->lite = TRUE; | |
498 | + break; | |
499 | + } | |
500 | + } | |
501 | + else | |
502 | + { | |
503 | + switch (p_ptr->prace) | |
504 | + { | |
505 | + case RACE_ELF: | |
506 | + p_ptr->resist_lite = TRUE; | |
507 | + break; | |
508 | + case RACE_HOBBIT: | |
509 | + p_ptr->hold_exp = TRUE; | |
510 | + break; | |
511 | + case RACE_GNOME: | |
512 | + p_ptr->free_act = TRUE; | |
513 | + break; | |
514 | + case RACE_DWARF: | |
515 | + p_ptr->resist_blind = TRUE; | |
516 | + break; | |
517 | + case RACE_HALF_ORC: | |
518 | + p_ptr->resist_dark = TRUE; | |
519 | + break; | |
520 | + case RACE_HALF_TROLL: | |
521 | + p_ptr->sustain_str = TRUE; | |
522 | + | |
523 | + if (p_ptr->lev > 14) | |
524 | + { | |
525 | + /* High level trolls heal fast... */ | |
526 | + p_ptr->regenerate = TRUE; | |
527 | + | |
528 | + if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_BERSERKER) | |
529 | + { | |
530 | + p_ptr->slow_digest = TRUE; | |
531 | + /* Let's not make Regeneration | |
532 | + * a disadvantage for the poor warriors who can | |
533 | + * never learn a spell that satisfies hunger (actually | |
534 | + * neither can rogues, but half-trolls are not | |
535 | + * supposed to play rogues) */ | |
536 | + } | |
537 | + } | |
538 | + break; | |
539 | + case RACE_AMBERITE: | |
540 | + p_ptr->sustain_con = TRUE; | |
541 | + p_ptr->regenerate = TRUE; /* Amberites heal fast... */ | |
542 | + break; | |
543 | + case RACE_HIGH_ELF: | |
544 | + p_ptr->resist_lite = TRUE; | |
545 | + p_ptr->see_inv = TRUE; | |
546 | + break; | |
547 | + case RACE_BARBARIAN: | |
548 | + p_ptr->resist_fear = TRUE; | |
549 | + break; | |
550 | + case RACE_HALF_OGRE: | |
551 | + p_ptr->resist_dark = TRUE; | |
552 | + p_ptr->sustain_str = TRUE; | |
553 | + break; | |
554 | + case RACE_HALF_GIANT: | |
555 | + p_ptr->sustain_str = TRUE; | |
556 | + p_ptr->resist_shard = TRUE; | |
557 | + break; | |
558 | + case RACE_HALF_TITAN: | |
559 | + p_ptr->resist_chaos = TRUE; | |
560 | + break; | |
561 | + case RACE_CYCLOPS: | |
562 | + p_ptr->resist_sound = TRUE; | |
563 | + break; | |
564 | + case RACE_YEEK: | |
565 | + p_ptr->resist_acid = TRUE; | |
566 | + if (p_ptr->lev > 19) p_ptr->immune_acid = TRUE; | |
567 | + break; | |
568 | + case RACE_KLACKON: | |
569 | + p_ptr->resist_conf = TRUE; | |
570 | + p_ptr->resist_acid = TRUE; | |
571 | + | |
572 | + /* Klackons become faster */ | |
573 | + new_speed += (p_ptr->lev) / 10; | |
574 | + break; | |
575 | + case RACE_KOBOLD: | |
576 | + p_ptr->resist_pois = TRUE; | |
577 | + break; | |
578 | + case RACE_NIBELUNG: | |
579 | + p_ptr->resist_disen = TRUE; | |
580 | + p_ptr->resist_dark = TRUE; | |
581 | + break; | |
582 | + case RACE_DARK_ELF: | |
583 | + p_ptr->resist_dark = TRUE; | |
584 | + if (p_ptr->lev > 19) p_ptr->see_inv = TRUE; | |
585 | + break; | |
586 | + case RACE_DRACONIAN: | |
587 | + p_ptr->levitation = TRUE; | |
588 | + if (p_ptr->lev > 4) p_ptr->resist_fire = TRUE; | |
589 | + if (p_ptr->lev > 9) p_ptr->resist_cold = TRUE; | |
590 | + if (p_ptr->lev > 14) p_ptr->resist_acid = TRUE; | |
591 | + if (p_ptr->lev > 19) p_ptr->resist_elec = TRUE; | |
592 | + if (p_ptr->lev > 34) p_ptr->resist_pois = TRUE; | |
593 | + break; | |
594 | + case RACE_MIND_FLAYER: | |
595 | + p_ptr->sustain_int = TRUE; | |
596 | + p_ptr->sustain_wis = TRUE; | |
597 | + if (p_ptr->lev > 14) p_ptr->see_inv = TRUE; | |
598 | + if (p_ptr->lev > 29) p_ptr->telepathy = TRUE; | |
599 | + break; | |
600 | + case RACE_IMP: | |
601 | + p_ptr->resist_fire = TRUE; | |
602 | + if (p_ptr->lev > 9) p_ptr->see_inv = TRUE; | |
603 | + break; | |
604 | + case RACE_GOLEM: | |
605 | + p_ptr->slow_digest = TRUE; | |
606 | + p_ptr->free_act = TRUE; | |
607 | + p_ptr->see_inv = TRUE; | |
608 | + p_ptr->resist_pois = TRUE; | |
609 | + if (p_ptr->lev > 34) p_ptr->hold_exp = TRUE; | |
610 | + break; | |
611 | + case RACE_SKELETON: | |
612 | + p_ptr->resist_shard = TRUE; | |
613 | + p_ptr->hold_exp = TRUE; | |
614 | + p_ptr->see_inv = TRUE; | |
615 | + p_ptr->resist_pois = TRUE; | |
616 | + if (p_ptr->lev > 9) p_ptr->resist_cold = TRUE; | |
617 | + break; | |
618 | + case RACE_ZOMBIE: | |
619 | + p_ptr->resist_neth = TRUE; | |
620 | + p_ptr->hold_exp = TRUE; | |
621 | + p_ptr->see_inv = TRUE; | |
622 | + p_ptr->resist_pois = TRUE; | |
623 | + p_ptr->slow_digest = TRUE; | |
624 | + if (p_ptr->lev > 4) p_ptr->resist_cold = TRUE; | |
625 | + break; | |
626 | + case RACE_VAMPIRE: | |
627 | + p_ptr->resist_dark = TRUE; | |
628 | + p_ptr->hold_exp = TRUE; | |
629 | + p_ptr->resist_neth = TRUE; | |
630 | + p_ptr->resist_cold = TRUE; | |
631 | + p_ptr->resist_pois = TRUE; | |
632 | + if (p_ptr->pclass != CLASS_NINJA) p_ptr->lite = TRUE; | |
633 | + break; | |
634 | + case RACE_SPECTRE: | |
635 | + p_ptr->levitation = TRUE; | |
636 | + p_ptr->free_act = TRUE; | |
637 | + p_ptr->resist_neth = TRUE; | |
638 | + p_ptr->hold_exp = TRUE; | |
639 | + p_ptr->see_inv = TRUE; | |
640 | + p_ptr->resist_pois = TRUE; | |
641 | + p_ptr->slow_digest = TRUE; | |
642 | + p_ptr->resist_cold = TRUE; | |
643 | + p_ptr->pass_wall = TRUE; | |
644 | + if (p_ptr->lev > 34) p_ptr->telepathy = TRUE; | |
645 | + break; | |
646 | + case RACE_SPRITE: | |
647 | + p_ptr->levitation = TRUE; | |
648 | + p_ptr->resist_lite = TRUE; | |
649 | + | |
650 | + /* Sprites become faster */ | |
651 | + new_speed += (p_ptr->lev) / 10; | |
652 | + break; | |
653 | + case RACE_BEASTMAN: | |
654 | + p_ptr->resist_conf = TRUE; | |
655 | + p_ptr->resist_sound = TRUE; | |
656 | + break; | |
657 | + case RACE_ENT: | |
658 | + /* Ents dig like maniacs, but only with their hands. */ | |
659 | + if (!inventory[INVEN_RARM].k_idx) | |
660 | + p_ptr->skill_dig += p_ptr->lev * 10; | |
661 | + /* Ents get tougher and stronger as they age, but lose dexterity. */ | |
662 | + if (p_ptr->lev > 25) p_ptr->stat_add[A_STR]++; | |
663 | + if (p_ptr->lev > 40) p_ptr->stat_add[A_STR]++; | |
664 | + if (p_ptr->lev > 45) p_ptr->stat_add[A_STR]++; | |
665 | + | |
666 | + if (p_ptr->lev > 25) p_ptr->stat_add[A_DEX]--; | |
667 | + if (p_ptr->lev > 40) p_ptr->stat_add[A_DEX]--; | |
668 | + if (p_ptr->lev > 45) p_ptr->stat_add[A_DEX]--; | |
669 | + | |
670 | + if (p_ptr->lev > 25) p_ptr->stat_add[A_CON]++; | |
671 | + if (p_ptr->lev > 40) p_ptr->stat_add[A_CON]++; | |
672 | + if (p_ptr->lev > 45) p_ptr->stat_add[A_CON]++; | |
673 | + break; | |
674 | + case RACE_ANGEL: | |
675 | + p_ptr->levitation = TRUE; | |
676 | + p_ptr->see_inv = TRUE; | |
677 | + p_ptr->align += 200; | |
678 | + break; | |
679 | + case RACE_DEMON: | |
680 | + p_ptr->resist_fire = TRUE; | |
681 | + p_ptr->resist_neth = TRUE; | |
682 | + p_ptr->hold_exp = TRUE; | |
683 | + if (p_ptr->lev > 9) p_ptr->see_inv = TRUE; | |
684 | + if (p_ptr->lev > 44) | |
685 | + { | |
686 | + p_ptr->oppose_fire = 1; | |
687 | + p_ptr->redraw |= PR_STATUS; | |
688 | + } | |
689 | + p_ptr->align -= 200; | |
690 | + break; | |
691 | + case RACE_DUNADAN: | |
692 | + p_ptr->sustain_con = TRUE; | |
693 | + break; | |
694 | + case RACE_S_FAIRY: | |
695 | + p_ptr->levitation = TRUE; | |
696 | + break; | |
697 | + case RACE_KUTAR: | |
698 | + p_ptr->resist_conf = TRUE; | |
699 | + break; | |
700 | + case RACE_ANDROID: | |
701 | + p_ptr->slow_digest = TRUE; | |
702 | + p_ptr->free_act = TRUE; | |
703 | + p_ptr->resist_pois = TRUE; | |
704 | + p_ptr->hold_exp = TRUE; | |
705 | + break; | |
706 | + case RACE_MERFOLK: | |
707 | + p_ptr->resist_water = TRUE; | |
708 | + break; | |
709 | + default: | |
710 | + /* Do nothing */ | |
711 | + ; | |
712 | + } | |
713 | + } | |
714 | + | |
715 | + if (p_ptr->ult_res || (p_ptr->special_defense & KATA_MUSOU)) | |
716 | + { | |
717 | + p_ptr->see_inv = TRUE; | |
718 | + p_ptr->free_act = TRUE; | |
719 | + p_ptr->slow_digest = TRUE; | |
720 | + p_ptr->regenerate = TRUE; | |
721 | + p_ptr->levitation = TRUE; | |
722 | + p_ptr->hold_exp = TRUE; | |
723 | + p_ptr->telepathy = TRUE; | |
724 | + p_ptr->lite = TRUE; | |
725 | + p_ptr->sustain_str = TRUE; | |
726 | + p_ptr->sustain_int = TRUE; | |
727 | + p_ptr->sustain_wis = TRUE; | |
728 | + p_ptr->sustain_con = TRUE; | |
729 | + p_ptr->sustain_dex = TRUE; | |
730 | + p_ptr->sustain_chr = TRUE; | |
731 | + p_ptr->resist_acid = TRUE; | |
732 | + p_ptr->resist_elec = TRUE; | |
733 | + p_ptr->resist_fire = TRUE; | |
734 | + p_ptr->resist_cold = TRUE; | |
735 | + p_ptr->resist_pois = TRUE; | |
736 | + p_ptr->resist_conf = TRUE; | |
737 | + p_ptr->resist_sound = TRUE; | |
738 | + p_ptr->resist_lite = TRUE; | |
739 | + p_ptr->resist_dark = TRUE; | |
740 | + p_ptr->resist_chaos = TRUE; | |
741 | + p_ptr->resist_disen = TRUE; | |
742 | + p_ptr->resist_shard = TRUE; | |
743 | + p_ptr->resist_nexus = TRUE; | |
744 | + p_ptr->resist_blind = TRUE; | |
745 | + p_ptr->resist_neth = TRUE; | |
746 | + p_ptr->resist_fear = TRUE; | |
747 | + p_ptr->reflect = TRUE; | |
748 | + p_ptr->sh_fire = TRUE; | |
749 | + p_ptr->sh_elec = TRUE; | |
750 | + p_ptr->sh_cold = TRUE; | |
751 | + p_ptr->to_a += 100; | |
752 | + p_ptr->dis_to_a += 100; | |
753 | + } | |
754 | + /* Temporary shield */ | |
755 | + else if (p_ptr->tsubureru || p_ptr->shield || p_ptr->magicdef) | |
756 | + { | |
757 | + p_ptr->to_a += 50; | |
758 | + p_ptr->dis_to_a += 50; | |
759 | + } | |
760 | + | |
761 | + if (p_ptr->tim_res_nether) | |
762 | + { | |
763 | + p_ptr->resist_neth = TRUE; | |
764 | + } | |
765 | + if (p_ptr->tim_sh_fire) | |
766 | + { | |
767 | + p_ptr->sh_fire = TRUE; | |
768 | + } | |
769 | + if (p_ptr->tim_res_time) | |
770 | + { | |
771 | + p_ptr->resist_time = TRUE; | |
772 | + } | |
773 | + | |
774 | + /* Sexy Gal */ | |
775 | + if (p_ptr->pseikaku == SEIKAKU_SEXY) p_ptr->cursed |= (TRC_AGGRAVATE); | |
776 | + | |
777 | + if (p_ptr->pseikaku == SEIKAKU_NAMAKE) p_ptr->to_m_chance += 10; | |
778 | + if (p_ptr->pseikaku == SEIKAKU_KIREMONO) p_ptr->to_m_chance -= 3; | |
779 | + if ((p_ptr->pseikaku == SEIKAKU_GAMAN) || (p_ptr->pseikaku == SEIKAKU_CHIKARA)) p_ptr->to_m_chance++; | |
780 | + | |
781 | + if (p_ptr->pseikaku == SEIKAKU_CHARGEMAN) | |
782 | + { | |
783 | + p_ptr->to_m_chance += 5; | |
784 | + p_ptr->resist_conf = TRUE; | |
785 | + } | |
786 | + | |
787 | + /* Lucky man */ | |
788 | + if (p_ptr->pseikaku == SEIKAKU_LUCKY) p_ptr->muta3 |= MUT3_GOOD_LUCK; | |
789 | + | |
790 | + if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN) | |
791 | + { | |
792 | + p_ptr->resist_blind = TRUE; | |
793 | + p_ptr->resist_conf = TRUE; | |
794 | + p_ptr->hold_exp = TRUE; | |
795 | + if (p_ptr->pclass != CLASS_NINJA) p_ptr->lite = TRUE; | |
796 | + | |
797 | + if ((p_ptr->prace != RACE_KLACKON) && (p_ptr->prace != RACE_SPRITE)) | |
798 | + /* Munchkin become faster */ | |
799 | + new_speed += (p_ptr->lev) / 10 + 5; | |
800 | + } | |
801 | + | |
802 | + if (music_singing(MUSIC_WALL)) | |
803 | + { | |
804 | + p_ptr->kill_wall = TRUE; | |
805 | + } | |
806 | + | |
807 | + /* Hack -- apply racial/class stat maxes */ | |
808 | + /* Apply the racial modifiers */ | |
809 | + for (i = 0; i < A_MAX; i++) | |
810 | + { | |
811 | + /* Modify the stats for "race" */ | |
812 | + p_ptr->stat_add[i] += (tmp_rp_ptr->r_adj[i] + cp_ptr->c_adj[i] + ap_ptr->a_adj[i]); | |
813 | + } | |
814 | + | |
815 | + | |
816 | + /* I'm adding the mutations here for the lack of a better place... */ | |
817 | + if (p_ptr->muta3) | |
818 | + { | |
819 | + /* Hyper Strength */ | |
820 | + if (p_ptr->muta3 & MUT3_HYPER_STR) | |
821 | + { | |
822 | + p_ptr->stat_add[A_STR] += 4; | |
823 | + } | |
824 | + | |
825 | + /* Puny */ | |
826 | + if (p_ptr->muta3 & MUT3_PUNY) | |
827 | + { | |
828 | + p_ptr->stat_add[A_STR] -= 4; | |
829 | + } | |
830 | + | |
831 | + /* Living computer */ | |
832 | + if (p_ptr->muta3 & MUT3_HYPER_INT) | |
833 | + { | |
834 | + p_ptr->stat_add[A_INT] += 4; | |
835 | + p_ptr->stat_add[A_WIS] += 4; | |
836 | + } | |
837 | + | |
838 | + /* Moronic */ | |
839 | + if (p_ptr->muta3 & MUT3_MORONIC) | |
840 | + { | |
841 | + p_ptr->stat_add[A_INT] -= 4; | |
842 | + p_ptr->stat_add[A_WIS] -= 4; | |
843 | + } | |
844 | + | |
845 | + if (p_ptr->muta3 & MUT3_RESILIENT) | |
846 | + { | |
847 | + p_ptr->stat_add[A_CON] += 4; | |
848 | + } | |
849 | + | |
850 | + if (p_ptr->muta3 & MUT3_XTRA_FAT) | |
851 | + { | |
852 | + p_ptr->stat_add[A_CON] += 2; | |
853 | + new_speed -= 2; | |
854 | + } | |
855 | + | |
856 | + if (p_ptr->muta3 & MUT3_ALBINO) | |
857 | + { | |
858 | + p_ptr->stat_add[A_CON] -= 4; | |
859 | + } | |
860 | + | |
861 | + if (p_ptr->muta3 & MUT3_FLESH_ROT) | |
862 | + { | |
863 | + p_ptr->stat_add[A_CON] -= 2; | |
864 | + p_ptr->stat_add[A_CHR] -= 1; | |
865 | + p_ptr->regenerate = FALSE; | |
866 | + /* Cancel innate regeneration */ | |
867 | + } | |
868 | + | |
869 | + if (p_ptr->muta3 & MUT3_SILLY_VOI) | |
870 | + { | |
871 | + p_ptr->stat_add[A_CHR] -= 4; | |
872 | + } | |
873 | + | |
874 | + if (p_ptr->muta3 & MUT3_BLANK_FAC) | |
875 | + { | |
876 | + p_ptr->stat_add[A_CHR] -= 1; | |
877 | + } | |
878 | + | |
879 | + if (p_ptr->muta3 & MUT3_XTRA_EYES) | |
880 | + { | |
881 | + p_ptr->skill_fos += 15; | |
882 | + p_ptr->skill_srh += 15; | |
883 | + } | |
884 | + | |
885 | + if (p_ptr->muta3 & MUT3_MAGIC_RES) | |
886 | + { | |
887 | + p_ptr->skill_sav += (15 + (p_ptr->lev / 5)); | |
888 | + } | |
889 | + | |
890 | + if (p_ptr->muta3 & MUT3_XTRA_NOIS) | |
891 | + { | |
892 | + p_ptr->skill_stl -= 3; | |
893 | + } | |
894 | + | |
895 | + if (p_ptr->muta3 & MUT3_INFRAVIS) | |
896 | + { | |
897 | + p_ptr->see_infra += 3; | |
898 | + } | |
899 | + | |
900 | + if (p_ptr->muta3 & MUT3_XTRA_LEGS) | |
901 | + { | |
902 | + new_speed += 3; | |
903 | + } | |
904 | + | |
905 | + if (p_ptr->muta3 & MUT3_SHORT_LEG) | |
906 | + { | |
907 | + new_speed -= 3; | |
908 | + } | |
909 | + | |
910 | + if (p_ptr->muta3 & MUT3_ELEC_TOUC) | |
911 | + { | |
912 | + p_ptr->sh_elec = TRUE; | |
913 | + } | |
914 | + | |
915 | + if (p_ptr->muta3 & MUT3_FIRE_BODY) | |
916 | + { | |
917 | + p_ptr->sh_fire = TRUE; | |
918 | + p_ptr->lite = TRUE; | |
919 | + } | |
920 | + | |
921 | + if (p_ptr->muta3 & MUT3_WART_SKIN) | |
922 | + { | |
923 | + p_ptr->stat_add[A_CHR] -= 2; | |
924 | + p_ptr->to_a += 5; | |
925 | + p_ptr->dis_to_a += 5; | |
926 | + } | |
927 | + | |
928 | + if (p_ptr->muta3 & MUT3_SCALES) | |
929 | + { | |
930 | + p_ptr->stat_add[A_CHR] -= 1; | |
931 | + p_ptr->to_a += 10; | |
932 | + p_ptr->dis_to_a += 10; | |
933 | + } | |
934 | + | |
935 | + if (p_ptr->muta3 & MUT3_IRON_SKIN) | |
936 | + { | |
937 | + p_ptr->stat_add[A_DEX] -= 1; | |
938 | + p_ptr->to_a += 25; | |
939 | + p_ptr->dis_to_a += 25; | |
940 | + } | |
941 | + | |
942 | + if (p_ptr->muta3 & MUT3_WINGS) | |
943 | + { | |
944 | + p_ptr->levitation = TRUE; | |
945 | + } | |
946 | + | |
947 | + if (p_ptr->muta3 & MUT3_FEARLESS) | |
948 | + { | |
949 | + p_ptr->resist_fear = TRUE; | |
950 | + } | |
951 | + | |
952 | + if (p_ptr->muta3 & MUT3_REGEN) | |
953 | + { | |
954 | + p_ptr->regenerate = TRUE; | |
955 | + } | |
956 | + | |
957 | + if (p_ptr->muta3 & MUT3_ESP) | |
958 | + { | |
959 | + p_ptr->telepathy = TRUE; | |
960 | + } | |
961 | + | |
962 | + if (p_ptr->muta3 & MUT3_LIMBER) | |
963 | + { | |
964 | + p_ptr->stat_add[A_DEX] += 3; | |
965 | + } | |
966 | + | |
967 | + if (p_ptr->muta3 & MUT3_ARTHRITIS) | |
968 | + { | |
969 | + p_ptr->stat_add[A_DEX] -= 3; | |
970 | + } | |
971 | + | |
972 | + if (p_ptr->muta3 & MUT3_MOTION) | |
973 | + { | |
974 | + p_ptr->free_act = TRUE; | |
975 | + p_ptr->skill_stl += 1; | |
976 | + } | |
977 | + | |
978 | + if (p_ptr->muta3 & MUT3_ILL_NORM) | |
979 | + { | |
980 | + p_ptr->stat_add[A_CHR] = 0; | |
981 | + } | |
982 | + } | |
983 | + | |
984 | + if (p_ptr->tsuyoshi) | |
985 | + { | |
986 | + p_ptr->stat_add[A_STR] += 4; | |
987 | + p_ptr->stat_add[A_CON] += 4; | |
988 | + } | |
989 | + | |
990 | + /* Scan the usable inventory */ | |
991 | + for (i = INVEN_RARM; i < INVEN_TOTAL; i++) | |
992 | + { | |
993 | + int bonus_to_h, bonus_to_d; | |
994 | + o_ptr = &inventory[i]; | |
995 | + | |
996 | + /* Skip non-objects */ | |
997 | + if (!o_ptr->k_idx) continue; | |
998 | + | |
999 | + /* Extract the item flags */ | |
1000 | + object_flags(o_ptr, flgs); | |
1001 | + | |
1002 | + p_ptr->cursed |= (o_ptr->curse_flags & (0xFFFFFFF0L)); | |
1003 | + if (o_ptr->name1 == ART_CHAINSWORD) p_ptr->cursed |= TRC_CHAINSWORD; | |
1004 | + | |
1005 | + /* Affect stats */ | |
1006 | + if (have_flag(flgs, TR_STR)) p_ptr->stat_add[A_STR] += o_ptr->pval; | |
1007 | + if (have_flag(flgs, TR_INT)) p_ptr->stat_add[A_INT] += o_ptr->pval; | |
1008 | + if (have_flag(flgs, TR_WIS)) p_ptr->stat_add[A_WIS] += o_ptr->pval; | |
1009 | + if (have_flag(flgs, TR_DEX)) p_ptr->stat_add[A_DEX] += o_ptr->pval; | |
1010 | + if (have_flag(flgs, TR_CON)) p_ptr->stat_add[A_CON] += o_ptr->pval; | |
1011 | + if (have_flag(flgs, TR_CHR)) p_ptr->stat_add[A_CHR] += o_ptr->pval; | |
1012 | + | |
1013 | + if (have_flag(flgs, TR_MAGIC_MASTERY)) p_ptr->skill_dev += 8 * o_ptr->pval; | |
1014 | + | |
1015 | + /* Affect stealth */ | |
1016 | + if (have_flag(flgs, TR_STEALTH)) p_ptr->skill_stl += o_ptr->pval; | |
1017 | + | |
1018 | + /* Affect searching ability (factor of five) */ | |
1019 | + if (have_flag(flgs, TR_SEARCH)) p_ptr->skill_srh += (o_ptr->pval * 5); | |
1020 | + | |
1021 | + /* Affect searching frequency (factor of five) */ | |
1022 | + if (have_flag(flgs, TR_SEARCH)) p_ptr->skill_fos += (o_ptr->pval * 5); | |
1023 | + | |
1024 | + /* Affect infravision */ | |
1025 | + if (have_flag(flgs, TR_INFRA)) p_ptr->see_infra += o_ptr->pval; | |
1026 | + | |
1027 | + /* Affect digging (factor of 20) */ | |
1028 | + if (have_flag(flgs, TR_TUNNEL)) p_ptr->skill_dig += (o_ptr->pval * 20); | |
1029 | + | |
1030 | + /* Affect speed */ | |
1031 | + if (have_flag(flgs, TR_SPEED)) new_speed += o_ptr->pval; | |
1032 | + | |
1033 | + /* Affect blows */ | |
1034 | + if (have_flag(flgs, TR_BLOWS)) | |
1035 | + { | |
1036 | + if ((i == INVEN_RARM || i == INVEN_RIGHT) && !p_ptr->ryoute) extra_blows[0] += o_ptr->pval; | |
1037 | + else if ((i == INVEN_LARM || i == INVEN_LEFT) && !p_ptr->ryoute) extra_blows[1] += o_ptr->pval; | |
1038 | + else { extra_blows[0] += o_ptr->pval; extra_blows[1] += o_ptr->pval; } | |
1039 | + } | |
1040 | + | |
1041 | + /* Hack -- cause earthquakes */ | |
1042 | + if (have_flag(flgs, TR_IMPACT)) p_ptr->impact[(i == INVEN_RARM) ? 0 : 1] = TRUE; | |
1043 | + | |
1044 | + /* Various flags */ | |
1045 | + if (have_flag(flgs, TR_AGGRAVATE)) p_ptr->cursed |= TRC_AGGRAVATE; | |
1046 | + if (have_flag(flgs, TR_DRAIN_EXP)) p_ptr->cursed |= TRC_DRAIN_EXP; | |
1047 | + if (have_flag(flgs, TR_TY_CURSE)) p_ptr->cursed |= TRC_TY_CURSE; | |
1048 | + if (have_flag(flgs, TR_ADD_L_CURSE)) p_ptr->cursed |= TRC_ADD_L_CURSE; | |
1049 | + if (have_flag(flgs, TR_ADD_H_CURSE)) p_ptr->cursed |= TRC_ADD_H_CURSE; | |
1050 | + if (have_flag(flgs, TR_DRAIN_HP)) p_ptr->cursed |= TRC_DRAIN_HP; | |
1051 | + if (have_flag(flgs, TR_DRAIN_MANA)) p_ptr->cursed |= TRC_DRAIN_MANA; | |
1052 | + if (have_flag(flgs, TR_CALL_ANIMAL)) p_ptr->cursed |= TRC_CALL_ANIMAL; | |
1053 | + if (have_flag(flgs, TR_CALL_DEMON)) p_ptr->cursed |= TRC_CALL_DEMON; | |
1054 | + if (have_flag(flgs, TR_CALL_DRAGON)) p_ptr->cursed |= TRC_CALL_DRAGON; | |
1055 | + if (have_flag(flgs, TR_CALL_UNDEAD)) p_ptr->cursed |= TRC_CALL_UNDEAD; | |
1056 | + if (have_flag(flgs, TR_COWARDICE)) p_ptr->cursed |= TRC_COWARDICE; | |
1057 | + if (have_flag(flgs, TR_LOW_MELEE)) p_ptr->cursed |= TRC_LOW_MELEE; | |
1058 | + if (have_flag(flgs, TR_LOW_AC)) p_ptr->cursed |= TRC_LOW_AC; | |
1059 | + if (have_flag(flgs, TR_LOW_MAGIC)) p_ptr->cursed |= TRC_LOW_MAGIC; | |
1060 | + if (have_flag(flgs, TR_FAST_DIGEST)) p_ptr->cursed |= TRC_FAST_DIGEST; | |
1061 | + if (have_flag(flgs, TR_SLOW_REGEN)) p_ptr->cursed |= TRC_SLOW_REGEN; | |
1062 | + if (have_flag(flgs, TR_DEC_MANA)) p_ptr->dec_mana = TRUE; | |
1063 | + if (have_flag(flgs, TR_BLESSED)) p_ptr->bless_blade = TRUE; | |
1064 | + if (have_flag(flgs, TR_XTRA_MIGHT)) p_ptr->xtra_might = TRUE; | |
1065 | + if (have_flag(flgs, TR_SLOW_DIGEST)) p_ptr->slow_digest = TRUE; | |
1066 | + if (have_flag(flgs, TR_REGEN)) p_ptr->regenerate = TRUE; | |
1067 | + if (have_flag(flgs, TR_TELEPATHY)) p_ptr->telepathy = TRUE; | |
1068 | + if (have_flag(flgs, TR_ESP_ANIMAL)) p_ptr->esp_animal = TRUE; | |
1069 | + if (have_flag(flgs, TR_ESP_UNDEAD)) p_ptr->esp_undead = TRUE; | |
1070 | + if (have_flag(flgs, TR_ESP_DEMON)) p_ptr->esp_demon = TRUE; | |
1071 | + if (have_flag(flgs, TR_ESP_ORC)) p_ptr->esp_orc = TRUE; | |
1072 | + if (have_flag(flgs, TR_ESP_TROLL)) p_ptr->esp_troll = TRUE; | |
1073 | + if (have_flag(flgs, TR_ESP_GIANT)) p_ptr->esp_giant = TRUE; | |
1074 | + if (have_flag(flgs, TR_ESP_DRAGON)) p_ptr->esp_dragon = TRUE; | |
1075 | + if (have_flag(flgs, TR_ESP_HUMAN)) p_ptr->esp_human = TRUE; | |
1076 | + if (have_flag(flgs, TR_ESP_EVIL)) p_ptr->esp_evil = TRUE; | |
1077 | + if (have_flag(flgs, TR_ESP_GOOD)) p_ptr->esp_good = TRUE; | |
1078 | + if (have_flag(flgs, TR_ESP_NONLIVING)) p_ptr->esp_nonliving = TRUE; | |
1079 | + if (have_flag(flgs, TR_ESP_UNIQUE)) p_ptr->esp_unique = TRUE; | |
1080 | + | |
1081 | + if (have_flag(flgs, TR_SEE_INVIS)) p_ptr->see_inv = TRUE; | |
1082 | + if (have_flag(flgs, TR_LEVITATION)) p_ptr->levitation = TRUE; | |
1083 | + if (have_flag(flgs, TR_FREE_ACT)) p_ptr->free_act = TRUE; | |
1084 | + if (have_flag(flgs, TR_HOLD_EXP)) p_ptr->hold_exp = TRUE; | |
1085 | + if (have_flag(flgs, TR_WARNING)) { | |
1086 | + if (!o_ptr->inscription || !(my_strchr(quark_str(o_ptr->inscription), '$'))) | |
1087 | + p_ptr->warning = TRUE; | |
1088 | + } | |
1089 | + | |
1090 | + if (have_flag(flgs, TR_TELEPORT)) | |
1091 | + { | |
1092 | + if (object_is_cursed(o_ptr)) p_ptr->cursed |= TRC_TELEPORT; | |
1093 | + else | |
1094 | + { | |
1095 | + concptr insc = quark_str(o_ptr->inscription); | |
1096 | + | |
1097 | + if (o_ptr->inscription && my_strchr(insc, '.')) | |
1098 | + { | |
1099 | + /* | |
1100 | + * {.} will stop random teleportation. | |
1101 | + */ | |
1102 | + } | |
1103 | + else | |
1104 | + { | |
1105 | + /* Controlled random teleportation */ | |
1106 | + p_ptr->cursed |= TRC_TELEPORT_SELF; | |
1107 | + } | |
1108 | + } | |
1109 | + } | |
1110 | + | |
1111 | + /* Immunity flags */ | |
1112 | + if (have_flag(flgs, TR_IM_FIRE)) p_ptr->immune_fire = TRUE; | |
1113 | + if (have_flag(flgs, TR_IM_ACID)) p_ptr->immune_acid = TRUE; | |
1114 | + if (have_flag(flgs, TR_IM_COLD)) p_ptr->immune_cold = TRUE; | |
1115 | + if (have_flag(flgs, TR_IM_ELEC)) p_ptr->immune_elec = TRUE; | |
1116 | + | |
1117 | + /* Resistance flags */ | |
1118 | + if (have_flag(flgs, TR_RES_ACID)) p_ptr->resist_acid = TRUE; | |
1119 | + if (have_flag(flgs, TR_RES_ELEC)) p_ptr->resist_elec = TRUE; | |
1120 | + if (have_flag(flgs, TR_RES_FIRE)) p_ptr->resist_fire = TRUE; | |
1121 | + if (have_flag(flgs, TR_RES_COLD)) p_ptr->resist_cold = TRUE; | |
1122 | + if (have_flag(flgs, TR_RES_POIS)) p_ptr->resist_pois = TRUE; | |
1123 | + if (have_flag(flgs, TR_RES_FEAR)) p_ptr->resist_fear = TRUE; | |
1124 | + if (have_flag(flgs, TR_RES_CONF)) p_ptr->resist_conf = TRUE; | |
1125 | + if (have_flag(flgs, TR_RES_SOUND)) p_ptr->resist_sound = TRUE; | |
1126 | + if (have_flag(flgs, TR_RES_LITE)) p_ptr->resist_lite = TRUE; | |
1127 | + if (have_flag(flgs, TR_RES_DARK)) p_ptr->resist_dark = TRUE; | |
1128 | + if (have_flag(flgs, TR_RES_CHAOS)) p_ptr->resist_chaos = TRUE; | |
1129 | + if (have_flag(flgs, TR_RES_DISEN)) p_ptr->resist_disen = TRUE; | |
1130 | + if (have_flag(flgs, TR_RES_SHARDS)) p_ptr->resist_shard = TRUE; | |
1131 | + if (have_flag(flgs, TR_RES_NEXUS)) p_ptr->resist_nexus = TRUE; | |
1132 | + if (have_flag(flgs, TR_RES_BLIND)) p_ptr->resist_blind = TRUE; | |
1133 | + if (have_flag(flgs, TR_RES_NETHER)) p_ptr->resist_neth = TRUE; | |
1134 | + | |
1135 | + if (have_flag(flgs, TR_REFLECT)) p_ptr->reflect = TRUE; | |
1136 | + if (have_flag(flgs, TR_SH_FIRE)) p_ptr->sh_fire = TRUE; | |
1137 | + if (have_flag(flgs, TR_SH_ELEC)) p_ptr->sh_elec = TRUE; | |
1138 | + if (have_flag(flgs, TR_SH_COLD)) p_ptr->sh_cold = TRUE; | |
1139 | + if (have_flag(flgs, TR_NO_MAGIC)) p_ptr->anti_magic = TRUE; | |
1140 | + if (have_flag(flgs, TR_NO_TELE)) p_ptr->anti_tele = TRUE; | |
1141 | + | |
1142 | + /* Sustain flags */ | |
1143 | + if (have_flag(flgs, TR_SUST_STR)) p_ptr->sustain_str = TRUE; | |
1144 | + if (have_flag(flgs, TR_SUST_INT)) p_ptr->sustain_int = TRUE; | |
1145 | + if (have_flag(flgs, TR_SUST_WIS)) p_ptr->sustain_wis = TRUE; | |
1146 | + if (have_flag(flgs, TR_SUST_DEX)) p_ptr->sustain_dex = TRUE; | |
1147 | + if (have_flag(flgs, TR_SUST_CON)) p_ptr->sustain_con = TRUE; | |
1148 | + if (have_flag(flgs, TR_SUST_CHR)) p_ptr->sustain_chr = TRUE; | |
1149 | + | |
1150 | + if (o_ptr->name2 == EGO_YOIYAMI) yoiyami = TRUE; | |
1151 | + if (o_ptr->name2 == EGO_2WEAPON) easy_2weapon = TRUE; | |
1152 | + if (o_ptr->name2 == EGO_RING_RES_TIME) p_ptr->resist_time = TRUE; | |
1153 | + if (o_ptr->name2 == EGO_RING_THROW) p_ptr->mighty_throw = TRUE; | |
1154 | + if (have_flag(flgs, TR_EASY_SPELL)) p_ptr->easy_spell = TRUE; | |
1155 | + if (o_ptr->name2 == EGO_AMU_FOOL) p_ptr->heavy_spell = TRUE; | |
1156 | + if (o_ptr->name2 == EGO_AMU_NAIVETY) down_saving = TRUE; | |
1157 | + | |
1158 | + if (o_ptr->curse_flags & TRC_LOW_MAGIC) | |
1159 | + { | |
1160 | + if (o_ptr->curse_flags & TRC_HEAVY_CURSE) | |
1161 | + { | |
1162 | + p_ptr->to_m_chance += 10; | |
1163 | + } | |
1164 | + else | |
1165 | + { | |
1166 | + p_ptr->to_m_chance += 3; | |
1167 | + } | |
1168 | + } | |
1169 | + | |
1170 | + if (o_ptr->tval == TV_CAPTURE) continue; | |
1171 | + | |
1172 | + /* Modify the base armor class */ | |
1173 | + p_ptr->ac += o_ptr->ac; | |
1174 | + | |
1175 | + /* The base armor class is always known */ | |
1176 | + p_ptr->dis_ac += o_ptr->ac; | |
1177 | + | |
1178 | + /* Apply the bonuses to armor class */ | |
1179 | + p_ptr->to_a += o_ptr->to_a; | |
1180 | + | |
1181 | + /* Apply the mental bonuses to armor class, if known */ | |
1182 | + if (object_is_known(o_ptr)) p_ptr->dis_to_a += o_ptr->to_a; | |
1183 | + | |
1184 | + if (o_ptr->curse_flags & TRC_LOW_MELEE) | |
1185 | + { | |
1186 | + int slot = i - INVEN_RARM; | |
1187 | + if (slot < 2) | |
1188 | + { | |
1189 | + if (o_ptr->curse_flags & TRC_HEAVY_CURSE) | |
1190 | + { | |
1191 | + p_ptr->to_h[slot] -= 15; | |
1192 | + if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_h[slot] -= 15; | |
1193 | + } | |
1194 | + else | |
1195 | + { | |
1196 | + p_ptr->to_h[slot] -= 5; | |
1197 | + if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_h[slot] -= 5; | |
1198 | + } | |
1199 | + } | |
1200 | + else | |
1201 | + { | |
1202 | + if (o_ptr->curse_flags & TRC_HEAVY_CURSE) | |
1203 | + { | |
1204 | + p_ptr->to_h_b -= 15; | |
1205 | + if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_h_b -= 15; | |
1206 | + } | |
1207 | + else | |
1208 | + { | |
1209 | + p_ptr->to_h_b -= 5; | |
1210 | + if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_h_b -= 5; | |
1211 | + } | |
1212 | + } | |
1213 | + } | |
1214 | + | |
1215 | + if (o_ptr->curse_flags & TRC_LOW_AC) | |
1216 | + { | |
1217 | + if (o_ptr->curse_flags & TRC_HEAVY_CURSE) | |
1218 | + { | |
1219 | + p_ptr->to_a -= 30; | |
1220 | + if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_a -= 30; | |
1221 | + } | |
1222 | + else | |
1223 | + { | |
1224 | + p_ptr->to_a -= 10; | |
1225 | + if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_a -= 10; | |
1226 | + } | |
1227 | + } | |
1228 | + | |
1229 | + /* Hack -- do not apply "weapon" bonuses */ | |
1230 | + if (i == INVEN_RARM && buki_motteruka(i)) continue; | |
1231 | + if (i == INVEN_LARM && buki_motteruka(i)) continue; | |
1232 | + | |
1233 | + /* Hack -- do not apply "bow" bonuses */ | |
1234 | + if (i == INVEN_BOW) continue; | |
1235 | + | |
1236 | + bonus_to_h = o_ptr->to_h; | |
1237 | + bonus_to_d = o_ptr->to_d; | |
1238 | + | |
1239 | + if (p_ptr->pclass == CLASS_NINJA) | |
1240 | + { | |
1241 | + if (o_ptr->to_h > 0) bonus_to_h = (o_ptr->to_h + 1) / 2; | |
1242 | + if (o_ptr->to_d > 0) bonus_to_d = (o_ptr->to_d + 1) / 2; | |
1243 | + } | |
1244 | + | |
1245 | + /* To Bow and Natural attack */ | |
1246 | + | |
1247 | + /* Apply the bonuses to hit/damage */ | |
1248 | + p_ptr->to_h_b += (s16b)bonus_to_h; | |
1249 | + p_ptr->to_h_m += (s16b)bonus_to_h; | |
1250 | + p_ptr->to_d_m += (s16b)bonus_to_d; | |
1251 | + | |
1252 | + /* Apply the mental bonuses tp hit/damage, if known */ | |
1253 | + if (object_is_known(o_ptr)) p_ptr->dis_to_h_b += (s16b)bonus_to_h; | |
1254 | + | |
1255 | + /* To Melee */ | |
1256 | + if ((i == INVEN_LEFT || i == INVEN_RIGHT) && !p_ptr->ryoute) | |
1257 | + { | |
1258 | + /* Apply the bonuses to hit/damage */ | |
1259 | + p_ptr->to_h[i - INVEN_RIGHT] += (s16b)bonus_to_h; | |
1260 | + p_ptr->to_d[i - INVEN_RIGHT] += (s16b)bonus_to_d; | |
1261 | + | |
1262 | + /* Apply the mental bonuses tp hit/damage, if known */ | |
1263 | + if (object_is_known(o_ptr)) | |
1264 | + { | |
1265 | + p_ptr->dis_to_h[i - INVEN_RIGHT] += (s16b)bonus_to_h; | |
1266 | + p_ptr->dis_to_d[i - INVEN_RIGHT] += (s16b)bonus_to_d; | |
1267 | + } | |
1268 | + } | |
1269 | + else if (p_ptr->migite && p_ptr->hidarite) | |
1270 | + { | |
1271 | + /* Apply the bonuses to hit/damage */ | |
1272 | + p_ptr->to_h[0] += (bonus_to_h > 0) ? (bonus_to_h + 1) / 2 : bonus_to_h; | |
1273 | + p_ptr->to_h[1] += (bonus_to_h > 0) ? bonus_to_h / 2 : bonus_to_h; | |
1274 | + p_ptr->to_d[0] += (bonus_to_d > 0) ? (bonus_to_d + 1) / 2 : bonus_to_d; | |
1275 | + p_ptr->to_d[1] += (bonus_to_d > 0) ? bonus_to_d / 2 : bonus_to_d; | |
1276 | + | |
1277 | + /* Apply the mental bonuses tp hit/damage, if known */ | |
1278 | + if (object_is_known(o_ptr)) | |
1279 | + { | |
1280 | + p_ptr->dis_to_h[0] += (bonus_to_h > 0) ? (bonus_to_h + 1) / 2 : bonus_to_h; | |
1281 | + p_ptr->dis_to_h[1] += (bonus_to_h > 0) ? bonus_to_h / 2 : bonus_to_h; | |
1282 | + p_ptr->dis_to_d[0] += (bonus_to_d > 0) ? (bonus_to_d + 1) / 2 : bonus_to_d; | |
1283 | + p_ptr->dis_to_d[1] += (bonus_to_d > 0) ? bonus_to_d / 2 : bonus_to_d; | |
1284 | + } | |
1285 | + } | |
1286 | + else | |
1287 | + { | |
1288 | + /* Apply the bonuses to hit/damage */ | |
1289 | + p_ptr->to_h[default_hand] += (s16b)bonus_to_h; | |
1290 | + p_ptr->to_d[default_hand] += (s16b)bonus_to_d; | |
1291 | + | |
1292 | + /* Apply the mental bonuses to hit/damage, if known */ | |
1293 | + if (object_is_known(o_ptr)) | |
1294 | + { | |
1295 | + p_ptr->dis_to_h[default_hand] += (s16b)bonus_to_h; | |
1296 | + p_ptr->dis_to_d[default_hand] += (s16b)bonus_to_d; | |
1297 | + } | |
1298 | + } | |
1299 | + } | |
1300 | + | |
1301 | + /* Shield skill bonus */ | |
1302 | + if (object_is_armour(&inventory[INVEN_RARM]) || object_is_armour(&inventory[INVEN_LARM])) | |
1303 | + { | |
1304 | + p_ptr->ac += p_ptr->skill_exp[GINOU_SHIELD] * (1 + p_ptr->lev / 22) / 2000; | |
1305 | + p_ptr->dis_ac += p_ptr->skill_exp[GINOU_SHIELD] * (1 + p_ptr->lev / 22) / 2000; | |
1306 | + } | |
1307 | + | |
1308 | + if (old_mighty_throw != p_ptr->mighty_throw) | |
1309 | + { | |
1310 | + /* Redraw average damege display of Shuriken */ | |
1311 | + p_ptr->window |= PW_INVEN; | |
1312 | + } | |
1313 | + | |
1314 | + if (p_ptr->cursed & TRC_TELEPORT) p_ptr->cursed &= ~(TRC_TELEPORT_SELF); | |
1315 | + | |
1316 | + /* Monks get extra ac for armour _not worn_ */ | |
1317 | + if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER)) && !heavy_armor()) | |
1318 | + { | |
1319 | + if (!(inventory[INVEN_BODY].k_idx)) | |
1320 | + { | |
1321 | + p_ptr->to_a += (p_ptr->lev * 3) / 2; | |
1322 | + p_ptr->dis_to_a += (p_ptr->lev * 3) / 2; | |
1323 | + } | |
1324 | + if (!(inventory[INVEN_OUTER].k_idx) && (p_ptr->lev > 15)) | |
1325 | + { | |
1326 | + p_ptr->to_a += ((p_ptr->lev - 13) / 3); | |
1327 | + p_ptr->dis_to_a += ((p_ptr->lev - 13) / 3); | |
1328 | + } | |
1329 | + if (!(inventory[INVEN_LARM].k_idx) && (p_ptr->lev > 10)) | |
1330 | + { | |
1331 | + p_ptr->to_a += ((p_ptr->lev - 8) / 3); | |
1332 | + p_ptr->dis_to_a += ((p_ptr->lev - 8) / 3); | |
1333 | + } | |
1334 | + if (!(inventory[INVEN_HEAD].k_idx) && (p_ptr->lev > 4)) | |
1335 | + { | |
1336 | + p_ptr->to_a += (p_ptr->lev - 2) / 3; | |
1337 | + p_ptr->dis_to_a += (p_ptr->lev - 2) / 3; | |
1338 | + } | |
1339 | + if (!(inventory[INVEN_HANDS].k_idx)) | |
1340 | + { | |
1341 | + p_ptr->to_a += (p_ptr->lev / 2); | |
1342 | + p_ptr->dis_to_a += (p_ptr->lev / 2); | |
1343 | + } | |
1344 | + if (!(inventory[INVEN_FEET].k_idx)) | |
1345 | + { | |
1346 | + p_ptr->to_a += (p_ptr->lev / 3); | |
1347 | + p_ptr->dis_to_a += (p_ptr->lev / 3); | |
1348 | + } | |
1349 | + if (p_ptr->special_defense & KAMAE_BYAKKO) | |
1350 | + { | |
1351 | + p_ptr->stat_add[A_STR] += 2; | |
1352 | + p_ptr->stat_add[A_DEX] += 2; | |
1353 | + p_ptr->stat_add[A_CON] -= 3; | |
1354 | + } | |
1355 | + else if (p_ptr->special_defense & KAMAE_SEIRYU) | |
1356 | + { | |
1357 | + } | |
1358 | + else if (p_ptr->special_defense & KAMAE_GENBU) | |
1359 | + { | |
1360 | + p_ptr->stat_add[A_INT] -= 1; | |
1361 | + p_ptr->stat_add[A_WIS] -= 1; | |
1362 | + p_ptr->stat_add[A_DEX] -= 2; | |
1363 | + p_ptr->stat_add[A_CON] += 3; | |
1364 | + } | |
1365 | + else if (p_ptr->special_defense & KAMAE_SUZAKU) | |
1366 | + { | |
1367 | + p_ptr->stat_add[A_STR] -= 2; | |
1368 | + p_ptr->stat_add[A_INT] += 1; | |
1369 | + p_ptr->stat_add[A_WIS] += 1; | |
1370 | + p_ptr->stat_add[A_DEX] += 2; | |
1371 | + p_ptr->stat_add[A_CON] -= 2; | |
1372 | + } | |
1373 | + } | |
1374 | + | |
1375 | + if (p_ptr->special_defense & KATA_KOUKIJIN) | |
1376 | + { | |
1377 | + for (i = 0; i < A_MAX; i++) | |
1378 | + p_ptr->stat_add[i] += 5; | |
1379 | + p_ptr->to_a -= 50; | |
1380 | + p_ptr->dis_to_a -= 50; | |
1381 | + } | |
1382 | + | |
1383 | + /* Hack -- aura of fire also provides light */ | |
1384 | + if (p_ptr->sh_fire) p_ptr->lite = TRUE; | |
1385 | + | |
1386 | + /* Golems also get an intrinsic AC bonus */ | |
1387 | + if (prace_is_(RACE_GOLEM) || prace_is_(RACE_ANDROID)) | |
1388 | + { | |
1389 | + p_ptr->to_a += 10 + (p_ptr->lev * 2 / 5); | |
1390 | + p_ptr->dis_to_a += 10 + (p_ptr->lev * 2 / 5); | |
1391 | + } | |
1392 | + | |
1393 | + /* Hex bonuses */ | |
1394 | + if (p_ptr->realm1 == REALM_HEX) | |
1395 | + { | |
1396 | + if (hex_spelling_any()) p_ptr->skill_stl -= (1 + CASTING_HEX_NUM(p_ptr)); | |
1397 | + if (hex_spelling(HEX_DETECT_EVIL)) p_ptr->esp_evil = TRUE; | |
1398 | + if (hex_spelling(HEX_XTRA_MIGHT)) p_ptr->stat_add[A_STR] += 4; | |
1399 | + if (hex_spelling(HEX_BUILDING)) | |
1400 | + { | |
1401 | + p_ptr->stat_add[A_STR] += 4; | |
1402 | + p_ptr->stat_add[A_DEX] += 4; | |
1403 | + p_ptr->stat_add[A_CON] += 4; | |
1404 | + } | |
1405 | + if (hex_spelling(HEX_DEMON_AURA)) | |
1406 | + { | |
1407 | + p_ptr->sh_fire = TRUE; | |
1408 | + p_ptr->regenerate = TRUE; | |
1409 | + } | |
1410 | + if (hex_spelling(HEX_ICE_ARMOR)) | |
1411 | + { | |
1412 | + p_ptr->sh_cold = TRUE; | |
1413 | + p_ptr->to_a += 30; | |
1414 | + p_ptr->dis_to_a += 30; | |
1415 | + } | |
1416 | + if (hex_spelling(HEX_SHOCK_CLOAK)) | |
1417 | + { | |
1418 | + p_ptr->sh_elec = TRUE; | |
1419 | + new_speed += 3; | |
1420 | + } | |
1421 | + for (i = INVEN_RARM; i <= INVEN_FEET; i++) | |
1422 | + { | |
1423 | + ARMOUR_CLASS ac = 0; | |
1424 | + o_ptr = &inventory[i]; | |
1425 | + if (!o_ptr->k_idx) continue; | |
1426 | + if (!object_is_armour(o_ptr)) continue; | |
1427 | + if (!object_is_cursed(o_ptr)) continue; | |
1428 | + ac += 5; | |
1429 | + if (o_ptr->curse_flags & TRC_HEAVY_CURSE) ac += 7; | |
1430 | + if (o_ptr->curse_flags & TRC_PERMA_CURSE) ac += 13; | |
1431 | + p_ptr->to_a += (s16b)ac; | |
1432 | + p_ptr->dis_to_a += (s16b)ac; | |
1433 | + } | |
1434 | + } | |
1435 | + | |
1436 | + /* Calculate stats */ | |
1437 | + for (i = 0; i < A_MAX; i++) | |
1438 | + { | |
1439 | + int top, use, ind; | |
1440 | + | |
1441 | + /* Extract the new "stat_use" value for the stat */ | |
1442 | + top = modify_stat_value(p_ptr->stat_max[i], p_ptr->stat_add[i]); | |
1443 | + | |
1444 | + /* Notice changes */ | |
1445 | + if (p_ptr->stat_top[i] != top) | |
1446 | + { | |
1447 | + /* Save the new value */ | |
1448 | + p_ptr->stat_top[i] = (s16b)top; | |
1449 | + | |
1450 | + /* Redisplay the stats later */ | |
1451 | + p_ptr->redraw |= (PR_STATS); | |
1452 | + | |
1453 | + p_ptr->window |= (PW_PLAYER); | |
1454 | + } | |
1455 | + | |
1456 | + | |
1457 | + /* Extract the new "stat_use" value for the stat */ | |
1458 | + use = modify_stat_value(p_ptr->stat_cur[i], p_ptr->stat_add[i]); | |
1459 | + | |
1460 | + if ((i == A_CHR) && (p_ptr->muta3 & MUT3_ILL_NORM)) | |
1461 | + { | |
1462 | + /* 10 to 18/90 charisma, guaranteed, based on level */ | |
1463 | + if (use < 8 + 2 * p_ptr->lev) | |
1464 | + { | |
1465 | + use = 8 + 2 * p_ptr->lev; | |
1466 | + } | |
1467 | + } | |
1468 | + | |
1469 | + /* Notice changes */ | |
1470 | + if (p_ptr->stat_use[i] != use) | |
1471 | + { | |
1472 | + /* Save the new value */ | |
1473 | + p_ptr->stat_use[i] = (s16b)use; | |
1474 | + | |
1475 | + /* Redisplay the stats later */ | |
1476 | + p_ptr->redraw |= (PR_STATS); | |
1477 | + | |
1478 | + p_ptr->window |= (PW_PLAYER); | |
1479 | + } | |
1480 | + | |
1481 | + | |
1482 | + /* Values: 3, 4, ..., 17 */ | |
1483 | + if (use <= 18) ind = (use - 3); | |
1484 | + | |
1485 | + /* Ranges: 18/00-18/09, ..., 18/210-18/219 */ | |
1486 | + else if (use <= 18 + 219) ind = (15 + (use - 18) / 10); | |
1487 | + | |
1488 | + /* Range: 18/220+ */ | |
1489 | + else ind = (37); | |
1490 | + | |
1491 | + /* Notice changes */ | |
1492 | + if (p_ptr->stat_ind[i] != ind) | |
1493 | + { | |
1494 | + /* Save the new index */ | |
1495 | + p_ptr->stat_ind[i] = (s16b)ind; | |
1496 | + | |
1497 | + /* Change in CON affects Hitpoints */ | |
1498 | + if (i == A_CON) | |
1499 | + { | |
1500 | + p_ptr->update |= (PU_HP); | |
1501 | + } | |
1502 | + | |
1503 | + /* Change in INT may affect Mana/Spells */ | |
1504 | + else if (i == A_INT) | |
1505 | + { | |
1506 | + if (mp_ptr->spell_stat == A_INT) | |
1507 | + { | |
1508 | + p_ptr->update |= (PU_MANA | PU_SPELLS); | |
1509 | + } | |
1510 | + } | |
1511 | + | |
1512 | + /* Change in WIS may affect Mana/Spells */ | |
1513 | + else if (i == A_WIS) | |
1514 | + { | |
1515 | + if (mp_ptr->spell_stat == A_WIS) | |
1516 | + { | |
1517 | + p_ptr->update |= (PU_MANA | PU_SPELLS); | |
1518 | + } | |
1519 | + } | |
1520 | + | |
1521 | + /* Change in WIS may affect Mana/Spells */ | |
1522 | + else if (i == A_CHR) | |
1523 | + { | |
1524 | + if (mp_ptr->spell_stat == A_CHR) | |
1525 | + { | |
1526 | + p_ptr->update |= (PU_MANA | PU_SPELLS); | |
1527 | + } | |
1528 | + } | |
1529 | + | |
1530 | + p_ptr->window |= (PW_PLAYER); | |
1531 | + } | |
1532 | + } | |
1533 | + | |
1534 | + | |
1535 | + /* Apply temporary "stun" */ | |
1536 | + if (p_ptr->stun > 50) | |
1537 | + { | |
1538 | + p_ptr->to_h[0] -= 20; | |
1539 | + p_ptr->to_h[1] -= 20; | |
1540 | + p_ptr->to_h_b -= 20; | |
1541 | + p_ptr->to_h_m -= 20; | |
1542 | + p_ptr->dis_to_h[0] -= 20; | |
1543 | + p_ptr->dis_to_h[1] -= 20; | |
1544 | + p_ptr->dis_to_h_b -= 20; | |
1545 | + p_ptr->to_d[0] -= 20; | |
1546 | + p_ptr->to_d[1] -= 20; | |
1547 | + p_ptr->to_d_m -= 20; | |
1548 | + p_ptr->dis_to_d[0] -= 20; | |
1549 | + p_ptr->dis_to_d[1] -= 20; | |
1550 | + } | |
1551 | + else if (p_ptr->stun) | |
1552 | + { | |
1553 | + p_ptr->to_h[0] -= 5; | |
1554 | + p_ptr->to_h[1] -= 5; | |
1555 | + p_ptr->to_h_b -= 5; | |
1556 | + p_ptr->to_h_m -= 5; | |
1557 | + p_ptr->dis_to_h[0] -= 5; | |
1558 | + p_ptr->dis_to_h[1] -= 5; | |
1559 | + p_ptr->dis_to_h_b -= 5; | |
1560 | + p_ptr->to_d[0] -= 5; | |
1561 | + p_ptr->to_d[1] -= 5; | |
1562 | + p_ptr->to_d_m -= 5; | |
1563 | + p_ptr->dis_to_d[0] -= 5; | |
1564 | + p_ptr->dis_to_d[1] -= 5; | |
1565 | + } | |
1566 | + | |
1567 | + /* Wraith form */ | |
1568 | + if (p_ptr->wraith_form) | |
1569 | + { | |
1570 | + p_ptr->reflect = TRUE; | |
1571 | + p_ptr->pass_wall = TRUE; | |
1572 | + } | |
1573 | + | |
1574 | + if (p_ptr->kabenuke) | |
1575 | + { | |
1576 | + p_ptr->pass_wall = TRUE; | |
1577 | + } | |
1578 | + | |
1579 | + /* Temporary blessing */ | |
1580 | + if (IS_BLESSED()) | |
1581 | + { | |
1582 | + p_ptr->to_a += 5; | |
1583 | + p_ptr->dis_to_a += 5; | |
1584 | + p_ptr->to_h[0] += 10; | |
1585 | + p_ptr->to_h[1] += 10; | |
1586 | + p_ptr->to_h_b += 10; | |
1587 | + p_ptr->to_h_m += 10; | |
1588 | + p_ptr->dis_to_h[0] += 10; | |
1589 | + p_ptr->dis_to_h[1] += 10; | |
1590 | + p_ptr->dis_to_h_b += 10; | |
1591 | + } | |
1592 | + | |
1593 | + if (p_ptr->magicdef) | |
1594 | + { | |
1595 | + p_ptr->resist_blind = TRUE; | |
1596 | + p_ptr->resist_conf = TRUE; | |
1597 | + p_ptr->reflect = TRUE; | |
1598 | + p_ptr->free_act = TRUE; | |
1599 | + p_ptr->levitation = TRUE; | |
1600 | + } | |
1601 | + | |
1602 | + /* Temporary "Hero" */ | |
1603 | + if (IS_HERO()) | |
1604 | + { | |
1605 | + p_ptr->to_h[0] += 12; | |
1606 | + p_ptr->to_h[1] += 12; | |
1607 | + p_ptr->to_h_b += 12; | |
1608 | + p_ptr->to_h_m += 12; | |
1609 | + p_ptr->dis_to_h[0] += 12; | |
1610 | + p_ptr->dis_to_h[1] += 12; | |
1611 | + p_ptr->dis_to_h_b += 12; | |
1612 | + } | |
1613 | + | |
1614 | + /* Temporary "Beserk" */ | |
1615 | + if (p_ptr->shero) | |
1616 | + { | |
1617 | + p_ptr->to_h[0] += 12; | |
1618 | + p_ptr->to_h[1] += 12; | |
1619 | + p_ptr->to_h_b -= 12; | |
1620 | + p_ptr->to_h_m += 12; | |
1621 | + p_ptr->to_d[0] += 3 + (p_ptr->lev / 5); | |
1622 | + p_ptr->to_d[1] += 3 + (p_ptr->lev / 5); | |
1623 | + p_ptr->to_d_m += 3 + (p_ptr->lev / 5); | |
1624 | + p_ptr->dis_to_h[0] += 12; | |
1625 | + p_ptr->dis_to_h[1] += 12; | |
1626 | + p_ptr->dis_to_h_b -= 12; | |
1627 | + p_ptr->dis_to_d[0] += 3 + (p_ptr->lev / 5); | |
1628 | + p_ptr->dis_to_d[1] += 3 + (p_ptr->lev / 5); | |
1629 | + p_ptr->to_a -= 10; | |
1630 | + p_ptr->dis_to_a -= 10; | |
1631 | + p_ptr->skill_stl -= 7; | |
1632 | + p_ptr->skill_dev -= 20; | |
1633 | + p_ptr->skill_sav -= 30; | |
1634 | + p_ptr->skill_srh -= 15; | |
1635 | + p_ptr->skill_fos -= 15; | |
1636 | + p_ptr->skill_tht -= 20; | |
1637 | + p_ptr->skill_dig += 30; | |
1638 | + } | |
1639 | + | |
1640 | + /* Temporary "fast" */ | |
1641 | + if (IS_FAST()) | |
1642 | + { | |
1643 | + new_speed += 10; | |
1644 | + } | |
1645 | + | |
1646 | + /* Temporary "slow" */ | |
1647 | + if (p_ptr->slow) | |
1648 | + { | |
1649 | + new_speed -= 10; | |
1650 | + } | |
1651 | + | |
1652 | + /* Temporary "telepathy" */ | |
1653 | + if (IS_TIM_ESP()) | |
1654 | + { | |
1655 | + p_ptr->telepathy = TRUE; | |
1656 | + } | |
1657 | + | |
1658 | + if (p_ptr->ele_immune) | |
1659 | + { | |
1660 | + if (p_ptr->special_defense & DEFENSE_ACID) | |
1661 | + p_ptr->immune_acid = TRUE; | |
1662 | + else if (p_ptr->special_defense & DEFENSE_ELEC) | |
1663 | + p_ptr->immune_elec = TRUE; | |
1664 | + else if (p_ptr->special_defense & DEFENSE_FIRE) | |
1665 | + p_ptr->immune_fire = TRUE; | |
1666 | + else if (p_ptr->special_defense & DEFENSE_COLD) | |
1667 | + p_ptr->immune_cold = TRUE; | |
1668 | + } | |
1669 | + | |
1670 | + /* Temporary see invisible */ | |
1671 | + if (p_ptr->tim_invis) | |
1672 | + { | |
1673 | + p_ptr->see_inv = TRUE; | |
1674 | + } | |
1675 | + | |
1676 | + /* Temporary infravision boost */ | |
1677 | + if (p_ptr->tim_infra) | |
1678 | + { | |
1679 | + p_ptr->see_infra += 3; | |
1680 | + } | |
1681 | + | |
1682 | + /* Temporary regeneration boost */ | |
1683 | + if (p_ptr->tim_regen) | |
1684 | + { | |
1685 | + p_ptr->regenerate = TRUE; | |
1686 | + } | |
1687 | + | |
1688 | + /* Temporary levitation */ | |
1689 | + if (p_ptr->tim_levitation) | |
1690 | + { | |
1691 | + p_ptr->levitation = TRUE; | |
1692 | + } | |
1693 | + | |
1694 | + /* Temporary reflection */ | |
1695 | + if (p_ptr->tim_reflect) | |
1696 | + { | |
1697 | + p_ptr->reflect = TRUE; | |
1698 | + } | |
1699 | + | |
1700 | + /* Hack -- Hero/Shero -> Res fear */ | |
1701 | + if (IS_HERO() || p_ptr->shero) | |
1702 | + { | |
1703 | + p_ptr->resist_fear = TRUE; | |
1704 | + } | |
1705 | + | |
1706 | + | |
1707 | + /* Hack -- Telepathy Change */ | |
1708 | + if (p_ptr->telepathy != old_telepathy) | |
1709 | + { | |
1710 | + p_ptr->update |= (PU_MONSTERS); | |
1711 | + } | |
1712 | + | |
1713 | + if ((p_ptr->esp_animal != old_esp_animal) || | |
1714 | + (p_ptr->esp_undead != old_esp_undead) || | |
1715 | + (p_ptr->esp_demon != old_esp_demon) || | |
1716 | + (p_ptr->esp_orc != old_esp_orc) || | |
1717 | + (p_ptr->esp_troll != old_esp_troll) || | |
1718 | + (p_ptr->esp_giant != old_esp_giant) || | |
1719 | + (p_ptr->esp_dragon != old_esp_dragon) || | |
1720 | + (p_ptr->esp_human != old_esp_human) || | |
1721 | + (p_ptr->esp_evil != old_esp_evil) || | |
1722 | + (p_ptr->esp_good != old_esp_good) || | |
1723 | + (p_ptr->esp_nonliving != old_esp_nonliving) || | |
1724 | + (p_ptr->esp_unique != old_esp_unique)) | |
1725 | + { | |
1726 | + p_ptr->update |= (PU_MONSTERS); | |
1727 | + } | |
1728 | + | |
1729 | + /* Hack -- See Invis Change */ | |
1730 | + if (p_ptr->see_inv != old_see_inv) | |
1731 | + { | |
1732 | + p_ptr->update |= (PU_MONSTERS); | |
1733 | + } | |
1734 | + | |
1735 | + /* Bloating slows the player down (a little) */ | |
1736 | + if (p_ptr->food >= PY_FOOD_MAX) new_speed -= 10; | |
1737 | + | |
1738 | + if (p_ptr->special_defense & KAMAE_SUZAKU) new_speed += 10; | |
1739 | + | |
1740 | + if ((p_ptr->migite && (empty_hands_status & EMPTY_HAND_RARM)) || | |
1741 | + (p_ptr->hidarite && (empty_hands_status & EMPTY_HAND_LARM))) | |
1742 | + { | |
1743 | + p_ptr->to_h[default_hand] += (p_ptr->skill_exp[GINOU_SUDE] - WEAPON_EXP_BEGINNER) / 200; | |
1744 | + p_ptr->dis_to_h[default_hand] += (p_ptr->skill_exp[GINOU_SUDE] - WEAPON_EXP_BEGINNER) / 200; | |
1745 | + } | |
1746 | + | |
1747 | + if (buki_motteruka(INVEN_RARM) && buki_motteruka(INVEN_LARM)) | |
1748 | + { | |
1749 | + int penalty1, penalty2; | |
1750 | + penalty1 = ((100 - p_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - inventory[INVEN_RARM].weight) / 8); | |
1751 | + penalty2 = ((100 - p_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - inventory[INVEN_LARM].weight) / 8); | |
1752 | + if ((inventory[INVEN_RARM].name1 == ART_QUICKTHORN) && (inventory[INVEN_LARM].name1 == ART_TINYTHORN)) | |
1753 | + { | |
1754 | + penalty1 = penalty1 / 2 - 5; | |
1755 | + penalty2 = penalty2 / 2 - 5; | |
1756 | + new_speed += 7; | |
1757 | + p_ptr->to_a += 10; | |
1758 | + p_ptr->dis_to_a += 10; | |
1759 | + } | |
1760 | + if (easy_2weapon) | |
1761 | + { | |
1762 | + if (penalty1 > 0) penalty1 /= 2; | |
1763 | + if (penalty2 > 0) penalty2 /= 2; | |
1764 | + } | |
1765 | + else if ((inventory[INVEN_LARM].tval == TV_SWORD) && ((inventory[INVEN_LARM].sval == SV_MAIN_GAUCHE) || (inventory[INVEN_LARM].sval == SV_WAKIZASHI))) | |
1766 | + { | |
1767 | + penalty1 = MAX(0, penalty1 - 10); | |
1768 | + penalty2 = MAX(0, penalty2 - 10); | |
1769 | + } | |
1770 | + if ((inventory[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (inventory[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI)) | |
1771 | + { | |
1772 | + penalty1 = MIN(0, penalty1); | |
1773 | + penalty2 = MIN(0, penalty2); | |
1774 | + p_ptr->to_a += 10; | |
1775 | + p_ptr->dis_to_a += 10; | |
1776 | + } | |
1777 | + else | |
1778 | + { | |
1779 | + if ((inventory[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (penalty1 > 0)) | |
1780 | + penalty1 /= 2; | |
1781 | + if ((inventory[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI) && (penalty2 > 0)) | |
1782 | + penalty2 /= 2; | |
1783 | + } | |
1784 | + if (inventory[INVEN_RARM].tval == TV_POLEARM) penalty1 += 10; | |
1785 | + if (inventory[INVEN_LARM].tval == TV_POLEARM) penalty2 += 10; | |
1786 | + p_ptr->to_h[0] -= (s16b)penalty1; | |
1787 | + p_ptr->to_h[1] -= (s16b)penalty2; | |
1788 | + p_ptr->dis_to_h[0] -= (s16b)penalty1; | |
1789 | + p_ptr->dis_to_h[1] -= (s16b)penalty2; | |
1790 | + } | |
1791 | + | |
1792 | + /* Extract the current weight (in tenth pounds) */ | |
1793 | + j = p_ptr->total_weight; | |
1794 | + | |
1795 | + if (!p_ptr->riding) | |
1796 | + { | |
1797 | + /* Extract the "weight limit" (in tenth pounds) */ | |
1798 | + i = (int)weight_limit(); | |
1799 | + } | |
1800 | + else | |
1801 | + { | |
1802 | + monster_type *riding_m_ptr = &m_list[p_ptr->riding]; | |
1803 | + monster_race *riding_r_ptr = &r_info[riding_m_ptr->r_idx]; | |
1804 | + SPEED speed = riding_m_ptr->mspeed; | |
1805 | + | |
1806 | + if (riding_m_ptr->mspeed > 110) | |
1807 | + { | |
1808 | + new_speed = 110 + (s16b)((speed - 110) * (p_ptr->skill_exp[GINOU_RIDING] * 3 + p_ptr->lev * 160L - 10000L) / (22000L)); | |
1809 | + if (new_speed < 110) new_speed = 110; | |
1810 | + } | |
1811 | + else | |
1812 | + { | |
1813 | + new_speed = speed; | |
1814 | + } | |
1815 | + new_speed += (p_ptr->skill_exp[GINOU_RIDING] + p_ptr->lev * 160L) / 3200; | |
1816 | + if (MON_FAST(riding_m_ptr)) new_speed += 10; | |
1817 | + if (MON_SLOW(riding_m_ptr)) new_speed -= 10; | |
1818 | + riding_levitation = (riding_r_ptr->flags7 & RF7_CAN_FLY) ? TRUE : FALSE; | |
1819 | + if (riding_r_ptr->flags7 & (RF7_CAN_SWIM | RF7_AQUATIC)) p_ptr->can_swim = TRUE; | |
1820 | + | |
1821 | + if (!(riding_r_ptr->flags2 & RF2_PASS_WALL)) p_ptr->pass_wall = FALSE; | |
1822 | + if (riding_r_ptr->flags2 & RF2_KILL_WALL) p_ptr->kill_wall = TRUE; | |
1823 | + | |
1824 | + if (p_ptr->skill_exp[GINOU_RIDING] < RIDING_EXP_SKILLED) j += (p_ptr->wt * 3 * (RIDING_EXP_SKILLED - p_ptr->skill_exp[GINOU_RIDING])) / RIDING_EXP_SKILLED; | |
1825 | + | |
1826 | + /* Extract the "weight limit" */ | |
1827 | + i = 1500 + riding_r_ptr->level * 25; | |
1828 | + } | |
1829 | + | |
1830 | + /* Apply "encumbrance" from weight */ | |
1831 | + if (j > i) new_speed -= ((j - i) / (i / 5)); | |
1832 | + | |
1833 | + /* Searching slows the player down */ | |
1834 | + if (p_ptr->action == ACTION_SEARCH) new_speed -= 10; | |
1835 | + | |
1836 | + /* Feature bonus */ | |
1837 | + if (p_ptr->prace == RACE_MERFOLK) | |
1838 | + { | |
1839 | + if (have_flag(f_ptr->flags, FF_WATER)) | |
1840 | + { | |
1841 | + new_speed += (2 + p_ptr->lev / 10); | |
1842 | + } | |
1843 | + else if (!p_ptr->levitation) | |
1844 | + { | |
1845 | + new_speed -= 2; | |
1846 | + } | |
1847 | + } | |
1848 | + | |
1849 | + | |
1850 | + /* Actual Modifier Bonuses (Un-inflate stat bonuses) */ | |
1851 | + p_ptr->to_a += ((int)(adj_dex_ta[p_ptr->stat_ind[A_DEX]]) - 128); | |
1852 | + p_ptr->to_d[0] += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128); | |
1853 | + p_ptr->to_d[1] += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128); | |
1854 | + p_ptr->to_d_m += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128); | |
1855 | + p_ptr->to_h[0] += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128); | |
1856 | + p_ptr->to_h[1] += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128); | |
1857 | + p_ptr->to_h_b += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128); | |
1858 | + p_ptr->to_h_m += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128); | |
1859 | + p_ptr->to_h[0] += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128); | |
1860 | + p_ptr->to_h[1] += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128); | |
1861 | + p_ptr->to_h_b += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128); | |
1862 | + p_ptr->to_h_m += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128); | |
1863 | + | |
1864 | + /* Displayed Modifier Bonuses (Un-inflate stat bonuses) */ | |
1865 | + p_ptr->dis_to_a += ((int)(adj_dex_ta[p_ptr->stat_ind[A_DEX]]) - 128); | |
1866 | + p_ptr->dis_to_d[0] += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128); | |
1867 | + p_ptr->dis_to_d[1] += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128); | |
1868 | + p_ptr->dis_to_h[0] += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128); | |
1869 | + p_ptr->dis_to_h[1] += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128); | |
1870 | + p_ptr->dis_to_h_b += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128); | |
1871 | + p_ptr->dis_to_h[0] += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128); | |
1872 | + p_ptr->dis_to_h[1] += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128); | |
1873 | + p_ptr->dis_to_h_b += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128); | |
1874 | + | |
1875 | + | |
1876 | + /* Obtain the "hold" value */ | |
1877 | + hold = adj_str_hold[p_ptr->stat_ind[A_STR]]; | |
1878 | + | |
1879 | + | |
1880 | + /* Examine the "current bow" */ | |
1881 | + o_ptr = &inventory[INVEN_BOW]; | |
1882 | + | |
1883 | + /* It is hard to carholdry a heavy bow */ | |
1884 | + p_ptr->heavy_shoot = is_heavy_shoot(o_ptr); | |
1885 | + if (p_ptr->heavy_shoot) | |
1886 | + { | |
1887 | + /* Hard to wield a heavy bow */ | |
1888 | + p_ptr->to_h_b += 2 * (hold - o_ptr->weight / 10); | |
1889 | + p_ptr->dis_to_h_b += 2 * (hold - o_ptr->weight / 10); | |
1890 | + } | |
1891 | + | |
1892 | + /* Compute "extra shots" if needed */ | |
1893 | + if (o_ptr->k_idx) | |
1894 | + { | |
1895 | + p_ptr->tval_ammo = (byte_hack)bow_tval_ammo(o_ptr); | |
1896 | + | |
1897 | + /* Apply special flags */ | |
1898 | + if (o_ptr->k_idx && !p_ptr->heavy_shoot) | |
1899 | + { | |
1900 | + /* Extra shots */ | |
1901 | + p_ptr->num_fire = calc_num_fire(o_ptr); | |
1902 | + | |
1903 | + /* Snipers love Cross bows */ | |
1904 | + if ((p_ptr->pclass == CLASS_SNIPER) && | |
1905 | + (p_ptr->tval_ammo == TV_BOLT)) | |
1906 | + { | |
1907 | + p_ptr->to_h_b += (10 + (p_ptr->lev / 5)); | |
1908 | + p_ptr->dis_to_h_b += (10 + (p_ptr->lev / 5)); | |
1909 | + } | |
1910 | + } | |
1911 | + } | |
1912 | + | |
1913 | + if (p_ptr->ryoute) hold *= 2; | |
1914 | + | |
1915 | + for (i = 0; i < 2; i++) | |
1916 | + { | |
1917 | + /* Examine the "main weapon" */ | |
1918 | + o_ptr = &inventory[INVEN_RARM + i]; | |
1919 | + | |
1920 | + object_flags(o_ptr, flgs); | |
1921 | + | |
1922 | + /* Assume not heavy */ | |
1923 | + p_ptr->heavy_wield[i] = FALSE; | |
1924 | + p_ptr->icky_wield[i] = FALSE; | |
1925 | + p_ptr->riding_wield[i] = FALSE; | |
1926 | + | |
1927 | + if (!buki_motteruka(INVEN_RARM + i)) | |
1928 | + { | |
1929 | + p_ptr->num_blow[i] = 1; | |
1930 | + continue; | |
1931 | + } | |
1932 | + /* It is hard to hold a heavy weapon */ | |
1933 | + if (hold < o_ptr->weight / 10) | |
1934 | + { | |
1935 | + /* Hard to wield a heavy weapon */ | |
1936 | + p_ptr->to_h[i] += 2 * (hold - o_ptr->weight / 10); | |
1937 | + p_ptr->dis_to_h[i] += 2 * (hold - o_ptr->weight / 10); | |
1938 | + | |
1939 | + /* Heavy weapon */ | |
1940 | + p_ptr->heavy_wield[i] = TRUE; | |
1941 | + } | |
1942 | + else if (p_ptr->ryoute && (hold < o_ptr->weight / 5)) omoi = TRUE; | |
1943 | + | |
1944 | + if ((i == 1) && (o_ptr->tval == TV_SWORD) && ((o_ptr->sval == SV_MAIN_GAUCHE) || (o_ptr->sval == SV_WAKIZASHI))) | |
1945 | + { | |
1946 | + p_ptr->to_a += 5; | |
1947 | + p_ptr->dis_to_a += 5; | |
1948 | + } | |
1949 | + | |
1950 | + /* Normal weapons */ | |
1951 | + if (o_ptr->k_idx && !p_ptr->heavy_wield[i]) | |
1952 | + { | |
1953 | + int str_index, dex_index; | |
1954 | + | |
1955 | + int num = 0, wgt = 0, mul = 0, div = 0; | |
1956 | + | |
1957 | + /* Analyze the class */ | |
1958 | + switch (p_ptr->pclass) | |
1959 | + { | |
1960 | + /* Warrior */ | |
1961 | + case CLASS_WARRIOR: | |
1962 | + num = 6; wgt = 70; mul = 5; break; | |
1963 | + | |
1964 | + /* Berserker */ | |
1965 | + case CLASS_BERSERKER: | |
1966 | + num = 6; wgt = 70; mul = 7; break; | |
1967 | + | |
1968 | + /* Mage */ | |
1969 | + case CLASS_MAGE: | |
1970 | + case CLASS_HIGH_MAGE: | |
1971 | + case CLASS_BLUE_MAGE: | |
1972 | + num = 3; wgt = 100; mul = 2; break; | |
1973 | + | |
1974 | + /* Priest, Mindcrafter, Magic-Eater */ | |
1975 | + case CLASS_PRIEST: | |
1976 | + case CLASS_MAGIC_EATER: | |
1977 | + case CLASS_MINDCRAFTER: | |
1978 | + num = 5; wgt = 100; mul = 3; break; | |
1979 | + | |
1980 | + /* Rogue */ | |
1981 | + case CLASS_ROGUE: | |
1982 | + num = 5; wgt = 40; mul = 3; break; | |
1983 | + | |
1984 | + /* Ranger */ | |
1985 | + case CLASS_RANGER: | |
1986 | + num = 5; wgt = 70; mul = 4; break; | |
1987 | + | |
1988 | + /* Paladin */ | |
1989 | + case CLASS_PALADIN: | |
1990 | + case CLASS_SAMURAI: | |
1991 | + num = 5; wgt = 70; mul = 4; break; | |
1992 | + | |
1993 | + /* Weaponsmith */ | |
1994 | + case CLASS_SMITH: | |
1995 | + num = 5; wgt = 150; mul = 5; break; | |
1996 | + | |
1997 | + /* Warrior-Mage */ | |
1998 | + case CLASS_WARRIOR_MAGE: | |
1999 | + case CLASS_RED_MAGE: | |
2000 | + num = 5; wgt = 70; mul = 3; break; | |
2001 | + | |
2002 | + /* Chaos Warrior */ | |
2003 | + case CLASS_CHAOS_WARRIOR: | |
2004 | + num = 5; wgt = 70; mul = 4; break; | |
2005 | + | |
2006 | + /* Monk */ | |
2007 | + case CLASS_MONK: | |
2008 | + num = 5; wgt = 60; mul = 3; break; | |
2009 | + | |
2010 | + /* Tourist */ | |
2011 | + case CLASS_TOURIST: | |
2012 | + num = 4; wgt = 100; mul = 3; break; | |
2013 | + | |
2014 | + /* Imitator */ | |
2015 | + case CLASS_IMITATOR: | |
2016 | + num = 5; wgt = 70; mul = 4; break; | |
2017 | + | |
2018 | + /* Beastmaster */ | |
2019 | + case CLASS_BEASTMASTER: | |
2020 | + num = 5; wgt = 70; mul = 3; break; | |
2021 | + | |
2022 | + /* Cavalry */ | |
2023 | + case CLASS_CAVALRY: | |
2024 | + if ((p_ptr->riding) && (have_flag(flgs, TR_RIDING))) { num = 5; wgt = 70; mul = 4; } | |
2025 | + else { num = 5; wgt = 100; mul = 3; } | |
2026 | + break; | |
2027 | + | |
2028 | + /* Sorcerer */ | |
2029 | + case CLASS_SORCERER: | |
2030 | + num = 1; wgt = 1; mul = 1; break; | |
2031 | + | |
2032 | + /* Archer, Bard, Sniper */ | |
2033 | + case CLASS_ARCHER: | |
2034 | + case CLASS_BARD: | |
2035 | + case CLASS_SNIPER: | |
2036 | + num = 4; wgt = 70; mul = 2; break; | |
2037 | + | |
2038 | + /* ForceTrainer */ | |
2039 | + case CLASS_FORCETRAINER: | |
2040 | + num = 4; wgt = 60; mul = 2; break; | |
2041 | + | |
2042 | + /* Mirror Master */ | |
2043 | + case CLASS_MIRROR_MASTER: | |
2044 | + num = 3; wgt = 100; mul = 3; break; | |
2045 | + | |
2046 | + /* Ninja */ | |
2047 | + case CLASS_NINJA: | |
2048 | + num = 4; wgt = 20; mul = 1; break; | |
2049 | + } | |
2050 | + | |
2051 | + /* Hex - extra mights gives +1 bonus to max blows */ | |
2052 | + if (hex_spelling(HEX_XTRA_MIGHT) || hex_spelling(HEX_BUILDING)) { num++; wgt /= 2; mul += 2; } | |
2053 | + | |
2054 | + /* Enforce a minimum "weight" (tenth pounds) */ | |
2055 | + div = ((o_ptr->weight < wgt) ? wgt : o_ptr->weight); | |
2056 | + | |
2057 | + /* Access the strength vs weight */ | |
2058 | + str_index = (adj_str_blow[p_ptr->stat_ind[A_STR]] * mul / div); | |
2059 | + | |
2060 | + if (p_ptr->ryoute && !omoi) str_index++; | |
2061 | + if (p_ptr->pclass == CLASS_NINJA) str_index = MAX(0, str_index - 1); | |
2062 | + | |
2063 | + /* Maximal value */ | |
2064 | + if (str_index > 11) str_index = 11; | |
2065 | + | |
2066 | + /* Index by dexterity */ | |
2067 | + dex_index = (adj_dex_blow[p_ptr->stat_ind[A_DEX]]); | |
2068 | + | |
2069 | + /* Maximal value */ | |
2070 | + if (dex_index > 11) dex_index = 11; | |
2071 | + | |
2072 | + /* Use the blows table */ | |
2073 | + p_ptr->num_blow[i] = blows_table[str_index][dex_index]; | |
2074 | + | |
2075 | + /* Maximal value */ | |
2076 | + if (p_ptr->num_blow[i] > num) p_ptr->num_blow[i] = (s16b)num; | |
2077 | + | |
2078 | + /* Add in the "bonus blows" */ | |
2079 | + p_ptr->num_blow[i] += (s16b)extra_blows[i]; | |
2080 | + | |
2081 | + | |
2082 | + if (p_ptr->pclass == CLASS_WARRIOR) p_ptr->num_blow[i] += (p_ptr->lev / 40); | |
2083 | + else if (p_ptr->pclass == CLASS_BERSERKER) | |
2084 | + { | |
2085 | + p_ptr->num_blow[i] += (p_ptr->lev / 23); | |
2086 | + } | |
2087 | + else if ((p_ptr->pclass == CLASS_ROGUE) && (o_ptr->weight < 50) && (p_ptr->stat_ind[A_DEX] >= 30)) p_ptr->num_blow[i] ++; | |
2088 | + | |
2089 | + if (p_ptr->special_defense & KATA_FUUJIN) p_ptr->num_blow[i] -= 1; | |
2090 | + | |
2091 | + if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) p_ptr->num_blow[i] = 1; | |
2092 | + | |
2093 | + | |
2094 | + /* Require at least one blow */ | |
2095 | + if (p_ptr->num_blow[i] < 1) p_ptr->num_blow[i] = 1; | |
2096 | + | |
2097 | + /* Boost digging skill by weapon weight */ | |
2098 | + p_ptr->skill_dig += (o_ptr->weight / 10); | |
2099 | + } | |
2100 | + | |
2101 | + /* Assume okay */ | |
2102 | + /* Priest weapon penalty for non-blessed edged weapons */ | |
2103 | + if ((p_ptr->pclass == CLASS_PRIEST) && (!(have_flag(flgs, TR_BLESSED))) && | |
2104 | + ((o_ptr->tval == TV_SWORD) || (o_ptr->tval == TV_POLEARM))) | |
2105 | + { | |
2106 | + /* Reduce the real bonuses */ | |
2107 | + p_ptr->to_h[i] -= 2; | |
2108 | + p_ptr->to_d[i] -= 2; | |
2109 | + | |
2110 | + /* Reduce the mental bonuses */ | |
2111 | + p_ptr->dis_to_h[i] -= 2; | |
2112 | + p_ptr->dis_to_d[i] -= 2; | |
2113 | + | |
2114 | + /* Icky weapon */ | |
2115 | + p_ptr->icky_wield[i] = TRUE; | |
2116 | + } | |
2117 | + else if (p_ptr->pclass == CLASS_BERSERKER) | |
2118 | + { | |
2119 | + p_ptr->to_h[i] += p_ptr->lev / 5; | |
2120 | + p_ptr->to_d[i] += p_ptr->lev / 6; | |
2121 | + p_ptr->dis_to_h[i] += p_ptr->lev / 5; | |
2122 | + p_ptr->dis_to_d[i] += p_ptr->lev / 6; | |
2123 | + if (((i == 0) && !p_ptr->hidarite) || p_ptr->ryoute) | |
2124 | + { | |
2125 | + p_ptr->to_h[i] += p_ptr->lev / 5; | |
2126 | + p_ptr->to_d[i] += p_ptr->lev / 6; | |
2127 | + p_ptr->dis_to_h[i] += p_ptr->lev / 5; | |
2128 | + p_ptr->dis_to_d[i] += p_ptr->lev / 6; | |
2129 | + } | |
2130 | + } | |
2131 | + else if (p_ptr->pclass == CLASS_SORCERER) | |
2132 | + { | |
2133 | + if (!((o_ptr->tval == TV_HAFTED) && ((o_ptr->sval == SV_WIZSTAFF) || (o_ptr->sval == SV_NAMAKE_HAMMER)))) | |
2134 | + { | |
2135 | + /* Reduce the real bonuses */ | |
2136 | + p_ptr->to_h[i] -= 200; | |
2137 | + p_ptr->to_d[i] -= 200; | |
2138 | + | |
2139 | + /* Reduce the mental bonuses */ | |
2140 | + p_ptr->dis_to_h[i] -= 200; | |
2141 | + p_ptr->dis_to_d[i] -= 200; | |
2142 | + | |
2143 | + /* Icky weapon */ | |
2144 | + p_ptr->icky_wield[i] = TRUE; | |
2145 | + } | |
2146 | + else | |
2147 | + { | |
2148 | + /* Reduce the real bonuses */ | |
2149 | + p_ptr->to_h[i] -= 30; | |
2150 | + p_ptr->to_d[i] -= 10; | |
2151 | + | |
2152 | + /* Reduce the mental bonuses */ | |
2153 | + p_ptr->dis_to_h[i] -= 30; | |
2154 | + p_ptr->dis_to_d[i] -= 10; | |
2155 | + } | |
2156 | + } | |
2157 | + /* Hex bonuses */ | |
2158 | + if (p_ptr->realm1 == REALM_HEX) | |
2159 | + { | |
2160 | + if (object_is_cursed(o_ptr)) | |
2161 | + { | |
2162 | + if (o_ptr->curse_flags & (TRC_CURSED)) { p_ptr->to_h[i] += 5; p_ptr->dis_to_h[i] += 5; } | |
2163 | + if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) { p_ptr->to_h[i] += 7; p_ptr->dis_to_h[i] += 7; } | |
2164 | + if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) { p_ptr->to_h[i] += 13; p_ptr->dis_to_h[i] += 13; } | |
2165 | + if (o_ptr->curse_flags & (TRC_TY_CURSE)) { p_ptr->to_h[i] += 5; p_ptr->dis_to_h[i] += 5; } | |
2166 | + if (hex_spelling(HEX_RUNESWORD)) | |
2167 | + { | |
2168 | + if (o_ptr->curse_flags & (TRC_CURSED)) { p_ptr->to_d[i] += 5; p_ptr->dis_to_d[i] += 5; } | |
2169 | + if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) { p_ptr->to_d[i] += 7; p_ptr->dis_to_d[i] += 7; } | |
2170 | + if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) { p_ptr->to_d[i] += 13; p_ptr->dis_to_d[i] += 13; } | |
2171 | + } | |
2172 | + } | |
2173 | + } | |
2174 | + if (p_ptr->riding) | |
2175 | + { | |
2176 | + if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE))) | |
2177 | + { | |
2178 | + p_ptr->to_h[i] += 15; | |
2179 | + p_ptr->dis_to_h[i] += 15; | |
2180 | + p_ptr->to_dd[i] += 2; | |
2181 | + } | |
2182 | + else if (!(have_flag(flgs, TR_RIDING))) | |
2183 | + { | |
2184 | + int penalty; | |
2185 | + if ((p_ptr->pclass == CLASS_BEASTMASTER) || (p_ptr->pclass == CLASS_CAVALRY)) | |
2186 | + { | |
2187 | + penalty = 5; | |
2188 | + } | |
2189 | + else | |
2190 | + { | |
2191 | + penalty = r_info[m_list[p_ptr->riding].r_idx].level - p_ptr->skill_exp[GINOU_RIDING] / 80; | |
2192 | + penalty += 30; | |
2193 | + if (penalty < 30) penalty = 30; | |
2194 | + } | |
2195 | + p_ptr->to_h[i] -= (s16b)penalty; | |
2196 | + p_ptr->dis_to_h[i] -= (s16b)penalty; | |
2197 | + | |
2198 | + /* Riding weapon */ | |
2199 | + p_ptr->riding_wield[i] = TRUE; | |
2200 | + } | |
2201 | + } | |
2202 | + } | |
2203 | + | |
2204 | + if (p_ptr->riding) | |
2205 | + { | |
2206 | + int penalty = 0; | |
2207 | + | |
2208 | + p_ptr->riding_ryoute = FALSE; | |
2209 | + | |
2210 | + if (p_ptr->ryoute || (empty_hands(FALSE) == EMPTY_HAND_NONE)) p_ptr->riding_ryoute = TRUE; | |
2211 | + else if (p_ptr->pet_extra_flags & PF_RYOUTE) | |
2212 | + { | |
2213 | + switch (p_ptr->pclass) | |
2214 | + { | |
2215 | + case CLASS_MONK: | |
2216 | + case CLASS_FORCETRAINER: | |
2217 | + case CLASS_BERSERKER: | |
2218 | + if ((empty_hands(FALSE) != EMPTY_HAND_NONE) && !buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM)) | |
2219 | + p_ptr->riding_ryoute = TRUE; | |
2220 | + break; | |
2221 | + } | |
2222 | + } | |
2223 | + | |
2224 | + if ((p_ptr->pclass == CLASS_BEASTMASTER) || (p_ptr->pclass == CLASS_CAVALRY)) | |
2225 | + { | |
2226 | + if (p_ptr->tval_ammo != TV_ARROW) penalty = 5; | |
2227 | + } | |
2228 | + else | |
2229 | + { | |
2230 | + penalty = r_info[m_list[p_ptr->riding].r_idx].level - p_ptr->skill_exp[GINOU_RIDING] / 80; | |
2231 | + penalty += 30; | |
2232 | + if (penalty < 30) penalty = 30; | |
2233 | + } | |
2234 | + if (p_ptr->tval_ammo == TV_BOLT) penalty *= 2; | |
2235 | + p_ptr->to_h_b -= (s16b)penalty; | |
2236 | + p_ptr->dis_to_h_b -= (s16b)penalty; | |
2237 | + } | |
2238 | + | |
2239 | + /* Different calculation for monks with empty hands */ | |
2240 | + if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_BERSERKER)) && | |
2241 | + (empty_hands_status & EMPTY_HAND_RARM) && !p_ptr->hidarite) | |
2242 | + { | |
2243 | + int blow_base = p_ptr->lev + adj_dex_blow[p_ptr->stat_ind[A_DEX]]; | |
2244 | + p_ptr->num_blow[0] = 0; | |
2245 | + | |
2246 | + if (p_ptr->pclass == CLASS_FORCETRAINER) | |
2247 | + { | |
2248 | + if (blow_base > 18) p_ptr->num_blow[0]++; | |
2249 | + if (blow_base > 31) p_ptr->num_blow[0]++; | |
2250 | + if (blow_base > 44) p_ptr->num_blow[0]++; | |
2251 | + if (blow_base > 58) p_ptr->num_blow[0]++; | |
2252 | + if (P_PTR_KI) | |
2253 | + { | |
2254 | + p_ptr->to_d[0] += P_PTR_KI / 5; | |
2255 | + p_ptr->dis_to_d[0] += P_PTR_KI / 5; | |
2256 | + } | |
2257 | + } | |
2258 | + else | |
2259 | + { | |
2260 | + if (blow_base > 12) p_ptr->num_blow[0]++; | |
2261 | + if (blow_base > 22) p_ptr->num_blow[0]++; | |
2262 | + if (blow_base > 31) p_ptr->num_blow[0]++; | |
2263 | + if (blow_base > 39) p_ptr->num_blow[0]++; | |
2264 | + if (blow_base > 46) p_ptr->num_blow[0]++; | |
2265 | + if (blow_base > 53) p_ptr->num_blow[0]++; | |
2266 | + if (blow_base > 59) p_ptr->num_blow[0]++; | |
2267 | + } | |
2268 | + | |
2269 | + if (heavy_armor() && (p_ptr->pclass != CLASS_BERSERKER)) | |
2270 | + p_ptr->num_blow[0] /= 2; | |
2271 | + else | |
2272 | + { | |
2273 | + p_ptr->to_h[0] += (p_ptr->lev / 3); | |
2274 | + p_ptr->dis_to_h[0] += (p_ptr->lev / 3); | |
2275 | + | |
2276 | + p_ptr->to_d[0] += (p_ptr->lev / 6); | |
2277 | + p_ptr->dis_to_d[0] += (p_ptr->lev / 6); | |
2278 | + } | |
2279 | + | |
2280 | + if (p_ptr->special_defense & KAMAE_BYAKKO) | |
2281 | + { | |
2282 | + p_ptr->to_a -= 40; | |
2283 | + p_ptr->dis_to_a -= 40; | |
2284 | + | |
2285 | + } | |
2286 | + else if (p_ptr->special_defense & KAMAE_SEIRYU) | |
2287 | + { | |
2288 | + p_ptr->to_a -= 50; | |
2289 | + p_ptr->dis_to_a -= 50; | |
2290 | + p_ptr->resist_acid = TRUE; | |
2291 | + p_ptr->resist_fire = TRUE; | |
2292 | + p_ptr->resist_elec = TRUE; | |
2293 | + p_ptr->resist_cold = TRUE; | |
2294 | + p_ptr->resist_pois = TRUE; | |
2295 | + p_ptr->sh_fire = TRUE; | |
2296 | + p_ptr->sh_elec = TRUE; | |
2297 | + p_ptr->sh_cold = TRUE; | |
2298 | + p_ptr->levitation = TRUE; | |
2299 | + } | |
2300 | + else if (p_ptr->special_defense & KAMAE_GENBU) | |
2301 | + { | |
2302 | + p_ptr->to_a += (p_ptr->lev*p_ptr->lev) / 50; | |
2303 | + p_ptr->dis_to_a += (p_ptr->lev*p_ptr->lev) / 50; | |
2304 | + p_ptr->reflect = TRUE; | |
2305 | + p_ptr->num_blow[0] -= 2; | |
2306 | + if ((p_ptr->pclass == CLASS_MONK) && (p_ptr->lev > 42)) p_ptr->num_blow[0]--; | |
2307 | + if (p_ptr->num_blow[0] < 0) p_ptr->num_blow[0] = 0; | |
2308 | + } | |
2309 | + else if (p_ptr->special_defense & KAMAE_SUZAKU) | |
2310 | + { | |
2311 | + p_ptr->to_h[0] -= (p_ptr->lev / 3); | |
2312 | + p_ptr->to_d[0] -= (p_ptr->lev / 6); | |
2313 | + | |
2314 | + p_ptr->dis_to_h[0] -= (p_ptr->lev / 3); | |
2315 | + p_ptr->dis_to_d[0] -= (p_ptr->lev / 6); | |
2316 | + p_ptr->num_blow[0] /= 2; | |
2317 | + p_ptr->levitation = TRUE; | |
2318 | + } | |
2319 | + | |
2320 | + p_ptr->num_blow[0] += 1 + extra_blows[0]; | |
2321 | + } | |
2322 | + | |
2323 | + if (p_ptr->riding) p_ptr->levitation = riding_levitation; | |
2324 | + | |
2325 | + monk_armour_aux = FALSE; | |
2326 | + | |
2327 | + if (heavy_armor()) | |
2328 | + { | |
2329 | + monk_armour_aux = TRUE; | |
2330 | + } | |
2331 | + | |
2332 | + for (i = 0; i < 2; i++) | |
2333 | + { | |
2334 | + if (buki_motteruka(INVEN_RARM + i)) | |
2335 | + { | |
2336 | + OBJECT_TYPE_VALUE tval = inventory[INVEN_RARM + i].tval - TV_WEAPON_BEGIN; | |
2337 | + OBJECT_SUBTYPE_VALUE sval = inventory[INVEN_RARM + i].sval; | |
2338 | + | |
2339 | + p_ptr->to_h[i] += (p_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200; | |
2340 | + p_ptr->dis_to_h[i] += (p_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200; | |
2341 | + if ((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER)) | |
2342 | + { | |
2343 | + if (!s_info[p_ptr->pclass].w_max[tval][sval]) | |
2344 | + { | |
2345 | + p_ptr->to_h[i] -= 40; | |
2346 | + p_ptr->dis_to_h[i] -= 40; | |
2347 | + p_ptr->icky_wield[i] = TRUE; | |
2348 | + } | |
2349 | + } | |
2350 | + else if (p_ptr->pclass == CLASS_NINJA) | |
2351 | + { | |
2352 | + if ((s_info[CLASS_NINJA].w_max[tval][sval] <= WEAPON_EXP_BEGINNER) || (inventory[INVEN_LARM - i].tval == TV_SHIELD)) | |
2353 | + { | |
2354 | + p_ptr->to_h[i] -= 40; | |
2355 | + p_ptr->dis_to_h[i] -= 40; | |
2356 | + p_ptr->icky_wield[i] = TRUE; | |
2357 | + p_ptr->num_blow[i] /= 2; | |
2358 | + if (p_ptr->num_blow[i] < 1) p_ptr->num_blow[i] = 1; | |
2359 | + } | |
2360 | + } | |
2361 | + | |
2362 | + if (inventory[INVEN_RARM + i].name1 == ART_IRON_BALL) p_ptr->align -= 1000; | |
2363 | + } | |
2364 | + } | |
2365 | + | |
2366 | + /* Maximum speed is (+99). (internally it's 110 + 99) */ | |
2367 | + /* Temporary lightspeed forces to be maximum speed */ | |
2368 | + if ((p_ptr->lightspeed && !p_ptr->riding) || (new_speed > 209)) | |
2369 | + { | |
2370 | + new_speed = 209; | |
2371 | + } | |
2372 | + | |
2373 | + /* Minimum speed is (-99). (internally it's 110 - 99) */ | |
2374 | + if (new_speed < 11) new_speed = 11; | |
2375 | + | |
2376 | + /* Display the speed (if needed) */ | |
2377 | + if (p_ptr->pspeed != (byte)new_speed) | |
2378 | + { | |
2379 | + p_ptr->pspeed = (byte)new_speed; | |
2380 | + p_ptr->redraw |= (PR_SPEED); | |
2381 | + } | |
2382 | + | |
2383 | + if (yoiyami) | |
2384 | + { | |
2385 | + if (p_ptr->to_a > (0 - p_ptr->ac)) | |
2386 | + p_ptr->to_a = 0 - p_ptr->ac; | |
2387 | + if (p_ptr->dis_to_a > (0 - p_ptr->dis_ac)) | |
2388 | + p_ptr->dis_to_a = 0 - p_ptr->dis_ac; | |
2389 | + } | |
2390 | + | |
2391 | + /* Redraw armor (if needed) */ | |
2392 | + if ((p_ptr->dis_ac != old_dis_ac) || (p_ptr->dis_to_a != old_dis_to_a)) | |
2393 | + { | |
2394 | + p_ptr->redraw |= (PR_ARMOR); | |
2395 | + p_ptr->window |= (PW_PLAYER); | |
2396 | + } | |
2397 | + | |
2398 | + if (p_ptr->ryoute && !omoi) | |
2399 | + { | |
2400 | + int bonus_to_h = 0, bonus_to_d = 0; | |
2401 | + bonus_to_d = ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128) / 2; | |
2402 | + bonus_to_h = ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128) + ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128); | |
2403 | + | |
2404 | + p_ptr->to_h[default_hand] += MAX(bonus_to_h, 1); | |
2405 | + p_ptr->dis_to_h[default_hand] += MAX(bonus_to_h, 1); | |
2406 | + p_ptr->to_d[default_hand] += MAX(bonus_to_d, 1); | |
2407 | + p_ptr->dis_to_d[default_hand] += MAX(bonus_to_d, 1); | |
2408 | + } | |
2409 | + | |
2410 | + if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_BERSERKER)) && (empty_hands(FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM))) p_ptr->ryoute = FALSE; | |
2411 | + | |
2412 | + /* Affect Skill -- stealth (bonus one) */ | |
2413 | + p_ptr->skill_stl += 1; | |
2414 | + | |
2415 | + if (IS_TIM_STEALTH()) p_ptr->skill_stl += 99; | |
2416 | + | |
2417 | + /* Affect Skill -- disarming (DEX and INT) */ | |
2418 | + p_ptr->skill_dis += adj_dex_dis[p_ptr->stat_ind[A_DEX]]; | |
2419 | + p_ptr->skill_dis += adj_int_dis[p_ptr->stat_ind[A_INT]]; | |
2420 | + | |
2421 | + /* Affect Skill -- magic devices (INT) */ | |
2422 | + p_ptr->skill_dev += adj_int_dev[p_ptr->stat_ind[A_INT]]; | |
2423 | + | |
2424 | + /* Affect Skill -- saving throw (WIS) */ | |
2425 | + p_ptr->skill_sav += adj_wis_sav[p_ptr->stat_ind[A_WIS]]; | |
2426 | + | |
2427 | + /* Affect Skill -- digging (STR) */ | |
2428 | + p_ptr->skill_dig += adj_str_dig[p_ptr->stat_ind[A_STR]]; | |
2429 | + | |
2430 | + /* Affect Skill -- disarming (Level, by Class) */ | |
2431 | + p_ptr->skill_dis += ((cp_ptr->x_dis * p_ptr->lev / 10) + (ap_ptr->a_dis * p_ptr->lev / 50)); | |
2432 | + | |
2433 | + /* Affect Skill -- magic devices (Level, by Class) */ | |
2434 | + p_ptr->skill_dev += ((cp_ptr->x_dev * p_ptr->lev / 10) + (ap_ptr->a_dev * p_ptr->lev / 50)); | |
2435 | + | |
2436 | + /* Affect Skill -- saving throw (Level, by Class) */ | |
2437 | + p_ptr->skill_sav += ((cp_ptr->x_sav * p_ptr->lev / 10) + (ap_ptr->a_sav * p_ptr->lev / 50)); | |
2438 | + | |
2439 | + /* Affect Skill -- stealth (Level, by Class) */ | |
2440 | + p_ptr->skill_stl += (cp_ptr->x_stl * p_ptr->lev / 10); | |
2441 | + | |
2442 | + /* Affect Skill -- search ability (Level, by Class) */ | |
2443 | + p_ptr->skill_srh += (cp_ptr->x_srh * p_ptr->lev / 10); | |
2444 | + | |
2445 | + /* Affect Skill -- search frequency (Level, by Class) */ | |
2446 | + p_ptr->skill_fos += (cp_ptr->x_fos * p_ptr->lev / 10); | |
2447 | + | |
2448 | + /* Affect Skill -- combat (normal) (Level, by Class) */ | |
2449 | + p_ptr->skill_thn += ((cp_ptr->x_thn * p_ptr->lev / 10) + (ap_ptr->a_thn * p_ptr->lev / 50)); | |
2450 | + | |
2451 | + /* Affect Skill -- combat (shooting) (Level, by Class) */ | |
2452 | + p_ptr->skill_thb += ((cp_ptr->x_thb * p_ptr->lev / 10) + (ap_ptr->a_thb * p_ptr->lev / 50)); | |
2453 | + | |
2454 | + /* Affect Skill -- combat (throwing) (Level, by Class) */ | |
2455 | + p_ptr->skill_tht += ((cp_ptr->x_thb * p_ptr->lev / 10) + (ap_ptr->a_thb * p_ptr->lev / 50)); | |
2456 | + | |
2457 | + | |
2458 | + if ((prace_is_(RACE_S_FAIRY)) && (p_ptr->pseikaku != SEIKAKU_SEXY) && (p_ptr->cursed & TRC_AGGRAVATE)) | |
2459 | + { | |
2460 | + p_ptr->cursed &= ~(TRC_AGGRAVATE); | |
2461 | + p_ptr->skill_stl = MIN(p_ptr->skill_stl - 3, (p_ptr->skill_stl + 2) / 2); | |
2462 | + } | |
2463 | + | |
2464 | + /* Limit Skill -- stealth from 0 to 30 */ | |
2465 | + if (p_ptr->skill_stl > 30) p_ptr->skill_stl = 30; | |
2466 | + if (p_ptr->skill_stl < 0) p_ptr->skill_stl = 0; | |
2467 | + | |
2468 | + /* Limit Skill -- digging from 1 up */ | |
2469 | + if (p_ptr->skill_dig < 1) p_ptr->skill_dig = 1; | |
2470 | + | |
2471 | + if (p_ptr->anti_magic && (p_ptr->skill_sav < (90 + p_ptr->lev))) p_ptr->skill_sav = 90 + p_ptr->lev; | |
2472 | + | |
2473 | + if (p_ptr->tsubureru) p_ptr->skill_sav = 10; | |
2474 | + | |
2475 | + if ((p_ptr->ult_res || p_ptr->resist_magic || p_ptr->magicdef) && (p_ptr->skill_sav < (95 + p_ptr->lev))) p_ptr->skill_sav = 95 + p_ptr->lev; | |
2476 | + | |
2477 | + if (down_saving) p_ptr->skill_sav /= 2; | |
2478 | + | |
2479 | + /* Hack -- Each elemental immunity includes resistance */ | |
2480 | + if (p_ptr->immune_acid) p_ptr->resist_acid = TRUE; | |
2481 | + if (p_ptr->immune_elec) p_ptr->resist_elec = TRUE; | |
2482 | + if (p_ptr->immune_fire) p_ptr->resist_fire = TRUE; | |
2483 | + if (p_ptr->immune_cold) p_ptr->resist_cold = TRUE; | |
2484 | + | |
2485 | + /* Determine player alignment */ | |
2486 | + for (i = 0, j = 0; i < 8; i++) | |
2487 | + { | |
2488 | + switch (p_ptr->vir_types[i]) | |
2489 | + { | |
2490 | + case V_JUSTICE: | |
2491 | + p_ptr->align += p_ptr->virtues[i] * 2; | |
2492 | + break; | |
2493 | + case V_CHANCE: | |
2494 | + /* Do nothing */ | |
2495 | + break; | |
2496 | + case V_NATURE: | |
2497 | + case V_HARMONY: | |
2498 | + neutral[j++] = i; | |
2499 | + break; | |
2500 | + case V_UNLIFE: | |
2501 | + p_ptr->align -= p_ptr->virtues[i]; | |
2502 | + break; | |
2503 | + default: | |
2504 | + p_ptr->align += p_ptr->virtues[i]; | |
2505 | + break; | |
2506 | + } | |
2507 | + } | |
2508 | + | |
2509 | + for (i = 0; i < j; i++) | |
2510 | + { | |
2511 | + if (p_ptr->align > 0) | |
2512 | + { | |
2513 | + p_ptr->align -= p_ptr->virtues[neutral[i]] / 2; | |
2514 | + if (p_ptr->align < 0) p_ptr->align = 0; | |
2515 | + } | |
2516 | + else if (p_ptr->align < 0) | |
2517 | + { | |
2518 | + p_ptr->align += p_ptr->virtues[neutral[i]] / 2; | |
2519 | + if (p_ptr->align > 0) p_ptr->align = 0; | |
2520 | + } | |
2521 | + } | |
2522 | + | |
2523 | + /* Hack -- handle "xtra" mode */ | |
2524 | + if (character_xtra) return; | |
2525 | + | |
2526 | + /* Take note when "heavy bow" changes */ | |
2527 | + if (p_ptr->old_heavy_shoot != p_ptr->heavy_shoot) | |
2528 | + { | |
2529 | + if (p_ptr->heavy_shoot) | |
2530 | + { | |
2531 | + msg_print(_("こんな重い弓を装備しているのは大変だ。", "You have trouble wielding such a heavy bow.")); | |
2532 | + } | |
2533 | + else if (inventory[INVEN_BOW].k_idx) | |
2534 | + { | |
2535 | + msg_print(_("この弓なら装備していても辛くない。", "You have no trouble wielding your bow.")); | |
2536 | + } | |
2537 | + else | |
2538 | + { | |
2539 | + msg_print(_("重い弓を装備からはずして体が楽になった。", "You feel relieved to put down your heavy bow.")); | |
2540 | + } | |
2541 | + | |
2542 | + /* Save it */ | |
2543 | + p_ptr->old_heavy_shoot = p_ptr->heavy_shoot; | |
2544 | + } | |
2545 | + | |
2546 | + for (i = 0; i < 2; i++) | |
2547 | + { | |
2548 | + /* Take note when "heavy weapon" changes */ | |
2549 | + if (p_ptr->old_heavy_wield[i] != p_ptr->heavy_wield[i]) | |
2550 | + { | |
2551 | + if (p_ptr->heavy_wield[i]) | |
2552 | + { | |
2553 | + msg_print(_("こんな重い武器を装備しているのは大変だ。", "You have trouble wielding such a heavy weapon.")); | |
2554 | + } | |
2555 | + else if (buki_motteruka(INVEN_RARM + i)) | |
2556 | + { | |
2557 | + msg_print(_("これなら装備していても辛くない。", "You have no trouble wielding your weapon.")); | |
2558 | + } | |
2559 | + else if (p_ptr->heavy_wield[1 - i]) | |
2560 | + { | |
2561 | + msg_print(_("まだ武器が重い。", "You have still trouble wielding a heavy weapon.")); | |
2562 | + } | |
2563 | + else | |
2564 | + { | |
2565 | + msg_print(_("重い武器を装備からはずして体が楽になった。", "You feel relieved to put down your heavy weapon.")); | |
2566 | + } | |
2567 | + | |
2568 | + /* Save it */ | |
2569 | + p_ptr->old_heavy_wield[i] = p_ptr->heavy_wield[i]; | |
2570 | + } | |
2571 | + | |
2572 | + /* Take note when "heavy weapon" changes */ | |
2573 | + if (p_ptr->old_riding_wield[i] != p_ptr->riding_wield[i]) | |
2574 | + { | |
2575 | + if (p_ptr->riding_wield[i]) | |
2576 | + { | |
2577 | + msg_print(_("この武器は乗馬中に使うにはむかないようだ。", "This weapon is not suitable for use while riding.")); | |
2578 | + } | |
2579 | + else if (!p_ptr->riding) | |
2580 | + { | |
2581 | + msg_print(_("この武器は徒歩で使いやすい。", "This weapon was not suitable for use while riding.")); | |
2582 | + } | |
2583 | + else if (buki_motteruka(INVEN_RARM + i)) | |
2584 | + { | |
2585 | + msg_print(_("これなら乗馬中にぴったりだ。", "This weapon is suitable for use while riding.")); | |
2586 | + } | |
2587 | + /* Save it */ | |
2588 | + p_ptr->old_riding_wield[i] = p_ptr->riding_wield[i]; | |
2589 | + } | |
2590 | + | |
2591 | + /* Take note when "illegal weapon" changes */ | |
2592 | + if (p_ptr->old_icky_wield[i] != p_ptr->icky_wield[i]) | |
2593 | + { | |
2594 | + if (p_ptr->icky_wield[i]) | |
2595 | + { | |
2596 | + msg_print(_("今の装備はどうも自分にふさわしくない気がする。", "You do not feel comfortable with your weapon.")); | |
2597 | + if (is_loading_now) | |
2598 | + { | |
2599 | + chg_virtue(V_FAITH, -1); | |
2600 | + } | |
2601 | + } | |
2602 | + else if (buki_motteruka(INVEN_RARM + i)) | |
2603 | + { | |
2604 | + msg_print(_("今の装備は自分にふさわしい気がする。", "You feel comfortable with your weapon.")); | |
2605 | + } | |
2606 | + else | |
2607 | + { | |
2608 | + msg_print(_("装備をはずしたら随分と気が楽になった。", "You feel more comfortable after removing your weapon.")); | |
2609 | + } | |
2610 | + | |
2611 | + /* Save it */ | |
2612 | + p_ptr->old_icky_wield[i] = p_ptr->icky_wield[i]; | |
2613 | + } | |
2614 | + } | |
2615 | + | |
2616 | + if (p_ptr->riding && (p_ptr->old_riding_ryoute != p_ptr->riding_ryoute)) | |
2617 | + { | |
2618 | + if (p_ptr->riding_ryoute) | |
2619 | + { | |
2620 | +#ifdef JP | |
2621 | + msg_format("%s馬を操れない。", (empty_hands(FALSE) == EMPTY_HAND_NONE) ? "両手がふさがっていて" : ""); | |
2622 | +#else | |
2623 | + msg_print("You are using both hand for fighting, and you can't control a riding pet."); | |
2624 | +#endif | |
2625 | + } | |
2626 | + else | |
2627 | + { | |
2628 | +#ifdef JP | |
2629 | + msg_format("%s馬を操れるようになった。", (empty_hands(FALSE) == EMPTY_HAND_NONE) ? "手が空いて" : ""); | |
2630 | +#else | |
2631 | + msg_print("You began to control riding pet with one hand."); | |
2632 | +#endif | |
2633 | + } | |
2634 | + | |
2635 | + p_ptr->old_riding_ryoute = p_ptr->riding_ryoute; | |
2636 | + } | |
2637 | + | |
2638 | + if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_NINJA)) && (monk_armour_aux != monk_notify_aux)) | |
2639 | + { | |
2640 | + if (heavy_armor()) | |
2641 | + { | |
2642 | + msg_print(_("装備が重くてバランスを取れない。", "The weight of your armor disrupts your balance.")); | |
2643 | + if (is_loading_now) | |
2644 | + { | |
2645 | + chg_virtue(V_HARMONY, -1); | |
2646 | + } | |
2647 | + } | |
2648 | + else | |
2649 | + { | |
2650 | + msg_print(_("バランスがとれるようになった。", "You regain your balance.")); | |
2651 | + } | |
2652 | + | |
2653 | + monk_notify_aux = monk_armour_aux; | |
2654 | + } | |
2655 | + | |
2656 | + for (i = 0; i < INVEN_PACK; i++) | |
2657 | + { | |
2658 | +#if 0 | |
2659 | + if ((inventory[i].tval == TV_SORCERY_BOOK) && (inventory[i].sval == 2)) have_dd_s = TRUE; | |
2660 | + if ((inventory[i].tval == TV_TRUMP_BOOK) && (inventory[i].sval == 1)) have_dd_t = TRUE; | |
2661 | +#endif | |
2662 | + if ((inventory[i].tval == TV_NATURE_BOOK) && (inventory[i].sval == 2)) have_sw = TRUE; | |
2663 | + if ((inventory[i].tval == TV_CRAFT_BOOK) && (inventory[i].sval == 2)) have_kabe = TRUE; | |
2664 | + } | |
2665 | + | |
2666 | + for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx) | |
2667 | + { | |
2668 | + o_ptr = &o_list[this_o_idx]; | |
2669 | + | |
2670 | + /* Acquire next object */ | |
2671 | + next_o_idx = o_ptr->next_o_idx; | |
2672 | + | |
2673 | +#if 0 | |
2674 | + if ((o_ptr->tval == TV_SORCERY_BOOK) && (o_ptr->sval == 3)) have_dd_s = TRUE; | |
2675 | + if ((o_ptr->tval == TV_TRUMP_BOOK) && (o_ptr->sval == 1)) have_dd_t = TRUE; | |
2676 | +#endif | |
2677 | + if ((o_ptr->tval == TV_NATURE_BOOK) && (o_ptr->sval == 2)) have_sw = TRUE; | |
2678 | + if ((o_ptr->tval == TV_CRAFT_BOOK) && (o_ptr->sval == 2)) have_kabe = TRUE; | |
2679 | + } | |
2680 | + | |
2681 | + if (p_ptr->pass_wall && !p_ptr->kill_wall) p_ptr->no_flowed = TRUE; | |
2682 | +#if 0 | |
2683 | + if (have_dd_s && ((p_ptr->realm1 == REALM_SORCERY) || (p_ptr->realm2 == REALM_SORCERY) || (p_ptr->pclass == CLASS_SORCERER))) | |
2684 | + { | |
2685 | + const magic_type *s_ptr = &mp_ptr->info[REALM_SORCERY - 1][SPELL_DD_S]; | |
2686 | + if (p_ptr->lev >= s_ptr->slevel) p_ptr->no_flowed = TRUE; | |
2687 | + } | |
2688 | + | |
2689 | + if (have_dd_t && ((p_ptr->realm1 == REALM_TRUMP) || (p_ptr->realm2 == REALM_TRUMP) || (p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))) | |
2690 | + { | |
2691 | + const magic_type *s_ptr = &mp_ptr->info[REALM_TRUMP - 1][SPELL_DD_T]; | |
2692 | + if (p_ptr->lev >= s_ptr->slevel) p_ptr->no_flowed = TRUE; | |
2693 | + } | |
2694 | +#endif | |
2695 | + if (have_sw && ((p_ptr->realm1 == REALM_NATURE) || (p_ptr->realm2 == REALM_NATURE) || (p_ptr->pclass == CLASS_SORCERER))) | |
2696 | + { | |
2697 | + const magic_type *s_ptr = &mp_ptr->info[REALM_NATURE - 1][SPELL_SW]; | |
2698 | + if (p_ptr->lev >= s_ptr->slevel) p_ptr->no_flowed = TRUE; | |
2699 | + } | |
2700 | + | |
2701 | + if (have_kabe && ((p_ptr->realm1 == REALM_CRAFT) || (p_ptr->realm2 == REALM_CRAFT) || (p_ptr->pclass == CLASS_SORCERER))) | |
2702 | + { | |
2703 | + const magic_type *s_ptr = &mp_ptr->info[REALM_CRAFT - 1][SPELL_KABE]; | |
2704 | + if (p_ptr->lev >= s_ptr->slevel) p_ptr->no_flowed = TRUE; | |
2705 | + } | |
2706 | +} | |
2707 | + | |
2708 | + | |
2709 | +/*! | |
2710 | + * @brief プレイヤーの最大HPを計算する / | |
2711 | + * Calculate the players (maximal) hit points | |
2712 | + * Adjust current hitpoints if necessary | |
2713 | + * @return なし | |
2714 | + * @details | |
2715 | + */ | |
2716 | +static void calc_hitpoints(void) | |
2717 | +{ | |
2718 | + int bonus, mhp; | |
2719 | + byte tmp_hitdie; | |
2720 | + | |
2721 | + /* Un-inflate "half-hitpoint bonus per level" value */ | |
2722 | + bonus = ((int)(adj_con_mhp[p_ptr->stat_ind[A_CON]]) - 128) * p_ptr->lev / 4; | |
2723 | + | |
2724 | + /* Calculate hitpoints */ | |
2725 | + mhp = p_ptr->player_hp[p_ptr->lev - 1]; | |
2726 | + | |
2727 | + if (p_ptr->mimic_form) | |
2728 | + { | |
2729 | + if (p_ptr->pclass == CLASS_SORCERER) | |
2730 | + tmp_hitdie = mimic_info[p_ptr->mimic_form].r_mhp / 2 + cp_ptr->c_mhp + ap_ptr->a_mhp; | |
2731 | + else | |
2732 | + tmp_hitdie = mimic_info[p_ptr->mimic_form].r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp; | |
2733 | + mhp = mhp * tmp_hitdie / p_ptr->hitdie; | |
2734 | + } | |
2735 | + | |
2736 | + if (p_ptr->pclass == CLASS_SORCERER) | |
2737 | + { | |
2738 | + if (p_ptr->lev < 30) | |
2739 | + mhp = (mhp * (45 + p_ptr->lev) / 100); | |
2740 | + else | |
2741 | + mhp = (mhp * 75 / 100); | |
2742 | + bonus = (bonus * 65 / 100); | |
2743 | + } | |
2744 | + | |
2745 | + mhp += bonus; | |
2746 | + | |
2747 | + if (p_ptr->pclass == CLASS_BERSERKER) | |
2748 | + { | |
2749 | + mhp = mhp * (110 + (((p_ptr->lev + 40) * (p_ptr->lev + 40) - 1550) / 110)) / 100; | |
2750 | + } | |
2751 | + | |
2752 | + /* Always have at least one hitpoint per level */ | |
2753 | + if (mhp < p_ptr->lev + 1) mhp = p_ptr->lev + 1; | |
2754 | + | |
2755 | + /* Factor in the hero / superhero settings */ | |
2756 | + if (IS_HERO()) mhp += 10; | |
2757 | + if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER)) mhp += 30; | |
2758 | + if (p_ptr->tsuyoshi) mhp += 50; | |
2759 | + | |
2760 | + /* Factor in the hex spell settings */ | |
2761 | + if (hex_spelling(HEX_XTRA_MIGHT)) mhp += 15; | |
2762 | + if (hex_spelling(HEX_BUILDING)) mhp += 60; | |
2763 | + | |
2764 | + /* New maximum hitpoints */ | |
2765 | + if (p_ptr->mhp != mhp) | |
2766 | + { | |
2767 | + /* Enforce maximum */ | |
2768 | + if (p_ptr->chp >= mhp) | |
2769 | + { | |
2770 | + p_ptr->chp = mhp; | |
2771 | + p_ptr->chp_frac = 0; | |
2772 | + } | |
2773 | + | |
2774 | +#ifdef JP | |
2775 | + /* レベルアップの時は上昇量を表示する */ | |
2776 | + if ((level_up == 1) && (mhp > p_ptr->mhp)) | |
2777 | + { | |
2778 | + msg_format("最大ヒット・ポイントが %d 増加した!", (mhp - p_ptr->mhp)); | |
2779 | + } | |
2780 | +#endif | |
2781 | + /* Save the new max-hitpoints */ | |
2782 | + p_ptr->mhp = mhp; | |
2783 | + | |
2784 | + /* Display hitpoints (later) */ | |
2785 | + p_ptr->redraw |= (PR_HP); | |
2786 | + | |
2787 | + p_ptr->window |= (PW_PLAYER); | |
2788 | + } | |
2789 | +} | |
2790 | + | |
2791 | +/*! | |
2792 | + * @brief プレイヤーの光源半径を計算する / Extract and set the current "lite radius" | |
2793 | + * @return なし | |
2794 | + * @details | |
2795 | + * SWD: Experimental modification: multiple light sources have additive effect. | |
2796 | + */ | |
2797 | +static void calc_torch(void) | |
2798 | +{ | |
2799 | + int i, rad; | |
2800 | + object_type *o_ptr; | |
2801 | + BIT_FLAGS flgs[TR_FLAG_SIZE]; | |
2802 | + | |
2803 | + /* Assume no light */ | |
2804 | + p_ptr->cur_lite = 0; | |
2805 | + | |
2806 | + /* Loop through all wielded items */ | |
2807 | + for (i = INVEN_RARM; i < INVEN_TOTAL; i++) | |
2808 | + { | |
2809 | + o_ptr = &inventory[i]; | |
2810 | + /* Skip empty slots */ | |
2811 | + if (!o_ptr->k_idx) continue; | |
2812 | + | |
2813 | + if (o_ptr->name2 == EGO_LITE_SHINE) p_ptr->cur_lite++; | |
2814 | + | |
2815 | + /* Need Fuels */ | |
2816 | + if (o_ptr->name2 != EGO_LITE_DARKNESS) | |
2817 | + { | |
2818 | + if (o_ptr->tval == TV_LITE) | |
2819 | + { | |
2820 | + if ((o_ptr->sval == SV_LITE_TORCH) && !(o_ptr->xtra4 > 0)) continue; | |
2821 | + if ((o_ptr->sval == SV_LITE_LANTERN) && !(o_ptr->xtra4 > 0)) continue; | |
2822 | + } | |
2823 | + } | |
2824 | + object_flags(o_ptr, flgs); | |
2825 | + | |
2826 | + /* calc the lite_radius */ | |
2827 | + | |
2828 | + rad = 0; | |
2829 | + if (have_flag(flgs, TR_LITE_1) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 1; | |
2830 | + if (have_flag(flgs, TR_LITE_2) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 2; | |
2831 | + if (have_flag(flgs, TR_LITE_3) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 3; | |
2832 | + if (have_flag(flgs, TR_LITE_M1)) rad -= 1; | |
2833 | + if (have_flag(flgs, TR_LITE_M2)) rad -= 2; | |
2834 | + if (have_flag(flgs, TR_LITE_M3)) rad -= 3; | |
2835 | + p_ptr->cur_lite += (s16b)rad; | |
2836 | + } | |
2837 | + | |
2838 | + /* max radius is 14 (was 5) without rewriting other code -- */ | |
2839 | + /* see cave.c:update_lite() and defines.h:LITE_MAX */ | |
2840 | + if (d_info[dungeon_type].flags1 & DF1_DARKNESS && p_ptr->cur_lite > 1) | |
2841 | + p_ptr->cur_lite = 1; | |
2842 | + | |
2843 | + /* | |
2844 | + * check if the player doesn't have light radius, | |
2845 | + * but does weakly glow as an intrinsic. | |
2846 | + */ | |
2847 | + if (p_ptr->cur_lite <= 0 && p_ptr->lite) p_ptr->cur_lite++; | |
2848 | + | |
2849 | + if (p_ptr->cur_lite > 14) p_ptr->cur_lite = 14; | |
2850 | + if (p_ptr->cur_lite < 0) p_ptr->cur_lite = 0; | |
2851 | + | |
2852 | + /* end experimental mods */ | |
2853 | + | |
2854 | + /* Notice changes in the "lite radius" */ | |
2855 | + if (p_ptr->old_lite != p_ptr->cur_lite) | |
2856 | + { | |
2857 | + /* Hack -- PU_MON_LITE for monsters' darkness */ | |
2858 | + p_ptr->update |= (PU_LITE | PU_MON_LITE | PU_MONSTERS); | |
2859 | + | |
2860 | + /* Remember the old lite */ | |
2861 | + p_ptr->old_lite = p_ptr->cur_lite; | |
2862 | + | |
2863 | + if ((p_ptr->cur_lite > 0) && (p_ptr->special_defense & NINJA_S_STEALTH)) | |
2864 | + set_superstealth(FALSE); | |
2865 | + } | |
2866 | +} | |
2867 | + | |
2868 | +/*! | |
2869 | + * @brief プレイヤーの現在学習可能な魔法数を計算し、増減に応じて魔法の忘却、再学習を処置する。 / | |
2870 | + * Calculate number of spells player should have, and forget, | |
2871 | + * or remember, spells until that number is properly reflected. | |
2872 | + * @return なし | |
2873 | + * @details | |
2874 | + * Note that this function induces various "status" messages, | |
2875 | + * which must be bypasses until the character is created. | |
2876 | + */ | |
2877 | +static void calc_spells(void) | |
2878 | +{ | |
2879 | + int i, j, k, levels; | |
2880 | + int num_allowed; | |
2881 | + int num_boukyaku = 0; | |
2882 | + | |
2883 | + const magic_type *s_ptr; | |
2884 | + REALM_IDX which; | |
2885 | + int bonus = 0; | |
2886 | + | |
2887 | + | |
2888 | + concptr p; | |
2889 | + | |
2890 | + /* Hack -- must be literate */ | |
2891 | + if (!mp_ptr->spell_book) return; | |
2892 | + | |
2893 | + /* Hack -- wait for creation */ | |
2894 | + if (!character_generated) return; | |
2895 | + | |
2896 | + /* Hack -- handle "xtra" mode */ | |
2897 | + if (character_xtra) return; | |
2898 | + | |
2899 | + if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE)) | |
2900 | + { | |
2901 | + p_ptr->new_spells = 0; | |
2902 | + return; | |
2903 | + } | |
2904 | + | |
2905 | + p = spell_category_name(mp_ptr->spell_book); | |
2906 | + | |
2907 | + /* Determine the number of spells allowed */ | |
2908 | + levels = p_ptr->lev - mp_ptr->spell_first + 1; | |
2909 | + | |
2910 | + /* Hack -- no negative spells */ | |
2911 | + if (levels < 0) levels = 0; | |
2912 | + | |
2913 | + /* Extract total allowed spells */ | |
2914 | + num_allowed = (adj_mag_study[p_ptr->stat_ind[mp_ptr->spell_stat]] * levels / 2); | |
2915 | + | |
2916 | + if ((p_ptr->pclass != CLASS_SAMURAI) && (mp_ptr->spell_book != TV_LIFE_BOOK)) | |
2917 | + { | |
2918 | + bonus = 4; | |
2919 | + } | |
2920 | + if (p_ptr->pclass == CLASS_SAMURAI) | |
2921 | + { | |
2922 | + num_allowed = 32; | |
2923 | + } | |
2924 | + else if (p_ptr->realm2 == REALM_NONE) | |
2925 | + { | |
2926 | + num_allowed = (num_allowed + 1) / 2; | |
2927 | + if (num_allowed > (32 + bonus)) num_allowed = 32 + bonus; | |
2928 | + } | |
2929 | + else if ((p_ptr->pclass == CLASS_MAGE) || (p_ptr->pclass == CLASS_PRIEST)) | |
2930 | + { | |
2931 | + if (num_allowed > (96 + bonus)) num_allowed = 96 + bonus; | |
2932 | + } | |
2933 | + else | |
2934 | + { | |
2935 | + if (num_allowed > (80 + bonus)) num_allowed = 80 + bonus; | |
2936 | + } | |
2937 | + | |
2938 | + /* Count the number of spells we know */ | |
2939 | + for (j = 0; j < 64; j++) | |
2940 | + { | |
2941 | + /* Count known spells */ | |
2942 | + if ((j < 32) ? | |
2943 | + (p_ptr->spell_forgotten1 & (1L << j)) : | |
2944 | + (p_ptr->spell_forgotten2 & (1L << (j - 32)))) | |
2945 | + { | |
2946 | + num_boukyaku++; | |
2947 | + } | |
2948 | + } | |
2949 | + | |
2950 | + /* See how many spells we must forget or may learn */ | |
2951 | + p_ptr->new_spells = num_allowed + p_ptr->add_spells + num_boukyaku - p_ptr->learned_spells; | |
2952 | + | |
2953 | + /* Forget spells which are too hard */ | |
2954 | + for (i = 63; i >= 0; i--) | |
2955 | + { | |
2956 | + /* Efficiency -- all done */ | |
2957 | + if (!p_ptr->spell_learned1 && !p_ptr->spell_learned2) break; | |
2958 | + | |
2959 | + /* Access the spell */ | |
2960 | + j = p_ptr->spell_order[i]; | |
2961 | + | |
2962 | + /* Skip non-spells */ | |
2963 | + if (j >= 99) continue; | |
2964 | + | |
2965 | + | |
2966 | + /* Get the spell */ | |
2967 | + if (!is_magic((j < 32) ? p_ptr->realm1 : p_ptr->realm2)) | |
2968 | + { | |
2969 | + if (j < 32) | |
2970 | + s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][j]; | |
2971 | + else | |
2972 | + s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][j % 32]; | |
2973 | + } | |
2974 | + else if (j < 32) | |
2975 | + s_ptr = &mp_ptr->info[p_ptr->realm1 - 1][j]; | |
2976 | + else | |
2977 | + s_ptr = &mp_ptr->info[p_ptr->realm2 - 1][j % 32]; | |
2978 | + | |
2979 | + /* Skip spells we are allowed to know */ | |
2980 | + if (s_ptr->slevel <= p_ptr->lev) continue; | |
2981 | + | |
2982 | + /* Is it known? */ | |
2983 | + if ((j < 32) ? | |
2984 | + (p_ptr->spell_learned1 & (1L << j)) : | |
2985 | + (p_ptr->spell_learned2 & (1L << (j - 32)))) | |
2986 | + { | |
2987 | + /* Mark as forgotten */ | |
2988 | + if (j < 32) | |
2989 | + { | |
2990 | + p_ptr->spell_forgotten1 |= (1L << j); | |
2991 | + which = p_ptr->realm1; | |
2992 | + } | |
2993 | + else | |
2994 | + { | |
2995 | + p_ptr->spell_forgotten2 |= (1L << (j - 32)); | |
2996 | + which = p_ptr->realm2; | |
2997 | + } | |
2998 | + | |
2999 | + /* No longer known */ | |
3000 | + if (j < 32) | |
3001 | + { | |
3002 | + p_ptr->spell_learned1 &= ~(1L << j); | |
3003 | + which = p_ptr->realm1; | |
3004 | + } | |
3005 | + else | |
3006 | + { | |
3007 | + p_ptr->spell_learned2 &= ~(1L << (j - 32)); | |
3008 | + which = p_ptr->realm2; | |
3009 | + } | |
3010 | + | |
3011 | +#ifdef JP | |
3012 | + msg_format("%sの%sを忘れてしまった。", do_spell(which, j % 32, SPELL_NAME), p); | |
3013 | +#else | |
3014 | + msg_format("You have forgotten the %s of %s.", p, do_spell(which, j % 32, SPELL_NAME)); | |
3015 | +#endif | |
3016 | + | |
3017 | + | |
3018 | + /* One more can be learned */ | |
3019 | + p_ptr->new_spells++; | |
3020 | + } | |
3021 | + } | |
3022 | + | |
3023 | + | |
3024 | + /* Forget spells if we know too many spells */ | |
3025 | + for (i = 63; i >= 0; i--) | |
3026 | + { | |
3027 | + /* Stop when possible */ | |
3028 | + if (p_ptr->new_spells >= 0) break; | |
3029 | + | |
3030 | + /* Efficiency -- all done */ | |
3031 | + if (!p_ptr->spell_learned1 && !p_ptr->spell_learned2) break; | |
3032 | + | |
3033 | + /* Get the (i+1)th spell learned */ | |
3034 | + j = p_ptr->spell_order[i]; | |
3035 | + | |
3036 | + /* Skip unknown spells */ | |
3037 | + if (j >= 99) continue; | |
3038 | + | |
3039 | + /* Forget it (if learned) */ | |
3040 | + if ((j < 32) ? | |
3041 | + (p_ptr->spell_learned1 & (1L << j)) : | |
3042 | + (p_ptr->spell_learned2 & (1L << (j - 32)))) | |
3043 | + { | |
3044 | + /* Mark as forgotten */ | |
3045 | + if (j < 32) | |
3046 | + { | |
3047 | + p_ptr->spell_forgotten1 |= (1L << j); | |
3048 | + which = p_ptr->realm1; | |
3049 | + } | |
3050 | + else | |
3051 | + { | |
3052 | + p_ptr->spell_forgotten2 |= (1L << (j - 32)); | |
3053 | + which = p_ptr->realm2; | |
3054 | + } | |
3055 | + | |
3056 | + /* No longer known */ | |
3057 | + if (j < 32) | |
3058 | + { | |
3059 | + p_ptr->spell_learned1 &= ~(1L << j); | |
3060 | + which = p_ptr->realm1; | |
3061 | + } | |
3062 | + else | |
3063 | + { | |
3064 | + p_ptr->spell_learned2 &= ~(1L << (j - 32)); | |
3065 | + which = p_ptr->realm2; | |
3066 | + } | |
3067 | + | |
3068 | +#ifdef JP | |
3069 | + msg_format("%sの%sを忘れてしまった。", | |
3070 | + do_spell(which, j % 32, SPELL_NAME), p); | |
3071 | +#else | |
3072 | + msg_format("You have forgotten the %s of %s.", p, | |
3073 | + do_spell(which, j % 32, SPELL_NAME)); | |
3074 | +#endif | |
3075 | + | |
3076 | + | |
3077 | + /* One more can be learned */ | |
3078 | + p_ptr->new_spells++; | |
3079 | + } | |
3080 | + } | |
3081 | + | |
3082 | + | |
3083 | + /* Check for spells to remember */ | |
3084 | + for (i = 0; i < 64; i++) | |
3085 | + { | |
3086 | + /* None left to remember */ | |
3087 | + if (p_ptr->new_spells <= 0) break; | |
3088 | + | |
3089 | + /* Efficiency -- all done */ | |
3090 | + if (!p_ptr->spell_forgotten1 && !p_ptr->spell_forgotten2) break; | |
3091 | + | |
3092 | + /* Get the next spell we learned */ | |
3093 | + j = p_ptr->spell_order[i]; | |
3094 | + | |
3095 | + /* Skip unknown spells */ | |
3096 | + if (j >= 99) break; | |
3097 | + | |
3098 | + /* Access the spell */ | |
3099 | + if (!is_magic((j < 32) ? p_ptr->realm1 : p_ptr->realm2)) | |
3100 | + { | |
3101 | + if (j < 32) | |
3102 | + s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][j]; | |
3103 | + else | |
3104 | + s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][j % 32]; | |
3105 | + } | |
3106 | + else if (j < 32) | |
3107 | + s_ptr = &mp_ptr->info[p_ptr->realm1 - 1][j]; | |
3108 | + else | |
3109 | + s_ptr = &mp_ptr->info[p_ptr->realm2 - 1][j % 32]; | |
3110 | + | |
3111 | + /* Skip spells we cannot remember */ | |
3112 | + if (s_ptr->slevel > p_ptr->lev) continue; | |
3113 | + | |
3114 | + /* First set of spells */ | |
3115 | + if ((j < 32) ? | |
3116 | + (p_ptr->spell_forgotten1 & (1L << j)) : | |
3117 | + (p_ptr->spell_forgotten2 & (1L << (j - 32)))) | |
3118 | + { | |
3119 | + /* No longer forgotten */ | |
3120 | + if (j < 32) | |
3121 | + { | |
3122 | + p_ptr->spell_forgotten1 &= ~(1L << j); | |
3123 | + which = p_ptr->realm1; | |
3124 | + } | |
3125 | + else | |
3126 | + { | |
3127 | + p_ptr->spell_forgotten2 &= ~(1L << (j - 32)); | |
3128 | + which = p_ptr->realm2; | |
3129 | + } | |
3130 | + | |
3131 | + /* Known once more */ | |
3132 | + if (j < 32) | |
3133 | + { | |
3134 | + p_ptr->spell_learned1 |= (1L << j); | |
3135 | + which = p_ptr->realm1; | |
3136 | + } | |
3137 | + else | |
3138 | + { | |
3139 | + p_ptr->spell_learned2 |= (1L << (j - 32)); | |
3140 | + which = p_ptr->realm2; | |
3141 | + } | |
3142 | + | |
3143 | +#ifdef JP | |
3144 | + msg_format("%sの%sを思い出した。", do_spell(which, j % 32, SPELL_NAME), p); | |
3145 | +#else | |
3146 | + msg_format("You have remembered the %s of %s.", p, do_spell(which, j % 32, SPELL_NAME)); | |
3147 | +#endif | |
3148 | + | |
3149 | + | |
3150 | + /* One less can be learned */ | |
3151 | + p_ptr->new_spells--; | |
3152 | + } | |
3153 | + } | |
3154 | + | |
3155 | + k = 0; | |
3156 | + | |
3157 | + if (p_ptr->realm2 == REALM_NONE) | |
3158 | + { | |
3159 | + /* Count spells that can be learned */ | |
3160 | + for (j = 0; j < 32; j++) | |
3161 | + { | |
3162 | + if (!is_magic(p_ptr->realm1)) s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][j]; | |
3163 | + else s_ptr = &mp_ptr->info[p_ptr->realm1 - 1][j]; | |
3164 | + | |
3165 | + /* Skip spells we cannot remember */ | |
3166 | + if (s_ptr->slevel > p_ptr->lev) continue; | |
3167 | + | |
3168 | + /* Skip spells we already know */ | |
3169 | + if (p_ptr->spell_learned1 & (1L << j)) | |
3170 | + { | |
3171 | + continue; | |
3172 | + } | |
3173 | + | |
3174 | + /* Count it */ | |
3175 | + k++; | |
3176 | + } | |
3177 | + if (k > 32) k = 32; | |
3178 | + if ((p_ptr->new_spells > k) && | |
3179 | + ((mp_ptr->spell_book == TV_LIFE_BOOK) || (mp_ptr->spell_book == TV_HISSATSU_BOOK))) | |
3180 | + { | |
3181 | + p_ptr->new_spells = (s16b)k; | |
3182 | + } | |
3183 | + } | |
3184 | + | |
3185 | + if (p_ptr->new_spells < 0) p_ptr->new_spells = 0; | |
3186 | + | |
3187 | + /* Spell count changed */ | |
3188 | + if (p_ptr->old_spells != p_ptr->new_spells) | |
3189 | + { | |
3190 | + /* Message if needed */ | |
3191 | + if (p_ptr->new_spells) | |
3192 | + { | |
3193 | +#ifdef JP | |
3194 | + if (p_ptr->new_spells < 10) { | |
3195 | + msg_format("あと %d つの%sを学べる。", p_ptr->new_spells, p); | |
3196 | + } | |
3197 | + else { | |
3198 | + msg_format("あと %d 個の%sを学べる。", p_ptr->new_spells, p); | |
3199 | + } | |
3200 | +#else | |
3201 | + msg_format("You can learn %d more %s%s.", | |
3202 | + p_ptr->new_spells, p, | |
3203 | + (p_ptr->new_spells != 1) ? "s" : ""); | |
3204 | +#endif | |
3205 | + | |
3206 | + } | |
3207 | + | |
3208 | + /* Save the new_spells value */ | |
3209 | + p_ptr->old_spells = p_ptr->new_spells; | |
3210 | + | |
3211 | + /* Redraw Study Status */ | |
3212 | + p_ptr->redraw |= (PR_STUDY); | |
3213 | + | |
3214 | + /* Redraw object recall */ | |
3215 | + p_ptr->window |= (PW_OBJECT); | |
3216 | + } | |
3217 | +} | |
3218 | + | |
3219 | +/*! | |
3220 | + * @brief プレイヤーの最大MPを計算する / | |
3221 | + * Calculate maximum mana. You do not need to know any spells. | |
3222 | + * Note that mana is lowered by heavy (or inappropriate) armor. | |
3223 | + * @return なし | |
3224 | + * @details | |
3225 | + * This function induces status messages. | |
3226 | + */ | |
3227 | +static void calc_mana(void) | |
3228 | +{ | |
3229 | + int msp, levels, cur_wgt, max_wgt; | |
3230 | + | |
3231 | + object_type *o_ptr; | |
3232 | + | |
3233 | + | |
3234 | + /* Hack -- Must be literate */ | |
3235 | + if (!mp_ptr->spell_book) return; | |
3236 | + | |
3237 | + if ((p_ptr->pclass == CLASS_MINDCRAFTER) || | |
3238 | + (p_ptr->pclass == CLASS_MIRROR_MASTER) || | |
3239 | + (p_ptr->pclass == CLASS_BLUE_MAGE)) | |
3240 | + { | |
3241 | + levels = p_ptr->lev; | |
3242 | + } | |
3243 | + else | |
3244 | + { | |
3245 | + if (mp_ptr->spell_first > p_ptr->lev) | |
3246 | + { | |
3247 | + /* Save new mana */ | |
3248 | + p_ptr->msp = 0; | |
3249 | + | |
3250 | + /* Display mana later */ | |
3251 | + p_ptr->redraw |= (PR_MANA); | |
3252 | + return; | |
3253 | + } | |
3254 | + | |
3255 | + /* Extract "effective" player level */ | |
3256 | + levels = (p_ptr->lev - mp_ptr->spell_first) + 1; | |
3257 | + } | |
3258 | + | |
3259 | + if (p_ptr->pclass == CLASS_SAMURAI) | |
3260 | + { | |
3261 | + msp = (adj_mag_mana[p_ptr->stat_ind[mp_ptr->spell_stat]] + 10) * 2; | |
3262 | + if (msp) msp += (msp * rp_ptr->r_adj[mp_ptr->spell_stat] / 20); | |
3263 | + } | |
3264 | + else | |
3265 | + { | |
3266 | + /* Extract total mana */ | |
3267 | + msp = adj_mag_mana[p_ptr->stat_ind[mp_ptr->spell_stat]] * (levels + 3) / 4; | |
3268 | + | |
3269 | + /* Hack -- usually add one mana */ | |
3270 | + if (msp) msp++; | |
3271 | + | |
3272 | + if (msp) msp += (msp * rp_ptr->r_adj[mp_ptr->spell_stat] / 20); | |
3273 | + | |
3274 | + if (msp && (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)) msp += msp / 2; | |
3275 | + | |
3276 | + /* Hack: High mages have a 25% mana bonus */ | |
3277 | + if (msp && (p_ptr->pclass == CLASS_HIGH_MAGE)) msp += msp / 4; | |
3278 | + | |
3279 | + if (msp && (p_ptr->pclass == CLASS_SORCERER)) msp += msp * (25 + p_ptr->lev) / 100; | |
3280 | + } | |
3281 | + | |
3282 | + /* Only mages are affected */ | |
3283 | + if (mp_ptr->spell_xtra & MAGIC_GLOVE_REDUCE_MANA) | |
3284 | + { | |
3285 | + BIT_FLAGS flgs[TR_FLAG_SIZE]; | |
3286 | + | |
3287 | + /* Assume player is not encumbered by gloves */ | |
3288 | + p_ptr->cumber_glove = FALSE; | |
3289 | + | |
3290 | + /* Get the gloves */ | |
3291 | + o_ptr = &inventory[INVEN_HANDS]; | |
3292 | + | |
3293 | + /* Examine the gloves */ | |
3294 | + object_flags(o_ptr, flgs); | |
3295 | + | |
3296 | + /* Normal gloves hurt mage-type spells */ | |
3297 | + if (o_ptr->k_idx && | |
3298 | + !(have_flag(flgs, TR_FREE_ACT)) && | |
3299 | + !(have_flag(flgs, TR_DEC_MANA)) && | |
3300 | + !(have_flag(flgs, TR_EASY_SPELL)) && | |
3301 | + !((have_flag(flgs, TR_MAGIC_MASTERY)) && (o_ptr->pval > 0)) && | |
3302 | + !((have_flag(flgs, TR_DEX)) && (o_ptr->pval > 0))) | |
3303 | + { | |
3304 | + /* Encumbered */ | |
3305 | + p_ptr->cumber_glove = TRUE; | |
3306 | + | |
3307 | + /* Reduce mana */ | |
3308 | + msp = (3 * msp) / 4; | |
3309 | + } | |
3310 | + } | |
3311 | + | |
3312 | + | |
3313 | + /* Assume player not encumbered by armor */ | |
3314 | + p_ptr->cumber_armor = FALSE; | |
3315 | + | |
3316 | + /* Weigh the armor */ | |
3317 | + cur_wgt = 0; | |
3318 | + if (inventory[INVEN_RARM].tval > TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight; | |
3319 | + if (inventory[INVEN_LARM].tval > TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight; | |
3320 | + cur_wgt += inventory[INVEN_BODY].weight; | |
3321 | + cur_wgt += inventory[INVEN_HEAD].weight; | |
3322 | + cur_wgt += inventory[INVEN_OUTER].weight; | |
3323 | + cur_wgt += inventory[INVEN_HANDS].weight; | |
3324 | + cur_wgt += inventory[INVEN_FEET].weight; | |
3325 | + | |
3326 | + /* Subtract a percentage of maximum mana. */ | |
3327 | + switch (p_ptr->pclass) | |
3328 | + { | |
3329 | + /* For these classes, mana is halved if armour | |
3330 | + * is 30 pounds over their weight limit. */ | |
3331 | + case CLASS_MAGE: | |
3332 | + case CLASS_HIGH_MAGE: | |
3333 | + case CLASS_BLUE_MAGE: | |
3334 | + case CLASS_MONK: | |
3335 | + case CLASS_FORCETRAINER: | |
3336 | + case CLASS_SORCERER: | |
3337 | + { | |
3338 | + if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight; | |
3339 | + if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight; | |
3340 | + break; | |
3341 | + } | |
3342 | + | |
3343 | + /* Mana halved if armour is 40 pounds over weight limit. */ | |
3344 | + case CLASS_PRIEST: | |
3345 | + case CLASS_BARD: | |
3346 | + case CLASS_TOURIST: | |
3347 | + { | |
3348 | + if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight * 2 / 3; | |
3349 | + if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight * 2 / 3; | |
3350 | + break; | |
3351 | + } | |
3352 | + | |
3353 | + case CLASS_MINDCRAFTER: | |
3354 | + case CLASS_BEASTMASTER: | |
3355 | + case CLASS_MIRROR_MASTER: | |
3356 | + { | |
3357 | + if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight / 2; | |
3358 | + if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight / 2; | |
3359 | + break; | |
3360 | + } | |
3361 | + | |
3362 | + /* Mana halved if armour is 50 pounds over weight limit. */ | |
3363 | + case CLASS_ROGUE: | |
3364 | + case CLASS_RANGER: | |
3365 | + case CLASS_RED_MAGE: | |
3366 | + case CLASS_WARRIOR_MAGE: | |
3367 | + { | |
3368 | + if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight / 3; | |
3369 | + if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight / 3; | |
3370 | + break; | |
3371 | + } | |
3372 | + | |
3373 | + /* Mana halved if armour is 60 pounds over weight limit. */ | |
3374 | + case CLASS_PALADIN: | |
3375 | + case CLASS_CHAOS_WARRIOR: | |
3376 | + { | |
3377 | + if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight / 5; | |
3378 | + if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight / 5; | |
3379 | + break; | |
3380 | + } | |
3381 | + | |
3382 | + /* For new classes created, but not yet added to this formula. */ | |
3383 | + default: | |
3384 | + { | |
3385 | + break; | |
3386 | + } | |
3387 | + } | |
3388 | + | |
3389 | + /* Determine the weight allowance */ | |
3390 | + max_wgt = mp_ptr->spell_weight; | |
3391 | + | |
3392 | + /* Heavy armor penalizes mana by a percentage. -LM- */ | |
3393 | + if ((cur_wgt - max_wgt) > 0) | |
3394 | + { | |
3395 | + /* Encumbered */ | |
3396 | + p_ptr->cumber_armor = TRUE; | |
3397 | + | |
3398 | + /* Subtract a percentage of maximum mana. */ | |
3399 | + switch (p_ptr->pclass) | |
3400 | + { | |
3401 | + /* For these classes, mana is halved if armour | |
3402 | + * is 30 pounds over their weight limit. */ | |
3403 | + case CLASS_MAGE: | |
3404 | + case CLASS_HIGH_MAGE: | |
3405 | + case CLASS_BLUE_MAGE: | |
3406 | + { | |
3407 | + msp -= msp * (cur_wgt - max_wgt) / 600; | |
3408 | + break; | |
3409 | + } | |
3410 | + | |
3411 | + /* Mana halved if armour is 40 pounds over weight limit. */ | |
3412 | + case CLASS_PRIEST: | |
3413 | + case CLASS_MINDCRAFTER: | |
3414 | + case CLASS_BEASTMASTER: | |
3415 | + case CLASS_BARD: | |
3416 | + case CLASS_FORCETRAINER: | |
3417 | + case CLASS_TOURIST: | |
3418 | + case CLASS_MIRROR_MASTER: | |
3419 | + { | |
3420 | + msp -= msp * (cur_wgt - max_wgt) / 800; | |
3421 | + break; | |
3422 | + } | |
3423 | + | |
3424 | + case CLASS_SORCERER: | |
3425 | + { | |
3426 | + msp -= msp * (cur_wgt - max_wgt) / 900; | |
3427 | + break; | |
3428 | + } | |
3429 | + | |
3430 | + /* Mana halved if armour is 50 pounds over weight limit. */ | |
3431 | + case CLASS_ROGUE: | |
3432 | + case CLASS_RANGER: | |
3433 | + case CLASS_MONK: | |
3434 | + case CLASS_RED_MAGE: | |
3435 | + { | |
3436 | + msp -= msp * (cur_wgt - max_wgt) / 1000; | |
3437 | + break; | |
3438 | + } | |
3439 | + | |
3440 | + /* Mana halved if armour is 60 pounds over weight limit. */ | |
3441 | + case CLASS_PALADIN: | |
3442 | + case CLASS_CHAOS_WARRIOR: | |
3443 | + case CLASS_WARRIOR_MAGE: | |
3444 | + { | |
3445 | + msp -= msp * (cur_wgt - max_wgt) / 1200; | |
3446 | + break; | |
3447 | + } | |
3448 | + | |
3449 | + case CLASS_SAMURAI: | |
3450 | + { | |
3451 | + p_ptr->cumber_armor = FALSE; | |
3452 | + break; | |
3453 | + } | |
3454 | + | |
3455 | + /* For new classes created, but not yet added to this formula. */ | |
3456 | + default: | |
3457 | + { | |
3458 | + msp -= msp * (cur_wgt - max_wgt) / 800; | |
3459 | + break; | |
3460 | + } | |
3461 | + } | |
3462 | + } | |
3463 | + | |
3464 | + /* Mana can never be negative */ | |
3465 | + if (msp < 0) msp = 0; | |
3466 | + | |
3467 | + | |
3468 | + /* Maximum mana has changed */ | |
3469 | + if (p_ptr->msp != msp) | |
3470 | + { | |
3471 | + /* Enforce maximum */ | |
3472 | + if ((p_ptr->csp >= msp) && (p_ptr->pclass != CLASS_SAMURAI)) | |
3473 | + { | |
3474 | + p_ptr->csp = msp; | |
3475 | + p_ptr->csp_frac = 0; | |
3476 | + } | |
3477 | + | |
3478 | +#ifdef JP | |
3479 | + /* レベルアップの時は上昇量を表示する */ | |
3480 | + if ((level_up == 1) && (msp > p_ptr->msp)) | |
3481 | + { | |
3482 | + msg_format("最大マジック・ポイントが %d 増加した!", (msp - p_ptr->msp)); | |
3483 | + } | |
3484 | +#endif | |
3485 | + /* Save new mana */ | |
3486 | + p_ptr->msp = msp; | |
3487 | + | |
3488 | + /* Display mana later */ | |
3489 | + p_ptr->redraw |= (PR_MANA); | |
3490 | + | |
3491 | + p_ptr->window |= (PW_PLAYER); | |
3492 | + p_ptr->window |= (PW_SPELL); | |
3493 | + } | |
3494 | + | |
3495 | + | |
3496 | + /* Hack -- handle "xtra" mode */ | |
3497 | + if (character_xtra) return; | |
3498 | + | |
3499 | + /* Take note when "glove state" changes */ | |
3500 | + if (p_ptr->old_cumber_glove != p_ptr->cumber_glove) | |
3501 | + { | |
3502 | + if (p_ptr->cumber_glove) | |
3503 | + { | |
3504 | + msg_print(_("手が覆われて呪文が唱えにくい感じがする。", "Your covered hands feel unsuitable for spellcasting.")); | |
3505 | + } | |
3506 | + else | |
3507 | + { | |
3508 | + msg_print(_("この手の状態なら、ぐっと呪文が唱えやすい感じだ。", "Your hands feel more suitable for spellcasting.")); | |
3509 | + } | |
3510 | + | |
3511 | + /* Save it */ | |
3512 | + p_ptr->old_cumber_glove = p_ptr->cumber_glove; | |
3513 | + } | |
3514 | + | |
3515 | + | |
3516 | + /* Take note when "armor state" changes */ | |
3517 | + if (p_ptr->old_cumber_armor != p_ptr->cumber_armor) | |
3518 | + { | |
3519 | + if (p_ptr->cumber_armor) | |
3520 | + { | |
3521 | + msg_print(_("装備の重さで動きが鈍くなってしまっている。", "The weight of your equipment encumbers your movement.")); | |
3522 | + } | |
3523 | + else | |
3524 | + { | |
3525 | + msg_print(_("ぐっと楽に体を動かせるようになった。", "You feel able to move more freely.")); | |
3526 | + } | |
3527 | + | |
3528 | + /* Save it */ | |
3529 | + p_ptr->old_cumber_armor = p_ptr->cumber_armor; | |
3530 | + } | |
3531 | +} | |
3532 | + | |
3533 | +/*! | |
3534 | + * @brief 装備中の射撃武器の威力倍率を返す / | |
3535 | + * calcurate the fire rate of target object | |
3536 | + * @param o_ptr 計算する射撃武器のアイテム情報参照ポインタ | |
3537 | + * @return 射撃倍率の値(100で1.00倍) | |
3538 | + */ | |
3539 | +s16b calc_num_fire(object_type *o_ptr) | |
3540 | +{ | |
3541 | + int extra_shots = 0; | |
3542 | + int i; | |
3543 | + int num = 0; | |
3544 | + OBJECT_TYPE_VALUE tval_ammo = bow_tval_ammo(o_ptr); | |
3545 | + object_type *q_ptr; | |
3546 | + BIT_FLAGS flgs[TR_FLAG_SIZE]; | |
3547 | + | |
3548 | + /* Scan the usable inventory */ | |
3549 | + for (i = INVEN_RARM; i < INVEN_TOTAL; i++) | |
3550 | + { | |
3551 | + q_ptr = &inventory[i]; | |
3552 | + | |
3553 | + /* Skip non-objects */ | |
3554 | + if (!q_ptr->k_idx) continue; | |
3555 | + | |
3556 | + /* Do not apply current equip */ | |
3557 | + if (i == INVEN_BOW) continue; | |
3558 | + | |
3559 | + /* Extract the item flags */ | |
3560 | + object_flags(q_ptr, flgs); | |
3561 | + | |
3562 | + /* Boost shots */ | |
3563 | + if (have_flag(flgs, TR_XTRA_SHOTS)) extra_shots++; | |
3564 | + } | |
3565 | + | |
3566 | + object_flags(o_ptr, flgs); | |
3567 | + if (have_flag(flgs, TR_XTRA_SHOTS)) extra_shots++; | |
3568 | + | |
3569 | + if (o_ptr->k_idx && !is_heavy_shoot(o_ptr)) | |
3570 | + { | |
3571 | + num = 100; | |
3572 | + /* Extra shots */ | |
3573 | + num += (extra_shots * 100); | |
3574 | + | |
3575 | + /* Hack -- Rangers love Bows */ | |
3576 | + if ((p_ptr->pclass == CLASS_RANGER) && | |
3577 | + (tval_ammo == TV_ARROW)) | |
3578 | + { | |
3579 | + num += (p_ptr->lev * 4); | |
3580 | + } | |
3581 | + | |
3582 | + if ((p_ptr->pclass == CLASS_CAVALRY) && | |
3583 | + (tval_ammo == TV_ARROW)) | |
3584 | + { | |
3585 | + num += (p_ptr->lev * 3); | |
3586 | + } | |
3587 | + | |
3588 | + if (p_ptr->pclass == CLASS_ARCHER) | |
3589 | + { | |
3590 | + if (tval_ammo == TV_ARROW) | |
3591 | + num += ((p_ptr->lev * 5) + 50); | |
3592 | + else if ((tval_ammo == TV_BOLT) || (tval_ammo == TV_SHOT)) | |
3593 | + num += (p_ptr->lev * 4); | |
3594 | + } | |
3595 | + | |
3596 | + /* | |
3597 | + * Addendum -- also "Reward" high level warriors, | |
3598 | + * with _any_ missile weapon -- TY | |
3599 | + */ | |
3600 | + if (p_ptr->pclass == CLASS_WARRIOR && | |
3601 | + (tval_ammo <= TV_BOLT) && | |
3602 | + (tval_ammo >= TV_SHOT)) | |
3603 | + { | |
3604 | + num += (p_ptr->lev * 2); | |
3605 | + } | |
3606 | + if ((p_ptr->pclass == CLASS_ROGUE) && | |
3607 | + (tval_ammo == TV_SHOT)) | |
3608 | + { | |
3609 | + num += (p_ptr->lev * 4); | |
3610 | + } | |
3611 | + } | |
3612 | + return (s16b)num; | |
3613 | +} | |
3614 | + | |
3615 | +/*! | |
3616 | + * @brief プレイヤーの所持重量制限を計算する / | |
3617 | + * Computes current weight limit. | |
3618 | + * @return 制限重量(ポンド) | |
3619 | + */ | |
3620 | +WEIGHT weight_limit(void) | |
3621 | +{ | |
3622 | + WEIGHT i; | |
3623 | + | |
3624 | + /* Weight limit based only on strength */ | |
3625 | + i = (WEIGHT)adj_str_wgt[p_ptr->stat_ind[A_STR]] * 50; /* Constant was 100 */ | |
3626 | + if (p_ptr->pclass == CLASS_BERSERKER) i = i * 3 / 2; | |
3627 | + | |
3628 | + /* Return the result */ | |
3629 | + return i; | |
3630 | +} | |
3631 | + | |
3632 | +/*! | |
3633 | + * @brief プレイヤーが現在右手/左手に武器を持っているか判定する / | |
3634 | + * @param i 判定する手のID(右手:0 左手:1) | |
3635 | + * @return 持っているならばTRUE | |
3636 | + */ | |
3637 | +bool buki_motteruka(int i) | |
3638 | +{ | |
3639 | + return ((inventory[i].k_idx && object_is_melee_weapon(&inventory[i])) ? TRUE : FALSE); | |
3640 | +} | |
3641 | + | |
3642 | +/*! | |
3643 | + * @brief プレイヤーの現在開いている手の状態を返す | |
3644 | + * @param riding_control 乗馬中により片手を必要としている状態ならばTRUEを返す。 | |
3645 | + * @return 開いている手のビットフラグ | |
3646 | + */ | |
3647 | +BIT_FLAGS16 empty_hands(bool riding_control) | |
3648 | +{ | |
3649 | + BIT_FLAGS16 status = EMPTY_HAND_NONE; | |
3650 | + | |
3651 | + if (!inventory[INVEN_RARM].k_idx) status |= EMPTY_HAND_RARM; | |
3652 | + if (!inventory[INVEN_LARM].k_idx) status |= EMPTY_HAND_LARM; | |
3653 | + | |
3654 | + if (riding_control && (status != EMPTY_HAND_NONE) && p_ptr->riding && !(p_ptr->pet_extra_flags & PF_RYOUTE)) | |
3655 | + { | |
3656 | + if (status & EMPTY_HAND_LARM) status &= ~(EMPTY_HAND_LARM); | |
3657 | + else if (status & EMPTY_HAND_RARM) status &= ~(EMPTY_HAND_RARM); | |
3658 | + } | |
3659 | + | |
3660 | + return status; | |
3661 | +} | |
3662 | + | |
3663 | + | |
3664 | +/*! | |
3665 | + * @brief プレイヤーが防具重量制限のある職業時にペナルティを受ける状態にあるかどうかを返す。 | |
3666 | + * @return ペナルティが適用されるならばTRUE。 | |
3667 | + */ | |
3668 | +bool heavy_armor(void) | |
3669 | +{ | |
3670 | + WEIGHT monk_arm_wgt = 0; | |
3671 | + | |
3672 | + if ((p_ptr->pclass != CLASS_MONK) && (p_ptr->pclass != CLASS_FORCETRAINER) && (p_ptr->pclass != CLASS_NINJA)) return FALSE; | |
3673 | + | |
3674 | + /* Weight the armor */ | |
3675 | + if (inventory[INVEN_RARM].tval > TV_SWORD) monk_arm_wgt += inventory[INVEN_RARM].weight; | |
3676 | + if (inventory[INVEN_LARM].tval > TV_SWORD) monk_arm_wgt += inventory[INVEN_LARM].weight; | |
3677 | + monk_arm_wgt += inventory[INVEN_BODY].weight; | |
3678 | + monk_arm_wgt += inventory[INVEN_HEAD].weight; | |
3679 | + monk_arm_wgt += inventory[INVEN_OUTER].weight; | |
3680 | + monk_arm_wgt += inventory[INVEN_HANDS].weight; | |
3681 | + monk_arm_wgt += inventory[INVEN_FEET].weight; | |
3682 | + | |
3683 | + return (monk_arm_wgt > (100 + (p_ptr->lev * 4))); | |
3684 | +} | |
3685 | + | |
3686 | +/*! | |
3687 | + * @brief p_ptr->update のフラグに応じた更新をまとめて行う / Handle "p_ptr->update" | |
3688 | + * @return なし | |
3689 | + * @details 更新処理の対象はプレイヤーの能力修正/光源寿命/HP/MP/魔法の学習状態、他多数の外界の状態判定。 | |
3690 | + */ | |
3691 | +void update_creature(player_type *creature_ptr) | |
3692 | +{ | |
3693 | + if (!creature_ptr->update) return; | |
3694 | + | |
3695 | + /* Actually do auto-destroy */ | |
3696 | + if (creature_ptr->update & (PU_AUTODESTROY)) | |
3697 | + { | |
3698 | + creature_ptr->update &= ~(PU_AUTODESTROY); | |
3699 | + autopick_delayed_alter(); | |
3700 | + } | |
3701 | + | |
3702 | + /* Combine the pack */ | |
3703 | + if (creature_ptr->update & (PU_COMBINE)) | |
3704 | + { | |
3705 | + creature_ptr->update &= ~(PU_COMBINE); | |
3706 | + combine_pack(); | |
3707 | + } | |
3708 | + | |
3709 | + /* Reorder the pack */ | |
3710 | + if (creature_ptr->update & (PU_REORDER)) | |
3711 | + { | |
3712 | + creature_ptr->update &= ~(PU_REORDER); | |
3713 | + reorder_pack(); | |
3714 | + } | |
3715 | + | |
3716 | + if (creature_ptr->update & (PU_BONUS)) | |
3717 | + { | |
3718 | + creature_ptr->update &= ~(PU_BONUS); | |
3719 | + calc_bonuses(); | |
3720 | + } | |
3721 | + | |
3722 | + if (creature_ptr->update & (PU_TORCH)) | |
3723 | + { | |
3724 | + creature_ptr->update &= ~(PU_TORCH); | |
3725 | + calc_torch(); | |
3726 | + } | |
3727 | + | |
3728 | + if (creature_ptr->update & (PU_HP)) | |
3729 | + { | |
3730 | + creature_ptr->update &= ~(PU_HP); | |
3731 | + calc_hitpoints(); | |
3732 | + } | |
3733 | + | |
3734 | + if (creature_ptr->update & (PU_MANA)) | |
3735 | + { | |
3736 | + creature_ptr->update &= ~(PU_MANA); | |
3737 | + calc_mana(); | |
3738 | + } | |
3739 | + | |
3740 | + if (creature_ptr->update & (PU_SPELLS)) | |
3741 | + { | |
3742 | + creature_ptr->update &= ~(PU_SPELLS); | |
3743 | + calc_spells(); | |
3744 | + } | |
3745 | + | |
3746 | + /* Character is not ready yet, no screen updates */ | |
3747 | + if (!character_generated) return; | |
3748 | + | |
3749 | + /* Character is in "icky" mode, no screen updates */ | |
3750 | + if (character_icky) return; | |
3751 | + | |
3752 | + if (creature_ptr->update & (PU_UN_LITE)) | |
3753 | + { | |
3754 | + creature_ptr->update &= ~(PU_UN_LITE); | |
3755 | + forget_lite(); | |
3756 | + } | |
3757 | + | |
3758 | + if (creature_ptr->update & (PU_UN_VIEW)) | |
3759 | + { | |
3760 | + creature_ptr->update &= ~(PU_UN_VIEW); | |
3761 | + forget_view(); | |
3762 | + } | |
3763 | + | |
3764 | + if (creature_ptr->update & (PU_VIEW)) | |
3765 | + { | |
3766 | + creature_ptr->update &= ~(PU_VIEW); | |
3767 | + update_view(); | |
3768 | + } | |
3769 | + | |
3770 | + if (creature_ptr->update & (PU_LITE)) | |
3771 | + { | |
3772 | + creature_ptr->update &= ~(PU_LITE); | |
3773 | + update_lite(); | |
3774 | + } | |
3775 | + | |
3776 | + | |
3777 | + if (creature_ptr->update & (PU_FLOW)) | |
3778 | + { | |
3779 | + creature_ptr->update &= ~(PU_FLOW); | |
3780 | + update_flow(); | |
3781 | + } | |
3782 | + | |
3783 | + if (creature_ptr->update & (PU_DISTANCE)) | |
3784 | + { | |
3785 | + creature_ptr->update &= ~(PU_DISTANCE); | |
3786 | + | |
3787 | + /* Still need to call update_monsters(FALSE) after update_mon_lite() */ | |
3788 | + /* creature_ptr->update &= ~(PU_MONSTERS); */ | |
3789 | + | |
3790 | + update_monsters(TRUE); | |
3791 | + } | |
3792 | + | |
3793 | + if (creature_ptr->update & (PU_MON_LITE)) | |
3794 | + { | |
3795 | + creature_ptr->update &= ~(PU_MON_LITE); | |
3796 | + update_mon_lite(); | |
3797 | + } | |
3798 | + | |
3799 | + /* | |
3800 | + * Mega-Hack -- Delayed visual update | |
3801 | + * Only used if update_view(), update_lite() or update_mon_lite() was called | |
3802 | + */ | |
3803 | + if (creature_ptr->update & (PU_DELAY_VIS)) | |
3804 | + { | |
3805 | + creature_ptr->update &= ~(PU_DELAY_VIS); | |
3806 | + delayed_visual_update(); | |
3807 | + } | |
3808 | + | |
3809 | + if (creature_ptr->update & (PU_MONSTERS)) | |
3810 | + { | |
3811 | + creature_ptr->update &= ~(PU_MONSTERS); | |
3812 | + update_monsters(FALSE); | |
3813 | + } | |
3814 | +} |
@@ -2073,3636 +2073,52 @@ static void fix_object(void) | ||
2073 | 2073 | |
2074 | 2074 | |
2075 | 2075 | /*! |
2076 | - * @brief プレイヤーの現在学習可能な魔法数を計算し、増減に応じて魔法の忘却、再学習を処置する。 / | |
2077 | - * Calculate number of spells player should have, and forget, | |
2078 | - * or remember, spells until that number is properly reflected. | |
2079 | - * @return なし | |
2080 | - * @details | |
2081 | - * Note that this function induces various "status" messages, | |
2082 | - * which must be bypasses until the character is created. | |
2083 | - */ | |
2084 | -static void calc_spells(void) | |
2085 | -{ | |
2086 | - int i, j, k, levels; | |
2087 | - int num_allowed; | |
2088 | - int num_boukyaku = 0; | |
2089 | - | |
2090 | - const magic_type *s_ptr; | |
2091 | - REALM_IDX which; | |
2092 | - int bonus = 0; | |
2093 | - | |
2094 | - | |
2095 | - concptr p; | |
2096 | - | |
2097 | - /* Hack -- must be literate */ | |
2098 | - if (!mp_ptr->spell_book) return; | |
2099 | - | |
2100 | - /* Hack -- wait for creation */ | |
2101 | - if (!character_generated) return; | |
2102 | - | |
2103 | - /* Hack -- handle "xtra" mode */ | |
2104 | - if (character_xtra) return; | |
2105 | - | |
2106 | - if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE)) | |
2107 | - { | |
2108 | - p_ptr->new_spells = 0; | |
2109 | - return; | |
2110 | - } | |
2111 | - | |
2112 | - p = spell_category_name(mp_ptr->spell_book); | |
2113 | - | |
2114 | - /* Determine the number of spells allowed */ | |
2115 | - levels = p_ptr->lev - mp_ptr->spell_first + 1; | |
2116 | - | |
2117 | - /* Hack -- no negative spells */ | |
2118 | - if (levels < 0) levels = 0; | |
2119 | - | |
2120 | - /* Extract total allowed spells */ | |
2121 | - num_allowed = (adj_mag_study[p_ptr->stat_ind[mp_ptr->spell_stat]] * levels / 2); | |
2122 | - | |
2123 | - if ((p_ptr->pclass != CLASS_SAMURAI) && (mp_ptr->spell_book != TV_LIFE_BOOK)) | |
2124 | - { | |
2125 | - bonus = 4; | |
2126 | - } | |
2127 | - if (p_ptr->pclass == CLASS_SAMURAI) | |
2128 | - { | |
2129 | - num_allowed = 32; | |
2130 | - } | |
2131 | - else if (p_ptr->realm2 == REALM_NONE) | |
2132 | - { | |
2133 | - num_allowed = (num_allowed+1)/2; | |
2134 | - if (num_allowed>(32+bonus)) num_allowed = 32+bonus; | |
2135 | - } | |
2136 | - else if ((p_ptr->pclass == CLASS_MAGE) || (p_ptr->pclass == CLASS_PRIEST)) | |
2137 | - { | |
2138 | - if (num_allowed>(96+bonus)) num_allowed = 96+bonus; | |
2139 | - } | |
2140 | - else | |
2141 | - { | |
2142 | - if (num_allowed>(80+bonus)) num_allowed = 80+bonus; | |
2143 | - } | |
2144 | - | |
2145 | - /* Count the number of spells we know */ | |
2146 | - for (j = 0; j < 64; j++) | |
2147 | - { | |
2148 | - /* Count known spells */ | |
2149 | - if ((j < 32) ? | |
2150 | - (p_ptr->spell_forgotten1 & (1L << j)) : | |
2151 | - (p_ptr->spell_forgotten2 & (1L << (j - 32)))) | |
2152 | - { | |
2153 | - num_boukyaku++; | |
2154 | - } | |
2155 | - } | |
2156 | - | |
2157 | - /* See how many spells we must forget or may learn */ | |
2158 | - p_ptr->new_spells = num_allowed + p_ptr->add_spells + num_boukyaku - p_ptr->learned_spells; | |
2159 | - | |
2160 | - /* Forget spells which are too hard */ | |
2161 | - for (i = 63; i >= 0; i--) | |
2162 | - { | |
2163 | - /* Efficiency -- all done */ | |
2164 | - if (!p_ptr->spell_learned1 && !p_ptr->spell_learned2) break; | |
2165 | - | |
2166 | - /* Access the spell */ | |
2167 | - j = p_ptr->spell_order[i]; | |
2168 | - | |
2169 | - /* Skip non-spells */ | |
2170 | - if (j >= 99) continue; | |
2171 | - | |
2172 | - | |
2173 | - /* Get the spell */ | |
2174 | - if (!is_magic((j < 32) ? p_ptr->realm1 : p_ptr->realm2)) | |
2175 | - { | |
2176 | - if (j < 32) | |
2177 | - s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][j]; | |
2178 | - else | |
2179 | - s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][j%32]; | |
2180 | - } | |
2181 | - else if (j < 32) | |
2182 | - s_ptr = &mp_ptr->info[p_ptr->realm1-1][j]; | |
2183 | - else | |
2184 | - s_ptr = &mp_ptr->info[p_ptr->realm2-1][j%32]; | |
2185 | - | |
2186 | - /* Skip spells we are allowed to know */ | |
2187 | - if (s_ptr->slevel <= p_ptr->lev) continue; | |
2188 | - | |
2189 | - /* Is it known? */ | |
2190 | - if ((j < 32) ? | |
2191 | - (p_ptr->spell_learned1 & (1L << j)) : | |
2192 | - (p_ptr->spell_learned2 & (1L << (j - 32)))) | |
2193 | - { | |
2194 | - /* Mark as forgotten */ | |
2195 | - if (j < 32) | |
2196 | - { | |
2197 | - p_ptr->spell_forgotten1 |= (1L << j); | |
2198 | - which = p_ptr->realm1; | |
2199 | - } | |
2200 | - else | |
2201 | - { | |
2202 | - p_ptr->spell_forgotten2 |= (1L << (j - 32)); | |
2203 | - which = p_ptr->realm2; | |
2204 | - } | |
2205 | - | |
2206 | - /* No longer known */ | |
2207 | - if (j < 32) | |
2208 | - { | |
2209 | - p_ptr->spell_learned1 &= ~(1L << j); | |
2210 | - which = p_ptr->realm1; | |
2211 | - } | |
2212 | - else | |
2213 | - { | |
2214 | - p_ptr->spell_learned2 &= ~(1L << (j - 32)); | |
2215 | - which = p_ptr->realm2; | |
2216 | - } | |
2217 | - | |
2218 | -#ifdef JP | |
2219 | - msg_format("%sの%sを忘れてしまった。", do_spell(which, j%32, SPELL_NAME), p ); | |
2220 | -#else | |
2221 | - msg_format("You have forgotten the %s of %s.", p, do_spell(which, j%32, SPELL_NAME)); | |
2222 | -#endif | |
2223 | - | |
2224 | - | |
2225 | - /* One more can be learned */ | |
2226 | - p_ptr->new_spells++; | |
2227 | - } | |
2228 | - } | |
2229 | - | |
2230 | - | |
2231 | - /* Forget spells if we know too many spells */ | |
2232 | - for (i = 63; i >= 0; i--) | |
2233 | - { | |
2234 | - /* Stop when possible */ | |
2235 | - if (p_ptr->new_spells >= 0) break; | |
2236 | - | |
2237 | - /* Efficiency -- all done */ | |
2238 | - if (!p_ptr->spell_learned1 && !p_ptr->spell_learned2) break; | |
2239 | - | |
2240 | - /* Get the (i+1)th spell learned */ | |
2241 | - j = p_ptr->spell_order[i]; | |
2242 | - | |
2243 | - /* Skip unknown spells */ | |
2244 | - if (j >= 99) continue; | |
2245 | - | |
2246 | - /* Forget it (if learned) */ | |
2247 | - if ((j < 32) ? | |
2248 | - (p_ptr->spell_learned1 & (1L << j)) : | |
2249 | - (p_ptr->spell_learned2 & (1L << (j - 32)))) | |
2250 | - { | |
2251 | - /* Mark as forgotten */ | |
2252 | - if (j < 32) | |
2253 | - { | |
2254 | - p_ptr->spell_forgotten1 |= (1L << j); | |
2255 | - which = p_ptr->realm1; | |
2256 | - } | |
2257 | - else | |
2258 | - { | |
2259 | - p_ptr->spell_forgotten2 |= (1L << (j - 32)); | |
2260 | - which = p_ptr->realm2; | |
2261 | - } | |
2262 | - | |
2263 | - /* No longer known */ | |
2264 | - if (j < 32) | |
2265 | - { | |
2266 | - p_ptr->spell_learned1 &= ~(1L << j); | |
2267 | - which = p_ptr->realm1; | |
2268 | - } | |
2269 | - else | |
2270 | - { | |
2271 | - p_ptr->spell_learned2 &= ~(1L << (j - 32)); | |
2272 | - which = p_ptr->realm2; | |
2273 | - } | |
2274 | - | |
2275 | -#ifdef JP | |
2276 | - msg_format("%sの%sを忘れてしまった。", | |
2277 | - do_spell(which, j%32, SPELL_NAME), p ); | |
2278 | -#else | |
2279 | - msg_format("You have forgotten the %s of %s.", p, | |
2280 | - do_spell(which, j%32, SPELL_NAME)); | |
2281 | -#endif | |
2282 | - | |
2283 | - | |
2284 | - /* One more can be learned */ | |
2285 | - p_ptr->new_spells++; | |
2286 | - } | |
2287 | - } | |
2288 | - | |
2289 | - | |
2290 | - /* Check for spells to remember */ | |
2291 | - for (i = 0; i < 64; i++) | |
2292 | - { | |
2293 | - /* None left to remember */ | |
2294 | - if (p_ptr->new_spells <= 0) break; | |
2295 | - | |
2296 | - /* Efficiency -- all done */ | |
2297 | - if (!p_ptr->spell_forgotten1 && !p_ptr->spell_forgotten2) break; | |
2298 | - | |
2299 | - /* Get the next spell we learned */ | |
2300 | - j = p_ptr->spell_order[i]; | |
2301 | - | |
2302 | - /* Skip unknown spells */ | |
2303 | - if (j >= 99) break; | |
2304 | - | |
2305 | - /* Access the spell */ | |
2306 | - if (!is_magic((j < 32) ? p_ptr->realm1 : p_ptr->realm2)) | |
2307 | - { | |
2308 | - if (j < 32) | |
2309 | - s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][j]; | |
2310 | - else | |
2311 | - s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][j%32]; | |
2312 | - } | |
2313 | - else if (j<32) | |
2314 | - s_ptr = &mp_ptr->info[p_ptr->realm1-1][j]; | |
2315 | - else | |
2316 | - s_ptr = &mp_ptr->info[p_ptr->realm2-1][j%32]; | |
2317 | - | |
2318 | - /* Skip spells we cannot remember */ | |
2319 | - if (s_ptr->slevel > p_ptr->lev) continue; | |
2320 | - | |
2321 | - /* First set of spells */ | |
2322 | - if ((j < 32) ? | |
2323 | - (p_ptr->spell_forgotten1 & (1L << j)) : | |
2324 | - (p_ptr->spell_forgotten2 & (1L << (j - 32)))) | |
2325 | - { | |
2326 | - /* No longer forgotten */ | |
2327 | - if (j < 32) | |
2328 | - { | |
2329 | - p_ptr->spell_forgotten1 &= ~(1L << j); | |
2330 | - which = p_ptr->realm1; | |
2331 | - } | |
2332 | - else | |
2333 | - { | |
2334 | - p_ptr->spell_forgotten2 &= ~(1L << (j - 32)); | |
2335 | - which = p_ptr->realm2; | |
2336 | - } | |
2337 | - | |
2338 | - /* Known once more */ | |
2339 | - if (j < 32) | |
2340 | - { | |
2341 | - p_ptr->spell_learned1 |= (1L << j); | |
2342 | - which = p_ptr->realm1; | |
2343 | - } | |
2344 | - else | |
2345 | - { | |
2346 | - p_ptr->spell_learned2 |= (1L << (j - 32)); | |
2347 | - which = p_ptr->realm2; | |
2348 | - } | |
2349 | - | |
2350 | -#ifdef JP | |
2351 | - msg_format("%sの%sを思い出した。", do_spell(which, j%32, SPELL_NAME), p ); | |
2352 | -#else | |
2353 | - msg_format("You have remembered the %s of %s.", p, do_spell(which, j%32, SPELL_NAME)); | |
2354 | -#endif | |
2355 | - | |
2356 | - | |
2357 | - /* One less can be learned */ | |
2358 | - p_ptr->new_spells--; | |
2359 | - } | |
2360 | - } | |
2361 | - | |
2362 | - k = 0; | |
2363 | - | |
2364 | - if (p_ptr->realm2 == REALM_NONE) | |
2365 | - { | |
2366 | - /* Count spells that can be learned */ | |
2367 | - for (j = 0; j < 32; j++) | |
2368 | - { | |
2369 | - if (!is_magic(p_ptr->realm1)) s_ptr = &technic_info[p_ptr->realm1-MIN_TECHNIC][j]; | |
2370 | - else s_ptr = &mp_ptr->info[p_ptr->realm1-1][j]; | |
2371 | - | |
2372 | - /* Skip spells we cannot remember */ | |
2373 | - if (s_ptr->slevel > p_ptr->lev) continue; | |
2374 | - | |
2375 | - /* Skip spells we already know */ | |
2376 | - if (p_ptr->spell_learned1 & (1L << j)) | |
2377 | - { | |
2378 | - continue; | |
2379 | - } | |
2380 | - | |
2381 | - /* Count it */ | |
2382 | - k++; | |
2383 | - } | |
2384 | - if (k > 32) k = 32; | |
2385 | - if ((p_ptr->new_spells > k) && | |
2386 | - ((mp_ptr->spell_book == TV_LIFE_BOOK) || (mp_ptr->spell_book == TV_HISSATSU_BOOK))) | |
2387 | - { | |
2388 | - p_ptr->new_spells = (s16b)k; | |
2389 | - } | |
2390 | - } | |
2391 | - | |
2392 | - if (p_ptr->new_spells < 0) p_ptr->new_spells = 0; | |
2393 | - | |
2394 | - /* Spell count changed */ | |
2395 | - if (p_ptr->old_spells != p_ptr->new_spells) | |
2396 | - { | |
2397 | - /* Message if needed */ | |
2398 | - if (p_ptr->new_spells) | |
2399 | - { | |
2400 | -#ifdef JP | |
2401 | - if( p_ptr->new_spells < 10 ){ | |
2402 | - msg_format("あと %d つの%sを学べる。", p_ptr->new_spells, p); | |
2403 | - }else{ | |
2404 | - msg_format("あと %d 個の%sを学べる。", p_ptr->new_spells, p); | |
2405 | - } | |
2406 | -#else | |
2407 | - msg_format("You can learn %d more %s%s.", | |
2408 | - p_ptr->new_spells, p, | |
2409 | - (p_ptr->new_spells != 1) ? "s" : ""); | |
2410 | -#endif | |
2411 | - | |
2412 | - } | |
2413 | - | |
2414 | - /* Save the new_spells value */ | |
2415 | - p_ptr->old_spells = p_ptr->new_spells; | |
2416 | - | |
2417 | - /* Redraw Study Status */ | |
2418 | - p_ptr->redraw |= (PR_STUDY); | |
2419 | - | |
2420 | - /* Redraw object recall */ | |
2421 | - p_ptr->window |= (PW_OBJECT); | |
2422 | - } | |
2423 | -} | |
2424 | - | |
2425 | -/*! | |
2426 | - * @brief プレイヤーの最大MPを計算する / | |
2427 | - * Calculate maximum mana. You do not need to know any spells. | |
2428 | - * Note that mana is lowered by heavy (or inappropriate) armor. | |
2429 | - * @return なし | |
2430 | - * @details | |
2431 | - * This function induces status messages. | |
2432 | - */ | |
2433 | -static void calc_mana(void) | |
2434 | -{ | |
2435 | - int msp, levels, cur_wgt, max_wgt; | |
2436 | - | |
2437 | - object_type *o_ptr; | |
2438 | - | |
2439 | - | |
2440 | - /* Hack -- Must be literate */ | |
2441 | - if (!mp_ptr->spell_book) return; | |
2442 | - | |
2443 | - if ((p_ptr->pclass == CLASS_MINDCRAFTER) || | |
2444 | - (p_ptr->pclass == CLASS_MIRROR_MASTER) || | |
2445 | - (p_ptr->pclass == CLASS_BLUE_MAGE)) | |
2446 | - { | |
2447 | - levels = p_ptr->lev; | |
2448 | - } | |
2449 | - else | |
2450 | - { | |
2451 | - if(mp_ptr->spell_first > p_ptr->lev) | |
2452 | - { | |
2453 | - /* Save new mana */ | |
2454 | - p_ptr->msp = 0; | |
2455 | - | |
2456 | - /* Display mana later */ | |
2457 | - p_ptr->redraw |= (PR_MANA); | |
2458 | - return; | |
2459 | - } | |
2460 | - | |
2461 | - /* Extract "effective" player level */ | |
2462 | - levels = (p_ptr->lev - mp_ptr->spell_first) + 1; | |
2463 | - } | |
2464 | - | |
2465 | - if (p_ptr->pclass == CLASS_SAMURAI) | |
2466 | - { | |
2467 | - msp = (adj_mag_mana[p_ptr->stat_ind[mp_ptr->spell_stat]] + 10) * 2; | |
2468 | - if (msp) msp += (msp * rp_ptr->r_adj[mp_ptr->spell_stat] / 20); | |
2469 | - } | |
2470 | - else | |
2471 | - { | |
2472 | - /* Extract total mana */ | |
2473 | - msp = adj_mag_mana[p_ptr->stat_ind[mp_ptr->spell_stat]] * (levels+3) / 4; | |
2474 | - | |
2475 | - /* Hack -- usually add one mana */ | |
2476 | - if (msp) msp++; | |
2477 | - | |
2478 | - if (msp) msp += (msp * rp_ptr->r_adj[mp_ptr->spell_stat] / 20); | |
2479 | - | |
2480 | - if (msp && (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)) msp += msp/2; | |
2481 | - | |
2482 | - /* Hack: High mages have a 25% mana bonus */ | |
2483 | - if (msp && (p_ptr->pclass == CLASS_HIGH_MAGE)) msp += msp / 4; | |
2484 | - | |
2485 | - if (msp && (p_ptr->pclass == CLASS_SORCERER)) msp += msp*(25+p_ptr->lev)/100; | |
2486 | - } | |
2487 | - | |
2488 | - /* Only mages are affected */ | |
2489 | - if (mp_ptr->spell_xtra & MAGIC_GLOVE_REDUCE_MANA) | |
2490 | - { | |
2491 | - BIT_FLAGS flgs[TR_FLAG_SIZE]; | |
2492 | - | |
2493 | - /* Assume player is not encumbered by gloves */ | |
2494 | - p_ptr->cumber_glove = FALSE; | |
2495 | - | |
2496 | - /* Get the gloves */ | |
2497 | - o_ptr = &inventory[INVEN_HANDS]; | |
2498 | - | |
2499 | - /* Examine the gloves */ | |
2500 | - object_flags(o_ptr, flgs); | |
2501 | - | |
2502 | - /* Normal gloves hurt mage-type spells */ | |
2503 | - if (o_ptr->k_idx && | |
2504 | - !(have_flag(flgs, TR_FREE_ACT)) && | |
2505 | - !(have_flag(flgs, TR_DEC_MANA)) && | |
2506 | - !(have_flag(flgs, TR_EASY_SPELL)) && | |
2507 | - !((have_flag(flgs, TR_MAGIC_MASTERY)) && (o_ptr->pval > 0)) && | |
2508 | - !((have_flag(flgs, TR_DEX)) && (o_ptr->pval > 0))) | |
2509 | - { | |
2510 | - /* Encumbered */ | |
2511 | - p_ptr->cumber_glove = TRUE; | |
2512 | - | |
2513 | - /* Reduce mana */ | |
2514 | - msp = (3 * msp) / 4; | |
2515 | - } | |
2516 | - } | |
2517 | - | |
2518 | - | |
2519 | - /* Assume player not encumbered by armor */ | |
2520 | - p_ptr->cumber_armor = FALSE; | |
2521 | - | |
2522 | - /* Weigh the armor */ | |
2523 | - cur_wgt = 0; | |
2524 | - if(inventory[INVEN_RARM].tval> TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight; | |
2525 | - if(inventory[INVEN_LARM].tval> TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight; | |
2526 | - cur_wgt += inventory[INVEN_BODY].weight; | |
2527 | - cur_wgt += inventory[INVEN_HEAD].weight; | |
2528 | - cur_wgt += inventory[INVEN_OUTER].weight; | |
2529 | - cur_wgt += inventory[INVEN_HANDS].weight; | |
2530 | - cur_wgt += inventory[INVEN_FEET].weight; | |
2531 | - | |
2532 | - /* Subtract a percentage of maximum mana. */ | |
2533 | - switch (p_ptr->pclass) | |
2534 | - { | |
2535 | - /* For these classes, mana is halved if armour | |
2536 | - * is 30 pounds over their weight limit. */ | |
2537 | - case CLASS_MAGE: | |
2538 | - case CLASS_HIGH_MAGE: | |
2539 | - case CLASS_BLUE_MAGE: | |
2540 | - case CLASS_MONK: | |
2541 | - case CLASS_FORCETRAINER: | |
2542 | - case CLASS_SORCERER: | |
2543 | - { | |
2544 | - if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight; | |
2545 | - if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight; | |
2546 | - break; | |
2547 | - } | |
2548 | - | |
2549 | - /* Mana halved if armour is 40 pounds over weight limit. */ | |
2550 | - case CLASS_PRIEST: | |
2551 | - case CLASS_BARD: | |
2552 | - case CLASS_TOURIST: | |
2553 | - { | |
2554 | - if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight*2/3; | |
2555 | - if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight*2/3; | |
2556 | - break; | |
2557 | - } | |
2558 | - | |
2559 | - case CLASS_MINDCRAFTER: | |
2560 | - case CLASS_BEASTMASTER: | |
2561 | - case CLASS_MIRROR_MASTER: | |
2562 | - { | |
2563 | - if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight/2; | |
2564 | - if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight/2; | |
2565 | - break; | |
2566 | - } | |
2567 | - | |
2568 | - /* Mana halved if armour is 50 pounds over weight limit. */ | |
2569 | - case CLASS_ROGUE: | |
2570 | - case CLASS_RANGER: | |
2571 | - case CLASS_RED_MAGE: | |
2572 | - case CLASS_WARRIOR_MAGE: | |
2573 | - { | |
2574 | - if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight/3; | |
2575 | - if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight/3; | |
2576 | - break; | |
2577 | - } | |
2578 | - | |
2579 | - /* Mana halved if armour is 60 pounds over weight limit. */ | |
2580 | - case CLASS_PALADIN: | |
2581 | - case CLASS_CHAOS_WARRIOR: | |
2582 | - { | |
2583 | - if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight/5; | |
2584 | - if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight/5; | |
2585 | - break; | |
2586 | - } | |
2587 | - | |
2588 | - /* For new classes created, but not yet added to this formula. */ | |
2589 | - default: | |
2590 | - { | |
2591 | - break; | |
2592 | - } | |
2593 | - } | |
2594 | - | |
2595 | - /* Determine the weight allowance */ | |
2596 | - max_wgt = mp_ptr->spell_weight; | |
2597 | - | |
2598 | - /* Heavy armor penalizes mana by a percentage. -LM- */ | |
2599 | - if ((cur_wgt - max_wgt) > 0) | |
2600 | - { | |
2601 | - /* Encumbered */ | |
2602 | - p_ptr->cumber_armor = TRUE; | |
2603 | - | |
2604 | - /* Subtract a percentage of maximum mana. */ | |
2605 | - switch (p_ptr->pclass) | |
2606 | - { | |
2607 | - /* For these classes, mana is halved if armour | |
2608 | - * is 30 pounds over their weight limit. */ | |
2609 | - case CLASS_MAGE: | |
2610 | - case CLASS_HIGH_MAGE: | |
2611 | - case CLASS_BLUE_MAGE: | |
2612 | - { | |
2613 | - msp -= msp * (cur_wgt - max_wgt) / 600; | |
2614 | - break; | |
2615 | - } | |
2616 | - | |
2617 | - /* Mana halved if armour is 40 pounds over weight limit. */ | |
2618 | - case CLASS_PRIEST: | |
2619 | - case CLASS_MINDCRAFTER: | |
2620 | - case CLASS_BEASTMASTER: | |
2621 | - case CLASS_BARD: | |
2622 | - case CLASS_FORCETRAINER: | |
2623 | - case CLASS_TOURIST: | |
2624 | - case CLASS_MIRROR_MASTER: | |
2625 | - { | |
2626 | - msp -= msp * (cur_wgt - max_wgt) / 800; | |
2627 | - break; | |
2628 | - } | |
2629 | - | |
2630 | - case CLASS_SORCERER: | |
2631 | - { | |
2632 | - msp -= msp * (cur_wgt - max_wgt) / 900; | |
2633 | - break; | |
2634 | - } | |
2635 | - | |
2636 | - /* Mana halved if armour is 50 pounds over weight limit. */ | |
2637 | - case CLASS_ROGUE: | |
2638 | - case CLASS_RANGER: | |
2639 | - case CLASS_MONK: | |
2640 | - case CLASS_RED_MAGE: | |
2641 | - { | |
2642 | - msp -= msp * (cur_wgt - max_wgt) / 1000; | |
2643 | - break; | |
2644 | - } | |
2645 | - | |
2646 | - /* Mana halved if armour is 60 pounds over weight limit. */ | |
2647 | - case CLASS_PALADIN: | |
2648 | - case CLASS_CHAOS_WARRIOR: | |
2649 | - case CLASS_WARRIOR_MAGE: | |
2650 | - { | |
2651 | - msp -= msp * (cur_wgt - max_wgt) / 1200; | |
2652 | - break; | |
2653 | - } | |
2654 | - | |
2655 | - case CLASS_SAMURAI: | |
2656 | - { | |
2657 | - p_ptr->cumber_armor = FALSE; | |
2658 | - break; | |
2659 | - } | |
2660 | - | |
2661 | - /* For new classes created, but not yet added to this formula. */ | |
2662 | - default: | |
2663 | - { | |
2664 | - msp -= msp * (cur_wgt - max_wgt) / 800; | |
2665 | - break; | |
2666 | - } | |
2667 | - } | |
2668 | - } | |
2669 | - | |
2670 | - /* Mana can never be negative */ | |
2671 | - if (msp < 0) msp = 0; | |
2672 | - | |
2673 | - | |
2674 | - /* Maximum mana has changed */ | |
2675 | - if (p_ptr->msp != msp) | |
2676 | - { | |
2677 | - /* Enforce maximum */ | |
2678 | - if ((p_ptr->csp >= msp) && (p_ptr->pclass != CLASS_SAMURAI)) | |
2679 | - { | |
2680 | - p_ptr->csp = msp; | |
2681 | - p_ptr->csp_frac = 0; | |
2682 | - } | |
2683 | - | |
2684 | -#ifdef JP | |
2685 | - /* レベルアップの時は上昇量を表示する */ | |
2686 | - if ((level_up == 1) && (msp > p_ptr->msp)) | |
2687 | - { | |
2688 | - msg_format("最大マジック・ポイントが %d 増加した!", (msp - p_ptr->msp)); | |
2689 | - } | |
2690 | -#endif | |
2691 | - /* Save new mana */ | |
2692 | - p_ptr->msp = msp; | |
2693 | - | |
2694 | - /* Display mana later */ | |
2695 | - p_ptr->redraw |= (PR_MANA); | |
2696 | - | |
2697 | - p_ptr->window |= (PW_PLAYER); | |
2698 | - p_ptr->window |= (PW_SPELL); | |
2699 | - } | |
2700 | - | |
2701 | - | |
2702 | - /* Hack -- handle "xtra" mode */ | |
2703 | - if (character_xtra) return; | |
2704 | - | |
2705 | - /* Take note when "glove state" changes */ | |
2706 | - if (p_ptr->old_cumber_glove != p_ptr->cumber_glove) | |
2707 | - { | |
2708 | - if (p_ptr->cumber_glove) | |
2709 | - { | |
2710 | - msg_print(_("手が覆われて呪文が唱えにくい感じがする。", "Your covered hands feel unsuitable for spellcasting.")); | |
2711 | - } | |
2712 | - else | |
2713 | - { | |
2714 | - msg_print(_("この手の状態なら、ぐっと呪文が唱えやすい感じだ。", "Your hands feel more suitable for spellcasting.")); | |
2715 | - } | |
2716 | - | |
2717 | - /* Save it */ | |
2718 | - p_ptr->old_cumber_glove = p_ptr->cumber_glove; | |
2719 | - } | |
2720 | - | |
2721 | - | |
2722 | - /* Take note when "armor state" changes */ | |
2723 | - if (p_ptr->old_cumber_armor != p_ptr->cumber_armor) | |
2724 | - { | |
2725 | - if (p_ptr->cumber_armor) | |
2726 | - { | |
2727 | - msg_print(_("装備の重さで動きが鈍くなってしまっている。", "The weight of your equipment encumbers your movement.")); | |
2728 | - } | |
2729 | - else | |
2730 | - { | |
2731 | - msg_print(_("ぐっと楽に体を動かせるようになった。", "You feel able to move more freely.")); | |
2732 | - } | |
2733 | - | |
2734 | - /* Save it */ | |
2735 | - p_ptr->old_cumber_armor = p_ptr->cumber_armor; | |
2736 | - } | |
2737 | -} | |
2738 | - | |
2739 | - | |
2740 | - | |
2741 | -/*! | |
2742 | - * @brief プレイヤーの最大HPを計算する / | |
2743 | - * Calculate the players (maximal) hit points | |
2744 | - * Adjust current hitpoints if necessary | |
2745 | - * @return なし | |
2746 | - * @details | |
2747 | - */ | |
2748 | -static void calc_hitpoints(void) | |
2749 | -{ | |
2750 | - int bonus, mhp; | |
2751 | - byte tmp_hitdie; | |
2752 | - | |
2753 | - /* Un-inflate "half-hitpoint bonus per level" value */ | |
2754 | - bonus = ((int)(adj_con_mhp[p_ptr->stat_ind[A_CON]]) - 128) * p_ptr->lev / 4; | |
2755 | - | |
2756 | - /* Calculate hitpoints */ | |
2757 | - mhp = p_ptr->player_hp[p_ptr->lev - 1]; | |
2758 | - | |
2759 | - if (p_ptr->mimic_form) | |
2760 | - { | |
2761 | - if (p_ptr->pclass == CLASS_SORCERER) | |
2762 | - tmp_hitdie = mimic_info[p_ptr->mimic_form].r_mhp/2 + cp_ptr->c_mhp + ap_ptr->a_mhp; | |
2763 | - else | |
2764 | - tmp_hitdie = mimic_info[p_ptr->mimic_form].r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp; | |
2765 | - mhp = mhp * tmp_hitdie / p_ptr->hitdie; | |
2766 | - } | |
2767 | - | |
2768 | - if (p_ptr->pclass == CLASS_SORCERER) | |
2769 | - { | |
2770 | - if (p_ptr->lev < 30) | |
2771 | - mhp = (mhp * (45+p_ptr->lev) / 100); | |
2772 | - else | |
2773 | - mhp = (mhp * 75 / 100); | |
2774 | - bonus = (bonus * 65 / 100); | |
2775 | - } | |
2776 | - | |
2777 | - mhp += bonus; | |
2778 | - | |
2779 | - if (p_ptr->pclass == CLASS_BERSERKER) | |
2780 | - { | |
2781 | - mhp = mhp*(110+(((p_ptr->lev + 40) * (p_ptr->lev + 40) - 1550) / 110))/100; | |
2782 | - } | |
2783 | - | |
2784 | - /* Always have at least one hitpoint per level */ | |
2785 | - if (mhp < p_ptr->lev + 1) mhp = p_ptr->lev + 1; | |
2786 | - | |
2787 | - /* Factor in the hero / superhero settings */ | |
2788 | - if (IS_HERO()) mhp += 10; | |
2789 | - if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER)) mhp += 30; | |
2790 | - if (p_ptr->tsuyoshi) mhp += 50; | |
2791 | - | |
2792 | - /* Factor in the hex spell settings */ | |
2793 | - if (hex_spelling(HEX_XTRA_MIGHT)) mhp += 15; | |
2794 | - if (hex_spelling(HEX_BUILDING)) mhp += 60; | |
2795 | - | |
2796 | - /* New maximum hitpoints */ | |
2797 | - if (p_ptr->mhp != mhp) | |
2798 | - { | |
2799 | - /* Enforce maximum */ | |
2800 | - if (p_ptr->chp >= mhp) | |
2801 | - { | |
2802 | - p_ptr->chp = mhp; | |
2803 | - p_ptr->chp_frac = 0; | |
2804 | - } | |
2805 | - | |
2806 | -#ifdef JP | |
2807 | - /* レベルアップの時は上昇量を表示する */ | |
2808 | - if ((level_up == 1) && (mhp > p_ptr->mhp)) | |
2809 | - { | |
2810 | - msg_format("最大ヒット・ポイントが %d 増加した!", (mhp - p_ptr->mhp) ); | |
2811 | - } | |
2812 | -#endif | |
2813 | - /* Save the new max-hitpoints */ | |
2814 | - p_ptr->mhp = mhp; | |
2815 | - | |
2816 | - /* Display hitpoints (later) */ | |
2817 | - p_ptr->redraw |= (PR_HP); | |
2818 | - | |
2819 | - p_ptr->window |= (PW_PLAYER); | |
2820 | - } | |
2821 | -} | |
2822 | - | |
2823 | -/*! | |
2824 | - * @brief プレイヤーの光源半径を計算する / Extract and set the current "lite radius" | |
2825 | - * @return なし | |
2826 | - * @details | |
2827 | - * SWD: Experimental modification: multiple light sources have additive effect. | |
2828 | - */ | |
2829 | -static void calc_torch(void) | |
2830 | -{ | |
2831 | - int i, rad; | |
2832 | - object_type *o_ptr; | |
2833 | - BIT_FLAGS flgs[TR_FLAG_SIZE]; | |
2834 | - | |
2835 | - /* Assume no light */ | |
2836 | - p_ptr->cur_lite = 0; | |
2837 | - | |
2838 | - /* Loop through all wielded items */ | |
2839 | - for (i = INVEN_RARM; i < INVEN_TOTAL; i++) | |
2840 | - { | |
2841 | - o_ptr = &inventory[i]; | |
2842 | - /* Skip empty slots */ | |
2843 | - if (!o_ptr->k_idx) continue; | |
2844 | - | |
2845 | - if (o_ptr->name2 == EGO_LITE_SHINE) p_ptr->cur_lite++; | |
2846 | - | |
2847 | - /* Need Fuels */ | |
2848 | - if (o_ptr->name2 != EGO_LITE_DARKNESS) | |
2849 | - { | |
2850 | - if (o_ptr->tval == TV_LITE) | |
2851 | - { | |
2852 | - if((o_ptr->sval == SV_LITE_TORCH) && !(o_ptr->xtra4 > 0)) continue; | |
2853 | - if((o_ptr->sval == SV_LITE_LANTERN) && !(o_ptr->xtra4 > 0)) continue; | |
2854 | - } | |
2855 | - } | |
2856 | - object_flags(o_ptr, flgs); | |
2857 | - | |
2858 | - /* calc the lite_radius */ | |
2859 | - | |
2860 | - rad = 0; | |
2861 | - if (have_flag(flgs, TR_LITE_1) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 1; | |
2862 | - if (have_flag(flgs, TR_LITE_2) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 2; | |
2863 | - if (have_flag(flgs, TR_LITE_3) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 3; | |
2864 | - if (have_flag(flgs, TR_LITE_M1)) rad -= 1; | |
2865 | - if (have_flag(flgs, TR_LITE_M2)) rad -= 2; | |
2866 | - if (have_flag(flgs, TR_LITE_M3)) rad -= 3; | |
2867 | - p_ptr->cur_lite += (s16b)rad; | |
2868 | - } | |
2869 | - | |
2870 | - /* max radius is 14 (was 5) without rewriting other code -- */ | |
2871 | - /* see cave.c:update_lite() and defines.h:LITE_MAX */ | |
2872 | - if (d_info[dungeon_type].flags1 & DF1_DARKNESS && p_ptr->cur_lite > 1) | |
2873 | - p_ptr->cur_lite = 1; | |
2874 | - | |
2875 | - /* | |
2876 | - * check if the player doesn't have light radius, | |
2877 | - * but does weakly glow as an intrinsic. | |
2878 | - */ | |
2879 | - if (p_ptr->cur_lite <= 0 && p_ptr->lite) p_ptr->cur_lite++; | |
2880 | - | |
2881 | - if (p_ptr->cur_lite > 14) p_ptr->cur_lite = 14; | |
2882 | - if (p_ptr->cur_lite < 0) p_ptr->cur_lite = 0; | |
2883 | - | |
2884 | - /* end experimental mods */ | |
2885 | - | |
2886 | - /* Notice changes in the "lite radius" */ | |
2887 | - if (p_ptr->old_lite != p_ptr->cur_lite) | |
2888 | - { | |
2889 | - /* Hack -- PU_MON_LITE for monsters' darkness */ | |
2890 | - p_ptr->update |= (PU_LITE | PU_MON_LITE | PU_MONSTERS); | |
2891 | - | |
2892 | - /* Remember the old lite */ | |
2893 | - p_ptr->old_lite = p_ptr->cur_lite; | |
2894 | - | |
2895 | - if ((p_ptr->cur_lite > 0) && (p_ptr->special_defense & NINJA_S_STEALTH)) | |
2896 | - set_superstealth(FALSE); | |
2897 | - } | |
2898 | -} | |
2899 | - | |
2900 | - | |
2901 | -/*! | |
2902 | - * @brief プレイヤーの所持重量制限を計算する / | |
2903 | - * Computes current weight limit. | |
2904 | - * @return 制限重量(ポンド) | |
2905 | - */ | |
2906 | -WEIGHT weight_limit(void) | |
2907 | -{ | |
2908 | - WEIGHT i; | |
2909 | - | |
2910 | - /* Weight limit based only on strength */ | |
2911 | - i = (WEIGHT)adj_str_wgt[p_ptr->stat_ind[A_STR]] * 50; /* Constant was 100 */ | |
2912 | - if (p_ptr->pclass == CLASS_BERSERKER) i = i * 3 / 2; | |
2913 | - | |
2914 | - /* Return the result */ | |
2915 | - return i; | |
2916 | -} | |
2917 | - | |
2918 | -/*! | |
2919 | - * @brief プレイヤーが現在右手/左手に武器を持っているか判定する / | |
2920 | - * @param i 判定する手のID(右手:0 左手:1) | |
2921 | - * @return 持っているならばTRUE | |
2922 | - */ | |
2923 | -bool buki_motteruka(int i) | |
2924 | -{ | |
2925 | - return ((inventory[i].k_idx && object_is_melee_weapon(&inventory[i])) ? TRUE : FALSE); | |
2926 | -} | |
2927 | - | |
2928 | -/*! | |
2929 | - * @brief 射撃武器がプレイヤーにとって重すぎるかどうかの判定 / | |
2930 | - * @param o_ptr 判定する射撃武器のアイテム情報参照ポインタ | |
2931 | - * @return 重すぎるならばTRUE | |
2932 | - */ | |
2933 | -bool is_heavy_shoot(object_type *o_ptr) | |
2934 | -{ | |
2935 | - int hold = adj_str_hold[p_ptr->stat_ind[A_STR]]; | |
2936 | - /* It is hard to carholdry a heavy bow */ | |
2937 | - return (hold < o_ptr->weight / 10); | |
2938 | -} | |
2939 | - | |
2940 | -/*! | |
2941 | - * @brief 射撃武器に対応する矢/弾薬のベースアイテムIDを返す / | |
2942 | - * @param o_ptr 判定する射撃武器のアイテム情報参照ポインタ | |
2943 | - * @return 対応する矢/弾薬のベースアイテムID | |
2944 | - */ | |
2945 | -int bow_tval_ammo(object_type *o_ptr) | |
2946 | -{ | |
2947 | - /* Analyze the launcher */ | |
2948 | - switch (o_ptr->sval) | |
2949 | - { | |
2950 | - case SV_SLING: | |
2951 | - { | |
2952 | - return TV_SHOT; | |
2953 | - } | |
2954 | - | |
2955 | - case SV_SHORT_BOW: | |
2956 | - case SV_LONG_BOW: | |
2957 | - case SV_NAMAKE_BOW: | |
2958 | - { | |
2959 | - return TV_ARROW; | |
2960 | - } | |
2961 | - | |
2962 | - case SV_LIGHT_XBOW: | |
2963 | - case SV_HEAVY_XBOW: | |
2964 | - { | |
2965 | - return TV_BOLT; | |
2966 | - } | |
2967 | - case SV_CRIMSON: | |
2968 | - case SV_HARP: | |
2969 | - { | |
2970 | - return TV_NO_AMMO; | |
2971 | - } | |
2972 | - } | |
2973 | - | |
2974 | - return 0; | |
2975 | -} | |
2976 | - | |
2977 | -/*! | |
2978 | - * @brief 装備中の射撃武器の威力倍率を返す / | |
2979 | - * calcurate the fire rate of target object | |
2980 | - * @param o_ptr 計算する射撃武器のアイテム情報参照ポインタ | |
2981 | - * @return 射撃倍率の値(100で1.00倍) | |
2982 | - */ | |
2983 | -s16b calc_num_fire(object_type *o_ptr) | |
2984 | -{ | |
2985 | - int extra_shots = 0; | |
2986 | - int i; | |
2987 | - int num = 0; | |
2988 | - OBJECT_TYPE_VALUE tval_ammo = bow_tval_ammo(o_ptr); | |
2989 | - object_type *q_ptr; | |
2990 | - BIT_FLAGS flgs[TR_FLAG_SIZE]; | |
2991 | - | |
2992 | - /* Scan the usable inventory */ | |
2993 | - for (i = INVEN_RARM; i < INVEN_TOTAL; i++) | |
2994 | - { | |
2995 | - q_ptr = &inventory[i]; | |
2996 | - | |
2997 | - /* Skip non-objects */ | |
2998 | - if (!q_ptr->k_idx) continue; | |
2999 | - | |
3000 | - /* Do not apply current equip */ | |
3001 | - if (i == INVEN_BOW) continue; | |
3002 | - | |
3003 | - /* Extract the item flags */ | |
3004 | - object_flags(q_ptr, flgs); | |
3005 | - | |
3006 | - /* Boost shots */ | |
3007 | - if (have_flag(flgs, TR_XTRA_SHOTS)) extra_shots++; | |
3008 | - } | |
3009 | - | |
3010 | - object_flags(o_ptr, flgs); | |
3011 | - if (have_flag(flgs, TR_XTRA_SHOTS)) extra_shots++; | |
3012 | - | |
3013 | - if (o_ptr->k_idx && !is_heavy_shoot(o_ptr)) | |
3014 | - { | |
3015 | - num = 100; | |
3016 | - /* Extra shots */ | |
3017 | - num += (extra_shots * 100); | |
3018 | - | |
3019 | - /* Hack -- Rangers love Bows */ | |
3020 | - if ((p_ptr->pclass == CLASS_RANGER) && | |
3021 | - (tval_ammo == TV_ARROW)) | |
3022 | - { | |
3023 | - num += (p_ptr->lev * 4); | |
3024 | - } | |
3025 | - | |
3026 | - if ((p_ptr->pclass == CLASS_CAVALRY) && | |
3027 | - (tval_ammo == TV_ARROW)) | |
3028 | - { | |
3029 | - num += (p_ptr->lev * 3); | |
3030 | - } | |
3031 | - | |
3032 | - if (p_ptr->pclass == CLASS_ARCHER) | |
3033 | - { | |
3034 | - if (tval_ammo == TV_ARROW) | |
3035 | - num += ((p_ptr->lev * 5)+50); | |
3036 | - else if ((tval_ammo == TV_BOLT) || (tval_ammo == TV_SHOT)) | |
3037 | - num += (p_ptr->lev * 4); | |
3038 | - } | |
3039 | - | |
3040 | - /* | |
3041 | - * Addendum -- also "Reward" high level warriors, | |
3042 | - * with _any_ missile weapon -- TY | |
3043 | - */ | |
3044 | - if (p_ptr->pclass == CLASS_WARRIOR && | |
3045 | - (tval_ammo <= TV_BOLT) && | |
3046 | - (tval_ammo >= TV_SHOT)) | |
3047 | - { | |
3048 | - num += (p_ptr->lev * 2); | |
3049 | - } | |
3050 | - if ((p_ptr->pclass == CLASS_ROGUE) && | |
3051 | - (tval_ammo == TV_SHOT)) | |
3052 | - { | |
3053 | - num += (p_ptr->lev * 4); | |
3054 | - } | |
3055 | - } | |
3056 | - return (s16b)num; | |
3057 | -} | |
3058 | - | |
3059 | -/*! | |
3060 | - * @brief プレイヤーの全ステータスを更新する / | |
3061 | - * Calculate the players current "state", taking into account | |
3062 | - * not only race/class intrinsics, but also objects being worn | |
3063 | - * and temporary spell effects. | |
3064 | - * @return なし | |
3065 | - * @details | |
3066 | - * <pre> | |
3067 | - * See also calc_mana() and calc_hitpoints(). | |
3068 | - * | |
3069 | - * Take note of the new "speed code", in particular, a very strong | |
3070 | - * player will start slowing down as soon as he reaches 150 pounds, | |
3071 | - * but not until he reaches 450 pounds will he be half as fast as | |
3072 | - * a normal kobold. This both hurts and helps the player, hurts | |
3073 | - * because in the old days a player could just avoid 300 pounds, | |
3074 | - * and helps because now carrying 300 pounds is not very painful. | |
3075 | - * | |
3076 | - * The "weapon" and "bow" do *not* add to the bonuses to hit or to | |
3077 | - * damage, since that would affect non-combat things. These values | |
3078 | - * are actually added in later, at the appropriate place. | |
3079 | - * | |
3080 | - * This function induces various "status" messages. | |
3081 | - * </pre> | |
3082 | - */ | |
3083 | -void calc_bonuses(void) | |
3084 | -{ | |
3085 | - int i, j, hold, neutral[2]; | |
3086 | - int new_speed; | |
3087 | - int default_hand = 0; | |
3088 | - int empty_hands_status = empty_hands(TRUE); | |
3089 | - int extra_blows[2]; | |
3090 | - object_type *o_ptr; | |
3091 | - BIT_FLAGS flgs[TR_FLAG_SIZE]; | |
3092 | - bool omoi = FALSE; | |
3093 | - bool yoiyami = FALSE; | |
3094 | - bool down_saving = FALSE; | |
3095 | -#if 0 | |
3096 | - bool have_dd_s = FALSE, have_dd_t = FALSE; | |
3097 | -#endif | |
3098 | - bool have_sw = FALSE, have_kabe = FALSE; | |
3099 | - bool easy_2weapon = FALSE; | |
3100 | - bool riding_levitation = FALSE; | |
3101 | - OBJECT_IDX this_o_idx, next_o_idx = 0; | |
3102 | - const player_race *tmp_rp_ptr; | |
3103 | - | |
3104 | - /* Save the old vision stuff */ | |
3105 | - bool old_telepathy = p_ptr->telepathy; | |
3106 | - bool old_esp_animal = p_ptr->esp_animal; | |
3107 | - bool old_esp_undead = p_ptr->esp_undead; | |
3108 | - bool old_esp_demon = p_ptr->esp_demon; | |
3109 | - bool old_esp_orc = p_ptr->esp_orc; | |
3110 | - bool old_esp_troll = p_ptr->esp_troll; | |
3111 | - bool old_esp_giant = p_ptr->esp_giant; | |
3112 | - bool old_esp_dragon = p_ptr->esp_dragon; | |
3113 | - bool old_esp_human = p_ptr->esp_human; | |
3114 | - bool old_esp_evil = p_ptr->esp_evil; | |
3115 | - bool old_esp_good = p_ptr->esp_good; | |
3116 | - bool old_esp_nonliving = p_ptr->esp_nonliving; | |
3117 | - bool old_esp_unique = p_ptr->esp_unique; | |
3118 | - bool old_see_inv = p_ptr->see_inv; | |
3119 | - bool old_mighty_throw = p_ptr->mighty_throw; | |
3120 | - | |
3121 | - /* Current feature under player. */ | |
3122 | - feature_type *f_ptr = &f_info[cave[p_ptr->y][p_ptr->x].feat]; | |
3123 | - | |
3124 | - /* Save the old armor class */ | |
3125 | - ARMOUR_CLASS old_dis_ac = p_ptr->dis_ac; | |
3126 | - ARMOUR_CLASS old_dis_to_a = p_ptr->dis_to_a; | |
3127 | - | |
3128 | - | |
3129 | - /* Clear extra blows/shots */ | |
3130 | - extra_blows[0] = extra_blows[1] = 0; | |
3131 | - | |
3132 | - /* Clear the stat modifiers */ | |
3133 | - for (i = 0; i < A_MAX; i++) p_ptr->stat_add[i] = 0; | |
3134 | - | |
3135 | - | |
3136 | - /* Clear the Displayed/Real armor class */ | |
3137 | - p_ptr->dis_ac = p_ptr->ac = 0; | |
3138 | - | |
3139 | - /* Clear the Displayed/Real Bonuses */ | |
3140 | - p_ptr->dis_to_h[0] = p_ptr->to_h[0] = 0; | |
3141 | - p_ptr->dis_to_h[1] = p_ptr->to_h[1] = 0; | |
3142 | - p_ptr->dis_to_d[0] = p_ptr->to_d[0] = 0; | |
3143 | - p_ptr->dis_to_d[1] = p_ptr->to_d[1] = 0; | |
3144 | - p_ptr->dis_to_h_b = p_ptr->to_h_b = 0; | |
3145 | - p_ptr->dis_to_a = p_ptr->to_a = 0; | |
3146 | - p_ptr->to_h_m = 0; | |
3147 | - p_ptr->to_d_m = 0; | |
3148 | - | |
3149 | - p_ptr->to_m_chance = 0; | |
3150 | - | |
3151 | - /* Clear the Extra Dice Bonuses */ | |
3152 | - p_ptr->to_dd[0] = p_ptr->to_ds[0] = 0; | |
3153 | - p_ptr->to_dd[1] = p_ptr->to_ds[1] = 0; | |
3154 | - | |
3155 | - /* Start with "normal" speed */ | |
3156 | - new_speed = 110; | |
3157 | - | |
3158 | - /* Start with a single blow per turn */ | |
3159 | - p_ptr->num_blow[0] = 1; | |
3160 | - p_ptr->num_blow[1] = 1; | |
3161 | - | |
3162 | - /* Start with a single shot per turn */ | |
3163 | - p_ptr->num_fire = 100; | |
3164 | - | |
3165 | - /* Reset the "xtra" tval */ | |
3166 | - p_ptr->tval_xtra = 0; | |
3167 | - | |
3168 | - /* Reset the "ammo" tval */ | |
3169 | - p_ptr->tval_ammo = 0; | |
3170 | - | |
3171 | - /* Clear all the flags */ | |
3172 | - p_ptr->cursed = 0L; | |
3173 | - p_ptr->bless_blade = FALSE; | |
3174 | - p_ptr->xtra_might = FALSE; | |
3175 | - p_ptr->impact[0] = FALSE; | |
3176 | - p_ptr->impact[1] = FALSE; | |
3177 | - p_ptr->pass_wall = FALSE; | |
3178 | - p_ptr->kill_wall = FALSE; | |
3179 | - p_ptr->dec_mana = FALSE; | |
3180 | - p_ptr->easy_spell = FALSE; | |
3181 | - p_ptr->heavy_spell = FALSE; | |
3182 | - p_ptr->see_inv = FALSE; | |
3183 | - p_ptr->free_act = FALSE; | |
3184 | - p_ptr->slow_digest = FALSE; | |
3185 | - p_ptr->regenerate = FALSE; | |
3186 | - p_ptr->can_swim = FALSE; | |
3187 | - p_ptr->levitation = FALSE; | |
3188 | - p_ptr->hold_exp = FALSE; | |
3189 | - p_ptr->telepathy = FALSE; | |
3190 | - p_ptr->esp_animal = FALSE; | |
3191 | - p_ptr->esp_undead = FALSE; | |
3192 | - p_ptr->esp_demon = FALSE; | |
3193 | - p_ptr->esp_orc = FALSE; | |
3194 | - p_ptr->esp_troll = FALSE; | |
3195 | - p_ptr->esp_giant = FALSE; | |
3196 | - p_ptr->esp_dragon = FALSE; | |
3197 | - p_ptr->esp_human = FALSE; | |
3198 | - p_ptr->esp_evil = FALSE; | |
3199 | - p_ptr->esp_good = FALSE; | |
3200 | - p_ptr->esp_nonliving = FALSE; | |
3201 | - p_ptr->esp_unique = FALSE; | |
3202 | - p_ptr->lite = FALSE; | |
3203 | - p_ptr->sustain_str = FALSE; | |
3204 | - p_ptr->sustain_int = FALSE; | |
3205 | - p_ptr->sustain_wis = FALSE; | |
3206 | - p_ptr->sustain_con = FALSE; | |
3207 | - p_ptr->sustain_dex = FALSE; | |
3208 | - p_ptr->sustain_chr = FALSE; | |
3209 | - p_ptr->resist_acid = FALSE; | |
3210 | - p_ptr->resist_elec = FALSE; | |
3211 | - p_ptr->resist_fire = FALSE; | |
3212 | - p_ptr->resist_cold = FALSE; | |
3213 | - p_ptr->resist_pois = FALSE; | |
3214 | - p_ptr->resist_conf = FALSE; | |
3215 | - p_ptr->resist_sound = FALSE; | |
3216 | - p_ptr->resist_lite = FALSE; | |
3217 | - p_ptr->resist_dark = FALSE; | |
3218 | - p_ptr->resist_chaos = FALSE; | |
3219 | - p_ptr->resist_disen = FALSE; | |
3220 | - p_ptr->resist_shard = FALSE; | |
3221 | - p_ptr->resist_nexus = FALSE; | |
3222 | - p_ptr->resist_blind = FALSE; | |
3223 | - p_ptr->resist_neth = FALSE; | |
3224 | - p_ptr->resist_time = FALSE; | |
3225 | - p_ptr->resist_water = FALSE; | |
3226 | - p_ptr->resist_fear = FALSE; | |
3227 | - p_ptr->reflect = FALSE; | |
3228 | - p_ptr->sh_fire = FALSE; | |
3229 | - p_ptr->sh_elec = FALSE; | |
3230 | - p_ptr->sh_cold = FALSE; | |
3231 | - p_ptr->anti_magic = FALSE; | |
3232 | - p_ptr->anti_tele = FALSE; | |
3233 | - p_ptr->warning = FALSE; | |
3234 | - p_ptr->mighty_throw = FALSE; | |
3235 | - p_ptr->see_nocto = FALSE; | |
3236 | - | |
3237 | - p_ptr->immune_acid = FALSE; | |
3238 | - p_ptr->immune_elec = FALSE; | |
3239 | - p_ptr->immune_fire = FALSE; | |
3240 | - p_ptr->immune_cold = FALSE; | |
3241 | - | |
3242 | - p_ptr->ryoute = FALSE; | |
3243 | - p_ptr->migite = FALSE; | |
3244 | - p_ptr->hidarite = FALSE; | |
3245 | - p_ptr->no_flowed = FALSE; | |
3246 | - | |
3247 | - p_ptr->align = friend_align; | |
3248 | - | |
3249 | - if (p_ptr->mimic_form) tmp_rp_ptr = &mimic_info[p_ptr->mimic_form]; | |
3250 | - else tmp_rp_ptr = &race_info[p_ptr->prace]; | |
3251 | - | |
3252 | - /* Base infravision (purely racial) */ | |
3253 | - p_ptr->see_infra = tmp_rp_ptr->infra; | |
3254 | - | |
3255 | - /* Base skill -- disarming */ | |
3256 | - p_ptr->skill_dis = tmp_rp_ptr->r_dis + cp_ptr->c_dis + ap_ptr->a_dis; | |
3257 | - | |
3258 | - /* Base skill -- magic devices */ | |
3259 | - p_ptr->skill_dev = tmp_rp_ptr->r_dev + cp_ptr->c_dev + ap_ptr->a_dev; | |
3260 | - | |
3261 | - /* Base skill -- saving throw */ | |
3262 | - p_ptr->skill_sav = tmp_rp_ptr->r_sav + cp_ptr->c_sav + ap_ptr->a_sav; | |
3263 | - | |
3264 | - /* Base skill -- stealth */ | |
3265 | - p_ptr->skill_stl = tmp_rp_ptr->r_stl + cp_ptr->c_stl + ap_ptr->a_stl; | |
3266 | - | |
3267 | - /* Base skill -- searching ability */ | |
3268 | - p_ptr->skill_srh = tmp_rp_ptr->r_srh + cp_ptr->c_srh + ap_ptr->a_srh; | |
3269 | - | |
3270 | - /* Base skill -- searching frequency */ | |
3271 | - p_ptr->skill_fos = tmp_rp_ptr->r_fos + cp_ptr->c_fos + ap_ptr->a_fos; | |
3272 | - | |
3273 | - /* Base skill -- combat (normal) */ | |
3274 | - p_ptr->skill_thn = tmp_rp_ptr->r_thn + cp_ptr->c_thn + ap_ptr->a_thn; | |
3275 | - | |
3276 | - /* Base skill -- combat (shooting) */ | |
3277 | - p_ptr->skill_thb = tmp_rp_ptr->r_thb + cp_ptr->c_thb + ap_ptr->a_thb; | |
3278 | - | |
3279 | - /* Base skill -- combat (throwing) */ | |
3280 | - p_ptr->skill_tht = tmp_rp_ptr->r_thb + cp_ptr->c_thb + ap_ptr->a_thb; | |
3281 | - | |
3282 | - /* Base skill -- digging */ | |
3283 | - p_ptr->skill_dig = 0; | |
3284 | - | |
3285 | - if (buki_motteruka(INVEN_RARM)) p_ptr->migite = TRUE; | |
3286 | - if (buki_motteruka(INVEN_LARM)) | |
3287 | - { | |
3288 | - p_ptr->hidarite = TRUE; | |
3289 | - if (!p_ptr->migite) default_hand = 1; | |
3290 | - } | |
3291 | - | |
3292 | - if (CAN_TWO_HANDS_WIELDING()) | |
3293 | - { | |
3294 | - if (p_ptr->migite && (empty_hands(FALSE) == EMPTY_HAND_LARM) && | |
3295 | - object_allow_two_hands_wielding(&inventory[INVEN_RARM])) | |
3296 | - { | |
3297 | - p_ptr->ryoute = TRUE; | |
3298 | - } | |
3299 | - else if (p_ptr->hidarite && (empty_hands(FALSE) == EMPTY_HAND_RARM) && | |
3300 | - object_allow_two_hands_wielding(&inventory[INVEN_LARM])) | |
3301 | - { | |
3302 | - p_ptr->ryoute = TRUE; | |
3303 | - } | |
3304 | - else | |
3305 | - { | |
3306 | - switch (p_ptr->pclass) | |
3307 | - { | |
3308 | - case CLASS_MONK: | |
3309 | - case CLASS_FORCETRAINER: | |
3310 | - case CLASS_BERSERKER: | |
3311 | - if (empty_hands(FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM)) | |
3312 | - { | |
3313 | - p_ptr->migite = TRUE; | |
3314 | - p_ptr->ryoute = TRUE; | |
3315 | - } | |
3316 | - break; | |
3317 | - } | |
3318 | - } | |
3319 | - } | |
3320 | - | |
3321 | - if (!p_ptr->migite && !p_ptr->hidarite) | |
3322 | - { | |
3323 | - if (empty_hands_status & EMPTY_HAND_RARM) p_ptr->migite = TRUE; | |
3324 | - else if (empty_hands_status == EMPTY_HAND_LARM) | |
3325 | - { | |
3326 | - p_ptr->hidarite = TRUE; | |
3327 | - default_hand = 1; | |
3328 | - } | |
3329 | - } | |
3330 | - | |
3331 | - if (p_ptr->special_defense & KAMAE_MASK) | |
3332 | - { | |
3333 | - if (!(empty_hands_status & EMPTY_HAND_RARM)) | |
3334 | - { | |
3335 | - set_action(ACTION_NONE); | |
3336 | - } | |
3337 | - } | |
3338 | - | |
3339 | - switch (p_ptr->pclass) | |
3340 | - { | |
3341 | - case CLASS_WARRIOR: | |
3342 | - if (p_ptr->lev > 29) p_ptr->resist_fear = TRUE; | |
3343 | - if (p_ptr->lev > 44) p_ptr->regenerate = TRUE; | |
3344 | - break; | |
3345 | - case CLASS_PALADIN: | |
3346 | - if (p_ptr->lev > 39) p_ptr->resist_fear = TRUE; | |
3347 | - break; | |
3348 | - case CLASS_CHAOS_WARRIOR: | |
3349 | - if (p_ptr->lev > 29) p_ptr->resist_chaos = TRUE; | |
3350 | - if (p_ptr->lev > 39) p_ptr->resist_fear = TRUE; | |
3351 | - break; | |
3352 | - case CLASS_MINDCRAFTER: | |
3353 | - if (p_ptr->lev > 9) p_ptr->resist_fear = TRUE; | |
3354 | - if (p_ptr->lev > 19) p_ptr->sustain_wis = TRUE; | |
3355 | - if (p_ptr->lev > 29) p_ptr->resist_conf = TRUE; | |
3356 | - if (p_ptr->lev > 39) p_ptr->telepathy = TRUE; | |
3357 | - break; | |
3358 | - case CLASS_MONK: | |
3359 | - case CLASS_FORCETRAINER: | |
3360 | - /* Unencumbered Monks become faster every 10 levels */ | |
3361 | - if (!(heavy_armor())) | |
3362 | - { | |
3363 | - if (!(prace_is_(RACE_KLACKON) || | |
3364 | - prace_is_(RACE_SPRITE) || | |
3365 | - (p_ptr->pseikaku == SEIKAKU_MUNCHKIN))) | |
3366 | - new_speed += (p_ptr->lev) / 10; | |
3367 | - | |
3368 | - /* Free action if unencumbered at level 25 */ | |
3369 | - if (p_ptr->lev > 24) | |
3370 | - p_ptr->free_act = TRUE; | |
3371 | - } | |
3372 | - break; | |
3373 | - case CLASS_SORCERER: | |
3374 | - p_ptr->to_a -= 50; | |
3375 | - p_ptr->dis_to_a -= 50; | |
3376 | - break; | |
3377 | - case CLASS_BARD: | |
3378 | - p_ptr->resist_sound = TRUE; | |
3379 | - break; | |
3380 | - case CLASS_SAMURAI: | |
3381 | - if (p_ptr->lev > 29) p_ptr->resist_fear = TRUE; | |
3382 | - break; | |
3383 | - case CLASS_BERSERKER: | |
3384 | - p_ptr->shero = 1; | |
3385 | - p_ptr->sustain_str = TRUE; | |
3386 | - p_ptr->sustain_dex = TRUE; | |
3387 | - p_ptr->sustain_con = TRUE; | |
3388 | - p_ptr->regenerate = TRUE; | |
3389 | - p_ptr->free_act = TRUE; | |
3390 | - new_speed += 2; | |
3391 | - if (p_ptr->lev > 29) new_speed++; | |
3392 | - if (p_ptr->lev > 39) new_speed++; | |
3393 | - if (p_ptr->lev > 44) new_speed++; | |
3394 | - if (p_ptr->lev > 49) new_speed++; | |
3395 | - p_ptr->to_a += 10+p_ptr->lev/2; | |
3396 | - p_ptr->dis_to_a += 10+p_ptr->lev/2; | |
3397 | - p_ptr->skill_dig += (100+p_ptr->lev*8); | |
3398 | - if (p_ptr->lev > 39) p_ptr->reflect = TRUE; | |
3399 | - p_ptr->redraw |= PR_STATUS; | |
3400 | - break; | |
3401 | - case CLASS_MIRROR_MASTER: | |
3402 | - if (p_ptr->lev > 39) p_ptr->reflect = TRUE; | |
3403 | - break; | |
3404 | - case CLASS_NINJA: | |
3405 | - /* Unencumbered Ninjas become faster every 10 levels */ | |
3406 | - if (heavy_armor()) | |
3407 | - { | |
3408 | - new_speed -= (p_ptr->lev) / 10; | |
3409 | - p_ptr->skill_stl -= (p_ptr->lev)/10; | |
3410 | - } | |
3411 | - else if ((!inventory[INVEN_RARM].k_idx || p_ptr->migite) && | |
3412 | - (!inventory[INVEN_LARM].k_idx || p_ptr->hidarite)) | |
3413 | - { | |
3414 | - new_speed += 3; | |
3415 | - if (!(prace_is_(RACE_KLACKON) || | |
3416 | - prace_is_(RACE_SPRITE) || | |
3417 | - (p_ptr->pseikaku == SEIKAKU_MUNCHKIN))) | |
3418 | - new_speed += (p_ptr->lev) / 10; | |
3419 | - p_ptr->skill_stl += (p_ptr->lev)/10; | |
3420 | - | |
3421 | - /* Free action if unencumbered at level 25 */ | |
3422 | - if (p_ptr->lev > 24) | |
3423 | - p_ptr->free_act = TRUE; | |
3424 | - } | |
3425 | - if ((!inventory[INVEN_RARM].k_idx || p_ptr->migite) && | |
3426 | - (!inventory[INVEN_LARM].k_idx || p_ptr->hidarite)) | |
3427 | - { | |
3428 | - p_ptr->to_a += p_ptr->lev/2+5; | |
3429 | - p_ptr->dis_to_a += p_ptr->lev/2+5; | |
3430 | - } | |
3431 | - p_ptr->slow_digest = TRUE; | |
3432 | - p_ptr->resist_fear = TRUE; | |
3433 | - if (p_ptr->lev > 19) p_ptr->resist_pois = TRUE; | |
3434 | - if (p_ptr->lev > 24) p_ptr->sustain_dex = TRUE; | |
3435 | - if (p_ptr->lev > 29) p_ptr->see_inv = TRUE; | |
3436 | - if (p_ptr->lev > 44) | |
3437 | - { | |
3438 | - p_ptr->oppose_pois = 1; | |
3439 | - p_ptr->redraw |= PR_STATUS; | |
3440 | - } | |
3441 | - p_ptr->see_nocto = TRUE; | |
3442 | - break; | |
3443 | - } | |
3444 | - | |
3445 | - /***** Races ****/ | |
3446 | - if (p_ptr->mimic_form) | |
3447 | - { | |
3448 | - switch (p_ptr->mimic_form) | |
3449 | - { | |
3450 | - case MIMIC_DEMON: | |
3451 | - p_ptr->hold_exp = TRUE; | |
3452 | - p_ptr->resist_chaos = TRUE; | |
3453 | - p_ptr->resist_neth = TRUE; | |
3454 | - p_ptr->resist_fire = TRUE; | |
3455 | - p_ptr->oppose_fire = 1; | |
3456 | - p_ptr->see_inv=TRUE; | |
3457 | - new_speed += 3; | |
3458 | - p_ptr->redraw |= PR_STATUS; | |
3459 | - p_ptr->to_a += 10; | |
3460 | - p_ptr->dis_to_a += 10; | |
3461 | - p_ptr->align -= 200; | |
3462 | - break; | |
3463 | - case MIMIC_DEMON_LORD: | |
3464 | - p_ptr->hold_exp = TRUE; | |
3465 | - p_ptr->resist_chaos = TRUE; | |
3466 | - p_ptr->resist_neth = TRUE; | |
3467 | - p_ptr->immune_fire = TRUE; | |
3468 | - p_ptr->resist_acid = TRUE; | |
3469 | - p_ptr->resist_fire = TRUE; | |
3470 | - p_ptr->resist_cold = TRUE; | |
3471 | - p_ptr->resist_elec = TRUE; | |
3472 | - p_ptr->resist_pois = TRUE; | |
3473 | - p_ptr->resist_conf = TRUE; | |
3474 | - p_ptr->resist_disen = TRUE; | |
3475 | - p_ptr->resist_nexus = TRUE; | |
3476 | - p_ptr->resist_fear = TRUE; | |
3477 | - p_ptr->sh_fire = TRUE; | |
3478 | - p_ptr->see_inv = TRUE; | |
3479 | - p_ptr->telepathy = TRUE; | |
3480 | - p_ptr->levitation = TRUE; | |
3481 | - p_ptr->kill_wall = TRUE; | |
3482 | - new_speed += 5; | |
3483 | - p_ptr->to_a += 20; | |
3484 | - p_ptr->dis_to_a += 20; | |
3485 | - p_ptr->align -= 200; | |
3486 | - break; | |
3487 | - case MIMIC_VAMPIRE: | |
3488 | - p_ptr->resist_dark = TRUE; | |
3489 | - p_ptr->hold_exp = TRUE; | |
3490 | - p_ptr->resist_neth = TRUE; | |
3491 | - p_ptr->resist_cold = TRUE; | |
3492 | - p_ptr->resist_pois = TRUE; | |
3493 | - p_ptr->see_inv = TRUE; | |
3494 | - new_speed += 3; | |
3495 | - p_ptr->to_a += 10; | |
3496 | - p_ptr->dis_to_a += 10; | |
3497 | - if (p_ptr->pclass != CLASS_NINJA) p_ptr->lite = TRUE; | |
3498 | - break; | |
3499 | - } | |
3500 | - } | |
3501 | - else | |
3502 | - { | |
3503 | - switch (p_ptr->prace) | |
3504 | - { | |
3505 | - case RACE_ELF: | |
3506 | - p_ptr->resist_lite = TRUE; | |
3507 | - break; | |
3508 | - case RACE_HOBBIT: | |
3509 | - p_ptr->hold_exp = TRUE; | |
3510 | - break; | |
3511 | - case RACE_GNOME: | |
3512 | - p_ptr->free_act = TRUE; | |
3513 | - break; | |
3514 | - case RACE_DWARF: | |
3515 | - p_ptr->resist_blind = TRUE; | |
3516 | - break; | |
3517 | - case RACE_HALF_ORC: | |
3518 | - p_ptr->resist_dark = TRUE; | |
3519 | - break; | |
3520 | - case RACE_HALF_TROLL: | |
3521 | - p_ptr->sustain_str = TRUE; | |
3522 | - | |
3523 | - if (p_ptr->lev > 14) | |
3524 | - { | |
3525 | - /* High level trolls heal fast... */ | |
3526 | - p_ptr->regenerate = TRUE; | |
3527 | - | |
3528 | - if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_BERSERKER) | |
3529 | - { | |
3530 | - p_ptr->slow_digest = TRUE; | |
3531 | - /* Let's not make Regeneration | |
3532 | - * a disadvantage for the poor warriors who can | |
3533 | - * never learn a spell that satisfies hunger (actually | |
3534 | - * neither can rogues, but half-trolls are not | |
3535 | - * supposed to play rogues) */ | |
3536 | - } | |
3537 | - } | |
3538 | - break; | |
3539 | - case RACE_AMBERITE: | |
3540 | - p_ptr->sustain_con = TRUE; | |
3541 | - p_ptr->regenerate = TRUE; /* Amberites heal fast... */ | |
3542 | - break; | |
3543 | - case RACE_HIGH_ELF: | |
3544 | - p_ptr->resist_lite = TRUE; | |
3545 | - p_ptr->see_inv = TRUE; | |
3546 | - break; | |
3547 | - case RACE_BARBARIAN: | |
3548 | - p_ptr->resist_fear = TRUE; | |
3549 | - break; | |
3550 | - case RACE_HALF_OGRE: | |
3551 | - p_ptr->resist_dark = TRUE; | |
3552 | - p_ptr->sustain_str = TRUE; | |
3553 | - break; | |
3554 | - case RACE_HALF_GIANT: | |
3555 | - p_ptr->sustain_str = TRUE; | |
3556 | - p_ptr->resist_shard = TRUE; | |
3557 | - break; | |
3558 | - case RACE_HALF_TITAN: | |
3559 | - p_ptr->resist_chaos = TRUE; | |
3560 | - break; | |
3561 | - case RACE_CYCLOPS: | |
3562 | - p_ptr->resist_sound = TRUE; | |
3563 | - break; | |
3564 | - case RACE_YEEK: | |
3565 | - p_ptr->resist_acid = TRUE; | |
3566 | - if (p_ptr->lev > 19) p_ptr->immune_acid = TRUE; | |
3567 | - break; | |
3568 | - case RACE_KLACKON: | |
3569 | - p_ptr->resist_conf = TRUE; | |
3570 | - p_ptr->resist_acid = TRUE; | |
3571 | - | |
3572 | - /* Klackons become faster */ | |
3573 | - new_speed += (p_ptr->lev) / 10; | |
3574 | - break; | |
3575 | - case RACE_KOBOLD: | |
3576 | - p_ptr->resist_pois = TRUE; | |
3577 | - break; | |
3578 | - case RACE_NIBELUNG: | |
3579 | - p_ptr->resist_disen = TRUE; | |
3580 | - p_ptr->resist_dark = TRUE; | |
3581 | - break; | |
3582 | - case RACE_DARK_ELF: | |
3583 | - p_ptr->resist_dark = TRUE; | |
3584 | - if (p_ptr->lev > 19) p_ptr->see_inv = TRUE; | |
3585 | - break; | |
3586 | - case RACE_DRACONIAN: | |
3587 | - p_ptr->levitation = TRUE; | |
3588 | - if (p_ptr->lev > 4) p_ptr->resist_fire = TRUE; | |
3589 | - if (p_ptr->lev > 9) p_ptr->resist_cold = TRUE; | |
3590 | - if (p_ptr->lev > 14) p_ptr->resist_acid = TRUE; | |
3591 | - if (p_ptr->lev > 19) p_ptr->resist_elec = TRUE; | |
3592 | - if (p_ptr->lev > 34) p_ptr->resist_pois = TRUE; | |
3593 | - break; | |
3594 | - case RACE_MIND_FLAYER: | |
3595 | - p_ptr->sustain_int = TRUE; | |
3596 | - p_ptr->sustain_wis = TRUE; | |
3597 | - if (p_ptr->lev > 14) p_ptr->see_inv = TRUE; | |
3598 | - if (p_ptr->lev > 29) p_ptr->telepathy = TRUE; | |
3599 | - break; | |
3600 | - case RACE_IMP: | |
3601 | - p_ptr->resist_fire = TRUE; | |
3602 | - if (p_ptr->lev > 9) p_ptr->see_inv = TRUE; | |
3603 | - break; | |
3604 | - case RACE_GOLEM: | |
3605 | - p_ptr->slow_digest = TRUE; | |
3606 | - p_ptr->free_act = TRUE; | |
3607 | - p_ptr->see_inv = TRUE; | |
3608 | - p_ptr->resist_pois = TRUE; | |
3609 | - if (p_ptr->lev > 34) p_ptr->hold_exp = TRUE; | |
3610 | - break; | |
3611 | - case RACE_SKELETON: | |
3612 | - p_ptr->resist_shard = TRUE; | |
3613 | - p_ptr->hold_exp = TRUE; | |
3614 | - p_ptr->see_inv = TRUE; | |
3615 | - p_ptr->resist_pois = TRUE; | |
3616 | - if (p_ptr->lev > 9) p_ptr->resist_cold = TRUE; | |
3617 | - break; | |
3618 | - case RACE_ZOMBIE: | |
3619 | - p_ptr->resist_neth = TRUE; | |
3620 | - p_ptr->hold_exp = TRUE; | |
3621 | - p_ptr->see_inv = TRUE; | |
3622 | - p_ptr->resist_pois = TRUE; | |
3623 | - p_ptr->slow_digest = TRUE; | |
3624 | - if (p_ptr->lev > 4) p_ptr->resist_cold = TRUE; | |
3625 | - break; | |
3626 | - case RACE_VAMPIRE: | |
3627 | - p_ptr->resist_dark = TRUE; | |
3628 | - p_ptr->hold_exp = TRUE; | |
3629 | - p_ptr->resist_neth = TRUE; | |
3630 | - p_ptr->resist_cold = TRUE; | |
3631 | - p_ptr->resist_pois = TRUE; | |
3632 | - if (p_ptr->pclass != CLASS_NINJA) p_ptr->lite = TRUE; | |
3633 | - break; | |
3634 | - case RACE_SPECTRE: | |
3635 | - p_ptr->levitation = TRUE; | |
3636 | - p_ptr->free_act = TRUE; | |
3637 | - p_ptr->resist_neth = TRUE; | |
3638 | - p_ptr->hold_exp = TRUE; | |
3639 | - p_ptr->see_inv = TRUE; | |
3640 | - p_ptr->resist_pois = TRUE; | |
3641 | - p_ptr->slow_digest = TRUE; | |
3642 | - p_ptr->resist_cold = TRUE; | |
3643 | - p_ptr->pass_wall = TRUE; | |
3644 | - if (p_ptr->lev > 34) p_ptr->telepathy = TRUE; | |
3645 | - break; | |
3646 | - case RACE_SPRITE: | |
3647 | - p_ptr->levitation = TRUE; | |
3648 | - p_ptr->resist_lite = TRUE; | |
3649 | - | |
3650 | - /* Sprites become faster */ | |
3651 | - new_speed += (p_ptr->lev) / 10; | |
3652 | - break; | |
3653 | - case RACE_BEASTMAN: | |
3654 | - p_ptr->resist_conf = TRUE; | |
3655 | - p_ptr->resist_sound = TRUE; | |
3656 | - break; | |
3657 | - case RACE_ENT: | |
3658 | - /* Ents dig like maniacs, but only with their hands. */ | |
3659 | - if (!inventory[INVEN_RARM].k_idx) | |
3660 | - p_ptr->skill_dig += p_ptr->lev * 10; | |
3661 | - /* Ents get tougher and stronger as they age, but lose dexterity. */ | |
3662 | - if (p_ptr->lev > 25) p_ptr->stat_add[A_STR]++; | |
3663 | - if (p_ptr->lev > 40) p_ptr->stat_add[A_STR]++; | |
3664 | - if (p_ptr->lev > 45) p_ptr->stat_add[A_STR]++; | |
3665 | - | |
3666 | - if (p_ptr->lev > 25) p_ptr->stat_add[A_DEX]--; | |
3667 | - if (p_ptr->lev > 40) p_ptr->stat_add[A_DEX]--; | |
3668 | - if (p_ptr->lev > 45) p_ptr->stat_add[A_DEX]--; | |
3669 | - | |
3670 | - if (p_ptr->lev > 25) p_ptr->stat_add[A_CON]++; | |
3671 | - if (p_ptr->lev > 40) p_ptr->stat_add[A_CON]++; | |
3672 | - if (p_ptr->lev > 45) p_ptr->stat_add[A_CON]++; | |
3673 | - break; | |
3674 | - case RACE_ANGEL: | |
3675 | - p_ptr->levitation = TRUE; | |
3676 | - p_ptr->see_inv = TRUE; | |
3677 | - p_ptr->align += 200; | |
3678 | - break; | |
3679 | - case RACE_DEMON: | |
3680 | - p_ptr->resist_fire = TRUE; | |
3681 | - p_ptr->resist_neth = TRUE; | |
3682 | - p_ptr->hold_exp = TRUE; | |
3683 | - if (p_ptr->lev > 9) p_ptr->see_inv = TRUE; | |
3684 | - if (p_ptr->lev > 44) | |
3685 | - { | |
3686 | - p_ptr->oppose_fire = 1; | |
3687 | - p_ptr->redraw |= PR_STATUS; | |
3688 | - } | |
3689 | - p_ptr->align -= 200; | |
3690 | - break; | |
3691 | - case RACE_DUNADAN: | |
3692 | - p_ptr->sustain_con = TRUE; | |
3693 | - break; | |
3694 | - case RACE_S_FAIRY: | |
3695 | - p_ptr->levitation = TRUE; | |
3696 | - break; | |
3697 | - case RACE_KUTAR: | |
3698 | - p_ptr->resist_conf = TRUE; | |
3699 | - break; | |
3700 | - case RACE_ANDROID: | |
3701 | - p_ptr->slow_digest = TRUE; | |
3702 | - p_ptr->free_act = TRUE; | |
3703 | - p_ptr->resist_pois = TRUE; | |
3704 | - p_ptr->hold_exp = TRUE; | |
3705 | - break; | |
3706 | - case RACE_MERFOLK: | |
3707 | - p_ptr->resist_water = TRUE; | |
3708 | - break; | |
3709 | - default: | |
3710 | - /* Do nothing */ | |
3711 | - ; | |
3712 | - } | |
3713 | - } | |
3714 | - | |
3715 | - if (p_ptr->ult_res || (p_ptr->special_defense & KATA_MUSOU)) | |
3716 | - { | |
3717 | - p_ptr->see_inv = TRUE; | |
3718 | - p_ptr->free_act = TRUE; | |
3719 | - p_ptr->slow_digest = TRUE; | |
3720 | - p_ptr->regenerate = TRUE; | |
3721 | - p_ptr->levitation = TRUE; | |
3722 | - p_ptr->hold_exp = TRUE; | |
3723 | - p_ptr->telepathy = TRUE; | |
3724 | - p_ptr->lite = TRUE; | |
3725 | - p_ptr->sustain_str = TRUE; | |
3726 | - p_ptr->sustain_int = TRUE; | |
3727 | - p_ptr->sustain_wis = TRUE; | |
3728 | - p_ptr->sustain_con = TRUE; | |
3729 | - p_ptr->sustain_dex = TRUE; | |
3730 | - p_ptr->sustain_chr = TRUE; | |
3731 | - p_ptr->resist_acid = TRUE; | |
3732 | - p_ptr->resist_elec = TRUE; | |
3733 | - p_ptr->resist_fire = TRUE; | |
3734 | - p_ptr->resist_cold = TRUE; | |
3735 | - p_ptr->resist_pois = TRUE; | |
3736 | - p_ptr->resist_conf = TRUE; | |
3737 | - p_ptr->resist_sound = TRUE; | |
3738 | - p_ptr->resist_lite = TRUE; | |
3739 | - p_ptr->resist_dark = TRUE; | |
3740 | - p_ptr->resist_chaos = TRUE; | |
3741 | - p_ptr->resist_disen = TRUE; | |
3742 | - p_ptr->resist_shard = TRUE; | |
3743 | - p_ptr->resist_nexus = TRUE; | |
3744 | - p_ptr->resist_blind = TRUE; | |
3745 | - p_ptr->resist_neth = TRUE; | |
3746 | - p_ptr->resist_fear = TRUE; | |
3747 | - p_ptr->reflect = TRUE; | |
3748 | - p_ptr->sh_fire = TRUE; | |
3749 | - p_ptr->sh_elec = TRUE; | |
3750 | - p_ptr->sh_cold = TRUE; | |
3751 | - p_ptr->to_a += 100; | |
3752 | - p_ptr->dis_to_a += 100; | |
3753 | - } | |
3754 | - /* Temporary shield */ | |
3755 | - else if (p_ptr->tsubureru || p_ptr->shield || p_ptr->magicdef) | |
3756 | - { | |
3757 | - p_ptr->to_a += 50; | |
3758 | - p_ptr->dis_to_a += 50; | |
3759 | - } | |
3760 | - | |
3761 | - if (p_ptr->tim_res_nether) | |
3762 | - { | |
3763 | - p_ptr->resist_neth = TRUE; | |
3764 | - } | |
3765 | - if (p_ptr->tim_sh_fire) | |
3766 | - { | |
3767 | - p_ptr->sh_fire = TRUE; | |
3768 | - } | |
3769 | - if (p_ptr->tim_res_time) | |
3770 | - { | |
3771 | - p_ptr->resist_time = TRUE; | |
3772 | - } | |
3773 | - | |
3774 | - /* Sexy Gal */ | |
3775 | - if (p_ptr->pseikaku == SEIKAKU_SEXY) p_ptr->cursed |= (TRC_AGGRAVATE); | |
3776 | - | |
3777 | - if (p_ptr->pseikaku == SEIKAKU_NAMAKE) p_ptr->to_m_chance += 10; | |
3778 | - if (p_ptr->pseikaku == SEIKAKU_KIREMONO) p_ptr->to_m_chance -= 3; | |
3779 | - if ((p_ptr->pseikaku == SEIKAKU_GAMAN) || (p_ptr->pseikaku == SEIKAKU_CHIKARA)) p_ptr->to_m_chance++; | |
3780 | - | |
3781 | - if (p_ptr->pseikaku == SEIKAKU_CHARGEMAN) | |
3782 | - { | |
3783 | - p_ptr->to_m_chance += 5; | |
3784 | - p_ptr->resist_conf = TRUE; | |
3785 | - } | |
3786 | - | |
3787 | - /* Lucky man */ | |
3788 | - if (p_ptr->pseikaku == SEIKAKU_LUCKY) p_ptr->muta3 |= MUT3_GOOD_LUCK; | |
3789 | - | |
3790 | - if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN) | |
3791 | - { | |
3792 | - p_ptr->resist_blind = TRUE; | |
3793 | - p_ptr->resist_conf = TRUE; | |
3794 | - p_ptr->hold_exp = TRUE; | |
3795 | - if (p_ptr->pclass != CLASS_NINJA) p_ptr->lite = TRUE; | |
3796 | - | |
3797 | - if ((p_ptr->prace != RACE_KLACKON) && (p_ptr->prace != RACE_SPRITE)) | |
3798 | - /* Munchkin become faster */ | |
3799 | - new_speed += (p_ptr->lev) / 10 + 5; | |
3800 | - } | |
3801 | - | |
3802 | - if (music_singing(MUSIC_WALL)) | |
3803 | - { | |
3804 | - p_ptr->kill_wall = TRUE; | |
3805 | - } | |
3806 | - | |
3807 | - /* Hack -- apply racial/class stat maxes */ | |
3808 | - /* Apply the racial modifiers */ | |
3809 | - for (i = 0; i < A_MAX; i++) | |
3810 | - { | |
3811 | - /* Modify the stats for "race" */ | |
3812 | - p_ptr->stat_add[i] += (tmp_rp_ptr->r_adj[i] + cp_ptr->c_adj[i] + ap_ptr->a_adj[i]); | |
3813 | - } | |
3814 | - | |
3815 | - | |
3816 | - /* I'm adding the mutations here for the lack of a better place... */ | |
3817 | - if (p_ptr->muta3) | |
3818 | - { | |
3819 | - /* Hyper Strength */ | |
3820 | - if (p_ptr->muta3 & MUT3_HYPER_STR) | |
3821 | - { | |
3822 | - p_ptr->stat_add[A_STR] += 4; | |
3823 | - } | |
3824 | - | |
3825 | - /* Puny */ | |
3826 | - if (p_ptr->muta3 & MUT3_PUNY) | |
3827 | - { | |
3828 | - p_ptr->stat_add[A_STR] -= 4; | |
3829 | - } | |
3830 | - | |
3831 | - /* Living computer */ | |
3832 | - if (p_ptr->muta3 & MUT3_HYPER_INT) | |
3833 | - { | |
3834 | - p_ptr->stat_add[A_INT] += 4; | |
3835 | - p_ptr->stat_add[A_WIS] += 4; | |
3836 | - } | |
3837 | - | |
3838 | - /* Moronic */ | |
3839 | - if (p_ptr->muta3 & MUT3_MORONIC) | |
3840 | - { | |
3841 | - p_ptr->stat_add[A_INT] -= 4; | |
3842 | - p_ptr->stat_add[A_WIS] -= 4; | |
3843 | - } | |
3844 | - | |
3845 | - if (p_ptr->muta3 & MUT3_RESILIENT) | |
3846 | - { | |
3847 | - p_ptr->stat_add[A_CON] += 4; | |
3848 | - } | |
3849 | - | |
3850 | - if (p_ptr->muta3 & MUT3_XTRA_FAT) | |
3851 | - { | |
3852 | - p_ptr->stat_add[A_CON] += 2; | |
3853 | - new_speed -= 2; | |
3854 | - } | |
3855 | - | |
3856 | - if (p_ptr->muta3 & MUT3_ALBINO) | |
3857 | - { | |
3858 | - p_ptr->stat_add[A_CON] -= 4; | |
3859 | - } | |
3860 | - | |
3861 | - if (p_ptr->muta3 & MUT3_FLESH_ROT) | |
3862 | - { | |
3863 | - p_ptr->stat_add[A_CON] -= 2; | |
3864 | - p_ptr->stat_add[A_CHR] -= 1; | |
3865 | - p_ptr->regenerate = FALSE; | |
3866 | - /* Cancel innate regeneration */ | |
3867 | - } | |
3868 | - | |
3869 | - if (p_ptr->muta3 & MUT3_SILLY_VOI) | |
3870 | - { | |
3871 | - p_ptr->stat_add[A_CHR] -= 4; | |
3872 | - } | |
3873 | - | |
3874 | - if (p_ptr->muta3 & MUT3_BLANK_FAC) | |
3875 | - { | |
3876 | - p_ptr->stat_add[A_CHR] -= 1; | |
3877 | - } | |
3878 | - | |
3879 | - if (p_ptr->muta3 & MUT3_XTRA_EYES) | |
3880 | - { | |
3881 | - p_ptr->skill_fos += 15; | |
3882 | - p_ptr->skill_srh += 15; | |
3883 | - } | |
3884 | - | |
3885 | - if (p_ptr->muta3 & MUT3_MAGIC_RES) | |
3886 | - { | |
3887 | - p_ptr->skill_sav += (15 + (p_ptr->lev / 5)); | |
3888 | - } | |
3889 | - | |
3890 | - if (p_ptr->muta3 & MUT3_XTRA_NOIS) | |
3891 | - { | |
3892 | - p_ptr->skill_stl -= 3; | |
3893 | - } | |
3894 | - | |
3895 | - if (p_ptr->muta3 & MUT3_INFRAVIS) | |
3896 | - { | |
3897 | - p_ptr->see_infra += 3; | |
3898 | - } | |
3899 | - | |
3900 | - if (p_ptr->muta3 & MUT3_XTRA_LEGS) | |
3901 | - { | |
3902 | - new_speed += 3; | |
3903 | - } | |
3904 | - | |
3905 | - if (p_ptr->muta3 & MUT3_SHORT_LEG) | |
3906 | - { | |
3907 | - new_speed -= 3; | |
3908 | - } | |
3909 | - | |
3910 | - if (p_ptr->muta3 & MUT3_ELEC_TOUC) | |
3911 | - { | |
3912 | - p_ptr->sh_elec = TRUE; | |
3913 | - } | |
3914 | - | |
3915 | - if (p_ptr->muta3 & MUT3_FIRE_BODY) | |
3916 | - { | |
3917 | - p_ptr->sh_fire = TRUE; | |
3918 | - p_ptr->lite = TRUE; | |
3919 | - } | |
3920 | - | |
3921 | - if (p_ptr->muta3 & MUT3_WART_SKIN) | |
3922 | - { | |
3923 | - p_ptr->stat_add[A_CHR] -= 2; | |
3924 | - p_ptr->to_a += 5; | |
3925 | - p_ptr->dis_to_a += 5; | |
3926 | - } | |
3927 | - | |
3928 | - if (p_ptr->muta3 & MUT3_SCALES) | |
3929 | - { | |
3930 | - p_ptr->stat_add[A_CHR] -= 1; | |
3931 | - p_ptr->to_a += 10; | |
3932 | - p_ptr->dis_to_a += 10; | |
3933 | - } | |
3934 | - | |
3935 | - if (p_ptr->muta3 & MUT3_IRON_SKIN) | |
3936 | - { | |
3937 | - p_ptr->stat_add[A_DEX] -= 1; | |
3938 | - p_ptr->to_a += 25; | |
3939 | - p_ptr->dis_to_a += 25; | |
3940 | - } | |
3941 | - | |
3942 | - if (p_ptr->muta3 & MUT3_WINGS) | |
3943 | - { | |
3944 | - p_ptr->levitation = TRUE; | |
3945 | - } | |
3946 | - | |
3947 | - if (p_ptr->muta3 & MUT3_FEARLESS) | |
3948 | - { | |
3949 | - p_ptr->resist_fear = TRUE; | |
3950 | - } | |
3951 | - | |
3952 | - if (p_ptr->muta3 & MUT3_REGEN) | |
3953 | - { | |
3954 | - p_ptr->regenerate = TRUE; | |
3955 | - } | |
3956 | - | |
3957 | - if (p_ptr->muta3 & MUT3_ESP) | |
3958 | - { | |
3959 | - p_ptr->telepathy = TRUE; | |
3960 | - } | |
3961 | - | |
3962 | - if (p_ptr->muta3 & MUT3_LIMBER) | |
3963 | - { | |
3964 | - p_ptr->stat_add[A_DEX] += 3; | |
3965 | - } | |
3966 | - | |
3967 | - if (p_ptr->muta3 & MUT3_ARTHRITIS) | |
3968 | - { | |
3969 | - p_ptr->stat_add[A_DEX] -= 3; | |
3970 | - } | |
3971 | - | |
3972 | - if (p_ptr->muta3 & MUT3_MOTION) | |
3973 | - { | |
3974 | - p_ptr->free_act = TRUE; | |
3975 | - p_ptr->skill_stl += 1; | |
3976 | - } | |
3977 | - | |
3978 | - if (p_ptr->muta3 & MUT3_ILL_NORM) | |
3979 | - { | |
3980 | - p_ptr->stat_add[A_CHR] = 0; | |
3981 | - } | |
3982 | - } | |
3983 | - | |
3984 | - if (p_ptr->tsuyoshi) | |
3985 | - { | |
3986 | - p_ptr->stat_add[A_STR] += 4; | |
3987 | - p_ptr->stat_add[A_CON] += 4; | |
3988 | - } | |
3989 | - | |
3990 | - /* Scan the usable inventory */ | |
3991 | - for (i = INVEN_RARM; i < INVEN_TOTAL; i++) | |
3992 | - { | |
3993 | - int bonus_to_h, bonus_to_d; | |
3994 | - o_ptr = &inventory[i]; | |
3995 | - | |
3996 | - /* Skip non-objects */ | |
3997 | - if (!o_ptr->k_idx) continue; | |
3998 | - | |
3999 | - /* Extract the item flags */ | |
4000 | - object_flags(o_ptr, flgs); | |
4001 | - | |
4002 | - p_ptr->cursed |= (o_ptr->curse_flags & (0xFFFFFFF0L)); | |
4003 | - if (o_ptr->name1 == ART_CHAINSWORD) p_ptr->cursed |= TRC_CHAINSWORD; | |
4004 | - | |
4005 | - /* Affect stats */ | |
4006 | - if (have_flag(flgs, TR_STR)) p_ptr->stat_add[A_STR] += o_ptr->pval; | |
4007 | - if (have_flag(flgs, TR_INT)) p_ptr->stat_add[A_INT] += o_ptr->pval; | |
4008 | - if (have_flag(flgs, TR_WIS)) p_ptr->stat_add[A_WIS] += o_ptr->pval; | |
4009 | - if (have_flag(flgs, TR_DEX)) p_ptr->stat_add[A_DEX] += o_ptr->pval; | |
4010 | - if (have_flag(flgs, TR_CON)) p_ptr->stat_add[A_CON] += o_ptr->pval; | |
4011 | - if (have_flag(flgs, TR_CHR)) p_ptr->stat_add[A_CHR] += o_ptr->pval; | |
4012 | - | |
4013 | - if (have_flag(flgs, TR_MAGIC_MASTERY)) p_ptr->skill_dev += 8*o_ptr->pval; | |
4014 | - | |
4015 | - /* Affect stealth */ | |
4016 | - if (have_flag(flgs, TR_STEALTH)) p_ptr->skill_stl += o_ptr->pval; | |
4017 | - | |
4018 | - /* Affect searching ability (factor of five) */ | |
4019 | - if (have_flag(flgs, TR_SEARCH)) p_ptr->skill_srh += (o_ptr->pval * 5); | |
4020 | - | |
4021 | - /* Affect searching frequency (factor of five) */ | |
4022 | - if (have_flag(flgs, TR_SEARCH)) p_ptr->skill_fos += (o_ptr->pval * 5); | |
4023 | - | |
4024 | - /* Affect infravision */ | |
4025 | - if (have_flag(flgs, TR_INFRA)) p_ptr->see_infra += o_ptr->pval; | |
4026 | - | |
4027 | - /* Affect digging (factor of 20) */ | |
4028 | - if (have_flag(flgs, TR_TUNNEL)) p_ptr->skill_dig += (o_ptr->pval * 20); | |
4029 | - | |
4030 | - /* Affect speed */ | |
4031 | - if (have_flag(flgs, TR_SPEED)) new_speed += o_ptr->pval; | |
4032 | - | |
4033 | - /* Affect blows */ | |
4034 | - if (have_flag(flgs, TR_BLOWS)) | |
4035 | - { | |
4036 | - if((i == INVEN_RARM || i == INVEN_RIGHT) && !p_ptr->ryoute) extra_blows[0] += o_ptr->pval; | |
4037 | - else if((i == INVEN_LARM || i == INVEN_LEFT) && !p_ptr->ryoute) extra_blows[1] += o_ptr->pval; | |
4038 | - else {extra_blows[0] += o_ptr->pval; extra_blows[1] += o_ptr->pval;} | |
4039 | - } | |
4040 | - | |
4041 | - /* Hack -- cause earthquakes */ | |
4042 | - if (have_flag(flgs, TR_IMPACT)) p_ptr->impact[(i == INVEN_RARM) ? 0 : 1] = TRUE; | |
4043 | - | |
4044 | - /* Various flags */ | |
4045 | - if (have_flag(flgs, TR_AGGRAVATE)) p_ptr->cursed |= TRC_AGGRAVATE; | |
4046 | - if (have_flag(flgs, TR_DRAIN_EXP)) p_ptr->cursed |= TRC_DRAIN_EXP; | |
4047 | - if (have_flag(flgs, TR_TY_CURSE)) p_ptr->cursed |= TRC_TY_CURSE; | |
4048 | - if (have_flag(flgs, TR_ADD_L_CURSE)) p_ptr->cursed |= TRC_ADD_L_CURSE; | |
4049 | - if (have_flag(flgs, TR_ADD_H_CURSE)) p_ptr->cursed |= TRC_ADD_H_CURSE; | |
4050 | - if (have_flag(flgs, TR_DRAIN_HP)) p_ptr->cursed |= TRC_DRAIN_HP; | |
4051 | - if (have_flag(flgs, TR_DRAIN_MANA)) p_ptr->cursed |= TRC_DRAIN_MANA; | |
4052 | - if (have_flag(flgs, TR_CALL_ANIMAL)) p_ptr->cursed |= TRC_CALL_ANIMAL; | |
4053 | - if (have_flag(flgs, TR_CALL_DEMON)) p_ptr->cursed |= TRC_CALL_DEMON; | |
4054 | - if (have_flag(flgs, TR_CALL_DRAGON)) p_ptr->cursed |= TRC_CALL_DRAGON; | |
4055 | - if (have_flag(flgs, TR_CALL_UNDEAD)) p_ptr->cursed |= TRC_CALL_UNDEAD; | |
4056 | - if (have_flag(flgs, TR_COWARDICE)) p_ptr->cursed |= TRC_COWARDICE; | |
4057 | - if (have_flag(flgs, TR_LOW_MELEE)) p_ptr->cursed |= TRC_LOW_MELEE; | |
4058 | - if (have_flag(flgs, TR_LOW_AC)) p_ptr->cursed |= TRC_LOW_AC; | |
4059 | - if (have_flag(flgs, TR_LOW_MAGIC)) p_ptr->cursed |= TRC_LOW_MAGIC; | |
4060 | - if (have_flag(flgs, TR_FAST_DIGEST)) p_ptr->cursed |= TRC_FAST_DIGEST; | |
4061 | - if (have_flag(flgs, TR_SLOW_REGEN)) p_ptr->cursed |= TRC_SLOW_REGEN; | |
4062 | - if (have_flag(flgs, TR_DEC_MANA)) p_ptr->dec_mana = TRUE; | |
4063 | - if (have_flag(flgs, TR_BLESSED)) p_ptr->bless_blade = TRUE; | |
4064 | - if (have_flag(flgs, TR_XTRA_MIGHT)) p_ptr->xtra_might = TRUE; | |
4065 | - if (have_flag(flgs, TR_SLOW_DIGEST)) p_ptr->slow_digest = TRUE; | |
4066 | - if (have_flag(flgs, TR_REGEN)) p_ptr->regenerate = TRUE; | |
4067 | - if (have_flag(flgs, TR_TELEPATHY)) p_ptr->telepathy = TRUE; | |
4068 | - if (have_flag(flgs, TR_ESP_ANIMAL)) p_ptr->esp_animal = TRUE; | |
4069 | - if (have_flag(flgs, TR_ESP_UNDEAD)) p_ptr->esp_undead = TRUE; | |
4070 | - if (have_flag(flgs, TR_ESP_DEMON)) p_ptr->esp_demon = TRUE; | |
4071 | - if (have_flag(flgs, TR_ESP_ORC)) p_ptr->esp_orc = TRUE; | |
4072 | - if (have_flag(flgs, TR_ESP_TROLL)) p_ptr->esp_troll = TRUE; | |
4073 | - if (have_flag(flgs, TR_ESP_GIANT)) p_ptr->esp_giant = TRUE; | |
4074 | - if (have_flag(flgs, TR_ESP_DRAGON)) p_ptr->esp_dragon = TRUE; | |
4075 | - if (have_flag(flgs, TR_ESP_HUMAN)) p_ptr->esp_human = TRUE; | |
4076 | - if (have_flag(flgs, TR_ESP_EVIL)) p_ptr->esp_evil = TRUE; | |
4077 | - if (have_flag(flgs, TR_ESP_GOOD)) p_ptr->esp_good = TRUE; | |
4078 | - if (have_flag(flgs, TR_ESP_NONLIVING)) p_ptr->esp_nonliving = TRUE; | |
4079 | - if (have_flag(flgs, TR_ESP_UNIQUE)) p_ptr->esp_unique = TRUE; | |
4080 | - | |
4081 | - if (have_flag(flgs, TR_SEE_INVIS)) p_ptr->see_inv = TRUE; | |
4082 | - if (have_flag(flgs, TR_LEVITATION)) p_ptr->levitation = TRUE; | |
4083 | - if (have_flag(flgs, TR_FREE_ACT)) p_ptr->free_act = TRUE; | |
4084 | - if (have_flag(flgs, TR_HOLD_EXP)) p_ptr->hold_exp = TRUE; | |
4085 | - if (have_flag(flgs, TR_WARNING)){ | |
4086 | - if (!o_ptr->inscription || !(my_strchr(quark_str(o_ptr->inscription),'$'))) | |
4087 | - p_ptr->warning = TRUE; | |
4088 | - } | |
4089 | - | |
4090 | - if (have_flag(flgs, TR_TELEPORT)) | |
4091 | - { | |
4092 | - if (object_is_cursed(o_ptr)) p_ptr->cursed |= TRC_TELEPORT; | |
4093 | - else | |
4094 | - { | |
4095 | - concptr insc = quark_str(o_ptr->inscription); | |
4096 | - | |
4097 | - if (o_ptr->inscription && my_strchr(insc, '.')) | |
4098 | - { | |
4099 | - /* | |
4100 | - * {.} will stop random teleportation. | |
4101 | - */ | |
4102 | - } | |
4103 | - else | |
4104 | - { | |
4105 | - /* Controlled random teleportation */ | |
4106 | - p_ptr->cursed |= TRC_TELEPORT_SELF; | |
4107 | - } | |
4108 | - } | |
4109 | - } | |
4110 | - | |
4111 | - /* Immunity flags */ | |
4112 | - if (have_flag(flgs, TR_IM_FIRE)) p_ptr->immune_fire = TRUE; | |
4113 | - if (have_flag(flgs, TR_IM_ACID)) p_ptr->immune_acid = TRUE; | |
4114 | - if (have_flag(flgs, TR_IM_COLD)) p_ptr->immune_cold = TRUE; | |
4115 | - if (have_flag(flgs, TR_IM_ELEC)) p_ptr->immune_elec = TRUE; | |
4116 | - | |
4117 | - /* Resistance flags */ | |
4118 | - if (have_flag(flgs, TR_RES_ACID)) p_ptr->resist_acid = TRUE; | |
4119 | - if (have_flag(flgs, TR_RES_ELEC)) p_ptr->resist_elec = TRUE; | |
4120 | - if (have_flag(flgs, TR_RES_FIRE)) p_ptr->resist_fire = TRUE; | |
4121 | - if (have_flag(flgs, TR_RES_COLD)) p_ptr->resist_cold = TRUE; | |
4122 | - if (have_flag(flgs, TR_RES_POIS)) p_ptr->resist_pois = TRUE; | |
4123 | - if (have_flag(flgs, TR_RES_FEAR)) p_ptr->resist_fear = TRUE; | |
4124 | - if (have_flag(flgs, TR_RES_CONF)) p_ptr->resist_conf = TRUE; | |
4125 | - if (have_flag(flgs, TR_RES_SOUND)) p_ptr->resist_sound = TRUE; | |
4126 | - if (have_flag(flgs, TR_RES_LITE)) p_ptr->resist_lite = TRUE; | |
4127 | - if (have_flag(flgs, TR_RES_DARK)) p_ptr->resist_dark = TRUE; | |
4128 | - if (have_flag(flgs, TR_RES_CHAOS)) p_ptr->resist_chaos = TRUE; | |
4129 | - if (have_flag(flgs, TR_RES_DISEN)) p_ptr->resist_disen = TRUE; | |
4130 | - if (have_flag(flgs, TR_RES_SHARDS)) p_ptr->resist_shard = TRUE; | |
4131 | - if (have_flag(flgs, TR_RES_NEXUS)) p_ptr->resist_nexus = TRUE; | |
4132 | - if (have_flag(flgs, TR_RES_BLIND)) p_ptr->resist_blind = TRUE; | |
4133 | - if (have_flag(flgs, TR_RES_NETHER)) p_ptr->resist_neth = TRUE; | |
4134 | - | |
4135 | - if (have_flag(flgs, TR_REFLECT)) p_ptr->reflect = TRUE; | |
4136 | - if (have_flag(flgs, TR_SH_FIRE)) p_ptr->sh_fire = TRUE; | |
4137 | - if (have_flag(flgs, TR_SH_ELEC)) p_ptr->sh_elec = TRUE; | |
4138 | - if (have_flag(flgs, TR_SH_COLD)) p_ptr->sh_cold = TRUE; | |
4139 | - if (have_flag(flgs, TR_NO_MAGIC)) p_ptr->anti_magic = TRUE; | |
4140 | - if (have_flag(flgs, TR_NO_TELE)) p_ptr->anti_tele = TRUE; | |
4141 | - | |
4142 | - /* Sustain flags */ | |
4143 | - if (have_flag(flgs, TR_SUST_STR)) p_ptr->sustain_str = TRUE; | |
4144 | - if (have_flag(flgs, TR_SUST_INT)) p_ptr->sustain_int = TRUE; | |
4145 | - if (have_flag(flgs, TR_SUST_WIS)) p_ptr->sustain_wis = TRUE; | |
4146 | - if (have_flag(flgs, TR_SUST_DEX)) p_ptr->sustain_dex = TRUE; | |
4147 | - if (have_flag(flgs, TR_SUST_CON)) p_ptr->sustain_con = TRUE; | |
4148 | - if (have_flag(flgs, TR_SUST_CHR)) p_ptr->sustain_chr = TRUE; | |
4149 | - | |
4150 | - if (o_ptr->name2 == EGO_YOIYAMI) yoiyami = TRUE; | |
4151 | - if (o_ptr->name2 == EGO_2WEAPON) easy_2weapon = TRUE; | |
4152 | - if (o_ptr->name2 == EGO_RING_RES_TIME) p_ptr->resist_time = TRUE; | |
4153 | - if (o_ptr->name2 == EGO_RING_THROW) p_ptr->mighty_throw = TRUE; | |
4154 | - if (have_flag(flgs, TR_EASY_SPELL)) p_ptr->easy_spell = TRUE; | |
4155 | - if (o_ptr->name2 == EGO_AMU_FOOL) p_ptr->heavy_spell = TRUE; | |
4156 | - if (o_ptr->name2 == EGO_AMU_NAIVETY) down_saving = TRUE; | |
4157 | - | |
4158 | - if (o_ptr->curse_flags & TRC_LOW_MAGIC) | |
4159 | - { | |
4160 | - if (o_ptr->curse_flags & TRC_HEAVY_CURSE) | |
4161 | - { | |
4162 | - p_ptr->to_m_chance += 10; | |
4163 | - } | |
4164 | - else | |
4165 | - { | |
4166 | - p_ptr->to_m_chance += 3; | |
4167 | - } | |
4168 | - } | |
4169 | - | |
4170 | - if (o_ptr->tval == TV_CAPTURE) continue; | |
4171 | - | |
4172 | - /* Modify the base armor class */ | |
4173 | - p_ptr->ac += o_ptr->ac; | |
4174 | - | |
4175 | - /* The base armor class is always known */ | |
4176 | - p_ptr->dis_ac += o_ptr->ac; | |
4177 | - | |
4178 | - /* Apply the bonuses to armor class */ | |
4179 | - p_ptr->to_a += o_ptr->to_a; | |
4180 | - | |
4181 | - /* Apply the mental bonuses to armor class, if known */ | |
4182 | - if (object_is_known(o_ptr)) p_ptr->dis_to_a += o_ptr->to_a; | |
4183 | - | |
4184 | - if (o_ptr->curse_flags & TRC_LOW_MELEE) | |
4185 | - { | |
4186 | - int slot = i - INVEN_RARM; | |
4187 | - if (slot < 2) | |
4188 | - { | |
4189 | - if (o_ptr->curse_flags & TRC_HEAVY_CURSE) | |
4190 | - { | |
4191 | - p_ptr->to_h[slot] -= 15; | |
4192 | - if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_h[slot] -= 15; | |
4193 | - } | |
4194 | - else | |
4195 | - { | |
4196 | - p_ptr->to_h[slot] -= 5; | |
4197 | - if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_h[slot] -= 5; | |
4198 | - } | |
4199 | - } | |
4200 | - else | |
4201 | - { | |
4202 | - if (o_ptr->curse_flags & TRC_HEAVY_CURSE) | |
4203 | - { | |
4204 | - p_ptr->to_h_b -= 15; | |
4205 | - if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_h_b -= 15; | |
4206 | - } | |
4207 | - else | |
4208 | - { | |
4209 | - p_ptr->to_h_b -= 5; | |
4210 | - if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_h_b -= 5; | |
4211 | - } | |
4212 | - } | |
4213 | - } | |
4214 | - | |
4215 | - if (o_ptr->curse_flags & TRC_LOW_AC) | |
4216 | - { | |
4217 | - if (o_ptr->curse_flags & TRC_HEAVY_CURSE) | |
4218 | - { | |
4219 | - p_ptr->to_a -= 30; | |
4220 | - if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_a -= 30; | |
4221 | - } | |
4222 | - else | |
4223 | - { | |
4224 | - p_ptr->to_a -= 10; | |
4225 | - if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_a -= 10; | |
4226 | - } | |
4227 | - } | |
4228 | - | |
4229 | - /* Hack -- do not apply "weapon" bonuses */ | |
4230 | - if (i == INVEN_RARM && buki_motteruka(i)) continue; | |
4231 | - if (i == INVEN_LARM && buki_motteruka(i)) continue; | |
4232 | - | |
4233 | - /* Hack -- do not apply "bow" bonuses */ | |
4234 | - if (i == INVEN_BOW) continue; | |
4235 | - | |
4236 | - bonus_to_h = o_ptr->to_h; | |
4237 | - bonus_to_d = o_ptr->to_d; | |
4238 | - | |
4239 | - if (p_ptr->pclass == CLASS_NINJA) | |
4240 | - { | |
4241 | - if (o_ptr->to_h > 0) bonus_to_h = (o_ptr->to_h+1)/2; | |
4242 | - if (o_ptr->to_d > 0) bonus_to_d = (o_ptr->to_d+1)/2; | |
4243 | - } | |
4244 | - | |
4245 | - /* To Bow and Natural attack */ | |
4246 | - | |
4247 | - /* Apply the bonuses to hit/damage */ | |
4248 | - p_ptr->to_h_b += (s16b)bonus_to_h; | |
4249 | - p_ptr->to_h_m += (s16b)bonus_to_h; | |
4250 | - p_ptr->to_d_m += (s16b)bonus_to_d; | |
4251 | - | |
4252 | - /* Apply the mental bonuses tp hit/damage, if known */ | |
4253 | - if (object_is_known(o_ptr)) p_ptr->dis_to_h_b += (s16b)bonus_to_h; | |
4254 | - | |
4255 | - /* To Melee */ | |
4256 | - if ((i == INVEN_LEFT || i == INVEN_RIGHT) && !p_ptr->ryoute) | |
4257 | - { | |
4258 | - /* Apply the bonuses to hit/damage */ | |
4259 | - p_ptr->to_h[i-INVEN_RIGHT] += (s16b)bonus_to_h; | |
4260 | - p_ptr->to_d[i-INVEN_RIGHT] += (s16b)bonus_to_d; | |
4261 | - | |
4262 | - /* Apply the mental bonuses tp hit/damage, if known */ | |
4263 | - if (object_is_known(o_ptr)) | |
4264 | - { | |
4265 | - p_ptr->dis_to_h[i-INVEN_RIGHT] += (s16b)bonus_to_h; | |
4266 | - p_ptr->dis_to_d[i-INVEN_RIGHT] += (s16b)bonus_to_d; | |
4267 | - } | |
4268 | - } | |
4269 | - else if (p_ptr->migite && p_ptr->hidarite) | |
4270 | - { | |
4271 | - /* Apply the bonuses to hit/damage */ | |
4272 | - p_ptr->to_h[0] += (bonus_to_h > 0) ? (bonus_to_h+1)/2 : bonus_to_h; | |
4273 | - p_ptr->to_h[1] += (bonus_to_h > 0) ? bonus_to_h/2 : bonus_to_h; | |
4274 | - p_ptr->to_d[0] += (bonus_to_d > 0) ? (bonus_to_d+1)/2 : bonus_to_d; | |
4275 | - p_ptr->to_d[1] += (bonus_to_d > 0) ? bonus_to_d/2 : bonus_to_d; | |
4276 | - | |
4277 | - /* Apply the mental bonuses tp hit/damage, if known */ | |
4278 | - if (object_is_known(o_ptr)) | |
4279 | - { | |
4280 | - p_ptr->dis_to_h[0] += (bonus_to_h > 0) ? (bonus_to_h+1)/2 : bonus_to_h; | |
4281 | - p_ptr->dis_to_h[1] += (bonus_to_h > 0) ? bonus_to_h/2 : bonus_to_h; | |
4282 | - p_ptr->dis_to_d[0] += (bonus_to_d > 0) ? (bonus_to_d+1)/2 : bonus_to_d; | |
4283 | - p_ptr->dis_to_d[1] += (bonus_to_d > 0) ? bonus_to_d/2 : bonus_to_d; | |
4284 | - } | |
4285 | - } | |
4286 | - else | |
4287 | - { | |
4288 | - /* Apply the bonuses to hit/damage */ | |
4289 | - p_ptr->to_h[default_hand] += (s16b)bonus_to_h; | |
4290 | - p_ptr->to_d[default_hand] += (s16b)bonus_to_d; | |
4291 | - | |
4292 | - /* Apply the mental bonuses to hit/damage, if known */ | |
4293 | - if (object_is_known(o_ptr)) | |
4294 | - { | |
4295 | - p_ptr->dis_to_h[default_hand] += (s16b)bonus_to_h; | |
4296 | - p_ptr->dis_to_d[default_hand] += (s16b)bonus_to_d; | |
4297 | - } | |
4298 | - } | |
4299 | - } | |
4300 | - | |
4301 | - /* Shield skill bonus */ | |
4302 | - if (object_is_armour(&inventory[INVEN_RARM]) || object_is_armour(&inventory[INVEN_LARM])) | |
4303 | - { | |
4304 | - p_ptr->ac += p_ptr->skill_exp[GINOU_SHIELD] * (1 + p_ptr->lev / 22) / 2000; | |
4305 | - p_ptr->dis_ac += p_ptr->skill_exp[GINOU_SHIELD] * (1 + p_ptr->lev / 22) / 2000; | |
4306 | - } | |
4307 | - | |
4308 | - if (old_mighty_throw != p_ptr->mighty_throw) | |
4309 | - { | |
4310 | - /* Redraw average damege display of Shuriken */ | |
4311 | - p_ptr->window |= PW_INVEN; | |
4312 | - } | |
4313 | - | |
4314 | - if (p_ptr->cursed & TRC_TELEPORT) p_ptr->cursed &= ~(TRC_TELEPORT_SELF); | |
4315 | - | |
4316 | - /* Monks get extra ac for armour _not worn_ */ | |
4317 | - if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER)) && !heavy_armor()) | |
4318 | - { | |
4319 | - if (!(inventory[INVEN_BODY].k_idx)) | |
4320 | - { | |
4321 | - p_ptr->to_a += (p_ptr->lev * 3) / 2; | |
4322 | - p_ptr->dis_to_a += (p_ptr->lev * 3) / 2; | |
4323 | - } | |
4324 | - if (!(inventory[INVEN_OUTER].k_idx) && (p_ptr->lev > 15)) | |
4325 | - { | |
4326 | - p_ptr->to_a += ((p_ptr->lev - 13) / 3); | |
4327 | - p_ptr->dis_to_a += ((p_ptr->lev - 13) / 3); | |
4328 | - } | |
4329 | - if (!(inventory[INVEN_LARM].k_idx) && (p_ptr->lev > 10)) | |
4330 | - { | |
4331 | - p_ptr->to_a += ((p_ptr->lev - 8) / 3); | |
4332 | - p_ptr->dis_to_a += ((p_ptr->lev - 8) / 3); | |
4333 | - } | |
4334 | - if (!(inventory[INVEN_HEAD].k_idx) && (p_ptr->lev > 4)) | |
4335 | - { | |
4336 | - p_ptr->to_a += (p_ptr->lev - 2) / 3; | |
4337 | - p_ptr->dis_to_a += (p_ptr->lev -2) / 3; | |
4338 | - } | |
4339 | - if (!(inventory[INVEN_HANDS].k_idx)) | |
4340 | - { | |
4341 | - p_ptr->to_a += (p_ptr->lev / 2); | |
4342 | - p_ptr->dis_to_a += (p_ptr->lev / 2); | |
4343 | - } | |
4344 | - if (!(inventory[INVEN_FEET].k_idx)) | |
4345 | - { | |
4346 | - p_ptr->to_a += (p_ptr->lev / 3); | |
4347 | - p_ptr->dis_to_a += (p_ptr->lev / 3); | |
4348 | - } | |
4349 | - if (p_ptr->special_defense & KAMAE_BYAKKO) | |
4350 | - { | |
4351 | - p_ptr->stat_add[A_STR] += 2; | |
4352 | - p_ptr->stat_add[A_DEX] += 2; | |
4353 | - p_ptr->stat_add[A_CON] -= 3; | |
4354 | - } | |
4355 | - else if (p_ptr->special_defense & KAMAE_SEIRYU) | |
4356 | - { | |
4357 | - } | |
4358 | - else if (p_ptr->special_defense & KAMAE_GENBU) | |
4359 | - { | |
4360 | - p_ptr->stat_add[A_INT] -= 1; | |
4361 | - p_ptr->stat_add[A_WIS] -= 1; | |
4362 | - p_ptr->stat_add[A_DEX] -= 2; | |
4363 | - p_ptr->stat_add[A_CON] += 3; | |
4364 | - } | |
4365 | - else if (p_ptr->special_defense & KAMAE_SUZAKU) | |
4366 | - { | |
4367 | - p_ptr->stat_add[A_STR] -= 2; | |
4368 | - p_ptr->stat_add[A_INT] += 1; | |
4369 | - p_ptr->stat_add[A_WIS] += 1; | |
4370 | - p_ptr->stat_add[A_DEX] += 2; | |
4371 | - p_ptr->stat_add[A_CON] -= 2; | |
4372 | - } | |
4373 | - } | |
4374 | - | |
4375 | - if (p_ptr->special_defense & KATA_KOUKIJIN) | |
4376 | - { | |
4377 | - for (i = 0; i < A_MAX; i++) | |
4378 | - p_ptr->stat_add[i] += 5; | |
4379 | - p_ptr->to_a -= 50; | |
4380 | - p_ptr->dis_to_a -= 50; | |
4381 | - } | |
4382 | - | |
4383 | - /* Hack -- aura of fire also provides light */ | |
4384 | - if (p_ptr->sh_fire) p_ptr->lite = TRUE; | |
4385 | - | |
4386 | - /* Golems also get an intrinsic AC bonus */ | |
4387 | - if (prace_is_(RACE_GOLEM) || prace_is_(RACE_ANDROID)) | |
4388 | - { | |
4389 | - p_ptr->to_a += 10 + (p_ptr->lev * 2 / 5); | |
4390 | - p_ptr->dis_to_a += 10 + (p_ptr->lev * 2 / 5); | |
4391 | - } | |
4392 | - | |
4393 | - /* Hex bonuses */ | |
4394 | - if (p_ptr->realm1 == REALM_HEX) | |
4395 | - { | |
4396 | - if (hex_spelling_any()) p_ptr->skill_stl -= (1 + CASTING_HEX_NUM(p_ptr)); | |
4397 | - if (hex_spelling(HEX_DETECT_EVIL)) p_ptr->esp_evil = TRUE; | |
4398 | - if (hex_spelling(HEX_XTRA_MIGHT)) p_ptr->stat_add[A_STR] += 4; | |
4399 | - if (hex_spelling(HEX_BUILDING)) | |
4400 | - { | |
4401 | - p_ptr->stat_add[A_STR] += 4; | |
4402 | - p_ptr->stat_add[A_DEX] += 4; | |
4403 | - p_ptr->stat_add[A_CON] += 4; | |
4404 | - } | |
4405 | - if (hex_spelling(HEX_DEMON_AURA)) | |
4406 | - { | |
4407 | - p_ptr->sh_fire = TRUE; | |
4408 | - p_ptr->regenerate = TRUE; | |
4409 | - } | |
4410 | - if (hex_spelling(HEX_ICE_ARMOR)) | |
4411 | - { | |
4412 | - p_ptr->sh_cold = TRUE; | |
4413 | - p_ptr->to_a += 30; | |
4414 | - p_ptr->dis_to_a += 30; | |
4415 | - } | |
4416 | - if (hex_spelling(HEX_SHOCK_CLOAK)) | |
4417 | - { | |
4418 | - p_ptr->sh_elec = TRUE; | |
4419 | - new_speed += 3; | |
4420 | - } | |
4421 | - for (i = INVEN_RARM; i <= INVEN_FEET; i++) | |
4422 | - { | |
4423 | - ARMOUR_CLASS ac = 0; | |
4424 | - o_ptr = &inventory[i]; | |
4425 | - if (!o_ptr->k_idx) continue; | |
4426 | - if (!object_is_armour(o_ptr)) continue; | |
4427 | - if (!object_is_cursed(o_ptr)) continue; | |
4428 | - ac += 5; | |
4429 | - if (o_ptr->curse_flags & TRC_HEAVY_CURSE) ac += 7; | |
4430 | - if (o_ptr->curse_flags & TRC_PERMA_CURSE) ac += 13; | |
4431 | - p_ptr->to_a += (s16b)ac; | |
4432 | - p_ptr->dis_to_a += (s16b)ac; | |
4433 | - } | |
4434 | - } | |
4435 | - | |
4436 | - /* Calculate stats */ | |
4437 | - for (i = 0; i < A_MAX; i++) | |
4438 | - { | |
4439 | - int top, use, ind; | |
4440 | - | |
4441 | - /* Extract the new "stat_use" value for the stat */ | |
4442 | - top = modify_stat_value(p_ptr->stat_max[i], p_ptr->stat_add[i]); | |
4443 | - | |
4444 | - /* Notice changes */ | |
4445 | - if (p_ptr->stat_top[i] != top) | |
4446 | - { | |
4447 | - /* Save the new value */ | |
4448 | - p_ptr->stat_top[i] = (s16b)top; | |
4449 | - | |
4450 | - /* Redisplay the stats later */ | |
4451 | - p_ptr->redraw |= (PR_STATS); | |
4452 | - | |
4453 | - p_ptr->window |= (PW_PLAYER); | |
4454 | - } | |
4455 | - | |
4456 | - | |
4457 | - /* Extract the new "stat_use" value for the stat */ | |
4458 | - use = modify_stat_value(p_ptr->stat_cur[i], p_ptr->stat_add[i]); | |
4459 | - | |
4460 | - if ((i == A_CHR) && (p_ptr->muta3 & MUT3_ILL_NORM)) | |
4461 | - { | |
4462 | - /* 10 to 18/90 charisma, guaranteed, based on level */ | |
4463 | - if (use < 8 + 2 * p_ptr->lev) | |
4464 | - { | |
4465 | - use = 8 + 2 * p_ptr->lev; | |
4466 | - } | |
4467 | - } | |
4468 | - | |
4469 | - /* Notice changes */ | |
4470 | - if (p_ptr->stat_use[i] != use) | |
4471 | - { | |
4472 | - /* Save the new value */ | |
4473 | - p_ptr->stat_use[i] = (s16b)use; | |
4474 | - | |
4475 | - /* Redisplay the stats later */ | |
4476 | - p_ptr->redraw |= (PR_STATS); | |
4477 | - | |
4478 | - p_ptr->window |= (PW_PLAYER); | |
4479 | - } | |
4480 | - | |
4481 | - | |
4482 | - /* Values: 3, 4, ..., 17 */ | |
4483 | - if (use <= 18) ind = (use - 3); | |
4484 | - | |
4485 | - /* Ranges: 18/00-18/09, ..., 18/210-18/219 */ | |
4486 | - else if (use <= 18+219) ind = (15 + (use - 18) / 10); | |
4487 | - | |
4488 | - /* Range: 18/220+ */ | |
4489 | - else ind = (37); | |
4490 | - | |
4491 | - /* Notice changes */ | |
4492 | - if (p_ptr->stat_ind[i] != ind) | |
4493 | - { | |
4494 | - /* Save the new index */ | |
4495 | - p_ptr->stat_ind[i] = (s16b)ind; | |
4496 | - | |
4497 | - /* Change in CON affects Hitpoints */ | |
4498 | - if (i == A_CON) | |
4499 | - { | |
4500 | - p_ptr->update |= (PU_HP); | |
4501 | - } | |
4502 | - | |
4503 | - /* Change in INT may affect Mana/Spells */ | |
4504 | - else if (i == A_INT) | |
4505 | - { | |
4506 | - if (mp_ptr->spell_stat == A_INT) | |
4507 | - { | |
4508 | - p_ptr->update |= (PU_MANA | PU_SPELLS); | |
4509 | - } | |
4510 | - } | |
4511 | - | |
4512 | - /* Change in WIS may affect Mana/Spells */ | |
4513 | - else if (i == A_WIS) | |
4514 | - { | |
4515 | - if (mp_ptr->spell_stat == A_WIS) | |
4516 | - { | |
4517 | - p_ptr->update |= (PU_MANA | PU_SPELLS); | |
4518 | - } | |
4519 | - } | |
4520 | - | |
4521 | - /* Change in WIS may affect Mana/Spells */ | |
4522 | - else if (i == A_CHR) | |
4523 | - { | |
4524 | - if (mp_ptr->spell_stat == A_CHR) | |
4525 | - { | |
4526 | - p_ptr->update |= (PU_MANA | PU_SPELLS); | |
4527 | - } | |
4528 | - } | |
4529 | - | |
4530 | - p_ptr->window |= (PW_PLAYER); | |
4531 | - } | |
4532 | - } | |
4533 | - | |
4534 | - | |
4535 | - /* Apply temporary "stun" */ | |
4536 | - if (p_ptr->stun > 50) | |
4537 | - { | |
4538 | - p_ptr->to_h[0] -= 20; | |
4539 | - p_ptr->to_h[1] -= 20; | |
4540 | - p_ptr->to_h_b -= 20; | |
4541 | - p_ptr->to_h_m -= 20; | |
4542 | - p_ptr->dis_to_h[0] -= 20; | |
4543 | - p_ptr->dis_to_h[1] -= 20; | |
4544 | - p_ptr->dis_to_h_b -= 20; | |
4545 | - p_ptr->to_d[0] -= 20; | |
4546 | - p_ptr->to_d[1] -= 20; | |
4547 | - p_ptr->to_d_m -= 20; | |
4548 | - p_ptr->dis_to_d[0] -= 20; | |
4549 | - p_ptr->dis_to_d[1] -= 20; | |
4550 | - } | |
4551 | - else if (p_ptr->stun) | |
4552 | - { | |
4553 | - p_ptr->to_h[0] -= 5; | |
4554 | - p_ptr->to_h[1] -= 5; | |
4555 | - p_ptr->to_h_b -= 5; | |
4556 | - p_ptr->to_h_m -= 5; | |
4557 | - p_ptr->dis_to_h[0] -= 5; | |
4558 | - p_ptr->dis_to_h[1] -= 5; | |
4559 | - p_ptr->dis_to_h_b -= 5; | |
4560 | - p_ptr->to_d[0] -= 5; | |
4561 | - p_ptr->to_d[1] -= 5; | |
4562 | - p_ptr->to_d_m -= 5; | |
4563 | - p_ptr->dis_to_d[0] -= 5; | |
4564 | - p_ptr->dis_to_d[1] -= 5; | |
4565 | - } | |
4566 | - | |
4567 | - /* Wraith form */ | |
4568 | - if (p_ptr->wraith_form) | |
4569 | - { | |
4570 | - p_ptr->reflect = TRUE; | |
4571 | - p_ptr->pass_wall = TRUE; | |
4572 | - } | |
4573 | - | |
4574 | - if (p_ptr->kabenuke) | |
4575 | - { | |
4576 | - p_ptr->pass_wall = TRUE; | |
4577 | - } | |
4578 | - | |
4579 | - /* Temporary blessing */ | |
4580 | - if (IS_BLESSED()) | |
4581 | - { | |
4582 | - p_ptr->to_a += 5; | |
4583 | - p_ptr->dis_to_a += 5; | |
4584 | - p_ptr->to_h[0] += 10; | |
4585 | - p_ptr->to_h[1] += 10; | |
4586 | - p_ptr->to_h_b += 10; | |
4587 | - p_ptr->to_h_m += 10; | |
4588 | - p_ptr->dis_to_h[0] += 10; | |
4589 | - p_ptr->dis_to_h[1] += 10; | |
4590 | - p_ptr->dis_to_h_b += 10; | |
4591 | - } | |
4592 | - | |
4593 | - if (p_ptr->magicdef) | |
4594 | - { | |
4595 | - p_ptr->resist_blind = TRUE; | |
4596 | - p_ptr->resist_conf = TRUE; | |
4597 | - p_ptr->reflect = TRUE; | |
4598 | - p_ptr->free_act = TRUE; | |
4599 | - p_ptr->levitation = TRUE; | |
4600 | - } | |
4601 | - | |
4602 | - /* Temporary "Hero" */ | |
4603 | - if (IS_HERO()) | |
4604 | - { | |
4605 | - p_ptr->to_h[0] += 12; | |
4606 | - p_ptr->to_h[1] += 12; | |
4607 | - p_ptr->to_h_b += 12; | |
4608 | - p_ptr->to_h_m += 12; | |
4609 | - p_ptr->dis_to_h[0] += 12; | |
4610 | - p_ptr->dis_to_h[1] += 12; | |
4611 | - p_ptr->dis_to_h_b += 12; | |
4612 | - } | |
4613 | - | |
4614 | - /* Temporary "Beserk" */ | |
4615 | - if (p_ptr->shero) | |
4616 | - { | |
4617 | - p_ptr->to_h[0] += 12; | |
4618 | - p_ptr->to_h[1] += 12; | |
4619 | - p_ptr->to_h_b -= 12; | |
4620 | - p_ptr->to_h_m += 12; | |
4621 | - p_ptr->to_d[0] += 3+(p_ptr->lev/5); | |
4622 | - p_ptr->to_d[1] += 3+(p_ptr->lev/5); | |
4623 | - p_ptr->to_d_m += 3+(p_ptr->lev/5); | |
4624 | - p_ptr->dis_to_h[0] += 12; | |
4625 | - p_ptr->dis_to_h[1] += 12; | |
4626 | - p_ptr->dis_to_h_b -= 12; | |
4627 | - p_ptr->dis_to_d[0] += 3+(p_ptr->lev/5); | |
4628 | - p_ptr->dis_to_d[1] += 3+(p_ptr->lev/5); | |
4629 | - p_ptr->to_a -= 10; | |
4630 | - p_ptr->dis_to_a -= 10; | |
4631 | - p_ptr->skill_stl -= 7; | |
4632 | - p_ptr->skill_dev -= 20; | |
4633 | - p_ptr->skill_sav -= 30; | |
4634 | - p_ptr->skill_srh -= 15; | |
4635 | - p_ptr->skill_fos -= 15; | |
4636 | - p_ptr->skill_tht -= 20; | |
4637 | - p_ptr->skill_dig += 30; | |
4638 | - } | |
4639 | - | |
4640 | - /* Temporary "fast" */ | |
4641 | - if (IS_FAST()) | |
4642 | - { | |
4643 | - new_speed += 10; | |
4644 | - } | |
4645 | - | |
4646 | - /* Temporary "slow" */ | |
4647 | - if (p_ptr->slow) | |
4648 | - { | |
4649 | - new_speed -= 10; | |
4650 | - } | |
4651 | - | |
4652 | - /* Temporary "telepathy" */ | |
4653 | - if (IS_TIM_ESP()) | |
4654 | - { | |
4655 | - p_ptr->telepathy = TRUE; | |
4656 | - } | |
4657 | - | |
4658 | - if (p_ptr->ele_immune) | |
4659 | - { | |
4660 | - if (p_ptr->special_defense & DEFENSE_ACID) | |
4661 | - p_ptr->immune_acid = TRUE; | |
4662 | - else if (p_ptr->special_defense & DEFENSE_ELEC) | |
4663 | - p_ptr->immune_elec = TRUE; | |
4664 | - else if (p_ptr->special_defense & DEFENSE_FIRE) | |
4665 | - p_ptr->immune_fire = TRUE; | |
4666 | - else if (p_ptr->special_defense & DEFENSE_COLD) | |
4667 | - p_ptr->immune_cold = TRUE; | |
4668 | - } | |
4669 | - | |
4670 | - /* Temporary see invisible */ | |
4671 | - if (p_ptr->tim_invis) | |
4672 | - { | |
4673 | - p_ptr->see_inv = TRUE; | |
4674 | - } | |
4675 | - | |
4676 | - /* Temporary infravision boost */ | |
4677 | - if (p_ptr->tim_infra) | |
4678 | - { | |
4679 | - p_ptr->see_infra+=3; | |
4680 | - } | |
4681 | - | |
4682 | - /* Temporary regeneration boost */ | |
4683 | - if (p_ptr->tim_regen) | |
4684 | - { | |
4685 | - p_ptr->regenerate = TRUE; | |
4686 | - } | |
4687 | - | |
4688 | - /* Temporary levitation */ | |
4689 | - if (p_ptr->tim_levitation) | |
4690 | - { | |
4691 | - p_ptr->levitation = TRUE; | |
4692 | - } | |
4693 | - | |
4694 | - /* Temporary reflection */ | |
4695 | - if (p_ptr->tim_reflect) | |
4696 | - { | |
4697 | - p_ptr->reflect = TRUE; | |
4698 | - } | |
4699 | - | |
4700 | - /* Hack -- Hero/Shero -> Res fear */ | |
4701 | - if (IS_HERO() || p_ptr->shero) | |
4702 | - { | |
4703 | - p_ptr->resist_fear = TRUE; | |
4704 | - } | |
4705 | - | |
4706 | - | |
4707 | - /* Hack -- Telepathy Change */ | |
4708 | - if (p_ptr->telepathy != old_telepathy) | |
4709 | - { | |
4710 | - p_ptr->update |= (PU_MONSTERS); | |
4711 | - } | |
4712 | - | |
4713 | - if ((p_ptr->esp_animal != old_esp_animal) || | |
4714 | - (p_ptr->esp_undead != old_esp_undead) || | |
4715 | - (p_ptr->esp_demon != old_esp_demon) || | |
4716 | - (p_ptr->esp_orc != old_esp_orc) || | |
4717 | - (p_ptr->esp_troll != old_esp_troll) || | |
4718 | - (p_ptr->esp_giant != old_esp_giant) || | |
4719 | - (p_ptr->esp_dragon != old_esp_dragon) || | |
4720 | - (p_ptr->esp_human != old_esp_human) || | |
4721 | - (p_ptr->esp_evil != old_esp_evil) || | |
4722 | - (p_ptr->esp_good != old_esp_good) || | |
4723 | - (p_ptr->esp_nonliving != old_esp_nonliving) || | |
4724 | - (p_ptr->esp_unique != old_esp_unique)) | |
4725 | - { | |
4726 | - p_ptr->update |= (PU_MONSTERS); | |
4727 | - } | |
4728 | - | |
4729 | - /* Hack -- See Invis Change */ | |
4730 | - if (p_ptr->see_inv != old_see_inv) | |
4731 | - { | |
4732 | - p_ptr->update |= (PU_MONSTERS); | |
4733 | - } | |
4734 | - | |
4735 | - /* Bloating slows the player down (a little) */ | |
4736 | - if (p_ptr->food >= PY_FOOD_MAX) new_speed -= 10; | |
4737 | - | |
4738 | - if (p_ptr->special_defense & KAMAE_SUZAKU) new_speed += 10; | |
4739 | - | |
4740 | - if ((p_ptr->migite && (empty_hands_status & EMPTY_HAND_RARM)) || | |
4741 | - (p_ptr->hidarite && (empty_hands_status & EMPTY_HAND_LARM))) | |
4742 | - { | |
4743 | - p_ptr->to_h[default_hand] += (p_ptr->skill_exp[GINOU_SUDE] - WEAPON_EXP_BEGINNER) / 200; | |
4744 | - p_ptr->dis_to_h[default_hand] += (p_ptr->skill_exp[GINOU_SUDE] - WEAPON_EXP_BEGINNER) / 200; | |
4745 | - } | |
4746 | - | |
4747 | - if (buki_motteruka(INVEN_RARM) && buki_motteruka(INVEN_LARM)) | |
4748 | - { | |
4749 | - int penalty1, penalty2; | |
4750 | - penalty1 = ((100 - p_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - inventory[INVEN_RARM].weight) / 8); | |
4751 | - penalty2 = ((100 - p_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - inventory[INVEN_LARM].weight) / 8); | |
4752 | - if ((inventory[INVEN_RARM].name1 == ART_QUICKTHORN) && (inventory[INVEN_LARM].name1 == ART_TINYTHORN)) | |
4753 | - { | |
4754 | - penalty1 = penalty1 / 2 - 5; | |
4755 | - penalty2 = penalty2 / 2 - 5; | |
4756 | - new_speed += 7; | |
4757 | - p_ptr->to_a += 10; | |
4758 | - p_ptr->dis_to_a += 10; | |
4759 | - } | |
4760 | - if (easy_2weapon) | |
4761 | - { | |
4762 | - if (penalty1 > 0) penalty1 /= 2; | |
4763 | - if (penalty2 > 0) penalty2 /= 2; | |
4764 | - } | |
4765 | - else if ((inventory[INVEN_LARM].tval == TV_SWORD) && ((inventory[INVEN_LARM].sval == SV_MAIN_GAUCHE) || (inventory[INVEN_LARM].sval == SV_WAKIZASHI))) | |
4766 | - { | |
4767 | - penalty1 = MAX(0, penalty1 - 10); | |
4768 | - penalty2 = MAX(0, penalty2 - 10); | |
4769 | - } | |
4770 | - if ((inventory[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (inventory[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI)) | |
4771 | - { | |
4772 | - penalty1 = MIN(0, penalty1); | |
4773 | - penalty2 = MIN(0, penalty2); | |
4774 | - p_ptr->to_a += 10; | |
4775 | - p_ptr->dis_to_a += 10; | |
4776 | - } | |
4777 | - else | |
4778 | - { | |
4779 | - if ((inventory[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (penalty1 > 0)) | |
4780 | - penalty1 /= 2; | |
4781 | - if ((inventory[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI) && (penalty2 > 0)) | |
4782 | - penalty2 /= 2; | |
4783 | - } | |
4784 | - if (inventory[INVEN_RARM].tval == TV_POLEARM) penalty1 += 10; | |
4785 | - if (inventory[INVEN_LARM].tval == TV_POLEARM) penalty2 += 10; | |
4786 | - p_ptr->to_h[0] -= (s16b)penalty1; | |
4787 | - p_ptr->to_h[1] -= (s16b)penalty2; | |
4788 | - p_ptr->dis_to_h[0] -= (s16b)penalty1; | |
4789 | - p_ptr->dis_to_h[1] -= (s16b)penalty2; | |
4790 | - } | |
4791 | - | |
4792 | - /* Extract the current weight (in tenth pounds) */ | |
4793 | - j = p_ptr->total_weight; | |
4794 | - | |
4795 | - if (!p_ptr->riding) | |
4796 | - { | |
4797 | - /* Extract the "weight limit" (in tenth pounds) */ | |
4798 | - i = (int)weight_limit(); | |
4799 | - } | |
4800 | - else | |
4801 | - { | |
4802 | - monster_type *riding_m_ptr = &m_list[p_ptr->riding]; | |
4803 | - monster_race *riding_r_ptr = &r_info[riding_m_ptr->r_idx]; | |
4804 | - SPEED speed = riding_m_ptr->mspeed; | |
4805 | - | |
4806 | - if (riding_m_ptr->mspeed > 110) | |
4807 | - { | |
4808 | - new_speed = 110 + (s16b)((speed - 110) * (p_ptr->skill_exp[GINOU_RIDING] * 3 + p_ptr->lev * 160L - 10000L) / (22000L)); | |
4809 | - if (new_speed < 110) new_speed = 110; | |
4810 | - } | |
4811 | - else | |
4812 | - { | |
4813 | - new_speed = speed; | |
4814 | - } | |
4815 | - new_speed += (p_ptr->skill_exp[GINOU_RIDING] + p_ptr->lev *160L)/3200; | |
4816 | - if (MON_FAST(riding_m_ptr)) new_speed += 10; | |
4817 | - if (MON_SLOW(riding_m_ptr)) new_speed -= 10; | |
4818 | - riding_levitation = (riding_r_ptr->flags7 & RF7_CAN_FLY) ? TRUE : FALSE; | |
4819 | - if (riding_r_ptr->flags7 & (RF7_CAN_SWIM | RF7_AQUATIC)) p_ptr->can_swim = TRUE; | |
4820 | - | |
4821 | - if (!(riding_r_ptr->flags2 & RF2_PASS_WALL)) p_ptr->pass_wall = FALSE; | |
4822 | - if (riding_r_ptr->flags2 & RF2_KILL_WALL) p_ptr->kill_wall = TRUE; | |
4823 | - | |
4824 | - if (p_ptr->skill_exp[GINOU_RIDING] < RIDING_EXP_SKILLED) j += (p_ptr->wt * 3 * (RIDING_EXP_SKILLED - p_ptr->skill_exp[GINOU_RIDING])) / RIDING_EXP_SKILLED; | |
4825 | - | |
4826 | - /* Extract the "weight limit" */ | |
4827 | - i = 1500 + riding_r_ptr->level * 25; | |
4828 | - } | |
4829 | - | |
4830 | - /* Apply "encumbrance" from weight */ | |
4831 | - if (j > i) new_speed -= ((j - i) / (i / 5)); | |
4832 | - | |
4833 | - /* Searching slows the player down */ | |
4834 | - if (p_ptr->action == ACTION_SEARCH) new_speed -= 10; | |
4835 | - | |
4836 | - /* Feature bonus */ | |
4837 | - if(p_ptr->prace == RACE_MERFOLK) | |
4838 | - { | |
4839 | - if (have_flag(f_ptr->flags, FF_WATER)) | |
4840 | - { | |
4841 | - new_speed += (2 + p_ptr->lev / 10); | |
4842 | - } | |
4843 | - else if (!p_ptr->levitation) | |
4844 | - { | |
4845 | - new_speed -= 2; | |
4846 | - } | |
4847 | - } | |
4848 | - | |
4849 | - | |
4850 | - /* Actual Modifier Bonuses (Un-inflate stat bonuses) */ | |
4851 | - p_ptr->to_a += ((int)(adj_dex_ta[p_ptr->stat_ind[A_DEX]]) - 128); | |
4852 | - p_ptr->to_d[0] += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128); | |
4853 | - p_ptr->to_d[1] += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128); | |
4854 | - p_ptr->to_d_m += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128); | |
4855 | - p_ptr->to_h[0] += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128); | |
4856 | - p_ptr->to_h[1] += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128); | |
4857 | - p_ptr->to_h_b += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128); | |
4858 | - p_ptr->to_h_m += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128); | |
4859 | - p_ptr->to_h[0] += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128); | |
4860 | - p_ptr->to_h[1] += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128); | |
4861 | - p_ptr->to_h_b += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128); | |
4862 | - p_ptr->to_h_m += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128); | |
4863 | - | |
4864 | - /* Displayed Modifier Bonuses (Un-inflate stat bonuses) */ | |
4865 | - p_ptr->dis_to_a += ((int)(adj_dex_ta[p_ptr->stat_ind[A_DEX]]) - 128); | |
4866 | - p_ptr->dis_to_d[0] += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128); | |
4867 | - p_ptr->dis_to_d[1] += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128); | |
4868 | - p_ptr->dis_to_h[0] += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128); | |
4869 | - p_ptr->dis_to_h[1] += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128); | |
4870 | - p_ptr->dis_to_h_b += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128); | |
4871 | - p_ptr->dis_to_h[0] += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128); | |
4872 | - p_ptr->dis_to_h[1] += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128); | |
4873 | - p_ptr->dis_to_h_b += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128); | |
4874 | - | |
4875 | - | |
4876 | - /* Obtain the "hold" value */ | |
4877 | - hold = adj_str_hold[p_ptr->stat_ind[A_STR]]; | |
4878 | - | |
4879 | - | |
4880 | - /* Examine the "current bow" */ | |
4881 | - o_ptr = &inventory[INVEN_BOW]; | |
4882 | - | |
4883 | - /* It is hard to carholdry a heavy bow */ | |
4884 | - p_ptr->heavy_shoot = is_heavy_shoot(o_ptr); | |
4885 | - if (p_ptr->heavy_shoot) | |
4886 | - { | |
4887 | - /* Hard to wield a heavy bow */ | |
4888 | - p_ptr->to_h_b += 2 * (hold - o_ptr->weight / 10); | |
4889 | - p_ptr->dis_to_h_b += 2 * (hold - o_ptr->weight / 10); | |
4890 | - } | |
4891 | - | |
4892 | - /* Compute "extra shots" if needed */ | |
4893 | - if (o_ptr->k_idx) | |
4894 | - { | |
4895 | - p_ptr->tval_ammo = (byte_hack)bow_tval_ammo(o_ptr); | |
4896 | - | |
4897 | - /* Apply special flags */ | |
4898 | - if (o_ptr->k_idx && !p_ptr->heavy_shoot) | |
4899 | - { | |
4900 | - /* Extra shots */ | |
4901 | - p_ptr->num_fire = calc_num_fire(o_ptr); | |
4902 | - | |
4903 | - /* Snipers love Cross bows */ | |
4904 | - if ((p_ptr->pclass == CLASS_SNIPER) && | |
4905 | - (p_ptr->tval_ammo == TV_BOLT)) | |
4906 | - { | |
4907 | - p_ptr->to_h_b += (10 + (p_ptr->lev / 5)); | |
4908 | - p_ptr->dis_to_h_b += (10 + (p_ptr->lev / 5)); | |
4909 | - } | |
4910 | - } | |
4911 | - } | |
4912 | - | |
4913 | - if (p_ptr->ryoute) hold *= 2; | |
4914 | - | |
4915 | - for(i = 0 ; i < 2 ; i++) | |
4916 | - { | |
4917 | - /* Examine the "main weapon" */ | |
4918 | - o_ptr = &inventory[INVEN_RARM+i]; | |
4919 | - | |
4920 | - object_flags(o_ptr, flgs); | |
4921 | - | |
4922 | - /* Assume not heavy */ | |
4923 | - p_ptr->heavy_wield[i] = FALSE; | |
4924 | - p_ptr->icky_wield[i] = FALSE; | |
4925 | - p_ptr->riding_wield[i] = FALSE; | |
4926 | - | |
4927 | - if (!buki_motteruka(INVEN_RARM+i)) | |
4928 | - { | |
4929 | - p_ptr->num_blow[i] = 1; | |
4930 | - continue; | |
4931 | - } | |
4932 | - /* It is hard to hold a heavy weapon */ | |
4933 | - if (hold < o_ptr->weight / 10) | |
4934 | - { | |
4935 | - /* Hard to wield a heavy weapon */ | |
4936 | - p_ptr->to_h[i] += 2 * (hold - o_ptr->weight / 10); | |
4937 | - p_ptr->dis_to_h[i] += 2 * (hold - o_ptr->weight / 10); | |
4938 | - | |
4939 | - /* Heavy weapon */ | |
4940 | - p_ptr->heavy_wield[i] = TRUE; | |
4941 | - } | |
4942 | - else if (p_ptr->ryoute && (hold < o_ptr->weight/5)) omoi = TRUE; | |
4943 | - | |
4944 | - if ((i == 1) && (o_ptr->tval == TV_SWORD) && ((o_ptr->sval == SV_MAIN_GAUCHE) || (o_ptr->sval == SV_WAKIZASHI))) | |
4945 | - { | |
4946 | - p_ptr->to_a += 5; | |
4947 | - p_ptr->dis_to_a += 5; | |
4948 | - } | |
4949 | - | |
4950 | - /* Normal weapons */ | |
4951 | - if (o_ptr->k_idx && !p_ptr->heavy_wield[i]) | |
4952 | - { | |
4953 | - int str_index, dex_index; | |
4954 | - | |
4955 | - int num = 0, wgt = 0, mul = 0, div = 0; | |
4956 | - | |
4957 | - /* Analyze the class */ | |
4958 | - switch (p_ptr->pclass) | |
4959 | - { | |
4960 | - /* Warrior */ | |
4961 | - case CLASS_WARRIOR: | |
4962 | - num = 6; wgt = 70; mul = 5; break; | |
4963 | - | |
4964 | - /* Berserker */ | |
4965 | - case CLASS_BERSERKER: | |
4966 | - num = 6; wgt = 70; mul = 7; break; | |
4967 | - | |
4968 | - /* Mage */ | |
4969 | - case CLASS_MAGE: | |
4970 | - case CLASS_HIGH_MAGE: | |
4971 | - case CLASS_BLUE_MAGE: | |
4972 | - num = 3; wgt = 100; mul = 2; break; | |
4973 | - | |
4974 | - /* Priest, Mindcrafter, Magic-Eater */ | |
4975 | - case CLASS_PRIEST: | |
4976 | - case CLASS_MAGIC_EATER: | |
4977 | - case CLASS_MINDCRAFTER: | |
4978 | - num = 5; wgt = 100; mul = 3; break; | |
4979 | - | |
4980 | - /* Rogue */ | |
4981 | - case CLASS_ROGUE: | |
4982 | - num = 5; wgt = 40; mul = 3; break; | |
4983 | - | |
4984 | - /* Ranger */ | |
4985 | - case CLASS_RANGER: | |
4986 | - num = 5; wgt = 70; mul = 4; break; | |
4987 | - | |
4988 | - /* Paladin */ | |
4989 | - case CLASS_PALADIN: | |
4990 | - case CLASS_SAMURAI: | |
4991 | - num = 5; wgt = 70; mul = 4; break; | |
4992 | - | |
4993 | - /* Weaponsmith */ | |
4994 | - case CLASS_SMITH: | |
4995 | - num = 5; wgt = 150; mul = 5; break; | |
4996 | - | |
4997 | - /* Warrior-Mage */ | |
4998 | - case CLASS_WARRIOR_MAGE: | |
4999 | - case CLASS_RED_MAGE: | |
5000 | - num = 5; wgt = 70; mul = 3; break; | |
5001 | - | |
5002 | - /* Chaos Warrior */ | |
5003 | - case CLASS_CHAOS_WARRIOR: | |
5004 | - num = 5; wgt = 70; mul = 4; break; | |
5005 | - | |
5006 | - /* Monk */ | |
5007 | - case CLASS_MONK: | |
5008 | - num = 5; wgt = 60; mul = 3; break; | |
5009 | - | |
5010 | - /* Tourist */ | |
5011 | - case CLASS_TOURIST: | |
5012 | - num = 4; wgt = 100; mul = 3; break; | |
5013 | - | |
5014 | - /* Imitator */ | |
5015 | - case CLASS_IMITATOR: | |
5016 | - num = 5; wgt = 70; mul = 4; break; | |
5017 | - | |
5018 | - /* Beastmaster */ | |
5019 | - case CLASS_BEASTMASTER: | |
5020 | - num = 5; wgt = 70; mul = 3; break; | |
5021 | - | |
5022 | - /* Cavalry */ | |
5023 | - case CLASS_CAVALRY: | |
5024 | - if ((p_ptr->riding) && (have_flag(flgs, TR_RIDING))) {num = 5; wgt = 70; mul = 4;} | |
5025 | - else {num = 5; wgt = 100; mul = 3;} | |
5026 | - break; | |
5027 | - | |
5028 | - /* Sorcerer */ | |
5029 | - case CLASS_SORCERER: | |
5030 | - num = 1; wgt = 1; mul = 1; break; | |
5031 | - | |
5032 | - /* Archer, Bard, Sniper */ | |
5033 | - case CLASS_ARCHER: | |
5034 | - case CLASS_BARD: | |
5035 | - case CLASS_SNIPER: | |
5036 | - num = 4; wgt = 70; mul = 2; break; | |
5037 | - | |
5038 | - /* ForceTrainer */ | |
5039 | - case CLASS_FORCETRAINER: | |
5040 | - num = 4; wgt = 60; mul = 2; break; | |
5041 | - | |
5042 | - /* Mirror Master */ | |
5043 | - case CLASS_MIRROR_MASTER: | |
5044 | - num = 3; wgt = 100; mul = 3; break; | |
5045 | - | |
5046 | - /* Ninja */ | |
5047 | - case CLASS_NINJA: | |
5048 | - num = 4; wgt = 20; mul = 1; break; | |
5049 | - } | |
5050 | - | |
5051 | - /* Hex - extra mights gives +1 bonus to max blows */ | |
5052 | - if (hex_spelling(HEX_XTRA_MIGHT) || hex_spelling(HEX_BUILDING)) { num++; wgt /= 2; mul += 2; } | |
5053 | - | |
5054 | - /* Enforce a minimum "weight" (tenth pounds) */ | |
5055 | - div = ((o_ptr->weight < wgt) ? wgt : o_ptr->weight); | |
5056 | - | |
5057 | - /* Access the strength vs weight */ | |
5058 | - str_index = (adj_str_blow[p_ptr->stat_ind[A_STR]] * mul / div); | |
5059 | - | |
5060 | - if (p_ptr->ryoute && !omoi) str_index++; | |
5061 | - if (p_ptr->pclass == CLASS_NINJA) str_index = MAX(0, str_index-1); | |
5062 | - | |
5063 | - /* Maximal value */ | |
5064 | - if (str_index > 11) str_index = 11; | |
5065 | - | |
5066 | - /* Index by dexterity */ | |
5067 | - dex_index = (adj_dex_blow[p_ptr->stat_ind[A_DEX]]); | |
5068 | - | |
5069 | - /* Maximal value */ | |
5070 | - if (dex_index > 11) dex_index = 11; | |
5071 | - | |
5072 | - /* Use the blows table */ | |
5073 | - p_ptr->num_blow[i] = blows_table[str_index][dex_index]; | |
5074 | - | |
5075 | - /* Maximal value */ | |
5076 | - if (p_ptr->num_blow[i] > num) p_ptr->num_blow[i] = (s16b)num; | |
5077 | - | |
5078 | - /* Add in the "bonus blows" */ | |
5079 | - p_ptr->num_blow[i] += (s16b)extra_blows[i]; | |
5080 | - | |
5081 | - | |
5082 | - if (p_ptr->pclass == CLASS_WARRIOR) p_ptr->num_blow[i] += (p_ptr->lev / 40); | |
5083 | - else if (p_ptr->pclass == CLASS_BERSERKER) | |
5084 | - { | |
5085 | - p_ptr->num_blow[i] += (p_ptr->lev / 23); | |
5086 | - } | |
5087 | - else if ((p_ptr->pclass == CLASS_ROGUE) && (o_ptr->weight < 50) && (p_ptr->stat_ind[A_DEX] >= 30)) p_ptr->num_blow[i] ++; | |
5088 | - | |
5089 | - if (p_ptr->special_defense & KATA_FUUJIN) p_ptr->num_blow[i] -= 1; | |
5090 | - | |
5091 | - if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) p_ptr->num_blow[i] = 1; | |
5092 | - | |
5093 | - | |
5094 | - /* Require at least one blow */ | |
5095 | - if (p_ptr->num_blow[i] < 1) p_ptr->num_blow[i] = 1; | |
5096 | - | |
5097 | - /* Boost digging skill by weapon weight */ | |
5098 | - p_ptr->skill_dig += (o_ptr->weight / 10); | |
5099 | - } | |
5100 | - | |
5101 | - /* Assume okay */ | |
5102 | - /* Priest weapon penalty for non-blessed edged weapons */ | |
5103 | - if ((p_ptr->pclass == CLASS_PRIEST) && (!(have_flag(flgs, TR_BLESSED))) && | |
5104 | - ((o_ptr->tval == TV_SWORD) || (o_ptr->tval == TV_POLEARM))) | |
5105 | - { | |
5106 | - /* Reduce the real bonuses */ | |
5107 | - p_ptr->to_h[i] -= 2; | |
5108 | - p_ptr->to_d[i] -= 2; | |
5109 | - | |
5110 | - /* Reduce the mental bonuses */ | |
5111 | - p_ptr->dis_to_h[i] -= 2; | |
5112 | - p_ptr->dis_to_d[i] -= 2; | |
5113 | - | |
5114 | - /* Icky weapon */ | |
5115 | - p_ptr->icky_wield[i] = TRUE; | |
5116 | - } | |
5117 | - else if (p_ptr->pclass == CLASS_BERSERKER) | |
5118 | - { | |
5119 | - p_ptr->to_h[i] += p_ptr->lev/5; | |
5120 | - p_ptr->to_d[i] += p_ptr->lev/6; | |
5121 | - p_ptr->dis_to_h[i] += p_ptr->lev/5; | |
5122 | - p_ptr->dis_to_d[i] += p_ptr->lev/6; | |
5123 | - if (((i == 0) && !p_ptr->hidarite) || p_ptr->ryoute) | |
5124 | - { | |
5125 | - p_ptr->to_h[i] += p_ptr->lev/5; | |
5126 | - p_ptr->to_d[i] += p_ptr->lev/6; | |
5127 | - p_ptr->dis_to_h[i] += p_ptr->lev/5; | |
5128 | - p_ptr->dis_to_d[i] += p_ptr->lev/6; | |
5129 | - } | |
5130 | - } | |
5131 | - else if (p_ptr->pclass == CLASS_SORCERER) | |
5132 | - { | |
5133 | - if (!((o_ptr->tval == TV_HAFTED) && ((o_ptr->sval == SV_WIZSTAFF) || (o_ptr->sval == SV_NAMAKE_HAMMER)))) | |
5134 | - { | |
5135 | - /* Reduce the real bonuses */ | |
5136 | - p_ptr->to_h[i] -= 200; | |
5137 | - p_ptr->to_d[i] -= 200; | |
5138 | - | |
5139 | - /* Reduce the mental bonuses */ | |
5140 | - p_ptr->dis_to_h[i] -= 200; | |
5141 | - p_ptr->dis_to_d[i] -= 200; | |
5142 | - | |
5143 | - /* Icky weapon */ | |
5144 | - p_ptr->icky_wield[i] = TRUE; | |
5145 | - } | |
5146 | - else | |
5147 | - { | |
5148 | - /* Reduce the real bonuses */ | |
5149 | - p_ptr->to_h[i] -= 30; | |
5150 | - p_ptr->to_d[i] -= 10; | |
5151 | - | |
5152 | - /* Reduce the mental bonuses */ | |
5153 | - p_ptr->dis_to_h[i] -= 30; | |
5154 | - p_ptr->dis_to_d[i] -= 10; | |
5155 | - } | |
5156 | - } | |
5157 | - /* Hex bonuses */ | |
5158 | - if (p_ptr->realm1 == REALM_HEX) | |
5159 | - { | |
5160 | - if (object_is_cursed(o_ptr)) | |
5161 | - { | |
5162 | - if (o_ptr->curse_flags & (TRC_CURSED)) { p_ptr->to_h[i] += 5; p_ptr->dis_to_h[i] += 5; } | |
5163 | - if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) { p_ptr->to_h[i] += 7; p_ptr->dis_to_h[i] += 7; } | |
5164 | - if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) { p_ptr->to_h[i] += 13; p_ptr->dis_to_h[i] += 13; } | |
5165 | - if (o_ptr->curse_flags & (TRC_TY_CURSE)) { p_ptr->to_h[i] += 5; p_ptr->dis_to_h[i] += 5; } | |
5166 | - if (hex_spelling(HEX_RUNESWORD)) | |
5167 | - { | |
5168 | - if (o_ptr->curse_flags & (TRC_CURSED)) { p_ptr->to_d[i] += 5; p_ptr->dis_to_d[i] += 5; } | |
5169 | - if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) { p_ptr->to_d[i] += 7; p_ptr->dis_to_d[i] += 7; } | |
5170 | - if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) { p_ptr->to_d[i] += 13; p_ptr->dis_to_d[i] += 13; } | |
5171 | - } | |
5172 | - } | |
5173 | - } | |
5174 | - if (p_ptr->riding) | |
5175 | - { | |
5176 | - if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE))) | |
5177 | - { | |
5178 | - p_ptr->to_h[i] +=15; | |
5179 | - p_ptr->dis_to_h[i] +=15; | |
5180 | - p_ptr->to_dd[i] += 2; | |
5181 | - } | |
5182 | - else if (!(have_flag(flgs, TR_RIDING))) | |
5183 | - { | |
5184 | - int penalty; | |
5185 | - if ((p_ptr->pclass == CLASS_BEASTMASTER) || (p_ptr->pclass == CLASS_CAVALRY)) | |
5186 | - { | |
5187 | - penalty = 5; | |
5188 | - } | |
5189 | - else | |
5190 | - { | |
5191 | - penalty = r_info[m_list[p_ptr->riding].r_idx].level - p_ptr->skill_exp[GINOU_RIDING] / 80; | |
5192 | - penalty += 30; | |
5193 | - if (penalty < 30) penalty = 30; | |
5194 | - } | |
5195 | - p_ptr->to_h[i] -= (s16b)penalty; | |
5196 | - p_ptr->dis_to_h[i] -= (s16b)penalty; | |
5197 | - | |
5198 | - /* Riding weapon */ | |
5199 | - p_ptr->riding_wield[i] = TRUE; | |
5200 | - } | |
5201 | - } | |
5202 | - } | |
5203 | - | |
5204 | - if (p_ptr->riding) | |
5205 | - { | |
5206 | - int penalty = 0; | |
5207 | - | |
5208 | - p_ptr->riding_ryoute = FALSE; | |
5209 | - | |
5210 | - if (p_ptr->ryoute || (empty_hands(FALSE) == EMPTY_HAND_NONE)) p_ptr->riding_ryoute = TRUE; | |
5211 | - else if (p_ptr->pet_extra_flags & PF_RYOUTE) | |
5212 | - { | |
5213 | - switch (p_ptr->pclass) | |
5214 | - { | |
5215 | - case CLASS_MONK: | |
5216 | - case CLASS_FORCETRAINER: | |
5217 | - case CLASS_BERSERKER: | |
5218 | - if ((empty_hands(FALSE) != EMPTY_HAND_NONE) && !buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM)) | |
5219 | - p_ptr->riding_ryoute = TRUE; | |
5220 | - break; | |
5221 | - } | |
5222 | - } | |
5223 | - | |
5224 | - if ((p_ptr->pclass == CLASS_BEASTMASTER) || (p_ptr->pclass == CLASS_CAVALRY)) | |
5225 | - { | |
5226 | - if (p_ptr->tval_ammo != TV_ARROW) penalty = 5; | |
5227 | - } | |
5228 | - else | |
5229 | - { | |
5230 | - penalty = r_info[m_list[p_ptr->riding].r_idx].level - p_ptr->skill_exp[GINOU_RIDING] / 80; | |
5231 | - penalty += 30; | |
5232 | - if (penalty < 30) penalty = 30; | |
5233 | - } | |
5234 | - if (p_ptr->tval_ammo == TV_BOLT) penalty *= 2; | |
5235 | - p_ptr->to_h_b -= (s16b)penalty; | |
5236 | - p_ptr->dis_to_h_b -= (s16b)penalty; | |
5237 | - } | |
5238 | - | |
5239 | - /* Different calculation for monks with empty hands */ | |
5240 | - if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_BERSERKER)) && | |
5241 | - (empty_hands_status & EMPTY_HAND_RARM) && !p_ptr->hidarite) | |
5242 | - { | |
5243 | - int blow_base = p_ptr->lev + adj_dex_blow[p_ptr->stat_ind[A_DEX]]; | |
5244 | - p_ptr->num_blow[0] = 0; | |
5245 | - | |
5246 | - if (p_ptr->pclass == CLASS_FORCETRAINER) | |
5247 | - { | |
5248 | - if (blow_base > 18) p_ptr->num_blow[0]++; | |
5249 | - if (blow_base > 31) p_ptr->num_blow[0]++; | |
5250 | - if (blow_base > 44) p_ptr->num_blow[0]++; | |
5251 | - if (blow_base > 58) p_ptr->num_blow[0]++; | |
5252 | - if (P_PTR_KI) | |
5253 | - { | |
5254 | - p_ptr->to_d[0] += P_PTR_KI / 5; | |
5255 | - p_ptr->dis_to_d[0] += P_PTR_KI / 5; | |
5256 | - } | |
5257 | - } | |
5258 | - else | |
5259 | - { | |
5260 | - if (blow_base > 12) p_ptr->num_blow[0]++; | |
5261 | - if (blow_base > 22) p_ptr->num_blow[0]++; | |
5262 | - if (blow_base > 31) p_ptr->num_blow[0]++; | |
5263 | - if (blow_base > 39) p_ptr->num_blow[0]++; | |
5264 | - if (blow_base > 46) p_ptr->num_blow[0]++; | |
5265 | - if (blow_base > 53) p_ptr->num_blow[0]++; | |
5266 | - if (blow_base > 59) p_ptr->num_blow[0]++; | |
5267 | - } | |
5268 | - | |
5269 | - if (heavy_armor() && (p_ptr->pclass != CLASS_BERSERKER)) | |
5270 | - p_ptr->num_blow[0] /= 2; | |
5271 | - else | |
5272 | - { | |
5273 | - p_ptr->to_h[0] += (p_ptr->lev / 3); | |
5274 | - p_ptr->dis_to_h[0] += (p_ptr->lev / 3); | |
5275 | - | |
5276 | - p_ptr->to_d[0] += (p_ptr->lev / 6); | |
5277 | - p_ptr->dis_to_d[0] += (p_ptr->lev / 6); | |
5278 | - } | |
5279 | - | |
5280 | - if (p_ptr->special_defense & KAMAE_BYAKKO) | |
5281 | - { | |
5282 | - p_ptr->to_a -= 40; | |
5283 | - p_ptr->dis_to_a -= 40; | |
5284 | - | |
5285 | - } | |
5286 | - else if (p_ptr->special_defense & KAMAE_SEIRYU) | |
5287 | - { | |
5288 | - p_ptr->to_a -= 50; | |
5289 | - p_ptr->dis_to_a -= 50; | |
5290 | - p_ptr->resist_acid = TRUE; | |
5291 | - p_ptr->resist_fire = TRUE; | |
5292 | - p_ptr->resist_elec = TRUE; | |
5293 | - p_ptr->resist_cold = TRUE; | |
5294 | - p_ptr->resist_pois = TRUE; | |
5295 | - p_ptr->sh_fire = TRUE; | |
5296 | - p_ptr->sh_elec = TRUE; | |
5297 | - p_ptr->sh_cold = TRUE; | |
5298 | - p_ptr->levitation = TRUE; | |
5299 | - } | |
5300 | - else if (p_ptr->special_defense & KAMAE_GENBU) | |
5301 | - { | |
5302 | - p_ptr->to_a += (p_ptr->lev*p_ptr->lev)/50; | |
5303 | - p_ptr->dis_to_a += (p_ptr->lev*p_ptr->lev)/50; | |
5304 | - p_ptr->reflect = TRUE; | |
5305 | - p_ptr->num_blow[0] -= 2; | |
5306 | - if ((p_ptr->pclass == CLASS_MONK) && (p_ptr->lev > 42)) p_ptr->num_blow[0]--; | |
5307 | - if (p_ptr->num_blow[0] < 0) p_ptr->num_blow[0] = 0; | |
5308 | - } | |
5309 | - else if (p_ptr->special_defense & KAMAE_SUZAKU) | |
5310 | - { | |
5311 | - p_ptr->to_h[0] -= (p_ptr->lev / 3); | |
5312 | - p_ptr->to_d[0] -= (p_ptr->lev / 6); | |
5313 | - | |
5314 | - p_ptr->dis_to_h[0] -= (p_ptr->lev / 3); | |
5315 | - p_ptr->dis_to_d[0] -= (p_ptr->lev / 6); | |
5316 | - p_ptr->num_blow[0] /= 2; | |
5317 | - p_ptr->levitation = TRUE; | |
5318 | - } | |
5319 | - | |
5320 | - p_ptr->num_blow[0] += 1+extra_blows[0]; | |
5321 | - } | |
5322 | - | |
5323 | - if (p_ptr->riding) p_ptr->levitation = riding_levitation; | |
5324 | - | |
5325 | - monk_armour_aux = FALSE; | |
5326 | - | |
5327 | - if (heavy_armor()) | |
5328 | - { | |
5329 | - monk_armour_aux = TRUE; | |
5330 | - } | |
5331 | - | |
5332 | - for (i = 0; i < 2; i++) | |
5333 | - { | |
5334 | - if (buki_motteruka(INVEN_RARM+i)) | |
5335 | - { | |
5336 | - OBJECT_TYPE_VALUE tval = inventory[INVEN_RARM+i].tval - TV_WEAPON_BEGIN; | |
5337 | - OBJECT_SUBTYPE_VALUE sval = inventory[INVEN_RARM+i].sval; | |
5338 | - | |
5339 | - p_ptr->to_h[i] += (p_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200; | |
5340 | - p_ptr->dis_to_h[i] += (p_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200; | |
5341 | - if ((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER)) | |
5342 | - { | |
5343 | - if (!s_info[p_ptr->pclass].w_max[tval][sval]) | |
5344 | - { | |
5345 | - p_ptr->to_h[i] -= 40; | |
5346 | - p_ptr->dis_to_h[i] -= 40; | |
5347 | - p_ptr->icky_wield[i] = TRUE; | |
5348 | - } | |
5349 | - } | |
5350 | - else if (p_ptr->pclass == CLASS_NINJA) | |
5351 | - { | |
5352 | - if ((s_info[CLASS_NINJA].w_max[tval][sval] <= WEAPON_EXP_BEGINNER) || (inventory[INVEN_LARM-i].tval == TV_SHIELD)) | |
5353 | - { | |
5354 | - p_ptr->to_h[i] -= 40; | |
5355 | - p_ptr->dis_to_h[i] -= 40; | |
5356 | - p_ptr->icky_wield[i] = TRUE; | |
5357 | - p_ptr->num_blow[i] /= 2; | |
5358 | - if (p_ptr->num_blow[i] < 1) p_ptr->num_blow[i] = 1; | |
5359 | - } | |
5360 | - } | |
5361 | - | |
5362 | - if (inventory[INVEN_RARM + i].name1 == ART_IRON_BALL) p_ptr->align -= 1000; | |
5363 | - } | |
5364 | - } | |
5365 | - | |
5366 | - /* Maximum speed is (+99). (internally it's 110 + 99) */ | |
5367 | - /* Temporary lightspeed forces to be maximum speed */ | |
5368 | - if ((p_ptr->lightspeed && !p_ptr->riding) || (new_speed > 209)) | |
5369 | - { | |
5370 | - new_speed = 209; | |
5371 | - } | |
5372 | - | |
5373 | - /* Minimum speed is (-99). (internally it's 110 - 99) */ | |
5374 | - if (new_speed < 11) new_speed = 11; | |
5375 | - | |
5376 | - /* Display the speed (if needed) */ | |
5377 | - if (p_ptr->pspeed != (byte)new_speed) | |
5378 | - { | |
5379 | - p_ptr->pspeed = (byte)new_speed; | |
5380 | - p_ptr->redraw |= (PR_SPEED); | |
5381 | - } | |
5382 | - | |
5383 | - if (yoiyami) | |
5384 | - { | |
5385 | - if (p_ptr->to_a > (0 - p_ptr->ac)) | |
5386 | - p_ptr->to_a = 0 - p_ptr->ac; | |
5387 | - if (p_ptr->dis_to_a > (0 - p_ptr->dis_ac)) | |
5388 | - p_ptr->dis_to_a = 0 - p_ptr->dis_ac; | |
5389 | - } | |
5390 | - | |
5391 | - /* Redraw armor (if needed) */ | |
5392 | - if ((p_ptr->dis_ac != old_dis_ac) || (p_ptr->dis_to_a != old_dis_to_a)) | |
5393 | - { | |
5394 | - p_ptr->redraw |= (PR_ARMOR); | |
5395 | - p_ptr->window |= (PW_PLAYER); | |
5396 | - } | |
5397 | - | |
5398 | - if (p_ptr->ryoute && !omoi) | |
5399 | - { | |
5400 | - int bonus_to_h=0, bonus_to_d=0; | |
5401 | - bonus_to_d = ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128)/2; | |
5402 | - bonus_to_h = ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128) + ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128); | |
5403 | - | |
5404 | - p_ptr->to_h[default_hand] += MAX(bonus_to_h,1); | |
5405 | - p_ptr->dis_to_h[default_hand] += MAX(bonus_to_h,1); | |
5406 | - p_ptr->to_d[default_hand] += MAX(bonus_to_d,1); | |
5407 | - p_ptr->dis_to_d[default_hand] += MAX(bonus_to_d,1); | |
5408 | - } | |
5409 | - | |
5410 | - if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_BERSERKER)) && (empty_hands(FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM))) p_ptr->ryoute = FALSE; | |
5411 | - | |
5412 | - /* Affect Skill -- stealth (bonus one) */ | |
5413 | - p_ptr->skill_stl += 1; | |
5414 | - | |
5415 | - if (IS_TIM_STEALTH()) p_ptr->skill_stl += 99; | |
5416 | - | |
5417 | - /* Affect Skill -- disarming (DEX and INT) */ | |
5418 | - p_ptr->skill_dis += adj_dex_dis[p_ptr->stat_ind[A_DEX]]; | |
5419 | - p_ptr->skill_dis += adj_int_dis[p_ptr->stat_ind[A_INT]]; | |
5420 | - | |
5421 | - /* Affect Skill -- magic devices (INT) */ | |
5422 | - p_ptr->skill_dev += adj_int_dev[p_ptr->stat_ind[A_INT]]; | |
5423 | - | |
5424 | - /* Affect Skill -- saving throw (WIS) */ | |
5425 | - p_ptr->skill_sav += adj_wis_sav[p_ptr->stat_ind[A_WIS]]; | |
5426 | - | |
5427 | - /* Affect Skill -- digging (STR) */ | |
5428 | - p_ptr->skill_dig += adj_str_dig[p_ptr->stat_ind[A_STR]]; | |
5429 | - | |
5430 | - /* Affect Skill -- disarming (Level, by Class) */ | |
5431 | - p_ptr->skill_dis += ((cp_ptr->x_dis * p_ptr->lev / 10) + (ap_ptr->a_dis * p_ptr->lev / 50)); | |
5432 | - | |
5433 | - /* Affect Skill -- magic devices (Level, by Class) */ | |
5434 | - p_ptr->skill_dev += ((cp_ptr->x_dev * p_ptr->lev / 10) + (ap_ptr->a_dev * p_ptr->lev / 50)); | |
5435 | - | |
5436 | - /* Affect Skill -- saving throw (Level, by Class) */ | |
5437 | - p_ptr->skill_sav += ((cp_ptr->x_sav * p_ptr->lev / 10) + (ap_ptr->a_sav * p_ptr->lev / 50)); | |
5438 | - | |
5439 | - /* Affect Skill -- stealth (Level, by Class) */ | |
5440 | - p_ptr->skill_stl += (cp_ptr->x_stl * p_ptr->lev / 10); | |
5441 | - | |
5442 | - /* Affect Skill -- search ability (Level, by Class) */ | |
5443 | - p_ptr->skill_srh += (cp_ptr->x_srh * p_ptr->lev / 10); | |
5444 | - | |
5445 | - /* Affect Skill -- search frequency (Level, by Class) */ | |
5446 | - p_ptr->skill_fos += (cp_ptr->x_fos * p_ptr->lev / 10); | |
5447 | - | |
5448 | - /* Affect Skill -- combat (normal) (Level, by Class) */ | |
5449 | - p_ptr->skill_thn += ((cp_ptr->x_thn * p_ptr->lev / 10) + (ap_ptr->a_thn * p_ptr->lev / 50)); | |
5450 | - | |
5451 | - /* Affect Skill -- combat (shooting) (Level, by Class) */ | |
5452 | - p_ptr->skill_thb += ((cp_ptr->x_thb * p_ptr->lev / 10) + (ap_ptr->a_thb * p_ptr->lev / 50)); | |
5453 | - | |
5454 | - /* Affect Skill -- combat (throwing) (Level, by Class) */ | |
5455 | - p_ptr->skill_tht += ((cp_ptr->x_thb * p_ptr->lev / 10) + (ap_ptr->a_thb * p_ptr->lev / 50)); | |
5456 | - | |
5457 | - | |
5458 | - if ((prace_is_(RACE_S_FAIRY)) && (p_ptr->pseikaku != SEIKAKU_SEXY) && (p_ptr->cursed & TRC_AGGRAVATE)) | |
5459 | - { | |
5460 | - p_ptr->cursed &= ~(TRC_AGGRAVATE); | |
5461 | - p_ptr->skill_stl = MIN(p_ptr->skill_stl - 3, (p_ptr->skill_stl + 2) / 2); | |
5462 | - } | |
5463 | - | |
5464 | - /* Limit Skill -- stealth from 0 to 30 */ | |
5465 | - if (p_ptr->skill_stl > 30) p_ptr->skill_stl = 30; | |
5466 | - if (p_ptr->skill_stl < 0) p_ptr->skill_stl = 0; | |
5467 | - | |
5468 | - /* Limit Skill -- digging from 1 up */ | |
5469 | - if (p_ptr->skill_dig < 1) p_ptr->skill_dig = 1; | |
5470 | - | |
5471 | - if (p_ptr->anti_magic && (p_ptr->skill_sav < (90 + p_ptr->lev))) p_ptr->skill_sav = 90 + p_ptr->lev; | |
5472 | - | |
5473 | - if (p_ptr->tsubureru) p_ptr->skill_sav = 10; | |
5474 | - | |
5475 | - if ((p_ptr->ult_res || p_ptr->resist_magic || p_ptr->magicdef) && (p_ptr->skill_sav < (95 + p_ptr->lev))) p_ptr->skill_sav = 95 + p_ptr->lev; | |
5476 | - | |
5477 | - if (down_saving) p_ptr->skill_sav /= 2; | |
5478 | - | |
5479 | - /* Hack -- Each elemental immunity includes resistance */ | |
5480 | - if (p_ptr->immune_acid) p_ptr->resist_acid = TRUE; | |
5481 | - if (p_ptr->immune_elec) p_ptr->resist_elec = TRUE; | |
5482 | - if (p_ptr->immune_fire) p_ptr->resist_fire = TRUE; | |
5483 | - if (p_ptr->immune_cold) p_ptr->resist_cold = TRUE; | |
5484 | - | |
5485 | - /* Determine player alignment */ | |
5486 | - for (i = 0, j = 0; i < 8; i++) | |
5487 | - { | |
5488 | - switch (p_ptr->vir_types[i]) | |
5489 | - { | |
5490 | - case V_JUSTICE: | |
5491 | - p_ptr->align += p_ptr->virtues[i] * 2; | |
5492 | - break; | |
5493 | - case V_CHANCE: | |
5494 | - /* Do nothing */ | |
5495 | - break; | |
5496 | - case V_NATURE: | |
5497 | - case V_HARMONY: | |
5498 | - neutral[j++] = i; | |
5499 | - break; | |
5500 | - case V_UNLIFE: | |
5501 | - p_ptr->align -= p_ptr->virtues[i]; | |
5502 | - break; | |
5503 | - default: | |
5504 | - p_ptr->align += p_ptr->virtues[i]; | |
5505 | - break; | |
5506 | - } | |
5507 | - } | |
5508 | - | |
5509 | - for (i = 0; i < j; i++) | |
5510 | - { | |
5511 | - if (p_ptr->align > 0) | |
5512 | - { | |
5513 | - p_ptr->align -= p_ptr->virtues[neutral[i]] / 2; | |
5514 | - if (p_ptr->align < 0) p_ptr->align = 0; | |
5515 | - } | |
5516 | - else if (p_ptr->align < 0) | |
5517 | - { | |
5518 | - p_ptr->align += p_ptr->virtues[neutral[i]] / 2; | |
5519 | - if (p_ptr->align > 0) p_ptr->align = 0; | |
5520 | - } | |
5521 | - } | |
5522 | - | |
5523 | - /* Hack -- handle "xtra" mode */ | |
5524 | - if (character_xtra) return; | |
5525 | - | |
5526 | - /* Take note when "heavy bow" changes */ | |
5527 | - if (p_ptr->old_heavy_shoot != p_ptr->heavy_shoot) | |
5528 | - { | |
5529 | - if (p_ptr->heavy_shoot) | |
5530 | - { | |
5531 | - msg_print(_("こんな重い弓を装備しているのは大変だ。", "You have trouble wielding such a heavy bow.")); | |
5532 | - } | |
5533 | - else if (inventory[INVEN_BOW].k_idx) | |
5534 | - { | |
5535 | - msg_print(_("この弓なら装備していても辛くない。", "You have no trouble wielding your bow.")); | |
5536 | - } | |
5537 | - else | |
5538 | - { | |
5539 | - msg_print(_("重い弓を装備からはずして体が楽になった。", "You feel relieved to put down your heavy bow.")); | |
5540 | - } | |
5541 | - | |
5542 | - /* Save it */ | |
5543 | - p_ptr->old_heavy_shoot = p_ptr->heavy_shoot; | |
5544 | - } | |
2076 | + * @brief 射撃武器がプレイヤーにとって重すぎるかどうかの判定 / | |
2077 | + * @param o_ptr 判定する射撃武器のアイテム情報参照ポインタ | |
2078 | + * @return 重すぎるならばTRUE | |
2079 | + */ | |
2080 | +bool is_heavy_shoot(object_type *o_ptr) | |
2081 | +{ | |
2082 | + int hold = adj_str_hold[p_ptr->stat_ind[A_STR]]; | |
2083 | + /* It is hard to carholdry a heavy bow */ | |
2084 | + return (hold < o_ptr->weight / 10); | |
2085 | +} | |
5545 | 2086 | |
5546 | - for (i = 0 ; i < 2 ; i++) | |
2087 | +/*! | |
2088 | + * @brief 射撃武器に対応する矢/弾薬のベースアイテムIDを返す / | |
2089 | + * @param o_ptr 判定する射撃武器のアイテム情報参照ポインタ | |
2090 | + * @return 対応する矢/弾薬のベースアイテムID | |
2091 | + */ | |
2092 | +int bow_tval_ammo(object_type *o_ptr) | |
2093 | +{ | |
2094 | + /* Analyze the launcher */ | |
2095 | + switch (o_ptr->sval) | |
5547 | 2096 | { |
5548 | - /* Take note when "heavy weapon" changes */ | |
5549 | - if (p_ptr->old_heavy_wield[i] != p_ptr->heavy_wield[i]) | |
5550 | - { | |
5551 | - if (p_ptr->heavy_wield[i]) | |
5552 | - { | |
5553 | - msg_print(_("こんな重い武器を装備しているのは大変だ。", "You have trouble wielding such a heavy weapon.")); | |
5554 | - } | |
5555 | - else if (buki_motteruka(INVEN_RARM+i)) | |
5556 | - { | |
5557 | - msg_print(_("これなら装備していても辛くない。", "You have no trouble wielding your weapon.")); | |
5558 | - } | |
5559 | - else if (p_ptr->heavy_wield[1-i]) | |
5560 | - { | |
5561 | - msg_print(_("まだ武器が重い。", "You have still trouble wielding a heavy weapon.")); | |
5562 | - } | |
5563 | - else | |
5564 | - { | |
5565 | - msg_print(_("重い武器を装備からはずして体が楽になった。", "You feel relieved to put down your heavy weapon.")); | |
5566 | - } | |
5567 | - | |
5568 | - /* Save it */ | |
5569 | - p_ptr->old_heavy_wield[i] = p_ptr->heavy_wield[i]; | |
5570 | - } | |
5571 | - | |
5572 | - /* Take note when "heavy weapon" changes */ | |
5573 | - if (p_ptr->old_riding_wield[i] != p_ptr->riding_wield[i]) | |
5574 | - { | |
5575 | - if (p_ptr->riding_wield[i]) | |
5576 | - { | |
5577 | - msg_print(_("この武器は乗馬中に使うにはむかないようだ。", "This weapon is not suitable for use while riding.")); | |
5578 | - } | |
5579 | - else if (!p_ptr->riding) | |
5580 | - { | |
5581 | - msg_print(_("この武器は徒歩で使いやすい。", "This weapon was not suitable for use while riding.")); | |
5582 | - } | |
5583 | - else if (buki_motteruka(INVEN_RARM+i)) | |
5584 | - { | |
5585 | - msg_print(_("これなら乗馬中にぴったりだ。", "This weapon is suitable for use while riding.")); | |
5586 | - } | |
5587 | - /* Save it */ | |
5588 | - p_ptr->old_riding_wield[i] = p_ptr->riding_wield[i]; | |
5589 | - } | |
5590 | - | |
5591 | - /* Take note when "illegal weapon" changes */ | |
5592 | - if (p_ptr->old_icky_wield[i] != p_ptr->icky_wield[i]) | |
2097 | + case SV_SLING: | |
5593 | 2098 | { |
5594 | - if (p_ptr->icky_wield[i]) | |
5595 | - { | |
5596 | - msg_print(_("今の装備はどうも自分にふさわしくない気がする。", "You do not feel comfortable with your weapon.")); | |
5597 | - if (is_loading_now) | |
5598 | - { | |
5599 | - chg_virtue(V_FAITH, -1); | |
5600 | - } | |
5601 | - } | |
5602 | - else if (buki_motteruka(INVEN_RARM+i)) | |
5603 | - { | |
5604 | - msg_print(_("今の装備は自分にふさわしい気がする。", "You feel comfortable with your weapon.")); | |
5605 | - } | |
5606 | - else | |
5607 | - { | |
5608 | - msg_print(_("装備をはずしたら随分と気が楽になった。", "You feel more comfortable after removing your weapon.")); | |
5609 | - } | |
5610 | - | |
5611 | - /* Save it */ | |
5612 | - p_ptr->old_icky_wield[i] = p_ptr->icky_wield[i]; | |
2099 | + return TV_SHOT; | |
5613 | 2100 | } |
5614 | - } | |
5615 | 2101 | |
5616 | - if (p_ptr->riding && (p_ptr->old_riding_ryoute != p_ptr->riding_ryoute)) | |
5617 | - { | |
5618 | - if (p_ptr->riding_ryoute) | |
5619 | - { | |
5620 | -#ifdef JP | |
5621 | - msg_format("%s馬を操れない。", (empty_hands(FALSE) == EMPTY_HAND_NONE) ? "両手がふさがっていて" : ""); | |
5622 | -#else | |
5623 | - msg_print("You are using both hand for fighting, and you can't control a riding pet."); | |
5624 | -#endif | |
5625 | - } | |
5626 | - else | |
2102 | + case SV_SHORT_BOW: | |
2103 | + case SV_LONG_BOW: | |
2104 | + case SV_NAMAKE_BOW: | |
5627 | 2105 | { |
5628 | -#ifdef JP | |
5629 | - msg_format("%s馬を操れるようになった。", (empty_hands(FALSE) == EMPTY_HAND_NONE) ? "手が空いて" : ""); | |
5630 | -#else | |
5631 | - msg_print("You began to control riding pet with one hand."); | |
5632 | -#endif | |
2106 | + return TV_ARROW; | |
5633 | 2107 | } |
5634 | 2108 | |
5635 | - p_ptr->old_riding_ryoute = p_ptr->riding_ryoute; | |
5636 | - } | |
5637 | - | |
5638 | - if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_NINJA)) && (monk_armour_aux != monk_notify_aux)) | |
5639 | - { | |
5640 | - if (heavy_armor()) | |
2109 | + case SV_LIGHT_XBOW: | |
2110 | + case SV_HEAVY_XBOW: | |
5641 | 2111 | { |
5642 | - msg_print(_("装備が重くてバランスを取れない。", "The weight of your armor disrupts your balance.")); | |
5643 | - if (is_loading_now) | |
5644 | - { | |
5645 | - chg_virtue(V_HARMONY, -1); | |
5646 | - } | |
2112 | + return TV_BOLT; | |
5647 | 2113 | } |
5648 | - else | |
2114 | + case SV_CRIMSON: | |
2115 | + case SV_HARP: | |
5649 | 2116 | { |
5650 | - msg_print(_("バランスがとれるようになった。", "You regain your balance.")); | |
2117 | + return TV_NO_AMMO; | |
5651 | 2118 | } |
5652 | - | |
5653 | - monk_notify_aux = monk_armour_aux; | |
5654 | - } | |
5655 | - | |
5656 | - for (i = 0; i < INVEN_PACK; i++) | |
5657 | - { | |
5658 | -#if 0 | |
5659 | - if ((inventory[i].tval == TV_SORCERY_BOOK) && (inventory[i].sval == 2)) have_dd_s = TRUE; | |
5660 | - if ((inventory[i].tval == TV_TRUMP_BOOK) && (inventory[i].sval == 1)) have_dd_t = TRUE; | |
5661 | -#endif | |
5662 | - if ((inventory[i].tval == TV_NATURE_BOOK) && (inventory[i].sval == 2)) have_sw = TRUE; | |
5663 | - if ((inventory[i].tval == TV_CRAFT_BOOK) && (inventory[i].sval == 2)) have_kabe = TRUE; | |
5664 | - } | |
5665 | - | |
5666 | - for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx) | |
5667 | - { | |
5668 | - o_ptr = &o_list[this_o_idx]; | |
5669 | - | |
5670 | - /* Acquire next object */ | |
5671 | - next_o_idx = o_ptr->next_o_idx; | |
5672 | - | |
5673 | -#if 0 | |
5674 | - if ((o_ptr->tval == TV_SORCERY_BOOK) && (o_ptr->sval == 3)) have_dd_s = TRUE; | |
5675 | - if ((o_ptr->tval == TV_TRUMP_BOOK) && (o_ptr->sval == 1)) have_dd_t = TRUE; | |
5676 | -#endif | |
5677 | - if ((o_ptr->tval == TV_NATURE_BOOK) && (o_ptr->sval == 2)) have_sw = TRUE; | |
5678 | - if ((o_ptr->tval == TV_CRAFT_BOOK) && (o_ptr->sval == 2)) have_kabe = TRUE; | |
5679 | - } | |
5680 | - | |
5681 | - if (p_ptr->pass_wall && !p_ptr->kill_wall) p_ptr->no_flowed = TRUE; | |
5682 | -#if 0 | |
5683 | - if (have_dd_s && ((p_ptr->realm1 == REALM_SORCERY) || (p_ptr->realm2 == REALM_SORCERY) || (p_ptr->pclass == CLASS_SORCERER))) | |
5684 | - { | |
5685 | - const magic_type *s_ptr = &mp_ptr->info[REALM_SORCERY-1][SPELL_DD_S]; | |
5686 | - if (p_ptr->lev >= s_ptr->slevel) p_ptr->no_flowed = TRUE; | |
5687 | - } | |
5688 | - | |
5689 | - if (have_dd_t && ((p_ptr->realm1 == REALM_TRUMP) || (p_ptr->realm2 == REALM_TRUMP) || (p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))) | |
5690 | - { | |
5691 | - const magic_type *s_ptr = &mp_ptr->info[REALM_TRUMP-1][SPELL_DD_T]; | |
5692 | - if (p_ptr->lev >= s_ptr->slevel) p_ptr->no_flowed = TRUE; | |
5693 | - } | |
5694 | -#endif | |
5695 | - if (have_sw && ((p_ptr->realm1 == REALM_NATURE) || (p_ptr->realm2 == REALM_NATURE) || (p_ptr->pclass == CLASS_SORCERER))) | |
5696 | - { | |
5697 | - const magic_type *s_ptr = &mp_ptr->info[REALM_NATURE-1][SPELL_SW]; | |
5698 | - if (p_ptr->lev >= s_ptr->slevel) p_ptr->no_flowed = TRUE; | |
5699 | - } | |
5700 | - | |
5701 | - if (have_kabe && ((p_ptr->realm1 == REALM_CRAFT) || (p_ptr->realm2 == REALM_CRAFT) || (p_ptr->pclass == CLASS_SORCERER))) | |
5702 | - { | |
5703 | - const magic_type *s_ptr = &mp_ptr->info[REALM_CRAFT-1][SPELL_KABE]; | |
5704 | - if (p_ptr->lev >= s_ptr->slevel) p_ptr->no_flowed = TRUE; | |
5705 | 2119 | } |
2120 | + | |
2121 | + return 0; | |
5706 | 2122 | } |
5707 | 2123 | |
5708 | 2124 |
@@ -6008,180 +2424,6 @@ void update_output(void) | ||
6008 | 2424 | } |
6009 | 2425 | |
6010 | 2426 | /*! |
6011 | - * @brief p_ptr->update のフラグに応じた更新をまとめて行う / Handle "p_ptr->update" | |
6012 | - * @return なし | |
6013 | - * @details 更新処理の対象はプレイヤーの能力修正/光源寿命/HP/MP/魔法の学習状態、他多数の外界の状態判定。 | |
6014 | - */ | |
6015 | -void update_creature(player_type *creature_ptr) | |
6016 | -{ | |
6017 | - if (!creature_ptr->update) return; | |
6018 | - | |
6019 | - /* Actually do auto-destroy */ | |
6020 | - if (creature_ptr->update & (PU_AUTODESTROY)) | |
6021 | - { | |
6022 | - creature_ptr->update &= ~(PU_AUTODESTROY); | |
6023 | - autopick_delayed_alter(); | |
6024 | - } | |
6025 | - | |
6026 | - /* Combine the pack */ | |
6027 | - if (creature_ptr->update & (PU_COMBINE)) | |
6028 | - { | |
6029 | - creature_ptr->update &= ~(PU_COMBINE); | |
6030 | - combine_pack(); | |
6031 | - } | |
6032 | - | |
6033 | - /* Reorder the pack */ | |
6034 | - if (creature_ptr->update & (PU_REORDER)) | |
6035 | - { | |
6036 | - creature_ptr->update &= ~(PU_REORDER); | |
6037 | - reorder_pack(); | |
6038 | - } | |
6039 | - | |
6040 | - if (creature_ptr->update & (PU_BONUS)) | |
6041 | - { | |
6042 | - creature_ptr->update &= ~(PU_BONUS); | |
6043 | - calc_bonuses(); | |
6044 | - } | |
6045 | - | |
6046 | - if (creature_ptr->update & (PU_TORCH)) | |
6047 | - { | |
6048 | - creature_ptr->update &= ~(PU_TORCH); | |
6049 | - calc_torch(); | |
6050 | - } | |
6051 | - | |
6052 | - if (creature_ptr->update & (PU_HP)) | |
6053 | - { | |
6054 | - creature_ptr->update &= ~(PU_HP); | |
6055 | - calc_hitpoints(); | |
6056 | - } | |
6057 | - | |
6058 | - if (creature_ptr->update & (PU_MANA)) | |
6059 | - { | |
6060 | - creature_ptr->update &= ~(PU_MANA); | |
6061 | - calc_mana(); | |
6062 | - } | |
6063 | - | |
6064 | - if (creature_ptr->update & (PU_SPELLS)) | |
6065 | - { | |
6066 | - creature_ptr->update &= ~(PU_SPELLS); | |
6067 | - calc_spells(); | |
6068 | - } | |
6069 | - | |
6070 | - /* Character is not ready yet, no screen updates */ | |
6071 | - if (!character_generated) return; | |
6072 | - | |
6073 | - /* Character is in "icky" mode, no screen updates */ | |
6074 | - if (character_icky) return; | |
6075 | - | |
6076 | - if (creature_ptr->update & (PU_UN_LITE)) | |
6077 | - { | |
6078 | - creature_ptr->update &= ~(PU_UN_LITE); | |
6079 | - forget_lite(); | |
6080 | - } | |
6081 | - | |
6082 | - if (creature_ptr->update & (PU_UN_VIEW)) | |
6083 | - { | |
6084 | - creature_ptr->update &= ~(PU_UN_VIEW); | |
6085 | - forget_view(); | |
6086 | - } | |
6087 | - | |
6088 | - if (creature_ptr->update & (PU_VIEW)) | |
6089 | - { | |
6090 | - creature_ptr->update &= ~(PU_VIEW); | |
6091 | - update_view(); | |
6092 | - } | |
6093 | - | |
6094 | - if (creature_ptr->update & (PU_LITE)) | |
6095 | - { | |
6096 | - creature_ptr->update &= ~(PU_LITE); | |
6097 | - update_lite(); | |
6098 | - } | |
6099 | - | |
6100 | - | |
6101 | - if (creature_ptr->update & (PU_FLOW)) | |
6102 | - { | |
6103 | - creature_ptr->update &= ~(PU_FLOW); | |
6104 | - update_flow(); | |
6105 | - } | |
6106 | - | |
6107 | - if (creature_ptr->update & (PU_DISTANCE)) | |
6108 | - { | |
6109 | - creature_ptr->update &= ~(PU_DISTANCE); | |
6110 | - | |
6111 | - /* Still need to call update_monsters(FALSE) after update_mon_lite() */ | |
6112 | - /* creature_ptr->update &= ~(PU_MONSTERS); */ | |
6113 | - | |
6114 | - update_monsters(TRUE); | |
6115 | - } | |
6116 | - | |
6117 | - if (creature_ptr->update & (PU_MON_LITE)) | |
6118 | - { | |
6119 | - creature_ptr->update &= ~(PU_MON_LITE); | |
6120 | - update_mon_lite(); | |
6121 | - } | |
6122 | - | |
6123 | - /* | |
6124 | - * Mega-Hack -- Delayed visual update | |
6125 | - * Only used if update_view(), update_lite() or update_mon_lite() was called | |
6126 | - */ | |
6127 | - if (creature_ptr->update & (PU_DELAY_VIS)) | |
6128 | - { | |
6129 | - creature_ptr->update &= ~(PU_DELAY_VIS); | |
6130 | - delayed_visual_update(); | |
6131 | - } | |
6132 | - | |
6133 | - if (creature_ptr->update & (PU_MONSTERS)) | |
6134 | - { | |
6135 | - creature_ptr->update &= ~(PU_MONSTERS); | |
6136 | - update_monsters(FALSE); | |
6137 | - } | |
6138 | -} | |
6139 | - | |
6140 | -/*! | |
6141 | - * @brief プレイヤーの現在開いている手の状態を返す | |
6142 | - * @param riding_control 乗馬中により片手を必要としている状態ならばTRUEを返す。 | |
6143 | - * @return 開いている手のビットフラグ | |
6144 | - */ | |
6145 | -BIT_FLAGS16 empty_hands(bool riding_control) | |
6146 | -{ | |
6147 | - BIT_FLAGS16 status = EMPTY_HAND_NONE; | |
6148 | - | |
6149 | - if (!inventory[INVEN_RARM].k_idx) status |= EMPTY_HAND_RARM; | |
6150 | - if (!inventory[INVEN_LARM].k_idx) status |= EMPTY_HAND_LARM; | |
6151 | - | |
6152 | - if (riding_control && (status != EMPTY_HAND_NONE) && p_ptr->riding && !(p_ptr->pet_extra_flags & PF_RYOUTE)) | |
6153 | - { | |
6154 | - if (status & EMPTY_HAND_LARM) status &= ~(EMPTY_HAND_LARM); | |
6155 | - else if (status & EMPTY_HAND_RARM) status &= ~(EMPTY_HAND_RARM); | |
6156 | - } | |
6157 | - | |
6158 | - return status; | |
6159 | -} | |
6160 | - | |
6161 | - | |
6162 | -/*! | |
6163 | - * @brief プレイヤーが防具重量制限のある職業時にペナルティを受ける状態にあるかどうかを返す。 | |
6164 | - * @return ペナルティが適用されるならばTRUE。 | |
6165 | - */ | |
6166 | -bool heavy_armor(void) | |
6167 | -{ | |
6168 | - WEIGHT monk_arm_wgt = 0; | |
6169 | - | |
6170 | - if ((p_ptr->pclass != CLASS_MONK) && (p_ptr->pclass != CLASS_FORCETRAINER) && (p_ptr->pclass != CLASS_NINJA)) return FALSE; | |
6171 | - | |
6172 | - /* Weight the armor */ | |
6173 | - if(inventory[INVEN_RARM].tval > TV_SWORD) monk_arm_wgt += inventory[INVEN_RARM].weight; | |
6174 | - if(inventory[INVEN_LARM].tval > TV_SWORD) monk_arm_wgt += inventory[INVEN_LARM].weight; | |
6175 | - monk_arm_wgt += inventory[INVEN_BODY].weight; | |
6176 | - monk_arm_wgt += inventory[INVEN_HEAD].weight; | |
6177 | - monk_arm_wgt += inventory[INVEN_OUTER].weight; | |
6178 | - monk_arm_wgt += inventory[INVEN_HANDS].weight; | |
6179 | - monk_arm_wgt += inventory[INVEN_FEET].weight; | |
6180 | - | |
6181 | - return (monk_arm_wgt > (100 + (p_ptr->lev * 4))); | |
6182 | -} | |
6183 | - | |
6184 | -/*! | |
6185 | 2427 | * @brief 実ゲームプレイ時間を更新する |
6186 | 2428 | */ |
6187 | 2429 | void update_playtime(void) |