1 #include "player/player-status.h"
2 #include "art-definition/fixed-art-types.h"
3 #include "autopick/autopick-reader-writer.h"
4 #include "autopick/autopick.h"
5 #include "cmd-action/cmd-pet.h"
6 #include "cmd-action/cmd-spell.h"
7 #include "cmd-io/cmd-dump.h"
8 #include "cmd-item/cmd-magiceat.h"
9 #include "combat/attack-power-table.h"
10 #include "core/asking-player.h"
11 #include "core/player-redraw-types.h"
12 #include "core/player-update-types.h"
13 #include "core/stuff-handler.h"
14 #include "core/window-redrawer.h"
15 #include "dungeon/dungeon-flag-types.h"
16 #include "dungeon/dungeon.h"
17 #include "effect/effect-characteristics.h"
18 #include "floor/cave.h"
19 #include "floor/floor-events.h"
20 #include "floor/floor-leaver.h"
21 #include "floor/floor-save.h"
22 #include "floor/floor-util.h"
23 #include "game-option/birth-options.h"
24 #include "grid/feature.h"
25 #include "inventory/inventory-object.h"
26 #include "inventory/inventory-slot-types.h"
27 #include "io/input-key-acceptor.h"
28 #include "io/write-diary.h"
29 #include "main/sound-definitions-table.h"
30 #include "main/sound-of-music.h"
31 #include "market/arena-info-table.h"
32 #include "mind/mind-force-trainer.h"
33 #include "mind/mind-ninja.h"
34 #include "monster-floor/monster-lite.h"
35 #include "monster-floor/monster-remover.h"
36 #include "monster-race/monster-race-hook.h"
37 #include "monster-race/monster-race.h"
38 #include "monster-race/race-flags1.h"
39 #include "monster-race/race-flags2.h"
40 #include "monster-race/race-flags3.h"
41 #include "monster-race/race-flags7.h"
42 #include "monster/monster-info.h"
43 #include "monster/monster-status.h"
44 #include "monster/monster-update.h"
45 #include "monster/smart-learn-types.h"
46 #include "mutation/mutation-calculator.h"
47 #include "mutation/mutation-flag-types.h"
48 #include "mutation/mutation-investor-remover.h"
49 #include "object-enchant/object-ego.h"
50 #include "object-enchant/special-object-flags.h"
51 #include "object-enchant/tr-types.h"
52 #include "object-enchant/trc-types.h"
53 #include "object-hook/hook-armor.h"
54 #include "object-hook/hook-checker.h"
55 #include "object-hook/hook-weapon.h"
56 #include "object/object-flags.h"
57 #include "object/object-info.h"
58 #include "object/object-mark-types.h"
59 #include "perception/object-perception.h"
60 #include "pet/pet-util.h"
61 #include "player-info/avatar.h"
62 #include "player/attack-defense-types.h"
63 #include "player/digestion-processor.h"
64 #include "player/mimic-info-table.h"
65 #include "player/patron.h"
66 #include "player/player-class.h"
67 #include "player/player-damage.h"
68 #include "player/player-move.h"
69 #include "player/player-personalities-types.h"
70 #include "player/player-personality.h"
71 #include "player/player-race-types.h"
72 #include "player/player-skill.h"
73 #include "player/player-status-flags.h"
74 #include "player/player-status-table.h"
75 #include "player/player-view.h"
76 #include "player/race-info-table.h"
77 #include "player/special-defense-types.h"
78 #include "realm/realm-hex-numbers.h"
79 #include "realm/realm-names-table.h"
80 #include "realm/realm-song-numbers.h"
81 #include "specific-object/bow.h"
82 #include "specific-object/torch.h"
83 #include "spell-realm/spells-hex.h"
84 #include "spell/range-calc.h"
85 #include "spell/spells-describer.h"
86 #include "spell/spells-execution.h"
87 #include "spell/spells-status.h"
88 #include "spell/technic-info-table.h"
89 #include "status/action-setter.h"
90 #include "status/base-status.h"
91 #include "sv-definition/sv-lite-types.h"
92 #include "sv-definition/sv-weapon-types.h"
93 #include "system/angband.h"
94 #include "system/floor-type-definition.h"
95 #include "term/screen-processor.h"
96 #include "util/bit-flags-calculator.h"
97 #include "util/quarks.h"
98 #include "util/string-processor.h"
99 #include "view/display-messages.h"
100 #include "world/world.h"
102 static bool is_martial_arts_mode(player_type *creature_ptr);
104 static ACTION_SKILL_POWER calc_intra_vision(player_type *creature_ptr);
105 static ACTION_SKILL_POWER calc_stealth(player_type *creature_ptr);
106 static ACTION_SKILL_POWER calc_disarming(player_type *creature_ptr);
107 static ACTION_SKILL_POWER calc_device_ability(player_type *creature_ptr);
108 static ACTION_SKILL_POWER calc_saving_throw(player_type *creature_ptr);
109 static ACTION_SKILL_POWER calc_search(player_type *creature_ptr);
110 static ACTION_SKILL_POWER calc_search_freq(player_type *creature_ptr);
111 static ACTION_SKILL_POWER calc_to_hit_melee(player_type *creature_ptr);
112 static ACTION_SKILL_POWER calc_to_hit_shoot(player_type *creature_ptr);
113 static ACTION_SKILL_POWER calc_to_hit_throw(player_type *creature_ptr);
114 static ACTION_SKILL_POWER calc_skill_dig(player_type *creature_ptr);
115 static s16b calc_num_blow(player_type *creature_ptr, int i);
116 static s16b calc_strength_addition(player_type *creature_ptr);
117 static s16b calc_intelligence_addition(player_type *creature_ptr);
118 static s16b calc_wisdom_addition(player_type *creature_ptr);
119 static s16b calc_dexterity_addition(player_type *creature_ptr);
120 static s16b calc_constitution_addition(player_type *creature_ptr);
121 static s16b calc_charisma_addition(player_type *creature_ptr);
122 static s16b calc_to_magic_chance(player_type *creature_ptr);
123 static ARMOUR_CLASS calc_base_ac(player_type *creature_ptr);
124 static ARMOUR_CLASS calc_to_ac(player_type *creature_ptr, bool is_true_value);
125 static s16b calc_speed(player_type *creature_ptr);
126 static s16b calc_double_weapon_penalty(player_type *creature_ptr, INVENTORY_IDX slot);
127 static void calc_use_status(player_type *creature_ptr, int status);
128 static void calc_top_status(player_type *creature_ptr, int status);
129 static void calc_ind_status(player_type *creature_ptr, int status);
130 static s16b calc_riding_bow_penalty(player_type *creature_ptr);
131 static void put_equipment_warning(player_type *creature_ptr);
133 static s16b calc_to_damage(player_type *creature_ptr, INVENTORY_IDX slot, bool is_true_value);
134 static s16b calc_to_hit(player_type *creature_ptr, INVENTORY_IDX slot, bool is_true_value);
136 static s16b calc_to_hit_bow(player_type *creature_ptr, bool is_true_value);
138 static s16b calc_to_damage_misc(player_type *creature_ptr);
139 static s16b calc_to_hit_misc(player_type *creature_ptr);
141 static DICE_NUMBER calc_to_weapon_dice_num(player_type *creature_ptr, INVENTORY_IDX slot);
142 static DICE_NUMBER calc_to_weapon_dice_side(player_type *creature_ptr, INVENTORY_IDX slot);
144 static int get_default_hand(player_type *creature_ptr);
146 /*** Player information ***/
149 * @brief プレイヤー用のクリーチャー構造体実体 / Static player info record
154 * @brief プレイヤー用のクリーチャー構造体参照ポインタ / Pointer to the player info
156 player_type *p_ptr = &p_body;
159 * @brief クリーチャーの抽象的善悪アライメントの表記を返す。 / Return alignment title
160 * @param creature_ptr 算出するクリーチャーの参照ポインタ。
161 * @return アライメントの表記を返す。
163 concptr your_alignment(player_type *creature_ptr)
165 if (creature_ptr->align > 150)
166 return _("大善", "Lawful");
167 else if (creature_ptr->align > 50)
168 return _("中善", "Good");
169 else if (creature_ptr->align > 10)
170 return _("小善", "Neutral Good");
171 else if (creature_ptr->align > -11)
172 return _("中立", "Neutral");
173 else if (creature_ptr->align > -51)
174 return _("小悪", "Neutral Evil");
175 else if (creature_ptr->align > -151)
176 return _("中悪", "Evil");
178 return _("大悪", "Chaotic");
182 * @brief 武器や各種スキル(騎乗以外)の抽象的表現ランクを返す。 / Return proficiency level of weapons and misc. skills (except riding)
183 * @param weapon_exp 経験値
186 int weapon_exp_level(int weapon_exp)
188 if (weapon_exp < WEAPON_EXP_BEGINNER)
189 return EXP_LEVEL_UNSKILLED;
190 else if (weapon_exp < WEAPON_EXP_SKILLED)
191 return EXP_LEVEL_BEGINNER;
192 else if (weapon_exp < WEAPON_EXP_EXPERT)
193 return EXP_LEVEL_SKILLED;
194 else if (weapon_exp < WEAPON_EXP_MASTER)
195 return EXP_LEVEL_EXPERT;
197 return EXP_LEVEL_MASTER;
201 * @brief 騎乗スキルの抽象的ランクを返す。 / Return proficiency level of riding
202 * @param weapon_exp 経験値
205 int riding_exp_level(int riding_exp)
207 if (riding_exp < RIDING_EXP_BEGINNER)
208 return EXP_LEVEL_UNSKILLED;
209 else if (riding_exp < RIDING_EXP_SKILLED)
210 return EXP_LEVEL_BEGINNER;
211 else if (riding_exp < RIDING_EXP_EXPERT)
212 return EXP_LEVEL_SKILLED;
213 else if (riding_exp < RIDING_EXP_MASTER)
214 return EXP_LEVEL_EXPERT;
216 return EXP_LEVEL_MASTER;
220 * @brief クリーチャーの呪文レベルの抽象的ランクを返す。 / Return proficiency level of spells
221 * @param spell_exp 経験値
224 int spell_exp_level(int spell_exp)
226 if (spell_exp < SPELL_EXP_BEGINNER)
227 return EXP_LEVEL_UNSKILLED;
228 else if (spell_exp < SPELL_EXP_SKILLED)
229 return EXP_LEVEL_BEGINNER;
230 else if (spell_exp < SPELL_EXP_EXPERT)
231 return EXP_LEVEL_SKILLED;
232 else if (spell_exp < SPELL_EXP_MASTER)
233 return EXP_LEVEL_EXPERT;
235 return EXP_LEVEL_MASTER;
239 * @brief 遅延描画更新 / Delayed visual update
240 * @details update_view(), update_lite(), update_mon_lite() においてのみ更新すること / Only used if update_view(), update_lite() or update_mon_lite() was called
241 * @param player_ptr 主観となるプレイヤー構造体参照ポインタ
242 * @todo 将来独自インターフェース実装にはz-term系に追い出すべきか?
245 static void delayed_visual_update(player_type *player_ptr)
247 floor_type *floor_ptr = player_ptr->current_floor_ptr;
248 for (int i = 0; i < floor_ptr->redraw_n; i++) {
249 POSITION y = floor_ptr->redraw_y[i];
250 POSITION x = floor_ptr->redraw_x[i];
252 g_ptr = &floor_ptr->grid_array[y][x];
253 if (!(g_ptr->info & CAVE_REDRAW))
256 if (g_ptr->info & CAVE_NOTE)
257 note_spot(player_ptr, y, x);
259 lite_spot(player_ptr, y, x);
261 update_monster(player_ptr, g_ptr->m_idx, FALSE);
263 g_ptr->info &= ~(CAVE_NOTE | CAVE_REDRAW);
266 floor_ptr->redraw_n = 0;
270 * @brief 射撃武器がプレイヤーにとって重すぎるかどうかの判定 /
271 * @param o_ptr 判定する射撃武器のアイテム情報参照ポインタ
272 * @return 重すぎるならばTRUE
274 static bool is_heavy_shoot(player_type *creature_ptr, object_type *o_ptr)
276 int hold = adj_str_hold[creature_ptr->stat_ind[A_STR]];
277 return (hold < o_ptr->weight / 10);
282 * @param creature_ptr 計算対象となるクリーチャーの参照ポインタ
285 WEIGHT calc_inventory_weight(player_type *creature_ptr)
290 for (inventory_slot_type i = 0; i < INVEN_TOTAL; i++) {
291 o_ptr = &creature_ptr->inventory_list[i];
294 weight += o_ptr->weight * o_ptr->number;
299 * @brief プレイヤーの全ステータスを更新する /
300 * Calculate the players current "state", taking into account
301 * not only race/class intrinsics, but also objects being worn
302 * and temporary spell effects.
306 * See also calc_mana() and calc_hitpoints().
308 * Take note of the new "speed code", in particular, a very strong
309 * player will start slowing down as soon as he reaches 150 pounds,
310 * but not until he reaches 450 pounds will he be half as fast as
311 * a normal kobold. This both hurts and helps the player, hurts
312 * because in the old days a player could just avoid 300 pounds,
313 * and helps because now carrying 300 pounds is not very painful.
315 * The "weapon" and "bow" do *not* add to the bonuses to hit or to
316 * damage, since that would affect non-combat things. These values
317 * are actually added in later, at the appropriate place.
319 * This function induces various "status" messages.
321 * @todo ここで計算していた各値は一部の状態変化メッセージ処理を除き、今後必要な時に適示計算する形に移行するためほぼすべて削られる。
323 void calc_bonuses(player_type *creature_ptr)
325 int empty_hands_status = empty_hands(creature_ptr, TRUE);
328 /* Save the old vision stuff */
329 BIT_FLAGS old_telepathy = creature_ptr->telepathy;
330 BIT_FLAGS old_esp_animal = creature_ptr->esp_animal;
331 BIT_FLAGS old_esp_undead = creature_ptr->esp_undead;
332 BIT_FLAGS old_esp_demon = creature_ptr->esp_demon;
333 BIT_FLAGS old_esp_orc = creature_ptr->esp_orc;
334 BIT_FLAGS old_esp_troll = creature_ptr->esp_troll;
335 BIT_FLAGS old_esp_giant = creature_ptr->esp_giant;
336 BIT_FLAGS old_esp_dragon = creature_ptr->esp_dragon;
337 BIT_FLAGS old_esp_human = creature_ptr->esp_human;
338 BIT_FLAGS old_esp_evil = creature_ptr->esp_evil;
339 BIT_FLAGS old_esp_good = creature_ptr->esp_good;
340 BIT_FLAGS old_esp_nonliving = creature_ptr->esp_nonliving;
341 BIT_FLAGS old_esp_unique = creature_ptr->esp_unique;
342 BIT_FLAGS old_see_inv = creature_ptr->see_inv;
343 BIT_FLAGS old_mighty_throw = creature_ptr->mighty_throw;
344 s16b old_speed = creature_ptr->pspeed;
346 ARMOUR_CLASS old_dis_ac = creature_ptr->dis_ac;
347 ARMOUR_CLASS old_dis_to_a = creature_ptr->dis_to_a;
349 creature_ptr->pass_wall = has_pass_wall(creature_ptr);
350 creature_ptr->kill_wall = has_kill_wall(creature_ptr);
351 creature_ptr->xtra_might = has_xtra_might(creature_ptr);
352 creature_ptr->esp_evil = has_esp_evil(creature_ptr);
353 creature_ptr->esp_animal = has_esp_animal(creature_ptr);
354 creature_ptr->esp_undead = has_esp_undead(creature_ptr);
355 creature_ptr->esp_demon = has_esp_demon(creature_ptr);
356 creature_ptr->esp_orc = has_esp_orc(creature_ptr);
357 creature_ptr->esp_troll = has_esp_troll(creature_ptr);
358 creature_ptr->esp_giant = has_esp_giant(creature_ptr);
359 creature_ptr->esp_dragon = has_esp_dragon(creature_ptr);
360 creature_ptr->esp_human = has_esp_human(creature_ptr);
361 creature_ptr->esp_good = has_esp_good(creature_ptr);
362 creature_ptr->esp_nonliving = has_esp_nonliving(creature_ptr);
363 creature_ptr->esp_unique = has_esp_unique(creature_ptr);
364 creature_ptr->telepathy = has_esp_telepathy(creature_ptr);
365 creature_ptr->bless_blade = has_bless_blade(creature_ptr);
366 creature_ptr->easy_2weapon = has_easy2_weapon(creature_ptr);
367 creature_ptr->down_saving = has_down_saving(creature_ptr);
368 creature_ptr->yoiyami = has_no_ac(creature_ptr);
369 creature_ptr->mighty_throw = has_mighty_throw(creature_ptr);
370 creature_ptr->dec_mana = has_dec_mana(creature_ptr);
371 creature_ptr->reflect = has_reflect(creature_ptr);
372 creature_ptr->see_nocto = has_see_nocto(creature_ptr);
373 creature_ptr->warning = has_warning(creature_ptr);
374 creature_ptr->anti_magic = has_anti_magic(creature_ptr);
375 creature_ptr->anti_tele = has_anti_tele(creature_ptr);
376 creature_ptr->sh_fire = has_sh_fire(creature_ptr);
377 creature_ptr->sh_elec = has_sh_elec(creature_ptr);
378 creature_ptr->sh_cold = has_sh_cold(creature_ptr);
379 creature_ptr->easy_spell = has_easy_spell(creature_ptr);
380 creature_ptr->heavy_spell = has_heavy_spell(creature_ptr);
381 creature_ptr->hold_exp = has_hold_exp(creature_ptr);
382 creature_ptr->see_inv = has_see_inv(creature_ptr);
383 creature_ptr->free_act = has_free_act(creature_ptr);
384 creature_ptr->sustain_str = has_sustain_str(creature_ptr);
385 creature_ptr->sustain_int = has_sustain_int(creature_ptr);
386 creature_ptr->sustain_wis = has_sustain_wis(creature_ptr);
387 creature_ptr->sustain_dex = has_sustain_dex(creature_ptr);
388 creature_ptr->sustain_con = has_sustain_con(creature_ptr);
389 creature_ptr->sustain_chr = has_sustain_chr(creature_ptr);
390 creature_ptr->levitation = has_levitation(creature_ptr);
391 has_can_swim(creature_ptr);
392 creature_ptr->slow_digest = has_slow_digest(creature_ptr);
393 creature_ptr->regenerate = has_regenerate(creature_ptr);
394 has_curses(creature_ptr);
395 creature_ptr->impact = has_impact(creature_ptr);
396 has_extra_blow(creature_ptr);
397 creature_ptr->resist_acid = has_resist_acid(creature_ptr);
398 creature_ptr->resist_elec = has_resist_elec(creature_ptr);
399 creature_ptr->resist_fire = has_resist_fire(creature_ptr);
400 creature_ptr->resist_cold = has_resist_cold(creature_ptr);
401 creature_ptr->resist_pois = has_resist_pois(creature_ptr);
402 creature_ptr->resist_conf = has_resist_conf(creature_ptr);
403 creature_ptr->resist_sound = has_resist_sound(creature_ptr);
404 creature_ptr->resist_lite = has_resist_lite(creature_ptr);
405 creature_ptr->resist_dark = has_resist_dark(creature_ptr);
406 creature_ptr->resist_chaos = has_resist_chaos(creature_ptr);
407 creature_ptr->resist_disen = has_resist_disen(creature_ptr);
408 creature_ptr->resist_shard = has_resist_shard(creature_ptr);
409 creature_ptr->resist_nexus = has_resist_nexus(creature_ptr);
410 creature_ptr->resist_blind = has_resist_blind(creature_ptr);
411 creature_ptr->resist_neth = has_resist_neth(creature_ptr);
412 creature_ptr->resist_time = has_resist_time(creature_ptr);
413 creature_ptr->resist_fear = has_resist_fear(creature_ptr);
414 creature_ptr->resist_time = has_resist_time(creature_ptr);
415 creature_ptr->resist_water = has_resist_water(creature_ptr);
417 creature_ptr->lite = has_lite(creature_ptr);
419 if (creature_ptr->special_defense & KAMAE_MASK) {
420 if (!(empty_hands_status & EMPTY_HAND_RARM)) {
421 set_action(creature_ptr, ACTION_NONE);
425 creature_ptr->stat_add[A_STR] = calc_strength_addition(creature_ptr);
426 creature_ptr->stat_add[A_INT] = calc_intelligence_addition(creature_ptr);
427 creature_ptr->stat_add[A_WIS] = calc_wisdom_addition(creature_ptr);
428 creature_ptr->stat_add[A_DEX] = calc_dexterity_addition(creature_ptr);
429 creature_ptr->stat_add[A_CON] = calc_constitution_addition(creature_ptr);
430 creature_ptr->stat_add[A_CHR] = calc_charisma_addition(creature_ptr);
431 creature_ptr->to_m_chance = calc_to_magic_chance(creature_ptr);
432 creature_ptr->ac = calc_base_ac(creature_ptr);
433 creature_ptr->to_a = calc_to_ac(creature_ptr, TRUE);
434 creature_ptr->dis_ac = calc_base_ac(creature_ptr);
435 creature_ptr->dis_to_a = calc_to_ac(creature_ptr, FALSE);
437 for (int i = 0; i < A_MAX; i++) {
438 calc_top_status(creature_ptr, i);
439 calc_use_status(creature_ptr, i);
440 calc_ind_status(creature_ptr, i);
443 o_ptr = &creature_ptr->inventory_list[INVEN_BOW];
445 creature_ptr->tval_ammo = (byte)bow_tval_ammo(o_ptr);
446 if (o_ptr->k_idx && !is_heavy_shoot(creature_ptr, &creature_ptr->inventory_list[INVEN_BOW])) {
447 creature_ptr->num_fire = calc_num_fire(creature_ptr, o_ptr);
451 for (int i = 0; i < 2; i++) {
452 creature_ptr->icky_wield[i] = has_icky_wield_weapon(creature_ptr, i);
453 creature_ptr->riding_wield[i] = has_riding_wield_weapon(creature_ptr, i);
454 creature_ptr->num_blow[i] = calc_num_blow(creature_ptr, i);
455 creature_ptr->to_dd[i] = calc_to_weapon_dice_num(creature_ptr, INVEN_RARM + i);
456 creature_ptr->to_ds[i] = calc_to_weapon_dice_side(creature_ptr, INVEN_RARM + i);
459 creature_ptr->pspeed = calc_speed(creature_ptr);
460 creature_ptr->see_infra = calc_intra_vision(creature_ptr);
461 creature_ptr->skill_stl = calc_stealth(creature_ptr);
462 creature_ptr->skill_dis = calc_disarming(creature_ptr);
463 creature_ptr->skill_dev = calc_device_ability(creature_ptr);
464 creature_ptr->skill_sav = calc_saving_throw(creature_ptr);
465 creature_ptr->skill_srh = calc_search(creature_ptr);
466 creature_ptr->skill_fos = calc_search_freq(creature_ptr);
467 creature_ptr->skill_thn = calc_to_hit_melee(creature_ptr);
468 creature_ptr->skill_thb = calc_to_hit_shoot(creature_ptr);
469 creature_ptr->skill_tht = calc_to_hit_throw(creature_ptr);
470 creature_ptr->to_d[0] = calc_to_damage(creature_ptr, INVEN_RARM, TRUE);
471 creature_ptr->to_d[1] = calc_to_damage(creature_ptr, INVEN_LARM, TRUE);
472 creature_ptr->dis_to_d[0] = calc_to_damage(creature_ptr, INVEN_RARM, FALSE);
473 creature_ptr->dis_to_d[1] = calc_to_damage(creature_ptr, INVEN_LARM, FALSE);
474 creature_ptr->to_h[0] = calc_to_hit(creature_ptr, INVEN_RARM, TRUE);
475 creature_ptr->to_h[1] = calc_to_hit(creature_ptr, INVEN_LARM, TRUE);
476 creature_ptr->dis_to_h[0] = calc_to_hit(creature_ptr, INVEN_RARM, FALSE);
477 creature_ptr->dis_to_h[1] = calc_to_hit(creature_ptr, INVEN_LARM, FALSE);
478 creature_ptr->to_h_b = calc_to_hit_bow(creature_ptr, TRUE);
479 creature_ptr->dis_to_h_b = calc_to_hit_bow(creature_ptr, FALSE);
480 creature_ptr->to_d_m = calc_to_damage_misc(creature_ptr);
481 creature_ptr->to_h_m = calc_to_hit_misc(creature_ptr);
482 creature_ptr->skill_dig = calc_skill_dig(creature_ptr);
484 if (old_mighty_throw != creature_ptr->mighty_throw) {
485 creature_ptr->window |= PW_INVEN;
488 if (creature_ptr->telepathy != old_telepathy) {
489 creature_ptr->update |= (PU_MONSTERS);
492 if ((creature_ptr->esp_animal != old_esp_animal) || (creature_ptr->esp_undead != old_esp_undead) || (creature_ptr->esp_demon != old_esp_demon)
493 || (creature_ptr->esp_orc != old_esp_orc) || (creature_ptr->esp_troll != old_esp_troll) || (creature_ptr->esp_giant != old_esp_giant)
494 || (creature_ptr->esp_dragon != old_esp_dragon) || (creature_ptr->esp_human != old_esp_human) || (creature_ptr->esp_evil != old_esp_evil)
495 || (creature_ptr->esp_good != old_esp_good) || (creature_ptr->esp_nonliving != old_esp_nonliving) || (creature_ptr->esp_unique != old_esp_unique)) {
496 creature_ptr->update |= (PU_MONSTERS);
499 if (creature_ptr->see_inv != old_see_inv) {
500 creature_ptr->update |= (PU_MONSTERS);
503 if (creature_ptr->pspeed != old_speed) {
504 creature_ptr->redraw |= (PR_SPEED);
507 if ((creature_ptr->dis_ac != old_dis_ac) || (creature_ptr->dis_to_a != old_dis_to_a)) {
508 creature_ptr->redraw |= (PR_ARMOR);
509 creature_ptr->window |= (PW_PLAYER);
512 if (current_world_ptr->character_xtra)
515 put_equipment_warning(creature_ptr);
518 static void calc_alignment(player_type *creature_ptr)
520 creature_ptr->align = 0;
521 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
522 for (MONSTER_IDX m_idx = floor_ptr->m_max - 1; m_idx >= 1; m_idx--) {
525 m_ptr = &floor_ptr->m_list[m_idx];
526 if (!monster_is_valid(m_ptr))
528 r_ptr = &r_info[m_ptr->r_idx];
533 if (r_ptr->flags3 & RF3_GOOD)
534 creature_ptr->align += r_ptr->level;
535 if (r_ptr->flags3 & RF3_EVIL)
536 creature_ptr->align -= r_ptr->level;
539 if (creature_ptr->mimic_form) {
540 switch (creature_ptr->mimic_form) {
542 creature_ptr->align -= 200;
544 case MIMIC_DEMON_LORD:
545 creature_ptr->align -= 200;
549 switch (creature_ptr->prace) {
551 creature_ptr->align += 200;
554 creature_ptr->align -= 200;
559 for (int i = 0; i < 2; i++) {
560 if (!has_melee_weapon(creature_ptr, INVEN_RARM + i))
562 if (creature_ptr->inventory_list[INVEN_RARM + i].name1 != ART_IRON_BALL)
564 creature_ptr->align -= 1000;
569 for (int i = 0; i < 8; i++) {
570 switch (creature_ptr->vir_types[i]) {
572 creature_ptr->align += creature_ptr->virtues[i] * 2;
581 creature_ptr->align -= creature_ptr->virtues[i];
584 creature_ptr->align += creature_ptr->virtues[i];
589 for (int i = 0; i < j; i++) {
590 if (creature_ptr->align > 0) {
591 creature_ptr->align -= creature_ptr->virtues[neutral[i]] / 2;
592 if (creature_ptr->align < 0)
593 creature_ptr->align = 0;
594 } else if (creature_ptr->align < 0) {
595 creature_ptr->align += creature_ptr->virtues[neutral[i]] / 2;
596 if (creature_ptr->align > 0)
597 creature_ptr->align = 0;
603 * @brief プレイヤーの最大HPを計算する /
604 * Calculate the players (maximal) hit points
605 * Adjust current hitpoints if necessary
609 static void calc_hitpoints(player_type *creature_ptr)
611 int bonus = ((int)(adj_con_mhp[creature_ptr->stat_ind[A_CON]]) - 128) * creature_ptr->lev / 4;
612 int mhp = creature_ptr->player_hp[creature_ptr->lev - 1];
615 if (creature_ptr->mimic_form) {
616 if (creature_ptr->pclass == CLASS_SORCERER)
617 tmp_hitdie = mimic_info[creature_ptr->mimic_form].r_mhp / 2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
619 tmp_hitdie = mimic_info[creature_ptr->mimic_form].r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
620 mhp = mhp * tmp_hitdie / creature_ptr->hitdie;
623 if (creature_ptr->pclass == CLASS_SORCERER) {
624 if (creature_ptr->lev < 30)
625 mhp = (mhp * (45 + creature_ptr->lev) / 100);
627 mhp = (mhp * 75 / 100);
628 bonus = (bonus * 65 / 100);
633 if (creature_ptr->pclass == CLASS_BERSERKER) {
634 mhp = mhp * (110 + (((creature_ptr->lev + 40) * (creature_ptr->lev + 40) - 1550) / 110)) / 100;
637 if (mhp < creature_ptr->lev + 1)
638 mhp = creature_ptr->lev + 1;
639 if (is_hero(creature_ptr))
641 if (is_shero(creature_ptr))
643 if (creature_ptr->tsuyoshi)
645 if (hex_spelling(creature_ptr, HEX_XTRA_MIGHT))
647 if (hex_spelling(creature_ptr, HEX_BUILDING))
649 if (creature_ptr->mhp == mhp)
652 if (creature_ptr->chp >= mhp) {
653 creature_ptr->chp = mhp;
654 creature_ptr->chp_frac = 0;
658 if (creature_ptr->level_up_message && (mhp > creature_ptr->mhp)) {
659 msg_format("最大ヒット・ポイントが %d 増加した!", (mhp - creature_ptr->mhp));
662 creature_ptr->mhp = mhp;
664 creature_ptr->redraw |= PR_HP;
665 creature_ptr->window |= PW_PLAYER;
669 * @brief プレイヤーの現在学習可能な魔法数を計算し、増減に応じて魔法の忘却、再学習を処置する。 /
670 * Calculate number of spells player should have, and forget,
671 * or remember, spells until that number is properly reflected.
674 * Note that this function induces various "status" messages,
675 * which must be bypasses until the character is created.
677 static void calc_spells(player_type *creature_ptr)
679 if (!mp_ptr->spell_book)
681 if (!current_world_ptr->character_generated)
683 if (current_world_ptr->character_xtra)
685 if ((creature_ptr->pclass == CLASS_SORCERER) || (creature_ptr->pclass == CLASS_RED_MAGE)) {
686 creature_ptr->new_spells = 0;
690 concptr p = spell_category_name(mp_ptr->spell_book);
691 int levels = creature_ptr->lev - mp_ptr->spell_first + 1;
695 int num_allowed = (adj_mag_study[creature_ptr->stat_ind[mp_ptr->spell_stat]] * levels / 2);
697 if ((creature_ptr->pclass != CLASS_SAMURAI) && (mp_ptr->spell_book != TV_LIFE_BOOK)) {
701 if (creature_ptr->pclass == CLASS_SAMURAI) {
703 } else if (creature_ptr->realm2 == REALM_NONE) {
704 num_allowed = (num_allowed + 1) / 2;
705 if (num_allowed > (32 + bonus))
706 num_allowed = 32 + bonus;
707 } else if ((creature_ptr->pclass == CLASS_MAGE) || (creature_ptr->pclass == CLASS_PRIEST)) {
708 if (num_allowed > (96 + bonus))
709 num_allowed = 96 + bonus;
711 if (num_allowed > (80 + bonus))
712 num_allowed = 80 + bonus;
715 int num_boukyaku = 0;
716 for (int j = 0; j < 64; j++) {
717 if ((j < 32) ? (creature_ptr->spell_forgotten1 & (1L << j)) : (creature_ptr->spell_forgotten2 & (1L << (j - 32)))) {
722 creature_ptr->new_spells = num_allowed + creature_ptr->add_spells + num_boukyaku - creature_ptr->learned_spells;
723 for (int i = 63; i >= 0; i--) {
724 if (!creature_ptr->spell_learned1 && !creature_ptr->spell_learned2)
727 int j = creature_ptr->spell_order[i];
731 const magic_type *s_ptr;
732 if (!is_magic((j < 32) ? creature_ptr->realm1 : creature_ptr->realm2)) {
734 s_ptr = &technic_info[creature_ptr->realm1 - MIN_TECHNIC][j];
736 s_ptr = &technic_info[creature_ptr->realm2 - MIN_TECHNIC][j % 32];
738 s_ptr = &mp_ptr->info[creature_ptr->realm1 - 1][j];
740 s_ptr = &mp_ptr->info[creature_ptr->realm2 - 1][j % 32];
742 if (s_ptr->slevel <= creature_ptr->lev)
745 bool is_spell_learned = (j < 32) ? (creature_ptr->spell_learned1 & (1L << j)) : (creature_ptr->spell_learned2 & (1L << (j - 32)));
746 if (!is_spell_learned)
751 creature_ptr->spell_forgotten1 |= (1L << j);
752 which = creature_ptr->realm1;
754 creature_ptr->spell_forgotten2 |= (1L << (j - 32));
755 which = creature_ptr->realm2;
759 creature_ptr->spell_learned1 &= ~(1L << j);
760 which = creature_ptr->realm1;
762 creature_ptr->spell_learned2 &= ~(1L << (j - 32));
763 which = creature_ptr->realm2;
767 msg_format("%sの%sを忘れてしまった。", exe_spell(creature_ptr, which, j % 32, SPELL_NAME), p);
769 msg_format("You have forgotten the %s of %s.", p, exe_spell(creature_ptr, which, j % 32, SPELL_NAME));
771 creature_ptr->new_spells++;
774 /* Forget spells if we know too many spells */
775 for (int i = 63; i >= 0; i--) {
776 if (creature_ptr->new_spells >= 0)
778 if (!creature_ptr->spell_learned1 && !creature_ptr->spell_learned2)
781 int j = creature_ptr->spell_order[i];
785 bool is_spell_learned = (j < 32) ? (creature_ptr->spell_learned1 & (1L << j)) : (creature_ptr->spell_learned2 & (1L << (j - 32)));
786 if (!is_spell_learned)
791 creature_ptr->spell_forgotten1 |= (1L << j);
792 which = creature_ptr->realm1;
794 creature_ptr->spell_forgotten2 |= (1L << (j - 32));
795 which = creature_ptr->realm2;
799 creature_ptr->spell_learned1 &= ~(1L << j);
800 which = creature_ptr->realm1;
802 creature_ptr->spell_learned2 &= ~(1L << (j - 32));
803 which = creature_ptr->realm2;
807 msg_format("%sの%sを忘れてしまった。", exe_spell(creature_ptr, which, j % 32, SPELL_NAME), p);
809 msg_format("You have forgotten the %s of %s.", p, exe_spell(creature_ptr, which, j % 32, SPELL_NAME));
811 creature_ptr->new_spells++;
814 /* Check for spells to remember */
815 for (int i = 0; i < 64; i++) {
816 if (creature_ptr->new_spells <= 0)
818 if (!creature_ptr->spell_forgotten1 && !creature_ptr->spell_forgotten2)
820 int j = creature_ptr->spell_order[i];
824 const magic_type *s_ptr;
825 if (!is_magic((j < 32) ? creature_ptr->realm1 : creature_ptr->realm2)) {
827 s_ptr = &technic_info[creature_ptr->realm1 - MIN_TECHNIC][j];
829 s_ptr = &technic_info[creature_ptr->realm2 - MIN_TECHNIC][j % 32];
831 s_ptr = &mp_ptr->info[creature_ptr->realm1 - 1][j];
833 s_ptr = &mp_ptr->info[creature_ptr->realm2 - 1][j % 32];
835 if (s_ptr->slevel > creature_ptr->lev)
838 bool is_spell_learned = (j < 32) ? (creature_ptr->spell_forgotten1 & (1L << j)) : (creature_ptr->spell_forgotten2 & (1L << (j - 32)));
839 if (!is_spell_learned)
844 creature_ptr->spell_forgotten1 &= ~(1L << j);
845 which = creature_ptr->realm1;
847 creature_ptr->spell_forgotten2 &= ~(1L << (j - 32));
848 which = creature_ptr->realm2;
852 creature_ptr->spell_learned1 |= (1L << j);
853 which = creature_ptr->realm1;
855 creature_ptr->spell_learned2 |= (1L << (j - 32));
856 which = creature_ptr->realm2;
860 msg_format("%sの%sを思い出した。", exe_spell(creature_ptr, which, j % 32, SPELL_NAME), p);
862 msg_format("You have remembered the %s of %s.", p, exe_spell(creature_ptr, which, j % 32, SPELL_NAME));
864 creature_ptr->new_spells--;
867 if (creature_ptr->realm2 == REALM_NONE) {
869 for (int j = 0; j < 32; j++) {
870 const magic_type *s_ptr;
871 if (!is_magic(creature_ptr->realm1))
872 s_ptr = &technic_info[creature_ptr->realm1 - MIN_TECHNIC][j];
874 s_ptr = &mp_ptr->info[creature_ptr->realm1 - 1][j];
876 if (s_ptr->slevel > creature_ptr->lev)
879 if (creature_ptr->spell_learned1 & (1L << j)) {
888 if ((creature_ptr->new_spells > k) && ((mp_ptr->spell_book == TV_LIFE_BOOK) || (mp_ptr->spell_book == TV_HISSATSU_BOOK))) {
889 creature_ptr->new_spells = (s16b)k;
893 if (creature_ptr->new_spells < 0)
894 creature_ptr->new_spells = 0;
896 if (creature_ptr->old_spells == creature_ptr->new_spells)
899 if (creature_ptr->new_spells) {
901 if (creature_ptr->new_spells < 10) {
902 msg_format("あと %d つの%sを学べる。", creature_ptr->new_spells, p);
904 msg_format("あと %d 個の%sを学べる。", creature_ptr->new_spells, p);
907 msg_format("You can learn %d more %s%s.", creature_ptr->new_spells, p, (creature_ptr->new_spells != 1) ? "s" : "");
911 creature_ptr->old_spells = creature_ptr->new_spells;
912 creature_ptr->redraw |= PR_STUDY;
913 creature_ptr->window |= PW_OBJECT;
917 * @brief プレイヤーの最大MPを計算する /
918 * Calculate maximum mana. You do not need to know any spells.
919 * Note that mana is lowered by heavy (or inappropriate) armor.
922 * This function induces status messages.
924 static void calc_mana(player_type *creature_ptr)
926 if (!mp_ptr->spell_book)
930 if ((creature_ptr->pclass == CLASS_MINDCRAFTER) || (creature_ptr->pclass == CLASS_MIRROR_MASTER) || (creature_ptr->pclass == CLASS_BLUE_MAGE)) {
931 levels = creature_ptr->lev;
933 if (mp_ptr->spell_first > creature_ptr->lev) {
934 creature_ptr->msp = 0;
935 creature_ptr->redraw |= (PR_MANA);
939 levels = (creature_ptr->lev - mp_ptr->spell_first) + 1;
943 if (creature_ptr->pclass == CLASS_SAMURAI) {
944 msp = (adj_mag_mana[creature_ptr->stat_ind[mp_ptr->spell_stat]] + 10) * 2;
946 msp += (msp * rp_ptr->r_adj[mp_ptr->spell_stat] / 20);
948 msp = adj_mag_mana[creature_ptr->stat_ind[mp_ptr->spell_stat]] * (levels + 3) / 4;
952 msp += (msp * rp_ptr->r_adj[mp_ptr->spell_stat] / 20);
953 if (msp && (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN))
955 if (msp && (creature_ptr->pclass == CLASS_HIGH_MAGE))
957 if (msp && (creature_ptr->pclass == CLASS_SORCERER))
958 msp += msp * (25 + creature_ptr->lev) / 100;
961 if (mp_ptr->spell_xtra & MAGIC_GLOVE_REDUCE_MANA) {
962 BIT_FLAGS flgs[TR_FLAG_SIZE];
963 creature_ptr->cumber_glove = FALSE;
965 o_ptr = &creature_ptr->inventory_list[INVEN_HANDS];
966 object_flags(creature_ptr, o_ptr, flgs);
967 if (o_ptr->k_idx && !(has_flag(flgs, TR_FREE_ACT)) && !(has_flag(flgs, TR_DEC_MANA)) && !(has_flag(flgs, TR_EASY_SPELL))
968 && !((has_flag(flgs, TR_MAGIC_MASTERY)) && (o_ptr->pval > 0)) && !((has_flag(flgs, TR_DEX)) && (o_ptr->pval > 0))) {
969 creature_ptr->cumber_glove = TRUE;
974 creature_ptr->cumber_armor = FALSE;
977 if (creature_ptr->inventory_list[INVEN_RARM].tval > TV_SWORD)
978 cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight;
979 if (creature_ptr->inventory_list[INVEN_LARM].tval > TV_SWORD)
980 cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight;
981 cur_wgt += creature_ptr->inventory_list[INVEN_BODY].weight;
982 cur_wgt += creature_ptr->inventory_list[INVEN_HEAD].weight;
983 cur_wgt += creature_ptr->inventory_list[INVEN_OUTER].weight;
984 cur_wgt += creature_ptr->inventory_list[INVEN_HANDS].weight;
985 cur_wgt += creature_ptr->inventory_list[INVEN_FEET].weight;
987 switch (creature_ptr->pclass) {
989 case CLASS_HIGH_MAGE:
990 case CLASS_BLUE_MAGE:
992 case CLASS_FORCETRAINER:
993 case CLASS_SORCERER: {
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;
1002 case CLASS_TOURIST: {
1003 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD)
1004 cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight * 2 / 3;
1005 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD)
1006 cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight * 2 / 3;
1009 case CLASS_MINDCRAFTER:
1010 case CLASS_BEASTMASTER:
1011 case CLASS_MIRROR_MASTER: {
1012 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD)
1013 cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight / 2;
1014 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD)
1015 cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight / 2;
1020 case CLASS_RED_MAGE:
1021 case CLASS_WARRIOR_MAGE: {
1022 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD)
1023 cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight / 3;
1024 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD)
1025 cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight / 3;
1029 case CLASS_CHAOS_WARRIOR: {
1030 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD)
1031 cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight / 5;
1032 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD)
1033 cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight / 5;
1041 int max_wgt = mp_ptr->spell_weight;
1042 if ((cur_wgt - max_wgt) > 0) {
1043 creature_ptr->cumber_armor = TRUE;
1044 switch (creature_ptr->pclass) {
1046 case CLASS_HIGH_MAGE:
1047 case CLASS_BLUE_MAGE: {
1048 msp -= msp * (cur_wgt - max_wgt) / 600;
1052 case CLASS_MINDCRAFTER:
1053 case CLASS_BEASTMASTER:
1055 case CLASS_FORCETRAINER:
1057 case CLASS_MIRROR_MASTER: {
1058 msp -= msp * (cur_wgt - max_wgt) / 800;
1061 case CLASS_SORCERER: {
1062 msp -= msp * (cur_wgt - max_wgt) / 900;
1068 case CLASS_RED_MAGE: {
1069 msp -= msp * (cur_wgt - max_wgt) / 1000;
1073 case CLASS_CHAOS_WARRIOR:
1074 case CLASS_WARRIOR_MAGE: {
1075 msp -= msp * (cur_wgt - max_wgt) / 1200;
1078 case CLASS_SAMURAI: {
1079 creature_ptr->cumber_armor = FALSE;
1083 msp -= msp * (cur_wgt - max_wgt) / 800;
1092 if (creature_ptr->msp != msp) {
1093 if ((creature_ptr->csp >= msp) && (creature_ptr->pclass != CLASS_SAMURAI)) {
1094 creature_ptr->csp = msp;
1095 creature_ptr->csp_frac = 0;
1099 if (creature_ptr->level_up_message && (msp > creature_ptr->msp)) {
1100 msg_format("最大マジック・ポイントが %d 増加した!", (msp - creature_ptr->msp));
1103 creature_ptr->msp = msp;
1104 creature_ptr->redraw |= (PR_MANA);
1105 creature_ptr->window |= (PW_PLAYER | PW_SPELL);
1108 if (current_world_ptr->character_xtra)
1111 if (creature_ptr->old_cumber_glove != creature_ptr->cumber_glove) {
1112 if (creature_ptr->cumber_glove)
1113 msg_print(_("手が覆われて呪文が唱えにくい感じがする。", "Your covered hands feel unsuitable for spellcasting."));
1115 msg_print(_("この手の状態なら、ぐっと呪文が唱えやすい感じだ。", "Your hands feel more suitable for spellcasting."));
1117 creature_ptr->old_cumber_glove = creature_ptr->cumber_glove;
1120 if (creature_ptr->old_cumber_armor == creature_ptr->cumber_armor)
1123 if (creature_ptr->cumber_armor)
1124 msg_print(_("装備の重さで動きが鈍くなってしまっている。", "The weight of your equipment encumbers your movement."));
1126 msg_print(_("ぐっと楽に体を動かせるようになった。", "You feel able to move more freely."));
1128 creature_ptr->old_cumber_armor = creature_ptr->cumber_armor;
1132 * @brief 装備中の射撃武器の威力倍率を返す /
1133 * calcurate the fire rate of target object
1134 * @param o_ptr 計算する射撃武器のアイテム情報参照ポインタ
1135 * @return 射撃倍率の値(100で1.00倍)
1137 s16b calc_num_fire(player_type *creature_ptr, object_type *o_ptr)
1139 int extra_shots = 0;
1140 BIT_FLAGS flgs[TR_FLAG_SIZE];
1141 creature_ptr->num_fire = 100;
1142 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1144 q_ptr = &creature_ptr->inventory_list[i];
1151 object_flags(creature_ptr, q_ptr, flgs);
1152 if (has_flag(flgs, TR_XTRA_SHOTS))
1156 object_flags(creature_ptr, o_ptr, flgs);
1157 if (has_flag(flgs, TR_XTRA_SHOTS))
1161 if (o_ptr->k_idx == 0 || is_heavy_shoot(creature_ptr, o_ptr))
1165 num += (extra_shots * 100);
1167 tval_type tval_ammo = bow_tval_ammo(o_ptr);
1168 if ((creature_ptr->pclass == CLASS_RANGER) && (tval_ammo == TV_ARROW)) {
1169 num += (creature_ptr->lev * 4);
1172 if ((creature_ptr->pclass == CLASS_CAVALRY) && (tval_ammo == TV_ARROW)) {
1173 num += (creature_ptr->lev * 3);
1176 if (creature_ptr->pclass == CLASS_ARCHER) {
1177 if (tval_ammo == TV_ARROW)
1178 num += ((creature_ptr->lev * 5) + 50);
1179 else if ((tval_ammo == TV_BOLT) || (tval_ammo == TV_SHOT))
1180 num += (creature_ptr->lev * 4);
1183 if (creature_ptr->pclass == CLASS_WARRIOR && (tval_ammo <= TV_BOLT) && (tval_ammo >= TV_SHOT)) {
1184 num += (creature_ptr->lev * 2);
1187 if ((creature_ptr->pclass == CLASS_ROGUE) && (tval_ammo == TV_SHOT)) {
1188 num += (creature_ptr->lev * 4);
1196 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1200 * * 変異MUT3_INFRAVISによる加算(+3)
1201 * * 魔法効果tim_infraによる加算(+3)
1202 * * 装備がTR_INFRAフラグ持ちなら加算(+pval*1)
1204 static ACTION_SKILL_POWER calc_intra_vision(player_type *creature_ptr)
1206 ACTION_SKILL_POWER pow;
1207 const player_race *tmp_rp_ptr;
1209 if (creature_ptr->mimic_form)
1210 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1212 tmp_rp_ptr = &race_info[creature_ptr->prace];
1214 pow = tmp_rp_ptr->infra;
1216 if (creature_ptr->muta3 & MUT3_INFRAVIS) {
1220 if (creature_ptr->tim_infra) {
1224 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1226 BIT_FLAGS flgs[TR_FLAG_SIZE];
1227 o_ptr = &creature_ptr->inventory_list[i];
1230 object_flags(creature_ptr, o_ptr, flgs);
1231 if (has_flag(flgs, TR_INFRA))
1240 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1246 * * 装備による修正(TR_STEALTHがあれば+pval*1)
1247 * * 変異MUT3_XTRA_NOISで減算(-3)
1248 * * 変異MUT3_MOTIONで加算(+1)
1249 * * 呪術を唱えていると減算(-(詠唱数+1))
1250 * * セクシーギャルでない影フェアリーがTRC_AGGRAVATE持ちの時、別処理でTRC_AGGRAVATEを無効にする代わりに減算(-3か3未満なら(現在値+2)/2)
1252 * * 忍者がheavy_armorならば減算(-レベル/10)
1253 * * 忍者がheavy_armorでなく適正な武器を持っていれば加算(+レベル/10)
1257 static ACTION_SKILL_POWER calc_stealth(player_type *creature_ptr)
1259 ACTION_SKILL_POWER pow;
1260 const player_race *tmp_rp_ptr;
1262 if (creature_ptr->mimic_form)
1263 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1265 tmp_rp_ptr = &race_info[creature_ptr->prace];
1266 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1267 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1269 pow = 1 + tmp_rp_ptr->r_stl + c_ptr->c_stl + a_ptr->a_stl;
1270 pow += (c_ptr->x_stl * creature_ptr->lev / 10);
1272 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1274 BIT_FLAGS flgs[TR_FLAG_SIZE];
1275 o_ptr = &creature_ptr->inventory_list[i];
1278 object_flags(creature_ptr, o_ptr, flgs);
1279 if (has_flag(flgs, TR_STEALTH))
1283 if (creature_ptr->muta3 & MUT3_XTRA_NOIS) {
1286 if (creature_ptr->muta3 & MUT3_MOTION) {
1289 if (creature_ptr->realm1 == REALM_HEX) {
1290 if (hex_spelling_any(creature_ptr))
1291 pow -= (1 + casting_hex_num(creature_ptr));
1293 if ((is_specific_player_race(creature_ptr, RACE_S_FAIRY)) && (creature_ptr->pseikaku != PERSONALITY_SEXY) && (creature_ptr->cursed & TRC_AGGRAVATE)) {
1294 pow = MIN(pow - 3, (pow + 2) / 2);
1297 if (is_shero(creature_ptr)) {
1301 if (creature_ptr->pclass == CLASS_NINJA && heavy_armor(creature_ptr)) {
1302 pow -= (creature_ptr->lev) / 10;
1303 } else if ((!creature_ptr->inventory_list[INVEN_RARM].k_idx || has_right_hand_weapon(creature_ptr))
1304 && (!creature_ptr->inventory_list[INVEN_LARM].k_idx || has_left_hand_weapon(creature_ptr))) {
1305 pow += (creature_ptr->lev) / 10;
1308 if (is_time_limit_stealth(creature_ptr))
1321 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1325 * * 職業と性格とレベルによる追加加算
1326 * * 器用さに応じたadj_dex_disテーブルによる加算
1327 * * 知力に応じたadj_int_disテーブルによる加算
1329 static ACTION_SKILL_POWER calc_disarming(player_type *creature_ptr)
1331 ACTION_SKILL_POWER pow;
1332 const player_race *tmp_rp_ptr;
1334 if (creature_ptr->mimic_form)
1335 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1337 tmp_rp_ptr = &race_info[creature_ptr->prace];
1338 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1339 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1341 pow = tmp_rp_ptr->r_dis + c_ptr->c_dis + a_ptr->a_dis;
1342 pow += ((cp_ptr->x_dis * creature_ptr->lev / 10) + (ap_ptr->a_dis * creature_ptr->lev / 50));
1343 pow += adj_dex_dis[creature_ptr->stat_ind[A_DEX]];
1344 pow += adj_int_dis[creature_ptr->stat_ind[A_INT]];
1350 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1354 * * 職業と性格とレベルによる追加加算
1355 * * 装備による加算(TR_MAGIC_MASTERYを持っていたら+pval*8)
1356 * * 知力に応じたadj_int_devテーブルによる加算
1359 static ACTION_SKILL_POWER calc_device_ability(player_type *creature_ptr)
1361 ACTION_SKILL_POWER pow;
1362 const player_race *tmp_rp_ptr;
1364 if (creature_ptr->mimic_form)
1365 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1367 tmp_rp_ptr = &race_info[creature_ptr->prace];
1368 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1369 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1371 pow = tmp_rp_ptr->r_dev + c_ptr->c_dev + a_ptr->a_dev;
1372 pow += ((c_ptr->x_dev * creature_ptr->lev / 10) + (ap_ptr->a_dev * creature_ptr->lev / 50));
1374 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1376 BIT_FLAGS flgs[TR_FLAG_SIZE];
1377 o_ptr = &creature_ptr->inventory_list[i];
1380 object_flags(creature_ptr, o_ptr, flgs);
1381 if (has_flag(flgs, TR_MAGIC_MASTERY))
1382 pow += 8 * o_ptr->pval;
1385 pow += adj_int_dev[creature_ptr->stat_ind[A_INT]];
1387 if (is_shero(creature_ptr)) {
1395 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1399 * * 職業と性格とレベルによる追加加算
1400 * * 変異MUT3_MAGIC_RESによる加算(15 + レベル / 5)
1401 * * 賢さによるadj_wis_savテーブル加算
1403 * * 反魔法持ちで大なり上書き(90+レベル未満ならその値に上書き)
1404 * * クターのつぶれ状態なら(10に上書き)
1405 * * 生命の「究極の耐性」や regist_magic,magicdef持ちなら大なり上書き(95+レベル未満ならその値に上書き)
1406 * * 呪いのdown_savingがかかっているなら半減
1408 static ACTION_SKILL_POWER calc_saving_throw(player_type *creature_ptr)
1410 ACTION_SKILL_POWER pow;
1411 const player_race *tmp_rp_ptr;
1413 if (creature_ptr->mimic_form)
1414 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1416 tmp_rp_ptr = &race_info[creature_ptr->prace];
1417 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1418 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1420 pow = tmp_rp_ptr->r_sav + c_ptr->c_sav + a_ptr->a_sav;
1421 pow += ((cp_ptr->x_sav * creature_ptr->lev / 10) + (ap_ptr->a_sav * creature_ptr->lev / 50));
1423 if (creature_ptr->muta3 & MUT3_MAGIC_RES)
1424 pow += (15 + (creature_ptr->lev / 5));
1426 pow += adj_wis_sav[creature_ptr->stat_ind[A_WIS]];
1428 if (is_shero(creature_ptr))
1431 if (creature_ptr->anti_magic && (pow < (90 + creature_ptr->lev)))
1432 pow = 90 + creature_ptr->lev;
1434 if (creature_ptr->tsubureru)
1437 if ((creature_ptr->ult_res || creature_ptr->resist_magic || creature_ptr->magicdef) && (pow < (95 + creature_ptr->lev)))
1438 pow = 95 + creature_ptr->lev;
1440 if (creature_ptr->down_saving)
1448 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1453 * * 各装備による加算(TR_SEARCHがあれば+pval*5)
1455 * * 変異(MUT3_XTRA_EYES)による加算(+15)
1457 static ACTION_SKILL_POWER calc_search(player_type *creature_ptr)
1459 ACTION_SKILL_POWER pow;
1460 const player_race *tmp_rp_ptr;
1462 if (creature_ptr->mimic_form)
1463 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1465 tmp_rp_ptr = &race_info[creature_ptr->prace];
1466 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1467 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1469 pow = tmp_rp_ptr->r_srh + c_ptr->c_srh + a_ptr->a_srh;
1470 pow += (c_ptr->x_srh * creature_ptr->lev / 10);
1472 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1474 BIT_FLAGS flgs[TR_FLAG_SIZE];
1475 o_ptr = &creature_ptr->inventory_list[i];
1478 object_flags(creature_ptr, o_ptr, flgs);
1479 if (has_flag(flgs, TR_SEARCH))
1480 pow += (o_ptr->pval * 5);
1483 if (creature_ptr->muta3 & MUT3_XTRA_EYES) {
1487 if (is_shero(creature_ptr)) {
1496 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1501 * * 各装備による加算(TR_SEARCHがあれば+pval*5)
1503 * * 変異(MUT3_XTRA_EYES)による加算(+15)
1505 static ACTION_SKILL_POWER calc_search_freq(player_type *creature_ptr)
1507 ACTION_SKILL_POWER pow;
1508 const player_race *tmp_rp_ptr;
1510 if (creature_ptr->mimic_form)
1511 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1513 tmp_rp_ptr = &race_info[creature_ptr->prace];
1514 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1515 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1517 pow = tmp_rp_ptr->r_fos + c_ptr->c_fos + a_ptr->a_fos;
1518 pow += (c_ptr->x_fos * creature_ptr->lev / 10);
1520 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1522 BIT_FLAGS flgs[TR_FLAG_SIZE];
1523 o_ptr = &creature_ptr->inventory_list[i];
1526 object_flags(creature_ptr, o_ptr, flgs);
1527 if (has_flag(flgs, TR_SEARCH))
1528 pow += (o_ptr->pval * 5);
1531 if (is_shero(creature_ptr)) {
1535 if (creature_ptr->muta3 & MUT3_XTRA_EYES) {
1544 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1547 * * 種族/職業/性格による加算とレベルによる追加加算
1549 static ACTION_SKILL_POWER calc_to_hit_melee(player_type *creature_ptr)
1551 ACTION_SKILL_POWER pow;
1552 const player_race *tmp_rp_ptr;
1553 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1554 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1556 if (creature_ptr->mimic_form)
1557 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1559 tmp_rp_ptr = &race_info[creature_ptr->prace];
1561 pow = tmp_rp_ptr->r_thn + c_ptr->c_thn + a_ptr->a_thn;
1562 pow += ((c_ptr->x_thn * creature_ptr->lev / 10) + (a_ptr->a_thn * creature_ptr->lev / 50));
1568 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1571 * * 種族/職業/性格による加算とレベルによる追加加算
1573 static ACTION_SKILL_POWER calc_to_hit_shoot(player_type *creature_ptr)
1575 ACTION_SKILL_POWER pow;
1576 const player_race *tmp_rp_ptr;
1577 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1578 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1580 if (creature_ptr->mimic_form)
1581 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1583 tmp_rp_ptr = &race_info[creature_ptr->prace];
1585 pow = tmp_rp_ptr->r_thb + c_ptr->c_thb + a_ptr->a_thb;
1586 pow += ((c_ptr->x_thb * creature_ptr->lev / 10) + (a_ptr->a_thb * creature_ptr->lev / 50));
1592 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1595 * * 種族/職業/性格による加算とレベルによる追加加算
1598 static ACTION_SKILL_POWER calc_to_hit_throw(player_type *creature_ptr)
1600 ACTION_SKILL_POWER pow;
1601 const player_race *tmp_rp_ptr;
1602 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1603 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1605 if (creature_ptr->mimic_form)
1606 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1608 tmp_rp_ptr = &race_info[creature_ptr->prace];
1610 pow = tmp_rp_ptr->r_thb + c_ptr->c_thb + a_ptr->a_thb;
1611 pow += ((c_ptr->x_thb * creature_ptr->lev / 10) + (a_ptr->a_thb * creature_ptr->lev / 50));
1613 if (is_shero(creature_ptr)) {
1622 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1633 static ACTION_SKILL_POWER calc_skill_dig(player_type *creature_ptr)
1636 BIT_FLAGS flgs[TR_FLAG_SIZE];
1638 ACTION_SKILL_POWER pow;
1642 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_ENT && !creature_ptr->inventory_list[INVEN_RARM].k_idx) {
1643 pow += creature_ptr->lev * 10;
1646 if (is_shero(creature_ptr))
1649 pow += adj_str_dig[creature_ptr->stat_ind[A_STR]];
1651 if (creature_ptr->pclass == CLASS_BERSERKER)
1652 pow += (100 + creature_ptr->lev * 8);
1654 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1655 o_ptr = &creature_ptr->inventory_list[i];
1658 object_flags(creature_ptr, o_ptr, flgs);
1659 if (has_flag(flgs, TR_TUNNEL))
1660 pow += (o_ptr->pval * 20);
1663 for (int i = 0; i < 2; i++) {
1664 o_ptr = &creature_ptr->inventory_list[INVEN_RARM + i];
1665 if (has_melee_weapon(creature_ptr, INVEN_RARM + i) && !creature_ptr->heavy_wield[i]) {
1666 pow += (o_ptr->weight / 10);
1670 if (is_shero(creature_ptr)) {
1680 static bool is_martial_arts_mode(player_type *creature_ptr)
1682 return ((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER) || (creature_ptr->pclass == CLASS_BERSERKER))
1683 && (empty_hands(creature_ptr, TRUE) & EMPTY_HAND_RARM) && !has_left_hand_weapon(creature_ptr);
1686 static s16b calc_num_blow(player_type *creature_ptr, int i)
1689 BIT_FLAGS flgs[TR_FLAG_SIZE];
1692 o_ptr = &creature_ptr->inventory_list[INVEN_RARM + i];
1693 object_flags(creature_ptr, o_ptr, flgs);
1694 creature_ptr->heavy_wield[i] = FALSE;
1695 if (!has_melee_weapon(creature_ptr, INVEN_RARM + i)) {
1698 if (calc_weapon_weight_limit(creature_ptr) < o_ptr->weight / 10) {
1699 creature_ptr->heavy_wield[i] = TRUE;
1702 if (o_ptr->k_idx && !creature_ptr->heavy_wield[i]) {
1703 int str_index, dex_index;
1704 int num = 0, wgt = 0, mul = 0, div = 0;
1706 num = class_info[creature_ptr->pclass].num;
1707 wgt = class_info[creature_ptr->pclass].wgt;
1708 mul = class_info[creature_ptr->pclass].mul;
1710 if (creature_ptr->pclass == CLASS_CAVALRY && (creature_ptr->riding) && (has_flag(flgs, TR_RIDING))) {
1716 if (hex_spelling(creature_ptr, HEX_XTRA_MIGHT) || hex_spelling(creature_ptr, HEX_BUILDING)) {
1722 div = ((o_ptr->weight < wgt) ? wgt : o_ptr->weight);
1723 str_index = (adj_str_blow[creature_ptr->stat_ind[A_STR]] * mul / div);
1725 if (has_two_handed_weapons(creature_ptr) && !has_disable_two_handed_bonus(creature_ptr, 0))
1727 if (creature_ptr->pclass == CLASS_NINJA)
1728 str_index = MAX(0, str_index - 1);
1732 dex_index = (adj_dex_blow[creature_ptr->stat_ind[A_DEX]]);
1736 num_blow = blows_table[str_index][dex_index];
1738 num_blow = (s16b)num;
1740 num_blow += (s16b)creature_ptr->extra_blows[i];
1741 if (creature_ptr->pclass == CLASS_WARRIOR)
1742 num_blow += (creature_ptr->lev / 40);
1743 else if (creature_ptr->pclass == CLASS_BERSERKER)
1744 num_blow += (creature_ptr->lev / 23);
1745 else if ((creature_ptr->pclass == CLASS_ROGUE) && (o_ptr->weight < 50) && (creature_ptr->stat_ind[A_DEX] >= 30))
1748 if (creature_ptr->special_defense & KATA_FUUJIN)
1751 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_POISON_NEEDLE))
1761 /* Different calculation for monks with empty hands */
1762 if (is_martial_arts_mode(creature_ptr)) {
1763 int blow_base = creature_ptr->lev + adj_dex_blow[creature_ptr->stat_ind[A_DEX]];
1766 if (creature_ptr->pclass == CLASS_FORCETRAINER) {
1776 MAGIC_NUM1 current_ki = get_current_ki(creature_ptr);
1777 if (current_ki != i) {
1778 creature_ptr->to_d[i] += current_ki / 5;
1779 creature_ptr->dis_to_d[i] += current_ki / 5;
1798 if (heavy_armor(creature_ptr) && (creature_ptr->pclass != CLASS_BERSERKER))
1801 if (creature_ptr->special_defense & KAMAE_GENBU) {
1802 creature_ptr->to_a += (creature_ptr->lev * creature_ptr->lev) / 50;
1803 creature_ptr->dis_to_a += (creature_ptr->lev * creature_ptr->lev) / 50;
1805 if ((creature_ptr->pclass == CLASS_MONK) && (creature_ptr->lev > 42))
1809 } else if (creature_ptr->special_defense & KAMAE_SUZAKU) {
1810 creature_ptr->to_h[i] -= (creature_ptr->lev / 3);
1811 creature_ptr->to_d[i] -= (creature_ptr->lev / 6);
1813 creature_ptr->dis_to_h[i] -= (creature_ptr->lev / 3);
1814 creature_ptr->dis_to_d[i] -= (creature_ptr->lev / 6);
1818 num_blow += 1 + creature_ptr->extra_blows[0];
1821 if (has_not_ninja_weapon(creature_ptr, i)) {
1832 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1836 * * エントは別途レベル26,41,46到達ごとに加算(+1)
1837 * * 装備がTR_STRフラグを持っていれば加算(+pval*1)
1843 * * 変異MUT3_HYPER_STRで加算(+4)
1844 * * 変異MUT3_PUNYで減算(-4)
1845 * * ネオ・つよしスペシャル中で加算(+4)
1847 static s16b calc_strength_addition(player_type *creature_ptr)
1850 const player_race *tmp_rp_ptr;
1851 if (creature_ptr->mimic_form)
1852 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1854 tmp_rp_ptr = &race_info[creature_ptr->prace];
1855 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1856 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1857 pow = tmp_rp_ptr->r_adj[A_STR] + c_ptr->c_adj[A_STR] + a_ptr->a_adj[A_STR];
1859 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_ENT) {
1860 if (creature_ptr->lev > 25)
1862 if (creature_ptr->lev > 40)
1864 if (creature_ptr->lev > 45)
1868 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1870 BIT_FLAGS flgs[TR_FLAG_SIZE];
1871 o_ptr = &creature_ptr->inventory_list[i];
1874 object_flags(creature_ptr, o_ptr, flgs);
1875 if (has_flag(flgs, TR_STR)) {
1880 if (creature_ptr->realm1 == REALM_HEX) {
1881 if (hex_spelling(creature_ptr, HEX_XTRA_MIGHT)) {
1884 if (hex_spelling(creature_ptr, HEX_BUILDING)) {
1889 if (creature_ptr->special_defense & KATA_KOUKIJIN) {
1893 if (creature_ptr->special_defense & KAMAE_BYAKKO) {
1895 } else if (creature_ptr->special_defense & KAMAE_SUZAKU) {
1899 if (creature_ptr->muta3) {
1901 if (creature_ptr->muta3 & MUT3_HYPER_STR) {
1905 if (creature_ptr->muta3 & MUT3_PUNY) {
1910 if (creature_ptr->tsuyoshi) {
1918 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1922 * * 装備がTR_INTフラグを持っていれば加算(+pval*1)
1928 * * 変異MUT3_HYPER_INTで加算(+4)
1929 * * 変異MUT3_MORONICで減算(-4)
1931 s16b calc_intelligence_addition(player_type *creature_ptr)
1934 const player_race *tmp_rp_ptr;
1935 if (creature_ptr->mimic_form)
1936 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1938 tmp_rp_ptr = &race_info[creature_ptr->prace];
1939 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1940 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1941 pow = tmp_rp_ptr->r_adj[A_INT] + c_ptr->c_adj[A_INT] + a_ptr->a_adj[A_INT];
1943 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1945 BIT_FLAGS flgs[TR_FLAG_SIZE];
1946 o_ptr = &creature_ptr->inventory_list[i];
1949 object_flags(creature_ptr, o_ptr, flgs);
1950 if (has_flag(flgs, TR_INT)) {
1955 if (creature_ptr->special_defense & KATA_KOUKIJIN) {
1959 if (creature_ptr->special_defense & KAMAE_GENBU) {
1961 } else if (creature_ptr->special_defense & KAMAE_SUZAKU) {
1965 if (creature_ptr->muta3) {
1966 if (creature_ptr->muta3 & MUT3_HYPER_INT) {
1970 if (creature_ptr->muta3 & MUT3_MORONIC) {
1980 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1984 * * 装備がTR_WISフラグを持っていれば加算(+pval*1)
1990 * * 変異MUT3_HYPER_INTで加算(+4)
1991 * * 変異MUT3_MORONICで減算(-4)
1993 static s16b calc_wisdom_addition(player_type *creature_ptr)
1996 const player_race *tmp_rp_ptr;
1997 if (creature_ptr->mimic_form)
1998 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
2000 tmp_rp_ptr = &race_info[creature_ptr->prace];
2001 const player_class *c_ptr = &class_info[creature_ptr->pclass];
2002 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
2003 pow = tmp_rp_ptr->r_adj[A_WIS] + c_ptr->c_adj[A_WIS] + a_ptr->a_adj[A_WIS];
2005 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2007 BIT_FLAGS flgs[TR_FLAG_SIZE];
2008 o_ptr = &creature_ptr->inventory_list[i];
2011 object_flags(creature_ptr, o_ptr, flgs);
2012 if (has_flag(flgs, TR_WIS)) {
2017 if (creature_ptr->special_defense & KATA_KOUKIJIN) {
2021 if (creature_ptr->special_defense & KAMAE_GENBU) {
2023 } else if (creature_ptr->special_defense & KAMAE_SUZAKU) {
2027 if (creature_ptr->muta3) {
2029 if (creature_ptr->muta3 & MUT3_HYPER_INT) {
2033 if (creature_ptr->muta3 & MUT3_MORONIC) {
2043 * @param creature_ptr 計算するクリーチャーの参照ポインタ
2047 * * エントは別途レベル26,41,46到達ごとに減算(-1)
2048 * * 装備がTR_DEXフラグを持っていれば加算(+pval*1)
2054 * * 変異MUT3_IRON_SKINで減算(-1)
2055 * * 変異MUT3_LIMBERで加算(+3)
2056 * * 変異MUT3_ARTHRITISで減算(-3)
2058 static s16b calc_dexterity_addition(player_type *creature_ptr)
2061 const player_race *tmp_rp_ptr;
2062 if (creature_ptr->mimic_form)
2063 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
2065 tmp_rp_ptr = &race_info[creature_ptr->prace];
2066 const player_class *c_ptr = &class_info[creature_ptr->pclass];
2067 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
2068 pow = tmp_rp_ptr->r_adj[A_DEX] + c_ptr->c_adj[A_DEX] + a_ptr->a_adj[A_DEX];
2070 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_ENT) {
2071 if (creature_ptr->lev > 25)
2073 if (creature_ptr->lev > 40)
2075 if (creature_ptr->lev > 45)
2079 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2081 BIT_FLAGS flgs[TR_FLAG_SIZE];
2082 o_ptr = &creature_ptr->inventory_list[i];
2085 object_flags(creature_ptr, o_ptr, flgs);
2086 if (has_flag(flgs, TR_DEX)) {
2091 if (creature_ptr->realm1 == REALM_HEX) {
2092 if (hex_spelling(creature_ptr, HEX_BUILDING)) {
2097 if (creature_ptr->special_defense & KATA_KOUKIJIN) {
2101 if (creature_ptr->special_defense & KAMAE_BYAKKO) {
2103 } else if (creature_ptr->special_defense & KAMAE_GENBU) {
2105 } else if (creature_ptr->special_defense & KAMAE_SUZAKU) {
2109 if (creature_ptr->muta3 & MUT3_IRON_SKIN) {
2113 if (creature_ptr->muta3 & MUT3_LIMBER) {
2117 if (creature_ptr->muta3 & MUT3_ARTHRITIS) {
2126 * @param creature_ptr 計算するクリーチャーの参照ポインタ
2130 * * エントは別途レベル26,41,46到達ごとに加算(+1)
2131 * * 装備がTR_CONフラグを持っていれば加算(+pval*1)
2137 * * 変異MUT3_RESILIENTで加算(+4)
2138 * * 変異MUT3_ALBINOで減算(-4)
2139 * * 変異MUT3_XTRA_FATで加算(+2)
2140 * * 変異MUT3_FLESH_ROTで減算(-2)
2141 * * ネオ・つよしスペシャル中で加算(+4)
2143 static s16b calc_constitution_addition(player_type *creature_ptr)
2146 const player_race *tmp_rp_ptr;
2147 if (creature_ptr->mimic_form)
2148 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
2150 tmp_rp_ptr = &race_info[creature_ptr->prace];
2151 const player_class *c_ptr = &class_info[creature_ptr->pclass];
2152 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
2153 pow = tmp_rp_ptr->r_adj[A_CON] + c_ptr->c_adj[A_CON] + a_ptr->a_adj[A_CON];
2155 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_ENT) {
2156 if (creature_ptr->lev > 25)
2158 if (creature_ptr->lev > 40)
2160 if (creature_ptr->lev > 45)
2164 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2166 BIT_FLAGS flgs[TR_FLAG_SIZE];
2167 o_ptr = &creature_ptr->inventory_list[i];
2170 object_flags(creature_ptr, o_ptr, flgs);
2171 if (has_flag(flgs, TR_CON))
2175 if (creature_ptr->realm1 == REALM_HEX) {
2176 if (hex_spelling(creature_ptr, HEX_BUILDING)) {
2181 if (creature_ptr->special_defense & KATA_KOUKIJIN) {
2185 if (creature_ptr->special_defense & KAMAE_BYAKKO) {
2187 } else if (creature_ptr->special_defense & KAMAE_GENBU) {
2189 } else if (creature_ptr->special_defense & KAMAE_SUZAKU) {
2193 if (creature_ptr->muta3) {
2194 if (creature_ptr->muta3 & MUT3_RESILIENT) {
2198 if (creature_ptr->muta3 & MUT3_ALBINO) {
2202 if (creature_ptr->muta3 & MUT3_XTRA_FAT) {
2206 if (creature_ptr->muta3 & MUT3_FLESH_ROT) {
2211 if (creature_ptr->tsuyoshi) {
2220 * @param creature_ptr 計算するクリーチャーの参照ポインタ
2224 * * 装備がTR_CHRフラグを持っていれば加算(+pval*1)
2227 * * 変異MUT3_FLESH_ROTで減算(-1)
2228 * * 変異MUT3_SILLY_VOIで減算(-4)
2229 * * 変異MUT3_BLANK_FACで減算(-1)
2230 * * 変異MUT3_WART_SKINで減算(-2)
2231 * * 変異MUT3_SCALESで減算(-1)
2232 * * 変異MUT3_ILL_NORMで0固定(後で個体値のみ上書きを行う)
2234 static s16b calc_charisma_addition(player_type *creature_ptr)
2237 const player_race *tmp_rp_ptr;
2238 if (creature_ptr->mimic_form)
2239 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
2241 tmp_rp_ptr = &race_info[creature_ptr->prace];
2242 const player_class *c_ptr = &class_info[creature_ptr->pclass];
2243 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
2244 pow = tmp_rp_ptr->r_adj[A_CHR] + c_ptr->c_adj[A_CHR] + a_ptr->a_adj[A_CHR];
2246 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2248 BIT_FLAGS flgs[TR_FLAG_SIZE];
2249 o_ptr = &creature_ptr->inventory_list[i];
2252 object_flags(creature_ptr, o_ptr, flgs);
2253 if (has_flag(flgs, TR_CHR))
2257 if (creature_ptr->special_defense & KATA_KOUKIJIN) {
2261 if (creature_ptr->muta3) {
2262 if (creature_ptr->muta3 & MUT3_FLESH_ROT) {
2265 if (creature_ptr->muta3 & MUT3_SILLY_VOI) {
2268 if (creature_ptr->muta3 & MUT3_BLANK_FAC) {
2271 if (creature_ptr->muta3 & MUT3_WART_SKIN) {
2274 if (creature_ptr->muta3 & MUT3_SCALES) {
2277 if (creature_ptr->muta3 & MUT3_ILL_NORM) {
2287 * @param creature_ptr 計算するクリーチャーの参照ポインタ
2290 * * 性格なまけものなら加算(+10)
2292 * * 性格ちからじまんとがまんづよいなら加算(+1)
2293 * * 性格チャージマンなら加算(+5)
2294 * * 装備品にTRC_LOW_MAGICがあるなら加算(軽い呪いなら+3/重い呪いなら+10)
2296 static s16b calc_to_magic_chance(player_type *creature_ptr)
2300 if (creature_ptr->pseikaku == PERSONALITY_LAZY)
2302 if (creature_ptr->pseikaku == PERSONALITY_SHREWD)
2304 if ((creature_ptr->pseikaku == PERSONALITY_PATIENT) || (creature_ptr->pseikaku == PERSONALITY_MIGHTY))
2306 if (creature_ptr->pseikaku == PERSONALITY_CHARGEMAN)
2309 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2311 BIT_FLAGS flgs[TR_FLAG_SIZE];
2312 o_ptr = &creature_ptr->inventory_list[i];
2315 object_flags(creature_ptr, o_ptr, flgs);
2316 if (o_ptr->curse_flags & TRC_LOW_MAGIC) {
2317 if (o_ptr->curse_flags & TRC_HEAVY_CURSE) {
2327 static ARMOUR_CLASS calc_base_ac(player_type *creature_ptr)
2329 ARMOUR_CLASS ac = 0;
2330 if (creature_ptr->yoiyami)
2333 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2335 o_ptr = &creature_ptr->inventory_list[i];
2341 if (object_is_armour(creature_ptr, &creature_ptr->inventory_list[INVEN_RARM])
2342 || object_is_armour(creature_ptr, &creature_ptr->inventory_list[INVEN_LARM])) {
2343 ac += creature_ptr->skill_exp[GINOU_SHIELD] * (1 + creature_ptr->lev / 22) / 2000;
2349 static ARMOUR_CLASS calc_to_ac(player_type *creature_ptr, bool is_true_value)
2351 ARMOUR_CLASS ac = 0;
2352 if (creature_ptr->yoiyami)
2355 ac += ((int)(adj_dex_ta[creature_ptr->stat_ind[A_DEX]]) - 128);
2357 if (creature_ptr->mimic_form) {
2358 switch (creature_ptr->mimic_form) {
2362 case MIMIC_DEMON_LORD:
2370 if (creature_ptr->pclass == CLASS_BERSERKER) {
2371 ac += 10 + creature_ptr->lev / 2;
2373 if (creature_ptr->pclass == CLASS_SORCERER) {
2377 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2379 o_ptr = &creature_ptr->inventory_list[i];
2382 if (is_true_value || object_is_known(o_ptr))
2385 if (o_ptr->curse_flags & TRC_LOW_AC) {
2386 if (o_ptr->curse_flags & TRC_HEAVY_CURSE) {
2387 if (is_true_value || object_is_fully_known(o_ptr))
2390 if (is_true_value || object_is_fully_known(o_ptr))
2395 if ((i == INVEN_LARM) && (o_ptr->tval == TV_SWORD) && ((o_ptr->sval == SV_MAIN_GAUCHE) || (o_ptr->sval == SV_WAKIZASHI))) {
2400 if (is_specific_player_race(creature_ptr, RACE_GOLEM) || is_specific_player_race(creature_ptr, RACE_ANDROID)) {
2401 ac += 10 + (creature_ptr->lev * 2 / 5);
2404 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_QUICKTHORN) && (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_TINYTHORN)) {
2408 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI)) {
2412 if (creature_ptr->muta3 & MUT3_WART_SKIN) {
2416 if (creature_ptr->muta3 & MUT3_SCALES) {
2420 if (creature_ptr->muta3 & MUT3_IRON_SKIN) {
2424 if (((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER)) && !heavy_armor(creature_ptr)) {
2425 if (!(creature_ptr->inventory_list[INVEN_BODY].k_idx)) {
2426 ac += (creature_ptr->lev * 3) / 2;
2428 if (!(creature_ptr->inventory_list[INVEN_OUTER].k_idx) && (creature_ptr->lev > 15)) {
2429 ac += ((creature_ptr->lev - 13) / 3);
2431 if (!(creature_ptr->inventory_list[INVEN_LARM].k_idx) && (creature_ptr->lev > 10)) {
2432 ac += ((creature_ptr->lev - 8) / 3);
2434 if (!(creature_ptr->inventory_list[INVEN_HEAD].k_idx) && (creature_ptr->lev > 4)) {
2435 ac += (creature_ptr->lev - 2) / 3;
2437 if (!(creature_ptr->inventory_list[INVEN_HANDS].k_idx)) {
2438 ac += (creature_ptr->lev / 2);
2440 if (!(creature_ptr->inventory_list[INVEN_FEET].k_idx)) {
2441 ac += (creature_ptr->lev / 3);
2445 if (creature_ptr->realm1 == REALM_HEX) {
2446 if (hex_spelling(creature_ptr, HEX_ICE_ARMOR)) {
2450 for (inventory_slot_type i = INVEN_RARM; i <= INVEN_FEET; i++) {
2451 object_type *o_ptr = &creature_ptr->inventory_list[i];
2454 if (!object_is_armour(creature_ptr, o_ptr))
2456 if (!object_is_cursed(o_ptr))
2458 if (o_ptr->curse_flags & TRC_CURSED)
2460 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
2462 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
2467 if (creature_ptr->special_defense & KAMAE_BYAKKO) {
2469 } else if (creature_ptr->special_defense & KAMAE_SEIRYU) {
2471 } else if (creature_ptr->special_defense & KATA_KOUKIJIN) {
2475 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
2477 } else if (creature_ptr->tsubureru || creature_ptr->shield || creature_ptr->magicdef) {
2481 if (is_blessed(creature_ptr)) {
2485 if (is_shero(creature_ptr)) {
2489 if (creature_ptr->pclass == CLASS_NINJA) {
2490 if ((!creature_ptr->inventory_list[INVEN_RARM].k_idx || has_right_hand_weapon(creature_ptr))
2491 && (!creature_ptr->inventory_list[INVEN_LARM].k_idx || has_left_hand_weapon(creature_ptr))) {
2492 ac += creature_ptr->lev / 2 + 5;
2501 * @param creature_ptr 計算するクリーチャーの参照ポインタ
2506 * ** クラッコンと妖精に加算(+レベル/10)
2507 * ** 悪魔変化/吸血鬼変化で加算(+3)
2509 * ** 装備品にTR_SPEEDがあれば加算(+pval+1
2510 * ** 忍者の装備が重ければ減算(-レベル/10)
2511 * ** 忍者の装備が適正ならば加算(+3)さらにクラッコン、妖精、いかさま以外なら加算(+レベル/10)
2512 * ** 錬気術師で装備が重くなくクラッコン、妖精、いかさま以外なら加算(+レベル/10)
2513 * ** 狂戦士なら加算(+3),レベル20/30/40/50ごとに+1
2514 * ** いかさまでクラッコン/妖精以外なら加算(+5+レベル/10)
2517 * ** 呪術「衝撃のクローク」で加算(+3)
2520 * ** 変異MUT3_XTRA_FATなら減算(-2)
2521 * ** 変異MUT3_XTRA_LEGなら加算(+3)
2522 * ** 変異MUT3_SHORT_LEGなら減算(-3)
2523 * ** マーフォークがFF_WATER地形にいれば加算(+2+レベル/10)
2524 * ** そうでなく浮遊を持っていないなら減算(-2)
2525 * ** 棘セット装備中ならば加算(+7)
2526 * * 騎乗中ならばモンスターの加速に準拠、ただし騎乗技能値とモンスターレベルによるキャップ処理あり
2528 * * 光速移動中かこの時点で+99を超えていたら+99にキャップ
2531 static s16b calc_speed(player_type *creature_ptr)
2533 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
2534 feature_type *f_ptr = &f_info[floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat];
2538 int j = calc_inventory_weight(creature_ptr);
2541 if (!creature_ptr->riding) {
2542 if (is_specific_player_race(creature_ptr, RACE_KLACKON) || is_specific_player_race(creature_ptr, RACE_SPRITE))
2543 pow += (creature_ptr->lev) / 10;
2545 if (creature_ptr->mimic_form) {
2546 switch (creature_ptr->mimic_form) {
2550 case MIMIC_DEMON_LORD:
2559 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2560 object_type *o_ptr = &creature_ptr->inventory_list[i];
2561 BIT_FLAGS flgs[TR_FLAG_SIZE];
2562 object_flags(creature_ptr, o_ptr, flgs);
2566 if (has_flag(flgs, TR_SPEED))
2570 if (creature_ptr->pclass == CLASS_NINJA) {
2571 if (heavy_armor(creature_ptr)) {
2572 pow -= (creature_ptr->lev) / 10;
2573 } else if ((!creature_ptr->inventory_list[INVEN_RARM].k_idx || has_right_hand_weapon(creature_ptr))
2574 && (!creature_ptr->inventory_list[INVEN_LARM].k_idx || has_left_hand_weapon(creature_ptr))) {
2576 if (!(is_specific_player_race(creature_ptr, RACE_KLACKON) || is_specific_player_race(creature_ptr, RACE_SPRITE)
2577 || (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN)))
2578 pow += (creature_ptr->lev) / 10;
2582 if (creature_ptr->pclass == CLASS_FORCETRAINER && !(heavy_armor(creature_ptr))) {
2583 if (!(is_specific_player_race(creature_ptr, RACE_KLACKON) || is_specific_player_race(creature_ptr, RACE_SPRITE)
2584 || (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN)))
2585 pow += (creature_ptr->lev) / 10;
2588 if (creature_ptr->pclass == CLASS_BERSERKER) {
2590 if (creature_ptr->lev > 29)
2592 if (creature_ptr->lev > 39)
2594 if (creature_ptr->lev > 44)
2596 if (creature_ptr->lev > 49)
2600 if (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN && creature_ptr->prace != RACE_KLACKON && creature_ptr->prace != RACE_SPRITE) {
2601 pow += (creature_ptr->lev) / 10 + 5;
2604 if (is_fast(creature_ptr)) {
2608 if (creature_ptr->slow) {
2612 if (creature_ptr->realm1 == REALM_HEX) {
2613 if (hex_spelling(creature_ptr, HEX_SHOCK_CLOAK)) {
2618 if (creature_ptr->food >= PY_FOOD_MAX)
2621 if (creature_ptr->special_defense & KAMAE_SUZAKU)
2624 if (creature_ptr->muta3) {
2626 if (creature_ptr->muta3 & MUT3_XTRA_FAT) {
2630 if (creature_ptr->muta3 & MUT3_XTRA_LEGS) {
2634 if (creature_ptr->muta3 & MUT3_SHORT_LEG) {
2639 if (creature_ptr->prace == RACE_MERFOLK) {
2640 if (has_flag(f_ptr->flags, FF_WATER)) {
2641 pow += (2 + creature_ptr->lev / 10);
2642 } else if (!creature_ptr->levitation) {
2647 if (has_melee_weapon(creature_ptr, INVEN_RARM) && has_melee_weapon(creature_ptr, INVEN_LARM)) {
2648 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_QUICKTHORN) && (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_TINYTHORN)) {
2653 count = (int)calc_weight_limit(creature_ptr);
2655 pow -= ((j - count) / (count / 5));
2658 monster_type *riding_m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding];
2659 monster_race *riding_r_ptr = &r_info[riding_m_ptr->r_idx];
2660 SPEED speed = riding_m_ptr->mspeed;
2662 if (riding_m_ptr->mspeed > 110) {
2663 pow = 110 + (s16b)((speed - 110) * (creature_ptr->skill_exp[GINOU_RIDING] * 3 + creature_ptr->lev * 160L - 10000L) / (22000L));
2670 pow += (creature_ptr->skill_exp[GINOU_RIDING] + creature_ptr->lev * 160L) / 3200;
2672 if (monster_fast_remaining(riding_m_ptr))
2674 if (monster_slow_remaining(riding_m_ptr))
2677 if (creature_ptr->skill_exp[GINOU_RIDING] < RIDING_EXP_SKILLED)
2678 j += (creature_ptr->wt * 3 * (RIDING_EXP_SKILLED - creature_ptr->skill_exp[GINOU_RIDING])) / RIDING_EXP_SKILLED;
2680 count = 1500 + riding_r_ptr->level * 25;
2682 pow -= ((j - count) / (count / 5));
2685 if (creature_ptr->action == ACTION_SEARCH)
2688 /* Maximum speed is (+99). (internally it's 110 + 99) */
2689 /* Temporary lightspeed forces to be maximum speed */
2690 if ((creature_ptr->lightspeed && !creature_ptr->riding) || (pow > 209)) {
2694 /* Minimum speed is (-99). (internally it's 110 - 99) */
2702 * @brief 二刀流ペナルティ量計算
2703 * @param creature_ptr 計算するクリーチャーの参照ポインタ
2704 * @param slot ペナルティ量を計算する武器スロット
2710 * * マンゴーシュ/脇差を左に装備した場合の軽減
2714 s16b calc_double_weapon_penalty(player_type *creature_ptr, INVENTORY_IDX slot)
2717 if (has_melee_weapon(creature_ptr, INVEN_RARM) && has_melee_weapon(creature_ptr, INVEN_LARM)) {
2718 penalty = ((100 - creature_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - creature_ptr->inventory_list[slot].weight) / 8);
2719 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_QUICKTHORN) && (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_TINYTHORN)) {
2720 penalty = penalty / 2 - 5;
2722 if (creature_ptr->easy_2weapon) {
2725 } else if ((creature_ptr->inventory_list[INVEN_LARM].tval == TV_SWORD)
2726 && ((creature_ptr->inventory_list[INVEN_LARM].sval == SV_MAIN_GAUCHE) || (creature_ptr->inventory_list[INVEN_LARM].sval == SV_WAKIZASHI))) {
2727 penalty = MAX(0, penalty - 10);
2729 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI)) {
2730 penalty = MIN(0, penalty);
2732 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (penalty > 0))
2734 if ((creature_ptr->inventory_list[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI) && (penalty > 0))
2738 if (creature_ptr->inventory_list[slot].tval == TV_POLEARM)
2741 return (s16b)penalty;
2744 static void calc_ind_status(player_type *creature_ptr, int status)
2747 if (creature_ptr->stat_use[status] <= 18)
2748 ind = (creature_ptr->stat_use[status] - 3);
2749 else if (creature_ptr->stat_use[status] <= 18 + 219)
2750 ind = (15 + (creature_ptr->stat_use[status] - 18) / 10);
2754 if (creature_ptr->stat_ind[status] == ind)
2757 creature_ptr->stat_ind[status] = (s16b)ind;
2758 if (status == A_CON) {
2759 creature_ptr->update |= (PU_HP);
2760 } else if (status == A_INT) {
2761 if (mp_ptr->spell_stat == A_INT) {
2762 creature_ptr->update |= (PU_MANA | PU_SPELLS);
2764 } else if (status == A_WIS) {
2765 if (mp_ptr->spell_stat == A_WIS) {
2766 creature_ptr->update |= (PU_MANA | PU_SPELLS);
2768 } else if (status == A_CHR) {
2769 if (mp_ptr->spell_stat == A_CHR) {
2770 creature_ptr->update |= (PU_MANA | PU_SPELLS);
2774 creature_ptr->window |= (PW_PLAYER);
2777 static void calc_use_status(player_type *creature_ptr, int status)
2779 int use = modify_stat_value(creature_ptr->stat_cur[status], creature_ptr->stat_add[status]);
2781 if ((status == A_CHR) && (creature_ptr->muta3 & MUT3_ILL_NORM)) {
2782 /* 10 to 18/90 charisma, guaranteed, based on level */
2783 if (use < 8 + 2 * creature_ptr->lev) {
2784 use = 8 + 2 * creature_ptr->lev;
2788 if (creature_ptr->stat_use[status] != use) {
2789 creature_ptr->stat_use[status] = (s16b)use;
2790 creature_ptr->redraw |= (PR_STATS);
2791 creature_ptr->window |= (PW_PLAYER);
2795 static void calc_top_status(player_type *creature_ptr, int status)
2797 int top = modify_stat_value(creature_ptr->stat_max[status], creature_ptr->stat_add[status]);
2799 if (creature_ptr->stat_top[status] != top) {
2800 creature_ptr->stat_top[status] = (s16b)top;
2801 creature_ptr->redraw |= (PR_STATS);
2802 creature_ptr->window |= (PW_PLAYER);
2806 static s16b calc_riding_bow_penalty(player_type *creature_ptr)
2808 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
2809 if (!creature_ptr->riding)
2814 creature_ptr->riding_ryoute = FALSE;
2816 if (has_two_handed_weapons(creature_ptr) || (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_NONE))
2817 creature_ptr->riding_ryoute = TRUE;
2818 else if (creature_ptr->pet_extra_flags & PF_TWO_HANDS) {
2819 switch (creature_ptr->pclass) {
2821 case CLASS_FORCETRAINER:
2822 case CLASS_BERSERKER:
2823 if ((empty_hands(creature_ptr, FALSE) != EMPTY_HAND_NONE) && !has_melee_weapon(creature_ptr, INVEN_RARM)
2824 && !has_melee_weapon(creature_ptr, INVEN_LARM))
2825 creature_ptr->riding_ryoute = TRUE;
2830 if ((creature_ptr->pclass == CLASS_BEASTMASTER) || (creature_ptr->pclass == CLASS_CAVALRY)) {
2831 if (creature_ptr->tval_ammo != TV_ARROW)
2834 penalty = r_info[floor_ptr->m_list[creature_ptr->riding].r_idx].level - creature_ptr->skill_exp[GINOU_RIDING] / 80;
2840 if (creature_ptr->tval_ammo == TV_BOLT)
2846 void put_equipment_warning(player_type *creature_ptr)
2848 bool heavy_shoot = is_heavy_shoot(creature_ptr, &creature_ptr->inventory_list[INVEN_BOW]);
2849 if (creature_ptr->old_heavy_shoot != heavy_shoot) {
2851 msg_print(_("こんな重い弓を装備しているのは大変だ。", "You have trouble wielding such a heavy bow."));
2852 } else if (creature_ptr->inventory_list[INVEN_BOW].k_idx) {
2853 msg_print(_("この弓なら装備していても辛くない。", "You have no trouble wielding your bow."));
2855 msg_print(_("重い弓を装備からはずして体が楽になった。", "You feel relieved to put down your heavy bow."));
2857 creature_ptr->old_heavy_shoot = heavy_shoot;
2860 for (int i = 0; i < 2; i++) {
2861 if (creature_ptr->old_heavy_wield[i] != creature_ptr->heavy_wield[i]) {
2862 if (creature_ptr->heavy_wield[i]) {
2863 msg_print(_("こんな重い武器を装備しているのは大変だ。", "You have trouble wielding such a heavy weapon."));
2864 } else if (has_melee_weapon(creature_ptr, INVEN_RARM + i)) {
2865 msg_print(_("これなら装備していても辛くない。", "You have no trouble wielding your weapon."));
2866 } else if (creature_ptr->heavy_wield[1 - i]) {
2867 msg_print(_("まだ武器が重い。", "You have still trouble wielding a heavy weapon."));
2869 msg_print(_("重い武器を装備からはずして体が楽になった。", "You feel relieved to put down your heavy weapon."));
2872 creature_ptr->old_heavy_wield[i] = creature_ptr->heavy_wield[i];
2875 if (creature_ptr->old_riding_wield[i] != creature_ptr->riding_wield[i]) {
2876 if (creature_ptr->riding_wield[i]) {
2877 msg_print(_("この武器は乗馬中に使うにはむかないようだ。", "This weapon is not suitable for use while riding."));
2878 } else if (!creature_ptr->riding) {
2879 msg_print(_("この武器は徒歩で使いやすい。", "This weapon is suitable for use on foot."));
2880 } else if (has_melee_weapon(creature_ptr, INVEN_RARM + i)) {
2881 msg_print(_("これなら乗馬中にぴったりだ。", "This weapon is suitable for use while riding."));
2884 creature_ptr->old_riding_wield[i] = creature_ptr->riding_wield[i];
2887 if (creature_ptr->old_icky_wield[i] == creature_ptr->icky_wield[i])
2890 if (creature_ptr->icky_wield[i]) {
2891 msg_print(_("今の装備はどうも自分にふさわしくない気がする。", "You do not feel comfortable with your weapon."));
2892 if (current_world_ptr->is_loading_now) {
2893 chg_virtue(creature_ptr, V_FAITH, -1);
2895 } else if (has_melee_weapon(creature_ptr, INVEN_RARM + i)) {
2896 msg_print(_("今の装備は自分にふさわしい気がする。", "You feel comfortable with your weapon."));
2898 msg_print(_("装備をはずしたら随分と気が楽になった。", "You feel more comfortable after removing your weapon."));
2901 creature_ptr->old_icky_wield[i] = creature_ptr->icky_wield[i];
2904 if (creature_ptr->riding && (creature_ptr->old_riding_ryoute != creature_ptr->riding_ryoute)) {
2905 if (creature_ptr->riding_ryoute) {
2907 msg_format("%s馬を操れない。", (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_NONE) ? "両手がふさがっていて" : "");
2909 msg_print("You are using both hand for fighting, and you can't control the pet you're riding.");
2913 msg_format("%s馬を操れるようになった。", (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_NONE) ? "手が空いて" : "");
2915 msg_print("You began to control the pet you're riding with one hand.");
2919 creature_ptr->old_riding_ryoute = creature_ptr->riding_ryoute;
2922 if (((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER) || (creature_ptr->pclass == CLASS_NINJA))
2923 && (heavy_armor(creature_ptr) != creature_ptr->monk_notify_aux)) {
2924 if (heavy_armor(creature_ptr)) {
2925 msg_print(_("装備が重くてバランスを取れない。", "The weight of your armor disrupts your balance."));
2926 if (current_world_ptr->is_loading_now) {
2927 chg_virtue(creature_ptr, V_HARMONY, -1);
2930 msg_print(_("バランスがとれるようになった。", "You regain your balance."));
2933 creature_ptr->monk_notify_aux = heavy_armor(creature_ptr);
2937 static s16b calc_to_damage(player_type *creature_ptr, INVENTORY_IDX slot, bool is_true_value)
2939 object_type *o_ptr = &creature_ptr->inventory_list[slot];
2940 int id = slot - INVEN_RARM;
2941 BIT_FLAGS flgs[TR_FLAG_SIZE];
2942 object_flags(creature_ptr, o_ptr, flgs);
2945 damage += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
2947 if (is_shero(creature_ptr)) {
2948 damage += 3 + (creature_ptr->lev / 5);
2951 if (creature_ptr->stun > 50) {
2953 } else if (creature_ptr->stun) {
2957 if ((creature_ptr->pclass == CLASS_PRIEST) && (!(has_flag(flgs, TR_BLESSED))) && ((o_ptr->tval == TV_SWORD) || (o_ptr->tval == TV_POLEARM))) {
2959 } else if (creature_ptr->pclass == CLASS_BERSERKER) {
2960 damage += creature_ptr->lev / 6;
2961 if (((id == 0) && !has_left_hand_weapon(creature_ptr)) || has_two_handed_weapons(creature_ptr)) {
2962 damage += creature_ptr->lev / 6;
2964 } else if (creature_ptr->pclass == CLASS_SORCERER) {
2965 if (!((o_ptr->tval == TV_HAFTED) && ((o_ptr->sval == SV_WIZSTAFF) || (o_ptr->sval == SV_NAMAKE_HAMMER)))) {
2972 if ((creature_ptr->realm1 == REALM_HEX) && object_is_cursed(o_ptr)) {
2973 if (hex_spelling(creature_ptr, HEX_RUNESWORD)) {
2974 if (o_ptr->curse_flags & (TRC_CURSED)) {
2977 if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) {
2980 if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) {
2986 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2988 o_ptr = &creature_ptr->inventory_list[i];
2989 if (!o_ptr->k_idx || o_ptr->tval == TV_CAPTURE || (i == INVEN_RARM && has_melee_weapon(creature_ptr, i))
2990 || (i == INVEN_LARM && has_melee_weapon(creature_ptr, i)) || i == INVEN_BOW)
2993 if (!object_is_known(o_ptr) && !is_true_value)
2995 bonus_to_d = o_ptr->to_d;
2997 if (creature_ptr->pclass == CLASS_NINJA) {
2998 if (o_ptr->to_d > 0)
2999 bonus_to_d = (o_ptr->to_d + 1) / 2;
3002 if ((i == INVEN_LEFT || i == INVEN_RIGHT) && !has_two_handed_weapons(creature_ptr)) {
3003 damage += (s16b)bonus_to_d;
3004 } else if (has_right_hand_weapon(creature_ptr) && has_left_hand_weapon(creature_ptr)) {
3006 damage += (bonus_to_d > 0) ? (bonus_to_d + 1) / 2 : bonus_to_d;
3008 damage += (bonus_to_d > 0) ? bonus_to_d / 2 : bonus_to_d;
3009 } else if (id == get_default_hand(creature_ptr)) {
3010 damage += (s16b)bonus_to_d;
3014 if (get_default_hand(creature_ptr) == id) {
3015 if ((is_martial_arts_mode(creature_ptr) && empty_hands(creature_ptr, FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM))
3016 || !has_disable_two_handed_bonus(creature_ptr, 0)) {
3018 bonus_to_d = ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128) / 2;
3019 damage += MAX(bonus_to_d, 1);
3023 if (is_martial_arts_mode(creature_ptr) && (!heavy_armor(creature_ptr) || creature_ptr->pclass != CLASS_BERSERKER)) {
3024 damage += (creature_ptr->lev / 6);
3031 * @brief 武器の命中修正を計算する。 / Calculate hit bonus from a wielded weapon.
3033 * 'slot' MUST be INVEN_RARM or INVEM_LARM.
3035 static s16b calc_to_hit(player_type *creature_ptr, INVENTORY_IDX slot, bool is_true_value)
3040 hit += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
3041 hit += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
3043 /* Temporary bonuses */
3044 if (is_blessed(creature_ptr)) {
3048 if (is_hero(creature_ptr)) {
3052 if (is_shero(creature_ptr)) {
3056 if (creature_ptr->stun > 50) {
3058 } else if (creature_ptr->stun) {
3062 /* Default hand bonuses */
3063 int id = slot - INVEN_RARM;
3064 int default_hand = get_default_hand(creature_ptr);
3065 if (default_hand == id) {
3066 /* Add trained bonus of empty hands' combat when having no weapon and riding */
3067 if ((!has_right_hand_weapon(creature_ptr) && (empty_hands(creature_ptr, TRUE) & EMPTY_HAND_LARM))
3068 || (!has_left_hand_weapon(creature_ptr) && (empty_hands(creature_ptr, TRUE) & EMPTY_HAND_RARM))) {
3069 hit += (creature_ptr->skill_exp[GINOU_SUDE] - WEAPON_EXP_BEGINNER) / 200;
3072 if ((is_martial_arts_mode(creature_ptr) && empty_hands(creature_ptr, FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM))
3073 || !has_disable_two_handed_bonus(creature_ptr, 0)) {
3075 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);
3076 hit += MAX(bonus_to_h, 1);
3080 /* Bonuses and penalties by weapon */
3081 if (has_melee_weapon(creature_ptr, slot)) {
3082 object_type *o_ptr = &creature_ptr->inventory_list[slot];
3083 BIT_FLAGS flgs[TR_FLAG_SIZE];
3084 object_flags(creature_ptr, o_ptr, flgs);
3086 tval_type tval = o_ptr->tval - TV_WEAPON_BEGIN;
3087 OBJECT_SUBTYPE_VALUE sval = o_ptr->sval;
3089 /* Traind bonuses */
3090 hit += (creature_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200;
3092 /* Weight penalty */
3093 if (calc_weapon_weight_limit(creature_ptr) < o_ptr->weight / 10) {
3094 hit += 2 * (calc_weapon_weight_limit(creature_ptr) - o_ptr->weight / 10);
3097 /* Low melee penalty */
3098 if ((object_is_fully_known(o_ptr) || is_true_value) && o_ptr->curse_flags & TRC_LOW_MELEE) {
3099 if (o_ptr->curse_flags & TRC_HEAVY_CURSE) {
3106 /* Riding bonus and penalty */
3107 if (creature_ptr->riding) {
3108 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE))) {
3113 if (creature_ptr->riding != 0 && !(o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE))
3114 && !has_flag(flgs, TR_RIDING)) {
3117 if ((creature_ptr->pclass == CLASS_BEASTMASTER) || (creature_ptr->pclass == CLASS_CAVALRY)) {
3120 penalty = r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].level - creature_ptr->skill_exp[GINOU_RIDING] / 80;
3125 hit -= (s16b)penalty;
3128 /* Class penalties */
3129 if ((creature_ptr->pclass == CLASS_PRIEST) && (!(has_flag(flgs, TR_BLESSED))) && ((o_ptr->tval == TV_SWORD) || (o_ptr->tval == TV_POLEARM))) {
3131 } else if (creature_ptr->pclass == CLASS_BERSERKER) {
3132 hit += creature_ptr->lev / 5;
3133 if (((id == 0) && !has_left_hand_weapon(creature_ptr)) || has_two_handed_weapons(creature_ptr)) {
3134 hit += creature_ptr->lev / 5;
3136 } else if (creature_ptr->pclass == CLASS_SORCERER) {
3137 if (!((o_ptr->tval == TV_HAFTED) && ((o_ptr->sval == SV_WIZSTAFF) || (o_ptr->sval == SV_NAMAKE_HAMMER)))) {
3144 if (has_not_ninja_weapon(creature_ptr, id) || has_not_monk_weapon(creature_ptr, id)) {
3148 /* Hex realm bonuses */
3149 if ((creature_ptr->realm1 == REALM_HEX) && object_is_cursed(o_ptr)) {
3150 if (o_ptr->curse_flags & (TRC_CURSED)) {
3153 if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) {
3156 if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) {
3159 if (o_ptr->curse_flags & (TRC_TY_CURSE)) {
3165 /* Bonuses from inventory */
3166 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
3167 object_type *o_ptr = &creature_ptr->inventory_list[i];
3169 /* Ignore empty hands, handed weapons, bows and capture balls */
3171 || o_ptr->tval == TV_CAPTURE
3172 || (i == INVEN_RARM && has_melee_weapon(creature_ptr, i))
3173 || (i == INVEN_LARM && has_melee_weapon(creature_ptr, i))
3177 /* Fake value does not include unknown objects' value */
3178 if (is_true_value || !object_is_known(o_ptr))
3181 int bonus_to_h = o_ptr->to_h;
3183 /* When wields only a weapon */
3184 if (creature_ptr->pclass == CLASS_NINJA) {
3185 if (o_ptr->to_h > 0)
3186 bonus_to_h = (o_ptr->to_h + 1) / 2;
3189 if ((i == INVEN_LEFT || i == INVEN_RIGHT) && !has_two_handed_weapons(creature_ptr)) {
3190 hit += (s16b)bonus_to_h;
3194 /* When wields two weapons on each hand */
3195 if (has_right_hand_weapon(creature_ptr) && has_left_hand_weapon(creature_ptr)) {
3196 if (default_hand == 0)
3197 hit += (bonus_to_h > 0) ? (bonus_to_h + 1) / 2 : bonus_to_h;
3198 if (default_hand == 1)
3199 hit += (bonus_to_h > 0) ? bonus_to_h / 2 : bonus_to_h;
3203 if (default_hand == id)
3204 hit += (s16b)bonus_to_h;
3207 /* Martial arts bonus */
3208 if (is_martial_arts_mode(creature_ptr) && (!heavy_armor(creature_ptr) || creature_ptr->pclass != CLASS_BERSERKER)) {
3209 hit += (creature_ptr->lev / 3);
3212 /* Two handed combat penalty */
3213 hit -= calc_double_weapon_penalty(creature_ptr, slot);
3218 static s16b calc_to_hit_bow(player_type *creature_ptr, bool is_true_value)
3222 pow += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
3223 pow += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
3227 BIT_FLAGS flgs[TR_FLAG_SIZE];
3228 o_ptr = &creature_ptr->inventory_list[INVEN_BOW];
3230 object_flags(creature_ptr, o_ptr, flgs);
3232 if (o_ptr->curse_flags & TRC_LOW_MELEE) {
3233 if (o_ptr->curse_flags & TRC_HEAVY_CURSE) {
3242 if (creature_ptr->stun > 50) {
3244 } else if (creature_ptr->stun) {
3248 if (is_blessed(creature_ptr)) {
3252 if (is_hero(creature_ptr)) {
3256 if (is_shero(creature_ptr)) {
3260 object_type *o_ptr = &creature_ptr->inventory_list[INVEN_BOW];
3262 if (is_heavy_shoot(creature_ptr, o_ptr)) {
3263 pow += 2 * (calc_weapon_weight_limit(creature_ptr) - o_ptr->weight / 10);
3267 if (o_ptr->k_idx && !is_heavy_shoot(creature_ptr, &creature_ptr->inventory_list[INVEN_BOW])) {
3268 if ((creature_ptr->pclass == CLASS_SNIPER) && (creature_ptr->tval_ammo == TV_BOLT)) {
3269 pow += (10 + (creature_ptr->lev / 5));
3275 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
3277 o_ptr = &creature_ptr->inventory_list[i];
3278 if (!o_ptr->k_idx || o_ptr->tval == TV_CAPTURE || (i == INVEN_RARM && has_melee_weapon(creature_ptr, i))
3279 || (i == INVEN_LARM && has_melee_weapon(creature_ptr, i)) || i == INVEN_BOW)
3282 bonus_to_h = o_ptr->to_h;
3284 if (creature_ptr->pclass == CLASS_NINJA) {
3285 if (o_ptr->to_h > 0)
3286 bonus_to_h = (o_ptr->to_h + 1) / 2;
3289 if (is_true_value || object_is_known(o_ptr))
3290 pow += (s16b)bonus_to_h;
3293 pow -= calc_riding_bow_penalty(creature_ptr);
3298 static s16b calc_to_damage_misc(player_type *creature_ptr)
3301 BIT_FLAGS flgs[TR_FLAG_SIZE];
3305 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
3306 o_ptr = &creature_ptr->inventory_list[i];
3310 object_flags(creature_ptr, o_ptr, flgs);
3312 int bonus_to_d = o_ptr->to_d;
3313 if (creature_ptr->pclass == CLASS_NINJA) {
3314 if (o_ptr->to_d > 0)
3315 bonus_to_d = (o_ptr->to_d + 1) / 2;
3317 to_dam += (s16b)bonus_to_d;
3320 if (is_shero(creature_ptr)) {
3321 to_dam += 3 + (creature_ptr->lev / 5);
3324 if (creature_ptr->stun > 50) {
3326 } else if (creature_ptr->stun) {
3330 to_dam += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
3334 static s16b calc_to_hit_misc(player_type *creature_ptr)
3337 BIT_FLAGS flgs[TR_FLAG_SIZE];
3341 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
3342 o_ptr = &creature_ptr->inventory_list[i];
3346 object_flags(creature_ptr, o_ptr, flgs);
3348 int bonus_to_h = o_ptr->to_h;
3349 if (creature_ptr->pclass == CLASS_NINJA) {
3350 if (o_ptr->to_h > 0)
3351 bonus_to_h = (o_ptr->to_h + 1) / 2;
3353 to_hit += (s16b)bonus_to_h;
3356 if (is_blessed(creature_ptr)) {
3360 if (is_hero(creature_ptr)) {
3364 if (is_shero(creature_ptr)) {
3368 if (creature_ptr->stun > 50) {
3370 } else if (creature_ptr->stun) {
3374 to_hit += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
3375 to_hit += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
3380 static DICE_NUMBER calc_to_weapon_dice_num(player_type *creature_ptr, INVENTORY_IDX slot)
3382 object_type *o_ptr = &creature_ptr->inventory_list[slot];
3385 if (creature_ptr->riding) {
3387 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE))) {
3395 static DICE_NUMBER calc_to_weapon_dice_side(player_type *creature_ptr, INVENTORY_IDX slot)
3397 (void)creature_ptr; // unused
3398 (void)slot; // unused
3403 * @brief プレイヤーの所持重量制限を計算する /
3404 * Computes current weight limit.
3407 WEIGHT calc_weight_limit(player_type *creature_ptr)
3409 WEIGHT i = (WEIGHT)adj_str_wgt[creature_ptr->stat_ind[A_STR]] * 50;
3410 if (creature_ptr->pclass == CLASS_BERSERKER)
3416 * @brief プレイヤーが現在右手/左手に武器を持っているか判定する /
3417 * @param i 判定する手のID(右手:INVEN_RARM 左手:INVEN_LARM)
3418 * @return 持っているならばTRUE
3420 bool has_melee_weapon(player_type *creature_ptr, int slot)
3422 return ((creature_ptr->inventory_list[slot].k_idx) && object_is_melee_weapon(&creature_ptr->inventory_list[slot]));
3426 * @brief プレイヤーの現在開いている手の状態を返す
3427 * @param riding_control 乗馬中により片手を必要としている状態ならばTRUEを返す。
3428 * @return 開いている手のビットフラグ
3430 BIT_FLAGS16 empty_hands(player_type *creature_ptr, bool riding_control)
3432 BIT_FLAGS16 status = EMPTY_HAND_NONE;
3433 if (!creature_ptr->inventory_list[INVEN_RARM].k_idx)
3434 status |= EMPTY_HAND_RARM;
3435 if (!creature_ptr->inventory_list[INVEN_LARM].k_idx)
3436 status |= EMPTY_HAND_LARM;
3438 if (riding_control && (status != EMPTY_HAND_NONE) && creature_ptr->riding && !(creature_ptr->pet_extra_flags & PF_TWO_HANDS)) {
3439 if (status & EMPTY_HAND_LARM)
3440 status &= ~(EMPTY_HAND_LARM);
3441 else if (status & EMPTY_HAND_RARM)
3442 status &= ~(EMPTY_HAND_RARM);
3449 * @brief プレイヤーが防具重量制限のある職業時にペナルティを受ける状態にあるかどうかを返す。
3450 * @return ペナルティが適用されるならばTRUE。
3452 bool heavy_armor(player_type *creature_ptr)
3454 if ((creature_ptr->pclass != CLASS_MONK) && (creature_ptr->pclass != CLASS_FORCETRAINER) && (creature_ptr->pclass != CLASS_NINJA))
3457 WEIGHT monk_arm_wgt = 0;
3458 if (creature_ptr->inventory_list[INVEN_RARM].tval > TV_SWORD)
3459 monk_arm_wgt += creature_ptr->inventory_list[INVEN_RARM].weight;
3460 if (creature_ptr->inventory_list[INVEN_LARM].tval > TV_SWORD)
3461 monk_arm_wgt += creature_ptr->inventory_list[INVEN_LARM].weight;
3462 monk_arm_wgt += creature_ptr->inventory_list[INVEN_BODY].weight;
3463 monk_arm_wgt += creature_ptr->inventory_list[INVEN_HEAD].weight;
3464 monk_arm_wgt += creature_ptr->inventory_list[INVEN_OUTER].weight;
3465 monk_arm_wgt += creature_ptr->inventory_list[INVEN_HANDS].weight;
3466 monk_arm_wgt += creature_ptr->inventory_list[INVEN_FEET].weight;
3468 return (monk_arm_wgt > (100 + (creature_ptr->lev * 4)));
3472 * @brief update のフラグに応じた更新をまとめて行う / Handle "update"
3474 * @details 更新処理の対象はプレイヤーの能力修正/光源寿命/HP/MP/魔法の学習状態、他多数の外界の状態判定。
3476 void update_creature(player_type *creature_ptr)
3478 if (!creature_ptr->update)
3481 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
3482 if (creature_ptr->update & (PU_AUTODESTROY)) {
3483 creature_ptr->update &= ~(PU_AUTODESTROY);
3484 autopick_delayed_alter(creature_ptr);
3487 if (creature_ptr->update & (PU_COMBINE)) {
3488 creature_ptr->update &= ~(PU_COMBINE);
3489 combine_pack(creature_ptr);
3492 if (creature_ptr->update & (PU_REORDER)) {
3493 creature_ptr->update &= ~(PU_REORDER);
3494 reorder_pack(creature_ptr);
3497 if (creature_ptr->update & (PU_BONUS)) {
3498 creature_ptr->update &= ~(PU_BONUS);
3499 calc_alignment(creature_ptr);
3500 calc_bonuses(creature_ptr);
3503 if (creature_ptr->update & (PU_TORCH)) {
3504 creature_ptr->update &= ~(PU_TORCH);
3505 calc_lite_radius(creature_ptr);
3508 if (creature_ptr->update & (PU_HP)) {
3509 creature_ptr->update &= ~(PU_HP);
3510 calc_hitpoints(creature_ptr);
3513 if (creature_ptr->update & (PU_MANA)) {
3514 creature_ptr->update &= ~(PU_MANA);
3515 calc_mana(creature_ptr);
3518 if (creature_ptr->update & (PU_SPELLS)) {
3519 creature_ptr->update &= ~(PU_SPELLS);
3520 calc_spells(creature_ptr);
3523 if (!current_world_ptr->character_generated)
3525 if (current_world_ptr->character_icky)
3527 if (creature_ptr->update & (PU_UN_LITE)) {
3528 creature_ptr->update &= ~(PU_UN_LITE);
3529 forget_lite(floor_ptr);
3532 if (creature_ptr->update & (PU_UN_VIEW)) {
3533 creature_ptr->update &= ~(PU_UN_VIEW);
3534 forget_view(floor_ptr);
3537 if (creature_ptr->update & (PU_VIEW)) {
3538 creature_ptr->update &= ~(PU_VIEW);
3539 update_view(creature_ptr);
3542 if (creature_ptr->update & (PU_LITE)) {
3543 creature_ptr->update &= ~(PU_LITE);
3544 update_lite(creature_ptr);
3547 if (creature_ptr->update & (PU_FLOW)) {
3548 creature_ptr->update &= ~(PU_FLOW);
3549 update_flow(creature_ptr);
3552 if (creature_ptr->update & (PU_DISTANCE)) {
3553 creature_ptr->update &= ~(PU_DISTANCE);
3555 update_monsters(creature_ptr, TRUE);
3558 if (creature_ptr->update & (PU_MON_LITE)) {
3559 creature_ptr->update &= ~(PU_MON_LITE);
3560 update_mon_lite(creature_ptr);
3563 if (creature_ptr->update & (PU_DELAY_VIS)) {
3564 creature_ptr->update &= ~(PU_DELAY_VIS);
3565 delayed_visual_update(creature_ptr);
3568 if (creature_ptr->update & (PU_MONSTERS)) {
3569 creature_ptr->update &= ~(PU_MONSTERS);
3570 update_monsters(creature_ptr, FALSE);
3575 * @brief プレイヤーが魔道書を一冊も持っていないかを判定する
3576 * @return 魔道書を一冊も持っていないならTRUEを返す
3578 bool player_has_no_spellbooks(player_type *creature_ptr)
3581 for (int i = 0; i < INVEN_PACK; i++) {
3582 o_ptr = &creature_ptr->inventory_list[i];
3583 if (o_ptr->k_idx && check_book_realm(creature_ptr, o_ptr->tval, o_ptr->sval))
3587 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
3588 for (int i = floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].o_idx; i; i = o_ptr->next_o_idx) {
3589 o_ptr = &floor_ptr->o_list[i];
3590 if (o_ptr->k_idx && (o_ptr->marked & OM_FOUND) && check_book_realm(creature_ptr, o_ptr->tval, o_ptr->sval))
3597 void take_turn(player_type *creature_ptr, PERCENTAGE need_cost) { creature_ptr->energy_use = (ENERGY)need_cost; }
3599 void free_turn(player_type *creature_ptr) { creature_ptr->energy_use = 0; }
3602 * @brief プレイヤーを指定座標に配置する / Place the player in the dungeon XXX XXX
3605 * @return 配置に成功したらTRUE
3607 bool player_place(player_type *creature_ptr, POSITION y, POSITION x)
3609 if (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx != 0)
3612 /* Save player location */
3613 creature_ptr->y = y;
3614 creature_ptr->x = x;
3619 * @brief 種族アンバライトが出血時パターンの上に乗った際のペナルティ処理
3622 void wreck_the_pattern(player_type *creature_ptr)
3624 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
3625 int pattern_type = f_info[floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat].subtype;
3626 if (pattern_type == PATTERN_TILE_WRECKED)
3629 msg_print(_("パターンを血で汚してしまった!", "You bleed on the Pattern!"));
3630 msg_print(_("何か恐ろしい事が起こった!", "Something terrible happens!"));
3632 if (!is_invuln(creature_ptr))
3633 take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(10, 8), _("パターン損壊", "corrupting the Pattern"), -1);
3635 int to_ruin = randint1(45) + 35;
3638 scatter(creature_ptr, &r_y, &r_x, creature_ptr->y, creature_ptr->x, 4, PROJECT_NONE);
3640 if (pattern_tile(floor_ptr, r_y, r_x) && (f_info[floor_ptr->grid_array[r_y][r_x].feat].subtype != PATTERN_TILE_WRECKED)) {
3641 cave_set_feat(creature_ptr, r_y, r_x, feat_pattern_corrupted);
3645 cave_set_feat(creature_ptr, creature_ptr->y, creature_ptr->x, feat_pattern_corrupted);
3649 * @brief プレイヤーの経験値について整合性のためのチェックと調整を行う /
3650 * Advance experience levels and print experience
3653 void check_experience(player_type *creature_ptr)
3655 if (creature_ptr->exp < 0)
3656 creature_ptr->exp = 0;
3657 if (creature_ptr->max_exp < 0)
3658 creature_ptr->max_exp = 0;
3659 if (creature_ptr->max_max_exp < 0)
3660 creature_ptr->max_max_exp = 0;
3662 if (creature_ptr->exp > PY_MAX_EXP)
3663 creature_ptr->exp = PY_MAX_EXP;
3664 if (creature_ptr->max_exp > PY_MAX_EXP)
3665 creature_ptr->max_exp = PY_MAX_EXP;
3666 if (creature_ptr->max_max_exp > PY_MAX_EXP)
3667 creature_ptr->max_max_exp = PY_MAX_EXP;
3669 if (creature_ptr->exp > creature_ptr->max_exp)
3670 creature_ptr->max_exp = creature_ptr->exp;
3671 if (creature_ptr->max_exp > creature_ptr->max_max_exp)
3672 creature_ptr->max_max_exp = creature_ptr->max_exp;
3674 creature_ptr->redraw |= (PR_EXP);
3675 handle_stuff(creature_ptr);
3677 bool android = (creature_ptr->prace == RACE_ANDROID ? TRUE : FALSE);
3678 PLAYER_LEVEL old_lev = creature_ptr->lev;
3679 while ((creature_ptr->lev > 1) && (creature_ptr->exp < ((android ? player_exp_a : player_exp)[creature_ptr->lev - 2] * creature_ptr->expfact / 100L))) {
3680 creature_ptr->lev--;
3681 creature_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
3682 creature_ptr->redraw |= (PR_LEV | PR_TITLE);
3683 creature_ptr->window |= (PW_PLAYER);
3684 handle_stuff(creature_ptr);
3687 bool level_reward = FALSE;
3688 bool level_mutation = FALSE;
3689 bool level_inc_stat = FALSE;
3690 while ((creature_ptr->lev < PY_MAX_LEVEL)
3691 && (creature_ptr->exp >= ((android ? player_exp_a : player_exp)[creature_ptr->lev - 1] * creature_ptr->expfact / 100L))) {
3692 creature_ptr->lev++;
3693 if (creature_ptr->lev > creature_ptr->max_plv) {
3694 creature_ptr->max_plv = creature_ptr->lev;
3696 if ((creature_ptr->pclass == CLASS_CHAOS_WARRIOR) || (creature_ptr->muta2 & MUT2_CHAOS_GIFT)) {
3697 level_reward = TRUE;
3699 if (creature_ptr->prace == RACE_BEASTMAN) {
3701 level_mutation = TRUE;
3703 level_inc_stat = TRUE;
3705 exe_write_diary(creature_ptr, DIARY_LEVELUP, creature_ptr->lev, NULL);
3709 msg_format(_("レベル %d にようこそ。", "Welcome to level %d."), creature_ptr->lev);
3710 creature_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
3711 creature_ptr->redraw |= (PR_LEV | PR_TITLE | PR_EXP);
3712 creature_ptr->window |= (PW_PLAYER | PW_SPELL | PW_INVEN);
3713 creature_ptr->level_up_message = TRUE;
3714 handle_stuff(creature_ptr);
3716 creature_ptr->level_up_message = FALSE;
3717 if (level_inc_stat) {
3718 if (!(creature_ptr->max_plv % 10)) {
3725 cnv_stat(creature_ptr->stat_max[0], tmp);
3726 prt(format(_(" a) 腕力 (現在値 %s)", " a) Str (cur %s)"), tmp), 2, 14);
3727 cnv_stat(creature_ptr->stat_max[1], tmp);
3728 prt(format(_(" b) 知能 (現在値 %s)", " b) Int (cur %s)"), tmp), 3, 14);
3729 cnv_stat(creature_ptr->stat_max[2], tmp);
3730 prt(format(_(" c) 賢さ (現在値 %s)", " c) Wis (cur %s)"), tmp), 4, 14);
3731 cnv_stat(creature_ptr->stat_max[3], tmp);
3732 prt(format(_(" d) 器用 (現在値 %s)", " d) Dex (cur %s)"), tmp), 5, 14);
3733 cnv_stat(creature_ptr->stat_max[4], tmp);
3734 prt(format(_(" e) 耐久 (現在値 %s)", " e) Con (cur %s)"), tmp), 6, 14);
3735 cnv_stat(creature_ptr->stat_max[5], tmp);
3736 prt(format(_(" f) 魅力 (現在値 %s)", " f) Chr (cur %s)"), tmp), 7, 14);
3739 prt(_(" どの能力値を上げますか?", " Which stat do you want to raise?"), 1, 14);
3743 if ((choice >= 'a') && (choice <= 'f'))
3746 for (n = 0; n < A_MAX; n++)
3747 if (n != choice - 'a')
3749 if (get_check(_("よろしいですか?", "Are you sure? ")))
3752 do_inc_stat(creature_ptr, choice - 'a');
3754 } else if (!(creature_ptr->max_plv % 2))
3755 do_inc_stat(creature_ptr, randint0(6));
3758 if (level_mutation) {
3759 msg_print(_("あなたは変わった気がする...", "You feel different..."));
3760 (void)gain_mutation(creature_ptr, 0);
3761 level_mutation = FALSE;
3765 * 報酬でレベルが上ると再帰的に check_experience(creature_ptr) が
3769 gain_level_reward(creature_ptr, 0);
3770 level_reward = FALSE;
3773 creature_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
3774 creature_ptr->redraw |= (PR_LEV | PR_TITLE);
3775 creature_ptr->window |= (PW_PLAYER | PW_SPELL);
3776 handle_stuff(creature_ptr);
3779 if (old_lev != creature_ptr->lev)
3780 autopick_load_pref(creature_ptr, FALSE);
3784 * @brief 現在の修正後能力値を3~17及び18/xxx形式に変換する / Converts stat num into a six-char (right justified) string
3786 * @param out_val 出力先文字列ポインタ
3789 void cnv_stat(int val, char *out_val)
3792 sprintf(out_val, " %2d", val);
3796 int bonus = (val - 18);
3798 sprintf(out_val, "18/%3s", "***");
3799 } else if (bonus >= 100) {
3800 sprintf(out_val, "18/%03d", bonus);
3802 sprintf(out_val, " 18/%02d", bonus);
3807 * @brief 能力値現在値から3~17及び18/xxx様式に基づく加減算を行う。
3808 * Modify a stat value by a "modifier", return new value
3810 * @param amount 加減算値
3814 * Stats go up: 3,4,...,17,18,18/10,18/20,...,18/220
3815 * Or even: 18/13, 18/23, 18/33, ..., 18/220
3816 * Stats go down: 18/220, 18/210,..., 18/10, 18, 17, ..., 3
3817 * Or even: 18/13, 18/03, 18, 17, ..., 3
3820 s16b modify_stat_value(int value, int amount)
3823 for (int i = 0; i < amount; i++) {
3829 } else if (amount < 0) {
3830 for (int i = 0; i < (0 - amount); i++) {
3831 if (value >= 18 + 10)
3833 else if (value > 18)
3845 * Hack -- Calculates the total number of points earned -JWT-
3849 long calc_score(player_type *creature_ptr)
3851 int arena_win = MIN(creature_ptr->arena_number, MAX_ARENA_MONS);
3864 if (ironman_small_levels)
3866 if (ironman_empty_levels)
3872 if (ironman_nightmare)
3879 for (int i = 0; i < current_world_ptr->max_d_idx; i++)
3880 if (max_dlv[i] > max_dl)
3881 max_dl = max_dlv[i];
3883 u32b point_l = (creature_ptr->max_max_exp + (100 * max_dl));
3884 u32b point_h = point_l / 0x10000L;
3885 point_l = point_l % 0x10000L;
3888 point_h += point_l / 0x10000L;
3889 point_l %= 0x10000L;
3891 point_l += ((point_h % 100) << 16);
3895 u32b point = (point_h << 16) + (point_l);
3896 if (creature_ptr->arena_number >= 0)
3897 point += (arena_win * arena_win * (arena_win > 29 ? 1000 : 100));
3899 if (ironman_downward)
3901 if (creature_ptr->pclass == CLASS_BERSERKER) {
3902 if (creature_ptr->prace == RACE_SPECTRE)
3906 if ((creature_ptr->pseikaku == PERSONALITY_MUNCHKIN) && point) {
3908 if (current_world_ptr->total_winner)
3913 point = (0 - point);
3919 * @param creature_ptr プレーヤーへの参照ポインタ
3920 * @return 祝福状態ならばTRUE
3922 bool is_blessed(player_type *creature_ptr)
3924 return creature_ptr->blessed || music_singing(creature_ptr, MUSIC_BLESS) || hex_spelling(creature_ptr, HEX_BLESS);
3927 bool is_tim_esp(player_type *creature_ptr)
3929 return creature_ptr->tim_esp || music_singing(creature_ptr, MUSIC_MIND) || (creature_ptr->concent >= CONCENT_TELE_THRESHOLD);
3932 bool is_tim_stealth(player_type *creature_ptr) { return creature_ptr->tim_stealth || music_singing(creature_ptr, MUSIC_STEALTH); }
3934 bool is_time_limit_esp(player_type *creature_ptr)
3936 return creature_ptr->tim_esp || music_singing(creature_ptr, MUSIC_MIND) || (creature_ptr->concent >= CONCENT_TELE_THRESHOLD);
3939 bool is_time_limit_stealth(player_type *creature_ptr) { return creature_ptr->tim_stealth || music_singing(creature_ptr, MUSIC_STEALTH); }
3941 bool can_two_hands_wielding(player_type *creature_ptr) { return !creature_ptr->riding || (creature_ptr->pet_extra_flags & PF_TWO_HANDS); }
3944 * @brief 歌の停止を処理する / Stop singing if the player is a Bard
3947 void stop_singing(player_type *creature_ptr)
3949 if (creature_ptr->pclass != CLASS_BARD)
3952 /* Are there interupted song? */
3953 if (INTERUPTING_SONG_EFFECT(creature_ptr)) {
3954 /* Forget interupted song */
3955 INTERUPTING_SONG_EFFECT(creature_ptr) = MUSIC_NONE;
3959 /* The player is singing? */
3960 if (!SINGING_SONG_EFFECT(creature_ptr))
3963 /* Hack -- if called from set_action(), avoid recursive loop */
3964 if (creature_ptr->action == ACTION_SING)
3965 set_action(creature_ptr, ACTION_NONE);
3967 /* Message text of each song or etc. */
3968 exe_spell(creature_ptr, REALM_MUSIC, SINGING_SONG_ID(creature_ptr), SPELL_STOP);
3970 SINGING_SONG_EFFECT(creature_ptr) = MUSIC_NONE;
3971 SINGING_SONG_ID(creature_ptr) = 0;
3972 creature_ptr->update |= (PU_BONUS);
3973 creature_ptr->redraw |= (PR_STATUS);
3977 * @brief 口を使う継続的な処理を中断する
3978 * @param caster_ptr プレーヤーへの参照ポインタ
3981 void stop_mouth(player_type *caster_ptr)
3983 if (music_singing_any(caster_ptr))
3984 stop_singing(caster_ptr);
3985 if (hex_spelling_any(caster_ptr))
3986 stop_hex_spell_all(caster_ptr);
3990 * @brief ペットの維持コスト計算
3993 PERCENTAGE calculate_upkeep(player_type *creature_ptr)
3996 bool has_a_unique = FALSE;
3997 DEPTH total_friend_levels = 0;
4001 for (m_idx = creature_ptr->current_floor_ptr->m_max - 1; m_idx >= 1; m_idx--) {
4002 monster_type *m_ptr;
4003 monster_race *r_ptr;
4005 m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
4006 if (!monster_is_valid(m_ptr))
4008 r_ptr = &r_info[m_ptr->r_idx];
4010 if (is_pet(m_ptr)) {
4012 if (r_ptr->flags1 & RF1_UNIQUE) {
4013 if (creature_ptr->pclass == CLASS_CAVALRY) {
4014 if (creature_ptr->riding == m_idx)
4015 total_friend_levels += (r_ptr->level + 5) * 2;
4016 else if (!has_a_unique && (r_info[m_ptr->r_idx].flags7 & RF7_RIDING))
4017 total_friend_levels += (r_ptr->level + 5) * 7 / 2;
4019 total_friend_levels += (r_ptr->level + 5) * 10;
4020 has_a_unique = TRUE;
4022 total_friend_levels += (r_ptr->level + 5) * 10;
4024 total_friend_levels += r_ptr->level;
4028 if (total_friends) {
4030 upkeep_factor = (total_friend_levels - (creature_ptr->lev * 80 / (cp_ptr->pet_upkeep_div)));
4031 if (upkeep_factor < 0)
4033 if (upkeep_factor > 1000)
4034 upkeep_factor = 1000;
4035 return upkeep_factor;
4040 bool music_singing(player_type *caster_ptr, int music_songs) { return (caster_ptr->pclass == CLASS_BARD) && (caster_ptr->magic_num1[0] == music_songs); }
4042 bool is_fast(player_type *creature_ptr) { return creature_ptr->fast || music_singing(creature_ptr, MUSIC_SPEED) || music_singing(creature_ptr, MUSIC_SHERO); }
4044 bool is_invuln(player_type *creature_ptr) { return creature_ptr->invuln || music_singing(creature_ptr, MUSIC_INVULN); }
4046 bool is_hero(player_type *creature_ptr) { return creature_ptr->hero || music_singing(creature_ptr, MUSIC_HERO) || music_singing(creature_ptr, MUSIC_SHERO); }
4048 bool is_shero(player_type *creature_ptr) { return creature_ptr->shero || creature_ptr->pclass == CLASS_BERSERKER; }
4050 bool is_echizen(player_type *creature_ptr)
4052 return (creature_ptr->pseikaku == PERSONALITY_COMBAT) || (creature_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON);
4055 int calc_weapon_weight_limit(player_type *creature_ptr)
4057 int weight = adj_str_hold[creature_ptr->stat_ind[A_STR]];
4059 if (has_two_handed_weapons(creature_ptr))
4065 static int get_default_hand(player_type *creature_ptr)
4067 int default_hand = 0;
4069 if (has_melee_weapon(creature_ptr, INVEN_LARM)) {
4070 if (!has_right_hand_weapon(creature_ptr))
4074 if (can_two_hands_wielding(creature_ptr)) {
4075 if (has_right_hand_weapon(creature_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_LARM)
4076 && object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_RARM])) {
4077 } else if (has_left_hand_weapon(creature_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_RARM)
4078 && object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_LARM])) {
4084 return default_hand;