OSDN Git Service

Merge pull request #972 from habu1010/feature/list-for-item-stack
[hengbandforosx/hengbandosx.git] / src / player / player-damage.cpp
index 5f05c20..254d2a7 100644 (file)
@@ -8,6 +8,7 @@
 #include "core/player-update-types.h"
 #include "core/stuff-handler.h"
 #include "core/window-redrawer.h"
+#include "dungeon/dungeon.h"
 #include "dungeon/quest.h"
 #include "flavor/flavor-describer.h"
 #include "flavor/object-flavor-types.h"
 #include "object/object-flags.h"
 #include "player-info/avatar.h"
 #include "player/player-class.h"
-#include "player/player-personalities-types.h"
+#include "player/player-personality-types.h"
 #include "player/player-race-types.h"
 #include "player/player-status-flags.h"
 #include "player/player-status-resist.h"
+#include "player/player-status.h"
 #include "player/race-info-table.h"
 #include "player/special-defense-types.h"
 #include "racial/racial-android.h"
 #include "status/element-resistance.h"
 #include "system/building-type-definition.h"
 #include "system/floor-type-definition.h"
+#include "system/monster-race-definition.h"
+#include "system/monster-type-definition.h"
+#include "system/object-type-definition.h"
+#include "system/player-type-definition.h"
 #include "term/screen-processor.h"
 #include "term/term-color-types.h"
 #include "util/bit-flags-calculator.h"
@@ -135,7 +141,7 @@ static bool acid_minus_ac(player_type *creature_ptr)
  * @return 修正HPダメージ量
  * @details 酸オーラは存在しないが関数ポインタのために引数だけは用意している
  */
-HIT_POINT acid_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, int monspell, bool aura)
+HIT_POINT acid_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, bool aura)
 {
     int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
     bool double_resist = is_oppose_acid(creature_ptr);
@@ -151,7 +157,7 @@ HIT_POINT acid_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, int
             dam = (dam + 1) / 2;
     }
 
-    HIT_POINT get_damage = take_hit(creature_ptr, aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell);
+    HIT_POINT get_damage = take_hit(creature_ptr, aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str);
     if (!aura && !(double_resist && has_resist_acid(creature_ptr)))
         inventory_damage(creature_ptr, set_acid_destroy, inv);
 
@@ -168,7 +174,7 @@ HIT_POINT acid_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, int
  * @param aura オーラよるダメージが原因ならばTRUE
  * @return 修正HPダメージ量
  */
-HIT_POINT elec_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, int monspell, bool aura)
+HIT_POINT elec_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, bool aura)
 {
     int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
     bool double_resist = is_oppose_elec(creature_ptr);
@@ -183,7 +189,7 @@ HIT_POINT elec_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, int
             (void)do_dec_stat(creature_ptr, A_DEX);
     }
 
-    HIT_POINT get_damage = take_hit(creature_ptr, aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell);
+    HIT_POINT get_damage = take_hit(creature_ptr, aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str);
     if (!aura && !(double_resist && has_resist_elec(creature_ptr)))
         inventory_damage(creature_ptr, set_elec_destroy, inv);
 
@@ -200,7 +206,7 @@ HIT_POINT elec_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, int
  * @param aura オーラよるダメージが原因ならばTRUE
  * @return 修正HPダメージ量
  */
-HIT_POINT fire_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, int monspell, bool aura)
+HIT_POINT fire_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, bool aura)
 {
     int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
     bool double_resist = is_oppose_fire(creature_ptr);
@@ -215,7 +221,7 @@ HIT_POINT fire_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, int
             (void)do_dec_stat(creature_ptr, A_STR);
     }
 
-    HIT_POINT get_damage = take_hit(creature_ptr, aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell);
+    HIT_POINT get_damage = take_hit(creature_ptr, aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str);
     if (!aura && !(double_resist && has_resist_fire(creature_ptr)))
         inventory_damage(creature_ptr, set_fire_destroy, inv);
 
@@ -232,7 +238,7 @@ HIT_POINT fire_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, int
  * @param aura オーラよるダメージが原因ならばTRUE
  * @return 修正HPダメージ量
  */
-HIT_POINT cold_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, int monspell, bool aura)
+HIT_POINT cold_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, bool aura)
 {
     int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
     bool double_resist = is_oppose_cold(creature_ptr);
@@ -245,7 +251,7 @@ HIT_POINT cold_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, int
             (void)do_dec_stat(creature_ptr, A_STR);
     }
 
