OSDN Git Service

[Refactor] #963 Added argument of update_turn_type to update_player_turn_energy()
authorHourier <grapefox.whitelucifer.0408@gmail.com>
Thu, 29 Apr 2021 04:03:34 +0000 (13:03 +0900)
committerHourier <grapefox.whitelucifer.0408@gmail.com>
Thu, 29 Apr 2021 09:39:43 +0000 (18:39 +0900)
50 files changed:
src/action/activation-execution.cpp
src/action/movement-execution.cpp
src/action/open-close-execution.cpp
src/action/racial-execution.cpp
src/action/run-execution.cpp
src/action/travel-execution.cpp
src/action/tunnel-execution.cpp
src/cmd-action/cmd-attack.cpp
src/cmd-action/cmd-hissatsu.cpp
src/cmd-action/cmd-mane.cpp
src/cmd-action/cmd-mind.cpp
src/cmd-action/cmd-move.cpp
src/cmd-action/cmd-open-close.cpp
src/cmd-action/cmd-others.cpp
src/cmd-action/cmd-pet.cpp
src/cmd-action/cmd-spell.cpp
src/cmd-action/cmd-tunnel.cpp
src/cmd-building/cmd-building.cpp
src/cmd-item/cmd-destroy.cpp
src/cmd-item/cmd-eat.cpp
src/cmd-item/cmd-equipment.cpp
src/cmd-item/cmd-item.cpp
src/cmd-item/cmd-magiceat.cpp
src/cmd-item/cmd-refill.cpp
src/cmd-item/cmd-smith.cpp
src/cmd-item/cmd-throw.cpp
src/cmd-item/cmd-usestaff.cpp
src/cmd-item/cmd-zaprod.cpp
src/cmd-item/cmd-zapwand.cpp
src/core/player-processor.cpp
src/dungeon/quest.cpp
src/floor/wild.cpp
src/mind/mind-blue-mage.cpp
src/mind/mind-elementalist.cpp
src/mind/mind-magic-eater.cpp
src/mind/mind-ninja.cpp
src/mind/mind-sniper.cpp
src/monster/monster-processor.cpp
src/monster/monster-status.cpp
src/object-enchant/object-boost.cpp
src/object-use/quaff-execution.cpp
src/object-use/read-execution.cpp
src/player-status/player-energy.cpp
src/player-status/player-energy.h
src/status/action-setter.cpp
src/store/cmd-store.cpp
src/system/gamevalue.h
src/term/z-rand.cpp
src/term/z-util.cpp
src/world/world-turn-processor.cpp

