1 #include "player/player-status.h"
2 #include "art-definition/art-bow-types.h"
3 #include "art-definition/art-sword-types.h"
4 #include "art-definition/art-weapon-types.h"
5 #include "autopick/autopick-reader-writer.h"
6 #include "autopick/autopick.h"
7 #include "cmd-action/cmd-pet.h"
8 #include "cmd-action/cmd-spell.h"
9 #include "cmd-io/cmd-dump.h"
10 #include "cmd-item/cmd-magiceat.h"
11 #include "combat/attack-power-table.h"
12 #include "core/asking-player.h"
13 #include "core/player-redraw-types.h"
14 #include "core/player-update-types.h"
15 #include "core/stuff-handler.h"
16 #include "core/window-redrawer.h"
17 #include "dungeon/dungeon-flag-types.h"
18 #include "dungeon/dungeon.h"
19 #include "dungeon/quest.h"
20 #include "effect/effect-characteristics.h"
21 #include "floor/cave.h"
22 #include "floor/floor-events.h"
23 #include "floor/floor-leaver.h"
24 #include "floor/floor-save.h"
25 #include "floor/floor-util.h"
26 #include "game-option/birth-options.h"
27 #include "grid/feature.h"
28 #include "inventory/inventory-object.h"
29 #include "inventory/inventory-slot-types.h"
30 #include "io/input-key-acceptor.h"
31 #include "io/write-diary.h"
32 #include "main/sound-definitions-table.h"
33 #include "main/sound-of-music.h"
34 #include "market/arena-info-table.h"
35 #include "mind/mind-force-trainer.h"
36 #include "mind/mind-ninja.h"
37 #include "monster-floor/monster-lite.h"
38 #include "monster-floor/monster-remover.h"
39 #include "monster-race/monster-race-hook.h"
40 #include "monster-race/monster-race.h"
41 #include "monster-race/race-flags1.h"
42 #include "monster-race/race-flags2.h"
43 #include "monster-race/race-flags3.h"
44 #include "monster-race/race-flags7.h"
45 #include "monster/monster-info.h"
46 #include "monster/monster-status.h"
47 #include "monster/monster-update.h"
48 #include "monster/smart-learn-types.h"
49 #include "mutation/mutation-calculator.h"
50 #include "mutation/mutation-flag-types.h"
51 #include "mutation/mutation-investor-remover.h"
52 #include "object-enchant/object-ego.h"
53 #include "object-enchant/special-object-flags.h"
54 #include "object-enchant/tr-types.h"
55 #include "object-enchant/trc-types.h"
56 #include "object-hook/hook-armor.h"
57 #include "object-hook/hook-checker.h"
58 #include "object-hook/hook-weapon.h"
59 #include "object/object-flags.h"
60 #include "object/object-info.h"
61 #include "object/object-mark-types.h"
62 #include "perception/object-perception.h"
63 #include "pet/pet-util.h"
64 #include "player/attack-defense-types.h"
65 #include "player-info/avatar.h"
66 #include "player/digestion-processor.h"
67 #include "player/mimic-info-table.h"
68 #include "player/patron.h"
69 #include "player/player-class.h"
70 #include "player/player-damage.h"
71 #include "player/player-move.h"
72 #include "player/player-personalities-types.h"
73 #include "player/player-personality.h"
74 #include "player/player-race-types.h"
75 #include "player/player-skill.h"
76 #include "player/player-status-flags.h"
77 #include "player/player-status-table.h"
78 #include "player/player-view.h"
79 #include "player/race-info-table.h"
80 #include "player/special-defense-types.h"
81 #include "realm/realm-hex-numbers.h"
82 #include "realm/realm-names-table.h"
83 #include "realm/realm-song-numbers.h"
84 #include "specific-object/bow.h"
85 #include "specific-object/torch.h"
86 #include "spell-realm/spells-hex.h"
87 #include "spell/range-calc.h"
88 #include "spell/spells-describer.h"
89 #include "spell/spells-execution.h"
90 #include "spell/spells-status.h"
91 #include "spell/technic-info-table.h"
92 #include "status/action-setter.h"
93 #include "status/base-status.h"
94 #include "sv-definition/sv-lite-types.h"
95 #include "sv-definition/sv-weapon-types.h"
96 #include "system/angband.h"
97 #include "system/floor-type-definition.h"
98 #include "term/screen-processor.h"
99 #include "util/bit-flags-calculator.h"
100 #include "util/quarks.h"
101 #include "util/string-processor.h"
102 #include "view/display-messages.h"
103 #include "world/world.h"
105 static bool is_martial_arts_mode(player_type *creature_ptr);
107 static ACTION_SKILL_POWER calc_intra_vision(player_type *creature_ptr);
108 static ACTION_SKILL_POWER calc_stealth(player_type *creature_ptr);
109 static ACTION_SKILL_POWER calc_disarming(player_type *creature_ptr);
110 static ACTION_SKILL_POWER calc_device_ability(player_type *creature_ptr);
111 static ACTION_SKILL_POWER calc_saving_throw(player_type *creature_ptr);
112 static ACTION_SKILL_POWER calc_search(player_type *creature_ptr);
113 static ACTION_SKILL_POWER calc_search_freq(player_type *creature_ptr);
114 static ACTION_SKILL_POWER calc_to_hit_melee(player_type *creature_ptr);
115 static ACTION_SKILL_POWER calc_to_hit_shoot(player_type *creature_ptr);
116 static ACTION_SKILL_POWER calc_to_hit_throw(player_type *creature_ptr);
117 static ACTION_SKILL_POWER calc_skill_dig(player_type *creature_ptr);
118 static s16b calc_num_blow(player_type *creature_ptr, int i);
119 static s16b calc_strength_addition(player_type *creature_ptr);
120 static s16b calc_intelligence_addition(player_type *creature_ptr);
121 static s16b calc_wisdom_addition(player_type *creature_ptr);
122 static s16b calc_dexterity_addition(player_type *creature_ptr);
123 static s16b calc_constitution_addition(player_type *creature_ptr);
124 static s16b calc_charisma_addition(player_type *creature_ptr);
125 static s16b calc_to_magic_chance(player_type *creature_ptr);
126 static ARMOUR_CLASS calc_base_ac(player_type *creature_ptr);
127 static ARMOUR_CLASS calc_to_ac(player_type *creature_ptr, bool is_true_value);
128 static s16b calc_speed(player_type *creature_ptr);
129 static s16b calc_double_weapon_penalty(player_type *creature_ptr, INVENTORY_IDX slot);
130 static void calc_use_status(player_type *creature_ptr, int status);
131 static void calc_top_status(player_type *creature_ptr, int status);
132 static void calc_ind_status(player_type *creature_ptr, int status);
133 static s16b calc_riding_bow_penalty(player_type *creature_ptr);
134 static void put_equipment_warning(player_type *creature_ptr);
136 static s16b calc_to_damage(player_type *creature_ptr, INVENTORY_IDX slot, bool is_true_value);
137 static s16b calc_to_hit(player_type *creature_ptr, INVENTORY_IDX slot, bool is_true_value);
139 static s16b calc_to_hit_bow(player_type *creature_ptr, bool is_true_value);
141 static s16b calc_to_damage_misc(player_type *creature_ptr);
142 static s16b calc_to_hit_misc(player_type *creature_ptr);
144 static DICE_NUMBER calc_to_weapon_dice_num(player_type *creature_ptr, INVENTORY_IDX slot);
145 static DICE_NUMBER calc_to_weapon_dice_side(player_type *creature_ptr, INVENTORY_IDX slot);
147 static int get_default_hand(player_type *creature_ptr);
149 /*** Player information ***/
152 * Static player info record
157 * Pointer to the player info
159 player_type *p_ptr = &p_body;
162 * Return alignment title
164 concptr your_alignment(player_type *creature_ptr)
166 if (creature_ptr->align > 150)
167 return _("大善", "Lawful");
168 else if (creature_ptr->align > 50)
169 return _("中善", "Good");
170 else if (creature_ptr->align > 10)
171 return _("小善", "Neutral Good");
172 else if (creature_ptr->align > -11)
173 return _("中立", "Neutral");
174 else if (creature_ptr->align > -51)
175 return _("小悪", "Neutral Evil");
176 else if (creature_ptr->align > -151)
177 return _("中悪", "Evil");
179 return _("大悪", "Chaotic");
183 * Return proficiency level of weapons and misc. skills (except riding)
185 int weapon_exp_level(int weapon_exp)
187 if (weapon_exp < WEAPON_EXP_BEGINNER)
188 return EXP_LEVEL_UNSKILLED;
189 else if (weapon_exp < WEAPON_EXP_SKILLED)
190 return EXP_LEVEL_BEGINNER;
191 else if (weapon_exp < WEAPON_EXP_EXPERT)
192 return EXP_LEVEL_SKILLED;
193 else if (weapon_exp < WEAPON_EXP_MASTER)
194 return EXP_LEVEL_EXPERT;
196 return EXP_LEVEL_MASTER;
200 * Return proficiency level of riding
202 int riding_exp_level(int riding_exp)
204 if (riding_exp < RIDING_EXP_BEGINNER)
205 return EXP_LEVEL_UNSKILLED;
206 else if (riding_exp < RIDING_EXP_SKILLED)
207 return EXP_LEVEL_BEGINNER;
208 else if (riding_exp < RIDING_EXP_EXPERT)
209 return EXP_LEVEL_SKILLED;
210 else if (riding_exp < RIDING_EXP_MASTER)
211 return EXP_LEVEL_EXPERT;
213 return EXP_LEVEL_MASTER;
217 * Return proficiency level of spells
219 int spell_exp_level(int spell_exp)
221 if (spell_exp < SPELL_EXP_BEGINNER)
222 return EXP_LEVEL_UNSKILLED;
223 else if (spell_exp < SPELL_EXP_SKILLED)
224 return EXP_LEVEL_BEGINNER;
225 else if (spell_exp < SPELL_EXP_EXPERT)
226 return EXP_LEVEL_SKILLED;
227 else if (spell_exp < SPELL_EXP_MASTER)
228 return EXP_LEVEL_EXPERT;
230 return EXP_LEVEL_MASTER;
234 * Delayed visual update
235 * Only used if update_view(), update_lite() or update_mon_lite() was called
237 static void delayed_visual_update(player_type *player_ptr)
239 floor_type *floor_ptr = player_ptr->current_floor_ptr;
240 for (int i = 0; i < floor_ptr->redraw_n; i++) {
241 POSITION y = floor_ptr->redraw_y[i];
242 POSITION x = floor_ptr->redraw_x[i];
244 g_ptr = &floor_ptr->grid_array[y][x];
245 if (!(g_ptr->info & CAVE_REDRAW))
248 if (g_ptr->info & CAVE_NOTE)
249 note_spot(player_ptr, y, x);
251 lite_spot(player_ptr, y, x);
253 update_monster(player_ptr, g_ptr->m_idx, FALSE);
255 g_ptr->info &= ~(CAVE_NOTE | CAVE_REDRAW);
258 floor_ptr->redraw_n = 0;
262 * @brief 射撃武器がプレイヤーにとって重すぎるかどうかの判定 /
263 * @param o_ptr 判定する射撃武器のアイテム情報参照ポインタ
264 * @return 重すぎるならばTRUE
266 static bool is_heavy_shoot(player_type *creature_ptr, object_type *o_ptr)
268 int hold = adj_str_hold[creature_ptr->stat_ind[A_STR]];
269 return (hold < o_ptr->weight / 10);
273 * @brief プレイヤーの全ステータスを更新する /
274 * Calculate the players current "state", taking into account
275 * not only race/class intrinsics, but also objects being worn
276 * and temporary spell effects.
280 * See also calc_mana() and calc_hitpoints().
282 * Take note of the new "speed code", in particular, a very strong
283 * player will start slowing down as soon as he reaches 150 pounds,
284 * but not until he reaches 450 pounds will he be half as fast as
285 * a normal kobold. This both hurts and helps the player, hurts
286 * because in the old days a player could just avoid 300 pounds,
287 * and helps because now carrying 300 pounds is not very painful.
289 * The "weapon" and "bow" do *not* add to the bonuses to hit or to
290 * damage, since that would affect non-combat things. These values
291 * are actually added in later, at the appropriate place.
293 * This function induces various "status" messages.
296 void calc_bonuses(player_type *creature_ptr)
298 int empty_hands_status = empty_hands(creature_ptr, TRUE);
301 /* Save the old vision stuff */
302 bool old_telepathy = creature_ptr->telepathy;
303 BIT_FLAGS old_esp_animal = creature_ptr->esp_animal;
304 BIT_FLAGS old_esp_undead = creature_ptr->esp_undead;
305 BIT_FLAGS old_esp_demon = creature_ptr->esp_demon;
306 BIT_FLAGS old_esp_orc = creature_ptr->esp_orc;
307 BIT_FLAGS old_esp_troll = creature_ptr->esp_troll;
308 BIT_FLAGS old_esp_giant = creature_ptr->esp_giant;
309 BIT_FLAGS old_esp_dragon = creature_ptr->esp_dragon;
310 bool old_esp_human = creature_ptr->esp_human;
311 BIT_FLAGS old_esp_evil = creature_ptr->esp_evil;
312 bool old_esp_good = creature_ptr->esp_good;
313 bool old_esp_nonliving = creature_ptr->esp_nonliving;
314 bool old_esp_unique = creature_ptr->esp_unique;
315 bool old_see_inv = creature_ptr->see_inv;
316 bool old_mighty_throw = creature_ptr->mighty_throw;
317 s16b old_speed = creature_ptr->pspeed;
319 ARMOUR_CLASS old_dis_ac = creature_ptr->dis_ac;
320 ARMOUR_CLASS old_dis_to_a = creature_ptr->dis_to_a;
322 creature_ptr->pass_wall = have_pass_wall(creature_ptr);
323 creature_ptr->kill_wall = have_kill_wall(creature_ptr);
324 creature_ptr->xtra_might = have_xtra_might(creature_ptr);
325 creature_ptr->esp_evil = have_esp_evil(creature_ptr);
326 creature_ptr->esp_animal = have_esp_animal(creature_ptr);
327 creature_ptr->esp_undead = have_esp_undead(creature_ptr);
328 creature_ptr->esp_demon = have_esp_demon(creature_ptr);
329 creature_ptr->esp_orc = have_esp_orc(creature_ptr);
330 creature_ptr->esp_troll = have_esp_troll(creature_ptr);
331 creature_ptr->esp_giant = have_esp_giant(creature_ptr);
332 creature_ptr->esp_dragon = have_esp_dragon(creature_ptr);
333 have_esp_human(creature_ptr);
334 have_esp_good(creature_ptr);
335 have_esp_nonliving(creature_ptr);
336 have_esp_unique(creature_ptr);
337 have_esp_telepathy(creature_ptr);
338 have_bless_blade(creature_ptr);
339 have_easy2_weapon(creature_ptr);
340 have_down_saving(creature_ptr);
341 have_no_ac(creature_ptr);
342 have_mighty_throw(creature_ptr);
343 have_dec_mana(creature_ptr);
344 have_reflect(creature_ptr);
345 have_see_nocto(creature_ptr);
346 have_warning(creature_ptr);
347 have_anti_magic(creature_ptr);
348 have_anti_tele(creature_ptr);
349 have_sh_fire(creature_ptr);
350 have_sh_elec(creature_ptr);
351 have_sh_cold(creature_ptr);
352 have_easy_spell(creature_ptr);
353 have_heavy_spell(creature_ptr);
354 have_hold_exp(creature_ptr);
355 have_see_inv(creature_ptr);
356 have_free_act(creature_ptr);
357 have_sustain_str(creature_ptr);
358 have_sustain_int(creature_ptr);
359 have_sustain_wis(creature_ptr);
360 have_sustain_dex(creature_ptr);
361 have_sustain_con(creature_ptr);
362 have_sustain_chr(creature_ptr);
363 have_levitation(creature_ptr);
364 have_can_swim(creature_ptr);
365 have_slow_digest(creature_ptr);
366 have_regenerate(creature_ptr);
367 have_curses(creature_ptr);
368 have_impact(creature_ptr);
369 have_extra_blow(creature_ptr);
370 have_immune_acid(creature_ptr);
371 have_immune_elec(creature_ptr);
372 have_immune_fire(creature_ptr);
373 have_immune_cold(creature_ptr);
374 have_resist_acid(creature_ptr);
375 have_resist_elec(creature_ptr);
376 have_resist_fire(creature_ptr);
377 have_resist_cold(creature_ptr);
378 have_resist_pois(creature_ptr);
379 have_resist_conf(creature_ptr);
380 have_resist_sound(creature_ptr);
381 have_resist_lite(creature_ptr);
382 have_resist_dark(creature_ptr);
383 have_resist_chaos(creature_ptr);
384 have_resist_disen(creature_ptr);
385 have_resist_shard(creature_ptr);
386 have_resist_nexus(creature_ptr);
387 have_resist_blind(creature_ptr);
388 have_resist_neth(creature_ptr);
389 have_resist_time(creature_ptr);
390 have_resist_fear(creature_ptr);
392 have_lite(creature_ptr);
394 const player_race *tmp_rp_ptr;
395 if (creature_ptr->mimic_form)
396 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
398 tmp_rp_ptr = &race_info[creature_ptr->prace];
400 if (creature_ptr->mimic_form) {
401 switch (creature_ptr->mimic_form) {
403 creature_ptr->oppose_fire = 1;
404 creature_ptr->redraw |= PR_STATUS;
408 switch (creature_ptr->prace) {
411 if (creature_ptr->lev > 44) {
412 creature_ptr->oppose_fire = 1;
413 creature_ptr->redraw |= PR_STATUS;
422 switch (creature_ptr->pclass) {
424 case CLASS_BERSERKER:
425 creature_ptr->shero = 1;
426 creature_ptr->redraw |= PR_STATUS;
429 if (creature_ptr->lev > 44) {
430 creature_ptr->oppose_pois = 1;
431 creature_ptr->redraw |= PR_STATUS;
436 if (creature_ptr->special_defense & KAMAE_MASK) {
437 if (!(empty_hands_status & EMPTY_HAND_RARM)) {
438 set_action(creature_ptr, ACTION_NONE);
442 creature_ptr->stat_add[A_STR] = calc_strength_addition(creature_ptr);
443 creature_ptr->stat_add[A_INT] = calc_intelligence_addition(creature_ptr);
444 creature_ptr->stat_add[A_WIS] = calc_wisdom_addition(creature_ptr);
445 creature_ptr->stat_add[A_DEX] = calc_dexterity_addition(creature_ptr);
446 creature_ptr->stat_add[A_CON] = calc_constitution_addition(creature_ptr);
447 creature_ptr->stat_add[A_CHR] = calc_charisma_addition(creature_ptr);
448 creature_ptr->to_m_chance = calc_to_magic_chance(creature_ptr);
449 creature_ptr->ac = calc_base_ac(creature_ptr);
450 creature_ptr->to_a = calc_to_ac(creature_ptr, TRUE);
451 creature_ptr->dis_ac = calc_base_ac(creature_ptr);
452 creature_ptr->dis_to_a = calc_to_ac(creature_ptr, FALSE);
454 for (int i = 0; i < A_MAX; i++) {
455 calc_top_status(creature_ptr, i);
456 calc_use_status(creature_ptr, i);
457 calc_ind_status(creature_ptr, i);
460 o_ptr = &creature_ptr->inventory_list[INVEN_BOW];
462 creature_ptr->tval_ammo = (byte)bow_tval_ammo(o_ptr);
463 if (o_ptr->k_idx && !is_heavy_shoot(creature_ptr, &creature_ptr->inventory_list[INVEN_BOW])) {
464 creature_ptr->num_fire = calc_num_fire(creature_ptr, o_ptr);
468 for (int i = 0; i < 2; i++) {
469 creature_ptr->icky_wield[i] = is_icky_wield_weapon(creature_ptr, i);
470 creature_ptr->riding_wield[i] = is_riding_wield_weapon(creature_ptr, i);
471 creature_ptr->num_blow[i] = calc_num_blow(creature_ptr, i);
472 creature_ptr->to_dd[i] = calc_to_weapon_dice_num(creature_ptr, INVEN_RARM + i);
473 creature_ptr->to_ds[i] = calc_to_weapon_dice_side(creature_ptr, INVEN_RARM + i);
476 creature_ptr->pspeed = calc_speed(creature_ptr);
477 creature_ptr->see_infra = calc_intra_vision(creature_ptr);
478 creature_ptr->skill_stl = calc_stealth(creature_ptr);
479 creature_ptr->skill_dis = calc_disarming(creature_ptr);
480 creature_ptr->skill_dev = calc_device_ability(creature_ptr);
481 creature_ptr->skill_sav = calc_saving_throw(creature_ptr);
482 creature_ptr->skill_srh = calc_search(creature_ptr);
483 creature_ptr->skill_fos = calc_search_freq(creature_ptr);
484 creature_ptr->skill_thn = calc_to_hit_melee(creature_ptr);
485 creature_ptr->skill_thb = calc_to_hit_shoot(creature_ptr);
486 creature_ptr->skill_tht = calc_to_hit_throw(creature_ptr);
487 creature_ptr->to_d[0] = calc_to_damage(creature_ptr, INVEN_RARM, TRUE);
488 creature_ptr->to_d[1] = calc_to_damage(creature_ptr, INVEN_LARM, TRUE);
489 creature_ptr->dis_to_d[0] = calc_to_damage(creature_ptr, INVEN_RARM, FALSE);
490 creature_ptr->dis_to_d[1] = calc_to_damage(creature_ptr, INVEN_LARM, FALSE);
491 creature_ptr->to_h[0] = calc_to_hit(creature_ptr, INVEN_RARM, TRUE);
492 creature_ptr->to_h[1] = calc_to_hit(creature_ptr, INVEN_LARM, TRUE);
493 creature_ptr->dis_to_h[0] = calc_to_hit(creature_ptr, INVEN_RARM, FALSE);
494 creature_ptr->dis_to_h[1] = calc_to_hit(creature_ptr, INVEN_LARM, FALSE);
495 creature_ptr->to_h_b = calc_to_hit_bow(creature_ptr, TRUE);
496 creature_ptr->dis_to_h_b = calc_to_hit_bow(creature_ptr, FALSE);
497 creature_ptr->to_d_m = calc_to_damage_misc(creature_ptr);
498 creature_ptr->to_h_m = calc_to_hit_misc(creature_ptr);
499 creature_ptr->skill_dig = calc_skill_dig(creature_ptr);
501 if (old_mighty_throw != creature_ptr->mighty_throw) {
502 creature_ptr->window |= PW_INVEN;
505 if (creature_ptr->telepathy != old_telepathy) {
506 creature_ptr->update |= (PU_MONSTERS);
509 if ((creature_ptr->esp_animal != old_esp_animal) || (creature_ptr->esp_undead != old_esp_undead) || (creature_ptr->esp_demon != old_esp_demon)
510 || (creature_ptr->esp_orc != old_esp_orc) || (creature_ptr->esp_troll != old_esp_troll) || (creature_ptr->esp_giant != old_esp_giant)
511 || (creature_ptr->esp_dragon != old_esp_dragon) || (creature_ptr->esp_human != old_esp_human) || (creature_ptr->esp_evil != old_esp_evil)
512 || (creature_ptr->esp_good != old_esp_good) || (creature_ptr->esp_nonliving != old_esp_nonliving) || (creature_ptr->esp_unique != old_esp_unique)) {
513 creature_ptr->update |= (PU_MONSTERS);
516 if (creature_ptr->see_inv != old_see_inv) {
517 creature_ptr->update |= (PU_MONSTERS);
520 if (creature_ptr->pspeed != old_speed) {
521 creature_ptr->redraw |= (PR_SPEED);
524 if ((creature_ptr->dis_ac != old_dis_ac) || (creature_ptr->dis_to_a != old_dis_to_a)) {
525 creature_ptr->redraw |= (PR_ARMOR);
526 creature_ptr->window |= (PW_PLAYER);
529 if (current_world_ptr->character_xtra)
532 put_equipment_warning(creature_ptr);
535 static void calc_alignment(player_type *creature_ptr)
537 creature_ptr->align = 0;
538 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
539 for (MONSTER_IDX m_idx = floor_ptr->m_max - 1; m_idx >= 1; m_idx--) {
542 m_ptr = &floor_ptr->m_list[m_idx];
543 if (!monster_is_valid(m_ptr))
545 r_ptr = &r_info[m_ptr->r_idx];
550 if (r_ptr->flags3 & RF3_GOOD)
551 creature_ptr->align += r_ptr->level;
552 if (r_ptr->flags3 & RF3_EVIL)
553 creature_ptr->align -= r_ptr->level;
556 if (creature_ptr->mimic_form) {
557 switch (creature_ptr->mimic_form) {
559 creature_ptr->align -= 200;
561 case MIMIC_DEMON_LORD:
562 creature_ptr->align -= 200;
566 switch (creature_ptr->prace) {
568 creature_ptr->align += 200;
571 creature_ptr->align -= 200;
576 for (int i = 0; i < 2; i++) {
577 if (!has_melee_weapon(creature_ptr, INVEN_RARM + i))
579 if (creature_ptr->inventory_list[INVEN_RARM + i].name1 != ART_IRON_BALL)
581 creature_ptr->align -= 1000;
586 for (int i = 0; i < 8; i++) {
587 switch (creature_ptr->vir_types[i]) {
589 creature_ptr->align += creature_ptr->virtues[i] * 2;
598 creature_ptr->align -= creature_ptr->virtues[i];
601 creature_ptr->align += creature_ptr->virtues[i];
606 for (int i = 0; i < j; i++) {
607 if (creature_ptr->align > 0) {
608 creature_ptr->align -= creature_ptr->virtues[neutral[i]] / 2;
609 if (creature_ptr->align < 0)
610 creature_ptr->align = 0;
611 } else if (creature_ptr->align < 0) {
612 creature_ptr->align += creature_ptr->virtues[neutral[i]] / 2;
613 if (creature_ptr->align > 0)
614 creature_ptr->align = 0;
620 * @brief プレイヤーの最大HPを計算する /
621 * Calculate the players (maximal) hit points
622 * Adjust current hitpoints if necessary
626 static void calc_hitpoints(player_type *creature_ptr)
628 int bonus = ((int)(adj_con_mhp[creature_ptr->stat_ind[A_CON]]) - 128) * creature_ptr->lev / 4;
629 int mhp = creature_ptr->player_hp[creature_ptr->lev - 1];
632 if (creature_ptr->mimic_form) {
633 if (creature_ptr->pclass == CLASS_SORCERER)
634 tmp_hitdie = mimic_info[creature_ptr->mimic_form].r_mhp / 2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
636 tmp_hitdie = mimic_info[creature_ptr->mimic_form].r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
637 mhp = mhp * tmp_hitdie / creature_ptr->hitdie;
640 if (creature_ptr->pclass == CLASS_SORCERER) {
641 if (creature_ptr->lev < 30)
642 mhp = (mhp * (45 + creature_ptr->lev) / 100);
644 mhp = (mhp * 75 / 100);
645 bonus = (bonus * 65 / 100);
650 if (creature_ptr->pclass == CLASS_BERSERKER) {
651 mhp = mhp * (110 + (((creature_ptr->lev + 40) * (creature_ptr->lev + 40) - 1550) / 110)) / 100;
654 if (mhp < creature_ptr->lev + 1)
655 mhp = creature_ptr->lev + 1;
656 if (is_hero(creature_ptr))
658 if (creature_ptr->shero && (creature_ptr->pclass != CLASS_BERSERKER))
660 if (creature_ptr->tsuyoshi)
662 if (hex_spelling(creature_ptr, HEX_XTRA_MIGHT))
664 if (hex_spelling(creature_ptr, HEX_BUILDING))
666 if (creature_ptr->mhp == mhp)
669 if (creature_ptr->chp >= mhp) {
670 creature_ptr->chp = mhp;
671 creature_ptr->chp_frac = 0;
675 if (creature_ptr->level_up_message && (mhp > creature_ptr->mhp)) {
676 msg_format("最大ヒット・ポイントが %d 増加した!", (mhp - creature_ptr->mhp));
679 creature_ptr->mhp = mhp;
681 creature_ptr->redraw |= PR_HP;
682 creature_ptr->window |= PW_PLAYER;
686 * @brief プレイヤーの現在学習可能な魔法数を計算し、増減に応じて魔法の忘却、再学習を処置する。 /
687 * Calculate number of spells player should have, and forget,
688 * or remember, spells until that number is properly reflected.
691 * Note that this function induces various "status" messages,
692 * which must be bypasses until the character is created.
694 static void calc_spells(player_type *creature_ptr)
696 if (!mp_ptr->spell_book)
698 if (!current_world_ptr->character_generated)
700 if (current_world_ptr->character_xtra)
702 if ((creature_ptr->pclass == CLASS_SORCERER) || (creature_ptr->pclass == CLASS_RED_MAGE)) {
703 creature_ptr->new_spells = 0;
707 concptr p = spell_category_name(mp_ptr->spell_book);
708 int levels = creature_ptr->lev - mp_ptr->spell_first + 1;
712 int num_allowed = (adj_mag_study[creature_ptr->stat_ind[mp_ptr->spell_stat]] * levels / 2);
714 if ((creature_ptr->pclass != CLASS_SAMURAI) && (mp_ptr->spell_book != TV_LIFE_BOOK)) {
718 if (creature_ptr->pclass == CLASS_SAMURAI) {
720 } else if (creature_ptr->realm2 == REALM_NONE) {
721 num_allowed = (num_allowed + 1) / 2;
722 if (num_allowed > (32 + bonus))
723 num_allowed = 32 + bonus;
724 } else if ((creature_ptr->pclass == CLASS_MAGE) || (creature_ptr->pclass == CLASS_PRIEST)) {
725 if (num_allowed > (96 + bonus))
726 num_allowed = 96 + bonus;
728 if (num_allowed > (80 + bonus))
729 num_allowed = 80 + bonus;
732 int num_boukyaku = 0;
733 for (int j = 0; j < 64; j++) {
734 if ((j < 32) ? (creature_ptr->spell_forgotten1 & (1L << j)) : (creature_ptr->spell_forgotten2 & (1L << (j - 32)))) {
739 creature_ptr->new_spells = num_allowed + creature_ptr->add_spells + num_boukyaku - creature_ptr->learned_spells;
740 for (int i = 63; i >= 0; i--) {
741 if (!creature_ptr->spell_learned1 && !creature_ptr->spell_learned2)
744 int j = creature_ptr->spell_order[i];
748 const magic_type *s_ptr;
749 if (!is_magic((j < 32) ? creature_ptr->realm1 : creature_ptr->realm2)) {
751 s_ptr = &technic_info[creature_ptr->realm1 - MIN_TECHNIC][j];
753 s_ptr = &technic_info[creature_ptr->realm2 - MIN_TECHNIC][j % 32];
755 s_ptr = &mp_ptr->info[creature_ptr->realm1 - 1][j];
757 s_ptr = &mp_ptr->info[creature_ptr->realm2 - 1][j % 32];
759 if (s_ptr->slevel <= creature_ptr->lev)
762 bool is_spell_learned = (j < 32) ? (creature_ptr->spell_learned1 & (1L << j)) : (creature_ptr->spell_learned2 & (1L << (j - 32)));
763 if (!is_spell_learned)
768 creature_ptr->spell_forgotten1 |= (1L << j);
769 which = creature_ptr->realm1;
771 creature_ptr->spell_forgotten2 |= (1L << (j - 32));
772 which = creature_ptr->realm2;
776 creature_ptr->spell_learned1 &= ~(1L << j);
777 which = creature_ptr->realm1;
779 creature_ptr->spell_learned2 &= ~(1L << (j - 32));
780 which = creature_ptr->realm2;
784 msg_format("%sの%sを忘れてしまった。", exe_spell(creature_ptr, which, j % 32, SPELL_NAME), p);
786 msg_format("You have forgotten the %s of %s.", p, exe_spell(creature_ptr, which, j % 32, SPELL_NAME));
788 creature_ptr->new_spells++;
791 /* Forget spells if we know too many spells */
792 for (int i = 63; i >= 0; i--) {
793 if (creature_ptr->new_spells >= 0)
795 if (!creature_ptr->spell_learned1 && !creature_ptr->spell_learned2)
798 int j = creature_ptr->spell_order[i];
802 bool is_spell_learned = (j < 32) ? (creature_ptr->spell_learned1 & (1L << j)) : (creature_ptr->spell_learned2 & (1L << (j - 32)));
803 if (!is_spell_learned)
808 creature_ptr->spell_forgotten1 |= (1L << j);
809 which = creature_ptr->realm1;
811 creature_ptr->spell_forgotten2 |= (1L << (j - 32));
812 which = creature_ptr->realm2;
816 creature_ptr->spell_learned1 &= ~(1L << j);
817 which = creature_ptr->realm1;
819 creature_ptr->spell_learned2 &= ~(1L << (j - 32));
820 which = creature_ptr->realm2;
824 msg_format("%sの%sを忘れてしまった。", exe_spell(creature_ptr, which, j % 32, SPELL_NAME), p);
826 msg_format("You have forgotten the %s of %s.", p, exe_spell(creature_ptr, which, j % 32, SPELL_NAME));
828 creature_ptr->new_spells++;
831 /* Check for spells to remember */
832 for (int i = 0; i < 64; i++) {
833 if (creature_ptr->new_spells <= 0)
835 if (!creature_ptr->spell_forgotten1 && !creature_ptr->spell_forgotten2)
837 int j = creature_ptr->spell_order[i];
841 const magic_type *s_ptr;
842 if (!is_magic((j < 32) ? creature_ptr->realm1 : creature_ptr->realm2)) {
844 s_ptr = &technic_info[creature_ptr->realm1 - MIN_TECHNIC][j];
846 s_ptr = &technic_info[creature_ptr->realm2 - MIN_TECHNIC][j % 32];
848 s_ptr = &mp_ptr->info[creature_ptr->realm1 - 1][j];
850 s_ptr = &mp_ptr->info[creature_ptr->realm2 - 1][j % 32];
852 if (s_ptr->slevel > creature_ptr->lev)
855 bool is_spell_learned = (j < 32) ? (creature_ptr->spell_forgotten1 & (1L << j)) : (creature_ptr->spell_forgotten2 & (1L << (j - 32)));
856 if (!is_spell_learned)
861 creature_ptr->spell_forgotten1 &= ~(1L << j);
862 which = creature_ptr->realm1;
864 creature_ptr->spell_forgotten2 &= ~(1L << (j - 32));
865 which = creature_ptr->realm2;
869 creature_ptr->spell_learned1 |= (1L << j);
870 which = creature_ptr->realm1;
872 creature_ptr->spell_learned2 |= (1L << (j - 32));
873 which = creature_ptr->realm2;
877 msg_format("%sの%sを思い出した。", exe_spell(creature_ptr, which, j % 32, SPELL_NAME), p);
879 msg_format("You have remembered the %s of %s.", p, exe_spell(creature_ptr, which, j % 32, SPELL_NAME));
881 creature_ptr->new_spells--;
884 if (creature_ptr->realm2 == REALM_NONE) {
886 for (int j = 0; j < 32; j++) {
887 const magic_type *s_ptr;
888 if (!is_magic(creature_ptr->realm1))
889 s_ptr = &technic_info[creature_ptr->realm1 - MIN_TECHNIC][j];
891 s_ptr = &mp_ptr->info[creature_ptr->realm1 - 1][j];
893 if (s_ptr->slevel > creature_ptr->lev)
896 if (creature_ptr->spell_learned1 & (1L << j)) {
905 if ((creature_ptr->new_spells > k) && ((mp_ptr->spell_book == TV_LIFE_BOOK) || (mp_ptr->spell_book == TV_HISSATSU_BOOK))) {
906 creature_ptr->new_spells = (s16b)k;
910 if (creature_ptr->new_spells < 0)
911 creature_ptr->new_spells = 0;
913 if (creature_ptr->old_spells == creature_ptr->new_spells)
916 if (creature_ptr->new_spells) {
918 if (creature_ptr->new_spells < 10) {
919 msg_format("あと %d つの%sを学べる。", creature_ptr->new_spells, p);
921 msg_format("あと %d 個の%sを学べる。", creature_ptr->new_spells, p);
924 msg_format("You can learn %d more %s%s.", creature_ptr->new_spells, p, (creature_ptr->new_spells != 1) ? "s" : "");
928 creature_ptr->old_spells = creature_ptr->new_spells;
929 creature_ptr->redraw |= PR_STUDY;
930 creature_ptr->window |= PW_OBJECT;
934 * @brief プレイヤーの最大MPを計算する /
935 * Calculate maximum mana. You do not need to know any spells.
936 * Note that mana is lowered by heavy (or inappropriate) armor.
939 * This function induces status messages.
941 static void calc_mana(player_type *creature_ptr)
943 if (!mp_ptr->spell_book)
947 if ((creature_ptr->pclass == CLASS_MINDCRAFTER) || (creature_ptr->pclass == CLASS_MIRROR_MASTER) || (creature_ptr->pclass == CLASS_BLUE_MAGE)) {
948 levels = creature_ptr->lev;
950 if (mp_ptr->spell_first > creature_ptr->lev) {
951 creature_ptr->msp = 0;
952 creature_ptr->redraw |= (PR_MANA);
956 levels = (creature_ptr->lev - mp_ptr->spell_first) + 1;
960 if (creature_ptr->pclass == CLASS_SAMURAI) {
961 msp = (adj_mag_mana[creature_ptr->stat_ind[mp_ptr->spell_stat]] + 10) * 2;
963 msp += (msp * rp_ptr->r_adj[mp_ptr->spell_stat] / 20);
965 msp = adj_mag_mana[creature_ptr->stat_ind[mp_ptr->spell_stat]] * (levels + 3) / 4;
969 msp += (msp * rp_ptr->r_adj[mp_ptr->spell_stat] / 20);
970 if (msp && (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN))
972 if (msp && (creature_ptr->pclass == CLASS_HIGH_MAGE))
974 if (msp && (creature_ptr->pclass == CLASS_SORCERER))
975 msp += msp * (25 + creature_ptr->lev) / 100;
978 if (mp_ptr->spell_xtra & MAGIC_GLOVE_REDUCE_MANA) {
979 BIT_FLAGS flgs[TR_FLAG_SIZE];
980 creature_ptr->cumber_glove = FALSE;
982 o_ptr = &creature_ptr->inventory_list[INVEN_HANDS];
983 object_flags(creature_ptr, o_ptr, flgs);
984 if (o_ptr->k_idx && !(have_flag(flgs, TR_FREE_ACT)) && !(have_flag(flgs, TR_DEC_MANA)) && !(have_flag(flgs, TR_EASY_SPELL))
985 && !((have_flag(flgs, TR_MAGIC_MASTERY)) && (o_ptr->pval > 0)) && !((have_flag(flgs, TR_DEX)) && (o_ptr->pval > 0))) {
986 creature_ptr->cumber_glove = TRUE;
991 creature_ptr->cumber_armor = FALSE;
994 if (creature_ptr->inventory_list[INVEN_RARM].tval > TV_SWORD)
995 cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight;
996 if (creature_ptr->inventory_list[INVEN_LARM].tval > TV_SWORD)
997 cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight;
998 cur_wgt += creature_ptr->inventory_list[INVEN_BODY].weight;
999 cur_wgt += creature_ptr->inventory_list[INVEN_HEAD].weight;
1000 cur_wgt += creature_ptr->inventory_list[INVEN_OUTER].weight;
1001 cur_wgt += creature_ptr->inventory_list[INVEN_HANDS].weight;
1002 cur_wgt += creature_ptr->inventory_list[INVEN_FEET].weight;
1004 switch (creature_ptr->pclass) {
1006 case CLASS_HIGH_MAGE:
1007 case CLASS_BLUE_MAGE:
1009 case CLASS_FORCETRAINER:
1010 case CLASS_SORCERER: {
1011 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD)
1012 cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight;
1013 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD)
1014 cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight;
1019 case CLASS_TOURIST: {
1020 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD)
1021 cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight * 2 / 3;
1022 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD)
1023 cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight * 2 / 3;
1026 case CLASS_MINDCRAFTER:
1027 case CLASS_BEASTMASTER:
1028 case CLASS_MIRROR_MASTER: {
1029 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD)
1030 cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight / 2;
1031 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD)
1032 cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight / 2;
1037 case CLASS_RED_MAGE:
1038 case CLASS_WARRIOR_MAGE: {
1039 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD)
1040 cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight / 3;
1041 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD)
1042 cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight / 3;
1046 case CLASS_CHAOS_WARRIOR: {
1047 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD)
1048 cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight / 5;
1049 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD)
1050 cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight / 5;
1058 int max_wgt = mp_ptr->spell_weight;
1059 if ((cur_wgt - max_wgt) > 0) {
1060 creature_ptr->cumber_armor = TRUE;
1061 switch (creature_ptr->pclass) {
1063 case CLASS_HIGH_MAGE:
1064 case CLASS_BLUE_MAGE: {
1065 msp -= msp * (cur_wgt - max_wgt) / 600;
1069 case CLASS_MINDCRAFTER:
1070 case CLASS_BEASTMASTER:
1072 case CLASS_FORCETRAINER:
1074 case CLASS_MIRROR_MASTER: {
1075 msp -= msp * (cur_wgt - max_wgt) / 800;
1078 case CLASS_SORCERER: {
1079 msp -= msp * (cur_wgt - max_wgt) / 900;
1085 case CLASS_RED_MAGE: {
1086 msp -= msp * (cur_wgt - max_wgt) / 1000;
1090 case CLASS_CHAOS_WARRIOR:
1091 case CLASS_WARRIOR_MAGE: {
1092 msp -= msp * (cur_wgt - max_wgt) / 1200;
1095 case CLASS_SAMURAI: {
1096 creature_ptr->cumber_armor = FALSE;
1100 msp -= msp * (cur_wgt - max_wgt) / 800;
1109 if (creature_ptr->msp != msp) {
1110 if ((creature_ptr->csp >= msp) && (creature_ptr->pclass != CLASS_SAMURAI)) {
1111 creature_ptr->csp = msp;
1112 creature_ptr->csp_frac = 0;
1116 if (creature_ptr->level_up_message && (msp > creature_ptr->msp)) {
1117 msg_format("最大マジック・ポイントが %d 増加した!", (msp - creature_ptr->msp));
1120 creature_ptr->msp = msp;
1121 creature_ptr->redraw |= (PR_MANA);
1122 creature_ptr->window |= (PW_PLAYER | PW_SPELL);
1125 if (current_world_ptr->character_xtra)
1128 if (creature_ptr->old_cumber_glove != creature_ptr->cumber_glove) {
1129 if (creature_ptr->cumber_glove)
1130 msg_print(_("手が覆われて呪文が唱えにくい感じがする。", "Your covered hands feel unsuitable for spellcasting."));
1132 msg_print(_("この手の状態なら、ぐっと呪文が唱えやすい感じだ。", "Your hands feel more suitable for spellcasting."));
1134 creature_ptr->old_cumber_glove = creature_ptr->cumber_glove;
1137 if (creature_ptr->old_cumber_armor == creature_ptr->cumber_armor)
1140 if (creature_ptr->cumber_armor)
1141 msg_print(_("装備の重さで動きが鈍くなってしまっている。", "The weight of your equipment encumbers your movement."));
1143 msg_print(_("ぐっと楽に体を動かせるようになった。", "You feel able to move more freely."));
1145 creature_ptr->old_cumber_armor = creature_ptr->cumber_armor;
1149 * @brief 装備中の射撃武器の威力倍率を返す /
1150 * calcurate the fire rate of target object
1151 * @param o_ptr 計算する射撃武器のアイテム情報参照ポインタ
1152 * @return 射撃倍率の値(100で1.00倍)
1154 s16b calc_num_fire(player_type *creature_ptr, object_type *o_ptr)
1156 int extra_shots = 0;
1157 BIT_FLAGS flgs[TR_FLAG_SIZE];
1158 creature_ptr->num_fire = 100;
1159 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1161 q_ptr = &creature_ptr->inventory_list[i];
1168 object_flags(creature_ptr, q_ptr, flgs);
1169 if (have_flag(flgs, TR_XTRA_SHOTS))
1173 object_flags(creature_ptr, o_ptr, flgs);
1174 if (have_flag(flgs, TR_XTRA_SHOTS))
1178 if (o_ptr->k_idx == 0 || is_heavy_shoot(creature_ptr, o_ptr))
1182 num += (extra_shots * 100);
1184 tval_type tval_ammo = bow_tval_ammo(o_ptr);
1185 if ((creature_ptr->pclass == CLASS_RANGER) && (tval_ammo == TV_ARROW)) {
1186 num += (creature_ptr->lev * 4);
1189 if ((creature_ptr->pclass == CLASS_CAVALRY) && (tval_ammo == TV_ARROW)) {
1190 num += (creature_ptr->lev * 3);
1193 if (creature_ptr->pclass == CLASS_ARCHER) {
1194 if (tval_ammo == TV_ARROW)
1195 num += ((creature_ptr->lev * 5) + 50);
1196 else if ((tval_ammo == TV_BOLT) || (tval_ammo == TV_SHOT))
1197 num += (creature_ptr->lev * 4);
1200 if (creature_ptr->pclass == CLASS_WARRIOR && (tval_ammo <= TV_BOLT) && (tval_ammo >= TV_SHOT)) {
1201 num += (creature_ptr->lev * 2);
1204 if ((creature_ptr->pclass == CLASS_ROGUE) && (tval_ammo == TV_SHOT)) {
1205 num += (creature_ptr->lev * 4);
1213 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1217 * * 変異MUT3_INFRAVISによる加算(+3)
1218 * * 魔法効果tim_infraによる加算(+3)
1219 * * 装備がTR_INFRAフラグ持ちなら加算(+pval*1)
1221 static ACTION_SKILL_POWER calc_intra_vision(player_type *creature_ptr)
1223 ACTION_SKILL_POWER pow;
1224 const player_race *tmp_rp_ptr;
1226 if (creature_ptr->mimic_form)
1227 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1229 tmp_rp_ptr = &race_info[creature_ptr->prace];
1231 pow = tmp_rp_ptr->infra;
1233 if (creature_ptr->muta3 & MUT3_INFRAVIS) {
1237 if (creature_ptr->tim_infra) {
1241 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1243 BIT_FLAGS flgs[TR_FLAG_SIZE];
1244 o_ptr = &creature_ptr->inventory_list[i];
1247 object_flags(creature_ptr, o_ptr, flgs);
1248 if (have_flag(flgs, TR_INFRA))
1257 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1263 * * 装備による修正(TR_STEALTHがあれば+pval*1)
1264 * * 変異MUT3_XTRA_NOISで減算(-3)
1265 * * 変異MUT3_MOTIONで加算(+1)
1266 * * 呪術を唱えていると減算(-(詠唱数+1))
1267 * * セクシーギャルでない影フェアリーがTRC_AGGRAVATE持ちの時、別処理でTRC_AGGRAVATEを無効にする代わりに減算(-3か3未満なら(現在値+2)/2)
1269 * * 忍者がheavy_armorならば減算(-レベル/10)
1270 * * 忍者がheavy_armorでなく適正な武器を持っていれば加算(+レベル/10)
1274 static ACTION_SKILL_POWER calc_stealth(player_type *creature_ptr)
1276 ACTION_SKILL_POWER pow;
1277 const player_race *tmp_rp_ptr;
1279 if (creature_ptr->mimic_form)
1280 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1282 tmp_rp_ptr = &race_info[creature_ptr->prace];
1283 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1284 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1286 pow = 1 + tmp_rp_ptr->r_stl + c_ptr->c_stl + a_ptr->a_stl;
1287 pow += (c_ptr->x_stl * creature_ptr->lev / 10);
1289 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1291 BIT_FLAGS flgs[TR_FLAG_SIZE];
1292 o_ptr = &creature_ptr->inventory_list[i];
1295 object_flags(creature_ptr, o_ptr, flgs);
1296 if (have_flag(flgs, TR_STEALTH))
1300 if (creature_ptr->muta3 & MUT3_XTRA_NOIS) {
1303 if (creature_ptr->muta3 & MUT3_MOTION) {
1306 if (creature_ptr->realm1 == REALM_HEX) {
1307 if (hex_spelling_any(creature_ptr))
1308 pow -= (1 + casting_hex_num(creature_ptr));
1310 if ((is_specific_player_race(creature_ptr, RACE_S_FAIRY)) && (creature_ptr->pseikaku != PERSONALITY_SEXY) && (creature_ptr->cursed & TRC_AGGRAVATE)) {
1311 pow = MIN(pow - 3, (pow + 2) / 2);
1314 if (creature_ptr->shero) {
1318 if (creature_ptr->pclass == CLASS_NINJA && heavy_armor(creature_ptr)) {
1319 pow -= (creature_ptr->lev) / 10;
1320 } else if ((!creature_ptr->inventory_list[INVEN_RARM].k_idx || have_right_hand_weapon(creature_ptr))
1321 && (!creature_ptr->inventory_list[INVEN_LARM].k_idx || have_left_hand_weapon(creature_ptr))) {
1322 pow += (creature_ptr->lev) / 10;
1325 if (is_time_limit_stealth(creature_ptr))
1338 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1342 * * 職業と性格とレベルによる追加加算
1343 * * 器用さに応じたadj_dex_disテーブルによる加算
1344 * * 知力に応じたadj_int_disテーブルによる加算
1346 static ACTION_SKILL_POWER calc_disarming(player_type *creature_ptr)
1348 ACTION_SKILL_POWER pow;
1349 const player_race *tmp_rp_ptr;
1351 if (creature_ptr->mimic_form)
1352 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1354 tmp_rp_ptr = &race_info[creature_ptr->prace];
1355 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1356 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1358 pow = tmp_rp_ptr->r_dis + c_ptr->c_dis + a_ptr->a_dis;
1359 pow += ((cp_ptr->x_dis * creature_ptr->lev / 10) + (ap_ptr->a_dis * creature_ptr->lev / 50));
1360 pow += adj_dex_dis[creature_ptr->stat_ind[A_DEX]];
1361 pow += adj_int_dis[creature_ptr->stat_ind[A_INT]];
1367 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1371 * * 職業と性格とレベルによる追加加算
1372 * * 装備による加算(TR_MAGIC_MASTERYを持っていたら+pval*8)
1373 * * 知力に応じたadj_int_devテーブルによる加算
1376 static ACTION_SKILL_POWER calc_device_ability(player_type *creature_ptr)
1378 ACTION_SKILL_POWER pow;
1379 const player_race *tmp_rp_ptr;
1381 if (creature_ptr->mimic_form)
1382 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1384 tmp_rp_ptr = &race_info[creature_ptr->prace];
1385 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1386 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1388 pow = tmp_rp_ptr->r_dev + c_ptr->c_dev + a_ptr->a_dev;
1389 pow += ((c_ptr->x_dev * creature_ptr->lev / 10) + (ap_ptr->a_dev * creature_ptr->lev / 50));
1391 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1393 BIT_FLAGS flgs[TR_FLAG_SIZE];
1394 o_ptr = &creature_ptr->inventory_list[i];
1397 object_flags(creature_ptr, o_ptr, flgs);
1398 if (have_flag(flgs, TR_MAGIC_MASTERY))
1399 pow += 8 * o_ptr->pval;
1402 pow += adj_int_dev[creature_ptr->stat_ind[A_INT]];
1404 if (creature_ptr->shero) {
1412 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1416 * * 職業と性格とレベルによる追加加算
1417 * * 変異MUT3_MAGIC_RESによる加算(15 + レベル / 5)
1418 * * 賢さによるadj_wis_savテーブル加算
1420 * * 反魔法持ちで大なり上書き(90+レベル未満ならその値に上書き)
1421 * * クターのつぶれ状態なら(10に上書き)
1422 * * 生命の「究極の耐性」や regist_magic,magicdef持ちなら大なり上書き(95+レベル未満ならその値に上書き)
1423 * * 呪いのdown_savingがかかっているなら半減
1425 static ACTION_SKILL_POWER calc_saving_throw(player_type *creature_ptr)
1427 ACTION_SKILL_POWER pow;
1428 const player_race *tmp_rp_ptr;
1430 if (creature_ptr->mimic_form)
1431 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1433 tmp_rp_ptr = &race_info[creature_ptr->prace];
1434 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1435 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1437 pow = tmp_rp_ptr->r_sav + c_ptr->c_sav + a_ptr->a_sav;
1438 pow += ((cp_ptr->x_sav * creature_ptr->lev / 10) + (ap_ptr->a_sav * creature_ptr->lev / 50));
1440 if (creature_ptr->muta3 & MUT3_MAGIC_RES)
1441 pow += (15 + (creature_ptr->lev / 5));
1443 pow += adj_wis_sav[creature_ptr->stat_ind[A_WIS]];
1445 if (creature_ptr->shero)
1448 if (creature_ptr->anti_magic && (pow < (90 + creature_ptr->lev)))
1449 pow = 90 + creature_ptr->lev;
1451 if (creature_ptr->tsubureru)
1454 if ((creature_ptr->ult_res || creature_ptr->resist_magic || creature_ptr->magicdef) && (pow < (95 + creature_ptr->lev)))
1455 pow = 95 + creature_ptr->lev;
1457 if (creature_ptr->down_saving)
1465 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1470 * * 各装備による加算(TR_SEARCHがあれば+pval*5)
1472 * * 変異(MUT3_XTRA_EYES)による加算(+15)
1474 static ACTION_SKILL_POWER calc_search(player_type *creature_ptr)
1476 ACTION_SKILL_POWER pow;
1477 const player_race *tmp_rp_ptr;
1479 if (creature_ptr->mimic_form)
1480 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1482 tmp_rp_ptr = &race_info[creature_ptr->prace];
1483 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1484 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1486 pow = tmp_rp_ptr->r_srh + c_ptr->c_srh + a_ptr->a_srh;
1487 pow += (c_ptr->x_srh * creature_ptr->lev / 10);
1489 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1491 BIT_FLAGS flgs[TR_FLAG_SIZE];
1492 o_ptr = &creature_ptr->inventory_list[i];
1495 object_flags(creature_ptr, o_ptr, flgs);
1496 if (have_flag(flgs, TR_SEARCH))
1497 pow += (o_ptr->pval * 5);
1500 if (creature_ptr->muta3 & MUT3_XTRA_EYES) {
1504 if (creature_ptr->shero) {
1513 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1518 * * 各装備による加算(TR_SEARCHがあれば+pval*5)
1520 * * 変異(MUT3_XTRA_EYES)による加算(+15)
1522 static ACTION_SKILL_POWER calc_search_freq(player_type *creature_ptr)
1524 ACTION_SKILL_POWER pow;
1525 const player_race *tmp_rp_ptr;
1527 if (creature_ptr->mimic_form)
1528 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1530 tmp_rp_ptr = &race_info[creature_ptr->prace];
1531 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1532 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1534 pow = tmp_rp_ptr->r_fos + c_ptr->c_fos + a_ptr->a_fos;
1535 pow += (c_ptr->x_fos * creature_ptr->lev / 10);
1537 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1539 BIT_FLAGS flgs[TR_FLAG_SIZE];
1540 o_ptr = &creature_ptr->inventory_list[i];
1543 object_flags(creature_ptr, o_ptr, flgs);
1544 if (have_flag(flgs, TR_SEARCH))
1545 pow += (o_ptr->pval * 5);
1548 if (creature_ptr->shero) {
1552 if (creature_ptr->muta3 & MUT3_XTRA_EYES) {
1561 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1564 * * 種族/職業/性格による加算とレベルによる追加加算
1566 static ACTION_SKILL_POWER calc_to_hit_melee(player_type *creature_ptr)
1568 ACTION_SKILL_POWER pow;
1569 const player_race *tmp_rp_ptr;
1570 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1571 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1573 if (creature_ptr->mimic_form)
1574 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1576 tmp_rp_ptr = &race_info[creature_ptr->prace];
1578 pow = tmp_rp_ptr->r_thn + c_ptr->c_thn + a_ptr->a_thn;
1579 pow += ((c_ptr->x_thn * creature_ptr->lev / 10) + (a_ptr->a_thn * creature_ptr->lev / 50));
1585 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1588 * * 種族/職業/性格による加算とレベルによる追加加算
1590 static ACTION_SKILL_POWER calc_to_hit_shoot(player_type *creature_ptr)
1592 ACTION_SKILL_POWER pow;
1593 const player_race *tmp_rp_ptr;
1594 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1595 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1597 if (creature_ptr->mimic_form)
1598 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1600 tmp_rp_ptr = &race_info[creature_ptr->prace];
1602 pow = tmp_rp_ptr->r_thb + c_ptr->c_thb + a_ptr->a_thb;
1603 pow += ((c_ptr->x_thb * creature_ptr->lev / 10) + (a_ptr->a_thb * creature_ptr->lev / 50));
1609 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1612 * * 種族/職業/性格による加算とレベルによる追加加算
1615 static ACTION_SKILL_POWER calc_to_hit_throw(player_type *creature_ptr)
1617 ACTION_SKILL_POWER pow;
1618 const player_race *tmp_rp_ptr;
1619 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1620 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1622 if (creature_ptr->mimic_form)
1623 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1625 tmp_rp_ptr = &race_info[creature_ptr->prace];
1627 pow = tmp_rp_ptr->r_thb + c_ptr->c_thb + a_ptr->a_thb;
1628 pow += ((c_ptr->x_thb * creature_ptr->lev / 10) + (a_ptr->a_thb * creature_ptr->lev / 50));
1630 if (creature_ptr->shero) {
1639 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1650 static ACTION_SKILL_POWER calc_skill_dig(player_type *creature_ptr)
1653 BIT_FLAGS flgs[TR_FLAG_SIZE];
1655 ACTION_SKILL_POWER pow;
1659 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_ENT && !creature_ptr->inventory_list[INVEN_RARM].k_idx) {
1660 pow += creature_ptr->lev * 10;
1663 if (creature_ptr->shero)
1666 pow += adj_str_dig[creature_ptr->stat_ind[A_STR]];
1668 if (creature_ptr->pclass == CLASS_BERSERKER)
1669 pow += (100 + creature_ptr->lev * 8);
1671 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1672 o_ptr = &creature_ptr->inventory_list[i];
1675 object_flags(creature_ptr, o_ptr, flgs);
1676 if (have_flag(flgs, TR_TUNNEL))
1677 pow += (o_ptr->pval * 20);
1680 for (int i = 0; i < 2; i++) {
1681 o_ptr = &creature_ptr->inventory_list[INVEN_RARM + i];
1682 if (has_melee_weapon(creature_ptr, INVEN_RARM + i) && !creature_ptr->heavy_wield[i]) {
1683 pow += (o_ptr->weight / 10);
1687 if (creature_ptr->shero) {
1697 static bool is_martial_arts_mode(player_type *creature_ptr)
1699 return ((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER) || (creature_ptr->pclass == CLASS_BERSERKER))
1700 && (empty_hands(creature_ptr, TRUE) & EMPTY_HAND_RARM) && !have_left_hand_weapon(creature_ptr);
1703 static s16b calc_num_blow(player_type *creature_ptr, int i)
1706 BIT_FLAGS flgs[TR_FLAG_SIZE];
1709 o_ptr = &creature_ptr->inventory_list[INVEN_RARM + i];
1710 object_flags(creature_ptr, o_ptr, flgs);
1711 creature_ptr->heavy_wield[i] = FALSE;
1712 if (!has_melee_weapon(creature_ptr, INVEN_RARM + i)) {
1715 if (calc_weapon_weight_limit(creature_ptr) < o_ptr->weight / 10) {
1716 creature_ptr->heavy_wield[i] = TRUE;
1719 if (o_ptr->k_idx && !creature_ptr->heavy_wield[i]) {
1720 int str_index, dex_index;
1721 int num = 0, wgt = 0, mul = 0, div = 0;
1723 num = class_info[creature_ptr->pclass].num;
1724 wgt = class_info[creature_ptr->pclass].wgt;
1725 mul = class_info[creature_ptr->pclass].mul;
1727 if (creature_ptr->pclass == CLASS_CAVALRY && (creature_ptr->riding) && (have_flag(flgs, TR_RIDING))) {
1733 if (hex_spelling(creature_ptr, HEX_XTRA_MIGHT) || hex_spelling(creature_ptr, HEX_BUILDING)) {
1739 div = ((o_ptr->weight < wgt) ? wgt : o_ptr->weight);
1740 str_index = (adj_str_blow[creature_ptr->stat_ind[A_STR]] * mul / div);
1742 if (have_two_handed_weapons(creature_ptr) && !is_disable_two_handed_bonus(creature_ptr, 0))
1744 if (creature_ptr->pclass == CLASS_NINJA)
1745 str_index = MAX(0, str_index - 1);
1749 dex_index = (adj_dex_blow[creature_ptr->stat_ind[A_DEX]]);
1753 num_blow = blows_table[str_index][dex_index];
1755 num_blow = (s16b)num;
1757 num_blow += (s16b)creature_ptr->extra_blows[i];
1758 if (creature_ptr->pclass == CLASS_WARRIOR)
1759 num_blow += (creature_ptr->lev / 40);
1760 else if (creature_ptr->pclass == CLASS_BERSERKER)
1761 num_blow += (creature_ptr->lev / 23);
1762 else if ((creature_ptr->pclass == CLASS_ROGUE) && (o_ptr->weight < 50) && (creature_ptr->stat_ind[A_DEX] >= 30))
1765 if (creature_ptr->special_defense & KATA_FUUJIN)
1768 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_POISON_NEEDLE))
1778 /* Different calculation for monks with empty hands */
1779 if (is_martial_arts_mode(creature_ptr)) {
1780 int blow_base = creature_ptr->lev + adj_dex_blow[creature_ptr->stat_ind[A_DEX]];
1783 if (creature_ptr->pclass == CLASS_FORCETRAINER) {
1793 MAGIC_NUM1 current_ki = get_current_ki(creature_ptr);
1794 if (current_ki != i) {
1795 creature_ptr->to_d[i] += current_ki / 5;
1796 creature_ptr->dis_to_d[i] += current_ki / 5;
1815 if (heavy_armor(creature_ptr) && (creature_ptr->pclass != CLASS_BERSERKER))
1818 if (creature_ptr->special_defense & KAMAE_GENBU) {
1819 creature_ptr->to_a += (creature_ptr->lev * creature_ptr->lev) / 50;
1820 creature_ptr->dis_to_a += (creature_ptr->lev * creature_ptr->lev) / 50;
1822 if ((creature_ptr->pclass == CLASS_MONK) && (creature_ptr->lev > 42))
1826 } else if (creature_ptr->special_defense & KAMAE_SUZAKU) {
1827 creature_ptr->to_h[i] -= (creature_ptr->lev / 3);
1828 creature_ptr->to_d[i] -= (creature_ptr->lev / 6);
1830 creature_ptr->dis_to_h[i] -= (creature_ptr->lev / 3);
1831 creature_ptr->dis_to_d[i] -= (creature_ptr->lev / 6);
1835 num_blow += 1 + creature_ptr->extra_blows[0];
1838 if (is_not_ninja_weapon(creature_ptr, i)) {
1849 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1853 * * エントは別途レベル26,41,46到達ごとに加算(+1)
1854 * * 装備がTR_STRフラグを持っていれば加算(+pval*1)
1860 * * 変異MUT3_HYPER_STRで加算(+4)
1861 * * 変異MUT3_PUNYで減算(-4)
1862 * * ネオ・つよしスペシャル中で加算(+4)
1864 static s16b calc_strength_addition(player_type *creature_ptr)
1867 const player_race *tmp_rp_ptr;
1868 if (creature_ptr->mimic_form)
1869 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1871 tmp_rp_ptr = &race_info[creature_ptr->prace];
1872 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1873 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1874 pow = tmp_rp_ptr->r_adj[A_STR] + c_ptr->c_adj[A_STR] + a_ptr->a_adj[A_STR];
1876 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_ENT) {
1877 if (creature_ptr->lev > 25)
1879 if (creature_ptr->lev > 40)
1881 if (creature_ptr->lev > 45)
1885 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1887 BIT_FLAGS flgs[TR_FLAG_SIZE];
1888 o_ptr = &creature_ptr->inventory_list[i];
1891 object_flags(creature_ptr, o_ptr, flgs);
1892 if (have_flag(flgs, TR_STR)) {
1897 if (creature_ptr->realm1 == REALM_HEX) {
1898 if (hex_spelling(creature_ptr, HEX_XTRA_MIGHT)) {
1901 if (hex_spelling(creature_ptr, HEX_BUILDING)) {
1906 if (creature_ptr->special_defense & KATA_KOUKIJIN) {
1910 if (creature_ptr->special_defense & KAMAE_BYAKKO) {
1912 } else if (creature_ptr->special_defense & KAMAE_SUZAKU) {
1916 if (creature_ptr->muta3) {
1918 if (creature_ptr->muta3 & MUT3_HYPER_STR) {
1922 if (creature_ptr->muta3 & MUT3_PUNY) {
1927 if (creature_ptr->tsuyoshi) {
1935 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1939 * * 装備がTR_INTフラグを持っていれば加算(+pval*1)
1945 * * 変異MUT3_HYPER_INTで加算(+4)
1946 * * 変異MUT3_MORONICで減算(-4)
1948 s16b calc_intelligence_addition(player_type *creature_ptr)
1951 const player_race *tmp_rp_ptr;
1952 if (creature_ptr->mimic_form)
1953 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1955 tmp_rp_ptr = &race_info[creature_ptr->prace];
1956 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1957 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1958 pow = tmp_rp_ptr->r_adj[A_INT] + c_ptr->c_adj[A_INT] + a_ptr->a_adj[A_INT];
1960 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1962 BIT_FLAGS flgs[TR_FLAG_SIZE];
1963 o_ptr = &creature_ptr->inventory_list[i];
1966 object_flags(creature_ptr, o_ptr, flgs);
1967 if (have_flag(flgs, TR_INT)) {
1972 if (creature_ptr->special_defense & KATA_KOUKIJIN) {
1976 if (creature_ptr->special_defense & KAMAE_GENBU) {
1978 } else if (creature_ptr->special_defense & KAMAE_SUZAKU) {
1982 if (creature_ptr->muta3) {
1983 if (creature_ptr->muta3 & MUT3_HYPER_INT) {
1987 if (creature_ptr->muta3 & MUT3_MORONIC) {
1997 * @param creature_ptr 計算するクリーチャーの参照ポインタ
2001 * * 装備がTR_WISフラグを持っていれば加算(+pval*1)
2007 * * 変異MUT3_HYPER_INTで加算(+4)
2008 * * 変異MUT3_MORONICで減算(-4)
2010 static s16b calc_wisdom_addition(player_type *creature_ptr)
2013 const player_race *tmp_rp_ptr;
2014 if (creature_ptr->mimic_form)
2015 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
2017 tmp_rp_ptr = &race_info[creature_ptr->prace];
2018 const player_class *c_ptr = &class_info[creature_ptr->pclass];
2019 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
2020 pow = tmp_rp_ptr->r_adj[A_WIS] + c_ptr->c_adj[A_WIS] + a_ptr->a_adj[A_WIS];
2022 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2024 BIT_FLAGS flgs[TR_FLAG_SIZE];
2025 o_ptr = &creature_ptr->inventory_list[i];
2028 object_flags(creature_ptr, o_ptr, flgs);
2029 if (have_flag(flgs, TR_WIS)) {
2034 if (creature_ptr->special_defense & KATA_KOUKIJIN) {
2038 if (creature_ptr->special_defense & KAMAE_GENBU) {
2040 } else if (creature_ptr->special_defense & KAMAE_SUZAKU) {
2044 if (creature_ptr->muta3) {
2046 if (creature_ptr->muta3 & MUT3_HYPER_INT) {
2050 if (creature_ptr->muta3 & MUT3_MORONIC) {
2060 * @param creature_ptr 計算するクリーチャーの参照ポインタ
2064 * * エントは別途レベル26,41,46到達ごとに減算(-1)
2065 * * 装備がTR_DEXフラグを持っていれば加算(+pval*1)
2071 * * 変異MUT3_IRON_SKINで減算(-1)
2072 * * 変異MUT3_LIMBERで加算(+3)
2073 * * 変異MUT3_ARTHRITISで減算(-3)
2075 static s16b calc_dexterity_addition(player_type *creature_ptr)
2078 const player_race *tmp_rp_ptr;
2079 if (creature_ptr->mimic_form)
2080 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
2082 tmp_rp_ptr = &race_info[creature_ptr->prace];
2083 const player_class *c_ptr = &class_info[creature_ptr->pclass];
2084 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
2085 pow = tmp_rp_ptr->r_adj[A_DEX] + c_ptr->c_adj[A_DEX] + a_ptr->a_adj[A_DEX];
2087 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_ENT) {
2088 if (creature_ptr->lev > 25)
2090 if (creature_ptr->lev > 40)
2092 if (creature_ptr->lev > 45)
2096 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2098 BIT_FLAGS flgs[TR_FLAG_SIZE];
2099 o_ptr = &creature_ptr->inventory_list[i];
2102 object_flags(creature_ptr, o_ptr, flgs);
2103 if (have_flag(flgs, TR_DEX)) {
2108 if (creature_ptr->realm1 == REALM_HEX) {
2109 if (hex_spelling(creature_ptr, HEX_BUILDING)) {
2114 if (creature_ptr->special_defense & KATA_KOUKIJIN) {
2118 if (creature_ptr->special_defense & KAMAE_BYAKKO) {
2120 } else if (creature_ptr->special_defense & KAMAE_GENBU) {
2122 } else if (creature_ptr->special_defense & KAMAE_SUZAKU) {
2126 if (creature_ptr->muta3 & MUT3_IRON_SKIN) {
2130 if (creature_ptr->muta3 & MUT3_LIMBER) {
2134 if (creature_ptr->muta3 & MUT3_ARTHRITIS) {
2143 * @param creature_ptr 計算するクリーチャーの参照ポインタ
2147 * * エントは別途レベル26,41,46到達ごとに加算(+1)
2148 * * 装備がTR_CONフラグを持っていれば加算(+pval*1)
2154 * * 変異MUT3_RESILIENTで加算(+4)
2155 * * 変異MUT3_ALBINOで減算(-4)
2156 * * 変異MUT3_XTRA_FATで加算(+2)
2157 * * 変異MUT3_FLESH_ROTで減算(-2)
2158 * * ネオ・つよしスペシャル中で加算(+4)
2160 static s16b calc_constitution_addition(player_type *creature_ptr)
2163 const player_race *tmp_rp_ptr;
2164 if (creature_ptr->mimic_form)
2165 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
2167 tmp_rp_ptr = &race_info[creature_ptr->prace];
2168 const player_class *c_ptr = &class_info[creature_ptr->pclass];
2169 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
2170 pow = tmp_rp_ptr->r_adj[A_CON] + c_ptr->c_adj[A_CON] + a_ptr->a_adj[A_CON];
2172 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_ENT) {
2173 if (creature_ptr->lev > 25)
2175 if (creature_ptr->lev > 40)
2177 if (creature_ptr->lev > 45)
2181 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2183 BIT_FLAGS flgs[TR_FLAG_SIZE];
2184 o_ptr = &creature_ptr->inventory_list[i];
2187 object_flags(creature_ptr, o_ptr, flgs);
2188 if (have_flag(flgs, TR_CON))
2192 if (creature_ptr->realm1 == REALM_HEX) {
2193 if (hex_spelling(creature_ptr, HEX_BUILDING)) {
2198 if (creature_ptr->special_defense & KATA_KOUKIJIN) {
2202 if (creature_ptr->special_defense & KAMAE_BYAKKO) {
2204 } else if (creature_ptr->special_defense & KAMAE_GENBU) {
2206 } else if (creature_ptr->special_defense & KAMAE_SUZAKU) {
2210 if (creature_ptr->muta3) {
2211 if (creature_ptr->muta3 & MUT3_RESILIENT) {
2215 if (creature_ptr->muta3 & MUT3_ALBINO) {
2219 if (creature_ptr->muta3 & MUT3_XTRA_FAT) {
2223 if (creature_ptr->muta3 & MUT3_FLESH_ROT) {
2228 if (creature_ptr->tsuyoshi) {
2237 * @param creature_ptr 計算するクリーチャーの参照ポインタ
2241 * * 装備がTR_CHRフラグを持っていれば加算(+pval*1)
2244 * * 変異MUT3_FLESH_ROTで減算(-1)
2245 * * 変異MUT3_SILLY_VOIで減算(-4)
2246 * * 変異MUT3_BLANK_FACで減算(-1)
2247 * * 変異MUT3_WART_SKINで減算(-2)
2248 * * 変異MUT3_SCALESで減算(-1)
2249 * * 変異MUT3_ILL_NORMで0固定(後で個体値のみ上書きを行う)
2251 static s16b calc_charisma_addition(player_type *creature_ptr)
2254 const player_race *tmp_rp_ptr;
2255 if (creature_ptr->mimic_form)
2256 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
2258 tmp_rp_ptr = &race_info[creature_ptr->prace];
2259 const player_class *c_ptr = &class_info[creature_ptr->pclass];
2260 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
2261 pow = tmp_rp_ptr->r_adj[A_CHR] + c_ptr->c_adj[A_CHR] + a_ptr->a_adj[A_CHR];
2263 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2265 BIT_FLAGS flgs[TR_FLAG_SIZE];
2266 o_ptr = &creature_ptr->inventory_list[i];
2269 object_flags(creature_ptr, o_ptr, flgs);
2270 if (have_flag(flgs, TR_CHR))
2274 if (creature_ptr->special_defense & KATA_KOUKIJIN) {
2278 if (creature_ptr->muta3) {
2279 if (creature_ptr->muta3 & MUT3_FLESH_ROT) {
2282 if (creature_ptr->muta3 & MUT3_SILLY_VOI) {
2285 if (creature_ptr->muta3 & MUT3_BLANK_FAC) {
2288 if (creature_ptr->muta3 & MUT3_WART_SKIN) {
2291 if (creature_ptr->muta3 & MUT3_SCALES) {
2294 if (creature_ptr->muta3 & MUT3_ILL_NORM) {
2304 * @param creature_ptr 計算するクリーチャーの参照ポインタ
2307 * * 性格なまけものなら加算(+10)
2309 * * 性格ちからじまんとがまんづよいなら加算(+1)
2310 * * 性格チャージマンなら加算(+5)
2311 * * 装備品にTRC_LOW_MAGICがあるなら加算(軽い呪いなら+3/重い呪いなら+10)
2313 static s16b calc_to_magic_chance(player_type *creature_ptr)
2317 if (creature_ptr->pseikaku == PERSONALITY_LAZY)
2319 if (creature_ptr->pseikaku == PERSONALITY_SHREWD)
2321 if ((creature_ptr->pseikaku == PERSONALITY_PATIENT) || (creature_ptr->pseikaku == PERSONALITY_MIGHTY))
2323 if (creature_ptr->pseikaku == PERSONALITY_CHARGEMAN)
2326 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2328 BIT_FLAGS flgs[TR_FLAG_SIZE];
2329 o_ptr = &creature_ptr->inventory_list[i];
2332 object_flags(creature_ptr, o_ptr, flgs);
2333 if (o_ptr->curse_flags & TRC_LOW_MAGIC) {
2334 if (o_ptr->curse_flags & TRC_HEAVY_CURSE) {
2344 static ARMOUR_CLASS calc_base_ac(player_type *creature_ptr)
2346 ARMOUR_CLASS ac = 0;
2347 if (creature_ptr->yoiyami)
2350 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2352 o_ptr = &creature_ptr->inventory_list[i];
2358 if (object_is_armour(creature_ptr, &creature_ptr->inventory_list[INVEN_RARM])
2359 || object_is_armour(creature_ptr, &creature_ptr->inventory_list[INVEN_LARM])) {
2360 ac += creature_ptr->skill_exp[GINOU_SHIELD] * (1 + creature_ptr->lev / 22) / 2000;
2366 static ARMOUR_CLASS calc_to_ac(player_type *creature_ptr, bool is_true_value)
2368 ARMOUR_CLASS ac = 0;
2369 if (creature_ptr->yoiyami)
2372 ac += ((int)(adj_dex_ta[creature_ptr->stat_ind[A_DEX]]) - 128);
2374 if (creature_ptr->mimic_form) {
2375 switch (creature_ptr->mimic_form) {
2379 case MIMIC_DEMON_LORD:
2387 if (creature_ptr->pclass == CLASS_BERSERKER) {
2388 ac += 10 + creature_ptr->lev / 2;
2390 if (creature_ptr->pclass == CLASS_SORCERER) {
2394 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2396 o_ptr = &creature_ptr->inventory_list[i];
2399 if (is_true_value || object_is_known(o_ptr))
2402 if (o_ptr->curse_flags & TRC_LOW_AC) {
2403 if (o_ptr->curse_flags & TRC_HEAVY_CURSE) {
2404 if (is_true_value || object_is_fully_known(o_ptr))
2407 if (is_true_value || object_is_fully_known(o_ptr))
2412 if ((i == INVEN_LARM) && (o_ptr->tval == TV_SWORD) && ((o_ptr->sval == SV_MAIN_GAUCHE) || (o_ptr->sval == SV_WAKIZASHI))) {
2417 if (is_specific_player_race(creature_ptr, RACE_GOLEM) || is_specific_player_race(creature_ptr, RACE_ANDROID)) {
2418 ac += 10 + (creature_ptr->lev * 2 / 5);
2421 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_QUICKTHORN) && (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_TINYTHORN)) {
2425 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI)) {
2429 if (creature_ptr->muta3 & MUT3_WART_SKIN) {
2433 if (creature_ptr->muta3 & MUT3_SCALES) {
2437 if (creature_ptr->muta3 & MUT3_IRON_SKIN) {
2441 if (((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER)) && !heavy_armor(creature_ptr)) {
2442 if (!(creature_ptr->inventory_list[INVEN_BODY].k_idx)) {
2443 ac += (creature_ptr->lev * 3) / 2;
2445 if (!(creature_ptr->inventory_list[INVEN_OUTER].k_idx) && (creature_ptr->lev > 15)) {
2446 ac += ((creature_ptr->lev - 13) / 3);
2448 if (!(creature_ptr->inventory_list[INVEN_LARM].k_idx) && (creature_ptr->lev > 10)) {
2449 ac += ((creature_ptr->lev - 8) / 3);
2451 if (!(creature_ptr->inventory_list[INVEN_HEAD].k_idx) && (creature_ptr->lev > 4)) {
2452 ac += (creature_ptr->lev - 2) / 3;
2454 if (!(creature_ptr->inventory_list[INVEN_HANDS].k_idx)) {
2455 ac += (creature_ptr->lev / 2);
2457 if (!(creature_ptr->inventory_list[INVEN_FEET].k_idx)) {
2458 ac += (creature_ptr->lev / 3);
2462 if (creature_ptr->realm1 == REALM_HEX) {
2463 if (hex_spelling(creature_ptr, HEX_ICE_ARMOR)) {
2467 for (inventory_slot_type i = INVEN_RARM; i <= INVEN_FEET; i++) {
2468 object_type *o_ptr = &creature_ptr->inventory_list[i];
2471 if (!object_is_armour(creature_ptr, o_ptr))
2473 if (!object_is_cursed(o_ptr))
2475 if (o_ptr->curse_flags & TRC_CURSED)
2477 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
2479 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
2484 if (creature_ptr->special_defense & KAMAE_BYAKKO) {
2486 } else if (creature_ptr->special_defense & KAMAE_SEIRYU) {
2488 } else if (creature_ptr->special_defense & KATA_KOUKIJIN) {
2492 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
2494 } else if (creature_ptr->tsubureru || creature_ptr->shield || creature_ptr->magicdef) {
2498 if (is_blessed(creature_ptr)) {
2502 if (creature_ptr->shero) {
2506 if (creature_ptr->pclass == CLASS_NINJA) {
2507 if ((!creature_ptr->inventory_list[INVEN_RARM].k_idx || have_right_hand_weapon(creature_ptr))
2508 && (!creature_ptr->inventory_list[INVEN_LARM].k_idx || have_left_hand_weapon(creature_ptr))) {
2509 ac += creature_ptr->lev / 2 + 5;
2518 * @param creature_ptr 計算するクリーチャーの参照ポインタ
2523 * ** クラッコンと妖精に加算(+レベル/10)
2524 * ** 悪魔変化/吸血鬼変化で加算(+3)
2526 * ** 装備品にTR_SPEEDがあれば加算(+pval+1
2527 * ** 忍者の装備が重ければ減算(-レベル/10)
2528 * ** 忍者の装備が適正ならば加算(+3)さらにクラッコン、妖精、いかさま以外なら加算(+レベル/10)
2529 * ** 錬気術師で装備が重くなくクラッコン、妖精、いかさま以外なら加算(+レベル/10)
2530 * ** 狂戦士なら加算(+3),レベル20/30/40/50ごとに+1
2531 * ** いかさまでクラッコン/妖精以外なら加算(+5+レベル/10)
2534 * ** 呪術「衝撃のクローク」で加算(+3)
2537 * ** 変異MUT3_XTRA_FATなら減算(-2)
2538 * ** 変異MUT3_XTRA_LEGなら加算(+3)
2539 * ** 変異MUT3_SHORT_LEGなら減算(-3)
2540 * ** マーフォークがFF_WATER地形にいれば加算(+2+レベル/10)
2541 * ** そうでなく浮遊を持っていないなら減算(-2)
2542 * ** 棘セット装備中ならば加算(+7)
2543 * * 騎乗中ならばモンスターの加速に準拠、ただし騎乗技能値とモンスターレベルによるキャップ処理あり
2545 * * 光速移動中かこの時点で+99を超えていたら+99にキャップ
2548 static s16b calc_speed(player_type *creature_ptr)
2550 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
2551 feature_type *f_ptr = &f_info[floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat];
2555 int j = creature_ptr->total_weight;
2558 if (!creature_ptr->riding) {
2559 count = (int)weight_limit(creature_ptr);
2561 const player_race *tmp_rp_ptr;
2562 if (creature_ptr->mimic_form)
2563 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
2565 tmp_rp_ptr = &race_info[creature_ptr->prace];
2567 if (is_specific_player_race(creature_ptr, RACE_KLACKON) || is_specific_player_race(creature_ptr, RACE_SPRITE))
2568 pow += (creature_ptr->lev) / 10;
2570 if (creature_ptr->mimic_form) {
2571 switch (creature_ptr->mimic_form) {
2575 case MIMIC_DEMON_LORD:
2584 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2585 object_type *o_ptr = &creature_ptr->inventory_list[i];
2586 BIT_FLAGS flgs[TR_FLAG_SIZE];
2587 object_flags(creature_ptr, o_ptr, flgs);
2591 if (have_flag(flgs, TR_SPEED))
2595 if (creature_ptr->pclass == CLASS_NINJA) {
2596 if (heavy_armor(creature_ptr)) {
2597 pow -= (creature_ptr->lev) / 10;
2598 } else if ((!creature_ptr->inventory_list[INVEN_RARM].k_idx || have_right_hand_weapon(creature_ptr))
2599 && (!creature_ptr->inventory_list[INVEN_LARM].k_idx || have_left_hand_weapon(creature_ptr))) {
2601 if (!(is_specific_player_race(creature_ptr, RACE_KLACKON) || is_specific_player_race(creature_ptr, RACE_SPRITE)
2602 || (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN)))
2603 pow += (creature_ptr->lev) / 10;
2607 if (creature_ptr->pclass == CLASS_FORCETRAINER && !(heavy_armor(creature_ptr))) {
2608 if (!(is_specific_player_race(creature_ptr, RACE_KLACKON) || is_specific_player_race(creature_ptr, RACE_SPRITE)
2609 || (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN)))
2610 pow += (creature_ptr->lev) / 10;
2613 if (creature_ptr->pclass == CLASS_BERSERKER) {
2615 if (creature_ptr->lev > 29)
2617 if (creature_ptr->lev > 39)
2619 if (creature_ptr->lev > 44)
2621 if (creature_ptr->lev > 49)
2625 if (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN && creature_ptr->prace != RACE_KLACKON && creature_ptr->prace != RACE_SPRITE) {
2626 pow += (creature_ptr->lev) / 10 + 5;
2629 if (is_fast(creature_ptr)) {
2633 if (creature_ptr->slow) {
2637 if (creature_ptr->realm1 == REALM_HEX) {
2638 if (hex_spelling(creature_ptr, HEX_SHOCK_CLOAK)) {
2643 if (creature_ptr->food >= PY_FOOD_MAX)
2646 if (creature_ptr->special_defense & KAMAE_SUZAKU)
2649 if (creature_ptr->muta3) {
2651 if (creature_ptr->muta3 & MUT3_XTRA_FAT) {
2655 if (creature_ptr->muta3 & MUT3_XTRA_LEGS) {
2659 if (creature_ptr->muta3 & MUT3_SHORT_LEG) {
2664 if (creature_ptr->prace == RACE_MERFOLK) {
2665 if (have_flag(f_ptr->flags, FF_WATER)) {
2666 pow += (2 + creature_ptr->lev / 10);
2667 } else if (!creature_ptr->levitation) {
2672 if (has_melee_weapon(creature_ptr, INVEN_RARM) && has_melee_weapon(creature_ptr, INVEN_LARM)) {
2673 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_QUICKTHORN) && (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_TINYTHORN)) {
2679 monster_type *riding_m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding];
2680 monster_race *riding_r_ptr = &r_info[riding_m_ptr->r_idx];
2681 SPEED speed = riding_m_ptr->mspeed;
2683 if (riding_m_ptr->mspeed > 110) {
2684 pow = 110 + (s16b)((speed - 110) * (creature_ptr->skill_exp[GINOU_RIDING] * 3 + creature_ptr->lev * 160L - 10000L) / (22000L));
2691 pow += (creature_ptr->skill_exp[GINOU_RIDING] + creature_ptr->lev * 160L) / 3200;
2693 if (monster_fast_remaining(riding_m_ptr))
2695 if (monster_slow_remaining(riding_m_ptr))
2698 if (creature_ptr->skill_exp[GINOU_RIDING] < RIDING_EXP_SKILLED)
2699 j += (creature_ptr->wt * 3 * (RIDING_EXP_SKILLED - creature_ptr->skill_exp[GINOU_RIDING])) / RIDING_EXP_SKILLED;
2701 count = 1500 + riding_r_ptr->level * 25;
2703 pow -= ((j - count) / (count / 5));
2707 if (creature_ptr->action == ACTION_SEARCH)
2710 /* Maximum speed is (+99). (internally it's 110 + 99) */
2711 /* Temporary lightspeed forces to be maximum speed */
2712 if ((creature_ptr->lightspeed && !creature_ptr->riding) || (pow > 209)) {
2716 /* Minimum speed is (-99). (internally it's 110 - 99) */
2724 * @brief 二刀流ペナルティ量計算
2725 * @param creature_ptr 計算するクリーチャーの参照ポインタ
2726 * @param slot ペナルティ量を計算する武器スロット
2732 * * マンゴーシュ/脇差を左に装備した場合の軽減
2736 s16b calc_double_weapon_penalty(player_type *creature_ptr, INVENTORY_IDX slot)
2739 if (has_melee_weapon(creature_ptr, INVEN_RARM) && has_melee_weapon(creature_ptr, INVEN_LARM)) {
2740 penalty = ((100 - creature_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - creature_ptr->inventory_list[slot].weight) / 8);
2741 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_QUICKTHORN) && (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_TINYTHORN)) {
2742 penalty = penalty / 2 - 5;
2744 if (creature_ptr->easy_2weapon) {
2747 } else if ((creature_ptr->inventory_list[INVEN_LARM].tval == TV_SWORD)
2748 && ((creature_ptr->inventory_list[INVEN_LARM].sval == SV_MAIN_GAUCHE) || (creature_ptr->inventory_list[INVEN_LARM].sval == SV_WAKIZASHI))) {
2749 penalty = MAX(0, penalty - 10);
2751 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI)) {
2752 penalty = MIN(0, penalty);
2754 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (penalty > 0))
2756 if ((creature_ptr->inventory_list[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI) && (penalty > 0))
2760 if (creature_ptr->inventory_list[slot].tval == TV_POLEARM)
2763 return (s16b)penalty;
2766 static void calc_ind_status(player_type *creature_ptr, int status)
2769 if (creature_ptr->stat_use[status] <= 18)
2770 ind = (creature_ptr->stat_use[status] - 3);
2771 else if (creature_ptr->stat_use[status] <= 18 + 219)
2772 ind = (15 + (creature_ptr->stat_use[status] - 18) / 10);
2776 if (creature_ptr->stat_ind[status] == ind)
2779 creature_ptr->stat_ind[status] = (s16b)ind;
2780 if (status == A_CON) {
2781 creature_ptr->update |= (PU_HP);
2782 } else if (status == A_INT) {
2783 if (mp_ptr->spell_stat == A_INT) {
2784 creature_ptr->update |= (PU_MANA | PU_SPELLS);
2786 } else if (status == A_WIS) {
2787 if (mp_ptr->spell_stat == A_WIS) {
2788 creature_ptr->update |= (PU_MANA | PU_SPELLS);
2790 } else if (status == A_CHR) {
2791 if (mp_ptr->spell_stat == A_CHR) {
2792 creature_ptr->update |= (PU_MANA | PU_SPELLS);
2796 creature_ptr->window |= (PW_PLAYER);
2799 static void calc_use_status(player_type *creature_ptr, int status)
2801 int use = modify_stat_value(creature_ptr->stat_cur[status], creature_ptr->stat_add[status]);
2803 if ((status == A_CHR) && (creature_ptr->muta3 & MUT3_ILL_NORM)) {
2804 /* 10 to 18/90 charisma, guaranteed, based on level */
2805 if (use < 8 + 2 * creature_ptr->lev) {
2806 use = 8 + 2 * creature_ptr->lev;
2810 if (creature_ptr->stat_use[status] != use) {
2811 creature_ptr->stat_use[status] = (s16b)use;
2812 creature_ptr->redraw |= (PR_STATS);
2813 creature_ptr->window |= (PW_PLAYER);
2817 static void calc_top_status(player_type *creature_ptr, int status)
2819 int top = modify_stat_value(creature_ptr->stat_max[status], creature_ptr->stat_add[status]);
2821 if (creature_ptr->stat_top[status] != top) {
2822 creature_ptr->stat_top[status] = (s16b)top;
2823 creature_ptr->redraw |= (PR_STATS);
2824 creature_ptr->window |= (PW_PLAYER);
2828 static s16b calc_riding_bow_penalty(player_type *creature_ptr)
2830 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
2831 if (!creature_ptr->riding)
2836 creature_ptr->riding_ryoute = FALSE;
2838 if (have_two_handed_weapons(creature_ptr) || (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_NONE))
2839 creature_ptr->riding_ryoute = TRUE;
2840 else if (creature_ptr->pet_extra_flags & PF_TWO_HANDS) {
2841 switch (creature_ptr->pclass) {
2843 case CLASS_FORCETRAINER:
2844 case CLASS_BERSERKER:
2845 if ((empty_hands(creature_ptr, FALSE) != EMPTY_HAND_NONE) && !has_melee_weapon(creature_ptr, INVEN_RARM)
2846 && !has_melee_weapon(creature_ptr, INVEN_LARM))
2847 creature_ptr->riding_ryoute = TRUE;
2852 if ((creature_ptr->pclass == CLASS_BEASTMASTER) || (creature_ptr->pclass == CLASS_CAVALRY)) {
2853 if (creature_ptr->tval_ammo != TV_ARROW)
2856 penalty = r_info[floor_ptr->m_list[creature_ptr->riding].r_idx].level - creature_ptr->skill_exp[GINOU_RIDING] / 80;
2862 if (creature_ptr->tval_ammo == TV_BOLT)
2868 void put_equipment_warning(player_type *creature_ptr)
2870 bool heavy_shoot = is_heavy_shoot(creature_ptr, &creature_ptr->inventory_list[INVEN_BOW]);
2871 if (creature_ptr->old_heavy_shoot != heavy_shoot) {
2873 msg_print(_("こんな重い弓を装備しているのは大変だ。", "You have trouble wielding such a heavy bow."));
2874 } else if (creature_ptr->inventory_list[INVEN_BOW].k_idx) {
2875 msg_print(_("この弓なら装備していても辛くない。", "You have no trouble wielding your bow."));
2877 msg_print(_("重い弓を装備からはずして体が楽になった。", "You feel relieved to put down your heavy bow."));
2879 creature_ptr->old_heavy_shoot = heavy_shoot;
2882 for (int i = 0; i < 2; i++) {
2883 if (creature_ptr->old_heavy_wield[i] != creature_ptr->heavy_wield[i]) {
2884 if (creature_ptr->heavy_wield[i]) {
2885 msg_print(_("こんな重い武器を装備しているのは大変だ。", "You have trouble wielding such a heavy weapon."));
2886 } else if (has_melee_weapon(creature_ptr, INVEN_RARM + i)) {
2887 msg_print(_("これなら装備していても辛くない。", "You have no trouble wielding your weapon."));
2888 } else if (creature_ptr->heavy_wield[1 - i]) {
2889 msg_print(_("まだ武器が重い。", "You have still trouble wielding a heavy weapon."));
2891 msg_print(_("重い武器を装備からはずして体が楽になった。", "You feel relieved to put down your heavy weapon."));
2894 creature_ptr->old_heavy_wield[i] = creature_ptr->heavy_wield[i];
2897 if (creature_ptr->old_riding_wield[i] != creature_ptr->riding_wield[i]) {
2898 if (creature_ptr->riding_wield[i]) {
2899 msg_print(_("この武器は乗馬中に使うにはむかないようだ。", "This weapon is not suitable for use while riding."));
2900 } else if (!creature_ptr->riding) {
2901 msg_print(_("この武器は徒歩で使いやすい。", "This weapon is suitable for use on foot."));
2902 } else if (has_melee_weapon(creature_ptr, INVEN_RARM + i)) {
2903 msg_print(_("これなら乗馬中にぴったりだ。", "This weapon is suitable for use while riding."));
2906 creature_ptr->old_riding_wield[i] = creature_ptr->riding_wield[i];
2909 if (creature_ptr->old_icky_wield[i] == creature_ptr->icky_wield[i])
2912 if (creature_ptr->icky_wield[i]) {
2913 msg_print(_("今の装備はどうも自分にふさわしくない気がする。", "You do not feel comfortable with your weapon."));
2914 if (current_world_ptr->is_loading_now) {
2915 chg_virtue(creature_ptr, V_FAITH, -1);
2917 } else if (has_melee_weapon(creature_ptr, INVEN_RARM + i)) {
2918 msg_print(_("今の装備は自分にふさわしい気がする。", "You feel comfortable with your weapon."));
2920 msg_print(_("装備をはずしたら随分と気が楽になった。", "You feel more comfortable after removing your weapon."));
2923 creature_ptr->old_icky_wield[i] = creature_ptr->icky_wield[i];
2926 if (creature_ptr->riding && (creature_ptr->old_riding_ryoute != creature_ptr->riding_ryoute)) {
2927 if (creature_ptr->riding_ryoute) {
2929 msg_format("%s馬を操れない。", (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_NONE) ? "両手がふさがっていて" : "");
2931 msg_print("You are using both hand for fighting, and you can't control the pet you're riding.");
2935 msg_format("%s馬を操れるようになった。", (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_NONE) ? "手が空いて" : "");
2937 msg_print("You began to control the pet you're riding with one hand.");
2941 creature_ptr->old_riding_ryoute = creature_ptr->riding_ryoute;
2944 if (((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER) || (creature_ptr->pclass == CLASS_NINJA))
2945 && (heavy_armor(creature_ptr) != creature_ptr->monk_notify_aux)) {
2946 if (heavy_armor(creature_ptr)) {
2947 msg_print(_("装備が重くてバランスを取れない。", "The weight of your armor disrupts your balance."));
2948 if (current_world_ptr->is_loading_now) {
2949 chg_virtue(creature_ptr, V_HARMONY, -1);
2952 msg_print(_("バランスがとれるようになった。", "You regain your balance."));
2955 creature_ptr->monk_notify_aux = heavy_armor(creature_ptr);
2959 static s16b calc_to_damage(player_type *creature_ptr, INVENTORY_IDX slot, bool is_true_value)
2961 object_type *o_ptr = &creature_ptr->inventory_list[slot];
2962 int id = slot - INVEN_RARM;
2963 BIT_FLAGS flgs[TR_FLAG_SIZE];
2964 object_flags(creature_ptr, o_ptr, flgs);
2967 damage += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
2969 if (creature_ptr->shero) {
2970 damage += 3 + (creature_ptr->lev / 5);
2973 if (creature_ptr->stun > 50) {
2975 } else if (creature_ptr->stun) {
2979 if ((creature_ptr->pclass == CLASS_PRIEST) && (!(have_flag(flgs, TR_BLESSED))) && ((o_ptr->tval == TV_SWORD) || (o_ptr->tval == TV_POLEARM))) {
2981 } else if (creature_ptr->pclass == CLASS_BERSERKER) {
2982 damage += creature_ptr->lev / 6;
2983 if (((id == 0) && !have_left_hand_weapon(creature_ptr)) || have_two_handed_weapons(creature_ptr)) {
2984 damage += creature_ptr->lev / 6;
2986 } else if (creature_ptr->pclass == CLASS_SORCERER) {
2987 if (!((o_ptr->tval == TV_HAFTED) && ((o_ptr->sval == SV_WIZSTAFF) || (o_ptr->sval == SV_NAMAKE_HAMMER)))) {
2994 if ((creature_ptr->realm1 == REALM_HEX) && object_is_cursed(o_ptr)) {
2995 if (hex_spelling(creature_ptr, HEX_RUNESWORD)) {
2996 if (o_ptr->curse_flags & (TRC_CURSED)) {
2999 if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) {
3002 if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) {
3008 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
3010 o_ptr = &creature_ptr->inventory_list[i];
3011 if (!o_ptr->k_idx || o_ptr->tval == TV_CAPTURE || (i == INVEN_RARM && has_melee_weapon(creature_ptr, i))
3012 || (i == INVEN_LARM && has_melee_weapon(creature_ptr, i)) || i == INVEN_BOW)
3015 if (!object_is_known(o_ptr) && !is_true_value)
3017 bonus_to_d = o_ptr->to_d;
3019 if (creature_ptr->pclass == CLASS_NINJA) {
3020 if (o_ptr->to_d > 0)
3021 bonus_to_d = (o_ptr->to_d + 1) / 2;
3024 if ((i == INVEN_LEFT || i == INVEN_RIGHT) && !have_two_handed_weapons(creature_ptr)) {
3025 damage += (s16b)bonus_to_d;
3026 } else if (have_right_hand_weapon(creature_ptr) && have_left_hand_weapon(creature_ptr)) {
3028 damage += (bonus_to_d > 0) ? (bonus_to_d + 1) / 2 : bonus_to_d;
3030 damage += (bonus_to_d > 0) ? bonus_to_d / 2 : bonus_to_d;
3031 } else if (id == get_default_hand(creature_ptr)) {
3032 damage += (s16b)bonus_to_d;
3036 if (get_default_hand(creature_ptr) == id) {
3037 if ((is_martial_arts_mode(creature_ptr) && empty_hands(creature_ptr, FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM))
3038 || !is_disable_two_handed_bonus(creature_ptr, 0)) {
3040 bonus_to_d = ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128) / 2;
3041 damage += MAX(bonus_to_d, 1);
3045 if (is_martial_arts_mode(creature_ptr) && (!heavy_armor(creature_ptr) || creature_ptr->pclass != CLASS_BERSERKER)) {
3046 damage += (creature_ptr->lev / 6);
3052 static s16b calc_to_hit(player_type *creature_ptr, INVENTORY_IDX slot, bool is_true_value)
3054 int id = slot - INVEN_RARM;
3055 object_type *o_ptr = &creature_ptr->inventory_list[slot];
3056 BIT_FLAGS flgs[TR_FLAG_SIZE];
3057 object_flags(creature_ptr, o_ptr, flgs);
3058 tval_type tval = creature_ptr->inventory_list[INVEN_RARM + id].tval - TV_WEAPON_BEGIN;
3059 OBJECT_SUBTYPE_VALUE sval = creature_ptr->inventory_list[INVEN_RARM + id].sval;
3063 hit += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
3064 hit += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
3066 if ((creature_ptr->pclass == CLASS_PRIEST) && (!(have_flag(flgs, TR_BLESSED))) && ((o_ptr->tval == TV_SWORD) || (o_ptr->tval == TV_POLEARM))) {
3068 } else if (creature_ptr->pclass == CLASS_BERSERKER) {
3069 hit += creature_ptr->lev / 5;
3070 if (((id == 0) && !have_left_hand_weapon(creature_ptr)) || have_two_handed_weapons(creature_ptr)) {
3071 hit += creature_ptr->lev / 5;
3073 } else if (creature_ptr->pclass == CLASS_SORCERER) {
3074 if (!((o_ptr->tval == TV_HAFTED) && ((o_ptr->sval == SV_WIZSTAFF) || (o_ptr->sval == SV_NAMAKE_HAMMER)))) {
3081 if ((object_is_fully_known(o_ptr) || is_true_value) && o_ptr->curse_flags & TRC_LOW_MELEE) {
3082 if (o_ptr->curse_flags & TRC_HEAVY_CURSE) {
3089 if ((creature_ptr->realm1 == REALM_HEX) && object_is_cursed(o_ptr)) {
3090 if (o_ptr->curse_flags & (TRC_CURSED)) {
3093 if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) {
3096 if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) {
3099 if (o_ptr->curse_flags & (TRC_TY_CURSE)) {
3104 if (calc_weapon_weight_limit(creature_ptr) < o_ptr->weight / 10) {
3105 hit += 2 * (calc_weapon_weight_limit(creature_ptr) - o_ptr->weight / 10);
3108 if (is_blessed(creature_ptr)) {
3112 if (is_hero(creature_ptr)) {
3116 if (creature_ptr->shero) {
3120 if (creature_ptr->stun > 50) {
3122 } else if (creature_ptr->stun) {
3126 if (creature_ptr->riding) {
3127 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE))) {
3132 if (creature_ptr->riding != 0 && !(o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE))
3133 && !have_flag(flgs, TR_RIDING)) {
3136 if ((creature_ptr->pclass == CLASS_BEASTMASTER) || (creature_ptr->pclass == CLASS_CAVALRY)) {
3139 penalty = r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].level - creature_ptr->skill_exp[GINOU_RIDING] / 80;
3144 hit -= (s16b)penalty;
3147 hit += (creature_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200;
3149 if (is_not_ninja_weapon(creature_ptr, id) || is_not_monk_weapon(creature_ptr, id)) {
3153 if (get_default_hand(creature_ptr) == id) {
3154 if ((have_right_hand_weapon(creature_ptr) && (empty_hands(creature_ptr, TRUE) & EMPTY_HAND_RARM))
3155 || (have_left_hand_weapon(creature_ptr) && (empty_hands(creature_ptr, TRUE) & EMPTY_HAND_LARM))) {
3156 hit += (creature_ptr->skill_exp[GINOU_SUDE] - WEAPON_EXP_BEGINNER) / 200;
3159 if ((is_martial_arts_mode(creature_ptr) && empty_hands(creature_ptr, FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM))
3160 || !is_disable_two_handed_bonus(creature_ptr, 0)) {
3162 bonus_to_h = ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128) + ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
3163 hit += MAX(bonus_to_h, 1);
3167 int default_hand = get_default_hand(creature_ptr);
3168 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
3170 o_ptr = &creature_ptr->inventory_list[i];
3171 if (!o_ptr->k_idx || o_ptr->tval == TV_CAPTURE || (i == INVEN_RARM && has_melee_weapon(creature_ptr, i))
3172 || (i == INVEN_LARM && has_melee_weapon(creature_ptr, i)) || i == INVEN_BOW)
3175 if (is_true_value || !object_is_known(o_ptr))
3177 bonus_to_h = o_ptr->to_h;
3179 if (creature_ptr->pclass == CLASS_NINJA) {
3180 if (o_ptr->to_h > 0)
3181 bonus_to_h = (o_ptr->to_h + 1) / 2;
3184 if ((i == INVEN_LEFT || i == INVEN_RIGHT) && !have_two_handed_weapons(creature_ptr)) {
3185 hit += (s16b)bonus_to_h;
3189 if (have_right_hand_weapon(creature_ptr) && have_left_hand_weapon(creature_ptr)) {
3190 if (default_hand == 0)
3191 hit += (bonus_to_h > 0) ? (bonus_to_h + 1) / 2 : bonus_to_h;
3192 if (default_hand == 1)
3193 hit += (bonus_to_h > 0) ? bonus_to_h / 2 : bonus_to_h;
3197 if (default_hand == id)
3198 hit += (s16b)bonus_to_h;
3200 if (is_martial_arts_mode(creature_ptr) && (!heavy_armor(creature_ptr) || creature_ptr->pclass != CLASS_BERSERKER)) {
3201 hit += (creature_ptr->lev / 3);
3204 hit -= calc_double_weapon_penalty(creature_ptr, slot);
3209 static s16b calc_to_hit_bow(player_type *creature_ptr, bool is_true_value)
3213 pow += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
3214 pow += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
3218 BIT_FLAGS flgs[TR_FLAG_SIZE];
3219 o_ptr = &creature_ptr->inventory_list[INVEN_BOW];
3221 object_flags(creature_ptr, o_ptr, flgs);
3223 if (o_ptr->curse_flags & TRC_LOW_MELEE) {
3224 if (o_ptr->curse_flags & TRC_HEAVY_CURSE) {
3233 if (creature_ptr->stun > 50) {
3235 } else if (creature_ptr->stun) {
3239 if (is_blessed(creature_ptr)) {
3243 if (is_hero(creature_ptr)) {
3247 if (creature_ptr->shero) {
3251 object_type *o_ptr = &creature_ptr->inventory_list[INVEN_BOW];
3253 if (is_heavy_shoot(creature_ptr, o_ptr)) {
3254 pow += 2 * (calc_weapon_weight_limit(creature_ptr) - o_ptr->weight / 10);
3258 if (o_ptr->k_idx && !is_heavy_shoot(creature_ptr, &creature_ptr->inventory_list[INVEN_BOW])) {
3259 if ((creature_ptr->pclass == CLASS_SNIPER) && (creature_ptr->tval_ammo == TV_BOLT)) {
3260 pow += (10 + (creature_ptr->lev / 5));
3266 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
3268 o_ptr = &creature_ptr->inventory_list[i];
3269 if (!o_ptr->k_idx || o_ptr->tval == TV_CAPTURE || (i == INVEN_RARM && has_melee_weapon(creature_ptr, i))
3270 || (i == INVEN_LARM && has_melee_weapon(creature_ptr, i)) || i == INVEN_BOW)
3273 bonus_to_h = o_ptr->to_h;
3275 if (creature_ptr->pclass == CLASS_NINJA) {
3276 if (o_ptr->to_h > 0)
3277 bonus_to_h = (o_ptr->to_h + 1) / 2;
3280 if (is_true_value || object_is_known(o_ptr))
3281 pow += (s16b)bonus_to_h;
3284 pow -= calc_riding_bow_penalty(creature_ptr);
3289 static s16b calc_to_damage_misc(player_type *creature_ptr)
3292 BIT_FLAGS flgs[TR_FLAG_SIZE];
3296 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
3297 o_ptr = &creature_ptr->inventory_list[i];
3301 object_flags(creature_ptr, o_ptr, flgs);
3303 int bonus_to_d = o_ptr->to_d;
3304 if (creature_ptr->pclass == CLASS_NINJA) {
3305 if (o_ptr->to_d > 0)
3306 bonus_to_d = (o_ptr->to_d + 1) / 2;
3308 to_dam += (s16b)bonus_to_d;
3311 if (creature_ptr->shero) {
3312 to_dam += 3 + (creature_ptr->lev / 5);
3315 if (creature_ptr->stun > 50) {
3317 } else if (creature_ptr->stun) {
3321 to_dam += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
3325 static s16b calc_to_hit_misc(player_type *creature_ptr)
3328 BIT_FLAGS flgs[TR_FLAG_SIZE];
3332 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
3333 o_ptr = &creature_ptr->inventory_list[i];
3337 object_flags(creature_ptr, o_ptr, flgs);
3339 int bonus_to_h = o_ptr->to_h;
3340 if (creature_ptr->pclass == CLASS_NINJA) {
3341 if (o_ptr->to_h > 0)
3342 bonus_to_h = (o_ptr->to_h + 1) / 2;
3344 to_hit += (s16b)o_ptr->to_h;
3347 if (is_blessed(creature_ptr)) {
3351 if (is_hero(creature_ptr)) {
3355 if (creature_ptr->shero) {
3359 if (creature_ptr->stun > 50) {
3361 } else if (creature_ptr->stun) {
3365 to_hit += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
3366 to_hit += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
3371 static DICE_NUMBER calc_to_weapon_dice_num(player_type *creature_ptr, INVENTORY_IDX slot)
3373 object_type *o_ptr = &creature_ptr->inventory_list[slot];
3376 if (creature_ptr->riding) {
3378 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE))) {
3386 static DICE_NUMBER calc_to_weapon_dice_side(player_type *creature_ptr, INVENTORY_IDX slot)
3388 (creature_ptr); // unused
3394 * @brief プレイヤーの所持重量制限を計算する /
3395 * Computes current weight limit.
3398 WEIGHT weight_limit(player_type *creature_ptr)
3400 WEIGHT i = (WEIGHT)adj_str_wgt[creature_ptr->stat_ind[A_STR]] * 50;
3401 if (creature_ptr->pclass == CLASS_BERSERKER)
3407 * @brief プレイヤーが現在右手/左手に武器を持っているか判定する /
3408 * @param i 判定する手のID(右手:0 左手:1)
3409 * @return 持っているならばTRUE
3411 bool has_melee_weapon(player_type *creature_ptr, int i)
3413 return ((creature_ptr->inventory_list[i].k_idx && object_is_melee_weapon(&creature_ptr->inventory_list[i])) ? TRUE : FALSE);
3417 * @brief プレイヤーの現在開いている手の状態を返す
3418 * @param riding_control 乗馬中により片手を必要としている状態ならばTRUEを返す。
3419 * @return 開いている手のビットフラグ
3421 BIT_FLAGS16 empty_hands(player_type *creature_ptr, bool riding_control)
3423 BIT_FLAGS16 status = EMPTY_HAND_NONE;
3424 if (!creature_ptr->inventory_list[INVEN_RARM].k_idx)
3425 status |= EMPTY_HAND_RARM;
3426 if (!creature_ptr->inventory_list[INVEN_LARM].k_idx)
3427 status |= EMPTY_HAND_LARM;
3429 if (riding_control && (status != EMPTY_HAND_NONE) && creature_ptr->riding && !(creature_ptr->pet_extra_flags & PF_TWO_HANDS)) {
3430 if (status & EMPTY_HAND_LARM)
3431 status &= ~(EMPTY_HAND_LARM);
3432 else if (status & EMPTY_HAND_RARM)
3433 status &= ~(EMPTY_HAND_RARM);
3440 * @brief プレイヤーが防具重量制限のある職業時にペナルティを受ける状態にあるかどうかを返す。
3441 * @return ペナルティが適用されるならばTRUE。
3443 bool heavy_armor(player_type *creature_ptr)
3445 if ((creature_ptr->pclass != CLASS_MONK) && (creature_ptr->pclass != CLASS_FORCETRAINER) && (creature_ptr->pclass != CLASS_NINJA))
3448 WEIGHT monk_arm_wgt = 0;
3449 if (creature_ptr->inventory_list[INVEN_RARM].tval > TV_SWORD)
3450 monk_arm_wgt += creature_ptr->inventory_list[INVEN_RARM].weight;
3451 if (creature_ptr->inventory_list[INVEN_LARM].tval > TV_SWORD)
3452 monk_arm_wgt += creature_ptr->inventory_list[INVEN_LARM].weight;
3453 monk_arm_wgt += creature_ptr->inventory_list[INVEN_BODY].weight;
3454 monk_arm_wgt += creature_ptr->inventory_list[INVEN_HEAD].weight;
3455 monk_arm_wgt += creature_ptr->inventory_list[INVEN_OUTER].weight;
3456 monk_arm_wgt += creature_ptr->inventory_list[INVEN_HANDS].weight;
3457 monk_arm_wgt += creature_ptr->inventory_list[INVEN_FEET].weight;
3459 return (monk_arm_wgt > (100 + (creature_ptr->lev * 4)));
3463 * @brief update のフラグに応じた更新をまとめて行う / Handle "update"
3465 * @details 更新処理の対象はプレイヤーの能力修正/光源寿命/HP/MP/魔法の学習状態、他多数の外界の状態判定。
3467 void update_creature(player_type *creature_ptr)
3469 if (!creature_ptr->update)
3472 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
3473 if (creature_ptr->update & (PU_AUTODESTROY)) {
3474 creature_ptr->update &= ~(PU_AUTODESTROY);
3475 autopick_delayed_alter(creature_ptr);
3478 if (creature_ptr->update & (PU_COMBINE)) {
3479 creature_ptr->update &= ~(PU_COMBINE);
3480 combine_pack(creature_ptr);
3483 if (creature_ptr->update & (PU_REORDER)) {
3484 creature_ptr->update &= ~(PU_REORDER);
3485 reorder_pack(creature_ptr);
3488 if (creature_ptr->update & (PU_BONUS)) {
3489 creature_ptr->update &= ~(PU_BONUS);
3490 calc_alignment(creature_ptr);
3491 calc_bonuses(creature_ptr);
3494 if (creature_ptr->update & (PU_TORCH)) {
3495 creature_ptr->update &= ~(PU_TORCH);
3496 calc_lite_radius(creature_ptr);
3499 if (creature_ptr->update & (PU_HP)) {
3500 creature_ptr->update &= ~(PU_HP);
3501 calc_hitpoints(creature_ptr);
3504 if (creature_ptr->update & (PU_MANA)) {
3505 creature_ptr->update &= ~(PU_MANA);
3506 calc_mana(creature_ptr);
3509 if (creature_ptr->update & (PU_SPELLS)) {
3510 creature_ptr->update &= ~(PU_SPELLS);
3511 calc_spells(creature_ptr);
3514 if (!current_world_ptr->character_generated)
3516 if (current_world_ptr->character_icky)
3518 if (creature_ptr->update & (PU_UN_LITE)) {
3519 creature_ptr->update &= ~(PU_UN_LITE);
3520 forget_lite(floor_ptr);
3523 if (creature_ptr->update & (PU_UN_VIEW)) {
3524 creature_ptr->update &= ~(PU_UN_VIEW);
3525 forget_view(floor_ptr);
3528 if (creature_ptr->update & (PU_VIEW)) {
3529 creature_ptr->update &= ~(PU_VIEW);
3530 update_view(creature_ptr);
3533 if (creature_ptr->update & (PU_LITE)) {
3534 creature_ptr->update &= ~(PU_LITE);
3535 update_lite(creature_ptr);
3538 if (creature_ptr->update & (PU_FLOW)) {
3539 creature_ptr->update &= ~(PU_FLOW);
3540 update_flow(creature_ptr);
3543 if (creature_ptr->update & (PU_DISTANCE)) {
3544 creature_ptr->update &= ~(PU_DISTANCE);
3546 update_monsters(creature_ptr, TRUE);
3549 if (creature_ptr->update & (PU_MON_LITE)) {
3550 creature_ptr->update &= ~(PU_MON_LITE);
3551 update_mon_lite(creature_ptr);
3554 if (creature_ptr->update & (PU_DELAY_VIS)) {
3555 creature_ptr->update &= ~(PU_DELAY_VIS);
3556 delayed_visual_update(creature_ptr);
3559 if (creature_ptr->update & (PU_MONSTERS)) {
3560 creature_ptr->update &= ~(PU_MONSTERS);
3561 update_monsters(creature_ptr, FALSE);
3566 * @brief プレイヤーが魔道書を一冊も持っていないかを判定する
3567 * @return 魔道書を一冊も持っていないならTRUEを返す
3569 bool player_has_no_spellbooks(player_type *creature_ptr)
3572 for (int i = 0; i < INVEN_PACK; i++) {
3573 o_ptr = &creature_ptr->inventory_list[i];
3574 if (o_ptr->k_idx && check_book_realm(creature_ptr, o_ptr->tval, o_ptr->sval))
3578 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
3579 for (int i = floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].o_idx; i; i = o_ptr->next_o_idx) {
3580 o_ptr = &floor_ptr->o_list[i];
3581 if (o_ptr->k_idx && (o_ptr->marked & OM_FOUND) && check_book_realm(creature_ptr, o_ptr->tval, o_ptr->sval))
3588 void take_turn(player_type *creature_ptr, PERCENTAGE need_cost) { creature_ptr->energy_use = (ENERGY)need_cost; }
3590 void free_turn(player_type *creature_ptr) { creature_ptr->energy_use = 0; }
3593 * @brief プレイヤーを指定座標に配置する / Place the player in the dungeon XXX XXX
3596 * @return 配置に成功したらTRUE
3598 bool player_place(player_type *creature_ptr, POSITION y, POSITION x)
3600 if (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx != 0)
3603 /* Save player location */
3604 creature_ptr->y = y;
3605 creature_ptr->x = x;
3610 * @brief 種族アンバライトが出血時パターンの上に乗った際のペナルティ処理
3613 void wreck_the_pattern(player_type *creature_ptr)
3615 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
3616 int pattern_type = f_info[floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat].subtype;
3617 if (pattern_type == PATTERN_TILE_WRECKED)
3620 msg_print(_("パターンを血で汚してしまった!", "You bleed on the Pattern!"));
3621 msg_print(_("何か恐ろしい事が起こった!", "Something terrible happens!"));
3623 if (!is_invuln(creature_ptr))
3624 take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(10, 8), _("パターン損壊", "corrupting the Pattern"), -1);
3626 int to_ruin = randint1(45) + 35;
3629 scatter(creature_ptr, &r_y, &r_x, creature_ptr->y, creature_ptr->x, 4, PROJECT_NONE);
3631 if (pattern_tile(floor_ptr, r_y, r_x) && (f_info[floor_ptr->grid_array[r_y][r_x].feat].subtype != PATTERN_TILE_WRECKED)) {
3632 cave_set_feat(creature_ptr, r_y, r_x, feat_pattern_corrupted);
3636 cave_set_feat(creature_ptr, creature_ptr->y, creature_ptr->x, feat_pattern_corrupted);
3640 * @brief プレイヤーの経験値について整合性のためのチェックと調整を行う /
3641 * Advance experience levels and print experience
3644 void check_experience(player_type *creature_ptr)
3646 if (creature_ptr->exp < 0)
3647 creature_ptr->exp = 0;
3648 if (creature_ptr->max_exp < 0)
3649 creature_ptr->max_exp = 0;
3650 if (creature_ptr->max_max_exp < 0)
3651 creature_ptr->max_max_exp = 0;
3653 if (creature_ptr->exp > PY_MAX_EXP)
3654 creature_ptr->exp = PY_MAX_EXP;
3655 if (creature_ptr->max_exp > PY_MAX_EXP)
3656 creature_ptr->max_exp = PY_MAX_EXP;
3657 if (creature_ptr->max_max_exp > PY_MAX_EXP)
3658 creature_ptr->max_max_exp = PY_MAX_EXP;
3660 if (creature_ptr->exp > creature_ptr->max_exp)
3661 creature_ptr->max_exp = creature_ptr->exp;
3662 if (creature_ptr->max_exp > creature_ptr->max_max_exp)
3663 creature_ptr->max_max_exp = creature_ptr->max_exp;
3665 creature_ptr->redraw |= (PR_EXP);
3666 handle_stuff(creature_ptr);
3668 bool android = (creature_ptr->prace == RACE_ANDROID ? TRUE : FALSE);
3669 PLAYER_LEVEL old_lev = creature_ptr->lev;
3670 while ((creature_ptr->lev > 1) && (creature_ptr->exp < ((android ? player_exp_a : player_exp)[creature_ptr->lev - 2] * creature_ptr->expfact / 100L))) {
3671 creature_ptr->lev--;
3672 creature_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
3673 creature_ptr->redraw |= (PR_LEV | PR_TITLE);
3674 creature_ptr->window |= (PW_PLAYER);
3675 handle_stuff(creature_ptr);
3678 bool level_reward = FALSE;
3679 bool level_mutation = FALSE;
3680 bool level_inc_stat = FALSE;
3681 while ((creature_ptr->lev < PY_MAX_LEVEL)
3682 && (creature_ptr->exp >= ((android ? player_exp_a : player_exp)[creature_ptr->lev - 1] * creature_ptr->expfact / 100L))) {
3683 creature_ptr->lev++;
3684 if (creature_ptr->lev > creature_ptr->max_plv) {
3685 creature_ptr->max_plv = creature_ptr->lev;
3687 if ((creature_ptr->pclass == CLASS_CHAOS_WARRIOR) || (creature_ptr->muta2 & MUT2_CHAOS_GIFT)) {
3688 level_reward = TRUE;
3690 if (creature_ptr->prace == RACE_BEASTMAN) {
3692 level_mutation = TRUE;
3694 level_inc_stat = TRUE;
3696 exe_write_diary(creature_ptr, DIARY_LEVELUP, creature_ptr->lev, NULL);
3700 msg_format(_("レベル %d にようこそ。", "Welcome to level %d."), creature_ptr->lev);
3701 creature_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
3702 creature_ptr->redraw |= (PR_LEV | PR_TITLE | PR_EXP);
3703 creature_ptr->window |= (PW_PLAYER | PW_SPELL | PW_INVEN);
3704 creature_ptr->level_up_message = TRUE;
3705 handle_stuff(creature_ptr);
3707 creature_ptr->level_up_message = FALSE;
3708 if (level_inc_stat) {
3709 if (!(creature_ptr->max_plv % 10)) {
3716 cnv_stat(creature_ptr->stat_max[0], tmp);
3717 prt(format(_(" a) 腕力 (現在値 %s)", " a) Str (cur %s)"), tmp), 2, 14);
3718 cnv_stat(creature_ptr->stat_max[1], tmp);
3719 prt(format(_(" b) 知能 (現在値 %s)", " b) Int (cur %s)"), tmp), 3, 14);
3720 cnv_stat(creature_ptr->stat_max[2], tmp);
3721 prt(format(_(" c) 賢さ (現在値 %s)", " c) Wis (cur %s)"), tmp), 4, 14);
3722 cnv_stat(creature_ptr->stat_max[3], tmp);
3723 prt(format(_(" d) 器用 (現在値 %s)", " d) Dex (cur %s)"), tmp), 5, 14);
3724 cnv_stat(creature_ptr->stat_max[4], tmp);
3725 prt(format(_(" e) 耐久 (現在値 %s)", " e) Con (cur %s)"), tmp), 6, 14);
3726 cnv_stat(creature_ptr->stat_max[5], tmp);
3727 prt(format(_(" f) 魅力 (現在値 %s)", " f) Chr (cur %s)"), tmp), 7, 14);
3730 prt(_(" どの能力値を上げますか?", " Which stat do you want to raise?"), 1, 14);
3734 if ((choice >= 'a') && (choice <= 'f'))
3737 for (n = 0; n < A_MAX; n++)
3738 if (n != choice - 'a')
3740 if (get_check(_("よろしいですか?", "Are you sure? ")))
3743 do_inc_stat(creature_ptr, choice - 'a');
3745 } else if (!(creature_ptr->max_plv % 2))
3746 do_inc_stat(creature_ptr, randint0(6));
3749 if (level_mutation) {
3750 msg_print(_("あなたは変わった気がする...", "You feel different..."));
3751 (void)gain_mutation(creature_ptr, 0);
3752 level_mutation = FALSE;
3756 * 報酬でレベルが上ると再帰的に check_experience(creature_ptr) が
3760 gain_level_reward(creature_ptr, 0);
3761 level_reward = FALSE;
3764 creature_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
3765 creature_ptr->redraw |= (PR_LEV | PR_TITLE);
3766 creature_ptr->window |= (PW_PLAYER | PW_SPELL);
3767 handle_stuff(creature_ptr);
3770 if (old_lev != creature_ptr->lev)
3771 autopick_load_pref(creature_ptr, FALSE);
3775 * @brief 現在の修正後能力値を3~17及び18/xxx形式に変換する / Converts stat num into a six-char (right justified) string
3777 * @param out_val 出力先文字列ポインタ
3780 void cnv_stat(int val, char *out_val)
3783 sprintf(out_val, " %2d", val);
3787 int bonus = (val - 18);
3789 sprintf(out_val, "18/%3s", "***");
3790 } else if (bonus >= 100) {
3791 sprintf(out_val, "18/%03d", bonus);
3793 sprintf(out_val, " 18/%02d", bonus);
3798 * @brief 能力値現在値から3~17及び18/xxx様式に基づく加減算を行う。
3799 * Modify a stat value by a "modifier", return new value
3801 * @param amount 加減算値
3805 * Stats go up: 3,4,...,17,18,18/10,18/20,...,18/220
3806 * Or even: 18/13, 18/23, 18/33, ..., 18/220
3807 * Stats go down: 18/220, 18/210,..., 18/10, 18, 17, ..., 3
3808 * Or even: 18/13, 18/03, 18, 17, ..., 3
3811 s16b modify_stat_value(int value, int amount)
3814 for (int i = 0; i < amount; i++) {
3820 } else if (amount < 0) {
3821 for (int i = 0; i < (0 - amount); i++) {
3822 if (value >= 18 + 10)
3824 else if (value > 18)
3836 * Hack -- Calculates the total number of points earned -JWT-
3840 long calc_score(player_type *creature_ptr)
3842 int arena_win = MIN(creature_ptr->arena_number, MAX_ARENA_MONS);
3855 if (ironman_small_levels)
3857 if (ironman_empty_levels)
3863 if (ironman_nightmare)
3870 for (int i = 0; i < current_world_ptr->max_d_idx; i++)
3871 if (max_dlv[i] > max_dl)
3872 max_dl = max_dlv[i];
3874 u32b point_l = (creature_ptr->max_max_exp + (100 * max_dl));
3875 u32b point_h = point_l / 0x10000L;
3876 point_l = point_l % 0x10000L;
3879 point_h += point_l / 0x10000L;
3880 point_l %= 0x10000L;
3882 point_l += ((point_h % 100) << 16);
3886 u32b point = (point_h << 16) + (point_l);
3887 if (creature_ptr->arena_number >= 0)
3888 point += (arena_win * arena_win * (arena_win > 29 ? 1000 : 100));
3890 if (ironman_downward)
3892 if (creature_ptr->pclass == CLASS_BERSERKER) {
3893 if (creature_ptr->prace == RACE_SPECTRE)
3897 if ((creature_ptr->pseikaku == PERSONALITY_MUNCHKIN) && point) {
3899 if (current_world_ptr->total_winner)
3904 point = (0 - point);
3909 void cheat_death(player_type *creature_ptr)
3911 if (creature_ptr->sc)
3912 creature_ptr->sc = creature_ptr->age = 0;
3913 creature_ptr->age++;
3915 current_world_ptr->noscore |= 0x0001;
3916 msg_print(_("ウィザードモードに念を送り、死を欺いた。", "You invoke wizard mode and cheat death."));
3919 (void)life_stream(creature_ptr, FALSE, FALSE);
3920 (void)restore_mana(creature_ptr, TRUE);
3922 if (creature_ptr->word_recall) {
3923 msg_print(_("張りつめた大気が流れ去った...", "A tension leaves the air around you..."));
3925 creature_ptr->word_recall = 0;
3926 creature_ptr->redraw |= (PR_STATUS);
3929 if (creature_ptr->alter_reality) {
3930 creature_ptr->alter_reality = 0;
3931 creature_ptr->redraw |= (PR_STATUS);
3934 (void)strcpy(creature_ptr->died_from, _("死の欺き", "Cheating death"));
3935 creature_ptr->is_dead = FALSE;
3936 (void)set_food(creature_ptr, PY_FOOD_MAX - 1);
3938 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
3939 floor_ptr->dun_level = 0;
3940 floor_ptr->inside_arena = FALSE;
3941 creature_ptr->phase_out = FALSE;
3943 floor_ptr->inside_quest = 0;
3944 if (creature_ptr->dungeon_idx)
3945 creature_ptr->recall_dungeon = creature_ptr->dungeon_idx;
3946 creature_ptr->dungeon_idx = 0;
3947 if (lite_town || vanilla_town) {
3948 creature_ptr->wilderness_y = 1;
3949 creature_ptr->wilderness_x = 1;
3951 creature_ptr->oldpy = 10;
3952 creature_ptr->oldpx = 34;
3954 creature_ptr->oldpy = 33;
3955 creature_ptr->oldpx = 131;
3958 creature_ptr->wilderness_y = 48;
3959 creature_ptr->wilderness_x = 5;
3960 creature_ptr->oldpy = 33;
3961 creature_ptr->oldpx = 131;
3964 creature_ptr->wild_mode = FALSE;
3965 creature_ptr->leaving = TRUE;
3967 exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 1, _(" しかし、生き返った。", " but revived."));
3969 leave_floor(creature_ptr);
3970 wipe_monsters_list(creature_ptr);
3974 * @param creature_ptr プレーヤーへの参照ポインタ
3975 * @return 祝福状態ならばTRUE
3977 bool is_blessed(player_type *creature_ptr)
3979 return creature_ptr->blessed || music_singing(creature_ptr, MUSIC_BLESS) || hex_spelling(creature_ptr, HEX_BLESS);
3982 bool is_tim_esp(player_type *creature_ptr)
3984 return creature_ptr->tim_esp || music_singing(creature_ptr, MUSIC_MIND) || (creature_ptr->concent >= CONCENT_TELE_THRESHOLD);
3987 bool is_tim_stealth(player_type *creature_ptr) { return creature_ptr->tim_stealth || music_singing(creature_ptr, MUSIC_STEALTH); }
3989 bool is_time_limit_esp(player_type *creature_ptr)
3991 return creature_ptr->tim_esp || music_singing(creature_ptr, MUSIC_MIND) || (creature_ptr->concent >= CONCENT_TELE_THRESHOLD);
3994 bool is_time_limit_stealth(player_type *creature_ptr) { return creature_ptr->tim_stealth || music_singing(creature_ptr, MUSIC_STEALTH); }
3996 bool can_two_hands_wielding(player_type *creature_ptr) { return !creature_ptr->riding || (creature_ptr->pet_extra_flags & PF_TWO_HANDS); }
3999 * @brief 歌の停止を処理する / Stop singing if the player is a Bard
4002 void stop_singing(player_type *creature_ptr)
4004 if (creature_ptr->pclass != CLASS_BARD)
4007 /* Are there interupted song? */
4008 if (INTERUPTING_SONG_EFFECT(creature_ptr)) {
4009 /* Forget interupted song */
4010 INTERUPTING_SONG_EFFECT(creature_ptr) = MUSIC_NONE;
4014 /* The player is singing? */
4015 if (!SINGING_SONG_EFFECT(creature_ptr))
4018 /* Hack -- if called from set_action(), avoid recursive loop */
4019 if (creature_ptr->action == ACTION_SING)
4020 set_action(creature_ptr, ACTION_NONE);
4022 /* Message text of each song or etc. */
4023 exe_spell(creature_ptr, REALM_MUSIC, SINGING_SONG_ID(creature_ptr), SPELL_STOP);
4025 SINGING_SONG_EFFECT(creature_ptr) = MUSIC_NONE;
4026 SINGING_SONG_ID(creature_ptr) = 0;
4027 creature_ptr->update |= (PU_BONUS);
4028 creature_ptr->redraw |= (PR_STATUS);
4032 * @brief 口を使う継続的な処理を中断する
4033 * @param caster_ptr プレーヤーへの参照ポインタ
4036 void stop_mouth(player_type *caster_ptr)
4038 if (music_singing_any(caster_ptr))
4039 stop_singing(caster_ptr);
4040 if (hex_spelling_any(caster_ptr))
4041 stop_hex_spell_all(caster_ptr);
4045 * @brief ペットの維持コスト計算
4048 PERCENTAGE calculate_upkeep(player_type *creature_ptr)
4051 bool have_a_unique = FALSE;
4052 DEPTH total_friend_levels = 0;
4056 for (m_idx = creature_ptr->current_floor_ptr->m_max - 1; m_idx >= 1; m_idx--) {
4057 monster_type *m_ptr;
4058 monster_race *r_ptr;
4060 m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
4061 if (!monster_is_valid(m_ptr))
4063 r_ptr = &r_info[m_ptr->r_idx];
4065 if (is_pet(m_ptr)) {
4067 if (r_ptr->flags1 & RF1_UNIQUE) {
4068 if (creature_ptr->pclass == CLASS_CAVALRY) {
4069 if (creature_ptr->riding == m_idx)
4070 total_friend_levels += (r_ptr->level + 5) * 2;
4071 else if (!have_a_unique && (r_info[m_ptr->r_idx].flags7 & RF7_RIDING))
4072 total_friend_levels += (r_ptr->level + 5) * 7 / 2;
4074 total_friend_levels += (r_ptr->level + 5) * 10;
4075 have_a_unique = TRUE;
4077 total_friend_levels += (r_ptr->level + 5) * 10;
4079 total_friend_levels += r_ptr->level;
4083 if (total_friends) {
4085 upkeep_factor = (total_friend_levels - (creature_ptr->lev * 80 / (cp_ptr->pet_upkeep_div)));
4086 if (upkeep_factor < 0)
4088 if (upkeep_factor > 1000)
4089 upkeep_factor = 1000;
4090 return upkeep_factor;
4095 bool music_singing(player_type *caster_ptr, int music_songs) { return (caster_ptr->pclass == CLASS_BARD) && (caster_ptr->magic_num1[0] == music_songs); }
4097 bool is_fast(player_type *creature_ptr) { return creature_ptr->fast || music_singing(creature_ptr, MUSIC_SPEED) || music_singing(creature_ptr, MUSIC_SHERO); }
4099 bool is_invuln(player_type *creature_ptr) { return creature_ptr->invuln || music_singing(creature_ptr, MUSIC_INVULN); }
4101 bool is_hero(player_type *creature_ptr) { return creature_ptr->hero || music_singing(creature_ptr, MUSIC_HERO) || music_singing(creature_ptr, MUSIC_SHERO); }
4103 bool is_echizen(player_type *creature_ptr)
4105 return (creature_ptr->pseikaku == PERSONALITY_COMBAT) || (creature_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON);
4108 int calc_weapon_weight_limit(player_type *creature_ptr)
4110 int weight = adj_str_hold[creature_ptr->stat_ind[A_STR]];
4112 if (have_two_handed_weapons(creature_ptr))
4118 static int get_default_hand(player_type *creature_ptr)
4120 int default_hand = 0;
4122 if (has_melee_weapon(creature_ptr, INVEN_LARM)) {
4123 if (!have_right_hand_weapon(creature_ptr))
4127 if (can_two_hands_wielding(creature_ptr)) {
4128 if (have_right_hand_weapon(creature_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_LARM)
4129 && object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_RARM])) {
4130 } else if (have_left_hand_weapon(creature_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_RARM)
4131 && object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_LARM])) {
4137 return default_hand;