-    HIT_POINT get_damage = take_hit(creature_ptr, aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell);
+    HIT_POINT get_damage = take_hit(creature_ptr, aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str);
     if (!aura && !(double_resist && has_resist_cold(creature_ptr)))
         inventory_damage(creature_ptr, set_cold_destroy, inv);
 
@@ -261,10 +267,8 @@ HIT_POINT cold_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, int
  * the game when he dies, since the "You die." message is shown before
  * setting the player to "dead".
  */
-int take_hit(player_type *creature_ptr, int damage_type, HIT_POINT damage, concptr hit_from, int monspell)
+int take_hit(player_type *creature_ptr, int damage_type, HIT_POINT damage, concptr hit_from)
 {
-    (void)monspell; // unused
-
     int old_chp = creature_ptr->chp;
 
     char death_message[1024];
@@ -370,7 +374,7 @@ int take_hit(player_type *creature_ptr, int damage_type, HIT_POINT damage, concp
             play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_GAMEOVER);
 
 #ifdef WORLD_SCORE
-            screen_dump = make_screen_dump(creature_ptr, process_autopick_file_command);
+            screen_dump = make_screen_dump(creature_ptr);
 #endif
             if (seppuku) {
                 strcpy(creature_ptr->died_from, hit_from);
@@ -391,6 +395,7 @@ int take_hit(player_type *creature_ptr, int damage_type, HIT_POINT damage, concp
 
             current_world_ptr->total_winner = FALSE;
             if (winning_seppuku) {
+                add_retired_class(creature_ptr->pclass);
                 exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 0, _("勝利の後切腹した。", "committed seppuku after the winning."));
             } else {
                 char buf[20];
@@ -412,7 +417,7 @@ int take_hit(player_type *creature_ptr, int damage_type, HIT_POINT damage, concp
             exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 1, "\n\n\n\n");
             flush();
             if (get_check_strict(creature_ptr, _("画面を保存しますか?", "Dump the screen? "), CHECK_NO_HISTORY))
-                do_cmd_save_screen(creature_ptr, process_autopick_file_command);
+                do_cmd_save_screen(creature_ptr);
 
             flush();
             if (creature_ptr->last_message)
@@ -499,7 +504,7 @@ int take_hit(player_type *creature_ptr, int damage_type, HIT_POINT damage, concp
                     term_putstr(w - 1, h - 1, 1, TERM_WHITE, " ");
                     flush();
 #ifdef WORLD_SCORE
-                    screen_dump = make_screen_dump(creature_ptr, process_autopick_file_command);
+                    screen_dump = make_screen_dump(creature_ptr);
 #endif
                     (void)inkey();
                 } else
@@ -548,10 +553,9 @@ int take_hit(player_type *creature_ptr, int damage_type, HIT_POINT damage, concp
  * @param aura_flag オーラフラグ配列
  * @param dam_func ダメージ処理を行う関数の参照ポインタ
  * @param message オーラダメージを受けた際のメッセージ
- * @return なし
  */
 static void process_aura_damage(monster_type *m_ptr, player_type *touched_ptr, bool immune, int flags_offset, int r_flags_offset, u32b aura_flag,
-    HIT_POINT (*dam_func)(player_type *creature_type, HIT_POINT dam, concptr kb_str, int monspell, bool aura), concptr message)
+    HIT_POINT (*dam_func)(player_type *creature_type, HIT_POINT dam, concptr kb_str, bool aura), concptr message)
 {
     monster_race *r_ptr = &r_info[m_ptr->r_idx];
     if (!(atoffset(BIT_FLAGS, r_ptr, flags_offset) & aura_flag) || immune)
@@ -562,7 +566,7 @@ static void process_aura_damage(monster_type *m_ptr, player_type *touched_ptr, b
 
     monster_desc(touched_ptr, mon_name, m_ptr, MD_WRONGDOER_NAME);
     msg_print(message);
-    dam_func(touched_ptr, aura_damage, mon_name, -1, TRUE);
+    dam_func(touched_ptr, aura_damage, mon_name, TRUE);
 
     if (is_original_ap_and_seen(touched_ptr, m_ptr))
         atoffset(BIT_FLAGS, r_ptr, r_flags_offset) |= aura_flag;
@@ -574,7 +578,6 @@ static void process_aura_damage(monster_type *m_ptr, player_type *touched_ptr, b
  * @brief 敵オーラによるプレイヤーのダメージ処理
  * @param m_ptr オーラを持つモンスターの構造体参照ポインタ
  * @param touched_ptr オーラを持つ相手に振れたクリーチャーの参照ポインタ
- * @return なし
  */
 void touch_zap_player(monster_type *m_ptr, player_type *touched_ptr)
 {