index 0046493..84ccca4 100644 (file)
@@ -224,7 +224,7 @@ static bool activate_whistle(player_type *user_ptr, ae_type *ae_ptr)
  */
 void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
 {
-    update_player_turn_energy(user_ptr, 100);
+    update_player_turn_energy(user_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
     ae_type tmp_ae;
     ae_type *ae_ptr = initialize_ae_type(user_ptr, &tmp_ae, item);
     decide_activation_level(user_ptr, ae_ptr);
index 7300995..001675f 100644 (file)
@@ -136,7 +136,7 @@ void exe_movement(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool
             }
 
             creature_ptr->leaving = TRUE;
-            update_player_turn_energy(creature_ptr, 100);
+            update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
             return;
         }
 
index fde7f1d..d276c3b 100644 (file)
@@ -39,7 +39,7 @@ bool exe_open(player_type *creature_ptr, POSITION y, POSITION x)
 {
     grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
     feature_type *f_ptr = &f_info[g_ptr->feat];
-    update_player_turn_energy(creature_ptr, 100);
+    update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
     if (!has_flag(f_ptr->flags, FF_OPEN)) {
         msg_format(_("%sはがっちりと閉じられているようだ。", "The %s appears to be stuck."), f_info[get_feat_mimic(g_ptr)].name.c_str());
         return FALSE;
@@ -95,7 +95,7 @@ bool exe_close(player_type *creature_ptr, POSITION y, POSITION x)
     grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
     FEAT_IDX old_feat = g_ptr->feat;
     bool more = FALSE;
-    update_player_turn_energy(creature_ptr, 100);
+    update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
     if (!has_flag(f_info[old_feat].flags, FF_CLOSE))
         return more;
 
@@ -188,7 +188,7 @@ bool exe_disarm_chest(player_type *creature_ptr, POSITION y, POSITION x, OBJECT_
 {
     bool more = FALSE;
     object_type *o_ptr = &creature_ptr->current_floor_ptr->o_list[o_idx];
-    update_player_turn_energy(creature_ptr, 100);
+    update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
     int i = creature_ptr->skill_dis;
     if (creature_ptr->blind || no_lite(creature_ptr))
         i = i / 10;
@@ -248,7 +248,7 @@ bool exe_disarm(player_type *creature_ptr, POSITION y, POSITION x, DIRECTION dir
     int power = f_ptr->power;
     bool more = FALSE;
     int i = creature_ptr->skill_dis;
-    update_player_turn_energy(creature_ptr, 100);
+    update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
     if (creature_ptr->blind || no_lite(creature_ptr))
         i = i / 10;
 
@@ -300,7 +300,7 @@ bool exe_bash(player_type *creature_ptr, POSITION y, POSITION x, DIRECTION dir)
     int temp = f_ptr->power;
     bool more = FALSE;
     concptr name = f_info[get_feat_mimic(g_ptr)].name.c_str();
-    update_player_turn_energy(creature_ptr, 100);
+    update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
     msg_format(_("%sに体当たりをした!", "You smash into the %s!"), name);
     temp = (bash - (temp * 10));
     if (creature_ptr->pclass == CLASS_BERSERKER)
index f2a80dd..40d813d 100644 (file)
@@ -123,7 +123,7 @@ racial_level_check_result check_racial_level(player_type *creature_ptr, rpi_type
     }
 
     adjust_racial_power_difficulty(creature_ptr, rpi_ptr, &difficulty);
-    update_player_turn_energy(creature_ptr, 100);
+    update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
     if (randint1(creature_ptr->stat_cur[use_stat]) >= ((difficulty / 2) + randint1(difficulty / 2)))
         return RACIAL_SUCCESS;
 
index 4103f06..208b857 100644 (file)
@@ -382,7 +382,7 @@ void run_step(player_type *creature_ptr, DIRECTION dir)
     if (--creature_ptr->running <= 0)
         return;
 
-    update_player_turn_energy(creature_ptr, 100);
+    update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
     exe_movement(creature_ptr, find_current, FALSE, FALSE);
     if (player_bold(creature_ptr, creature_ptr->run_py, creature_ptr->run_px)) {
         creature_ptr->run_py = 0;
index e049c49..7ceda50 100644 (file)
@@ -104,7 +104,7 @@ void travel_step(player_type *creature_ptr)
         return;
     }
 
-    update_player_turn_energy(creature_ptr, 100);
+    update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
     exe_movement(creature_ptr, travel.dir, always_pickup, FALSE);
     if ((creature_ptr->y == travel.y) && (creature_ptr->x == travel.x)) {
         travel.run = 0;
index 4ccaae0..b0889c4 100644 (file)
@@ -62,7 +62,7 @@ bool exe_tunnel(player_type *creature_ptr, POSITION y, POSITION x)
     if (!do_cmd_tunnel_test(creature_ptr->current_floor_ptr, y, x))
         return FALSE;
 
-    update_player_turn_energy(creature_ptr, 100);
+    update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
     g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
     f_ptr = &f_info[g_ptr->feat];
     power = f_ptr->power;
index 60afd2b..5ad702e 100644 (file)
@@ -177,7 +177,7 @@ bool do_cmd_attack(player_type *attacker_ptr, POSITION y, POSITION x, combat_opt
 
     disturb(attacker_ptr, FALSE, TRUE);
 
-    update_player_turn_energy(attacker_ptr, 100);
+    update_player_turn_energy(attacker_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
 
     if (!can_attack_with_main_hand(attacker_ptr) && !can_attack_with_sub_hand(attacker_ptr)
         && attacker_ptr->muta.has_none_of(mutation_attack_methods)) {
index a6b1a54..b6047c2 100644 (file)
@@ -348,7 +348,7 @@ void do_cmd_hissatsu(player_type *creature_ptr)
     if (!exe_spell(creature_ptr, REALM_HISSATSU, n, SPELL_CAST))
         return;
 
-    update_player_turn_energy(creature_ptr, 100);
+    update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
 
     /* Use some mana */
     creature_ptr->csp -= spell.smana;
@@ -422,7 +422,7 @@ void do_cmd_gain_hissatsu(player_type *creature_ptr)
     if (!gain) {
         msg_print(_("何も覚えられなかった。", "You were not able to learn any special attacks."));
     } else {
-        update_player_turn_energy(creature_ptr, 100);
+        update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
     }
 
     creature_ptr->update |= (PU_SPELLS);
index eb9b5e7..977c53b 100644 (file)
@@ -1137,7 +1137,7 @@ bool do_cmd_mane(player_type *creature_ptr, bool baigaesi)
         creature_ptr->mane_dam[j] = creature_ptr->mane_dam[j + 1];
     }
 
-    update_player_turn_energy(creature_ptr, 100);
+    update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
 
     creature_ptr->redraw |= (PR_IMITATION);
     creature_ptr->window_flags |= (PW_PLAYER);
index 2a1b764..02f8b7f 100644 (file)
@@ -300,12 +300,12 @@ static void mind_turn_passing(player_type *caster_ptr, cm_type *cm_ptr)
 {
     if (cm_ptr->on_mirror && (caster_ptr->pclass == CLASS_MIRROR_MASTER)) {
         if (cm_ptr->n == 3 || cm_ptr->n == 5 || cm_ptr->n == 7 || cm_ptr->n == 16) {
-            update_player_turn_energy(caster_ptr, 50);
+            update_player_turn_energy(caster_ptr, 50, update_turn_type::ENERGY_SUBSTITUTION);
             return;
         }
     }
 
-    update_player_turn_energy(caster_ptr, 100);
+    update_player_turn_energy(caster_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
 }
 
 static bool judge_mind_chance(player_type *caster_ptr, cm_type *cm_ptr)
index 67bd666..107ba19 100644 (file)
@@ -104,7 +104,7 @@ void do_cmd_go_up(player_type *creature_ptr)
         creature_ptr->leaving = TRUE;
         creature_ptr->oldpx = 0;
         creature_ptr->oldpy = 0;
-        update_player_turn_energy(creature_ptr, 100);
+        update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
         return;
     }
 
@@ -116,7 +116,7 @@ void do_cmd_go_up(player_type *creature_ptr)
     if (!go_up)
         return;
 
-    update_player_turn_energy(creature_ptr, 100);
+    update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
 
     if (autosave_l)
         do_cmd_save_game(creature_ptr, TRUE);
@@ -215,7 +215,7 @@ void do_cmd_go_down(player_type *creature_ptr)
         creature_ptr->leaving = TRUE;
         creature_ptr->oldpx = 0;
         creature_ptr->oldpy = 0;
-        update_player_turn_energy(creature_ptr, 100);
+        update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
         return;
     }
 
@@ -240,7 +240,7 @@ void do_cmd_go_down(player_type *creature_ptr)
         prepare_change_floor_mode(creature_ptr, CFM_FIRST_FLOOR);
     }
 
-    update_player_turn_energy(creature_ptr, 100);
+    update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
     if (autosave_l)
         do_cmd_save_game(creature_ptr, TRUE);
 
@@ -305,7 +305,7 @@ void do_cmd_walk(player_type *creature_ptr, bool pickup)
     bool more = FALSE;
     DIRECTION dir;
     if (get_rep_dir(creature_ptr, &dir, FALSE)) {
-        update_player_turn_energy(creature_ptr, 100);
+        update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
         if ((dir != 5) && (creature_ptr->special_defense & KATA_MUSOU))
             set_action(creature_ptr, ACTION_NONE);
 
@@ -329,7 +329,7 @@ void do_cmd_walk(player_type *creature_ptr, bool pickup)
             creature_ptr->oldpy = randint1(MAX_HGT - 2);
             creature_ptr->oldpx = randint1(MAX_WID - 2);
             change_wild_mode(creature_ptr, TRUE);
-            update_player_turn_energy(creature_ptr, 100);
+            update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
         }
     }
 
@@ -375,7 +375,7 @@ void do_cmd_stay(player_type *creature_ptr, bool pickup)
         command_arg = 0;
     }
 
-    update_player_turn_energy(creature_ptr, 100);
+    update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
     if (pickup)
         mpe_mode |= MPE_DO_PICKUP;
 
@@ -421,7 +421,7 @@ void do_cmd_rest(player_type *creature_ptr)
     if (creature_ptr->special_defense & NINJA_S_STEALTH)
         set_superstealth(creature_ptr, FALSE);
 
-    update_player_turn_energy(creature_ptr, 100);
+    update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
     if (command_arg > 100)
         chg_virtue(creature_ptr, V_DILIGENCE, -1);
 
index d7a9868..fb7c6b9 100644 (file)
@@ -41,7 +41,7 @@ static bool exe_open_chest(player_type *creature_ptr, POSITION y, POSITION x, OB
     bool flag = TRUE;
     bool more = FALSE;
     object_type *o_ptr = &creature_ptr->current_floor_ptr->o_list[o_idx];
-    update_player_turn_energy(creature_ptr, 100);
+    update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
     if (o_ptr->pval > 0) {
         flag = FALSE;
         int i = creature_ptr->skill_dis;
@@ -122,7 +122,7 @@ void do_cmd_open(player_type *creature_ptr)
         if (!has_flag(f_info[feat].flags, FF_OPEN) && !o_idx) {
             msg_print(_("そこには開けるものが見当たらない。", "You see nothing there to open."));
         } else if (g_ptr->m_idx && creature_ptr->riding != g_ptr->m_idx) {
-            update_player_turn_energy(creature_ptr, 100);
+            update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
             msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
             do_cmd_attack(creature_ptr, y, x, HISSATSU_NONE);
         } else if (o_idx) {
@@ -173,7 +173,7 @@ void do_cmd_close(player_type *creature_ptr)
         if (!has_flag(f_info[feat].flags, FF_CLOSE)) {
             msg_print(_("そこには閉じるものが見当たらない。", "You see nothing there to close."));
         } else if (g_ptr->m_idx) {
-            update_player_turn_energy(creature_ptr, 100);
+            update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
             msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
             do_cmd_attack(creature_ptr, y, x, HISSATSU_NONE);
         } else {
@@ -287,7 +287,7 @@ void do_cmd_bash(player_type *creature_ptr)
         if (!has_flag(f_info[feat].flags, FF_BASH)) {
             msg_print(_("そこには体当たりするものが見当たらない。", "You see nothing there to bash."));
         } else if (g_ptr->m_idx) {
-            update_player_turn_energy(creature_ptr, 100);
+            update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
             msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
             do_cmd_attack(creature_ptr, y, x, HISSATSU_NONE);
         } else {
@@ -359,11 +359,11 @@ void do_cmd_spike(player_type *creature_ptr)
     } else if (!get_spike(creature_ptr, &item)) {
         msg_print(_("くさびを持っていない!", "You have no spikes!"));
     } else if (g_ptr->m_idx) {
-        update_player_turn_energy(creature_ptr, 100);
+        update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
         msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
         do_cmd_attack(creature_ptr, y, x, HISSATSU_NONE);
     } else {
-        update_player_turn_energy(creature_ptr, 100);
+        update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
         msg_format(_("%sにくさびを打ち込んだ。", "You jam the %s with a spike."), f_info[feat].name.c_str());
         cave_alter_feat(creature_ptr, y, x, FF_SPIKE);
         vary_item(creature_ptr, item, -1);
index 0bd763f..c0add8b 100644 (file)
@@ -50,7 +50,7 @@ void do_cmd_search(player_type *creature_ptr)
         command_arg = 0;
     }
 
-    update_player_turn_energy(creature_ptr, 100);
+    update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
     search(creature_ptr);
 
     if (creature_ptr->action == ACTION_SEARCH)
@@ -70,7 +70,7 @@ static bool exe_alter(player_type *creature_ptr)
     FEAT_IDX feat = get_feat_mimic(g_ptr);
     feature_type *f_ptr;
     f_ptr = &f_info[feat];
-    update_player_turn_energy(creature_ptr, 100);
+    update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
     if (g_ptr->m_idx) {
         do_cmd_attack(creature_ptr, y, x, HISSATSU_NONE);
         return FALSE;
index 0e668a5..b9e1e9b 100644 (file)
@@ -223,7 +223,7 @@ bool do_cmd_riding(player_type *creature_ptr, bool force)
             return FALSE;
 
         if (g_ptr->m_idx) {
-            update_player_turn_energy(creature_ptr, 100);
+            update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
 
             msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
 
@@ -278,7 +278,7 @@ bool do_cmd_riding(player_type *creature_ptr, bool force)
         }
         if (r_info[m_ptr->r_idx].level > randint1((creature_ptr->skill_exp[GINOU_RIDING] / 50 + creature_ptr->lev / 2 + 20))) {
             msg_print(_("うまく乗れなかった。", "You failed to ride."));
-            update_player_turn_energy(creature_ptr, 100);
+            update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
             return FALSE;
         }
 
@@ -299,7 +299,7 @@ bool do_cmd_riding(player_type *creature_ptr, bool force)
             health_track(creature_ptr, 0);
     }
 
-    update_player_turn_energy(creature_ptr, 100);
+    update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
 
     /* Mega-Hack -- Forget the view and lite */
     creature_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
index cb71e76..9f0e524 100644 (file)
@@ -908,7 +908,7 @@ void do_cmd_study(player_type *caster_ptr)
 #endif
     }
 
-    update_player_turn_energy(caster_ptr, 100);
+    update_player_turn_energy(caster_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
 
     switch (mp_ptr->spell_book) {
     case TV_LIFE_BOOK:
@@ -1302,7 +1302,7 @@ bool do_cmd_cast(player_type *caster_ptr)
         }
     }
 
-    update_player_turn_energy(caster_ptr, 100);
+    update_player_turn_energy(caster_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
 
     /* Over-exert the player */
     if (over_exerted) {
index d5ef83a..74ffe6b 100644 (file)
@@ -60,7 +60,7 @@ void do_cmd_tunnel(player_type *creature_ptr)
     else if (!has_flag(f_info[feat].flags, FF_TUNNEL))
         msg_print(_("そこは掘れない。", "You can't tunnel through that."));
     else if (g_ptr->m_idx) {
-        update_player_turn_energy(creature_ptr, 100);
+        update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
         msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
         do_cmd_attack(creature_ptr, y, x, HISSATSU_NONE);
     } else
index 54ba74c..2e8063b 100644 (file)
@@ -308,7 +308,7 @@ void do_cmd_building(player_type *player_ptr)
 {
        if (player_ptr->wild_mode) return;
 
-       update_player_turn_energy(player_ptr, 100);
+       update_player_turn_energy(player_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
 
        if (!cave_has_flag_bold(player_ptr->current_floor_ptr, player_ptr->y, player_ptr->x, FF_BLDG))
        {
index 4381893..20adb4f 100644 (file)
@@ -212,7 +212,7 @@ void do_cmd_destroy(player_type *creature_ptr)
     destroy_ptr->o_ptr->number = destroy_ptr->amt;
     describe_flavor(creature_ptr, destroy_ptr->o_name, destroy_ptr->o_ptr, 0);
     destroy_ptr->o_ptr->number = destroy_ptr->old_number;
-    update_player_turn_energy(creature_ptr, 100);
+    update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
     if (!can_player_destroy_object(creature_ptr, destroy_ptr->o_ptr)) {
         reset_player_turn(creature_ptr);
         msg_format(_("%sは破壊不可能だ。", "You cannot destroy %s."), destroy_ptr->o_name);
index 811b7e8..b55ec61 100644 (file)
@@ -269,7 +269,7 @@ void exe_eat_food(player_type *creature_ptr, INVENTORY_IDX item)
 
     sound(SOUND_EAT);
 
-    update_player_turn_energy(creature_ptr, 100);
+    update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
 
     /* Object level */
     int lev = k_info[o_ptr->k_idx].level;
index 7b44f11..8dcbbfc 100644 (file)
@@ -230,7 +230,7 @@ void do_cmd_wield(player_type *creature_ptr)
         autopick_alter_item(creature_ptr, item, FALSE);
     }
 
-    update_player_turn_energy(creature_ptr, 100);
+    update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
     q_ptr = &forge;
     object_copy(q_ptr, o_ptr);
     q_ptr->number = 1;
@@ -330,12 +330,12 @@ void do_cmd_takeoff(player_type *creature_ptr)
             msg_print(_("呪いを打ち破った。", "You break the curse."));
         } else {
             msg_print(_("装備を外せなかった。", "You couldn't remove the equipment."));
-            update_player_turn_energy(creature_ptr, 50);
+            update_player_turn_energy(creature_ptr, 50, update_turn_type::ENERGY_SUBSTITUTION);
             return;
         }
     }
 
-    update_player_turn_energy(creature_ptr, 50);
+    update_player_turn_energy(creature_ptr, 50, update_turn_type::ENERGY_SUBSTITUTION);
     (void)inven_takeoff(creature_ptr, item, 255);
     verify_equip_slot(creature_ptr, item);
     calc_android_exp(creature_ptr);
index 863fc2d..340356e 100644 (file)
@@ -131,7 +131,7 @@ void do_cmd_drop(player_type *creature_ptr)
             return;
     }
 
-    update_player_turn_energy(creature_ptr, 50);
+    update_player_turn_energy(creature_ptr, 50, update_turn_type::ENERGY_SUBSTITUTION);
     drop_from_inventory(creature_ptr, item, amt);
     if (item >= INVEN_MAIN_HAND) {
         verify_equip_slot(creature_ptr, item);
index ac374d7..c0d2f2b 100644 (file)
@@ -572,7 +572,7 @@ bool do_cmd_magic_eater(player_type *creature_ptr, bool only_browse, bool powerf
                sound(SOUND_FAIL);
                if (randint1(100) >= chance)
                        chg_virtue(creature_ptr, V_CHANCE,-1);
-               update_player_turn_energy(creature_ptr, 100);
+                update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
 
                return TRUE;
        }
@@ -600,7 +600,7 @@ bool do_cmd_magic_eater(player_type *creature_ptr, bool only_browse, bool powerf
                if (randint1(100) < chance)
                        chg_virtue(creature_ptr, V_CHANCE,1);
        }
-       update_player_turn_energy(creature_ptr, 100);
+        update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
        if (tval == TV_ROD) creature_ptr->magic_num1[item] += k_info[k_idx].pval * EATER_ROD_CHARGE;
        else creature_ptr->magic_num1[item] -= EATER_CHARGE;
 
index 6414e06..2677cd1 100644 (file)
@@ -40,7 +40,7 @@ static void do_cmd_refill_lamp(player_type *user_ptr)
     BIT_FLAGS flgs[TR_FLAG_SIZE], flgs2[TR_FLAG_SIZE];
     object_flags(user_ptr, o_ptr, flgs);
 
-    update_player_turn_energy(user_ptr, 50);
+    update_player_turn_energy(user_ptr, 50, update_turn_type::ENERGY_SUBSTITUTION);
     j_ptr = &user_ptr->inventory_list[INVEN_LITE];
     object_flags(user_ptr, j_ptr, flgs2);
     j_ptr->xtra4 += o_ptr->xtra4;
@@ -80,7 +80,7 @@ static void do_cmd_refill_torch(player_type *user_ptr)
     BIT_FLAGS flgs[TR_FLAG_SIZE], flgs2[TR_FLAG_SIZE];
     object_flags(user_ptr, o_ptr, flgs);
 
-    update_player_turn_energy(user_ptr, 50);
+    update_player_turn_energy(user_ptr, 50, update_turn_type::ENERGY_SUBSTITUTION);
     j_ptr = &user_ptr->inventory_list[INVEN_LITE];
     object_flags(user_ptr, j_ptr, flgs2);
     j_ptr->xtra4 += o_ptr->xtra4 + 5;
index 1a44378..4cf93e5 100644 (file)
@@ -261,7 +261,7 @@ static void drain_essence(player_type *creature_ptr)
             return;
     }
 
-    update_player_turn_energy(creature_ptr, 100);
+    update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
 
     object_flags(creature_ptr, o_ptr, old_flgs);
     if (has_flag(old_flgs, TR_KILL_DRAGON))
@@ -907,7 +907,7 @@ static void add_essence(player_type *creature_ptr, ESSENCE_IDX mode)
         if (es_ptr->add == ESSENCE_ATTACK) {
             if ((o_ptr->to_h >= creature_ptr->lev / 5 + 5) && (o_ptr->to_d >= creature_ptr->lev / 5 + 5)) {
                 msg_print(_("改良に失敗した。", "You failed to enchant."));
-                update_player_turn_energy(creature_ptr, 100);
+                update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
                 return;
             } else {
                 if (o_ptr->to_h < creature_ptr->lev / 5 + 5)
@@ -918,7 +918,7 @@ static void add_essence(player_type *creature_ptr, ESSENCE_IDX mode)
         } else if (es_ptr->add == ESSENCE_AC) {
             if (o_ptr->to_a >= creature_ptr->lev / 5 + 5) {
                 msg_print(_("改良に失敗した。", "You failed to enchant."));
-                update_player_turn_energy(creature_ptr, 100);
+                update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
                 return;
             } else {
                 if (o_ptr->to_a < creature_ptr->lev / 5 + 5)
@@ -982,7 +982,7 @@ static void add_essence(player_type *creature_ptr, ESSENCE_IDX mode)
         }
     }
 
-    update_player_turn_energy(creature_ptr, 100);
+    update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
     _(msg_format("%sに%sの能力を付加しました。", o_name, es_ptr->add_name), msg_format("You have added ability of %s to %s.", es_ptr->add_name, o_name));
     creature_ptr->update |= (PU_COMBINE | PU_REORDER);
     creature_ptr->window_flags |= (PW_INVEN);
@@ -1013,7 +1013,7 @@ static void erase_essence(player_type *creature_ptr)
     if (!get_check(format(_("よろしいですか? [%s]", "Are you sure? [%s]"), o_name)))
         return;
 
-    update_player_turn_energy(creature_ptr, 100);
+    update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
 
     if (o_ptr->xtra3 == 1 + ESSENCE_SLAY_GLOVE) {
         o_ptr->to_h -= (o_ptr->xtra4 >> 8);
index ae7fa0e..be4018f 100644 (file)
@@ -200,7 +200,7 @@ static void reflect_inventory_by_throw(player_type *creature_ptr, it_type *it_pt
 
 static void set_class_specific_throw_params(player_type *creature_ptr, it_type *it_ptr)
 {
-    update_player_turn_energy(creature_ptr, 100);
+    update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
     if ((creature_ptr->pclass == CLASS_ROGUE) || (creature_ptr->pclass == CLASS_NINJA))
         creature_ptr->energy_use -= creature_ptr->lev;
 
index d38068e..7d98925 100644 (file)
@@ -317,7 +317,7 @@ void exe_use_staff(player_type *creature_ptr, INVENTORY_IDX item)
         return;
     }
 
-    update_player_turn_energy(creature_ptr, 100);
+    update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
 
     lev = k_info[o_ptr->k_idx].level;
     if (lev > 50)
index 92bab2d..91ddf1f 100644 (file)
@@ -315,7 +315,7 @@ void exe_zap_rod(player_type *creature_ptr, INVENTORY_IDX item)
             return;
     }
 
-    update_player_turn_energy(creature_ptr, 100);
+    update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
 
     lev = k_info[o_ptr->k_idx].level;
 
index 7780ee2..3c9e83d 100644 (file)
@@ -357,7 +357,7 @@ void exe_aim_wand(player_type *creature_ptr, INVENTORY_IDX item)
     }
     target_pet = old_target_pet;
 
-    update_player_turn_energy(creature_ptr, 100);
+    update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
 
     /* Get the level */
     lev = k_info[o_ptr->k_idx].level;
index c1f2450..6a02571 100644 (file)
@@ -271,7 +271,7 @@ void process_player(player_type *creature_ptr)
             command_cmd = SPECIAL_KEY_BUILDING;
             process_command(creature_ptr);
         } else if ((creature_ptr->paralyzed || creature_ptr->stun >= 100) && !cheat_immortal) {
-            update_player_turn_energy(creature_ptr, 100);
+            update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
         } else if (creature_ptr->action == ACTION_REST) {
             if (creature_ptr->resting > 0) {
                 creature_ptr->resting--;
@@ -280,9 +280,9 @@ void process_player(player_type *creature_ptr)
                 creature_ptr->redraw |= (PR_STATE);
             }
 
-            update_player_turn_energy(creature_ptr, 100);
+            update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
         } else if (creature_ptr->action == ACTION_FISH) {
-            update_player_turn_energy(creature_ptr, 100);
+            update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
         } else if (creature_ptr->running) {
             run_step(creature_ptr, 0);
         } else if (travel.run) {
index 092a10d..5f14304 100644 (file)
@@ -324,7 +324,7 @@ void do_cmd_quest(player_type *player_ptr)
     if (player_ptr->wild_mode)
         return;
 
-    update_player_turn_energy(player_ptr, 100);
+    update_player_turn_energy(player_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
 
     if (!cave_has_flag_bold(player_ptr->current_floor_ptr, player_ptr->y, player_ptr->x, FF_QUEST_ENTER)) {
         msg_print(_("ここにはクエストの入口はない。", "You see no quest level here."));
index 57ceca5..b75e3ae 100644 (file)
@@ -895,7 +895,7 @@ bool change_wild_mode(player_type *creature_ptr, bool encount)
         }
     }
 
-    update_player_turn_energy(creature_ptr, 1000);
+    update_player_turn_energy(creature_ptr, 1000, update_turn_type::ENERGY_SUBSTITUTION);
     creature_ptr->oldpx = creature_ptr->x;
     creature_ptr->oldpy = creature_ptr->y;
     if (hex_spelling_any(creature_ptr))
index 94fe5c2..2fb7c82 100644 (file)
@@ -111,7 +111,7 @@ bool do_cmd_cast_learned(player_type *caster_ptr)
         }
     }
 
-    update_player_turn_energy(caster_ptr, 100);
+    update_player_turn_energy(caster_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
     caster_ptr->redraw |= PR_MANA;
     caster_ptr->window_flags |= PW_PLAYER | PW_SPELL;
     return TRUE;
index 62e584a..cd1dcf9 100644 (file)
@@ -880,7 +880,7 @@ static bool try_cast_element_spell(player_type *caster_ptr, SPELL_IDX spell_idx,
             PROJECT_JUMP | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM);
         caster_ptr->csp = MAX(0, caster_ptr->csp - caster_ptr->msp * 10 / (20 + randint1(10)));
 
-        update_player_turn_energy(caster_ptr, 100);
+        update_player_turn_energy(caster_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
         set_bits(caster_ptr->redraw, PR_MANA);
         set_bits(caster_ptr->window_flags, PW_PLAYER | PW_SPELL);
 
@@ -927,7 +927,7 @@ void do_cmd_element(player_type *caster_ptr)
         }
     }
 
-    update_player_turn_energy(caster_ptr, 100);
+    update_player_turn_energy(caster_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
     set_bits(caster_ptr->redraw, PR_MANA);
     set_bits(caster_ptr->window_flags, PW_PLAYER | PW_SPELL);
 }
index 71ec92f..914c176 100644 (file)
@@ -83,6 +83,6 @@ bool import_magic_device(player_type *user_ptr)
     msg_format(_("%sの魔力を取り込んだ。", "You absorb magic of %s."), o_name);
 
     vary_item(user_ptr, item, -999);
-    update_player_turn_energy(user_ptr, 100);
+    update_player_turn_energy(user_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
     return TRUE;
 }
index 6d76e89..0d7653b 100644 (file)
@@ -417,7 +417,7 @@ bool cast_ninja_spell(player_type *caster_ptr, mind_ninja_type spell)
             }
 
             do_cmd_throw(caster_ptr, 1, FALSE, slot);
-            update_player_turn_energy(caster_ptr, 100);
+            update_player_turn_energy(caster_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
         }
 
         break;
index 5905c04..d98ea0b 100644 (file)
@@ -22,9 +22,9 @@
 #include "main/sound-definitions-table.h"
 #include "main/sound-of-music.h"
 #include "mind/snipe-types.h"
+#include "monster-race/monster-race.h"
 #include "monster-race/race-flags-resistance.h"
 #include "monster-race/race-flags3.h"
-#include "monster-race/monster-race.h"
 #include "player-status/player-energy.h"
 #include "system/monster-race-definition.h"
 #include "system/monster-type-definition.h"
 #define MAX_SNIPE_POWERS 16
 
 /*! スナイパー技能情報の構造体 */
-typedef struct snipe_power
-{
-       PLAYER_LEVEL min_lev;
-       MANA_POINT mana_cost;
-       concptr name;
+typedef struct snipe_power {
+    PLAYER_LEVEL min_lev;
+    MANA_POINT mana_cost;
+    concptr name;
 } snipe_power;
 
 /*! スナイパー技能の解説メッセージ */
-static concptr const snipe_tips[MAX_SNIPE_POWERS] =
-{
+static concptr const snipe_tips[MAX_SNIPE_POWERS] = {
 #ifdef JP
-       "精神を集中する。射撃の威力、精度が上がり、高度な射撃術が使用できるようになる。",
-       "光る矢を放つ。光に弱いモンスターに威力を発揮する。",
-       "射撃を行った後、短距離の瞬間移動を行う。",
-       "軌道上の罠をすべて無効にする低空飛行の矢を放つ。",
-       "火炎属性の矢を放つ。",
-       "壁を粉砕する矢を放つ。岩でできたモンスターと無生物のモンスターに威力を発揮する。",
-       "冷気属性の矢を放つ。",
-       "敵を突き飛ばす矢を放つ。",
-       "複数の敵を貫通する矢を放つ。",
-       "善良なモンスターに威力を発揮する矢を放つ。",
-       "邪悪なモンスターに威力を発揮する矢を放つ。",
-       "当たると爆発する矢を放つ。",
-       "2回射撃を行う。",
-       "電撃属性の矢を放つ。",
-       "敵の急所にめがけて矢を放つ。成功すると敵を一撃死させる。失敗すると1ダメージ。",
-       "全てのモンスターに高威力を発揮する矢を放つ。反動による副次効果を受ける。",
+    "精神を集中する。射撃の威力、精度が上がり、高度な射撃術が使用できるようになる。",
+    "光る矢を放つ。光に弱いモンスターに威力を発揮する。",
+    "射撃を行った後、短距離の瞬間移動を行う。",
+    "軌道上の罠をすべて無効にする低空飛行の矢を放つ。",
+    "火炎属性の矢を放つ。",
+    "壁を粉砕する矢を放つ。岩でできたモンスターと無生物のモンスターに威力を発揮する。",
+    "冷気属性の矢を放つ。",
+    "敵を突き飛ばす矢を放つ。",
+    "複数の敵を貫通する矢を放つ。",
+    "善良なモンスターに威力を発揮する矢を放つ。",
+    "邪悪なモンスターに威力を発揮する矢を放つ。",
+    "当たると爆発する矢を放つ。",
+    "2回射撃を行う。",
+    "電撃属性の矢を放つ。",
+    "敵の急所にめがけて矢を放つ。成功すると敵を一撃死させる。失敗すると1ダメージ。",
+    "全てのモンスターに高威力を発揮する矢を放つ。反動による副次効果を受ける。",
 #else
-       "Concentrate your mind for shooting.",
-       "Shoot a glowing arrow effective against light-sensitive foes.",
-       "Blink after shooting.",
-       "Shoot an arrow able to shatter traps.",
-       "Deals extra damage of fire.",
-       "Shoot an arrow able to shatter rocks.",
-       "Deals extra damage of ice.",
-       "Shoot an arrow that pushes away the target.",
-       "Shoot an arrow that does not always stop at the first target on its path."
-       "Deals more damage to good monsters.",
-       "Deals more damage to evil monsters.",
-       "Shoot an arrow that explodes when it hits a monster.",
-       "Shoot two arrows at once.",
-       "Deals extra damage of lightning.",
-       "Deals quick death or 1 damage.",
-       "Deals great damage to all monsters, and some side effects to you.",
+    "Concentrate your mind for shooting.",
+    "Shoot a glowing arrow effective against light-sensitive foes.",
+    "Blink after shooting.",
+    "Shoot an arrow able to shatter traps.",
+    "Deals extra damage of fire.",
+    "Shoot an arrow able to shatter rocks.",
+    "Deals extra damage of ice.",
+    "Shoot an arrow that pushes away the target.",
+    "Shoot an arrow that does not always stop at the first target on its path."
+    "Deals more damage to good monsters.",
+    "Deals more damage to evil monsters.",
+    "Shoot an arrow that explodes when it hits a monster.",
+    "Shoot two arrows at once.",
+    "Deals extra damage of lightning.",
+    "Deals quick death or 1 damage.",
+    "Deals great damage to all monsters, and some side effects to you.",
 #endif
 };
 
 /*! スナイパー技能テーブル */
-static snipe_power const snipe_powers[MAX_SNIPE_POWERS] =
-{
-       /* Level gained,  cost,  name */
+static snipe_power const snipe_powers[MAX_SNIPE_POWERS] = {
+/* Level gained,  cost,  name */
 #ifdef JP
-       {  1,  0,  "精神集中" },
-       {  2,  1,  "フラッシュアロー" },
-       {  3,  1,  "シュート&アウェイ" },
-       {  5,  1,  "解除の矢" },
-       {  8,  2,  "火炎の矢" },
-       { 10,  2,  "岩砕き" },
-       { 13,  2,  "冷気の矢" },
-       { 18,  2,  "烈風弾"},
-       { 22,  3,  "貫通弾" },
-       { 25,  4,  "邪念弾"},
-       { 26,  4,  "破魔矢" },
-       { 30,  3,  "爆発の矢"},
-       { 32,  4,  "ダブルショット" },
-       { 36,  3,  "プラズマボルト" },
-       { 40,  3,  "ニードルショット" },
-       { 48,  7,  "セイントスターアロー" },
+    { 1, 0, "精神集中" },
+    { 2, 1, "フラッシュアロー" },
+    { 3, 1, "シュート&アウェイ" },
+    { 5, 1, "解除の矢" },
+    { 8, 2, "火炎の矢" },
+    { 10, 2, "岩砕き" },
+    { 13, 2, "冷気の矢" },
+    { 18, 2, "烈風弾" },
+    { 22, 3, "貫通弾" },
+    { 25, 4, "邪念弾" },
+    { 26, 4, "破魔矢" },
+    { 30, 3, "爆発の矢" },
+    { 32, 4, "ダブルショット" },
+    { 36, 3, "プラズマボルト" },
+    { 40, 3, "ニードルショット" },
+    { 48, 7, "セイントスターアロー" },
 #else
-       {  1,  0,  "Concentration" },
-       {  2,  1,  "Flash Arrow" },
-       {  3,  1,  "Shoot & Away" },
-       {  5,  1,  "Disarm Shot" },
-       {  8,  2,  "Fire Shot" },
-       { 10,  2,  "Shatter Arrow" },
-       { 13,  2,  "Ice Shot" },
-       { 18,  2,  "Rushing Arrow"},
-       { 22,  3,  "Piercing Shot" },
-       { 25,  4,  "Evil Shot"},
-       { 26,  4,  "Holy Shot" },
-       { 30,  3,  "Missile"},
-       { 32,  4,  "Double Shot" },
-       { 36,  3,  "Plasma Bolt" },
-       { 40,  3,  "Needle Shot" },
-       { 48,  7,  "Saint Stars Arrow" },
+    { 1, 0, "Concentration" },
+    { 2, 1, "Flash Arrow" },
+    { 3, 1, "Shoot & Away" },
+    { 5, 1, "Disarm Shot" },
+    { 8, 2, "Fire Shot" },
+    { 10, 2, "Shatter Arrow" },
+    { 13, 2, "Ice Shot" },
+    { 18, 2, "Rushing Arrow" },
+    { 22, 3, "Piercing Shot" },
+    { 25, 4, "Evil Shot" },
+    { 26, 4, "Holy Shot" },
+    { 30, 3, "Missile" },
+    { 32, 4, "Double Shot" },
+    { 36, 3, "Plasma Bolt" },
+    { 40, 3, "Needle Shot" },
+    { 48, 7, "Saint Stars Arrow" },
 #endif
 };
 
-/*! 
+/*!
  * @brief スナイパーの集中度加算
  * @return 常にTRUEを返す
  */
 static bool snipe_concentrate(player_type *creature_ptr)
 {
-       if ((int)creature_ptr->concent < (2 + (creature_ptr->lev + 5) / 10)) creature_ptr->concent++;
+    if ((int)creature_ptr->concent < (2 + (creature_ptr->lev + 5) / 10))
+        creature_ptr->concent++;
 
-       msg_format(_("集中した。(集中度 %d)", "You concentrate deeply. (lvl %d)"), creature_ptr->concent);
-       creature_ptr->reset_concent = FALSE;
+    msg_format(_("集中した。(集中度 %d)", "You concentrate deeply. (lvl %d)"), creature_ptr->concent);
+    creature_ptr->reset_concent = FALSE;
 
-       creature_ptr->update |= (PU_BONUS | PU_MONSTERS);
-       creature_ptr->redraw |= (PR_STATUS);
-       return TRUE;
+    creature_ptr->update |= (PU_BONUS | PU_MONSTERS);
+    creature_ptr->redraw |= (PR_STATUS);
+    return TRUE;
 }
 
-/*! 
+/*!
  * @brief スナイパーの集中度リセット
  * @param msg TRUEならばメッセージを表示する
  * @return なし
  */
 void reset_concentration(player_type *creature_ptr, bool msg)
 {
-       if (msg)
-       {
-               msg_print(_("集中力が途切れてしまった。", "Stop concentrating."));
-       }
+    if (msg) {
+        msg_print(_("集中力が途切れてしまった。", "Stop concentrating."));
+    }
 
-       creature_ptr->concent = 0;
-       creature_ptr->reset_concent = FALSE;
+    creature_ptr->concent = 0;
+    creature_ptr->reset_concent = FALSE;
 
-       creature_ptr->update |= (PU_BONUS | PU_MONSTERS);
-       creature_ptr->redraw |= (PR_STATUS);
+    creature_ptr->update |= (PU_BONUS | PU_MONSTERS);
+    creature_ptr->redraw |= (PR_STATUS);
 }
 
-/*! 
+/*!
  * @brief スナイパーの集中度によるダメージボーナスを加算する
  * @param tdam 算出中のダメージ
  * @return 集中度修正を加えたダメージ
  */
 int boost_concentration_damage(player_type *creature_ptr, int tdam)
 {
-       tdam *= (10 + creature_ptr->concent);
-       tdam /= 10;
+    tdam *= (10 + creature_ptr->concent);
+    tdam /= 10;
 
-       return (tdam);
+    return (tdam);
 }
 
-/*! 
+/*!
  * @brief スナイパーの技能リストを表示する
  * @return なし
  */
 void display_snipe_list(player_type *sniper_ptr)
 {
-       int i;
-       TERM_LEN y = 1;
-       TERM_LEN x = 1;
-       PLAYER_LEVEL plev = sniper_ptr->lev;
-       snipe_power spell;
-       char psi_desc[80];
-
-       /* Display a list of spells */
-       prt("", y, x);
-       put_str(_("名前", "Name"), y, x + 5);
-       put_str(_("Lv   MP", "Lv Mana"), y, x + 35);
-
-       for (i = 0; i < MAX_SNIPE_POWERS; i++)
-       {
-               /* Access the available spell */
-               spell = snipe_powers[i];
-               if (spell.min_lev > plev) continue;
-
-               sprintf(psi_desc, "  %c) %-30s%2d %4d",
-                       I2A(i), spell.name, spell.min_lev, spell.mana_cost);
-
-               if (spell.mana_cost > (int)sniper_ptr->concent)
-                       term_putstr(x, y + i + 1, -1, TERM_SLATE, psi_desc);
-               else
-                       term_putstr(x, y + i + 1, -1, TERM_WHITE, psi_desc);
-       }
-       return;
+    int i;
+    TERM_LEN y = 1;
+    TERM_LEN x = 1;
+    PLAYER_LEVEL plev = sniper_ptr->lev;
+    snipe_power spell;
+    char psi_desc[80];
+
+    /* Display a list of spells */
+    prt("", y, x);
+    put_str(_("名前", "Name"), y, x + 5);
+    put_str(_("Lv   MP", "Lv Mana"), y, x + 35);
+
+    for (i = 0; i < MAX_SNIPE_POWERS; i++) {
+        /* Access the available spell */
+        spell = snipe_powers[i];
+        if (spell.min_lev > plev)
+            continue;
+
+        sprintf(psi_desc, "  %c) %-30s%2d %4d", I2A(i), spell.name, spell.min_lev, spell.mana_cost);
+
+        if (spell.mana_cost > (int)sniper_ptr->concent)
+            term_putstr(x, y + i + 1, -1, TERM_SLATE, psi_desc);
+        else
+            term_putstr(x, y + i + 1, -1, TERM_WHITE, psi_desc);
+    }
+    return;
 }
 
-
-/*! 
+/*!
  * @brief スナイパー技能を選択する
  * @param sn 選択した特殊技能ID、キャンセルの場合-1、不正な選択の場合-2を返す
  * @param only_browse 一覧を見るだけの場合TRUEを返す
@@ -231,179 +226,167 @@ void display_snipe_list(player_type *sniper_ptr)
  */
 static int get_snipe_power(player_type *sniper_ptr, COMMAND_CODE *sn, bool only_browse)
 {
-       COMMAND_CODE i;
-       int num = 0;
-       TERM_LEN y = 1;
-       TERM_LEN x = 20;
-       PLAYER_LEVEL plev = sniper_ptr->lev;
-       int ask;
-       char choice;
-       char out_val[160];
-       concptr p = _("射撃術", "power");
-       snipe_power spell;
-       bool flag, redraw;
-
-       repeat_push(*sn);
-
-       /* Assume cancelled */
-       *sn = (-1);
-
-       /* Repeat previous command */
-       /* Get the spell, if available */
-       if (repeat_pull(sn))
-       {
-               /* Verify the spell */
-               if ((snipe_powers[*sn].min_lev <= plev) && (snipe_powers[*sn].mana_cost <= (int)sniper_ptr->concent))
-               {
-                       /* Success */
-                       return TRUE;
-               }
-       }
-
-       flag = FALSE;
-       redraw = FALSE;
-
-       for (i = 0; i < MAX_SNIPE_POWERS; i++)
-       {
-               if ((snipe_powers[i].min_lev <= plev) &&
-                       ((only_browse) || (snipe_powers[i].mana_cost <= (int)sniper_ptr->concent)))
-               {
-                       num = i;
-               }
-       }
-
-       /* Build a prompt (accept all spells) */
-       if (only_browse)
-       {
-               (void)strnfmt(out_val, 78, 
-                                       _("(%^s %c-%c, '*'で一覧, ESC) どの%sについて知りますか?", "(%^ss %c-%c, *=List, ESC=exit) Use which %s? "),
-                                       p, I2A(0), I2A(num), p);
-       }
-       else
-       {
-               (void)strnfmt(out_val, 78, 
-                                       _("(%^s %c-%c, '*'で一覧, ESC) どの%sを使いますか?", "(%^ss %c-%c, *=List, ESC=exit) Use which %s? "),
-                                       p, I2A(0), I2A(num), p);
-       }
-
-       choice = always_show_list ? ESCAPE : 1;
-       while (!flag)
-       {
-               if(choice == ESCAPE) choice = ' ';
-               else if( !get_com(out_val, &choice, FALSE) )break; 
-
-               /* Request redraw */
-               if ((choice == ' ') || (choice == '*') || (choice == '?'))
-               {
-                       /* Show the list */
-                       if (!redraw)
-                       {
-                               char psi_index[6];
-                               char psi_desc[75];
-                               redraw = TRUE;
-                               if (!only_browse) screen_save();
-
-                               /* Display a list of spells */
-                               prt("", y, x);
-                               put_str(_("名前", "Name"), y, x + 5);
-                               put_str(_("Lv   集中度", "Lv Pow"), y, x + 35);
-
-                               /* Dump the spells */
-                               for (i = 0; i < MAX_SNIPE_POWERS; i++)
-                               {
-                                       term_color_type tcol = TERM_WHITE;
-                                       term_erase(x, y + i + 1, 255);
-
-                                       /* Access the spell */
-                                       spell = snipe_powers[i];
-
-                                       /* Dump the spell --(-- */
-                                       if (spell.min_lev > plev)
-                                               sprintf(psi_index, "   ) ");
-                                       else
-                                               sprintf(psi_index, "  %c) ", I2A(i));
-
-                                       sprintf(psi_desc, "%-30s%2d %4d",
-                                               spell.name,     spell.min_lev, spell.mana_cost);
-
-                                       if (spell.min_lev > plev)
-                                               tcol = TERM_SLATE;
-                                       else if (spell.mana_cost > (int)sniper_ptr->concent)
-                                               tcol = TERM_L_BLUE;
-
-                                       term_putstr(x, y + i + 1, -1, tcol, psi_index);
-                                       term_putstr(x + 5, y + i + 1, -1, tcol, psi_desc);
-                               }
-
-                               /* Clear the bottom line */
-                               prt("", y + i + 1, x);
-                       }
-
-                       /* Hide the list */
-                       else
-                       {
-                               /* Hide list */
-                               redraw = FALSE;
-                               if (!only_browse) screen_load();
-                       }
-
-                       /* Redo asking */
-                       continue;
-               }
-
-               /* Note verify */
-               ask = isupper(choice);
-
-               /* Lowercase */
-               if (ask) choice = (char)tolower(choice);
-
-               /* Extract request */
-               i = (islower(choice) ? A2I(choice) : -1);
-
-               /* Totally Illegal */
-               if ((i < 0) || (i > num) || 
-                       (!only_browse &&(snipe_powers[i].mana_cost > (int)sniper_ptr->concent)))
-               {
-                       bell();
-                       continue;
-               }
-
-               /* Save the spell index */
-               spell = snipe_powers[i];
-
-               /* Verify it */
-               if (ask)
-               {
-                       char tmp_val[160];
-
-                       /* Prompt */
-                       (void) strnfmt(tmp_val, 78, _("%sを使いますか?", "Use %s? "), snipe_powers[i].name);
-
-                       /* Belay that order */
-                       if (!get_check(tmp_val)) continue;
-               }
-
-               /* Stop the loop */
-               flag = TRUE;
-       }
-       if (redraw && !only_browse) screen_load();
-
-       sniper_ptr->window_flags |= (PW_SPELL);
-       handle_stuff(sniper_ptr);
-
-       /* Abort if needed */
-       if (!flag) return FALSE;
-
-       /* Save the choice */
-       (*sn) = i;
-
-       repeat_push(*sn);
-
-       /* Success */
-       return TRUE;
+    COMMAND_CODE i;
+    int num = 0;
+    TERM_LEN y = 1;
+    TERM_LEN x = 20;
+    PLAYER_LEVEL plev = sniper_ptr->lev;
+    int ask;
+    char choice;
+    char out_val[160];
+    concptr p = _("射撃術", "power");
+    snipe_power spell;
+    bool flag, redraw;
+
+    repeat_push(*sn);
+
+    /* Assume cancelled */
+    *sn = (-1);
+
+    /* Repeat previous command */
+    /* Get the spell, if available */
+    if (repeat_pull(sn)) {
+        /* Verify the spell */
+        if ((snipe_powers[*sn].min_lev <= plev) && (snipe_powers[*sn].mana_cost <= (int)sniper_ptr->concent)) {
+            /* Success */
+            return TRUE;
+        }
+    }
+
+    flag = FALSE;
+    redraw = FALSE;
+
+    for (i = 0; i < MAX_SNIPE_POWERS; i++) {
+        if ((snipe_powers[i].min_lev <= plev) && ((only_browse) || (snipe_powers[i].mana_cost <= (int)sniper_ptr->concent))) {
+            num = i;
+        }
+    }
+
+    /* Build a prompt (accept all spells) */
+    if (only_browse) {
+        (void)strnfmt(
+            out_val, 78, _("(%^s %c-%c, '*'で一覧, ESC) どの%sについて知りますか?", "(%^ss %c-%c, *=List, ESC=exit) Use which %s? "), p, I2A(0), I2A(num), p);
+    } else {
+        (void)strnfmt(
+            out_val, 78, _("(%^s %c-%c, '*'で一覧, ESC) どの%sを使いますか?", "(%^ss %c-%c, *=List, ESC=exit) Use which %s? "), p, I2A(0), I2A(num), p);
+    }
+
+    choice = always_show_list ? ESCAPE : 1;
+    while (!flag) {
+        if (choice == ESCAPE)
+            choice = ' ';
+        else if (!get_com(out_val, &choice, FALSE))
+            break;
+
+        /* Request redraw */
+        if ((choice == ' ') || (choice == '*') || (choice == '?')) {
+            /* Show the list */
+            if (!redraw) {
+                char psi_index[6];
+                char psi_desc[75];
+                redraw = TRUE;
+                if (!only_browse)
+                    screen_save();
+
+                /* Display a list of spells */
+                prt("", y, x);
+                put_str(_("名前", "Name"), y, x + 5);
+                put_str(_("Lv   集中度", "Lv Pow"), y, x + 35);
+
+                /* Dump the spells */
+                for (i = 0; i < MAX_SNIPE_POWERS; i++) {
+                    term_color_type tcol = TERM_WHITE;
+                    term_erase(x, y + i + 1, 255);
+
+                    /* Access the spell */
+                    spell = snipe_powers[i];
+
+                    /* Dump the spell --(-- */
+                    if (spell.min_lev > plev)
+                        sprintf(psi_index, "   ) ");
+                    else
+                        sprintf(psi_index, "  %c) ", I2A(i));
+
+                    sprintf(psi_desc, "%-30s%2d %4d", spell.name, spell.min_lev, spell.mana_cost);
+
+                    if (spell.min_lev > plev)
+                        tcol = TERM_SLATE;
+                    else if (spell.mana_cost > (int)sniper_ptr->concent)
+                        tcol = TERM_L_BLUE;
+
+                    term_putstr(x, y + i + 1, -1, tcol, psi_index);
+                    term_putstr(x + 5, y + i + 1, -1, tcol, psi_desc);
+                }
+
+                /* Clear the bottom line */
+                prt("", y + i + 1, x);
+            }
+
+            /* Hide the list */
+            else {
+                /* Hide list */
+                redraw = FALSE;
+                if (!only_browse)
+                    screen_load();
+            }
+
+            /* Redo asking */
+            continue;
+        }
+
+        /* Note verify */
+        ask = isupper(choice);
+
+        /* Lowercase */
+        if (ask)
+            choice = (char)tolower(choice);
+
+        /* Extract request */
+        i = (islower(choice) ? A2I(choice) : -1);
+
+        /* Totally Illegal */
+        if ((i < 0) || (i > num) || (!only_browse && (snipe_powers[i].mana_cost > (int)sniper_ptr->concent))) {
+            bell();
+            continue;
+        }
+
+        /* Save the spell index */
+        spell = snipe_powers[i];
+
+        /* Verify it */
+        if (ask) {
+            char tmp_val[160];
+
+            /* Prompt */
+            (void)strnfmt(tmp_val, 78, _("%sを使いますか?", "Use %s? "), snipe_powers[i].name);
+
+            /* Belay that order */
+            if (!get_check(tmp_val))
+                continue;
+        }
+
+        /* Stop the loop */
+        flag = TRUE;
+    }
+    if (redraw && !only_browse)
+        screen_load();
+
+    sniper_ptr->window_flags |= (PW_SPELL);
+    handle_stuff(sniper_ptr);
+
+    /* Abort if needed */
+    if (!flag)
+        return FALSE;
+
+    /* Save the choice */
+    (*sn) = i;
+
+    repeat_push(*sn);
+
+    /* Success */
+    return TRUE;
 }
 
-
 /*!
  * @brief スナイバー技能のスレイ倍率計算を行う /
  * Calcurate magnification of snipe technics
@@ -413,96 +396,96 @@ static int get_snipe_power(player_type *sniper_ptr, COMMAND_CODE *sn, bool only_
  */
 MULTIPLY calc_snipe_damage_with_slay(player_type *sniper_ptr, MULTIPLY mult, monster_type *m_ptr, SPELL_IDX snipe_type)
 {
-       monster_race *r_ptr = &r_info[m_ptr->r_idx];
-       bool seen = is_seen(sniper_ptr, m_ptr);
-
-       switch (snipe_type)
-       {
-       case SP_LITE:
-               if (r_ptr->flags3 & (RF3_HURT_LITE))
-               {
-                       MULTIPLY n = 20 + sniper_ptr->concent;
-                       if (seen) r_ptr->r_flags3 |= (RF3_HURT_LITE);
-                       if (mult < n) mult = n;
-               }
-               break;
-       case SP_FIRE:
-               if (r_ptr->flagsr & RFR_IM_FIRE)
-               {
-                       if (seen) r_ptr->r_flagsr |= RFR_IM_FIRE;
-               }
-               else
-               {
-                       MULTIPLY n = 15 + (sniper_ptr->concent * 3);
-                       if (mult < n) mult = n;
-               }
-               break;
-       case SP_COLD:
-               if (r_ptr->flagsr & RFR_IM_COLD)
-               {
-                       if (seen) r_ptr->r_flagsr |= RFR_IM_COLD;
-               }
-               else
-               {
-                       MULTIPLY n = 15 + (sniper_ptr->concent * 3);
-                       if (mult < n) mult = n;
-               }
-               break;
-       case SP_ELEC:
-               if (r_ptr->flagsr & RFR_IM_ELEC)
-               {
-                       if (seen) r_ptr->r_flagsr |= RFR_IM_ELEC;
-               }
-               else
-               {
-                       MULTIPLY n = 18 + (sniper_ptr->concent * 4);
-                       if (mult < n) mult = n;
-               }
-               break;
-       case SP_KILL_WALL:
-               if (r_ptr->flags3 & RF3_HURT_ROCK)
-               {
-                       MULTIPLY n = 15 + (sniper_ptr->concent * 2);
-                       if (seen) r_ptr->r_flags3 |= RF3_HURT_ROCK;
-                       if (mult < n) mult = n;
-               }
-               else if (r_ptr->flags3 & RF3_NONLIVING)
-               {
-                       MULTIPLY n = 15 + (sniper_ptr->concent * 2);
-                       if (seen) r_ptr->r_flags3 |= RF3_NONLIVING;
-                       if (mult < n) mult = n;
-               }
-               break;
-       case SP_EVILNESS:
-               if (r_ptr->flags3 & RF3_GOOD)
-               {
-                       MULTIPLY n = 15 + (sniper_ptr->concent * 4);
-                       if (seen) r_ptr->r_flags3 |= RF3_GOOD;
-                       if (mult < n) mult = n;
-               }
-               break;
-       case SP_HOLYNESS:
-               if (r_ptr->flags3 & RF3_EVIL)
-               {
-                       MULTIPLY n = 12 + (sniper_ptr->concent * 3);
-                       if (seen) r_ptr->r_flags3 |= RF3_EVIL;
-                       if (r_ptr->flags3 & (RF3_HURT_LITE))
-                       {
-                               n += (sniper_ptr->concent * 3);
-                               if (seen) r_ptr->r_flags3 |= (RF3_HURT_LITE);
-                       }
-                       if (mult < n) mult = n;
-               }
-               break;
-       case SP_FINAL:
-               if (mult < 50) mult = 50;
-               break;
-       }
-
-       return (mult);
+    monster_race *r_ptr = &r_info[m_ptr->r_idx];
+    bool seen = is_seen(sniper_ptr, m_ptr);
+
+    switch (snipe_type) {
+    case SP_LITE:
+        if (r_ptr->flags3 & (RF3_HURT_LITE)) {
+            MULTIPLY n = 20 + sniper_ptr->concent;
+            if (seen)
+                r_ptr->r_flags3 |= (RF3_HURT_LITE);
+            if (mult < n)
+                mult = n;
+        }
+        break;
+    case SP_FIRE:
+        if (r_ptr->flagsr & RFR_IM_FIRE) {
+            if (seen)
+                r_ptr->r_flagsr |= RFR_IM_FIRE;
+        } else {
+            MULTIPLY n = 15 + (sniper_ptr->concent * 3);
+            if (mult < n)
+                mult = n;
+        }
+        break;
+    case SP_COLD:
+        if (r_ptr->flagsr & RFR_IM_COLD) {
+            if (seen)
+                r_ptr->r_flagsr |= RFR_IM_COLD;
+        } else {
+            MULTIPLY n = 15 + (sniper_ptr->concent * 3);
+            if (mult < n)
+                mult = n;
+        }
+        break;
+    case SP_ELEC:
+        if (r_ptr->flagsr & RFR_IM_ELEC) {
+            if (seen)
+                r_ptr->r_flagsr |= RFR_IM_ELEC;
+        } else {
+            MULTIPLY n = 18 + (sniper_ptr->concent * 4);
+            if (mult < n)
+                mult = n;
+        }
+        break;
+    case SP_KILL_WALL:
+        if (r_ptr->flags3 & RF3_HURT_ROCK) {
+            MULTIPLY n = 15 + (sniper_ptr->concent * 2);
+            if (seen)
+                r_ptr->r_flags3 |= RF3_HURT_ROCK;
+            if (mult < n)
+                mult = n;
+        } else if (r_ptr->flags3 & RF3_NONLIVING) {
+            MULTIPLY n = 15 + (sniper_ptr->concent * 2);
+            if (seen)
+                r_ptr->r_flags3 |= RF3_NONLIVING;
+            if (mult < n)
+                mult = n;
+        }
+        break;
+    case SP_EVILNESS:
+        if (r_ptr->flags3 & RF3_GOOD) {
+            MULTIPLY n = 15 + (sniper_ptr->concent * 4);
+            if (seen)
+                r_ptr->r_flags3 |= RF3_GOOD;
+            if (mult < n)
+                mult = n;
+        }
+        break;
+    case SP_HOLYNESS:
+        if (r_ptr->flags3 & RF3_EVIL) {
+            MULTIPLY n = 12 + (sniper_ptr->concent * 3);
+            if (seen)
+                r_ptr->r_flags3 |= RF3_EVIL;
+            if (r_ptr->flags3 & (RF3_HURT_LITE)) {
+                n += (sniper_ptr->concent * 3);
+                if (seen)
+                    r_ptr->r_flags3 |= (RF3_HURT_LITE);
+            }
+            if (mult < n)
+                mult = n;
+        }
+        break;
+    case SP_FINAL:
+        if (mult < 50)
+            mult = 50;
+        break;
+    }
+
+    return (mult);
 }
 
-
 /*!
  * @brief スナイパー技能の発動 /
  * do_cmd_cast calls this function if the player's class is 'snipe'.
@@ -511,45 +494,74 @@ MULTIPLY calc_snipe_damage_with_slay(player_type *sniper_ptr, MULTIPLY mult, mon
  */
 static bool cast_sniper_spell(player_type *sniper_ptr, int spell)
 {
-       object_type *o_ptr = &sniper_ptr->inventory_list[INVEN_BOW];
-       SPELL_IDX snipe_type = SP_NONE;
-
-       if (o_ptr->tval != TV_BOW)
-       {
-               msg_print(_("弓を装備していない!", "You wield no bow!"));
-               return FALSE;
-       }
-
-       /* spell code */
-       switch (spell)
-       {
-       case 0: /* Concentration */
-               if (!snipe_concentrate(sniper_ptr)) return FALSE;
-               update_player_turn_energy(sniper_ptr, 100);
-               return TRUE;
-       case 1: snipe_type = SP_LITE; break;
-       case 2: snipe_type = SP_AWAY; break;
-       case 3: snipe_type = SP_KILL_TRAP; break;
-       case 4: snipe_type = SP_FIRE; break;
-       case 5: snipe_type = SP_KILL_WALL; break;
-       case 6: snipe_type = SP_COLD; break;
-       case 7: snipe_type = SP_RUSH; break;
-       case 8: snipe_type = SP_PIERCE; break;
-       case 9: snipe_type = SP_EVILNESS; break;
-       case 10: snipe_type = SP_HOLYNESS; break;
-       case 11: snipe_type = SP_EXPLODE; break;
-       case 12: snipe_type = SP_DOUBLE; break;
-       case 13: snipe_type = SP_ELEC; break;
-       case 14: snipe_type = SP_NEEDLE; break;
-       case 15: snipe_type = SP_FINAL; break;
-       default:
-               msg_print(_("なに?", "Zap?"));
-       }
-
-       command_cmd = 'f';
-       do_cmd_fire(sniper_ptr, snipe_type);
-
-       return (sniper_ptr->is_fired);
+    object_type *o_ptr = &sniper_ptr->inventory_list[INVEN_BOW];
+    SPELL_IDX snipe_type = SP_NONE;
+
+    if (o_ptr->tval != TV_BOW) {
+        msg_print(_("弓を装備していない!", "You wield no bow!"));
+        return FALSE;
+    }
+
+    /* spell code */
+    switch (spell) {
+    case 0: /* Concentration */
+        if (!snipe_concentrate(sniper_ptr))
+            return FALSE;
+        update_player_turn_energy(sniper_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
+        return TRUE;
+    case 1:
+        snipe_type = SP_LITE;
+        break;
+    case 2:
+        snipe_type = SP_AWAY;
+        break;
+    case 3:
+        snipe_type = SP_KILL_TRAP;
+        break;
+    case 4:
+        snipe_type = SP_FIRE;
+        break;
+    case 5:
+        snipe_type = SP_KILL_WALL;
+        break;
+    case 6:
+        snipe_type = SP_COLD;
+        break;
+    case 7:
+        snipe_type = SP_RUSH;
+        break;
+    case 8:
+        snipe_type = SP_PIERCE;
+        break;
+    case 9:
+        snipe_type = SP_EVILNESS;
+        break;
+    case 10:
+        snipe_type = SP_HOLYNESS;
+        break;
+    case 11:
+        snipe_type = SP_EXPLODE;
+        break;
+    case 12:
+        snipe_type = SP_DOUBLE;
+        break;
+    case 13:
+        snipe_type = SP_ELEC;
+        break;
+    case 14:
+        snipe_type = SP_NEEDLE;
+        break;
+    case 15:
+        snipe_type = SP_FINAL;
+        break;
+    default:
+        msg_print(_("なに?", "Zap?"));
+    }
+
+    command_cmd = 'f';
+    do_cmd_fire(sniper_ptr, snipe_type);
+
+    return (sniper_ptr->is_fired);
 }
 
 /*!
@@ -558,22 +570,27 @@ static bool cast_sniper_spell(player_type *sniper_ptr, int spell)
  */
 void do_cmd_snipe(player_type *sniper_ptr)
 {
-       COMMAND_CODE n = 0;
-       bool cast;
-
-       if(cmd_limit_confused(sniper_ptr)) return;
-       if(cmd_limit_image(sniper_ptr)) return;
-       if(cmd_limit_stun(sniper_ptr)) return;
-
-       if (!get_snipe_power(sniper_ptr, &n, FALSE)) return;
-
-       sound(SOUND_SHOOT);
-       cast = cast_sniper_spell(sniper_ptr, n);
-
-       if (!cast) return;
-       sniper_ptr->redraw |= (PR_HP | PR_MANA);
-       sniper_ptr->window_flags |= (PW_PLAYER);
-       sniper_ptr->window_flags |= (PW_SPELL);
+    COMMAND_CODE n = 0;
+    bool cast;
+
+    if (cmd_limit_confused(sniper_ptr))
+        return;
+    if (cmd_limit_image(sniper_ptr))
+        return;
+    if (cmd_limit_stun(sniper_ptr))
+        return;
+
+    if (!get_snipe_power(sniper_ptr, &n, FALSE))
+        return;
+
+    sound(SOUND_SHOOT);
+    cast = cast_sniper_spell(sniper_ptr, n);
+
+    if (!cast)
+        return;
+    sniper_ptr->redraw |= (PR_HP | PR_MANA);
+    sniper_ptr->window_flags |= (PW_PLAYER);
+    sniper_ptr->window_flags |= (PW_SPELL);
 }
 
 /*!
@@ -582,32 +599,29 @@ void do_cmd_snipe(player_type *sniper_ptr)
  */
 void do_cmd_snipe_browse(player_type *sniper_ptr)
 {
-       COMMAND_CODE n = 0;
-       int j, line;
-       char temp[62 * 4];
-
-       screen_save();
-
-       while (TRUE)
-       {
-               if (!get_snipe_power(sniper_ptr, &n, TRUE))
-               {
-                       screen_load();
-                       return;
-               }
-
-               /* Clear lines, position cursor  (really should use strlen here) */
-               term_erase(12, 22, 255);
-               term_erase(12, 21, 255);
-               term_erase(12, 20, 255);
-               term_erase(12, 19, 255);
-               term_erase(12, 18, 255);
-
-               shape_buffer(snipe_tips[n], 62, temp, sizeof(temp));
-               for(j = 0, line = 19; temp[j]; j += (1 + strlen(&temp[j])))
-               {
-                       prt(&temp[j], line, 15);
-                       line++;
-               }
-       }
+    COMMAND_CODE n = 0;
+    int j, line;
+    char temp[62 * 4];
+
+    screen_save();
+
+    while (TRUE) {
+        if (!get_snipe_power(sniper_ptr, &n, TRUE)) {
+            screen_load();
+            return;
+        }
+
+        /* Clear lines, position cursor  (really should use strlen here) */
+        term_erase(12, 22, 255);
+        term_erase(12, 21, 255);
+        term_erase(12, 20, 255);
+        term_erase(12, 19, 255);
+        term_erase(12, 18, 255);
+
+        shape_buffer(snipe_tips[n], 62, temp, sizeof(temp));
+        for (j = 0, line = 19; temp[j]; j += (1 + strlen(&temp[j]))) {
+            prt(&temp[j], line, 15);
+            line++;
+        }
+    }
 }
index 2a693ce..3bfd266 100644 (file)
@@ -97,7 +97,7 @@ bool decide_process_continue(player_type *target_ptr, monster_type *m_ptr);
  * level.  This should prevent the level from being "swamped" by\n
  * reproducing monsters.  It also allows a large mass of mice to\n
  * prevent a louse from multiplying, but this is a small price to\n
- * pay for a simple multiplication method.\n
+ * pay for a simple ENERGY_MULTIPLICATION method.\n
  *\n
  * XXX Monster fear is slightly odd, in particular, monsters will\n
  * fixate on opening a door even if they cannot open it.  Actually,\n
index f8d81d8..aa7828e 100644 (file)
@@ -133,7 +133,7 @@ HIT_POINT mon_damage_mod(player_type *target_ptr, monster_type *m_ptr, HIT_POINT
  * @details
  * <pre>
  * Even the 64 bit operation is not big enough to avoid overflaw
- * unless we carefully choose orders of multiplication and division.
+ * unless we carefully choose orders of ENERGY_MULTIPLICATION and ENERGY_DIVISION.
  * Get the coefficient first, and multiply (potentially huge) base
  * experience point of a monster later.
  * </pre>
@@ -176,7 +176,7 @@ static void get_exp_from_mon(player_type *target_ptr, HIT_POINT dam, monster_typ
     if (!target_ptr->current_floor_ptr->dun_level && (!(r_ptr->flags8 & RF8_WILD_ONLY) || !(r_ptr->flags1 & RF1_UNIQUE)))
         s64b_mul(&div_h, &div_l, 0, 5);
 
-    /* Do division first to prevent overflaw */
+    /* Do ENERGY_DIVISION first to prevent overflaw */
     s64b_div(&new_exp, &new_exp_frac, div_h, div_l);
 
     /* Special penalty for mutiply-monster */
index 896b802..1af8b0d 100644 (file)
@@ -15,7 +15,7 @@
  * @return 算出されたボーナス値
  * @details
  * To avoid floating point but still provide a smooth distribution of bonuses,\n
- * we simply round the results of division in such a way as to "average" the\n
+ * we simply round the results of ENERGY_DIVISION in such a way as to "average" the\n
  * correct floating point value.\n
  *\n
  * This function has been changed.  It uses "randnor()" to choose values from\n
index 7516568..b6eb9ce 100644 (file)
@@ -119,7 +119,7 @@ void exe_quaff_potion(player_type *creature_ptr, INVENTORY_IDX item)
     object_type forge;
     object_type *q_ptr;
 
-    update_player_turn_energy(creature_ptr, 100);
+    update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
 
     if (creature_ptr->timewalk) {
         if (flush_failure)
index 36db1eb..159e973 100644 (file)
@@ -84,7 +84,7 @@ void exe_read(player_type *creature_ptr, INVENTORY_IDX item, bool known)
     int k, used_up, ident, lev;
     object_type *o_ptr;
     o_ptr = ref_item(creature_ptr, item);
-    update_player_turn_energy(creature_ptr, 100);
+    update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
     if (cmd_limit_time_walk(creature_ptr))
         return;
 
index 2119f6d..64d1322 100644 (file)
@@ -8,10 +8,34 @@
 #include "player-status/player-energy.h"
 #include "system/player-type-definition.h"
 
-// todo 第3引数 (演算:代入、加算、減算、他)を導入する。enumを使う
-void update_player_turn_energy(player_type *creature_ptr, PERCENTAGE need_cost)
+/*
+ * @brief プレーヤーの行動エネルギーを更新する
+ * @param creature_ptr プレーヤーの参照ポインタ
+ * @param need_cost 行動エネルギー
+ * @param ut_type 現在値に対する演算方法
+ * @return なし
+ */
+void update_player_turn_energy(player_type *creature_ptr, ENERGY need_cost, update_turn_type ut_type)
 {
-    creature_ptr->energy_use = (ENERGY)need_cost;
+    switch (ut_type) {
+    case update_turn_type::ENERGY_SUBSTITUTION:
+        creature_ptr->energy_use = need_cost;
+        return;
+    case update_turn_type::ENERGY_ADDITION:
+        creature_ptr->energy_use += need_cost;
+        return;
+    case update_turn_type::ENERGY_SUBTRACTION:
+        creature_ptr->energy_use -= need_cost;
+        return;
+    case update_turn_type::ENERGY_MULTIPLICATION:
+        creature_ptr->energy_use *= need_cost;
+        return;
+    case update_turn_type::ENERGY_DIVISION:
+        creature_ptr->energy_use /= need_cost;
+        return;
+    default:
+        return;
+    }
 }
 
 /*
@@ -21,5 +45,5 @@ void update_player_turn_energy(player_type *creature_ptr, PERCENTAGE need_cost)
  */
 void reset_player_turn(player_type *creature_ptr)
 {
-    creature_ptr->energy_use = 0;
+    update_player_turn_energy(creature_ptr, 0, update_turn_type::ENERGY_SUBSTITUTION);
 }
index c28731b..dd5a462 100644 (file)
@@ -2,6 +2,14 @@
 
 #include "system/angband.h"
 
+enum class update_turn_type {
+    ENERGY_SUBSTITUTION,
+    ENERGY_ADDITION,
+    ENERGY_SUBTRACTION,
+    ENERGY_MULTIPLICATION,
+    ENERGY_DIVISION,
+};
+
 typedef struct player_type player_type;
-void update_player_turn_energy(player_type *creature_ptr, PERCENTAGE need_cost);
+void update_player_turn_energy(player_type *creature_ptr, ENERGY need_cost, update_turn_type ut_type);
 void reset_player_turn(player_type *creature_ptr);
index 641c3ab..521416d 100644 (file)
@@ -69,7 +69,7 @@ void set_action(player_type *creature_ptr, ACTION_IDX typ)
     }
     case ACTION_HAYAGAKE: {
         msg_print(_("足が重くなった。", "You are no longer walking extremely fast."));
-        update_player_turn_energy(creature_ptr, 100);
+        update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
         break;
     }
     case ACTION_SPELL: {
index 98c61fc..f204163 100644 (file)
@@ -197,7 +197,7 @@ void do_cmd_store(player_type *player_ptr)
     player_ptr->town_num = old_town_num;
 
     select_floor_music(player_ptr);
-    update_player_turn_energy(player_ptr, 100);
+    update_player_turn_energy(player_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
     current_world_ptr->character_icky_depth = 0;
     command_new = 0;
     command_see = FALSE;
index 7bae50c..503b5a2 100644 (file)
 #define BREAK_RUNE_PROTECTION       550     /*!< 守りのルーンの強靭度 / Rune of protection resistance */
 #define BREAK_RUNE_EXPLOSION 299     /*!< 爆発のルーンの発動しやすさ / For explosive runes */
 #define BTH_PLUS_ADJ      3       /*!< 武器経験値及びプレイヤーの打撃/射撃能力に応じた修正値倍率 / Adjust BTH per plus-to-hit */
-#define MON_MULT_ADJ      8       /*!< モンスターの増殖しにくさの基本倍率 / High value slows multiplication */
+#define MON_MULT_ADJ      8       /*!< モンスターの増殖しにくさの基本倍率 / High value slows ENERGY_MULTIPLICATION */
 #define MON_SUMMON_ADJ    2       /*!< 現在未使用 Adjust level of summoned creatures */
 #define MON_DRAIN_LIFE    2       /*!< モンスターの打撃によるプレイヤーの経験値吸収基本倍率(%) / Percent of player exp drained per hit */
 #define USE_DEVICE        3       /*!< 魔道具の最低失敗基準値 x> Harder devices x< Easier devices     */
index a828325..7d2b7c6 100644 (file)
@@ -171,7 +171,7 @@ void Rand_state_restore(u32b *backup_state)
 }
 
 /*
- * Extract a "random" number from 0 to m-1, via "division"
+ * Extract a "random" number from 0 to m-1, via "ENERGY_DIVISION"
  */
 static s32b Rand_div_impl(s32b m, u32b *state)
 {
index 78efbf4..15e9aeb 100644 (file)
@@ -271,7 +271,7 @@ void s64b_div(s32b *A1, u32b *A2, s32b B1, u32b B2)
 }
 
 
-/* Reminder of division (A % B) */
+/* Reminder of ENERGY_DIVISION (A % B) */
 void s64b_mod(s32b *A1, u32b *A2, s32b B1, u32b B2)
 {
        s32b tmp1 = (*A1);
index 01f529d..323ec4c 100644 (file)
@@ -219,7 +219,7 @@ void process_world(player_type *player_ptr)
                 player_ptr->oldpy = randint1(MAX_HGT - 2);
                 player_ptr->oldpx = randint1(MAX_WID - 2);
                 change_wild_mode(player_ptr, TRUE);
-                update_player_turn_energy(player_ptr, 100);
+                update_player_turn_energy(player_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
             }
 
             player_ptr->invoking_midnight_curse = TRUE;