OSDN Git Service

[Refactor] #553 朦朧蓄積ランクに痛恨等で補正をかけるようにした
authorHourier <66951241+Hourier@users.noreply.github.com>
Thu, 30 Sep 2021 13:21:12 +0000 (22:21 +0900)
committerHourier <66951241+Hourier@users.noreply.github.com>
Thu, 30 Sep 2021 13:55:09 +0000 (22:55 +0900)
src/monster-attack/monster-attack-player.cpp

index 9c40640..e677409 100644 (file)
@@ -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);