OSDN Git Service

Merge branch 'Feature/Fix-Fall-Horse' into develop/3.0.0.1Alpha
[hengband/hengband.git] / src / combat / shoot.c
index eff9b26..e41feaf 100644 (file)
@@ -1,19 +1,19 @@
 #include "combat/shoot.h"
-#include "art-definition/art-bow-types.h"
+#include "artifact/fixed-art-types.h"
 #include "core/player-redraw-types.h"
 #include "core/player-update-types.h"
 #include "core/stuff-handler.h"
 #include "effect/effect-characteristics.h"
+#include "effect/effect-processor.h"
 #include "effect/spells-effect-util.h"
 #include "flavor/flavor-describer.h"
 #include "flavor/object-flavor-types.h"
 #include "floor/cave.h"
 #include "floor/floor-object.h"
-#include "floor/floor.h"
 #include "game-option/cheat-types.h"
 #include "game-option/special-options.h"
-#include "grid/feature.h"
 #include "grid/feature-flag-types.h"
+#include "grid/feature.h"
 #include "grid/grid.h"
 #include "inventory/inventory-object.h"
 #include "inventory/inventory-slot-types.h"
@@ -34,6 +34,7 @@
 #include "monster-race/race-indice-types.h"
 #include "monster/monster-describer.h"
 #include "monster/monster-info.h"
+#include "monster/monster-status-setter.h"
 #include "monster/monster-status.h"
 #include "monster/monster-update.h"
 #include "object-enchant/tr-types.h"
 #include "object/object-info.h"
 #include "object/object-kind.h"
 #include "object/object-mark-types.h"
-#include "player/avatar.h"
+#include "player-info/avatar.h"
 #include "player/player-class.h"
 #include "player/player-personalities-types.h"
 #include "player/player-skill.h"
+#include "player/player-status-table.h"
 #include "player/player-status.h"
-#include "spell/process-effect.h"
 #include "spell/spell-types.h"
 #include "sv-definition/sv-bow-types.h"
 #include "system/artifact-type-definition.h"
 #include "system/floor-type-definition.h"
+#include "target/projection-path-calculator.h"
 #include "target/target-checker.h"
 #include "target/target-getter.h"
 #include "util/bit-flags-calculator.h"
