From db87c46ed7b7f995bd1d157aec82d481c853d258 Mon Sep 17 00:00:00 2001 From: deskull Date: Mon, 8 Jul 2019 22:39:33 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#38997=20take=5Fhit()=20=E3=81=AB?= =?utf8?q?=20player=5Ftype=20*=20=E5=BC=95=E6=95=B0=E3=82=92=E8=BF=BD?= =?utf8?q?=E5=8A=A0=EF=BC=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/chest.c | 8 ++--- src/cmd-activate.c | 4 +-- src/cmd-eat.c | 12 +++---- src/cmd-pet.c | 4 +-- src/cmd-quaff.c | 4 +-- src/cmd-read.c | 6 ++-- src/cmd-spell.c | 2 +- src/core.c | 52 ++++++++++++++--------------- src/melee1.c | 62 +++++++++++++++++------------------ src/mind.c | 4 +-- src/mspells4.c | 2 +- src/mutation.c | 2 +- src/patron.c | 4 +-- src/player-damage.c | 92 ++++++++++++++++++++++++++-------------------------- src/player-damage.h | 2 +- src/player-effects.c | 4 +-- src/player-status.c | 2 +- src/racial.c | 2 +- src/realm-daemon.c | 2 +- src/realm-death.c | 2 +- src/realm-hissatsu.c | 6 ++-- src/realm-nature.c | 4 +-- src/spells-floor.c | 2 +- src/spells-object.c | 4 +-- src/spells1.c | 74 +++++++++++++++++++++--------------------- src/spells2.c | 10 +++--- src/spells3.c | 4 +-- src/trap.c | 6 ++-- 28 files changed, 191 insertions(+), 191 deletions(-) diff --git a/src/chest.c b/src/chest.c index 08b0494f8..b1a12daea 100644 --- a/src/chest.c +++ b/src/chest.c @@ -154,7 +154,7 @@ void chest_trap(POSITION y, POSITION x, OBJECT_IDX o_idx) if (trap & (CHEST_LOSE_STR)) { msg_print(_("仕掛けられていた小さな針に刺されてしまった!", "A small needle has pricked you!")); - take_hit(DAMAGE_NOESCAPE, damroll(1, 4), _("毒針", "a poison needle"), -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, damroll(1, 4), _("毒針", "a poison needle"), -1); (void)do_dec_stat(p_ptr, A_STR); } @@ -162,7 +162,7 @@ void chest_trap(POSITION y, POSITION x, OBJECT_IDX o_idx) if (trap & (CHEST_LOSE_CON)) { msg_print(_("仕掛けられていた小さな針に刺されてしまった!", "A small needle has pricked you!")); - take_hit(DAMAGE_NOESCAPE, damroll(1, 4), _("毒針", "a poison needle"), -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, damroll(1, 4), _("毒針", "a poison needle"), -1); (void)do_dec_stat(p_ptr, A_CON); } @@ -282,7 +282,7 @@ void chest_trap(POSITION y, POSITION x, OBJECT_IDX o_idx) /* ...but a high saving throw does help a little. */ if (randint1(100 + o_ptr->pval * 2) > p_ptr->skill_sav) { - if (one_in_(6)) take_hit(DAMAGE_NOESCAPE, damroll(5, 20), _("破滅のトラップの宝箱", "a chest dispel-player trap"), -1); + if (one_in_(6)) take_hit(p_ptr, DAMAGE_NOESCAPE, damroll(5, 20), _("破滅のトラップの宝箱", "a chest dispel-player trap"), -1); else if (one_in_(5)) (void)set_cut(p_ptr,p_ptr->cut + 200); else if (one_in_(4)) { @@ -322,7 +322,7 @@ void chest_trap(POSITION y, POSITION x, OBJECT_IDX o_idx) msg_print(_("箱の中の物はすべて粉々に砕け散った!", "Everything inside the chest is destroyed!")); o_ptr->pval = 0; sound(SOUND_EXPLODE); - take_hit(DAMAGE_ATTACK, damroll(5, 8), _("爆発する箱", "an exploding chest"), -1); + take_hit(p_ptr, DAMAGE_ATTACK, damroll(5, 8), _("爆発する箱", "an exploding chest"), -1); } /* Scatter contents. */ if ((trap & (CHEST_SCATTER)) && o_ptr->k_idx) diff --git a/src/cmd-activate.c b/src/cmd-activate.c index 04d6306d4..15e58d15f 100644 --- a/src/cmd-activate.c +++ b/src/cmd-activate.c @@ -1562,7 +1562,7 @@ bool activate_artifact(object_type *o_ptr) wiz_lite(FALSE); msg_format(_("%sはあなたの体力を奪った...", "The %s drains your vitality..."), name); - take_hit(DAMAGE_LOSELIFE, damroll(3, 8), _("審判の宝石", "the Jewel of Judgement"), -1); + take_hit(p_ptr, DAMAGE_LOSELIFE, damroll(3, 8), _("審判の宝石", "the Jewel of Judgement"), -1); (void)detect_traps(DETECT_RAD_DEFAULT, TRUE); (void)detect_doors(DETECT_RAD_DEFAULT); @@ -1727,7 +1727,7 @@ bool activate_artifact(object_type *o_ptr) { int t; msg_format(_("%sはあなたの体力を奪った...", "The %s drains your vitality..."), name); - take_hit(DAMAGE_LOSELIFE, damroll(3, 8), _("加速した疲労", "the strain of haste"), -1); + take_hit(p_ptr, DAMAGE_LOSELIFE, damroll(3, 8), _("加速した疲労", "the strain of haste"), -1); t = 25 + randint1(25); (void)set_fast(p_ptr, p_ptr->fast + t, FALSE); break; diff --git a/src/cmd-eat.c b/src/cmd-eat.c index d4a38b380..bf4812b7d 100644 --- a/src/cmd-eat.c +++ b/src/cmd-eat.c @@ -140,7 +140,7 @@ void exe_eat_food(INVENTORY_IDX item) case SV_FOOD_WEAKNESS: { - take_hit(DAMAGE_NOESCAPE, damroll(6, 6), _("毒入り食料", "poisonous food"), -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, damroll(6, 6), _("毒入り食料", "poisonous food"), -1); (void)do_dec_stat(p_ptr, A_STR); ident = TRUE; break; @@ -148,7 +148,7 @@ void exe_eat_food(INVENTORY_IDX item) case SV_FOOD_SICKNESS: { - take_hit(DAMAGE_NOESCAPE, damroll(6, 6), _("毒入り食料", "poisonous food"), -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, damroll(6, 6), _("毒入り食料", "poisonous food"), -1); (void)do_dec_stat(p_ptr, A_CON); ident = TRUE; break; @@ -156,7 +156,7 @@ void exe_eat_food(INVENTORY_IDX item) case SV_FOOD_STUPIDITY: { - take_hit(DAMAGE_NOESCAPE, damroll(8, 8), _("毒入り食料", "poisonous food"), -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, damroll(8, 8), _("毒入り食料", "poisonous food"), -1); (void)do_dec_stat(p_ptr, A_INT); ident = TRUE; break; @@ -164,7 +164,7 @@ void exe_eat_food(INVENTORY_IDX item) case SV_FOOD_NAIVETY: { - take_hit(DAMAGE_NOESCAPE, damroll(8, 8), _("毒入り食料", "poisonous food"), -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, damroll(8, 8), _("毒入り食料", "poisonous food"), -1); (void)do_dec_stat(p_ptr, A_WIS); ident = TRUE; break; @@ -172,7 +172,7 @@ void exe_eat_food(INVENTORY_IDX item) case SV_FOOD_UNHEALTH: { - take_hit(DAMAGE_NOESCAPE, damroll(10, 10), _("毒入り食料", "poisonous food"), -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, damroll(10, 10), _("毒入り食料", "poisonous food"), -1); (void)do_dec_stat(p_ptr, A_CON); ident = TRUE; break; @@ -180,7 +180,7 @@ void exe_eat_food(INVENTORY_IDX item) case SV_FOOD_DISEASE: { - take_hit(DAMAGE_NOESCAPE, damroll(10, 10), _("毒入り食料", "poisonous food"), -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, damroll(10, 10), _("毒入り食料", "poisonous food"), -1); (void)do_dec_stat(p_ptr, A_STR); ident = TRUE; break; diff --git a/src/cmd-pet.c b/src/cmd-pet.c index 7863dc041..542dbb534 100644 --- a/src/cmd-pet.c +++ b/src/cmd-pet.c @@ -1054,7 +1054,7 @@ bool rakuba(HIT_POINT dam, bool force) { monster_desc(m_name, m_ptr, 0); msg_format(_("%sから振り落とされそうになって、壁にぶつかった。", "You have nearly fallen from %s, but bumped into wall."), m_name); - take_hit(DAMAGE_NOESCAPE, r_ptr->level + 3, _("壁への衝突", "bumping into wall"), -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, r_ptr->level + 3, _("壁への衝突", "bumping into wall"), -1); return FALSE; } @@ -1095,7 +1095,7 @@ bool rakuba(HIT_POINT dam, bool force) } else { - take_hit(DAMAGE_NOESCAPE, r_ptr->level + 3, _("落馬", "Falling from riding"), -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, r_ptr->level + 3, _("落馬", "Falling from riding"), -1); fall_dam = TRUE; } diff --git a/src/cmd-quaff.c b/src/cmd-quaff.c index 06f032450..309bbe15d 100644 --- a/src/cmd-quaff.c +++ b/src/cmd-quaff.c @@ -206,7 +206,7 @@ void exe_quaff_potion(INVENTORY_IDX item) case SV_POTION_RUINATION: msg_print(_("身も心も弱ってきて、精気が抜けていくようだ。", "Your nerves and muscles feel weak and lifeless!")); - take_hit(DAMAGE_LOSELIFE, damroll(10, 10), _("破滅の薬", "a potion of Ruination"), -1); + take_hit(p_ptr, DAMAGE_LOSELIFE, damroll(10, 10), _("破滅の薬", "a potion of Ruination"), -1); (void)dec_stat(p_ptr, A_DEX, 25, TRUE); (void)dec_stat(p_ptr, A_WIS, 25, TRUE); @@ -249,7 +249,7 @@ void exe_quaff_potion(INVENTORY_IDX item) chg_virtue(p_ptr, V_VITALITY, -1); chg_virtue(p_ptr, V_UNLIFE, 5); msg_print(_("死の予感が体中を駆けめぐった。", "A feeling of Death flows through your body.")); - take_hit(DAMAGE_LOSELIFE, 5000, _("死の薬", "a potion of Death"), -1); + take_hit(p_ptr, DAMAGE_LOSELIFE, 5000, _("死の薬", "a potion of Death"), -1); ident = TRUE; break; diff --git a/src/cmd-read.c b/src/cmd-read.c index 996921a12..611ee21aa 100644 --- a/src/cmd-read.c +++ b/src/cmd-read.c @@ -460,7 +460,7 @@ void exe_read(INVENTORY_IDX item, bool known) fire_ball(GF_FIRE, 0, 666, 4); /* Note: "Double" damage since it is centered on the player ... */ if (!(IS_OPPOSE_FIRE() || p_ptr->resist_fire || p_ptr->immune_fire)) - take_hit(DAMAGE_NOESCAPE, 50+randint1(50), _("炎の巻物", "a Scroll of Fire"), -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, 50+randint1(50), _("炎の巻物", "a Scroll of Fire"), -1); ident = TRUE; break; @@ -471,7 +471,7 @@ void exe_read(INVENTORY_IDX item, bool known) { fire_ball(GF_ICE, 0, 777, 4); if (!(IS_OPPOSE_COLD() || p_ptr->resist_cold || p_ptr->immune_cold)) - take_hit(DAMAGE_NOESCAPE, 100+randint1(100), _("氷の巻物", "a Scroll of Ice"), -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, 100+randint1(100), _("氷の巻物", "a Scroll of Ice"), -1); ident = TRUE; break; @@ -481,7 +481,7 @@ void exe_read(INVENTORY_IDX item, bool known) { fire_ball(GF_CHAOS, 0, 1000, 4); if (!p_ptr->resist_chaos) - take_hit(DAMAGE_NOESCAPE, 111+randint1(111), _("ログルスの巻物", "a Scroll of Logrus"), -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, 111+randint1(111), _("ログルスの巻物", "a Scroll of Logrus"), -1); ident = TRUE; break; diff --git a/src/cmd-spell.c b/src/cmd-spell.c index b8f396cd5..372e62a55 100644 --- a/src/cmd-spell.c +++ b/src/cmd-spell.c @@ -1260,7 +1260,7 @@ void do_cmd_cast(void) else { msg_print(_("痛い!", "It hurts!")); - take_hit(DAMAGE_LOSELIFE, damroll(o_ptr->sval + 1, 6), _("暗黒魔法の逆流", "a miscast Death spell"), -1); + take_hit(p_ptr, DAMAGE_LOSELIFE, damroll(o_ptr->sval + 1, 6), _("暗黒魔法の逆流", "a miscast Death spell"), -1); if ((spell > 15) && one_in_(6) && !p_ptr->hold_exp) lose_exp(p_ptr, spell * 250); diff --git a/src/core.c b/src/core.c index 4cf3c3c1c..1d464e69b 100644 --- a/src/core.c +++ b/src/core.c @@ -732,14 +732,14 @@ static bool pattern_effect(void) case PATTERN_TILE_WRECKED: if (!IS_INVULN()) - take_hit(DAMAGE_NOESCAPE, 200, _("壊れた「パターン」を歩いたダメージ", "walking the corrupted Pattern"), -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, 200, _("壊れた「パターン」を歩いたダメージ", "walking the corrupted Pattern"), -1); break; default: if (PRACE_IS_(p_ptr, RACE_AMBERITE) && !one_in_(2)) return TRUE; else if (!IS_INVULN()) - take_hit(DAMAGE_NOESCAPE, damroll(1, 3), _("「パターン」を歩いたダメージ", "walking the Pattern"), -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, damroll(1, 3), _("「パターン」を歩いたダメージ", "walking the Pattern"), -1); break; } @@ -1322,7 +1322,7 @@ static void process_world_aux_digestion(void) /* Calculate damage */ HIT_POINT dam = (PY_FOOD_STARVE - p_ptr->food) / 10; - if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, dam, _("空腹", "starvation"), -1); + if (!IS_INVULN()) take_hit(p_ptr, DAMAGE_LOSELIFE, dam, _("空腹", "starvation"), -1); } } } @@ -1348,7 +1348,7 @@ static void process_world_aux_hp_and_sp(void) /* Take damage from poison */ if (p_ptr->poisoned && !IS_INVULN()) { - take_hit(DAMAGE_NOESCAPE, 1, _("毒", "poison"), -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, 1, _("毒", "poison"), -1); } /* Take damage from cuts */ @@ -1394,7 +1394,7 @@ static void process_world_aux_hp_and_sp(void) dam = 1; } - take_hit(DAMAGE_NOESCAPE, dam, _("致命傷", "a fatal wound"), -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, dam, _("致命傷", "a fatal wound"), -1); } /* (Vampires) Take damage from sunlight */ @@ -1405,7 +1405,7 @@ static void process_world_aux_hp_and_sp(void) if ((current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW) { msg_print(_("日光があなたのアンデッドの肉体を焼き焦がした!", "The sun's rays scorch your undead flesh!")); - take_hit(DAMAGE_NOESCAPE, 1, _("日光", "sunlight"), -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, 1, _("日光", "sunlight"), -1); cave_no_regen = TRUE; } } @@ -1427,7 +1427,7 @@ static void process_world_aux_hp_and_sp(void) object_desc(o_name, o_ptr, OD_NAME_ONLY); sprintf(ouch, _("%sを装備したダメージ", "wielding %s"), o_name); - if (!IS_INVULN()) take_hit(DAMAGE_NOESCAPE, 1, ouch, -1); + if (!IS_INVULN()) take_hit(p_ptr, DAMAGE_NOESCAPE, 1, ouch, -1); } } @@ -1456,14 +1456,14 @@ static void process_world_aux_hp_and_sp(void) if (p_ptr->levitation) { msg_print(_("熱で火傷した!", "The heat burns you!")); - take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"), + take_hit(p_ptr, DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"), f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1); } else { concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name; msg_format(_("%sで火傷した!", "The %s burns you!"), name); - take_hit(DAMAGE_NOESCAPE, damage, name, -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, damage, name, -1); } cave_no_regen = TRUE; @@ -1494,14 +1494,14 @@ static void process_world_aux_hp_and_sp(void) if (p_ptr->levitation) { msg_print(_("冷気に覆われた!", "The cold engulfs you!")); - take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"), + take_hit(p_ptr, DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"), f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1); } else { concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name; msg_format(_("%sに凍えた!", "The %s frostbites you!"), name); - take_hit(DAMAGE_NOESCAPE, damage, name, -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, damage, name, -1); } cave_no_regen = TRUE; @@ -1532,14 +1532,14 @@ static void process_world_aux_hp_and_sp(void) if (p_ptr->levitation) { msg_print(_("電撃を受けた!", "The electric shocks you!")); - take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"), + take_hit(p_ptr, DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"), f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1); } else { concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name; msg_format(_("%sに感電した!", "The %s shocks you!"), name); - take_hit(DAMAGE_NOESCAPE, damage, name, -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, damage, name, -1); } cave_no_regen = TRUE; @@ -1570,14 +1570,14 @@ static void process_world_aux_hp_and_sp(void) if (p_ptr->levitation) { msg_print(_("酸が飛び散った!", "The acid melt you!")); - take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"), + take_hit(p_ptr, DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"), f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1); } else { concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name; msg_format(_("%sに溶かされた!", "The %s melts you!"), name); - take_hit(DAMAGE_NOESCAPE, damage, name, -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, damage, name, -1); } cave_no_regen = TRUE; @@ -1608,7 +1608,7 @@ static void process_world_aux_hp_and_sp(void) if (p_ptr->levitation) { msg_print(_("毒気を吸い込んだ!", "The gas poisons you!")); - take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"), + take_hit(p_ptr, DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"), f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1); if (p_ptr->resist_pois) (void)set_poisoned(p_ptr, p_ptr->poisoned + 1); } @@ -1616,7 +1616,7 @@ static void process_world_aux_hp_and_sp(void) { concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name; msg_format(_("%sに毒された!", "The %s poisons you!"), name); - take_hit(DAMAGE_NOESCAPE, damage, name, -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, damage, name, -1); if (p_ptr->resist_pois) (void)set_poisoned(p_ptr, p_ptr->poisoned + 3); } @@ -1630,7 +1630,7 @@ static void process_world_aux_hp_and_sp(void) if (p_ptr->total_weight > weight_limit()) { msg_print(_("溺れている!", "You are drowning!")); - take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), _("溺れ", "drowning"), -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, randint1(p_ptr->lev), _("溺れ", "drowning"), -1); cave_no_regen = TRUE; } } @@ -1645,7 +1645,7 @@ static void process_world_aux_hp_and_sp(void) if (p_ptr->resist_fire) damage = damage / 3; if (IS_OPPOSE_FIRE()) damage = damage / 3; msg_print(_("熱い!", "It's hot!")); - take_hit(DAMAGE_NOESCAPE, damage, _("炎のオーラ", "Fire aura"), -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, damage, _("炎のオーラ", "Fire aura"), -1); } if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !p_ptr->immune_elec) { @@ -1654,7 +1654,7 @@ static void process_world_aux_hp_and_sp(void) if (p_ptr->resist_elec) damage = damage / 3; if (IS_OPPOSE_ELEC()) damage = damage / 3; msg_print(_("痛い!", "It hurts!")); - take_hit(DAMAGE_NOESCAPE, damage, _("電気のオーラ", "Elec aura"), -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, damage, _("電気のオーラ", "Elec aura"), -1); } if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !p_ptr->immune_cold) { @@ -1662,7 +1662,7 @@ static void process_world_aux_hp_and_sp(void) if (p_ptr->resist_cold) damage = damage / 3; if (IS_OPPOSE_COLD()) damage = damage / 3; msg_print(_("冷たい!", "It's cold!")); - take_hit(DAMAGE_NOESCAPE, damage, _("冷気のオーラ", "Cold aura"), -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, damage, _("冷気のオーラ", "Cold aura"), -1); } } @@ -1691,7 +1691,7 @@ static void process_world_aux_hp_and_sp(void) dam_desc = _("硬い岩", "solid rock"); } - take_hit(DAMAGE_NOESCAPE, 1 + (p_ptr->lev / 5), dam_desc, -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, 1 + (p_ptr->lev / 5), dam_desc, -1); } } @@ -2548,7 +2548,7 @@ static void process_world_aux_mutation(void) p_ptr->csp += healing; p_ptr->redraw |= (PR_HP | PR_MANA); - take_hit(DAMAGE_LOSELIFE, healing, _("頭に昇った血", "blood rushing to the head"), -1); + take_hit(p_ptr, DAMAGE_LOSELIFE, healing, _("頭に昇った血", "blood rushing to the head"), -1); } } @@ -2559,7 +2559,7 @@ static void process_world_aux_mutation(void) disturb(FALSE, TRUE); msg_print(_("足がもつれて転んだ!", "You trip over your own feet!")); - take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), _("転倒", "tripping"), -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), _("転倒", "tripping"), -1); msg_print(NULL); if (has_melee_weapon(INVEN_RARM)) @@ -2783,7 +2783,7 @@ static void process_world_aux_curse(void) object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_HP), (OD_OMIT_PREFIX | OD_NAME_ONLY)); msg_format(_("%sはあなたの体力を吸収した!", "Your %s drains HP from you!"), o_name); - take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev*2, 100), o_name, -1); + take_hit(p_ptr, DAMAGE_LOSELIFE, MIN(p_ptr->lev*2, 100), o_name, -1); } /* Handle mana draining */ if ((p_ptr->cursed & TRC_DRAIN_MANA) && p_ptr->csp && one_in_(666)) @@ -2813,7 +2813,7 @@ static void process_world_aux_curse(void) msg_print(_("『審判の宝石』はあなたの体力を吸収した!", "The Jewel of Judgement drains life from you!")); else msg_print(_("なにかがあなたの体力を吸収した!", "Something drains life from you!")); - take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), _("審判の宝石", "the Jewel of Judgement"), -1); + take_hit(p_ptr, DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), _("審判の宝石", "the Jewel of Judgement"), -1); } } } diff --git a/src/melee1.c b/src/melee1.c index 94db986be..fba82b78c 100644 --- a/src/melee1.c +++ b/src/melee1.c @@ -2125,7 +2125,7 @@ static void py_attack_aux(POSITION y, POSITION x, bool *fear, bool *mdeath, s16b k += (p_ptr->to_d[hand] + o_ptr->to_d); if (k < 0) k = 0; - take_hit(DAMAGE_FORCE, k, _("死の大鎌", "Death scythe"), -1); + take_hit(p_ptr, DAMAGE_FORCE, k, _("死の大鎌", "Death scythe"), -1); handle_stuff(); } else @@ -2798,7 +2798,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) msg_print(_("痛恨の一撃!", "It was a critical hit!")); tmp_damage = MAX(damage, tmp_damage*2); - get_damage += take_hit(DAMAGE_ATTACK, tmp_damage, ddesc, -1); + get_damage += take_hit(p_ptr, DAMAGE_ATTACK, tmp_damage, ddesc, -1); break; } } @@ -2806,7 +2806,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) { obvious = TRUE; damage -= (damage * ((ac < 150) ? ac : 150) / 250); - get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); + get_damage += take_hit(p_ptr, DAMAGE_ATTACK, damage, ddesc, -1); break; } @@ -2823,7 +2823,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) } } - get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); + get_damage += take_hit(p_ptr, DAMAGE_ATTACK, damage, ddesc, -1); /* Learn about the player */ update_smart_learn(m_idx, DRS_POIS); @@ -2847,7 +2847,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) } } - get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); + get_damage += take_hit(p_ptr, DAMAGE_ATTACK, damage, ddesc, -1); /* Learn about the player */ update_smart_learn(m_idx, DRS_DISEN); @@ -2857,7 +2857,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) case RBE_UN_POWER: { - get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); + get_damage += take_hit(p_ptr, DAMAGE_ATTACK, damage, ddesc, -1); if (p_ptr->is_dead || CHECK_MULTISHADOW()) break; @@ -2911,7 +2911,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) case RBE_EAT_GOLD: { - get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); + get_damage += take_hit(p_ptr, DAMAGE_ATTACK, damage, ddesc, -1); /* Confused monsters cannot steal successfully. -LM-*/ if (MON_CONFUSED(m_ptr)) break; @@ -2971,7 +2971,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) case RBE_EAT_ITEM: { - get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); + get_damage += take_hit(p_ptr, DAMAGE_ATTACK, damage, ddesc, -1); /* Confused monsters cannot steal successfully. -LM-*/ if (MON_CONFUSED(m_ptr)) break; @@ -3067,7 +3067,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) case RBE_EAT_FOOD: { - get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); + get_damage += take_hit(p_ptr, DAMAGE_ATTACK, damage, ddesc, -1); if (p_ptr->is_dead || CHECK_MULTISHADOW()) break; @@ -3107,7 +3107,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) { /* Access the lite */ o_ptr = &p_ptr->inventory_list[INVEN_LITE]; - get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); + get_damage += take_hit(p_ptr, DAMAGE_ATTACK, damage, ddesc, -1); if (p_ptr->is_dead || CHECK_MULTISHADOW()) break; @@ -3173,7 +3173,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) case RBE_BLIND: { - get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); + get_damage += take_hit(p_ptr, DAMAGE_ATTACK, damage, ddesc, -1); if (p_ptr->is_dead) break; /* Increase "blind" */ @@ -3199,7 +3199,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) case RBE_CONFUSE: { if (explode) break; - get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); + get_damage += take_hit(p_ptr, DAMAGE_ATTACK, damage, ddesc, -1); if (p_ptr->is_dead) break; @@ -3220,7 +3220,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) case RBE_TERRIFY: { - get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); + get_damage += take_hit(p_ptr, DAMAGE_ATTACK, damage, ddesc, -1); if (p_ptr->is_dead) break; @@ -3255,7 +3255,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) case RBE_PARALYZE: { - get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); + get_damage += take_hit(p_ptr, DAMAGE_ATTACK, damage, ddesc, -1); if (p_ptr->is_dead) break; @@ -3293,7 +3293,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) case RBE_LOSE_STR: { - get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); + get_damage += take_hit(p_ptr, DAMAGE_ATTACK, damage, ddesc, -1); if (p_ptr->is_dead || CHECK_MULTISHADOW()) break; if (do_dec_stat(p_ptr, A_STR)) obvious = TRUE; @@ -3303,7 +3303,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) case RBE_LOSE_INT: { - get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); + get_damage += take_hit(p_ptr, DAMAGE_ATTACK, damage, ddesc, -1); if (p_ptr->is_dead || CHECK_MULTISHADOW()) break; if (do_dec_stat(p_ptr, A_INT)) obvious = TRUE; @@ -3313,7 +3313,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) case RBE_LOSE_WIS: { - get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); + get_damage += take_hit(p_ptr, DAMAGE_ATTACK, damage, ddesc, -1); if (p_ptr->is_dead || CHECK_MULTISHADOW()) break; if (do_dec_stat(p_ptr, A_WIS)) obvious = TRUE; @@ -3323,7 +3323,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) case RBE_LOSE_DEX: { - get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); + get_damage += take_hit(p_ptr, DAMAGE_ATTACK, damage, ddesc, -1); if (p_ptr->is_dead || CHECK_MULTISHADOW()) break; if (do_dec_stat(p_ptr, A_DEX)) obvious = TRUE; @@ -3333,7 +3333,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) case RBE_LOSE_CON: { - get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); + get_damage += take_hit(p_ptr, DAMAGE_ATTACK, damage, ddesc, -1); if (p_ptr->is_dead || CHECK_MULTISHADOW()) break; if (do_dec_stat(p_ptr, A_CON)) obvious = TRUE; @@ -3343,7 +3343,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) case RBE_LOSE_CHR: { - get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); + get_damage += take_hit(p_ptr, DAMAGE_ATTACK, damage, ddesc, -1); if (p_ptr->is_dead || CHECK_MULTISHADOW()) break; if (do_dec_stat(p_ptr, A_CHR)) obvious = TRUE; @@ -3353,7 +3353,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) case RBE_LOSE_ALL: { - get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); + get_damage += take_hit(p_ptr, DAMAGE_ATTACK, damage, ddesc, -1); if (p_ptr->is_dead || CHECK_MULTISHADOW()) break; @@ -3375,7 +3375,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) /* Hack -- Reduce damage based on the player armor class */ damage -= (damage * ((ac < 150) ? ac : 150) / 250); - get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); + get_damage += take_hit(p_ptr, DAMAGE_ATTACK, damage, ddesc, -1); /* Radius 8 earthquake centered at the monster */ if (damage > 23 || explode) @@ -3392,7 +3392,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) obvious = TRUE; - get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); + get_damage += take_hit(p_ptr, DAMAGE_ATTACK, damage, ddesc, -1); if (p_ptr->is_dead || CHECK_MULTISHADOW()) break; @@ -3406,7 +3406,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) obvious = TRUE; - get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); + get_damage += take_hit(p_ptr, DAMAGE_ATTACK, damage, ddesc, -1); if (p_ptr->is_dead || CHECK_MULTISHADOW()) break; @@ -3420,7 +3420,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) obvious = TRUE; - get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); + get_damage += take_hit(p_ptr, DAMAGE_ATTACK, damage, ddesc, -1); if (p_ptr->is_dead || CHECK_MULTISHADOW()) break; @@ -3434,7 +3434,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) obvious = TRUE; - get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); + get_damage += take_hit(p_ptr, DAMAGE_ATTACK, damage, ddesc, -1); if (p_ptr->is_dead || CHECK_MULTISHADOW()) break; @@ -3444,7 +3444,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) case RBE_DISEASE: { - get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); + get_damage += take_hit(p_ptr, DAMAGE_ATTACK, damage, ddesc, -1); if (p_ptr->is_dead || CHECK_MULTISHADOW()) break; @@ -3531,7 +3531,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) } } } - get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); + get_damage += take_hit(p_ptr, DAMAGE_ATTACK, damage, ddesc, -1); break; } @@ -3542,7 +3542,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) obvious = TRUE; - get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); + get_damage += take_hit(p_ptr, DAMAGE_ATTACK, damage, ddesc, -1); if (p_ptr->is_dead || CHECK_MULTISHADOW()) break; @@ -3622,7 +3622,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) } case RBE_INERTIA: { - get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); + get_damage += take_hit(p_ptr, DAMAGE_ATTACK, damage, ddesc, -1); if (p_ptr->is_dead) break; @@ -3643,7 +3643,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) } case RBE_STUN: { - get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); + get_damage += take_hit(p_ptr, DAMAGE_ATTACK, damage, ddesc, -1); if (p_ptr->is_dead) break; diff --git a/src/mind.c b/src/mind.c index b3206ff25..5165d8ad8 100644 --- a/src/mind.c +++ b/src/mind.c @@ -1227,7 +1227,7 @@ static bool cast_force_spell(int spell) { msg_print(_("気が暴走した!", "The Force exploded!")); fire_ball(GF_MANA, 0, P_PTR_KI / 2, 10); - take_hit(DAMAGE_LOSELIFE, p_ptr->magic_num1[0] / 2, _("気の暴走", "Explosion of the Force"), -1); + take_hit(p_ptr, DAMAGE_LOSELIFE, p_ptr->magic_num1[0] / 2, _("気の暴走", "Explosion of the Force"), -1); } else return TRUE; break; @@ -2007,7 +2007,7 @@ void do_cmd_mind(void) if ((use_mind == MIND_BERSERKER) || (use_mind == MIND_NINJUTSU)) { - take_hit(DAMAGE_USELIFE, mana_cost, _("過度の集中", "concentrating too hard"), -1); + take_hit(p_ptr, DAMAGE_USELIFE, mana_cost, _("過度の集中", "concentrating too hard"), -1); /* Redraw hp */ p_ptr->redraw |= (PR_HP); } diff --git a/src/mspells4.c b/src/mspells4.c index 1e1467f4e..e6c4eef68 100644 --- a/src/mspells4.c +++ b/src/mspells4.c @@ -2099,7 +2099,7 @@ HIT_POINT spell_RF6_SPECIAL_B(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER /* Mega hack -- this special action deals damage to the player. Therefore the code of "eyeeye" is necessary. -- henkma */ - get_damage = take_hit(DAMAGE_NOESCAPE, dam, m_name, -1); + get_damage = take_hit(p_ptr, DAMAGE_NOESCAPE, dam, m_name, -1); if (p_ptr->tim_eyeeye && get_damage > 0 && !p_ptr->is_dead) { GAME_TEXT m_name_self[80]; diff --git a/src/mutation.c b/src/mutation.c index 60f7fdc3d..f649452a9 100644 --- a/src/mutation.c +++ b/src/mutation.c @@ -2265,7 +2265,7 @@ bool mutation_power_aux(player_type *creature_ptr, int power) case MUT1_STERILITY: msg_print(_("突然頭が痛くなった!", "You suddenly have a headache!")); - take_hit(DAMAGE_LOSELIFE, randint1(17) + 17, _("禁欲を強いた疲労", "the strain of forcing abstinence"), -1); + take_hit(p_ptr, DAMAGE_LOSELIFE, randint1(17) + 17, _("禁欲を強いた疲労", "the strain of forcing abstinence"), -1); current_floor_ptr->num_repro += MAX_REPRO; break; diff --git a/src/patron.c b/src/patron.c index e807c24ce..aacecaa1f 100644 --- a/src/patron.c +++ b/src/patron.c @@ -476,7 +476,7 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward) msg_print(_("「苦しむがよい、無能な愚か者よ!」", "'Suffer, pathetic fool!'")); fire_ball(GF_DISINTEGRATE, 0, creature_ptr->lev * 4, 4); - take_hit(DAMAGE_NOESCAPE, creature_ptr->lev * 4, wrath_reason, -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, creature_ptr->lev * 4, wrath_reason, -1); reward = _("分解の球が発生した。", "generating disintegration ball"); break; @@ -569,7 +569,7 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward) msg_format(_("%sの声が轟き渡った:", "The voice of %s thunders:"), chaos_patrons[creature_ptr->chaos_patron]); msg_print(_("「死ぬがよい、下僕よ!」", "'Die, mortal!'")); - take_hit(DAMAGE_LOSELIFE, creature_ptr->lev * 4, wrath_reason, -1); + take_hit(p_ptr, DAMAGE_LOSELIFE, creature_ptr->lev * 4, wrath_reason, -1); for (dummy = 0; dummy < A_MAX; dummy++) { (void)dec_stat(creature_ptr, dummy, 10 + randint1(15), FALSE); diff --git a/src/player-damage.c b/src/player-damage.c index 1f99849db..e270dfb59 100644 --- a/src/player-damage.c +++ b/src/player-damage.c @@ -221,7 +221,7 @@ HIT_POINT acid_dam(HIT_POINT dam, concptr kb_str, int monspell, bool aura) if (acid_minus_ac(p_ptr)) dam = (dam + 1) / 2; } - get_damage = take_hit(aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell); + get_damage = take_hit(p_ptr, aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell); /* Inventory damage */ if (!aura && !(double_resist && p_ptr->resist_acid)) @@ -268,7 +268,7 @@ HIT_POINT elec_dam(HIT_POINT dam, concptr kb_str, int monspell, bool aura) (void)do_dec_stat(p_ptr, A_DEX); } - get_damage = take_hit(aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell); + get_damage = take_hit(p_ptr, aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell); /* Inventory damage */ if (!aura && !(double_resist && p_ptr->resist_elec)) @@ -316,7 +316,7 @@ HIT_POINT fire_dam(HIT_POINT dam, concptr kb_str, int monspell, bool aura) (void)do_dec_stat(p_ptr, A_STR); } - get_damage = take_hit(aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell); + get_damage = take_hit(p_ptr, aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell); /* Inventory damage */ if (!aura && !(double_resist && p_ptr->resist_fire)) @@ -363,7 +363,7 @@ HIT_POINT cold_dam(HIT_POINT dam, concptr kb_str, int monspell, bool aura) (void)do_dec_stat(p_ptr, A_STR); } - get_damage = take_hit(aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell); + get_damage = take_hit(p_ptr, aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell); /* Inventory damage */ if (!aura && !(double_resist && p_ptr->resist_cold)) @@ -383,18 +383,18 @@ HIT_POINT cold_dam(HIT_POINT dam, concptr kb_str, int monspell, bool aura) * setting the player to "dead". */ -int take_hit(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, int monspell) { - int old_chp = p_ptr->chp; + int old_chp = creature_ptr->chp; char death_message[1024]; char tmp[1024]; - int warning = (p_ptr->mhp * hitpoint_warn / 10); - if (p_ptr->is_dead) return 0; + int warning = (creature_ptr->mhp * hitpoint_warn / 10); + if (creature_ptr->is_dead) return 0; - if (p_ptr->sutemi) damage *= 2; - if (p_ptr->special_defense & KATA_IAI) damage += (damage + 4) / 5; + if (creature_ptr->sutemi) damage *= 2; + if (creature_ptr->special_defense & KATA_IAI) damage += (damage + 4) / 5; if (easy_band) damage = (damage + 1) / 2; @@ -403,7 +403,7 @@ int take_hit(int damage_type, HIT_POINT damage, concptr hit_from, int monspell) disturb(TRUE, TRUE); if (auto_more) { - p_ptr->now_damaged = TRUE; + creature_ptr->now_damaged = TRUE; } } @@ -441,7 +441,7 @@ int take_hit(int damage_type, HIT_POINT damage, concptr hit_from, int monspell) } } - if (p_ptr->wraith_form) + if (creature_ptr->wraith_form) { if (damage_type == DAMAGE_FORCE) { @@ -454,7 +454,7 @@ int take_hit(int damage_type, HIT_POINT damage, concptr hit_from, int monspell) } } - if (p_ptr->special_defense & KATA_MUSOU) + if (creature_ptr->special_defense & KATA_MUSOU) { damage /= 2; if ((damage == 0) && one_in_(2)) damage = 1; @@ -462,28 +462,28 @@ int take_hit(int damage_type, HIT_POINT damage, concptr hit_from, int monspell) } /* not if LOSELIFE USELIFE */ /* Hurt the player */ - p_ptr->chp -= damage; - if (damage_type == DAMAGE_GENO && p_ptr->chp < 0) + creature_ptr->chp -= damage; + if (damage_type == DAMAGE_GENO && creature_ptr->chp < 0) { - damage += p_ptr->chp; - p_ptr->chp = 0; + damage += creature_ptr->chp; + creature_ptr->chp = 0; } /* Display the hitpoints */ - p_ptr->redraw |= (PR_HP); + creature_ptr->redraw |= (PR_HP); - p_ptr->window |= (PW_PLAYER); + creature_ptr->window |= (PW_PLAYER); - if (damage_type != DAMAGE_GENO && p_ptr->chp == 0) + if (damage_type != DAMAGE_GENO && creature_ptr->chp == 0) { - chg_virtue(p_ptr, V_SACRIFICE, 1); - chg_virtue(p_ptr, V_CHANCE, 2); + chg_virtue(creature_ptr, V_SACRIFICE, 1); + chg_virtue(creature_ptr, V_CHANCE, 2); } /* Dead player */ - if (p_ptr->chp < 0) + if (creature_ptr->chp < 0) { - bool android = (p_ptr->prace == RACE_ANDROID ? TRUE : FALSE); + bool android = (creature_ptr->prace == RACE_ANDROID ? TRUE : FALSE); #ifdef JP /* 死んだ時に強制終了して死を回避できなくしてみた by Habu */ if (!cheat_save) @@ -492,26 +492,26 @@ int take_hit(int damage_type, HIT_POINT damage, concptr hit_from, int monspell) sound(SOUND_DEATH); - chg_virtue(p_ptr, V_SACRIFICE, 10); + chg_virtue(creature_ptr, V_SACRIFICE, 10); handle_stuff(); - p_ptr->leaving = TRUE; + creature_ptr->leaving = TRUE; /* Note death */ - p_ptr->is_dead = TRUE; + creature_ptr->is_dead = TRUE; - if (p_ptr->inside_arena) + if (creature_ptr->inside_arena) { - concptr m_name = r_name + r_info[arena_info[p_ptr->arena_number].r_idx].name; + concptr m_name = r_name + r_info[arena_info[creature_ptr->arena_number].r_idx].name; msg_format(_("あなたは%sの前に敗れ去った。", "You are beaten by %s."), m_name); msg_print(NULL); - if (record_arena) do_cmd_write_nikki(NIKKI_ARENA, -1 - p_ptr->arena_number, m_name); + if (record_arena) do_cmd_write_nikki(NIKKI_ARENA, -1 - creature_ptr->arena_number, m_name); } else { QUEST_IDX q_idx = quest_number(current_floor_ptr->dun_level); bool seppuku = streq(hit_from, "Seppuku"); - bool winning_seppuku = p_ptr->total_winner && seppuku; + bool winning_seppuku = creature_ptr->total_winner && seppuku; play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_GAMEOVER); @@ -523,24 +523,24 @@ int take_hit(int damage_type, HIT_POINT damage, concptr hit_from, int monspell) /* Note cause of death */ if (seppuku) { - strcpy(p_ptr->died_from, hit_from); + strcpy(creature_ptr->died_from, hit_from); #ifdef JP - if (!winning_seppuku) strcpy(p_ptr->died_from, "切腹"); + if (!winning_seppuku) strcpy(creature_ptr->died_from, "切腹"); #endif } else { char dummy[1024]; #ifdef JP - sprintf(dummy, "%s%s%s", !p_ptr->paralyzed ? "" : p_ptr->free_act ? "彫像状態で" : "麻痺状態で", p_ptr->image ? "幻覚に歪んだ" : "", hit_from); + sprintf(dummy, "%s%s%s", !creature_ptr->paralyzed ? "" : creature_ptr->free_act ? "彫像状態で" : "麻痺状態で", creature_ptr->image ? "幻覚に歪んだ" : "", hit_from); #else - sprintf(dummy, "%s%s", hit_from, !p_ptr->paralyzed ? "" : " while helpless"); + sprintf(dummy, "%s%s", hit_from, !creature_ptr->paralyzed ? "" : " while helpless"); #endif - my_strcpy(p_ptr->died_from, dummy, sizeof p_ptr->died_from); + my_strcpy(creature_ptr->died_from, dummy, sizeof creature_ptr->died_from); } /* No longer a winner */ - p_ptr->total_winner = FALSE; + creature_ptr->total_winner = FALSE; if (winning_seppuku) { @@ -550,7 +550,7 @@ int take_hit(int damage_type, HIT_POINT damage, concptr hit_from, int monspell) { char buf[20]; - if (p_ptr->inside_arena) + if (creature_ptr->inside_arena) strcpy(buf, _("アリーナ", "in the Arena")); else if (!current_floor_ptr->dun_level) strcpy(buf, _("地上", "on the surface")); @@ -560,7 +560,7 @@ int take_hit(int damage_type, HIT_POINT damage, concptr hit_from, int monspell) else sprintf(buf, _("%d階", "level %d"), (int)current_floor_ptr->dun_level); - sprintf(tmp, _("%sで%sに殺された。", "killed by %s %s."), buf, p_ptr->died_from); + sprintf(tmp, _("%sで%sに殺された。", "killed by %s %s."), buf, creature_ptr->died_from); do_cmd_write_nikki(NIKKI_BUNSHOU, 0, tmp); } @@ -577,8 +577,8 @@ int take_hit(int damage_type, HIT_POINT damage, concptr hit_from, int monspell) flush(); /* Initialize "last message" buffer */ - if (p_ptr->last_message) string_free(p_ptr->last_message); - p_ptr->last_message = NULL; + if (creature_ptr->last_message) string_free(creature_ptr->last_message); + creature_ptr->last_message = NULL; /* Hack -- Note death */ if (!last_words) @@ -619,7 +619,7 @@ int take_hit(int damage_type, HIT_POINT damage, concptr hit_from, int monspell) strcpy(death_message, android ? "You are broken." : "You die."); #endif } - else p_ptr->last_message = string_make(death_message); + else creature_ptr->last_message = string_make(death_message); #ifdef JP if (winning_seppuku) @@ -687,7 +687,7 @@ int take_hit(int damage_type, HIT_POINT damage, concptr hit_from, int monspell) handle_stuff(); /* Hitpoint warning */ - if (p_ptr->chp < warning) + if (creature_ptr->chp < warning) { /* Hack -- bell on first notice */ if (old_chp > warning) bell(); @@ -696,7 +696,7 @@ int take_hit(int damage_type, HIT_POINT damage, concptr hit_from, int monspell) if (record_danger && (old_chp > warning)) { - if (p_ptr->image && damage_type == DAMAGE_ATTACK) + if (creature_ptr->image && damage_type == DAMAGE_ATTACK) hit_from = _("何か", "something"); sprintf(tmp, _("%sによってピンチに陥った。", "A critical situation because of %s."), hit_from); @@ -706,14 +706,14 @@ int take_hit(int damage_type, HIT_POINT damage, concptr hit_from, int monspell) if (auto_more) { /* stop auto_more even if DAMAGE_USELIFE */ - p_ptr->now_damaged = TRUE; + creature_ptr->now_damaged = TRUE; } msg_print(_("*** 警告:低ヒット・ポイント! ***", "*** LOW HITPOINT WARNING! ***")); msg_print(NULL); flush(); } - if (p_ptr->wild_mode && !p_ptr->leaving && (p_ptr->chp < MAX(warning, p_ptr->mhp / 5))) + if (creature_ptr->wild_mode && !creature_ptr->leaving && (creature_ptr->chp < MAX(warning, creature_ptr->mhp / 5))) { change_wild_mode(FALSE); } diff --git a/src/player-damage.h b/src/player-damage.h index 63ea51924..440f4eaf9 100644 --- a/src/player-damage.h +++ b/src/player-damage.h @@ -9,7 +9,7 @@ #define DAMAGE_ATTACK 4 #define DAMAGE_NOESCAPE 5 #define DAMAGE_USELIFE 6 -extern int take_hit(int damage_type, HIT_POINT damage, concptr kb_str, int monspell); +extern int take_hit(player_type *creature_ptr, int damage_type, HIT_POINT damage, concptr kb_str, int monspell); /* * This seems like a pretty standard "typedef" diff --git a/src/player-effects.c b/src/player-effects.c index 3394238ed..bb972bf8c 100644 --- a/src/player-effects.c +++ b/src/player-effects.c @@ -3694,7 +3694,7 @@ void do_poly_wounds(player_type *creature_ptr) if (Nasty_effect) { msg_print(_("新たな傷ができた!", "A new wound was created!")); - take_hit(DAMAGE_LOSELIFE, change / 2, _("変化した傷", "a polymorphed wound"), -1); + take_hit(p_ptr, DAMAGE_LOSELIFE, change / 2, _("変化した傷", "a polymorphed wound"), -1); set_cut(creature_ptr,change); } else @@ -3869,7 +3869,7 @@ void do_poly_self(player_type *creature_ptr) if (one_in_(6)) { msg_print(_("現在の姿で生きていくのは困難なようだ!", "You find living difficult in your present form!")); - take_hit(DAMAGE_LOSELIFE, damroll(randint1(10), creature_ptr->lev), _("致命的な突然変異", "a lethal mutation"), -1); + take_hit(p_ptr, DAMAGE_LOSELIFE, damroll(randint1(10), creature_ptr->lev), _("致命的な突然変異", "a lethal mutation"), -1); power -= 10; } diff --git a/src/player-status.c b/src/player-status.c index 5a78eca4e..88ed64f53 100644 --- a/src/player-status.c +++ b/src/player-status.c @@ -5177,7 +5177,7 @@ void wreck_the_pattern(void) msg_print(_("パターンを血で汚してしまった!", "You bleed on the Pattern!")); msg_print(_("何か恐ろしい事が起こった!", "Something terrible happens!")); - if (!IS_INVULN()) take_hit(DAMAGE_NOESCAPE, damroll(10, 8), _("パターン損壊", "corrupting the Pattern"), -1); + if (!IS_INVULN()) take_hit(p_ptr, DAMAGE_NOESCAPE, damroll(10, 8), _("パターン損壊", "corrupting the Pattern"), -1); to_ruin = randint1(45) + 35; while (to_ruin--) diff --git a/src/racial.c b/src/racial.c index fd78be61a..4965919e9 100644 --- a/src/racial.c +++ b/src/racial.c @@ -2026,7 +2026,7 @@ if (!repeat_pull(&i) || i<0 || i>=num) { { actual_racial_cost -= p_ptr->csp; p_ptr->csp = 0; - take_hit(DAMAGE_USELIFE, actual_racial_cost, _("過度の集中", "concentrating too hard"), -1); + take_hit(p_ptr, DAMAGE_USELIFE, actual_racial_cost, _("過度の集中", "concentrating too hard"), -1); } else p_ptr->csp -= actual_racial_cost; diff --git a/src/realm-daemon.c b/src/realm-daemon.c index 068750f5a..b7c750e18 100644 --- a/src/realm-daemon.c +++ b/src/realm-daemon.c @@ -569,7 +569,7 @@ concptr do_daemon_spell(SPELL_IDX spell, BIT_FLAGS mode) if (!get_aim_dir(&dir)) return NULL; fire_ball_hide(GF_BLOOD_CURSE, dir, dam, rad); - take_hit(DAMAGE_USELIFE, 20 + randint1(30), _("血の呪い", "Blood curse"), -1); + take_hit(p_ptr, DAMAGE_USELIFE, 20 + randint1(30), _("血の呪い", "Blood curse"), -1); } } break; diff --git a/src/realm-death.c b/src/realm-death.c index 65bb562c7..e7532bec9 100644 --- a/src/realm-death.c +++ b/src/realm-death.c @@ -612,7 +612,7 @@ concptr do_death_spell(SPELL_IDX spell, BIT_FLAGS mode) if (!get_aim_dir(&dir)) return NULL; fire_ball(GF_HELL_FIRE, dir, dam, rad); - take_hit(DAMAGE_USELIFE, 20 + randint1(30), _("地獄の劫火の呪文を唱えた疲労", "the strain of casting Hellfire"), -1); + take_hit(p_ptr, DAMAGE_USELIFE, 20 + randint1(30), _("地獄の劫火の呪文を唱えた疲労", "the strain of casting Hellfire"), -1); } } break; diff --git a/src/realm-hissatsu.c b/src/realm-hissatsu.c index 2c414c3f7..c7b8b616b 100644 --- a/src/realm-hissatsu.c +++ b/src/realm-hissatsu.c @@ -919,7 +919,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) msg_print(_("その方向にはモンスターはいません。", "There is no monster.")); return NULL; } - take_hit(DAMAGE_NOESCAPE, 100 + randint1(100), _("慶雲鬼忍剣を使った衝撃", "exhaustion on using Keiun-Kininken"), -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, 100 + randint1(100), _("慶雲鬼忍剣を使った衝撃", "exhaustion on using Keiun-Kininken"), -1); } break; @@ -940,13 +940,13 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) if (i != '@') return NULL; if (p_ptr->total_winner) { - take_hit(DAMAGE_FORCE, 9999, "Seppuku", -1); + take_hit(p_ptr, DAMAGE_FORCE, 9999, "Seppuku", -1); p_ptr->total_winner = TRUE; } else { msg_print(_("武士道とは、死ぬことと見つけたり。", "Meaning of Bushi-do is found in the death.")); - take_hit(DAMAGE_FORCE, 9999, "Seppuku", -1); + take_hit(p_ptr, DAMAGE_FORCE, 9999, "Seppuku", -1); } } break; diff --git a/src/realm-nature.c b/src/realm-nature.c index 3137fbeda..4f07beb4b 100644 --- a/src/realm-nature.c +++ b/src/realm-nature.c @@ -125,7 +125,7 @@ concptr do_nature_spell(SPELL_IDX spell, BIT_FLAGS mode) if ((PRACE_IS_(p_ptr, RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE)) && !p_ptr->resist_lite) { msg_print(_("日の光があなたの肉体を焦がした!", "The daylight scorches your flesh!")); - take_hit(DAMAGE_NOESCAPE, damroll(2, 2), _("日の光", "daylight"), -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, damroll(2, 2), _("日の光", "daylight"), -1); } } } @@ -529,7 +529,7 @@ concptr do_nature_spell(SPELL_IDX spell, BIT_FLAGS mode) if ((PRACE_IS_(p_ptr, RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE)) && !p_ptr->resist_lite) { msg_print(_("日光があなたの肉体を焦がした!", "The sunlight scorches your flesh!")); - take_hit(DAMAGE_NOESCAPE, 50, _("日光", "sunlight"), -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, 50, _("日光", "sunlight"), -1); } } } diff --git a/src/spells-floor.c b/src/spells-floor.c index dcf0dd9a1..c028645e4 100644 --- a/src/spells-floor.c +++ b/src/spells-floor.c @@ -910,7 +910,7 @@ bool earthquake(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) killer = _("地震", "an earthquake"); } - take_hit(DAMAGE_ATTACK, damage, killer, -1); + take_hit(p_ptr, DAMAGE_ATTACK, damage, killer, -1); } } diff --git a/src/spells-object.c b/src/spells-object.c index fe7ec731e..0ccb1593a 100644 --- a/src/spells-object.c +++ b/src/spells-object.c @@ -850,12 +850,12 @@ bool perilous_secrets(player_type *creature_ptr) } creature_ptr->redraw |= (PR_MANA); } - take_hit(DAMAGE_LOSELIFE, damroll(1, 12), _("危険な秘密", "perilous secrets"), -1); + take_hit(p_ptr, DAMAGE_LOSELIFE, damroll(1, 12), _("危険な秘密", "perilous secrets"), -1); /* Confusing. */ if (one_in_(5)) (void)set_confused(p_ptr, creature_ptr->confused + randint1(10)); /* Exercise a little care... */ - if (one_in_(20)) take_hit(DAMAGE_LOSELIFE, damroll(4, 10), _("危険な秘密", "perilous secrets"), -1); + if (one_in_(20)) take_hit(p_ptr, DAMAGE_LOSELIFE, damroll(4, 10), _("危険な秘密", "perilous secrets"), -1); return TRUE; } diff --git a/src/spells1.c b/src/spells1.c index 46f5b7d7c..e4e24c016 100644 --- a/src/spells1.c +++ b/src/spells1.c @@ -1738,7 +1738,7 @@ static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P { /* Injure +/- confusion */ monster_desc(killer, m_ptr, MD_WRONGDOER_NAME); - take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */ + take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */ if (one_in_(4) && !CHECK_MULTISHADOW()) { switch (randint1(4)) @@ -1836,7 +1836,7 @@ static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P p_ptr->redraw |= PR_MANA; p_ptr->window |= (PW_SPELL); } - take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */ + take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */ } dam = 0; } @@ -4163,7 +4163,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI do_dec_stat(p_ptr, A_CON); } - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW()) { @@ -4180,7 +4180,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5; if (double_resist) dam = (2 * dam + 2) / 5; - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW()) { set_poisoned(p_ptr, p_ptr->poisoned + randint0(dam) + 10); @@ -4206,7 +4206,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI case GF_MISSILE: { if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!")); - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); break; } @@ -4218,7 +4218,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI dam /= 2; else if (p_ptr->align < -10) dam *= 2; - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); break; } @@ -4227,7 +4227,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!")); if (p_ptr->align > 10) dam *= 2; - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); break; } @@ -4243,7 +4243,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI msg_print(_("矢を斬り捨てた!", "You cut down the arrow!")); break; } - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); break; } @@ -4251,7 +4251,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI case GF_PLASMA: { if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!")); - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); if (!p_ptr->resist_sound && !CHECK_MULTISHADOW()) { @@ -4288,7 +4288,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI } else { - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); } break; @@ -4317,7 +4317,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI if (p_ptr->resist_water) get_damage /= 4; } - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); break; } @@ -4357,7 +4357,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI } } - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); break; } @@ -4379,7 +4379,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI inven_damage(set_cold_destroy, 2); } - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); break; } @@ -4402,7 +4402,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI inven_damage(set_cold_destroy, 2); } - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); break; } @@ -4418,7 +4418,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI { (void)set_confused(p_ptr, p_ptr->confused + randint1(20) + 10); } - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); break; } @@ -4434,7 +4434,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI { (void)apply_disenchant(0); } - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); break; } @@ -4450,7 +4450,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI { apply_nexus(m_ptr); } - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); break; } @@ -4462,7 +4462,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI { (void)set_stun(p_ptr, p_ptr->stun + randint1(20)); } - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); break; } @@ -4490,7 +4490,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI inven_damage(set_cold_destroy, 3); } - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); break; } @@ -4499,7 +4499,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI { if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!")); if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr, p_ptr->slow + randint0(4) + 4, FALSE); - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); break; } @@ -4527,7 +4527,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI } if (p_ptr->wraith_form) dam *= 2; - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); if (p_ptr->wraith_form && !CHECK_MULTISHADOW()) { @@ -4557,7 +4557,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI { (void)set_blind(p_ptr, p_ptr->blind + randint1(5) + 2); } - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); break; } @@ -4620,7 +4620,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI } } - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); break; } @@ -4651,7 +4651,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI inven_damage(set_cold_destroy, 2); } - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); break; } @@ -4660,7 +4660,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI { if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!")); - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); break; } @@ -4711,7 +4711,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI case GF_SUPER_RAY: { if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!")); - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); break; } @@ -4719,7 +4719,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI case GF_PSY_SPEAR: { if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!")); - get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_FORCE, dam, killer, monspell); break; } @@ -4728,7 +4728,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI { if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!")); - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); if (!p_ptr->resist_shard || one_in_(13)) { if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2); @@ -4771,7 +4771,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI if (p_ptr->mimic_form) { if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING)) - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); } else { @@ -4792,7 +4792,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI /* Hurt a lot */ default: { - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); break; } } @@ -4893,7 +4893,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI p_ptr->redraw |= PR_MANA; } - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); } break; } @@ -4921,7 +4921,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI p_ptr->redraw |= PR_MANA; } - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); if (!CHECK_MULTISHADOW()) { if (!p_ptr->resist_blind) @@ -4963,7 +4963,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI else { if (!CHECK_MULTISHADOW()) curse_equipment(15, 0); - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); } break; } @@ -4979,7 +4979,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI else { if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5)); - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); } break; } @@ -4995,7 +4995,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI else { if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15)); - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); } break; } @@ -5010,7 +5010,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI } else { - get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell); if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr,p_ptr->cut + damroll(10, 10)); } break; @@ -5032,7 +5032,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI curse_equipment(40, 20); } - get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell); + get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, m_name, monspell); if (p_ptr->chp < 1) p_ptr->chp = 1; } diff --git a/src/spells2.c b/src/spells2.c index d1dcd5355..d6039ee1a 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -930,7 +930,7 @@ bool unleash_mana_storm(player_type *creature_ptr, bool powerful) (randint1(200) + (powerful ? 500 : 300)) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1); if ((creature_ptr->pclass != CLASS_MAGE) && (creature_ptr->pclass != CLASS_HIGH_MAGE) && (creature_ptr->pclass != CLASS_SORCERER) && (creature_ptr->pclass != CLASS_MAGIC_EATER) && (creature_ptr->pclass != CLASS_BLUE_MAGE)) { - (void)take_hit(DAMAGE_NOESCAPE, 50, _("コントロールし難い強力な魔力の解放", "unleashing magics too mighty to control"), -1); + (void)take_hit(p_ptr, DAMAGE_NOESCAPE, 50, _("コントロールし難い強力な魔力の解放", "unleashing magics too mighty to control"), -1); } return TRUE; } @@ -1081,7 +1081,7 @@ bool genocide_aux(MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, if (player_cast) { - take_hit(DAMAGE_GENO, randint1(dam_side), format(_("%^sの呪文を唱えた疲労", "the strain of casting %^s"), spell_name), -1); + take_hit(p_ptr, DAMAGE_GENO, randint1(dam_side), format(_("%^sの呪文を唱えた疲労", "the strain of casting %^s"), spell_name), -1); } /* Visual feedback */ @@ -2566,7 +2566,7 @@ bool activate_ty_curse(bool stop_ty, int *count) HIT_POINT dam = damroll(10, 10); msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!")); project(0, 8, p_ptr->y, p_ptr->x, dam, GF_MANA, flg, -1); - take_hit(DAMAGE_NOESCAPE, dam, _("純粋な魔力の解放", "released pure mana"), -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, dam, _("純粋な魔力の解放", "released pure mana"), -1); if (!one_in_(6)) break; } case 32: case 33: @@ -2583,7 +2583,7 @@ bool activate_ty_curse(bool stop_ty, int *count) if (!randint0(7)) { project(0, 7, p_ptr->y, p_ptr->x, 50, GF_KILL_WALL, flg, -1); - take_hit(DAMAGE_NOESCAPE, 50, _("エネルギーのうねり", "surge of energy"), -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, 50, _("エネルギーのうねり", "surge of energy"), -1); } if (!one_in_(6)) break; case 1: case 2: case 3: case 16: case 17: @@ -4269,7 +4269,7 @@ bool double_attack(player_type *creature_ptr) bool comvert_hp_to_mp(player_type *creature_ptr) { - int gain_sp = take_hit(DAMAGE_USELIFE, creature_ptr->lev, _("HPからMPへの無謀な変換", "thoughtless convertion from HP to SP"), -1) / 5; + int gain_sp = take_hit(p_ptr, DAMAGE_USELIFE, creature_ptr->lev, _("HPからMPへの無謀な変換", "thoughtless convertion from HP to SP"), -1) / 5; if (gain_sp) { creature_ptr->csp += gain_sp; diff --git a/src/spells3.c b/src/spells3.c index db3e18713..c97629059 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -1226,7 +1226,7 @@ void call_the_(void) msg_print(_("ダンジョンは大きく揺れた。", "The dungeon trembles.")); } - take_hit(DAMAGE_NOESCAPE, 100 + randint1(150), _("自殺的な虚無招来", "a suicidal Call the Void"), -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, 100 + randint1(150), _("自殺的な虚無招来", "a suicidal Call the Void"), -1); } } @@ -3466,7 +3466,7 @@ bool booze(player_type *creature_ptr) bool detonation(player_type *creature_ptr) { msg_print(_("体の中で激しい爆発が起きた!", "Massive explosions rupture your body!")); - take_hit(DAMAGE_NOESCAPE, damroll(50, 20), _("爆発の薬", "a potion of Detonation"), -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, damroll(50, 20), _("爆発の薬", "a potion of Detonation"), -1); (void)set_stun(p_ptr, creature_ptr->stun + 75); (void)set_cut(p_ptr,creature_ptr->cut + 5000); return TRUE; diff --git a/src/trap.c b/src/trap.c index dab60002e..0a4063a98 100644 --- a/src/trap.c +++ b/src/trap.c @@ -320,7 +320,7 @@ static void hit_trap_pit(int trap_feat_type) } } - take_hit(DAMAGE_NOESCAPE, dam, trap_name, -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, dam, trap_name, -1); } /*! @@ -334,7 +334,7 @@ static bool hit_trap_dart(void) if (check_hit(125)) { msg_print(_("小さなダーツが飛んできて刺さった!", "A small dart hits you!")); - take_hit(DAMAGE_ATTACK, damroll(1, 4), _("ダーツの罠", "a dart trap"), -1); + take_hit(p_ptr, DAMAGE_ATTACK, damroll(1, 4), _("ダーツの罠", "a dart trap"), -1); if (!CHECK_MULTISHADOW()) hit = TRUE; } else @@ -437,7 +437,7 @@ void hit_trap(bool break_trap) dam = damroll(2, 8); name = _("落とし戸", "a trap door"); - take_hit(DAMAGE_NOESCAPE, dam, name, -1); + take_hit(p_ptr, DAMAGE_NOESCAPE, dam, name, -1); /* Still alive and autosave enabled */ if (autosave_l && (p_ptr->chp >= 0)) -- 2.11.0