OSDN Git Service

Merge remote-tracking branch 'remotes/origin/feature/Fix-Aggravate-S_Fairy' into...
[hengband/hengband.git] / src / player / patron.c
index 14b68c4..cafe9fe 100644 (file)
@@ -5,6 +5,7 @@
 #include "flavor/object-flavor-types.h"
 #include "inventory/inventory-slot-types.h"
 #include "io/write-diary.h"
+#include "mind/mind-chaos-warrior.h"
 #include "monster-floor/monster-summon.h"
 #include "monster-floor/place-monster-types.h"
 #include "monster-race/monster-race-hook.h"
@@ -25,6 +26,7 @@
 #include "spell/spells-object.h"
 #include "spell/spells-status.h"
 #include "spell/spells-summon.h"
+#include "spell/summon-types.h"
 #include "status/base-status.h"
 #include "status/experience.h"
 #include "status/shape-changer.h"
@@ -151,7 +153,6 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward)
 {
     char wrath_reason[32] = "";
     int nasty_chance = 6;
-    tval_type dummy = 0;
     int type, effect;
     concptr reward = NULL;
     GAME_TEXT o_name[MAX_NLEN];
@@ -289,7 +290,7 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward)
             msg_format(_("%sの声が響き渡った:", "The voice of %s booms out:"), chaos_patrons[creature_ptr->chaos_patron]);
             msg_print(_("「我が下僕たちよ、かの傲慢なる者を倒すべし!」", "'My pets, destroy the arrogant mortal!'"));
 
-            for (dummy = 0; dummy < randint1(5) + 1; dummy++) {
+            for (int i = 0, summon_num = randint1(5) + 1; i < summon_num; i++) {
                 (void)summon_specific(creature_ptr, 0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, 0,
                     (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
             }
@@ -341,8 +342,8 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward)
             msg_print(_("「汝、謙虚たることを学ぶべし!」", "'Thou needst a lesson in humility, mortal!'"));
             msg_print(_("あなたは以前より弱くなった!", "You feel less powerful!"));
 
-            for (dummy = 0; dummy < A_MAX; dummy++) {
-                (void)dec_stat(creature_ptr, dummy, 10 + randint1(15), TRUE);
+            for (base_status_type stat = 0; stat < A_MAX; stat++) {
+                (void)dec_stat(creature_ptr, stat, 10 + randint1(15), TRUE);
             }
             reward = _("全能力値が下がった。", "decreasing all stats");
             break;
@@ -360,8 +361,8 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward)
 
             msg_print(_("「我がささやかなる賜物を受けとるがよい!」", "'Receive this modest gift from me!'"));
 
-            for (dummy = 0; dummy < A_MAX; dummy++) {
-                (void)do_inc_stat(creature_ptr, dummy);
+            for (base_status_type stat = 0; stat < A_MAX; stat++) {
+                (void)do_inc_stat(creature_ptr, stat);
             }
             reward = _("全能力値が上がった。", "increasing all stats");
             break;
@@ -385,23 +386,25 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward)
             reward = _("体力が回復した。", "healing");
             break;
 
-        case REW_CURSE_WP:
+        case REW_CURSE_WP: {
+            inventory_slot_type slot;
 
             if (!has_melee_weapon(creature_ptr, INVEN_RARM) && !has_melee_weapon(creature_ptr, INVEN_LARM))
                 break;
             msg_format(_("%sの声が響き渡った:", "The voice of %s booms out:"), chaos_patrons[creature_ptr->chaos_patron]);
             msg_print(_("「汝、武器に頼ることなかれ。」", "'Thou reliest too much on thy weapon.'"));
 
-            dummy = INVEN_RARM;
+            slot = INVEN_RARM;
             if (has_melee_weapon(creature_ptr, INVEN_LARM)) {
-                dummy = INVEN_LARM;
+                slot = INVEN_LARM;
                 if (has_melee_weapon(creature_ptr, INVEN_RARM) && one_in_(2))
-                    dummy = INVEN_RARM;
+                    slot = INVEN_RARM;
             }
-            describe_flavor(creature_ptr, o_name, &creature_ptr->inventory_list[dummy], OD_NAME_ONLY);
-            (void)curse_weapon_object(creature_ptr, FALSE, &creature_ptr->inventory_list[dummy]);
+            describe_flavor(creature_ptr, o_name, &creature_ptr->inventory_list[slot], OD_NAME_ONLY);
+            (void)curse_weapon_object(creature_ptr, FALSE, &creature_ptr->inventory_list[slot]);
             reward = format(_("%sが破壊された。", "destroying %s"), o_name);
             break;
+        }
 
         case REW_CURSE_AR:
 
@@ -431,16 +434,17 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward)
                 break;
             case 3:
                 if (one_in_(2)) {
+                    inventory_slot_type slot;
                     if (!has_melee_weapon(creature_ptr, INVEN_RARM) && !has_melee_weapon(creature_ptr, INVEN_LARM))
                         break;
-                    dummy = INVEN_RARM;
+                    slot = INVEN_RARM;
                     if (has_melee_weapon(creature_ptr, INVEN_LARM)) {
-                        dummy = INVEN_LARM;
+                        slot = INVEN_LARM;
                         if (has_melee_weapon(creature_ptr, INVEN_RARM) && one_in_(2))
-                            dummy = INVEN_RARM;
+                            slot = INVEN_RARM;
                     }
-                    describe_flavor(creature_ptr, o_name, &creature_ptr->inventory_list[dummy], OD_NAME_ONLY);
-                    (void)curse_weapon_object(creature_ptr, FALSE, &creature_ptr->inventory_list[dummy]);
+                    describe_flavor(creature_ptr, o_name, &creature_ptr->inventory_list[slot], OD_NAME_ONLY);
+                    (void)curse_weapon_object(creature_ptr, FALSE, &creature_ptr->inventory_list[slot]);
                     reward = format(_("%sが破壊された。", "destroying %s"), o_name);
                 } else {
                     if (!creature_ptr->inventory_list[INVEN_BODY].k_idx)
@@ -451,8 +455,8 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward)
                 }
                 break;
             default:
-                for (dummy = 0; dummy < A_MAX; dummy++) {
-                    (void)dec_stat(creature_ptr, dummy, 10 + randint1(15), TRUE);
+                for (base_status_type stat = 0; stat < A_MAX; stat++) {
+                    (void)dec_stat(creature_ptr, stat, 10 + randint1(15), TRUE);
                 }
                 reward = _("全能力値が下がった。", "decreasing all stats");
                 break;
@@ -465,23 +469,23 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward)
             msg_print(_("「死ぬがよい、下僕よ!」", "'Die, mortal!'"));
 
             take_hit(creature_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);
+            for (base_status_type stat = 0; stat < A_MAX; stat++) {
+                (void)dec_stat(creature_ptr, stat, 10 + randint1(15), FALSE);
             }
             activate_hi_summon(creature_ptr, creature_ptr->y, creature_ptr->x, FALSE);
             (void)activate_ty_curse(creature_ptr, FALSE, &count);
             if (one_in_(2)) {
-                dummy = 0;
+                inventory_slot_type slot = 0;
 
                 if (has_melee_weapon(creature_ptr, INVEN_RARM)) {
-                    dummy = INVEN_RARM;
+                    slot = INVEN_RARM;
                     if (has_melee_weapon(creature_ptr, INVEN_LARM) && one_in_(2))
-                        dummy = INVEN_LARM;
+                        slot = INVEN_LARM;
                 } else if (has_melee_weapon(creature_ptr, INVEN_LARM))
-                    dummy = INVEN_LARM;
+                    slot = INVEN_LARM;
 
-                if (dummy)
-                    (void)curse_weapon_object(creature_ptr, FALSE, &creature_ptr->inventory_list[dummy]);
+                if (slot)
+                    (void)curse_weapon_object(creature_ptr, FALSE, &creature_ptr->inventory_list[slot]);
             }
             if (one_in_(2))
                 (void)curse_armor(creature_ptr);