@@ -83,7 +85,7 @@ static MULTIPLY calc_shot_damage_with_slay(player_type *sniper_ptr, object_type
     case TV_SHOT:
     case TV_ARROW:
     case TV_BOLT: {
-        if ((have_flag(flgs, TR_SLAY_ANIMAL)) && (r_ptr->flags3 & RF3_ANIMAL)) {
+        if ((has_flag(flgs, TR_SLAY_ANIMAL)) && (r_ptr->flags3 & RF3_ANIMAL)) {
             if (is_original_ap_and_seen(sniper_ptr, m_ptr)) {
                 r_ptr->r_flags3 |= RF3_ANIMAL;
             }
@@ -91,7 +93,7 @@ static MULTIPLY calc_shot_damage_with_slay(player_type *sniper_ptr, object_type
                 mult = 17;
         }
 
-        if ((have_flag(flgs, TR_KILL_ANIMAL)) && (r_ptr->flags3 & RF3_ANIMAL)) {
+        if ((has_flag(flgs, TR_KILL_ANIMAL)) && (r_ptr->flags3 & RF3_ANIMAL)) {
             if (is_original_ap_and_seen(sniper_ptr, m_ptr)) {
                 r_ptr->r_flags3 |= RF3_ANIMAL;
             }
@@ -99,7 +101,7 @@ static MULTIPLY calc_shot_damage_with_slay(player_type *sniper_ptr, object_type
                 mult = 27;
         }
 
-        if ((have_flag(flgs, TR_SLAY_EVIL)) && (r_ptr->flags3 & RF3_EVIL)) {
+        if ((has_flag(flgs, TR_SLAY_EVIL)) && (r_ptr->flags3 & RF3_EVIL)) {
             if (is_original_ap_and_seen(sniper_ptr, m_ptr)) {
                 r_ptr->r_flags3 |= RF3_EVIL;
             }
@@ -107,7 +109,7 @@ static MULTIPLY calc_shot_damage_with_slay(player_type *sniper_ptr, object_type
                 mult = 15;
         }
 
-        if ((have_flag(flgs, TR_KILL_EVIL)) && (r_ptr->flags3 & RF3_EVIL)) {
+        if ((has_flag(flgs, TR_KILL_EVIL)) && (r_ptr->flags3 & RF3_EVIL)) {
             if (is_original_ap_and_seen(sniper_ptr, m_ptr)) {
                 r_ptr->r_flags3 |= RF3_EVIL;
             }
@@ -115,7 +117,7 @@ static MULTIPLY calc_shot_damage_with_slay(player_type *sniper_ptr, object_type
                 mult = 25;
         }
 
-        if ((have_flag(flgs, TR_SLAY_HUMAN)) && (r_ptr->flags2 & RF2_HUMAN)) {
+        if ((has_flag(flgs, TR_SLAY_HUMAN)) && (r_ptr->flags2 & RF2_HUMAN)) {
             if (is_original_ap_and_seen(sniper_ptr, m_ptr)) {
                 r_ptr->r_flags2 |= RF2_HUMAN;
             }
@@ -123,7 +125,7 @@ static MULTIPLY calc_shot_damage_with_slay(player_type *sniper_ptr, object_type
                 mult = 17;
         }
 
-        if ((have_flag(flgs, TR_KILL_HUMAN)) && (r_ptr->flags2 & RF2_HUMAN)) {
+        if ((has_flag(flgs, TR_KILL_HUMAN)) && (r_ptr->flags2 & RF2_HUMAN)) {
             if (is_original_ap_and_seen(sniper_ptr, m_ptr)) {
                 r_ptr->r_flags2 |= RF2_HUMAN;
             }
@@ -131,7 +133,7 @@ static MULTIPLY calc_shot_damage_with_slay(player_type *sniper_ptr, object_type
                 mult = 27;
         }
 
-        if ((have_flag(flgs, TR_SLAY_UNDEAD)) && (r_ptr->flags3 & RF3_UNDEAD)) {
+        if ((has_flag(flgs, TR_SLAY_UNDEAD)) && (r_ptr->flags3 & RF3_UNDEAD)) {
             if (is_original_ap_and_seen(sniper_ptr, m_ptr)) {
                 r_ptr->r_flags3 |= RF3_UNDEAD;
             }
@@ -139,7 +141,7 @@ static MULTIPLY calc_shot_damage_with_slay(player_type *sniper_ptr, object_type
                 mult = 20;
         }
 
-        if ((have_flag(flgs, TR_KILL_UNDEAD)) && (r_ptr->flags3 & RF3_UNDEAD)) {
+        if ((has_flag(flgs, TR_KILL_UNDEAD)) && (r_ptr->flags3 & RF3_UNDEAD)) {
             if (is_original_ap_and_seen(sniper_ptr, m_ptr)) {
                 r_ptr->r_flags3 |= RF3_UNDEAD;
             }
@@ -147,7 +149,7 @@ static MULTIPLY calc_shot_damage_with_slay(player_type *sniper_ptr, object_type
                 mult = 30;
         }
 
-        if ((have_flag(flgs, TR_SLAY_DEMON)) && (r_ptr->flags3 & RF3_DEMON)) {
+        if ((has_flag(flgs, TR_SLAY_DEMON)) && (r_ptr->flags3 & RF3_DEMON)) {
             if (is_original_ap_and_seen(sniper_ptr, m_ptr)) {
                 r_ptr->r_flags3 |= RF3_DEMON;
             }
@@ -155,7 +157,7 @@ static MULTIPLY calc_shot_damage_with_slay(player_type *sniper_ptr, object_type
                 mult = 20;
         }
 
-        if ((have_flag(flgs, TR_KILL_DEMON)) && (r_ptr->flags3 & RF3_DEMON)) {
+        if ((has_flag(flgs, TR_KILL_DEMON)) && (r_ptr->flags3 & RF3_DEMON)) {
             if (is_original_ap_and_seen(sniper_ptr, m_ptr)) {
                 r_ptr->r_flags3 |= RF3_DEMON;
             }
@@ -163,7 +165,7 @@ static MULTIPLY calc_shot_damage_with_slay(player_type *sniper_ptr, object_type
                 mult = 30;
         }
 
-        if ((have_flag(flgs, TR_SLAY_ORC)) && (r_ptr->flags3 & RF3_ORC)) {
+        if ((has_flag(flgs, TR_SLAY_ORC)) && (r_ptr->flags3 & RF3_ORC)) {
             if (is_original_ap_and_seen(sniper_ptr, m_ptr)) {
                 r_ptr->r_flags3 |= RF3_ORC;
             }
@@ -171,7 +173,7 @@ static MULTIPLY calc_shot_damage_with_slay(player_type *sniper_ptr, object_type
                 mult = 20;
         }
 
-        if ((have_flag(flgs, TR_KILL_ORC)) && (r_ptr->flags3 & RF3_ORC)) {
+        if ((has_flag(flgs, TR_KILL_ORC)) && (r_ptr->flags3 & RF3_ORC)) {
             if (is_original_ap_and_seen(sniper_ptr, m_ptr)) {
                 r_ptr->r_flags3 |= RF3_ORC;
             }
@@ -179,7 +181,7 @@ static MULTIPLY calc_shot_damage_with_slay(player_type *sniper_ptr, object_type
                 mult = 30;
         }
 
-        if ((have_flag(flgs, TR_SLAY_TROLL)) && (r_ptr->flags3 & RF3_TROLL)) {
+        if ((has_flag(flgs, TR_SLAY_TROLL)) && (r_ptr->flags3 & RF3_TROLL)) {
             if (is_original_ap_and_seen(sniper_ptr, m_ptr)) {
                 r_ptr->r_flags3 |= RF3_TROLL;
             }
@@ -188,7 +190,7 @@ static MULTIPLY calc_shot_damage_with_slay(player_type *sniper_ptr, object_type
                 mult = 20;
         }
 
-        if ((have_flag(flgs, TR_KILL_TROLL)) && (r_ptr->flags3 & RF3_TROLL)) {
+        if ((has_flag(flgs, TR_KILL_TROLL)) && (r_ptr->flags3 & RF3_TROLL)) {
             if (is_original_ap_and_seen(sniper_ptr, m_ptr)) {
                 r_ptr->r_flags3 |= RF3_TROLL;
             }
@@ -196,7 +198,7 @@ static MULTIPLY calc_shot_damage_with_slay(player_type *sniper_ptr, object_type
                 mult = 30;
         }
 
-        if ((have_flag(flgs, TR_SLAY_GIANT)) && (r_ptr->flags3 & RF3_GIANT)) {
+        if ((has_flag(flgs, TR_SLAY_GIANT)) && (r_ptr->flags3 & RF3_GIANT)) {
             if (is_original_ap_and_seen(sniper_ptr, m_ptr)) {
                 r_ptr->r_flags3 |= RF3_GIANT;
             }
@@ -204,7 +206,7 @@ static MULTIPLY calc_shot_damage_with_slay(player_type *sniper_ptr, object_type
                 mult = 20;
         }
 
-        if ((have_flag(flgs, TR_KILL_GIANT)) && (r_ptr->flags3 & RF3_GIANT)) {
+        if ((has_flag(flgs, TR_KILL_GIANT)) && (r_ptr->flags3 & RF3_GIANT)) {
             if (is_original_ap_and_seen(sniper_ptr, m_ptr)) {
                 r_ptr->r_flags3 |= RF3_GIANT;
             }
@@ -212,7 +214,7 @@ static MULTIPLY calc_shot_damage_with_slay(player_type *sniper_ptr, object_type
                 mult = 30;
         }
 
-        if ((have_flag(flgs, TR_SLAY_DRAGON)) && (r_ptr->flags3 & RF3_DRAGON)) {
+        if ((has_flag(flgs, TR_SLAY_DRAGON)) && (r_ptr->flags3 & RF3_DRAGON)) {
             if (is_original_ap_and_seen(sniper_ptr, m_ptr)) {
                 r_ptr->r_flags3 |= RF3_DRAGON;
             }
@@ -220,7 +222,7 @@ static MULTIPLY calc_shot_damage_with_slay(player_type *sniper_ptr, object_type
                 mult = 20;
         }
 
-        if ((have_flag(flgs, TR_KILL_DRAGON)) && (r_ptr->flags3 & RF3_DRAGON)) {
+        if ((has_flag(flgs, TR_KILL_DRAGON)) && (r_ptr->flags3 & RF3_DRAGON)) {
             if (is_original_ap_and_seen(sniper_ptr, m_ptr)) {
                 r_ptr->r_flags3 |= RF3_DRAGON;
             }
@@ -230,7 +232,7 @@ static MULTIPLY calc_shot_damage_with_slay(player_type *sniper_ptr, object_type
                 mult *= 5;
         }
 
-        if (have_flag(flgs, TR_BRAND_ACID)) {
+        if (has_flag(flgs, TR_BRAND_ACID)) {
             /* Notice immunity */
             if (r_ptr->flagsr & RFR_EFF_IM_ACID_MASK) {
                 if (is_original_ap_and_seen(sniper_ptr, m_ptr)) {
@@ -242,7 +244,7 @@ static MULTIPLY calc_shot_damage_with_slay(player_type *sniper_ptr, object_type
             }
         }
 
-        if (have_flag(flgs, TR_BRAND_ELEC)) {
+        if (has_flag(flgs, TR_BRAND_ELEC)) {
             /* Notice immunity */
             if (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK) {
                 if (is_original_ap_and_seen(sniper_ptr, m_ptr)) {
@@ -254,7 +256,7 @@ static MULTIPLY calc_shot_damage_with_slay(player_type *sniper_ptr, object_type
             }
         }
 
-        if (have_flag(flgs, TR_BRAND_FIRE)) {
+        if (has_flag(flgs, TR_BRAND_FIRE)) {
             /* Notice immunity */
             if (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK) {
                 if (is_original_ap_and_seen(sniper_ptr, m_ptr)) {
@@ -274,7 +276,7 @@ static MULTIPLY calc_shot_damage_with_slay(player_type *sniper_ptr, object_type
             }
         }
 
-        if (have_flag(flgs, TR_BRAND_COLD)) {
+        if (has_flag(flgs, TR_BRAND_COLD)) {
             /* Notice immunity */
             if (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK) {
                 if (is_original_ap_and_seen(sniper_ptr, m_ptr)) {
@@ -294,7 +296,7 @@ static MULTIPLY calc_shot_damage_with_slay(player_type *sniper_ptr, object_type
             }
         }
 
-        if (have_flag(flgs, TR_BRAND_POIS)) {
+        if (has_flag(flgs, TR_BRAND_POIS)) {
             /* Notice immunity */
             if (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK) {
                 if (is_original_ap_and_seen(sniper_ptr, m_ptr)) {
@@ -308,7 +310,7 @@ static MULTIPLY calc_shot_damage_with_slay(player_type *sniper_ptr, object_type
             }
         }
 
-        if ((have_flag(flgs, TR_FORCE_WEAPON)) && (sniper_ptr->csp > (sniper_ptr->msp / 30))) {
+        if ((has_flag(flgs, TR_FORCE_WEAPON)) && (sniper_ptr->csp > (sniper_ptr->msp / 30))) {
             sniper_ptr->csp -= (1 + (sniper_ptr->msp / 30));
             sniper_ptr->redraw |= (PR_MANA);
             mult = mult * 5 / 2;
@@ -451,7 +453,7 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr,
     }
 
     /* Get projection path length */
-    tdis = project_path(shooter_ptr, path_g, project_length, shooter_ptr->y, shooter_ptr->x, ty, tx, PROJECT_PATH | PROJECT_THRU) - 1;
+    tdis = projection_path(shooter_ptr, path_g, project_length, shooter_ptr->y, shooter_ptr->x, ty, tx, PROJECT_PATH | PROJECT_THRU) - 1;
 
     project_length = 0; /* reset to default */
 
@@ -512,7 +514,7 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr,
             if (snipe_type == SP_KILL_WALL) {
                 g_ptr = &shooter_ptr->current_floor_ptr->grid_array[ny][nx];
 
-                if (cave_have_flag_grid(g_ptr, FF_HURT_ROCK) && !g_ptr->m_idx) {
+                if (cave_has_flag_grid(g_ptr, FF_HURT_ROCK) && !g_ptr->m_idx) {
                     if (g_ptr->info & (CAVE_MARK))
                         msg_print(_("岩が砕け散った。", "Wall rocks were shattered."));
                     /* Forget the wall */
@@ -528,7 +530,7 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr,
             }
 
             /* Stopped by walls/doors */
-            if (!cave_have_flag_bold(shooter_ptr->current_floor_ptr, ny, nx, FF_PROJECT) && !shooter_ptr->current_floor_ptr->grid_array[ny][nx].m_idx)
+            if (!cave_has_flag_bold(shooter_ptr->current_floor_ptr, ny, nx, FF_PROJECT) && !shooter_ptr->current_floor_ptr->grid_array[ny][nx].m_idx)
                 break;
 
             /* Advance the distance */
@@ -830,7 +832,7 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr,
 
             /* Carry object */
             m_ptr->hold_o_idx = o_idx;
-        } else if (cave_have_flag_bold(shooter_ptr->current_floor_ptr, y, x, FF_PROJECT)) {
+        } else if (cave_has_flag_bold(shooter_ptr->current_floor_ptr, y, x, FF_PROJECT)) {
             /* Drop (or break) near that location */
             (void)drop_near(shooter_ptr, q_ptr, j, y, x);
         } else {