OSDN Git Service

[Refactor] #1148 Reshaped monster-attack-status.cpp
authorHourier <grapefox.whitelucifer.0408@gmail.com>
Fri, 28 May 2021 11:38:20 +0000 (20:38 +0900)
committerHourier <grapefox.whitelucifer.0408@gmail.com>
Sun, 8 Aug 2021 05:59:09 +0000 (14:59 +0900)
src/monster-attack/monster-attack-status.cpp

index 7006d6b..ca08789 100644 (file)
@@ -21,8 +21,9 @@
 
 void process_blind_attack(player_type *target_ptr, monap_type *monap_ptr)
 {
-    if (has_resist_blind(target_ptr) || check_multishadow(target_ptr))
+    if (has_resist_blind(target_ptr) || check_multishadow(target_ptr)) {
         return;
+    }
 
     auto is_dio = monap_ptr->m_ptr->r_idx == MON_DIO;
     auto dio_msg = _("どうだッ!この血の目潰しはッ!", "How is it! This blood-blinding!");
@@ -32,21 +33,24 @@ void process_blind_attack(player_type *target_ptr, monap_type *monap_ptr)
         return;
     }
 
-    if (!set_blind(target_ptr, target_ptr->blind + 10 + randint1(monap_ptr->rlev)))
+    if (!set_blind(target_ptr, target_ptr->blind + 10 + randint1(monap_ptr->rlev))) {
         return;
+    }
 
-    if (is_dio)
+    if (is_dio) {
         msg_print(dio_msg);
+    }
 
     monap_ptr->obvious = true;
 }
 
 void process_terrify_attack(player_type *target_ptr, monap_type *monap_ptr)
 {
-    if (check_multishadow(target_ptr))
+    if (check_multishadow(target_ptr)) {
         return;
+    }
 
-    monster_race *r_ptr = &r_info[monap_ptr->m_ptr->r_idx];
+    auto *r_ptr = &r_info[monap_ptr->m_ptr->r_idx];
     if (has_resist_fear(target_ptr)) {
         msg_print(_("しかし恐怖に侵されなかった!", "You stand your ground!"));
         monap_ptr->obvious = true;
@@ -59,16 +63,18 @@ void process_terrify_attack(player_type *target_ptr, monap_type *monap_ptr)
         return;
     }
 
-    if (set_afraid(target_ptr, target_ptr->afraid + 3 + randint1(monap_ptr->rlev)))
+    if (set_afraid(target_ptr, target_ptr->afraid + 3 + randint1(monap_ptr->rlev))) {
         monap_ptr->obvious = true;
+    }
 }
 
 void process_paralyze_attack(player_type *target_ptr, monap_type *monap_ptr)
 {
-    if (check_multishadow(target_ptr))
+    if (check_multishadow(target_ptr)) {
         return;
+    }
 
-    monster_race *r_ptr = &r_info[monap_ptr->m_ptr->r_idx];
+    auto *r_ptr = &r_info[monap_ptr->m_ptr->r_idx];
     if (target_ptr->free_act) {
         msg_print(_("しかし効果がなかった!", "You are unaffected!"));
         monap_ptr->obvious = true;
@@ -81,37 +87,45 @@ void process_paralyze_attack(player_type *target_ptr, monap_type *monap_ptr)
         return;
     }
 
-    if (!target_ptr->paralyzed && set_paralyzed(target_ptr, 3 + randint1(monap_ptr->rlev)))
+    if (!target_ptr->paralyzed && set_paralyzed(target_ptr, 3 + randint1(monap_ptr->rlev))) {
         monap_ptr->obvious = true;
+    }
 }
 
 void process_lose_all_attack(player_type *target_ptr, monap_type *monap_ptr)
 {
-    if (do_dec_stat(target_ptr, A_STR))
+    if (do_dec_stat(target_ptr, A_STR)) {
         monap_ptr->obvious = true;
+    }
 
-    if (do_dec_stat(target_ptr, A_DEX))
+    if (do_dec_stat(target_ptr, A_DEX)) {
         monap_ptr->obvious = true;
+    }
 
-    if (do_dec_stat(target_ptr, A_CON))
+    if (do_dec_stat(target_ptr, A_CON)) {
         monap_ptr->obvious = true;
+    }
 
-    if (do_dec_stat(target_ptr, A_INT))
+    if (do_dec_stat(target_ptr, A_INT)) {
         monap_ptr->obvious = true;
+    }
 
-    if (do_dec_stat(target_ptr, A_WIS))
+    if (do_dec_stat(target_ptr, A_WIS)) {
         monap_ptr->obvious = true;
+    }
 
-    if (do_dec_stat(target_ptr, A_CHR))
+    if (do_dec_stat(target_ptr, A_CHR)) {
         monap_ptr->obvious = true;
+    }
 }
 
 void process_stun_attack(player_type *target_ptr, monap_type *monap_ptr)
 {
-    if (has_resist_sound(target_ptr) || check_multishadow(target_ptr))
+    if (has_resist_sound(target_ptr) || check_multishadow(target_ptr)) {
         return;
+    }
 
-    monster_race *r_ptr = &r_info[monap_ptr->m_ptr->r_idx];
+    auto *r_ptr = &r_info[monap_ptr->m_ptr->r_idx];
     if (set_stun(target_ptr, target_ptr->stun + 10 + randint1(r_ptr->level / 4)))
         monap_ptr->obvious = true;
 }
@@ -147,46 +161,47 @@ static void describe_disability(player_type *target_ptr, monap_type *monap_ptr)
 
     msg_format(_("あなたは以前ほど%sなくなってしまった...。", "You're not as %s as you used to be..."), monap_ptr->act);
     target_ptr->stat_cur[stat] = (target_ptr->stat_cur[stat] * 3) / 4;
-    if (target_ptr->stat_cur[stat] < 3)
+    if (target_ptr->stat_cur[stat] < 3) {
         target_ptr->stat_cur[stat] = 3;
+    }
 }
 
 void process_monster_attack_time(player_type *target_ptr, monap_type *monap_ptr)
 {
-    if (has_resist_time(target_ptr) || check_multishadow(target_ptr))
+    if (has_resist_time(target_ptr) || check_multishadow(target_ptr)) {
         return;
+    }
 
     switch (randint1(10)) {
     case 1:
     case 2:
     case 3:
     case 4:
-    case 5: {
-        if (target_ptr->prace == RACE_ANDROID)
+    case 5:
+        if (target_ptr->prace == RACE_ANDROID) {
             break;
+        }
 
         msg_print(_("人生が逆戻りした気がする。", "You feel like a chunk of the past has been ripped away."));
         lose_exp(target_ptr, 100 + (target_ptr->exp / 100) * MON_DRAIN_LIFE);
         break;
-    }
     case 6:
     case 7:
     case 8:
-    case 9: {
+    case 9:
         describe_disability(target_ptr, monap_ptr);
         target_ptr->update |= (PU_BONUS);
         break;
-    }
-    case 10: {
+    case 10:
         msg_print(_("あなたは以前ほど力強くなくなってしまった...。", "You're not as powerful as you used to be..."));
-        for (int i = 0; i < A_MAX; i++) {
+        for (auto i = 0; i < A_MAX; i++) {
             target_ptr->stat_cur[i] = (target_ptr->stat_cur[i] * 7) / 8;
-            if (target_ptr->stat_cur[i] < 3)
+            if (target_ptr->stat_cur[i] < 3) {
                 target_ptr->stat_cur[i] = 3;
+            }
         }
 
-        target_ptr->update |= (PU_BONUS);
+        target_ptr->update |= PU_BONUS;
         break;
     }
-    }
 }