From f0dd51c666fc5ce9c5debed040421e8356e3d56a Mon Sep 17 00:00:00 2001 From: Hourier <66951241+Hourier@users.noreply.github.com> Date: Thu, 30 Sep 2021 22:21:12 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#553=20=E6=9C=A6=E6=9C=A7=E8=93=84?= =?utf8?q?=E7=A9=8D=E3=83=A9=E3=83=B3=E3=82=AF=E3=81=AB=E7=97=9B=E6=81=A8?= =?utf8?q?=E7=AD=89=E3=81=A7=E8=A3=9C=E6=AD=A3=E3=82=92=E3=81=8B=E3=81=91?= =?utf8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/monster-attack/monster-attack-player.cpp | 47 +++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/src/monster-attack/monster-attack-player.cpp b/src/monster-attack/monster-attack-player.cpp index 9c4064066..e6774095e 100644 --- a/src/monster-attack/monster-attack-player.cpp +++ b/src/monster-attack/monster-attack-player.cpp @@ -176,13 +176,58 @@ static void calc_player_cut(player_type *player_ptr, monap_type *monap_ptr) } } +/*! + * @brief 能力値の実値を求める + * @param raw player_typeに格納されている生値 + * @return 実値 + * @details AD&Dの記法に則り、19以上の値を取らなくしているので、格納方法が面倒 + */ +static int stat_value(const int raw) +{ + if (raw <= 18) { + return raw; + } + + return (raw - 18) / 10 + 18; +} + +/*! + * @brief 朦朧を蓄積させる + * @param player_ptr プレイヤーへの参照ポインタ + * @param monap_ptr モンスター打撃への参照ポインタ + * @details + * 痛恨の一撃ならば朦朧蓄積ランクを1上げる. + * 2%の確率で朦朧蓄積ランクを1上げる. + * 肉体のパラメータが合計80を超える水準に強化されていたら朦朧蓄積ランクを1下げる. + */ static void process_player_stun(player_type *player_ptr, monap_type *monap_ptr) { if (monap_ptr->do_stun == 0) { return; } - auto accumulation_rank = PlayerStun::get_accumulation_rank(monap_ptr->d_dice * monap_ptr->d_side, monap_ptr->damage); + auto total = monap_ptr->d_dice * monap_ptr->d_side; + auto accumulation_rank = PlayerStun::get_accumulation_rank(total, monap_ptr->damage); + if (accumulation_rank == 0) { + return; + } + + if ((total < monap_ptr->damage) && (accumulation_rank <= 6)) { + accumulation_rank++; + } + + if (one_in_(50)) { + accumulation_rank++; + } + + auto str = stat_value(player_ptr->stat_cur[A_STR]); + auto dex = stat_value(player_ptr->stat_cur[A_DEX]); + auto con = stat_value(player_ptr->stat_cur[A_CON]); + auto is_powerful_body = str + dex + con > 80; + if (is_powerful_body) { + accumulation_rank--; + } + auto stun_plus = PlayerStun::get_accumulation(accumulation_rank); if (stun_plus > 0) { (void)BadStatusSetter(player_ptr).mod_stun(stun_plus); -- 2.11.0