1 #include "player/player-status.h"
2 #include "artifact/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 player_hand 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->xtra_might = has_xtra_might(creature_ptr);
350 creature_ptr->esp_evil = has_esp_evil(creature_ptr);
351 creature_ptr->esp_animal = has_esp_animal(creature_ptr);
352 creature_ptr->esp_undead = has_esp_undead(creature_ptr);
353 creature_ptr->esp_demon = has_esp_demon(creature_ptr);
354 creature_ptr->esp_orc = has_esp_orc(creature_ptr);
355 creature_ptr->esp_troll = has_esp_troll(creature_ptr);
356 creature_ptr->esp_giant = has_esp_giant(creature_ptr);
357 creature_ptr->esp_dragon = has_esp_dragon(creature_ptr);
358 creature_ptr->esp_human = has_esp_human(creature_ptr);
359 creature_ptr->esp_good = has_esp_good(creature_ptr);
360 creature_ptr->esp_nonliving = has_esp_nonliving(creature_ptr);
361 creature_ptr->esp_unique = has_esp_unique(creature_ptr);
362 creature_ptr->telepathy = has_esp_telepathy(creature_ptr);
363 creature_ptr->bless_blade = has_bless_blade(creature_ptr);
364 creature_ptr->easy_2weapon = has_easy2_weapon(creature_ptr);
365 creature_ptr->down_saving = has_down_saving(creature_ptr);
366 creature_ptr->yoiyami = has_no_ac(creature_ptr);
367 creature_ptr->mighty_throw = has_mighty_throw(creature_ptr);
368 creature_ptr->dec_mana = has_dec_mana(creature_ptr);
369 creature_ptr->see_nocto = has_see_nocto(creature_ptr);
370 creature_ptr->warning = has_warning(creature_ptr);
371 creature_ptr->anti_magic = has_anti_magic(creature_ptr);
372 creature_ptr->anti_tele = has_anti_tele(creature_ptr);
373 creature_ptr->easy_spell = has_easy_spell(creature_ptr);
374 creature_ptr->heavy_spell = has_heavy_spell(creature_ptr);
375 creature_ptr->hold_exp = has_hold_exp(creature_ptr);
376 creature_ptr->see_inv = has_see_inv(creature_ptr);
377 creature_ptr->free_act = has_free_act(creature_ptr);
378 creature_ptr->levitation = has_levitation(creature_ptr);
379 has_can_swim(creature_ptr);
380 creature_ptr->slow_digest = has_slow_digest(creature_ptr);
381 creature_ptr->regenerate = has_regenerate(creature_ptr);
382 has_curses(creature_ptr);
383 creature_ptr->impact = has_impact(creature_ptr);
384 has_extra_blow(creature_ptr);
386 creature_ptr->lite = has_lite(creature_ptr);
388 if (creature_ptr->special_defense & KAMAE_MASK) {
389 if (!(empty_hands_status & EMPTY_HAND_RARM)) {
390 set_action(creature_ptr, ACTION_NONE);
394 creature_ptr->stat_add[A_STR] = calc_strength_addition(creature_ptr);
395 creature_ptr->stat_add[A_INT] = calc_intelligence_addition(creature_ptr);
396 creature_ptr->stat_add[A_WIS] = calc_wisdom_addition(creature_ptr);
397 creature_ptr->stat_add[A_DEX] = calc_dexterity_addition(creature_ptr);
398 creature_ptr->stat_add[A_CON] = calc_constitution_addition(creature_ptr);
399 creature_ptr->stat_add[A_CHR] = calc_charisma_addition(creature_ptr);
400 creature_ptr->to_m_chance = calc_to_magic_chance(creature_ptr);
401 creature_ptr->ac = calc_base_ac(creature_ptr);
402 creature_ptr->to_a = calc_to_ac(creature_ptr, TRUE);
403 creature_ptr->dis_ac = calc_base_ac(creature_ptr);
404 creature_ptr->dis_to_a = calc_to_ac(creature_ptr, FALSE);
406 for (int i = 0; i < A_MAX; i++) {
407 calc_top_status(creature_ptr, i);
408 calc_use_status(creature_ptr, i);
409 calc_ind_status(creature_ptr, i);
412 o_ptr = &creature_ptr->inventory_list[INVEN_BOW];
414 creature_ptr->tval_ammo = (byte)bow_tval_ammo(o_ptr);
415 if (o_ptr->k_idx && !is_heavy_shoot(creature_ptr, &creature_ptr->inventory_list[INVEN_BOW])) {
416 creature_ptr->num_fire = calc_num_fire(creature_ptr, o_ptr);
420 for (int i = 0; i < 2; i++) {
421 creature_ptr->icky_wield[i] = has_icky_wield_weapon(creature_ptr, i);
422 creature_ptr->riding_wield[i] = has_riding_wield_weapon(creature_ptr, i);
423 creature_ptr->num_blow[i] = calc_num_blow(creature_ptr, i);
424 creature_ptr->to_dd[i] = calc_to_weapon_dice_num(creature_ptr, INVEN_RARM + i);
425 creature_ptr->to_ds[i] = calc_to_weapon_dice_side(creature_ptr, INVEN_RARM + i);
428 creature_ptr->pspeed = calc_speed(creature_ptr);
429 creature_ptr->see_infra = calc_intra_vision(creature_ptr);
430 creature_ptr->skill_stl = calc_stealth(creature_ptr);
431 creature_ptr->skill_dis = calc_disarming(creature_ptr);
432 creature_ptr->skill_dev = calc_device_ability(creature_ptr);
433 creature_ptr->skill_sav = calc_saving_throw(creature_ptr);
434 creature_ptr->skill_srh = calc_search(creature_ptr);
435 creature_ptr->skill_fos = calc_search_freq(creature_ptr);
436 creature_ptr->skill_thn = calc_to_hit_melee(creature_ptr);
437 creature_ptr->skill_thb = calc_to_hit_shoot(creature_ptr);
438 creature_ptr->skill_tht = calc_to_hit_throw(creature_ptr);
439 creature_ptr->to_d[0] = calc_to_damage(creature_ptr, INVEN_RARM, TRUE);
440 creature_ptr->to_d[1] = calc_to_damage(creature_ptr, INVEN_LARM, TRUE);
441 creature_ptr->dis_to_d[0] = calc_to_damage(creature_ptr, INVEN_RARM, FALSE);
442 creature_ptr->dis_to_d[1] = calc_to_damage(creature_ptr, INVEN_LARM, FALSE);
443 creature_ptr->to_h[0] = calc_to_hit(creature_ptr, INVEN_RARM, TRUE);
444 creature_ptr->to_h[1] = calc_to_hit(creature_ptr, INVEN_LARM, TRUE);
445 creature_ptr->dis_to_h[0] = calc_to_hit(creature_ptr, INVEN_RARM, FALSE);
446 creature_ptr->dis_to_h[1] = calc_to_hit(creature_ptr, INVEN_LARM, FALSE);
447 creature_ptr->to_h_b = calc_to_hit_bow(creature_ptr, TRUE);
448 creature_ptr->dis_to_h_b = calc_to_hit_bow(creature_ptr, FALSE);
449 creature_ptr->to_d_m = calc_to_damage_misc(creature_ptr);
450 creature_ptr->to_h_m = calc_to_hit_misc(creature_ptr);
451 creature_ptr->skill_dig = calc_skill_dig(creature_ptr);
453 if (old_mighty_throw != creature_ptr->mighty_throw) {
454 creature_ptr->window |= PW_INVEN;
457 if (creature_ptr->telepathy != old_telepathy) {
458 creature_ptr->update |= (PU_MONSTERS);
461 if ((creature_ptr->esp_animal != old_esp_animal) || (creature_ptr->esp_undead != old_esp_undead) || (creature_ptr->esp_demon != old_esp_demon)
462 || (creature_ptr->esp_orc != old_esp_orc) || (creature_ptr->esp_troll != old_esp_troll) || (creature_ptr->esp_giant != old_esp_giant)
463 || (creature_ptr->esp_dragon != old_esp_dragon) || (creature_ptr->esp_human != old_esp_human) || (creature_ptr->esp_evil != old_esp_evil)
464 || (creature_ptr->esp_good != old_esp_good) || (creature_ptr->esp_nonliving != old_esp_nonliving) || (creature_ptr->esp_unique != old_esp_unique)) {
465 creature_ptr->update |= (PU_MONSTERS);
468 if (creature_ptr->see_inv != old_see_inv) {
469 creature_ptr->update |= (PU_MONSTERS);
472 if (creature_ptr->pspeed != old_speed) {
473 creature_ptr->redraw |= (PR_SPEED);
476 if ((creature_ptr->dis_ac != old_dis_ac) || (creature_ptr->dis_to_a != old_dis_to_a)) {
477 creature_ptr->redraw |= (PR_ARMOR);
478 creature_ptr->window |= (PW_PLAYER);
481 if (current_world_ptr->character_xtra)
484 put_equipment_warning(creature_ptr);
485 check_no_flowed(creature_ptr);
488 static void calc_alignment(player_type *creature_ptr)
490 creature_ptr->align = 0;
491 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
492 for (MONSTER_IDX m_idx = floor_ptr->m_max - 1; m_idx >= 1; m_idx--) {
495 m_ptr = &floor_ptr->m_list[m_idx];
496 if (!monster_is_valid(m_ptr))
498 r_ptr = &r_info[m_ptr->r_idx];
503 if (r_ptr->flags3 & RF3_GOOD)
504 creature_ptr->align += r_ptr->level;
505 if (r_ptr->flags3 & RF3_EVIL)
506 creature_ptr->align -= r_ptr->level;
509 if (creature_ptr->mimic_form) {
510 switch (creature_ptr->mimic_form) {
512 creature_ptr->align -= 200;
514 case MIMIC_DEMON_LORD:
515 creature_ptr->align -= 200;
519 switch (creature_ptr->prace) {
521 creature_ptr->align += 200;
524 creature_ptr->align -= 200;
529 for (int i = 0; i < 2; i++) {
530 if (!has_melee_weapon(creature_ptr, INVEN_RARM + i))
532 if (creature_ptr->inventory_list[INVEN_RARM + i].name1 != ART_IRON_BALL)
534 creature_ptr->align -= 1000;
539 for (int i = 0; i < 8; i++) {
540 switch (creature_ptr->vir_types[i]) {
542 creature_ptr->align += creature_ptr->virtues[i] * 2;
551 creature_ptr->align -= creature_ptr->virtues[i];
554 creature_ptr->align += creature_ptr->virtues[i];
559 for (int i = 0; i < j; i++) {
560 if (creature_ptr->align > 0) {
561 creature_ptr->align -= creature_ptr->virtues[neutral[i]] / 2;
562 if (creature_ptr->align < 0)
563 creature_ptr->align = 0;
564 } else if (creature_ptr->align < 0) {
565 creature_ptr->align += creature_ptr->virtues[neutral[i]] / 2;
566 if (creature_ptr->align > 0)
567 creature_ptr->align = 0;
573 * @brief プレイヤーの最大HPを計算する /
574 * Calculate the players (maximal) hit points
575 * Adjust current hitpoints if necessary
579 static void calc_hitpoints(player_type *creature_ptr)
581 int bonus = ((int)(adj_con_mhp[creature_ptr->stat_ind[A_CON]]) - 128) * creature_ptr->lev / 4;
582 int mhp = creature_ptr->player_hp[creature_ptr->lev - 1];
585 if (creature_ptr->mimic_form) {
586 if (creature_ptr->pclass == CLASS_SORCERER)
587 tmp_hitdie = mimic_info[creature_ptr->mimic_form].r_mhp / 2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
589 tmp_hitdie = mimic_info[creature_ptr->mimic_form].r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
590 mhp = mhp * tmp_hitdie / creature_ptr->hitdie;
593 if (creature_ptr->pclass == CLASS_SORCERER) {
594 if (creature_ptr->lev < 30)
595 mhp = (mhp * (45 + creature_ptr->lev) / 100);
597 mhp = (mhp * 75 / 100);
598 bonus = (bonus * 65 / 100);
603 if (creature_ptr->pclass == CLASS_BERSERKER) {
604 mhp = mhp * (110 + (((creature_ptr->lev + 40) * (creature_ptr->lev + 40) - 1550) / 110)) / 100;
607 if (mhp < creature_ptr->lev + 1)
608 mhp = creature_ptr->lev + 1;
609 if (is_hero(creature_ptr))
611 if (is_shero(creature_ptr))
613 if (creature_ptr->tsuyoshi)
615 if (hex_spelling(creature_ptr, HEX_XTRA_MIGHT))
617 if (hex_spelling(creature_ptr, HEX_BUILDING))
619 if (creature_ptr->mhp == mhp)
622 if (creature_ptr->chp >= mhp) {
623 creature_ptr->chp = mhp;
624 creature_ptr->chp_frac = 0;
628 if (creature_ptr->level_up_message && (mhp > creature_ptr->mhp)) {
629 msg_format("最大ヒット・ポイントが %d 増加した!", (mhp - creature_ptr->mhp));
632 creature_ptr->mhp = mhp;
634 creature_ptr->redraw |= PR_HP;
635 creature_ptr->window |= PW_PLAYER;
639 * @brief プレイヤーの現在学習可能な魔法数を計算し、増減に応じて魔法の忘却、再学習を処置する。 /
640 * Calculate number of spells player should have, and forget,
641 * or remember, spells until that number is properly reflected.
644 * Note that this function induces various "status" messages,
645 * which must be bypasses until the character is created.
647 static void calc_spells(player_type *creature_ptr)
649 if (!mp_ptr->spell_book)
651 if (!current_world_ptr->character_generated)
653 if (current_world_ptr->character_xtra)
655 if ((creature_ptr->pclass == CLASS_SORCERER) || (creature_ptr->pclass == CLASS_RED_MAGE)) {
656 creature_ptr->new_spells = 0;
660 concptr p = spell_category_name(mp_ptr->spell_book);
661 int levels = creature_ptr->lev - mp_ptr->spell_first + 1;
665 int num_allowed = (adj_mag_study[creature_ptr->stat_ind[mp_ptr->spell_stat]] * levels / 2);
667 if ((creature_ptr->pclass != CLASS_SAMURAI) && (mp_ptr->spell_book != TV_LIFE_BOOK)) {
671 if (creature_ptr->pclass == CLASS_SAMURAI) {
673 } else if (creature_ptr->realm2 == REALM_NONE) {
674 num_allowed = (num_allowed + 1) / 2;
675 if (num_allowed > (32 + bonus))
676 num_allowed = 32 + bonus;
677 } else if ((creature_ptr->pclass == CLASS_MAGE) || (creature_ptr->pclass == CLASS_PRIEST)) {
678 if (num_allowed > (96 + bonus))
679 num_allowed = 96 + bonus;
681 if (num_allowed > (80 + bonus))
682 num_allowed = 80 + bonus;
685 int num_boukyaku = 0;
686 for (int j = 0; j < 64; j++) {
687 if ((j < 32) ? (creature_ptr->spell_forgotten1 & (1L << j)) : (creature_ptr->spell_forgotten2 & (1L << (j - 32)))) {
692 creature_ptr->new_spells = num_allowed + creature_ptr->add_spells + num_boukyaku - creature_ptr->learned_spells;
693 for (int i = 63; i >= 0; i--) {
694 if (!creature_ptr->spell_learned1 && !creature_ptr->spell_learned2)
697 int j = creature_ptr->spell_order[i];
701 const magic_type *s_ptr;
702 if (!is_magic((j < 32) ? creature_ptr->realm1 : creature_ptr->realm2)) {
704 s_ptr = &technic_info[creature_ptr->realm1 - MIN_TECHNIC][j];
706 s_ptr = &technic_info[creature_ptr->realm2 - MIN_TECHNIC][j % 32];
708 s_ptr = &mp_ptr->info[creature_ptr->realm1 - 1][j];
710 s_ptr = &mp_ptr->info[creature_ptr->realm2 - 1][j % 32];
712 if (s_ptr->slevel <= creature_ptr->lev)
715 bool is_spell_learned = (j < 32) ? (creature_ptr->spell_learned1 & (1L << j)) : (creature_ptr->spell_learned2 & (1L << (j - 32)));
716 if (!is_spell_learned)
721 creature_ptr->spell_forgotten1 |= (1L << j);
722 which = creature_ptr->realm1;
724 creature_ptr->spell_forgotten2 |= (1L << (j - 32));
725 which = creature_ptr->realm2;
729 creature_ptr->spell_learned1 &= ~(1L << j);
730 which = creature_ptr->realm1;
732 creature_ptr->spell_learned2 &= ~(1L << (j - 32));
733 which = creature_ptr->realm2;
737 msg_format("%sの%sを忘れてしまった。", exe_spell(creature_ptr, which, j % 32, SPELL_NAME), p);
739 msg_format("You have forgotten the %s of %s.", p, exe_spell(creature_ptr, which, j % 32, SPELL_NAME));
741 creature_ptr->new_spells++;
744 /* Forget spells if we know too many spells */
745 for (int i = 63; i >= 0; i--) {
746 if (creature_ptr->new_spells >= 0)
748 if (!creature_ptr->spell_learned1 && !creature_ptr->spell_learned2)
751 int j = creature_ptr->spell_order[i];
755 bool is_spell_learned = (j < 32) ? (creature_ptr->spell_learned1 & (1L << j)) : (creature_ptr->spell_learned2 & (1L << (j - 32)));
756 if (!is_spell_learned)
761 creature_ptr->spell_forgotten1 |= (1L << j);
762 which = creature_ptr->realm1;
764 creature_ptr->spell_forgotten2 |= (1L << (j - 32));
765 which = creature_ptr->realm2;
769 creature_ptr->spell_learned1 &= ~(1L << j);
770 which = creature_ptr->realm1;
772 creature_ptr->spell_learned2 &= ~(1L << (j - 32));
773 which = creature_ptr->realm2;
777 msg_format("%sの%sを忘れてしまった。", exe_spell(creature_ptr, which, j % 32, SPELL_NAME), p);
779 msg_format("You have forgotten the %s of %s.", p, exe_spell(creature_ptr, which, j % 32, SPELL_NAME));
781 creature_ptr->new_spells++;
784 /* Check for spells to remember */
785 for (int i = 0; i < 64; i++) {
786 if (creature_ptr->new_spells <= 0)
788 if (!creature_ptr->spell_forgotten1 && !creature_ptr->spell_forgotten2)
790 int j = creature_ptr->spell_order[i];
794 const magic_type *s_ptr;
795 if (!is_magic((j < 32) ? creature_ptr->realm1 : creature_ptr->realm2)) {
797 s_ptr = &technic_info[creature_ptr->realm1 - MIN_TECHNIC][j];
799 s_ptr = &technic_info[creature_ptr->realm2 - MIN_TECHNIC][j % 32];
801 s_ptr = &mp_ptr->info[creature_ptr->realm1 - 1][j];
803 s_ptr = &mp_ptr->info[creature_ptr->realm2 - 1][j % 32];
805 if (s_ptr->slevel > creature_ptr->lev)
808 bool is_spell_learned = (j < 32) ? (creature_ptr->spell_forgotten1 & (1L << j)) : (creature_ptr->spell_forgotten2 & (1L << (j - 32)));
809 if (!is_spell_learned)
814 creature_ptr->spell_forgotten1 &= ~(1L << j);
815 which = creature_ptr->realm1;
817 creature_ptr->spell_forgotten2 &= ~(1L << (j - 32));
818 which = creature_ptr->realm2;
822 creature_ptr->spell_learned1 |= (1L << j);
823 which = creature_ptr->realm1;
825 creature_ptr->spell_learned2 |= (1L << (j - 32));
826 which = creature_ptr->realm2;
830 msg_format("%sの%sを思い出した。", exe_spell(creature_ptr, which, j % 32, SPELL_NAME), p);
832 msg_format("You have remembered the %s of %s.", p, exe_spell(creature_ptr, which, j % 32, SPELL_NAME));
834 creature_ptr->new_spells--;
837 if (creature_ptr->realm2 == REALM_NONE) {
839 for (int j = 0; j < 32; j++) {
840 const magic_type *s_ptr;
841 if (!is_magic(creature_ptr->realm1))
842 s_ptr = &technic_info[creature_ptr->realm1 - MIN_TECHNIC][j];
844 s_ptr = &mp_ptr->info[creature_ptr->realm1 - 1][j];
846 if (s_ptr->slevel > creature_ptr->lev)
849 if (creature_ptr->spell_learned1 & (1L << j)) {
858 if ((creature_ptr->new_spells > k) && ((mp_ptr->spell_book == TV_LIFE_BOOK) || (mp_ptr->spell_book == TV_HISSATSU_BOOK))) {
859 creature_ptr->new_spells = (s16b)k;
863 if (creature_ptr->new_spells < 0)
864 creature_ptr->new_spells = 0;
866 if (creature_ptr->old_spells == creature_ptr->new_spells)
869 if (creature_ptr->new_spells) {
871 if (creature_ptr->new_spells < 10) {
872 msg_format("あと %d つの%sを学べる。", creature_ptr->new_spells, p);
874 msg_format("あと %d 個の%sを学べる。", creature_ptr->new_spells, p);
877 msg_format("You can learn %d more %s%s.", creature_ptr->new_spells, p, (creature_ptr->new_spells != 1) ? "s" : "");
881 creature_ptr->old_spells = creature_ptr->new_spells;
882 creature_ptr->redraw |= PR_STUDY;
883 creature_ptr->window |= PW_OBJECT;
887 * @brief プレイヤーの最大MPを計算する /
888 * Calculate maximum mana. You do not need to know any spells.
889 * Note that mana is lowered by heavy (or inappropriate) armor.
892 * This function induces status messages.
894 static void calc_mana(player_type *creature_ptr)
896 if (!mp_ptr->spell_book)
900 if ((creature_ptr->pclass == CLASS_MINDCRAFTER) || (creature_ptr->pclass == CLASS_MIRROR_MASTER) || (creature_ptr->pclass == CLASS_BLUE_MAGE)) {
901 levels = creature_ptr->lev;
903 if (mp_ptr->spell_first > creature_ptr->lev) {
904 creature_ptr->msp = 0;
905 creature_ptr->redraw |= (PR_MANA);
909 levels = (creature_ptr->lev - mp_ptr->spell_first) + 1;
913 if (creature_ptr->pclass == CLASS_SAMURAI) {
914 msp = (adj_mag_mana[creature_ptr->stat_ind[mp_ptr->spell_stat]] + 10) * 2;
916 msp += (msp * rp_ptr->r_adj[mp_ptr->spell_stat] / 20);
918 msp = adj_mag_mana[creature_ptr->stat_ind[mp_ptr->spell_stat]] * (levels + 3) / 4;
922 msp += (msp * rp_ptr->r_adj[mp_ptr->spell_stat] / 20);
923 if (msp && (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN))
925 if (msp && (creature_ptr->pclass == CLASS_HIGH_MAGE))
927 if (msp && (creature_ptr->pclass == CLASS_SORCERER))
928 msp += msp * (25 + creature_ptr->lev) / 100;
931 if (mp_ptr->spell_xtra & MAGIC_GLOVE_REDUCE_MANA) {
932 BIT_FLAGS flgs[TR_FLAG_SIZE];
933 creature_ptr->cumber_glove = FALSE;
935 o_ptr = &creature_ptr->inventory_list[INVEN_HANDS];
936 object_flags(creature_ptr, o_ptr, flgs);
937 if (o_ptr->k_idx && !(has_flag(flgs, TR_FREE_ACT)) && !(has_flag(flgs, TR_DEC_MANA)) && !(has_flag(flgs, TR_EASY_SPELL))
938 && !((has_flag(flgs, TR_MAGIC_MASTERY)) && (o_ptr->pval > 0)) && !((has_flag(flgs, TR_DEX)) && (o_ptr->pval > 0))) {
939 creature_ptr->cumber_glove = TRUE;
944 creature_ptr->cumber_armor = FALSE;
947 if (creature_ptr->inventory_list[INVEN_RARM].tval > TV_SWORD)
948 cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight;
949 if (creature_ptr->inventory_list[INVEN_LARM].tval > TV_SWORD)
950 cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight;
951 cur_wgt += creature_ptr->inventory_list[INVEN_BODY].weight;
952 cur_wgt += creature_ptr->inventory_list[INVEN_HEAD].weight;
953 cur_wgt += creature_ptr->inventory_list[INVEN_OUTER].weight;
954 cur_wgt += creature_ptr->inventory_list[INVEN_HANDS].weight;
955 cur_wgt += creature_ptr->inventory_list[INVEN_FEET].weight;
957 switch (creature_ptr->pclass) {
959 case CLASS_HIGH_MAGE:
960 case CLASS_BLUE_MAGE:
962 case CLASS_FORCETRAINER:
963 case CLASS_SORCERER: {
964 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD)
965 cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight;
966 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD)
967 cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight;
972 case CLASS_TOURIST: {
973 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD)
974 cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight * 2 / 3;
975 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD)
976 cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight * 2 / 3;
979 case CLASS_MINDCRAFTER:
980 case CLASS_BEASTMASTER:
981 case CLASS_MIRROR_MASTER: {
982 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD)
983 cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight / 2;
984 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD)
985 cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight / 2;
991 case CLASS_WARRIOR_MAGE: {
992 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD)
993 cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight / 3;
994 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD)
995 cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight / 3;
999 case CLASS_CHAOS_WARRIOR: {
1000 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD)
1001 cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight / 5;
1002 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD)
1003 cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight / 5;
1011 int max_wgt = mp_ptr->spell_weight;
1012 if ((cur_wgt - max_wgt) > 0) {
1013 creature_ptr->cumber_armor = TRUE;
1014 switch (creature_ptr->pclass) {
1016 case CLASS_HIGH_MAGE:
1017 case CLASS_BLUE_MAGE: {
1018 msp -= msp * (cur_wgt - max_wgt) / 600;
1022 case CLASS_MINDCRAFTER:
1023 case CLASS_BEASTMASTER:
1025 case CLASS_FORCETRAINER:
1027 case CLASS_MIRROR_MASTER: {
1028 msp -= msp * (cur_wgt - max_wgt) / 800;
1031 case CLASS_SORCERER: {
1032 msp -= msp * (cur_wgt - max_wgt) / 900;
1038 case CLASS_RED_MAGE: {
1039 msp -= msp * (cur_wgt - max_wgt) / 1000;
1043 case CLASS_CHAOS_WARRIOR:
1044 case CLASS_WARRIOR_MAGE: {
1045 msp -= msp * (cur_wgt - max_wgt) / 1200;
1048 case CLASS_SAMURAI: {
1049 creature_ptr->cumber_armor = FALSE;
1053 msp -= msp * (cur_wgt - max_wgt) / 800;
1062 if (creature_ptr->msp != msp) {
1063 if ((creature_ptr->csp >= msp) && (creature_ptr->pclass != CLASS_SAMURAI)) {
1064 creature_ptr->csp = msp;
1065 creature_ptr->csp_frac = 0;
1069 if (creature_ptr->level_up_message && (msp > creature_ptr->msp)) {
1070 msg_format("最大マジック・ポイントが %d 増加した!", (msp - creature_ptr->msp));
1073 creature_ptr->msp = msp;
1074 creature_ptr->redraw |= (PR_MANA);
1075 creature_ptr->window |= (PW_PLAYER | PW_SPELL);
1078 if (current_world_ptr->character_xtra)
1081 if (creature_ptr->old_cumber_glove != creature_ptr->cumber_glove) {
1082 if (creature_ptr->cumber_glove)
1083 msg_print(_("手が覆われて呪文が唱えにくい感じがする。", "Your covered hands feel unsuitable for spellcasting."));
1085 msg_print(_("この手の状態なら、ぐっと呪文が唱えやすい感じだ。", "Your hands feel more suitable for spellcasting."));
1087 creature_ptr->old_cumber_glove = creature_ptr->cumber_glove;
1090 if (creature_ptr->old_cumber_armor == creature_ptr->cumber_armor)
1093 if (creature_ptr->cumber_armor)
1094 msg_print(_("装備の重さで動きが鈍くなってしまっている。", "The weight of your equipment encumbers your movement."));
1096 msg_print(_("ぐっと楽に体を動かせるようになった。", "You feel able to move more freely."));
1098 creature_ptr->old_cumber_armor = creature_ptr->cumber_armor;
1102 * @brief 装備中の射撃武器の威力倍率を返す /
1103 * calcurate the fire rate of target object
1104 * @param o_ptr 計算する射撃武器のアイテム情報参照ポインタ
1105 * @return 射撃倍率の値(100で1.00倍)
1107 s16b calc_num_fire(player_type *creature_ptr, object_type *o_ptr)
1109 int extra_shots = 0;
1110 BIT_FLAGS flgs[TR_FLAG_SIZE];
1112 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1114 q_ptr = &creature_ptr->inventory_list[i];
1121 object_flags(creature_ptr, q_ptr, flgs);
1122 if (has_flag(flgs, TR_XTRA_SHOTS))
1126 object_flags(creature_ptr, o_ptr, flgs);
1127 if (has_flag(flgs, TR_XTRA_SHOTS))
1131 if (o_ptr->k_idx == 0 || is_heavy_shoot(creature_ptr, o_ptr))
1135 num += (extra_shots * 100);
1137 tval_type tval_ammo = bow_tval_ammo(o_ptr);
1138 if ((creature_ptr->pclass == CLASS_RANGER) && (tval_ammo == TV_ARROW)) {
1139 num += (creature_ptr->lev * 4);
1142 if ((creature_ptr->pclass == CLASS_CAVALRY) && (tval_ammo == TV_ARROW)) {
1143 num += (creature_ptr->lev * 3);
1146 if (creature_ptr->pclass == CLASS_ARCHER) {
1147 if (tval_ammo == TV_ARROW)
1148 num += ((creature_ptr->lev * 5) + 50);
1149 else if ((tval_ammo == TV_BOLT) || (tval_ammo == TV_SHOT))
1150 num += (creature_ptr->lev * 4);
1153 if (creature_ptr->pclass == CLASS_WARRIOR && (tval_ammo <= TV_BOLT) && (tval_ammo >= TV_SHOT)) {
1154 num += (creature_ptr->lev * 2);
1157 if ((creature_ptr->pclass == CLASS_ROGUE) && (tval_ammo == TV_SHOT)) {
1158 num += (creature_ptr->lev * 4);
1166 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1170 * * 変異MUT3_INFRAVISによる加算(+3)
1171 * * 魔法効果tim_infraによる加算(+3)
1172 * * 装備がTR_INFRAフラグ持ちなら加算(+pval*1)
1174 static ACTION_SKILL_POWER calc_intra_vision(player_type *creature_ptr)
1176 ACTION_SKILL_POWER pow;
1177 const player_race *tmp_rp_ptr;
1179 if (creature_ptr->mimic_form)
1180 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1182 tmp_rp_ptr = &race_info[creature_ptr->prace];
1184 pow = tmp_rp_ptr->infra;
1186 if (creature_ptr->muta3 & MUT3_INFRAVIS) {
1190 if (creature_ptr->tim_infra) {
1194 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1196 BIT_FLAGS flgs[TR_FLAG_SIZE];
1197 o_ptr = &creature_ptr->inventory_list[i];
1200 object_flags(creature_ptr, o_ptr, flgs);
1201 if (has_flag(flgs, TR_INFRA))
1210 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1216 * * 装備による修正(TR_STEALTHがあれば+pval*1)
1217 * * 変異MUT3_XTRA_NOISで減算(-3)
1218 * * 変異MUT3_MOTIONで加算(+1)
1219 * * 呪術を唱えていると減算(-(詠唱数+1))
1220 * * セクシーギャルでない影フェアリーがTRC_AGGRAVATE持ちの時、別処理でTRC_AGGRAVATEを無効にする代わりに減算(-3か3未満なら(現在値+2)/2)
1222 * * 忍者がheavy_armorならば減算(-レベル/10)
1223 * * 忍者がheavy_armorでなく適正な武器を持っていれば加算(+レベル/10)
1227 static ACTION_SKILL_POWER calc_stealth(player_type *creature_ptr)
1229 ACTION_SKILL_POWER pow;
1230 const player_race *tmp_rp_ptr;
1232 if (creature_ptr->mimic_form)
1233 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1235 tmp_rp_ptr = &race_info[creature_ptr->prace];
1236 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1237 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1239 pow = 1 + tmp_rp_ptr->r_stl + c_ptr->c_stl + a_ptr->a_stl;
1240 pow += (c_ptr->x_stl * creature_ptr->lev / 10);
1242 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1244 BIT_FLAGS flgs[TR_FLAG_SIZE];
1245 o_ptr = &creature_ptr->inventory_list[i];
1248 object_flags(creature_ptr, o_ptr, flgs);
1249 if (has_flag(flgs, TR_STEALTH))
1253 if (creature_ptr->muta3 & MUT3_XTRA_NOIS) {
1256 if (creature_ptr->muta3 & MUT3_MOTION) {
1259 if (creature_ptr->realm1 == REALM_HEX) {
1260 if (hex_spelling_any(creature_ptr))
1261 pow -= (1 + casting_hex_num(creature_ptr));
1263 if (player_aggravate_state(creature_ptr) == AGGRAVATE_S_FAIRY) {
1264 pow = MIN(pow - 3, (pow + 2) / 2);
1267 if (is_shero(creature_ptr)) {
1271 if (creature_ptr->pclass == CLASS_NINJA) {
1272 if (heavy_armor(creature_ptr)) {
1273 pow -= (creature_ptr->lev) / 10;
1274 } else if ((!creature_ptr->inventory_list[INVEN_RARM].k_idx || has_right_hand_weapon(creature_ptr))
1275 && (!creature_ptr->inventory_list[INVEN_LARM].k_idx || has_left_hand_weapon(creature_ptr))) {
1276 pow += (creature_ptr->lev) / 10;
1280 if (is_time_limit_stealth(creature_ptr))
1293 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1297 * * 職業と性格とレベルによる追加加算
1298 * * 器用さに応じたadj_dex_disテーブルによる加算
1299 * * 知力に応じたadj_int_disテーブルによる加算
1301 static ACTION_SKILL_POWER calc_disarming(player_type *creature_ptr)
1303 ACTION_SKILL_POWER pow;
1304 const player_race *tmp_rp_ptr;
1306 if (creature_ptr->mimic_form)
1307 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1309 tmp_rp_ptr = &race_info[creature_ptr->prace];
1310 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1311 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1313 pow = tmp_rp_ptr->r_dis + c_ptr->c_dis + a_ptr->a_dis;
1314 pow += ((cp_ptr->x_dis * creature_ptr->lev / 10) + (ap_ptr->a_dis * creature_ptr->lev / 50));
1315 pow += adj_dex_dis[creature_ptr->stat_ind[A_DEX]];
1316 pow += adj_int_dis[creature_ptr->stat_ind[A_INT]];
1322 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1326 * * 職業と性格とレベルによる追加加算
1327 * * 装備による加算(TR_MAGIC_MASTERYを持っていたら+pval*8)
1328 * * 知力に応じたadj_int_devテーブルによる加算
1331 static ACTION_SKILL_POWER calc_device_ability(player_type *creature_ptr)
1333 ACTION_SKILL_POWER pow;
1334 const player_race *tmp_rp_ptr;
1336 if (creature_ptr->mimic_form)
1337 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1339 tmp_rp_ptr = &race_info[creature_ptr->prace];
1340 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1341 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1343 pow = tmp_rp_ptr->r_dev + c_ptr->c_dev + a_ptr->a_dev;
1344 pow += ((c_ptr->x_dev * creature_ptr->lev / 10) + (ap_ptr->a_dev * creature_ptr->lev / 50));
1346 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1348 BIT_FLAGS flgs[TR_FLAG_SIZE];
1349 o_ptr = &creature_ptr->inventory_list[i];
1352 object_flags(creature_ptr, o_ptr, flgs);
1353 if (has_flag(flgs, TR_MAGIC_MASTERY))
1354 pow += 8 * o_ptr->pval;
1357 pow += adj_int_dev[creature_ptr->stat_ind[A_INT]];
1359 if (is_shero(creature_ptr)) {
1367 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1371 * * 職業と性格とレベルによる追加加算
1372 * * 変異MUT3_MAGIC_RESによる加算(15 + レベル / 5)
1373 * * 賢さによるadj_wis_savテーブル加算
1375 * * 反魔法持ちで大なり上書き(90+レベル未満ならその値に上書き)
1376 * * クターのつぶれ状態なら(10に上書き)
1377 * * 生命の「究極の耐性」や regist_magic,magicdef持ちなら大なり上書き(95+レベル未満ならその値に上書き)
1378 * * 呪いのdown_savingがかかっているなら半減
1380 static ACTION_SKILL_POWER calc_saving_throw(player_type *creature_ptr)
1382 ACTION_SKILL_POWER pow;
1383 const player_race *tmp_rp_ptr;
1385 if (creature_ptr->mimic_form)
1386 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1388 tmp_rp_ptr = &race_info[creature_ptr->prace];
1389 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1390 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1392 pow = tmp_rp_ptr->r_sav + c_ptr->c_sav + a_ptr->a_sav;
1393 pow += ((cp_ptr->x_sav * creature_ptr->lev / 10) + (ap_ptr->a_sav * creature_ptr->lev / 50));
1395 if (creature_ptr->muta3 & MUT3_MAGIC_RES)
1396 pow += (15 + (creature_ptr->lev / 5));
1398 pow += adj_wis_sav[creature_ptr->stat_ind[A_WIS]];
1400 if (is_shero(creature_ptr))
1403 if (creature_ptr->anti_magic && (pow < (90 + creature_ptr->lev)))
1404 pow = 90 + creature_ptr->lev;
1406 if (creature_ptr->tsubureru)
1409 if ((creature_ptr->ult_res || creature_ptr->resist_magic || creature_ptr->magicdef) && (pow < (95 + creature_ptr->lev)))
1410 pow = 95 + creature_ptr->lev;
1412 if (creature_ptr->down_saving)
1420 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1425 * * 各装備による加算(TR_SEARCHがあれば+pval*5)
1427 * * 変異(MUT3_XTRA_EYES)による加算(+15)
1429 static ACTION_SKILL_POWER calc_search(player_type *creature_ptr)
1431 ACTION_SKILL_POWER pow;
1432 const player_race *tmp_rp_ptr;
1434 if (creature_ptr->mimic_form)
1435 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1437 tmp_rp_ptr = &race_info[creature_ptr->prace];
1438 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1439 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1441 pow = tmp_rp_ptr->r_srh + c_ptr->c_srh + a_ptr->a_srh;
1442 pow += (c_ptr->x_srh * creature_ptr->lev / 10);
1444 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1446 BIT_FLAGS flgs[TR_FLAG_SIZE];
1447 o_ptr = &creature_ptr->inventory_list[i];
1450 object_flags(creature_ptr, o_ptr, flgs);
1451 if (has_flag(flgs, TR_SEARCH))
1452 pow += (o_ptr->pval * 5);
1455 if (creature_ptr->muta3 & MUT3_XTRA_EYES) {
1459 if (is_shero(creature_ptr)) {
1468 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1473 * * 各装備による加算(TR_SEARCHがあれば+pval*5)
1475 * * 変異(MUT3_XTRA_EYES)による加算(+15)
1477 static ACTION_SKILL_POWER calc_search_freq(player_type *creature_ptr)
1479 ACTION_SKILL_POWER pow;
1480 const player_race *tmp_rp_ptr;
1482 if (creature_ptr->mimic_form)
1483 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1485 tmp_rp_ptr = &race_info[creature_ptr->prace];
1486 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1487 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1489 pow = tmp_rp_ptr->r_fos + c_ptr->c_fos + a_ptr->a_fos;
1490 pow += (c_ptr->x_fos * creature_ptr->lev / 10);
1492 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1494 BIT_FLAGS flgs[TR_FLAG_SIZE];
1495 o_ptr = &creature_ptr->inventory_list[i];
1498 object_flags(creature_ptr, o_ptr, flgs);
1499 if (has_flag(flgs, TR_SEARCH))
1500 pow += (o_ptr->pval * 5);
1503 if (is_shero(creature_ptr)) {
1507 if (creature_ptr->muta3 & MUT3_XTRA_EYES) {
1516 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1519 * * 種族/職業/性格による加算とレベルによる追加加算
1521 static ACTION_SKILL_POWER calc_to_hit_melee(player_type *creature_ptr)
1523 ACTION_SKILL_POWER pow;
1524 const player_race *tmp_rp_ptr;
1525 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1526 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1528 if (creature_ptr->mimic_form)
1529 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1531 tmp_rp_ptr = &race_info[creature_ptr->prace];
1533 pow = tmp_rp_ptr->r_thn + c_ptr->c_thn + a_ptr->a_thn;
1534 pow += ((c_ptr->x_thn * creature_ptr->lev / 10) + (a_ptr->a_thn * creature_ptr->lev / 50));
1540 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1543 * * 種族/職業/性格による加算とレベルによる追加加算
1545 static ACTION_SKILL_POWER calc_to_hit_shoot(player_type *creature_ptr)
1547 ACTION_SKILL_POWER pow;
1548 const player_race *tmp_rp_ptr;
1549 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1550 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1552 if (creature_ptr->mimic_form)
1553 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1555 tmp_rp_ptr = &race_info[creature_ptr->prace];
1557 pow = tmp_rp_ptr->r_thb + c_ptr->c_thb + a_ptr->a_thb;
1558 pow += ((c_ptr->x_thb * creature_ptr->lev / 10) + (a_ptr->a_thb * creature_ptr->lev / 50));
1564 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1567 * * 種族/職業/性格による加算とレベルによる追加加算
1570 static ACTION_SKILL_POWER calc_to_hit_throw(player_type *creature_ptr)
1572 ACTION_SKILL_POWER pow;
1573 const player_race *tmp_rp_ptr;
1574 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1575 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1577 if (creature_ptr->mimic_form)
1578 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1580 tmp_rp_ptr = &race_info[creature_ptr->prace];
1582 pow = tmp_rp_ptr->r_thb + c_ptr->c_thb + a_ptr->a_thb;
1583 pow += ((c_ptr->x_thb * creature_ptr->lev / 10) + (a_ptr->a_thb * creature_ptr->lev / 50));
1585 if (is_shero(creature_ptr)) {
1594 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1605 static ACTION_SKILL_POWER calc_skill_dig(player_type *creature_ptr)
1608 BIT_FLAGS flgs[TR_FLAG_SIZE];
1610 ACTION_SKILL_POWER pow;
1614 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_ENT && !creature_ptr->inventory_list[INVEN_RARM].k_idx) {
1615 pow += creature_ptr->lev * 10;
1618 if (is_shero(creature_ptr))
1621 pow += adj_str_dig[creature_ptr->stat_ind[A_STR]];
1623 if (creature_ptr->pclass == CLASS_BERSERKER)
1624 pow += (100 + creature_ptr->lev * 8);
1626 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1627 o_ptr = &creature_ptr->inventory_list[i];
1630 object_flags(creature_ptr, o_ptr, flgs);
1631 if (has_flag(flgs, TR_TUNNEL))
1632 pow += (o_ptr->pval * 20);
1635 for (int i = 0; i < 2; i++) {
1636 o_ptr = &creature_ptr->inventory_list[INVEN_RARM + i];
1637 if (has_melee_weapon(creature_ptr, INVEN_RARM + i) && !creature_ptr->heavy_wield[i]) {
1638 pow += (o_ptr->weight / 10);
1642 if (is_shero(creature_ptr)) {
1652 static bool is_martial_arts_mode(player_type *creature_ptr)
1654 return ((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER) || (creature_ptr->pclass == CLASS_BERSERKER))
1655 && (empty_hands(creature_ptr, TRUE) & EMPTY_HAND_RARM) && !has_left_hand_weapon(creature_ptr);
1658 static s16b calc_num_blow(player_type *creature_ptr, int i)
1661 BIT_FLAGS flgs[TR_FLAG_SIZE];
1664 o_ptr = &creature_ptr->inventory_list[INVEN_RARM + i];
1665 object_flags(creature_ptr, o_ptr, flgs);
1666 creature_ptr->heavy_wield[i] = FALSE;
1667 if (has_melee_weapon(creature_ptr, INVEN_RARM + i)) {
1668 if (calc_weapon_weight_limit(creature_ptr) < o_ptr->weight / 10) {
1669 creature_ptr->heavy_wield[i] = TRUE;
1672 if (o_ptr->k_idx && !creature_ptr->heavy_wield[i]) {
1673 int str_index, dex_index;
1674 int num = 0, wgt = 0, mul = 0, div = 0;
1676 num = class_info[creature_ptr->pclass].num;
1677 wgt = class_info[creature_ptr->pclass].wgt;
1678 mul = class_info[creature_ptr->pclass].mul;
1680 if (creature_ptr->pclass == CLASS_CAVALRY && (creature_ptr->riding) && (has_flag(flgs, TR_RIDING))) {
1686 if (hex_spelling(creature_ptr, HEX_XTRA_MIGHT) || hex_spelling(creature_ptr, HEX_BUILDING)) {
1692 div = ((o_ptr->weight < wgt) ? wgt : o_ptr->weight);
1693 str_index = (adj_str_blow[creature_ptr->stat_ind[A_STR]] * mul / div);
1695 if (has_two_handed_weapons(creature_ptr) && !has_disable_two_handed_bonus(creature_ptr, 0))
1697 if (creature_ptr->pclass == CLASS_NINJA)
1698 str_index = MAX(0, str_index - 1);
1702 dex_index = (adj_dex_blow[creature_ptr->stat_ind[A_DEX]]);
1706 num_blow = blows_table[str_index][dex_index];
1708 num_blow = (s16b)num;
1710 num_blow += (s16b)creature_ptr->extra_blows[i];
1711 if (creature_ptr->pclass == CLASS_WARRIOR)
1712 num_blow += (creature_ptr->lev / 40);
1713 else if (creature_ptr->pclass == CLASS_BERSERKER)
1714 num_blow += (creature_ptr->lev / 23);
1715 else if ((creature_ptr->pclass == CLASS_ROGUE) && (o_ptr->weight < 50) && (creature_ptr->stat_ind[A_DEX] >= 30))
1718 if (creature_ptr->special_defense & KATA_FUUJIN)
1721 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_POISON_NEEDLE))
1731 /* Different calculation for monks with empty hands */
1732 if (is_martial_arts_mode(creature_ptr)) {
1733 int blow_base = creature_ptr->lev + adj_dex_blow[creature_ptr->stat_ind[A_DEX]];
1736 if (creature_ptr->pclass == CLASS_FORCETRAINER) {
1746 MAGIC_NUM1 current_ki = get_current_ki(creature_ptr);
1747 if (current_ki != i) {
1748 creature_ptr->to_d[i] += current_ki / 5;
1749 creature_ptr->dis_to_d[i] += current_ki / 5;
1768 if (heavy_armor(creature_ptr) && (creature_ptr->pclass != CLASS_BERSERKER))
1771 if (creature_ptr->special_defense & KAMAE_GENBU) {
1772 creature_ptr->to_a += (creature_ptr->lev * creature_ptr->lev) / 50;
1773 creature_ptr->dis_to_a += (creature_ptr->lev * creature_ptr->lev) / 50;
1775 if ((creature_ptr->pclass == CLASS_MONK) && (creature_ptr->lev > 42))
1779 } else if (creature_ptr->special_defense & KAMAE_SUZAKU) {
1780 creature_ptr->to_h[i] -= (creature_ptr->lev / 3);
1781 creature_ptr->to_d[i] -= (creature_ptr->lev / 6);
1783 creature_ptr->dis_to_h[i] -= (creature_ptr->lev / 3);
1784 creature_ptr->dis_to_d[i] -= (creature_ptr->lev / 6);
1788 num_blow += 1 + creature_ptr->extra_blows[0];
1791 if (has_not_ninja_weapon(creature_ptr, i)) {
1802 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1806 * * エントは別途レベル26,41,46到達ごとに加算(+1)
1807 * * 装備がTR_STRフラグを持っていれば加算(+pval*1)
1813 * * 変異MUT3_HYPER_STRで加算(+4)
1814 * * 変異MUT3_PUNYで減算(-4)
1815 * * ネオ・つよしスペシャル中で加算(+4)
1817 static s16b calc_strength_addition(player_type *creature_ptr)
1820 const player_race *tmp_rp_ptr;
1821 if (creature_ptr->mimic_form)
1822 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1824 tmp_rp_ptr = &race_info[creature_ptr->prace];
1825 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1826 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1827 pow = tmp_rp_ptr->r_adj[A_STR] + c_ptr->c_adj[A_STR] + a_ptr->a_adj[A_STR];
1829 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_ENT) {
1830 if (creature_ptr->lev > 25)
1832 if (creature_ptr->lev > 40)
1834 if (creature_ptr->lev > 45)
1838 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1840 BIT_FLAGS flgs[TR_FLAG_SIZE];
1841 o_ptr = &creature_ptr->inventory_list[i];
1844 object_flags(creature_ptr, o_ptr, flgs);
1845 if (has_flag(flgs, TR_STR)) {
1850 if (creature_ptr->realm1 == REALM_HEX) {
1851 if (hex_spelling(creature_ptr, HEX_XTRA_MIGHT)) {
1854 if (hex_spelling(creature_ptr, HEX_BUILDING)) {
1859 if (creature_ptr->special_defense & KATA_KOUKIJIN) {
1863 if (creature_ptr->special_defense & KAMAE_BYAKKO) {
1865 } else if (creature_ptr->special_defense & KAMAE_SUZAKU) {
1869 if (creature_ptr->muta3) {
1871 if (creature_ptr->muta3 & MUT3_HYPER_STR) {
1875 if (creature_ptr->muta3 & MUT3_PUNY) {
1880 if (creature_ptr->tsuyoshi) {
1888 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1892 * * 装備がTR_INTフラグを持っていれば加算(+pval*1)
1898 * * 変異MUT3_HYPER_INTで加算(+4)
1899 * * 変異MUT3_MORONICで減算(-4)
1901 s16b calc_intelligence_addition(player_type *creature_ptr)
1904 const player_race *tmp_rp_ptr;
1905 if (creature_ptr->mimic_form)
1906 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1908 tmp_rp_ptr = &race_info[creature_ptr->prace];
1909 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1910 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1911 pow = tmp_rp_ptr->r_adj[A_INT] + c_ptr->c_adj[A_INT] + a_ptr->a_adj[A_INT];
1913 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1915 BIT_FLAGS flgs[TR_FLAG_SIZE];
1916 o_ptr = &creature_ptr->inventory_list[i];
1919 object_flags(creature_ptr, o_ptr, flgs);
1920 if (has_flag(flgs, TR_INT)) {
1925 if (creature_ptr->special_defense & KATA_KOUKIJIN) {
1929 if (creature_ptr->special_defense & KAMAE_GENBU) {
1931 } else if (creature_ptr->special_defense & KAMAE_SUZAKU) {
1935 if (creature_ptr->muta3) {
1936 if (creature_ptr->muta3 & MUT3_HYPER_INT) {
1940 if (creature_ptr->muta3 & MUT3_MORONIC) {
1950 * @param creature_ptr 計算するクリーチャーの参照ポインタ
1954 * * 装備がTR_WISフラグを持っていれば加算(+pval*1)
1960 * * 変異MUT3_HYPER_INTで加算(+4)
1961 * * 変異MUT3_MORONICで減算(-4)
1963 static s16b calc_wisdom_addition(player_type *creature_ptr)
1966 const player_race *tmp_rp_ptr;
1967 if (creature_ptr->mimic_form)
1968 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1970 tmp_rp_ptr = &race_info[creature_ptr->prace];
1971 const player_class *c_ptr = &class_info[creature_ptr->pclass];
1972 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
1973 pow = tmp_rp_ptr->r_adj[A_WIS] + c_ptr->c_adj[A_WIS] + a_ptr->a_adj[A_WIS];
1975 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1977 BIT_FLAGS flgs[TR_FLAG_SIZE];
1978 o_ptr = &creature_ptr->inventory_list[i];
1981 object_flags(creature_ptr, o_ptr, flgs);
1982 if (has_flag(flgs, TR_WIS)) {
1987 if (creature_ptr->special_defense & KATA_KOUKIJIN) {
1991 if (creature_ptr->special_defense & KAMAE_GENBU) {
1993 } else if (creature_ptr->special_defense & KAMAE_SUZAKU) {
1997 if (creature_ptr->muta3) {
1999 if (creature_ptr->muta3 & MUT3_HYPER_INT) {
2003 if (creature_ptr->muta3 & MUT3_MORONIC) {
2013 * @param creature_ptr 計算するクリーチャーの参照ポインタ
2017 * * エントは別途レベル26,41,46到達ごとに減算(-1)
2018 * * 装備がTR_DEXフラグを持っていれば加算(+pval*1)
2024 * * 変異MUT3_IRON_SKINで減算(-1)
2025 * * 変異MUT3_LIMBERで加算(+3)
2026 * * 変異MUT3_ARTHRITISで減算(-3)
2028 static s16b calc_dexterity_addition(player_type *creature_ptr)
2031 const player_race *tmp_rp_ptr;
2032 if (creature_ptr->mimic_form)
2033 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
2035 tmp_rp_ptr = &race_info[creature_ptr->prace];
2036 const player_class *c_ptr = &class_info[creature_ptr->pclass];
2037 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
2038 pow = tmp_rp_ptr->r_adj[A_DEX] + c_ptr->c_adj[A_DEX] + a_ptr->a_adj[A_DEX];
2040 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_ENT) {
2041 if (creature_ptr->lev > 25)
2043 if (creature_ptr->lev > 40)
2045 if (creature_ptr->lev > 45)
2049 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2051 BIT_FLAGS flgs[TR_FLAG_SIZE];
2052 o_ptr = &creature_ptr->inventory_list[i];
2055 object_flags(creature_ptr, o_ptr, flgs);
2056 if (has_flag(flgs, TR_DEX)) {
2061 if (creature_ptr->realm1 == REALM_HEX) {
2062 if (hex_spelling(creature_ptr, HEX_BUILDING)) {
2067 if (creature_ptr->special_defense & KATA_KOUKIJIN) {
2071 if (creature_ptr->special_defense & KAMAE_BYAKKO) {
2073 } else if (creature_ptr->special_defense & KAMAE_GENBU) {
2075 } else if (creature_ptr->special_defense & KAMAE_SUZAKU) {
2079 if (creature_ptr->muta3 & MUT3_IRON_SKIN) {
2083 if (creature_ptr->muta3 & MUT3_LIMBER) {
2087 if (creature_ptr->muta3 & MUT3_ARTHRITIS) {
2096 * @param creature_ptr 計算するクリーチャーの参照ポインタ
2100 * * エントは別途レベル26,41,46到達ごとに加算(+1)
2101 * * 装備がTR_CONフラグを持っていれば加算(+pval*1)
2107 * * 変異MUT3_RESILIENTで加算(+4)
2108 * * 変異MUT3_ALBINOで減算(-4)
2109 * * 変異MUT3_XTRA_FATで加算(+2)
2110 * * 変異MUT3_FLESH_ROTで減算(-2)
2111 * * ネオ・つよしスペシャル中で加算(+4)
2113 static s16b calc_constitution_addition(player_type *creature_ptr)
2116 const player_race *tmp_rp_ptr;
2117 if (creature_ptr->mimic_form)
2118 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
2120 tmp_rp_ptr = &race_info[creature_ptr->prace];
2121 const player_class *c_ptr = &class_info[creature_ptr->pclass];
2122 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
2123 pow = tmp_rp_ptr->r_adj[A_CON] + c_ptr->c_adj[A_CON] + a_ptr->a_adj[A_CON];
2125 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_ENT) {
2126 if (creature_ptr->lev > 25)
2128 if (creature_ptr->lev > 40)
2130 if (creature_ptr->lev > 45)
2134 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2136 BIT_FLAGS flgs[TR_FLAG_SIZE];
2137 o_ptr = &creature_ptr->inventory_list[i];
2140 object_flags(creature_ptr, o_ptr, flgs);
2141 if (has_flag(flgs, TR_CON))
2145 if (creature_ptr->realm1 == REALM_HEX) {
2146 if (hex_spelling(creature_ptr, HEX_BUILDING)) {
2151 if (creature_ptr->special_defense & KATA_KOUKIJIN) {
2155 if (creature_ptr->special_defense & KAMAE_BYAKKO) {
2157 } else if (creature_ptr->special_defense & KAMAE_GENBU) {
2159 } else if (creature_ptr->special_defense & KAMAE_SUZAKU) {
2163 if (creature_ptr->muta3) {
2164 if (creature_ptr->muta3 & MUT3_RESILIENT) {
2168 if (creature_ptr->muta3 & MUT3_ALBINO) {
2172 if (creature_ptr->muta3 & MUT3_XTRA_FAT) {
2176 if (creature_ptr->muta3 & MUT3_FLESH_ROT) {
2181 if (creature_ptr->tsuyoshi) {
2190 * @param creature_ptr 計算するクリーチャーの参照ポインタ
2194 * * 装備がTR_CHRフラグを持っていれば加算(+pval*1)
2197 * * 変異MUT3_FLESH_ROTで減算(-1)
2198 * * 変異MUT3_SILLY_VOIで減算(-4)
2199 * * 変異MUT3_BLANK_FACで減算(-1)
2200 * * 変異MUT3_WART_SKINで減算(-2)
2201 * * 変異MUT3_SCALESで減算(-1)
2202 * * 変異MUT3_ILL_NORMで0固定(後で個体値のみ上書きを行う)
2204 static s16b calc_charisma_addition(player_type *creature_ptr)
2207 const player_race *tmp_rp_ptr;
2208 if (creature_ptr->mimic_form)
2209 tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
2211 tmp_rp_ptr = &race_info[creature_ptr->prace];
2212 const player_class *c_ptr = &class_info[creature_ptr->pclass];
2213 const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
2214 pow = tmp_rp_ptr->r_adj[A_CHR] + c_ptr->c_adj[A_CHR] + a_ptr->a_adj[A_CHR];
2216 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2218 BIT_FLAGS flgs[TR_FLAG_SIZE];
2219 o_ptr = &creature_ptr->inventory_list[i];
2222 object_flags(creature_ptr, o_ptr, flgs);
2223 if (has_flag(flgs, TR_CHR))
2227 if (creature_ptr->special_defense & KATA_KOUKIJIN) {
2231 if (creature_ptr->muta3) {
2232 if (creature_ptr->muta3 & MUT3_FLESH_ROT) {
2235 if (creature_ptr->muta3 & MUT3_SILLY_VOI) {
2238 if (creature_ptr->muta3 & MUT3_BLANK_FAC) {
2241 if (creature_ptr->muta3 & MUT3_WART_SKIN) {
2244 if (creature_ptr->muta3 & MUT3_SCALES) {
2247 if (creature_ptr->muta3 & MUT3_ILL_NORM) {
2257 * @param creature_ptr 計算するクリーチャーの参照ポインタ
2260 * * 性格なまけものなら加算(+10)
2262 * * 性格ちからじまんとがまんづよいなら加算(+1)
2263 * * 性格チャージマンなら加算(+5)
2264 * * 装備品にTRC_LOW_MAGICがあるなら加算(軽い呪いなら+3/重い呪いなら+10)
2266 static s16b calc_to_magic_chance(player_type *creature_ptr)
2270 if (creature_ptr->pseikaku == PERSONALITY_LAZY)
2272 if (creature_ptr->pseikaku == PERSONALITY_SHREWD)
2274 if ((creature_ptr->pseikaku == PERSONALITY_PATIENT) || (creature_ptr->pseikaku == PERSONALITY_MIGHTY))
2276 if (creature_ptr->pseikaku == PERSONALITY_CHARGEMAN)
2279 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2281 BIT_FLAGS flgs[TR_FLAG_SIZE];
2282 o_ptr = &creature_ptr->inventory_list[i];
2285 object_flags(creature_ptr, o_ptr, flgs);
2286 if (o_ptr->curse_flags & TRC_LOW_MAGIC) {
2287 if (o_ptr->curse_flags & TRC_HEAVY_CURSE) {
2297 static ARMOUR_CLASS calc_base_ac(player_type *creature_ptr)
2299 ARMOUR_CLASS ac = 0;
2300 if (creature_ptr->yoiyami)
2303 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2305 o_ptr = &creature_ptr->inventory_list[i];
2311 if (object_is_armour(creature_ptr, &creature_ptr->inventory_list[INVEN_RARM])
2312 || object_is_armour(creature_ptr, &creature_ptr->inventory_list[INVEN_LARM])) {
2313 ac += creature_ptr->skill_exp[GINOU_SHIELD] * (1 + creature_ptr->lev / 22) / 2000;
2319 static ARMOUR_CLASS calc_to_ac(player_type *creature_ptr, bool is_true_value)
2321 ARMOUR_CLASS ac = 0;
2322 if (creature_ptr->yoiyami)
2325 ac += ((int)(adj_dex_ta[creature_ptr->stat_ind[A_DEX]]) - 128);
2327 if (creature_ptr->mimic_form) {
2328 switch (creature_ptr->mimic_form) {
2332 case MIMIC_DEMON_LORD:
2340 if (creature_ptr->pclass == CLASS_BERSERKER) {
2341 ac += 10 + creature_ptr->lev / 2;
2343 if (creature_ptr->pclass == CLASS_SORCERER) {
2347 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2349 o_ptr = &creature_ptr->inventory_list[i];
2352 if (is_true_value || object_is_known(o_ptr))
2355 if (o_ptr->curse_flags & TRC_LOW_AC) {
2356 if (o_ptr->curse_flags & TRC_HEAVY_CURSE) {
2357 if (is_true_value || object_is_fully_known(o_ptr))
2360 if (is_true_value || object_is_fully_known(o_ptr))
2365 if ((i == INVEN_LARM) && (o_ptr->tval == TV_SWORD) && ((o_ptr->sval == SV_MAIN_GAUCHE) || (o_ptr->sval == SV_WAKIZASHI))) {
2370 if (is_specific_player_race(creature_ptr, RACE_GOLEM) || is_specific_player_race(creature_ptr, RACE_ANDROID)) {
2371 ac += 10 + (creature_ptr->lev * 2 / 5);
2374 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_QUICKTHORN) && (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_TINYTHORN)) {
2378 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI)) {
2382 if (creature_ptr->muta3 & MUT3_WART_SKIN) {
2386 if (creature_ptr->muta3 & MUT3_SCALES) {
2390 if (creature_ptr->muta3 & MUT3_IRON_SKIN) {
2394 if (((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER)) && !heavy_armor(creature_ptr)) {
2395 if (!(creature_ptr->inventory_list[INVEN_BODY].k_idx)) {
2396 ac += (creature_ptr->lev * 3) / 2;
2398 if (!(creature_ptr->inventory_list[INVEN_OUTER].k_idx) && (creature_ptr->lev > 15)) {
2399 ac += ((creature_ptr->lev - 13) / 3);
2401 if (!(creature_ptr->inventory_list[INVEN_LARM].k_idx) && (creature_ptr->lev > 10)) {
2402 ac += ((creature_ptr->lev - 8) / 3);
2404 if (!(creature_ptr->inventory_list[INVEN_HEAD].k_idx) && (creature_ptr->lev > 4)) {
2405 ac += (creature_ptr->lev - 2) / 3;
2407 if (!(creature_ptr->inventory_list[INVEN_HANDS].k_idx)) {
2408 ac += (creature_ptr->lev / 2);
2410 if (!(creature_ptr->inventory_list[INVEN_FEET].k_idx)) {
2411 ac += (creature_ptr->lev / 3);
2415 if (creature_ptr->realm1 == REALM_HEX) {
2416 if (hex_spelling(creature_ptr, HEX_ICE_ARMOR)) {
2420 for (inventory_slot_type i = INVEN_RARM; i <= INVEN_FEET; i++) {
2421 object_type *o_ptr = &creature_ptr->inventory_list[i];
2424 if (!object_is_armour(creature_ptr, o_ptr))
2426 if (!object_is_cursed(o_ptr))
2428 if (o_ptr->curse_flags & TRC_CURSED)
2430 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
2432 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
2437 if (creature_ptr->special_defense & KAMAE_BYAKKO) {
2439 } else if (creature_ptr->special_defense & KAMAE_SEIRYU) {
2441 } else if (creature_ptr->special_defense & KATA_KOUKIJIN) {
2445 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
2447 } else if (creature_ptr->tsubureru || creature_ptr->shield || creature_ptr->magicdef) {
2451 if (is_blessed(creature_ptr)) {
2455 if (is_shero(creature_ptr)) {
2459 if (creature_ptr->pclass == CLASS_NINJA) {
2460 if ((!creature_ptr->inventory_list[INVEN_RARM].k_idx || has_right_hand_weapon(creature_ptr))
2461 && (!creature_ptr->inventory_list[INVEN_LARM].k_idx || has_left_hand_weapon(creature_ptr))) {
2462 ac += creature_ptr->lev / 2 + 5;
2471 * @param creature_ptr 計算するクリーチャーの参照ポインタ
2476 * ** クラッコンと妖精に加算(+レベル/10)
2477 * ** 悪魔変化/吸血鬼変化で加算(+3)
2479 * ** 装備品にTR_SPEEDがあれば加算(+pval+1
2480 * ** 忍者の装備が重ければ減算(-レベル/10)
2481 * ** 忍者の装備が適正ならば加算(+3)さらにクラッコン、妖精、いかさま以外なら加算(+レベル/10)
2482 * ** 錬気術師で装備が重くなくクラッコン、妖精、いかさま以外なら加算(+レベル/10)
2483 * ** 狂戦士なら加算(+3),レベル20/30/40/50ごとに+1
2484 * ** いかさまでクラッコン/妖精以外なら加算(+5+レベル/10)
2487 * ** 呪術「衝撃のクローク」で加算(+3)
2490 * ** 変異MUT3_XTRA_FATなら減算(-2)
2491 * ** 変異MUT3_XTRA_LEGなら加算(+3)
2492 * ** 変異MUT3_SHORT_LEGなら減算(-3)
2493 * ** マーフォークがFF_WATER地形にいれば加算(+2+レベル/10)
2494 * ** そうでなく浮遊を持っていないなら減算(-2)
2495 * ** 棘セット装備中ならば加算(+7)
2496 * * 騎乗中ならばモンスターの加速に準拠、ただし騎乗技能値とモンスターレベルによるキャップ処理あり
2498 * * 光速移動中かこの時点で+99を超えていたら+99にキャップ
2501 static s16b calc_speed(player_type *creature_ptr)
2503 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
2504 feature_type *f_ptr = &f_info[floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat];
2508 int j = calc_inventory_weight(creature_ptr);
2511 if (!creature_ptr->riding) {
2512 if (is_specific_player_race(creature_ptr, RACE_KLACKON) || is_specific_player_race(creature_ptr, RACE_SPRITE))
2513 pow += (creature_ptr->lev) / 10;
2515 if (creature_ptr->mimic_form) {
2516 switch (creature_ptr->mimic_form) {
2520 case MIMIC_DEMON_LORD:
2529 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2530 object_type *o_ptr = &creature_ptr->inventory_list[i];
2531 BIT_FLAGS flgs[TR_FLAG_SIZE];
2532 object_flags(creature_ptr, o_ptr, flgs);
2536 if (has_flag(flgs, TR_SPEED))
2540 if (creature_ptr->pclass == CLASS_NINJA) {
2541 if (heavy_armor(creature_ptr)) {
2542 pow -= (creature_ptr->lev) / 10;
2543 } else if ((!creature_ptr->inventory_list[INVEN_RARM].k_idx || has_right_hand_weapon(creature_ptr))
2544 && (!creature_ptr->inventory_list[INVEN_LARM].k_idx || has_left_hand_weapon(creature_ptr))) {
2546 if (!(is_specific_player_race(creature_ptr, RACE_KLACKON) || is_specific_player_race(creature_ptr, RACE_SPRITE)
2547 || (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN)))
2548 pow += (creature_ptr->lev) / 10;
2552 if ((creature_ptr->pclass == CLASS_MONK || creature_ptr->pclass == CLASS_FORCETRAINER) && !(heavy_armor(creature_ptr))) {
2553 if (!(is_specific_player_race(creature_ptr, RACE_KLACKON) || is_specific_player_race(creature_ptr, RACE_SPRITE)
2554 || (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN)))
2555 pow += (creature_ptr->lev) / 10;
2558 if (creature_ptr->pclass == CLASS_BERSERKER) {
2560 if (creature_ptr->lev > 29)
2562 if (creature_ptr->lev > 39)
2564 if (creature_ptr->lev > 44)
2566 if (creature_ptr->lev > 49)
2570 if (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN && creature_ptr->prace != RACE_KLACKON && creature_ptr->prace != RACE_SPRITE) {
2571 pow += (creature_ptr->lev) / 10 + 5;
2574 if (is_fast(creature_ptr)) {
2578 if (creature_ptr->slow) {
2582 if (creature_ptr->realm1 == REALM_HEX) {
2583 if (hex_spelling(creature_ptr, HEX_SHOCK_CLOAK)) {
2588 if (creature_ptr->food >= PY_FOOD_MAX)
2591 if (creature_ptr->special_defense & KAMAE_SUZAKU)
2594 if (creature_ptr->muta3) {
2596 if (creature_ptr->muta3 & MUT3_XTRA_FAT) {
2600 if (creature_ptr->muta3 & MUT3_XTRA_LEGS) {
2604 if (creature_ptr->muta3 & MUT3_SHORT_LEG) {
2609 if (creature_ptr->prace == RACE_MERFOLK) {
2610 if (has_flag(f_ptr->flags, FF_WATER)) {
2611 pow += (2 + creature_ptr->lev / 10);
2612 } else if (!creature_ptr->levitation) {
2617 if (has_melee_weapon(creature_ptr, INVEN_RARM) && has_melee_weapon(creature_ptr, INVEN_LARM)) {
2618 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_QUICKTHORN) && (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_TINYTHORN)) {
2623 count = (int)calc_weight_limit(creature_ptr);
2625 pow -= ((j - count) / (count / 5));
2628 monster_type *riding_m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding];
2629 monster_race *riding_r_ptr = &r_info[riding_m_ptr->r_idx];
2630 SPEED speed = riding_m_ptr->mspeed;
2632 if (riding_m_ptr->mspeed > 110) {
2633 pow = 110 + (s16b)((speed - 110) * (creature_ptr->skill_exp[GINOU_RIDING] * 3 + creature_ptr->lev * 160L - 10000L) / (22000L));
2640 pow += (creature_ptr->skill_exp[GINOU_RIDING] + creature_ptr->lev * 160L) / 3200;
2642 if (monster_fast_remaining(riding_m_ptr))
2644 if (monster_slow_remaining(riding_m_ptr))
2647 if (creature_ptr->skill_exp[GINOU_RIDING] < RIDING_EXP_SKILLED)
2648 j += (creature_ptr->wt * 3 * (RIDING_EXP_SKILLED - creature_ptr->skill_exp[GINOU_RIDING])) / RIDING_EXP_SKILLED;
2650 count = 1500 + riding_r_ptr->level * 25;
2652 pow -= ((j - count) / (count / 5));
2655 if (creature_ptr->action == ACTION_SEARCH)
2658 /* Maximum speed is (+99). (internally it's 110 + 99) */
2659 /* Temporary lightspeed forces to be maximum speed */
2660 if ((creature_ptr->lightspeed && !creature_ptr->riding) || (pow > 209)) {
2664 /* Minimum speed is (-99). (internally it's 110 - 99) */
2672 * @brief 二刀流ペナルティ量計算
2673 * @param creature_ptr 計算するクリーチャーの参照ポインタ
2674 * @param slot ペナルティ量を計算する武器スロット
2680 * * マンゴーシュ/脇差を左に装備した場合の軽減
2684 s16b calc_double_weapon_penalty(player_type *creature_ptr, INVENTORY_IDX slot)
2687 if (has_melee_weapon(creature_ptr, INVEN_RARM) && has_melee_weapon(creature_ptr, INVEN_LARM)) {
2688 penalty = ((100 - creature_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - creature_ptr->inventory_list[slot].weight) / 8);
2689 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_QUICKTHORN) && (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_TINYTHORN)) {
2690 penalty = penalty / 2 - 5;
2692 if (creature_ptr->easy_2weapon) {
2695 } else if ((creature_ptr->inventory_list[INVEN_LARM].tval == TV_SWORD)
2696 && ((creature_ptr->inventory_list[INVEN_LARM].sval == SV_MAIN_GAUCHE) || (creature_ptr->inventory_list[INVEN_LARM].sval == SV_WAKIZASHI))) {
2697 penalty = MAX(0, penalty - 10);
2699 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI)) {
2700 penalty = MIN(0, penalty);
2702 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (penalty > 0))
2704 if ((creature_ptr->inventory_list[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI) && (penalty > 0))
2708 if (creature_ptr->inventory_list[slot].tval == TV_POLEARM)
2711 return (s16b)penalty;
2714 static void calc_ind_status(player_type *creature_ptr, int status)
2717 if (creature_ptr->stat_use[status] <= 18)
2718 ind = (creature_ptr->stat_use[status] - 3);
2719 else if (creature_ptr->stat_use[status] <= 18 + 219)
2720 ind = (15 + (creature_ptr->stat_use[status] - 18) / 10);
2724 if (creature_ptr->stat_ind[status] == ind)
2727 creature_ptr->stat_ind[status] = (s16b)ind;
2728 if (status == A_CON) {
2729 creature_ptr->update |= (PU_HP);
2730 } else if (status == A_INT) {
2731 if (mp_ptr->spell_stat == A_INT) {
2732 creature_ptr->update |= (PU_MANA | PU_SPELLS);
2734 } else if (status == A_WIS) {
2735 if (mp_ptr->spell_stat == A_WIS) {
2736 creature_ptr->update |= (PU_MANA | PU_SPELLS);
2738 } else if (status == A_CHR) {
2739 if (mp_ptr->spell_stat == A_CHR) {
2740 creature_ptr->update |= (PU_MANA | PU_SPELLS);
2744 creature_ptr->window |= (PW_PLAYER);
2747 static void calc_use_status(player_type *creature_ptr, int status)
2749 int use = modify_stat_value(creature_ptr->stat_cur[status], creature_ptr->stat_add[status]);
2751 if ((status == A_CHR) && (creature_ptr->muta3 & MUT3_ILL_NORM)) {
2752 /* 10 to 18/90 charisma, guaranteed, based on level */
2753 if (use < 8 + 2 * creature_ptr->lev) {
2754 use = 8 + 2 * creature_ptr->lev;
2758 if (creature_ptr->stat_use[status] != use) {
2759 creature_ptr->stat_use[status] = (s16b)use;
2760 creature_ptr->redraw |= (PR_STATS);
2761 creature_ptr->window |= (PW_PLAYER);
2765 static void calc_top_status(player_type *creature_ptr, int status)
2767 int top = modify_stat_value(creature_ptr->stat_max[status], creature_ptr->stat_add[status]);
2769 if (creature_ptr->stat_top[status] != top) {
2770 creature_ptr->stat_top[status] = (s16b)top;
2771 creature_ptr->redraw |= (PR_STATS);
2772 creature_ptr->window |= (PW_PLAYER);
2776 static s16b calc_riding_bow_penalty(player_type *creature_ptr)
2778 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
2779 if (!creature_ptr->riding)
2784 creature_ptr->riding_ryoute = FALSE;
2786 if (has_two_handed_weapons(creature_ptr) || (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_NONE))
2787 creature_ptr->riding_ryoute = TRUE;
2788 else if (creature_ptr->pet_extra_flags & PF_TWO_HANDS) {
2789 switch (creature_ptr->pclass) {
2791 case CLASS_FORCETRAINER:
2792 case CLASS_BERSERKER:
2793 if ((empty_hands(creature_ptr, FALSE) != EMPTY_HAND_NONE) && !has_melee_weapon(creature_ptr, INVEN_RARM)
2794 && !has_melee_weapon(creature_ptr, INVEN_LARM))
2795 creature_ptr->riding_ryoute = TRUE;
2800 if ((creature_ptr->pclass == CLASS_BEASTMASTER) || (creature_ptr->pclass == CLASS_CAVALRY)) {
2801 if (creature_ptr->tval_ammo != TV_ARROW)
2804 penalty = r_info[floor_ptr->m_list[creature_ptr->riding].r_idx].level - creature_ptr->skill_exp[GINOU_RIDING] / 80;
2810 if (creature_ptr->tval_ammo == TV_BOLT)
2816 void put_equipment_warning(player_type *creature_ptr)
2818 bool heavy_shoot = is_heavy_shoot(creature_ptr, &creature_ptr->inventory_list[INVEN_BOW]);
2819 if (creature_ptr->old_heavy_shoot != heavy_shoot) {
2821 msg_print(_("こんな重い弓を装備しているのは大変だ。", "You have trouble wielding such a heavy bow."));
2822 } else if (creature_ptr->inventory_list[INVEN_BOW].k_idx) {
2823 msg_print(_("この弓なら装備していても辛くない。", "You have no trouble wielding your bow."));
2825 msg_print(_("重い弓を装備からはずして体が楽になった。", "You feel relieved to put down your heavy bow."));
2827 creature_ptr->old_heavy_shoot = heavy_shoot;
2830 for (int i = 0; i < 2; i++) {
2831 if (creature_ptr->old_heavy_wield[i] != creature_ptr->heavy_wield[i]) {
2832 if (creature_ptr->heavy_wield[i]) {
2833 msg_print(_("こんな重い武器を装備しているのは大変だ。", "You have trouble wielding such a heavy weapon."));
2834 } else if (has_melee_weapon(creature_ptr, INVEN_RARM + i)) {
2835 msg_print(_("これなら装備していても辛くない。", "You have no trouble wielding your weapon."));
2836 } else if (creature_ptr->heavy_wield[1 - i]) {
2837 msg_print(_("まだ武器が重い。", "You have still trouble wielding a heavy weapon."));
2839 msg_print(_("重い武器を装備からはずして体が楽になった。", "You feel relieved to put down your heavy weapon."));
2842 creature_ptr->old_heavy_wield[i] = creature_ptr->heavy_wield[i];
2845 if (creature_ptr->old_riding_wield[i] != creature_ptr->riding_wield[i]) {
2846 if (creature_ptr->riding_wield[i]) {
2847 msg_print(_("この武器は乗馬中に使うにはむかないようだ。", "This weapon is not suitable for use while riding."));
2848 } else if (!creature_ptr->riding) {
2849 msg_print(_("この武器は徒歩で使いやすい。", "This weapon is suitable for use on foot."));
2850 } else if (has_melee_weapon(creature_ptr, INVEN_RARM + i)) {
2851 msg_print(_("これなら乗馬中にぴったりだ。", "This weapon is suitable for use while riding."));
2854 creature_ptr->old_riding_wield[i] = creature_ptr->riding_wield[i];
2857 if (creature_ptr->old_icky_wield[i] == creature_ptr->icky_wield[i])
2860 if (creature_ptr->icky_wield[i]) {
2861 msg_print(_("今の装備はどうも自分にふさわしくない気がする。", "You do not feel comfortable with your weapon."));
2862 if (current_world_ptr->is_loading_now) {
2863 chg_virtue(creature_ptr, V_FAITH, -1);
2865 } else if (has_melee_weapon(creature_ptr, INVEN_RARM + i)) {
2866 msg_print(_("今の装備は自分にふさわしい気がする。", "You feel comfortable with your weapon."));
2868 msg_print(_("装備をはずしたら随分と気が楽になった。", "You feel more comfortable after removing your weapon."));
2871 creature_ptr->old_icky_wield[i] = creature_ptr->icky_wield[i];
2874 if (creature_ptr->riding && (creature_ptr->old_riding_ryoute != creature_ptr->riding_ryoute)) {
2875 if (creature_ptr->riding_ryoute) {
2877 msg_format("%s馬を操れない。", (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_NONE) ? "両手がふさがっていて" : "");
2879 msg_print("You are using both hand for fighting, and you can't control the pet you're riding.");
2883 msg_format("%s馬を操れるようになった。", (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_NONE) ? "手が空いて" : "");
2885 msg_print("You began to control the pet you're riding with one hand.");
2889 creature_ptr->old_riding_ryoute = creature_ptr->riding_ryoute;
2892 if (((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER) || (creature_ptr->pclass == CLASS_NINJA))
2893 && (heavy_armor(creature_ptr) != creature_ptr->monk_notify_aux)) {
2894 if (heavy_armor(creature_ptr)) {
2895 msg_print(_("装備が重くてバランスを取れない。", "The weight of your armor disrupts your balance."));
2896 if (current_world_ptr->is_loading_now) {
2897 chg_virtue(creature_ptr, V_HARMONY, -1);
2900 msg_print(_("バランスがとれるようになった。", "You regain your balance."));
2903 creature_ptr->monk_notify_aux = heavy_armor(creature_ptr);
2907 static s16b calc_to_damage(player_type *creature_ptr, INVENTORY_IDX slot, bool is_true_value)
2909 object_type *o_ptr = &creature_ptr->inventory_list[slot];
2910 BIT_FLAGS flgs[TR_FLAG_SIZE];
2911 object_flags(creature_ptr, o_ptr, flgs);
2913 player_hand calc_hand = PLAYER_HAND_OTHER;
2914 if (slot == INVEN_RARM)
2915 calc_hand = PLAYER_HAND_RIGHT;
2916 if (slot == INVEN_LARM)
2917 calc_hand = PLAYER_HAND_LEFT;
2922 damage += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
2924 if (is_shero(creature_ptr)) {
2925 damage += 3 + (creature_ptr->lev / 5);
2928 if (creature_ptr->stun > 50) {
2930 } else if (creature_ptr->stun) {
2934 if ((creature_ptr->pclass == CLASS_PRIEST) && (!(has_flag(flgs, TR_BLESSED))) && ((o_ptr->tval == TV_SWORD) || (o_ptr->tval == TV_POLEARM))) {
2936 } else if (creature_ptr->pclass == CLASS_BERSERKER) {
2937 damage += creature_ptr->lev / 6;
2938 if (((calc_hand == PLAYER_HAND_RIGHT) && !has_left_hand_weapon(creature_ptr)) || has_two_handed_weapons(creature_ptr)) {
2939 damage += creature_ptr->lev / 6;
2941 } else if (creature_ptr->pclass == CLASS_SORCERER) {
2942 if (!((o_ptr->tval == TV_HAFTED) && ((o_ptr->sval == SV_WIZSTAFF) || (o_ptr->sval == SV_NAMAKE_HAMMER)))) {
2949 if ((creature_ptr->realm1 == REALM_HEX) && object_is_cursed(o_ptr)) {
2950 if (hex_spelling(creature_ptr, HEX_RUNESWORD)) {
2951 if (o_ptr->curse_flags & (TRC_CURSED)) {
2954 if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) {
2957 if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) {
2963 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2965 o_ptr = &creature_ptr->inventory_list[i];
2966 if (!o_ptr->k_idx || o_ptr->tval == TV_CAPTURE || (i == INVEN_RARM && has_melee_weapon(creature_ptr, i))
2967 || (i == INVEN_LARM && has_melee_weapon(creature_ptr, i)) || i == INVEN_BOW)
2970 if (!object_is_known(o_ptr) && !is_true_value)
2972 bonus_to_d = o_ptr->to_d;
2974 if (creature_ptr->pclass == CLASS_NINJA) {
2975 if (o_ptr->to_d > 0)
2976 bonus_to_d = (o_ptr->to_d + 1) / 2;
2979 switch (player_melee_type(creature_ptr)) {
2980 case MELEE_TYPE_BAREHAND_TWO: /* fall through */
2981 case MELEE_TYPE_WEAPON_TWOHAND:
2982 if (calc_hand == get_default_hand(creature_ptr))
2983 damage += (s16b)bonus_to_d;
2986 case MELEE_TYPE_BAREHAND_RIGHT: /* fall through */
2987 case MELEE_TYPE_WEAPON_RIGHT:
2988 if ((calc_hand == PLAYER_HAND_RIGHT) && (i != INVEN_LEFT))
2989 damage += (s16b)bonus_to_d;
2992 case MELEE_TYPE_BAREHAND_LEFT: /* fall through */
2993 case MELEE_TYPE_WEAPON_LEFT:
2994 if ((calc_hand == PLAYER_HAND_LEFT) && (i != INVEN_RIGHT))
2995 damage += (s16b)bonus_to_d;
2998 case MELEE_TYPE_WEAPON_DOUBLE:
2999 if ((calc_hand == PLAYER_HAND_RIGHT)) {
3000 if (i == INVEN_RIGHT) {
3001 damage += (s16b)bonus_to_d;
3003 else if (i != INVEN_LEFT) {
3004 damage += (bonus_to_d > 0) ? (bonus_to_d + 1) / 2 : bonus_to_d;
3007 if ((calc_hand == PLAYER_HAND_LEFT)) {
3008 if (i == INVEN_LEFT) {
3009 damage += (s16b)bonus_to_d;
3010 } else if (i != INVEN_RIGHT) {
3011 damage += (bonus_to_d > 0) ? bonus_to_d / 2 : bonus_to_d;
3016 case MELEE_TYPE_SHIELD_DOUBLE:
3024 if (get_default_hand(creature_ptr) == calc_hand) {
3025 if ((is_martial_arts_mode(creature_ptr) && empty_hands(creature_ptr, FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM))
3026 || !has_disable_two_handed_bonus(creature_ptr, 0)) {
3028 bonus_to_d = ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128) / 2;
3029 damage += MAX(bonus_to_d, 1);
3033 if (is_martial_arts_mode(creature_ptr) && (!heavy_armor(creature_ptr) || creature_ptr->pclass != CLASS_BERSERKER)) {
3034 damage += (creature_ptr->lev / 6);
3041 * @brief 武器の命中修正を計算する。 / Calculate hit bonus from a wielded weapon.
3043 * 'slot' MUST be INVEN_RARM or INVEM_LARM.
3045 static s16b calc_to_hit(player_type *creature_ptr, INVENTORY_IDX slot, bool is_true_value)
3050 hit += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
3051 hit += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
3053 /* Temporary bonuses */
3054 if (is_blessed(creature_ptr)) {
3058 if (is_hero(creature_ptr)) {
3062 if (is_shero(creature_ptr)) {
3066 if (creature_ptr->stun > 50) {
3068 } else if (creature_ptr->stun) {
3072 player_hand calc_hand = PLAYER_HAND_OTHER;
3073 if (slot == INVEN_RARM)
3074 calc_hand = PLAYER_HAND_RIGHT;
3075 if (slot == INVEN_LARM)
3076 calc_hand = PLAYER_HAND_LEFT;
3078 /* Default hand bonuses */
3079 if (get_default_hand(creature_ptr) == calc_hand) {
3080 /* Add trained bonus of empty hands' combat when having no weapon and riding */
3081 if ((!has_right_hand_weapon(creature_ptr) && (empty_hands(creature_ptr, TRUE) & EMPTY_HAND_LARM))
3082 || (!has_left_hand_weapon(creature_ptr) && (empty_hands(creature_ptr, TRUE) & EMPTY_HAND_RARM))) {
3083 hit += (creature_ptr->skill_exp[GINOU_SUDE] - WEAPON_EXP_BEGINNER) / 200;
3086 if ((is_martial_arts_mode(creature_ptr) && empty_hands(creature_ptr, FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM))
3087 || !has_disable_two_handed_bonus(creature_ptr, 0)) {
3089 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);
3090 hit += MAX(bonus_to_h, 1);
3094 /* Bonuses and penalties by weapon */
3095 if (has_melee_weapon(creature_ptr, slot)) {
3096 object_type *o_ptr = &creature_ptr->inventory_list[slot];
3097 BIT_FLAGS flgs[TR_FLAG_SIZE];
3098 object_flags(creature_ptr, o_ptr, flgs);
3100 tval_type tval = o_ptr->tval - TV_WEAPON_BEGIN;
3101 OBJECT_SUBTYPE_VALUE sval = o_ptr->sval;
3103 /* Traind bonuses */
3104 hit += (creature_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200;
3106 /* Weight penalty */
3107 if (calc_weapon_weight_limit(creature_ptr) < o_ptr->weight / 10) {
3108 hit += 2 * (calc_weapon_weight_limit(creature_ptr) - o_ptr->weight / 10);
3111 /* Low melee penalty */
3112 if ((object_is_fully_known(o_ptr) || is_true_value) && o_ptr->curse_flags & TRC_LOW_MELEE) {
3113 if (o_ptr->curse_flags & TRC_HEAVY_CURSE) {
3120 /* Riding bonus and penalty */
3121 if (creature_ptr->riding) {
3122 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE))) {
3127 if (creature_ptr->riding != 0 && !(o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE))
3128 && !has_flag(flgs, TR_RIDING)) {
3131 if ((creature_ptr->pclass == CLASS_BEASTMASTER) || (creature_ptr->pclass == CLASS_CAVALRY)) {
3134 penalty = r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].level - creature_ptr->skill_exp[GINOU_RIDING] / 80;
3139 hit -= (s16b)penalty;
3142 /* Class penalties */
3143 if ((creature_ptr->pclass == CLASS_PRIEST) && (!(has_flag(flgs, TR_BLESSED))) && ((o_ptr->tval == TV_SWORD) || (o_ptr->tval == TV_POLEARM))) {
3145 } else if (creature_ptr->pclass == CLASS_BERSERKER) {
3146 hit += creature_ptr->lev / 5;
3147 if (((calc_hand == PLAYER_HAND_RIGHT) && !has_left_hand_weapon(creature_ptr)) || has_two_handed_weapons(creature_ptr)) {
3148 hit += creature_ptr->lev / 5;
3150 } else if (creature_ptr->pclass == CLASS_SORCERER) {
3151 if (!((o_ptr->tval == TV_HAFTED) && ((o_ptr->sval == SV_WIZSTAFF) || (o_ptr->sval == SV_NAMAKE_HAMMER)))) {
3158 if (has_not_ninja_weapon(creature_ptr, (int)calc_hand) || has_not_monk_weapon(creature_ptr, (int)calc_hand)) {
3162 /* Hex realm bonuses */
3163 if ((creature_ptr->realm1 == REALM_HEX) && object_is_cursed(o_ptr)) {
3164 if (o_ptr->curse_flags & (TRC_CURSED)) {
3167 if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) {
3170 if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) {
3173 if (o_ptr->curse_flags & (TRC_TY_CURSE)) {
3179 /* Bonuses from inventory */
3180 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
3181 object_type *o_ptr = &creature_ptr->inventory_list[i];
3183 /* Ignore empty hands, handed weapons, bows and capture balls */
3185 || o_ptr->tval == TV_CAPTURE
3186 || (i == INVEN_RARM && has_melee_weapon(creature_ptr, i))
3187 || (i == INVEN_LARM && has_melee_weapon(creature_ptr, i))
3191 /* Fake value does not include unknown objects' value */
3192 if (is_true_value || !object_is_known(o_ptr))
3195 int bonus_to_h = o_ptr->to_h;
3197 /* When wields only a weapon */
3198 if (creature_ptr->pclass == CLASS_NINJA) {
3199 if (o_ptr->to_h > 0)
3200 bonus_to_h = (o_ptr->to_h + 1) / 2;
3203 switch (player_melee_type(creature_ptr)) {
3204 case MELEE_TYPE_BAREHAND_TWO: /* fall through */
3205 case MELEE_TYPE_WEAPON_TWOHAND:
3206 if (calc_hand == get_default_hand(creature_ptr))
3207 hit += (s16b)bonus_to_h;
3210 case MELEE_TYPE_BAREHAND_RIGHT: /* fall through */
3211 case MELEE_TYPE_WEAPON_RIGHT:
3212 if ((calc_hand == PLAYER_HAND_RIGHT) && (i != INVEN_LEFT))
3213 hit += (s16b)bonus_to_h;
3216 case MELEE_TYPE_BAREHAND_LEFT: /* fall through */
3217 case MELEE_TYPE_WEAPON_LEFT:
3218 if ((calc_hand == PLAYER_HAND_LEFT) && (i != INVEN_RIGHT))
3219 hit += (s16b)bonus_to_h;
3222 case MELEE_TYPE_WEAPON_DOUBLE:
3223 if ((calc_hand == PLAYER_HAND_RIGHT)) {
3224 if (i == INVEN_RIGHT) {
3225 hit += (s16b)bonus_to_h;
3226 } else if (i != INVEN_LEFT) {
3227 hit += (bonus_to_h > 0) ? (bonus_to_h + 1) / 2 : bonus_to_h;
3230 if ((calc_hand == PLAYER_HAND_LEFT)) {
3231 if (i == INVEN_LEFT) {
3232 hit += (s16b)bonus_to_h;
3233 } else if (i != INVEN_RIGHT) {
3234 hit += (bonus_to_h > 0) ? bonus_to_h / 2 : bonus_to_h;
3239 case MELEE_TYPE_SHIELD_DOUBLE:
3247 /* Martial arts bonus */
3248 if (is_martial_arts_mode(creature_ptr) && (!heavy_armor(creature_ptr) || creature_ptr->pclass != CLASS_BERSERKER)) {
3249 hit += (creature_ptr->lev / 3);
3252 if ((empty_hands(creature_ptr, FALSE) & EMPTY_HAND_RARM) && calc_hand == PLAYER_HAND_RIGHT) {
3253 hit += (p_ptr->skill_exp[GINOU_SUDE] - WEAPON_EXP_BEGINNER) / 200;
3256 if ((empty_hands(creature_ptr, FALSE) & EMPTY_HAND_LARM) && calc_hand == PLAYER_HAND_LEFT) {
3257 hit += (p_ptr->skill_exp[GINOU_SUDE] - WEAPON_EXP_BEGINNER) / 200;
3260 /* Two handed combat penalty */
3261 hit -= calc_double_weapon_penalty(creature_ptr, slot);
3266 static s16b calc_to_hit_bow(player_type *creature_ptr, bool is_true_value)
3270 pow += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
3271 pow += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
3275 BIT_FLAGS flgs[TR_FLAG_SIZE];
3276 o_ptr = &creature_ptr->inventory_list[INVEN_BOW];
3278 object_flags(creature_ptr, o_ptr, flgs);
3280 if (o_ptr->curse_flags & TRC_LOW_MELEE) {
3281 if (o_ptr->curse_flags & TRC_HEAVY_CURSE) {
3290 if (creature_ptr->stun > 50) {
3292 } else if (creature_ptr->stun) {
3296 if (is_blessed(creature_ptr)) {
3300 if (is_hero(creature_ptr)) {
3304 if (is_shero(creature_ptr)) {
3308 object_type *o_ptr = &creature_ptr->inventory_list[INVEN_BOW];
3310 if (is_heavy_shoot(creature_ptr, o_ptr)) {
3311 pow += 2 * (calc_weapon_weight_limit(creature_ptr) - o_ptr->weight / 10);
3315 if (o_ptr->k_idx && !is_heavy_shoot(creature_ptr, &creature_ptr->inventory_list[INVEN_BOW])) {
3316 if ((creature_ptr->pclass == CLASS_SNIPER) && (creature_ptr->tval_ammo == TV_BOLT)) {
3317 pow += (10 + (creature_ptr->lev / 5));
3323 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
3325 o_ptr = &creature_ptr->inventory_list[i];
3326 if (!o_ptr->k_idx || o_ptr->tval == TV_CAPTURE || (i == INVEN_RARM && has_melee_weapon(creature_ptr, i))
3327 || (i == INVEN_LARM && has_melee_weapon(creature_ptr, i)) || i == INVEN_BOW)
3330 bonus_to_h = o_ptr->to_h;
3332 if (creature_ptr->pclass == CLASS_NINJA) {
3333 if (o_ptr->to_h > 0)
3334 bonus_to_h = (o_ptr->to_h + 1) / 2;
3337 if (is_true_value || object_is_known(o_ptr))
3338 pow += (s16b)bonus_to_h;
3341 pow -= calc_riding_bow_penalty(creature_ptr);
3346 static s16b calc_to_damage_misc(player_type *creature_ptr)
3349 BIT_FLAGS flgs[TR_FLAG_SIZE];
3353 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
3354 o_ptr = &creature_ptr->inventory_list[i];
3358 object_flags(creature_ptr, o_ptr, flgs);
3360 int bonus_to_d = o_ptr->to_d;
3361 if (creature_ptr->pclass == CLASS_NINJA) {
3362 if (o_ptr->to_d > 0)
3363 bonus_to_d = (o_ptr->to_d + 1) / 2;
3365 to_dam += (s16b)bonus_to_d;
3368 if (is_shero(creature_ptr)) {
3369 to_dam += 3 + (creature_ptr->lev / 5);
3372 if (creature_ptr->stun > 50) {
3374 } else if (creature_ptr->stun) {
3378 to_dam += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
3382 static s16b calc_to_hit_misc(player_type *creature_ptr)
3385 BIT_FLAGS flgs[TR_FLAG_SIZE];
3389 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
3390 o_ptr = &creature_ptr->inventory_list[i];
3394 object_flags(creature_ptr, o_ptr, flgs);
3396 int bonus_to_h = o_ptr->to_h;
3397 if (creature_ptr->pclass == CLASS_NINJA) {
3398 if (o_ptr->to_h > 0)
3399 bonus_to_h = (o_ptr->to_h + 1) / 2;
3401 to_hit += (s16b)bonus_to_h;
3404 if (is_blessed(creature_ptr)) {
3408 if (is_hero(creature_ptr)) {
3412 if (is_shero(creature_ptr)) {
3416 if (creature_ptr->stun > 50) {
3418 } else if (creature_ptr->stun) {
3422 to_hit += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
3423 to_hit += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
3428 static DICE_NUMBER calc_to_weapon_dice_num(player_type *creature_ptr, INVENTORY_IDX slot)
3430 object_type *o_ptr = &creature_ptr->inventory_list[slot];
3433 if (creature_ptr->riding) {
3435 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE))) {
3443 static DICE_NUMBER calc_to_weapon_dice_side(player_type *creature_ptr, INVENTORY_IDX slot)
3445 (void)creature_ptr; // unused
3446 (void)slot; // unused
3451 * @brief プレイヤーの所持重量制限を計算する /
3452 * Computes current weight limit.
3455 WEIGHT calc_weight_limit(player_type *creature_ptr)
3457 WEIGHT i = (WEIGHT)adj_str_wgt[creature_ptr->stat_ind[A_STR]] * 50;
3458 if (creature_ptr->pclass == CLASS_BERSERKER)
3464 * @brief プレイヤーが現在右手/左手に武器を持っているか判定する /
3465 * @param i 判定する手のID(右手:INVEN_RARM 左手:INVEN_LARM)
3466 * @return 持っているならばTRUE
3468 bool has_melee_weapon(player_type *creature_ptr, int slot)
3470 return ((creature_ptr->inventory_list[slot].k_idx) && object_is_melee_weapon(&creature_ptr->inventory_list[slot]));
3474 * @brief プレイヤーの現在開いている手の状態を返す
3475 * @param riding_control 乗馬中により片手を必要としている状態ならばTRUEを返す。
3476 * @return 開いている手のビットフラグ
3478 BIT_FLAGS16 empty_hands(player_type *creature_ptr, bool riding_control)
3480 BIT_FLAGS16 status = EMPTY_HAND_NONE;
3481 if (!creature_ptr->inventory_list[INVEN_RARM].k_idx)
3482 status |= EMPTY_HAND_RARM;
3483 if (!creature_ptr->inventory_list[INVEN_LARM].k_idx)
3484 status |= EMPTY_HAND_LARM;
3486 if (riding_control && (status != EMPTY_HAND_NONE) && creature_ptr->riding && !(creature_ptr->pet_extra_flags & PF_TWO_HANDS)) {
3487 if (status & EMPTY_HAND_LARM)
3488 status &= ~(EMPTY_HAND_LARM);
3489 else if (status & EMPTY_HAND_RARM)
3490 status &= ~(EMPTY_HAND_RARM);
3497 * @brief プレイヤーが防具重量制限のある職業時にペナルティを受ける状態にあるかどうかを返す。
3498 * @return ペナルティが適用されるならばTRUE。
3500 bool heavy_armor(player_type *creature_ptr)
3502 if ((creature_ptr->pclass != CLASS_MONK) && (creature_ptr->pclass != CLASS_FORCETRAINER) && (creature_ptr->pclass != CLASS_NINJA))
3505 WEIGHT monk_arm_wgt = 0;
3506 if (creature_ptr->inventory_list[INVEN_RARM].tval > TV_SWORD)
3507 monk_arm_wgt += creature_ptr->inventory_list[INVEN_RARM].weight;
3508 if (creature_ptr->inventory_list[INVEN_LARM].tval > TV_SWORD)
3509 monk_arm_wgt += creature_ptr->inventory_list[INVEN_LARM].weight;
3510 monk_arm_wgt += creature_ptr->inventory_list[INVEN_BODY].weight;
3511 monk_arm_wgt += creature_ptr->inventory_list[INVEN_HEAD].weight;
3512 monk_arm_wgt += creature_ptr->inventory_list[INVEN_OUTER].weight;
3513 monk_arm_wgt += creature_ptr->inventory_list[INVEN_HANDS].weight;
3514 monk_arm_wgt += creature_ptr->inventory_list[INVEN_FEET].weight;
3516 return (monk_arm_wgt > (100 + (creature_ptr->lev * 4)));
3520 * @brief update のフラグに応じた更新をまとめて行う / Handle "update"
3522 * @details 更新処理の対象はプレイヤーの能力修正/光源寿命/HP/MP/魔法の学習状態、他多数の外界の状態判定。
3524 void update_creature(player_type *creature_ptr)
3526 if (!creature_ptr->update)
3529 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
3530 if (creature_ptr->update & (PU_AUTODESTROY)) {
3531 creature_ptr->update &= ~(PU_AUTODESTROY);
3532 autopick_delayed_alter(creature_ptr);
3535 if (creature_ptr->update & (PU_COMBINE)) {
3536 creature_ptr->update &= ~(PU_COMBINE);
3537 combine_pack(creature_ptr);
3540 if (creature_ptr->update & (PU_REORDER)) {
3541 creature_ptr->update &= ~(PU_REORDER);
3542 reorder_pack(creature_ptr);
3545 if (creature_ptr->update & (PU_BONUS)) {
3546 creature_ptr->update &= ~(PU_BONUS);
3547 calc_alignment(creature_ptr);
3548 calc_bonuses(creature_ptr);
3551 if (creature_ptr->update & (PU_TORCH)) {
3552 creature_ptr->update &= ~(PU_TORCH);
3553 calc_lite_radius(creature_ptr);
3556 if (creature_ptr->update & (PU_HP)) {
3557 creature_ptr->update &= ~(PU_HP);
3558 calc_hitpoints(creature_ptr);
3561 if (creature_ptr->update & (PU_MANA)) {
3562 creature_ptr->update &= ~(PU_MANA);
3563 calc_mana(creature_ptr);
3566 if (creature_ptr->update & (PU_SPELLS)) {
3567 creature_ptr->update &= ~(PU_SPELLS);
3568 calc_spells(creature_ptr);
3571 if (!current_world_ptr->character_generated)
3573 if (current_world_ptr->character_icky)
3575 if (creature_ptr->update & (PU_UN_LITE)) {
3576 creature_ptr->update &= ~(PU_UN_LITE);
3577 forget_lite(floor_ptr);
3580 if (creature_ptr->update & (PU_UN_VIEW)) {
3581 creature_ptr->update &= ~(PU_UN_VIEW);
3582 forget_view(floor_ptr);
3585 if (creature_ptr->update & (PU_VIEW)) {
3586 creature_ptr->update &= ~(PU_VIEW);
3587 update_view(creature_ptr);
3590 if (creature_ptr->update & (PU_LITE)) {
3591 creature_ptr->update &= ~(PU_LITE);
3592 update_lite(creature_ptr);
3595 if (creature_ptr->update & (PU_FLOW)) {
3596 creature_ptr->update &= ~(PU_FLOW);
3597 update_flow(creature_ptr);
3600 if (creature_ptr->update & (PU_DISTANCE)) {
3601 creature_ptr->update &= ~(PU_DISTANCE);
3603 update_monsters(creature_ptr, TRUE);
3606 if (creature_ptr->update & (PU_MON_LITE)) {
3607 creature_ptr->update &= ~(PU_MON_LITE);
3608 update_mon_lite(creature_ptr);
3611 if (creature_ptr->update & (PU_DELAY_VIS)) {
3612 creature_ptr->update &= ~(PU_DELAY_VIS);
3613 delayed_visual_update(creature_ptr);
3616 if (creature_ptr->update & (PU_MONSTERS)) {
3617 creature_ptr->update &= ~(PU_MONSTERS);
3618 update_monsters(creature_ptr, FALSE);
3623 * @brief プレイヤーが魔道書を一冊も持っていないかを判定する
3624 * @return 魔道書を一冊も持っていないならTRUEを返す
3626 bool player_has_no_spellbooks(player_type *creature_ptr)
3629 for (int i = 0; i < INVEN_PACK; i++) {
3630 o_ptr = &creature_ptr->inventory_list[i];
3631 if (o_ptr->k_idx && check_book_realm(creature_ptr, o_ptr->tval, o_ptr->sval))
3635 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
3636 for (int i = floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].o_idx; i; i = o_ptr->next_o_idx) {
3637 o_ptr = &floor_ptr->o_list[i];
3638 if (o_ptr->k_idx && (o_ptr->marked & OM_FOUND) && check_book_realm(creature_ptr, o_ptr->tval, o_ptr->sval))
3645 void take_turn(player_type *creature_ptr, PERCENTAGE need_cost) { creature_ptr->energy_use = (ENERGY)need_cost; }
3647 void free_turn(player_type *creature_ptr) { creature_ptr->energy_use = 0; }
3650 * @brief プレイヤーを指定座標に配置する / Place the player in the dungeon XXX XXX
3653 * @return 配置に成功したらTRUE
3655 bool player_place(player_type *creature_ptr, POSITION y, POSITION x)
3657 if (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx != 0)
3660 /* Save player location */
3661 creature_ptr->y = y;
3662 creature_ptr->x = x;
3667 * @brief 種族アンバライトが出血時パターンの上に乗った際のペナルティ処理
3670 void wreck_the_pattern(player_type *creature_ptr)
3672 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
3673 int pattern_type = f_info[floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat].subtype;
3674 if (pattern_type == PATTERN_TILE_WRECKED)
3677 msg_print(_("パターンを血で汚してしまった!", "You bleed on the Pattern!"));
3678 msg_print(_("何か恐ろしい事が起こった!", "Something terrible happens!"));
3680 if (!is_invuln(creature_ptr))
3681 take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(10, 8), _("パターン損壊", "corrupting the Pattern"), -1);
3683 int to_ruin = randint1(45) + 35;
3686 scatter(creature_ptr, &r_y, &r_x, creature_ptr->y, creature_ptr->x, 4, PROJECT_NONE);
3688 if (pattern_tile(floor_ptr, r_y, r_x) && (f_info[floor_ptr->grid_array[r_y][r_x].feat].subtype != PATTERN_TILE_WRECKED)) {
3689 cave_set_feat(creature_ptr, r_y, r_x, feat_pattern_corrupted);
3693 cave_set_feat(creature_ptr, creature_ptr->y, creature_ptr->x, feat_pattern_corrupted);
3697 * @brief プレイヤーの経験値について整合性のためのチェックと調整を行う /
3698 * Advance experience levels and print experience
3701 void check_experience(player_type *creature_ptr)
3703 if (creature_ptr->exp < 0)
3704 creature_ptr->exp = 0;
3705 if (creature_ptr->max_exp < 0)
3706 creature_ptr->max_exp = 0;
3707 if (creature_ptr->max_max_exp < 0)
3708 creature_ptr->max_max_exp = 0;
3710 if (creature_ptr->exp > PY_MAX_EXP)
3711 creature_ptr->exp = PY_MAX_EXP;
3712 if (creature_ptr->max_exp > PY_MAX_EXP)
3713 creature_ptr->max_exp = PY_MAX_EXP;
3714 if (creature_ptr->max_max_exp > PY_MAX_EXP)
3715 creature_ptr->max_max_exp = PY_MAX_EXP;
3717 if (creature_ptr->exp > creature_ptr->max_exp)
3718 creature_ptr->max_exp = creature_ptr->exp;
3719 if (creature_ptr->max_exp > creature_ptr->max_max_exp)
3720 creature_ptr->max_max_exp = creature_ptr->max_exp;
3722 creature_ptr->redraw |= (PR_EXP);
3723 handle_stuff(creature_ptr);
3725 bool android = (creature_ptr->prace == RACE_ANDROID ? TRUE : FALSE);
3726 PLAYER_LEVEL old_lev = creature_ptr->lev;
3727 while ((creature_ptr->lev > 1) && (creature_ptr->exp < ((android ? player_exp_a : player_exp)[creature_ptr->lev - 2] * creature_ptr->expfact / 100L))) {
3728 creature_ptr->lev--;
3729 creature_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
3730 creature_ptr->redraw |= (PR_LEV | PR_TITLE);
3731 creature_ptr->window |= (PW_PLAYER);
3732 handle_stuff(creature_ptr);
3735 bool level_reward = FALSE;
3736 bool level_mutation = FALSE;
3737 bool level_inc_stat = FALSE;
3738 while ((creature_ptr->lev < PY_MAX_LEVEL)
3739 && (creature_ptr->exp >= ((android ? player_exp_a : player_exp)[creature_ptr->lev - 1] * creature_ptr->expfact / 100L))) {
3740 creature_ptr->lev++;
3741 if (creature_ptr->lev > creature_ptr->max_plv) {
3742 creature_ptr->max_plv = creature_ptr->lev;
3744 if ((creature_ptr->pclass == CLASS_CHAOS_WARRIOR) || (creature_ptr->muta2 & MUT2_CHAOS_GIFT)) {
3745 level_reward = TRUE;
3747 if (creature_ptr->prace == RACE_BEASTMAN) {
3749 level_mutation = TRUE;
3751 level_inc_stat = TRUE;
3753 exe_write_diary(creature_ptr, DIARY_LEVELUP, creature_ptr->lev, NULL);
3757 msg_format(_("レベル %d にようこそ。", "Welcome to level %d."), creature_ptr->lev);
3758 creature_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
3759 creature_ptr->redraw |= (PR_LEV | PR_TITLE | PR_EXP);
3760 creature_ptr->window |= (PW_PLAYER | PW_SPELL | PW_INVEN);
3761 creature_ptr->level_up_message = TRUE;
3762 handle_stuff(creature_ptr);
3764 creature_ptr->level_up_message = FALSE;
3765 if (level_inc_stat) {
3766 if (!(creature_ptr->max_plv % 10)) {
3773 cnv_stat(creature_ptr->stat_max[0], tmp);
3774 prt(format(_(" a) 腕力 (現在値 %s)", " a) Str (cur %s)"), tmp), 2, 14);
3775 cnv_stat(creature_ptr->stat_max[1], tmp);
3776 prt(format(_(" b) 知能 (現在値 %s)", " b) Int (cur %s)"), tmp), 3, 14);
3777 cnv_stat(creature_ptr->stat_max[2], tmp);
3778 prt(format(_(" c) 賢さ (現在値 %s)", " c) Wis (cur %s)"), tmp), 4, 14);
3779 cnv_stat(creature_ptr->stat_max[3], tmp);
3780 prt(format(_(" d) 器用 (現在値 %s)", " d) Dex (cur %s)"), tmp), 5, 14);
3781 cnv_stat(creature_ptr->stat_max[4], tmp);
3782 prt(format(_(" e) 耐久 (現在値 %s)", " e) Con (cur %s)"), tmp), 6, 14);
3783 cnv_stat(creature_ptr->stat_max[5], tmp);
3784 prt(format(_(" f) 魅力 (現在値 %s)", " f) Chr (cur %s)"), tmp), 7, 14);
3787 prt(_(" どの能力値を上げますか?", " Which stat do you want to raise?"), 1, 14);
3791 if ((choice >= 'a') && (choice <= 'f'))
3794 for (n = 0; n < A_MAX; n++)
3795 if (n != choice - 'a')
3797 if (get_check(_("よろしいですか?", "Are you sure? ")))
3800 do_inc_stat(creature_ptr, choice - 'a');
3802 } else if (!(creature_ptr->max_plv % 2))
3803 do_inc_stat(creature_ptr, randint0(6));
3806 if (level_mutation) {
3807 msg_print(_("あなたは変わった気がする...", "You feel different..."));
3808 (void)gain_mutation(creature_ptr, 0);
3809 level_mutation = FALSE;
3813 * 報酬でレベルが上ると再帰的に check_experience(creature_ptr) が
3817 gain_level_reward(creature_ptr, 0);
3818 level_reward = FALSE;
3821 creature_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
3822 creature_ptr->redraw |= (PR_LEV | PR_TITLE);
3823 creature_ptr->window |= (PW_PLAYER | PW_SPELL);
3824 handle_stuff(creature_ptr);
3827 if (old_lev != creature_ptr->lev)
3828 autopick_load_pref(creature_ptr, FALSE);
3832 * @brief 現在の修正後能力値を3~17及び18/xxx形式に変換する / Converts stat num into a six-char (right justified) string
3834 * @param out_val 出力先文字列ポインタ
3837 void cnv_stat(int val, char *out_val)
3840 sprintf(out_val, " %2d", val);
3844 int bonus = (val - 18);
3846 sprintf(out_val, "18/%3s", "***");
3847 } else if (bonus >= 100) {
3848 sprintf(out_val, "18/%03d", bonus);
3850 sprintf(out_val, " 18/%02d", bonus);
3855 * @brief 能力値現在値から3~17及び18/xxx様式に基づく加減算を行う。
3856 * Modify a stat value by a "modifier", return new value
3858 * @param amount 加減算値
3862 * Stats go up: 3,4,...,17,18,18/10,18/20,...,18/220
3863 * Or even: 18/13, 18/23, 18/33, ..., 18/220
3864 * Stats go down: 18/220, 18/210,..., 18/10, 18, 17, ..., 3
3865 * Or even: 18/13, 18/03, 18, 17, ..., 3
3868 s16b modify_stat_value(int value, int amount)
3871 for (int i = 0; i < amount; i++) {
3877 } else if (amount < 0) {
3878 for (int i = 0; i < (0 - amount); i++) {
3879 if (value >= 18 + 10)
3881 else if (value > 18)
3893 * Hack -- Calculates the total number of points earned -JWT-
3897 long calc_score(player_type *creature_ptr)
3899 int arena_win = MIN(creature_ptr->arena_number, MAX_ARENA_MONS);
3912 if (ironman_small_levels)
3914 if (ironman_empty_levels)
3920 if (ironman_nightmare)
3927 for (int i = 0; i < current_world_ptr->max_d_idx; i++)
3928 if (max_dlv[i] > max_dl)
3929 max_dl = max_dlv[i];
3931 u32b point_l = (creature_ptr->max_max_exp + (100 * max_dl));
3932 u32b point_h = point_l / 0x10000L;
3933 point_l = point_l % 0x10000L;
3936 point_h += point_l / 0x10000L;
3937 point_l %= 0x10000L;
3939 point_l += ((point_h % 100) << 16);
3943 u32b point = (point_h << 16) + (point_l);
3944 if (creature_ptr->arena_number >= 0)
3945 point += (arena_win * arena_win * (arena_win > 29 ? 1000 : 100));
3947 if (ironman_downward)
3949 if (creature_ptr->pclass == CLASS_BERSERKER) {
3950 if (creature_ptr->prace == RACE_SPECTRE)
3954 if ((creature_ptr->pseikaku == PERSONALITY_MUNCHKIN) && point) {
3956 if (current_world_ptr->total_winner)
3961 point = (0 - point);
3967 * @param creature_ptr プレーヤーへの参照ポインタ
3968 * @return 祝福状態ならばTRUE
3970 bool is_blessed(player_type *creature_ptr)
3972 return creature_ptr->blessed || music_singing(creature_ptr, MUSIC_BLESS) || hex_spelling(creature_ptr, HEX_BLESS);
3975 bool is_tim_esp(player_type *creature_ptr)
3977 return creature_ptr->tim_esp || music_singing(creature_ptr, MUSIC_MIND) || (creature_ptr->concent >= CONCENT_TELE_THRESHOLD);
3980 bool is_tim_stealth(player_type *creature_ptr) { return creature_ptr->tim_stealth || music_singing(creature_ptr, MUSIC_STEALTH); }
3982 bool is_time_limit_esp(player_type *creature_ptr)
3984 return creature_ptr->tim_esp || music_singing(creature_ptr, MUSIC_MIND) || (creature_ptr->concent >= CONCENT_TELE_THRESHOLD);
3987 bool is_time_limit_stealth(player_type *creature_ptr) { return creature_ptr->tim_stealth || music_singing(creature_ptr, MUSIC_STEALTH); }
3989 bool can_two_hands_wielding(player_type *creature_ptr) { return !creature_ptr->riding || (creature_ptr->pet_extra_flags & PF_TWO_HANDS); }
3992 * @brief 歌の停止を処理する / Stop singing if the player is a Bard
3995 void stop_singing(player_type *creature_ptr)
3997 if (creature_ptr->pclass != CLASS_BARD)
4000 /* Are there interupted song? */
4001 if (INTERUPTING_SONG_EFFECT(creature_ptr)) {
4002 /* Forget interupted song */
4003 INTERUPTING_SONG_EFFECT(creature_ptr) = MUSIC_NONE;
4007 /* The player is singing? */
4008 if (!SINGING_SONG_EFFECT(creature_ptr))
4011 /* Hack -- if called from set_action(), avoid recursive loop */
4012 if (creature_ptr->action == ACTION_SING)
4013 set_action(creature_ptr, ACTION_NONE);
4015 /* Message text of each song or etc. */
4016 exe_spell(creature_ptr, REALM_MUSIC, SINGING_SONG_ID(creature_ptr), SPELL_STOP);
4018 SINGING_SONG_EFFECT(creature_ptr) = MUSIC_NONE;
4019 SINGING_SONG_ID(creature_ptr) = 0;
4020 creature_ptr->update |= (PU_BONUS);
4021 creature_ptr->redraw |= (PR_STATUS);
4025 * @brief 口を使う継続的な処理を中断する
4026 * @param caster_ptr プレーヤーへの参照ポインタ
4029 void stop_mouth(player_type *caster_ptr)
4031 if (music_singing_any(caster_ptr))
4032 stop_singing(caster_ptr);
4033 if (hex_spelling_any(caster_ptr))
4034 stop_hex_spell_all(caster_ptr);
4038 * @brief ペットの維持コスト計算
4041 PERCENTAGE calculate_upkeep(player_type *creature_ptr)
4044 bool has_a_unique = FALSE;
4045 DEPTH total_friend_levels = 0;
4049 for (m_idx = creature_ptr->current_floor_ptr->m_max - 1; m_idx >= 1; m_idx--) {
4050 monster_type *m_ptr;
4051 monster_race *r_ptr;
4053 m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
4054 if (!monster_is_valid(m_ptr))
4056 r_ptr = &r_info[m_ptr->r_idx];
4058 if (is_pet(m_ptr)) {
4060 if (r_ptr->flags1 & RF1_UNIQUE) {
4061 if (creature_ptr->pclass == CLASS_CAVALRY) {
4062 if (creature_ptr->riding == m_idx)
4063 total_friend_levels += (r_ptr->level + 5) * 2;
4064 else if (!has_a_unique && (r_info[m_ptr->r_idx].flags7 & RF7_RIDING))
4065 total_friend_levels += (r_ptr->level + 5) * 7 / 2;
4067 total_friend_levels += (r_ptr->level + 5) * 10;
4068 has_a_unique = TRUE;
4070 total_friend_levels += (r_ptr->level + 5) * 10;
4072 total_friend_levels += r_ptr->level;
4076 if (total_friends) {
4078 upkeep_factor = (total_friend_levels - (creature_ptr->lev * 80 / (cp_ptr->pet_upkeep_div)));
4079 if (upkeep_factor < 0)
4081 if (upkeep_factor > 1000)
4082 upkeep_factor = 1000;
4083 return upkeep_factor;
4088 bool music_singing(player_type *caster_ptr, int music_songs) { return (caster_ptr->pclass == CLASS_BARD) && (caster_ptr->magic_num1[0] == music_songs); }
4090 bool is_fast(player_type *creature_ptr) { return creature_ptr->fast || music_singing(creature_ptr, MUSIC_SPEED) || music_singing(creature_ptr, MUSIC_SHERO); }
4092 bool is_invuln(player_type *creature_ptr) { return creature_ptr->invuln || music_singing(creature_ptr, MUSIC_INVULN); }
4094 bool is_hero(player_type *creature_ptr) { return creature_ptr->hero || music_singing(creature_ptr, MUSIC_HERO) || music_singing(creature_ptr, MUSIC_SHERO); }
4096 bool is_shero(player_type *creature_ptr) { return creature_ptr->shero || creature_ptr->pclass == CLASS_BERSERKER; }
4098 bool is_echizen(player_type *creature_ptr)
4100 return (creature_ptr->pseikaku == PERSONALITY_COMBAT) || (creature_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON);
4103 int calc_weapon_weight_limit(player_type *creature_ptr)
4105 int weight = adj_str_hold[creature_ptr->stat_ind[A_STR]];
4107 if (has_two_handed_weapons(creature_ptr))
4113 static player_hand get_default_hand(player_type *creature_ptr)
4115 switch (player_melee_type(creature_ptr)) {
4116 case MELEE_TYPE_BAREHAND_TWO: return PLAYER_HAND_RIGHT;
4117 case MELEE_TYPE_BAREHAND_RIGHT: return PLAYER_HAND_RIGHT;
4118 case MELEE_TYPE_BAREHAND_LEFT: return PLAYER_HAND_LEFT;
4119 case MELEE_TYPE_WEAPON_RIGHT: return PLAYER_HAND_RIGHT;
4120 case MELEE_TYPE_WEAPON_LEFT: return PLAYER_HAND_LEFT;
4121 case MELEE_TYPE_WEAPON_TWOHAND: return PLAYER_HAND_RIGHT;
4122 case MELEE_TYPE_WEAPON_DOUBLE: return PLAYER_HAND_RIGHT;
4123 case MELEE_TYPE_SHIELD_DOUBLE: return PLAYER_HAND_RIGHT;