OSDN Git Service

[Refactor] #38862 Moved artifact.c/h to object/
[hengband/hengband.git] / src / cmd / cmd-activate.c
index e4ec407..f2563e4 100644 (file)
@@ -6,38 +6,36 @@
 * cmd6.cより分離。
 */
 
-#include "angband.h"
-#include "util.h"
-
-#include "cmd-activate.h"
-#include "cmd-item.h"
-#include "cmd-basic.h"
-#include "floor.h"
-#include "object-hook.h"
+#include "system/angband.h"
+#include "main/sound-definitions-table.h"
+
+#include "cmd/cmd-activate.h"
+#include "cmd/cmd-basic.h"
+#include "cmd/cmd-save.h"
+#include "object/object-hook.h"
 #include "sort.h"
-#include "artifact.h"
+#include "object/artifact.h"
 #include "avatar.h"
-#include "spells.h"
-#include "spells-summon.h"
-#include "spells-status.h"
-#include "spells-object.h"
-#include "spells-floor.h"
-#include "player-effects.h"
-#include "realm-hex.h"
-#include "player-status.h"
-#include "player-damage.h"
+#include "spell/spells-summon.h"
+#include "spell/spells-status.h"
+#include "spell/spells-object.h"
+#include "spell/spells-floor.h"
+#include "player/player-effects.h"
+#include "realm/realm-hex.h"
+#include "player/player-damage.h"
 #include "player-inventory.h"
-#include "monster-status.h"
+#include "monster/monster-status.h"
 #include "files.h"
-#include "objectkind.h"
-#include "object-ego.h"
-#include "grid.h"
+#include "object/object-kind.h"
+#include "object/object-ego.h"
 #include "targeting.h"
-#include "realm-song.h"
-#include "player-race.h"
-#include "player-class.h"
-#include "view-mainwindow.h"
-#include "world.h"
+#include "world/world.h"
+#include "effect/spells-effect-util.h"
+#include "spell/spells-type.h"
+#include "spell/process-effect.h"
+#include "effect/effect-characteristics.h"
+#include "spell/spells2.h"
+#include "spell/spells3.h"
 
 /*!
  * @brief 装備耐性に準じたブレス効果の選択テーブル /
@@ -377,23 +375,23 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
        /* Confusion hurts skill */
        if (user_ptr->confused) chance = chance / 2;
 
-       fail = lev+5;
-       if (chance > fail) fail -= (chance - fail)*2;
-       else chance -= (fail - chance)*2;
+       fail = lev + 5;
+       if (chance > fail) fail -= (chance - fail) * 2;
+       else chance -= (fail - chance) * 2;
        if (fail < USE_DEVICE) fail = USE_DEVICE;
        if (chance < USE_DEVICE) chance = USE_DEVICE;
 
-       if(cmd_limit_time_walk(user_ptr)) return;
+       if (cmd_limit_time_walk(user_ptr)) return;
 
        if (user_ptr->pclass == CLASS_BERSERKER) success = FALSE;
        else if (chance > fail)
        {
-               if (randint0(chance*2) < fail) success = FALSE;
+               if (randint0(chance * 2) < fail) success = FALSE;
                else success = TRUE;
        }
        else
        {
-               if (randint0(fail*2) < chance) success = TRUE;
+               if (randint0(fail * 2) < chance) success = TRUE;
                else success = FALSE;
        }
 
@@ -457,7 +455,7 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
                        for (pet_ctr = user_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--)
                        {
                                if (is_pet(&user_ptr->current_floor_ptr->m_list[pet_ctr]) && (user_ptr->riding != pet_ctr))
-                                 who[max_pet++] = pet_ctr;
+                                       who[max_pet++] = pet_ctr;
                        }
 
                        ang_sort(who, &dummy_why, max_pet, ang_sort_comp_pet, ang_sort_swap_hook);
@@ -477,7 +475,7 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
        }
        else if (o_ptr->tval == TV_CAPTURE)
        {
-               if(!o_ptr->pval)
+               if (!o_ptr->pval)
                {
                        bool old_target_pet = target_pet;
                        target_pet = TRUE;
@@ -488,7 +486,7 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
                        }
                        target_pet = old_target_pet;
 
-                       if(fire_ball(user_ptr, GF_CAPTURE, dir, 0, 0))
+                       if (fire_ball(user_ptr, GF_CAPTURE, dir, 0, 0))
                        {
                                o_ptr->pval = (PARAMETER_VALUE)cap_mon;
                                o_ptr->xtra3 = (XTRA8)cap_mspeed;
@@ -503,7 +501,7 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
                                        if (o_ptr->inscription)
                                                strcpy(buf, quark_str(o_ptr->inscription));
                                        s = buf;
-                                       for (s = buf;*s && (*s != '#'); s++)
+                                       for (s = buf; *s && (*s != '#'); s++)
                                        {
 #ifdef JP
                                                if (iskanji(*s)) s++;
@@ -512,7 +510,7 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
                                        *s = '#';
                                        s++;
 #ifdef JP
- /*nothing*/
                                      /*nothing*/
 #else
                                        *s++ = '\'';
 #endif
@@ -524,7 +522,7 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
                                                t++;
                                        }
 #ifdef JP
- /*nothing*/
                                      /*nothing*/
 #else
                                        *s++ = '\'';
 #endif
@@ -537,9 +535,9 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
                {
                        success = FALSE;
                        if (!get_direction(user_ptr, &dir, FALSE, FALSE)) return;
-                       if (monster_can_enter(user_ptr->y + ddy[dir], user_ptr->x + ddx[dir], &r_info[o_ptr->pval], 0))
+                       if (monster_can_enter(user_ptr, user_ptr->y + ddy[dir], user_ptr->x + ddx[dir], &r_info[o_ptr->pval], 0))
                        {
-                               if (place_monster_aux(0, user_ptr->y + ddy[dir], user_ptr->x + ddx[dir], o_ptr->pval, (PM_FORCE_PET | PM_NO_KAGE)))
+                               if (place_monster_aux(user_ptr, 0, user_ptr->y + ddy[dir], user_ptr->x + ddx[dir], o_ptr->pval, (PM_FORCE_PET | PM_NO_KAGE)))
                                {
                                        if (o_ptr->xtra3) user_ptr->current_floor_ptr->m_list[hack_m_idx_ii].mspeed = o_ptr->xtra3;
                                        if (o_ptr->xtra5) user_ptr->current_floor_ptr->m_list[hack_m_idx_ii].max_maxhp = o_ptr->xtra5;
@@ -549,12 +547,13 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
                                        {
                                                char buf[80];
                                                concptr t;
-#ifndef JP
+#ifdef JP
+#else
                                                bool quote = FALSE;
 #endif
 
                                                t = quark_str(o_ptr->inscription);
-                                               for (t = quark_str(o_ptr->inscription);*t && (*t != '#'); t++)
+                                               for (t = quark_str(o_ptr->inscription); *t && (*t != '#'); t++)
                                                {
 #ifdef JP
                                                        if (iskanji(*t)) t++;
@@ -567,13 +566,13 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
 #ifdef JP
                                                        /* nothing */
 #else
-                                                       if (*t =='\'')
+                                                       if (*t == '\'')
                                                        {
                                                                t++;
                                                                quote = TRUE;
                                                        }
 #endif
-                                                       while(*t)
+                                                       while (*t)
                                                        {
                                                                *s = *t;
                                                                t++;
@@ -582,14 +581,14 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
 #ifdef JP
                                                        /* nothing */
 #else
-                                                       if (quote && *(s-1) =='\'')
+                                                       if (quote && *(s - 1) == '\'')
                                                                s--;
 #endif
                                                        *s = '\0';
                                                        user_ptr->current_floor_ptr->m_list[hack_m_idx_ii].nickname = quark_add(buf);
                                                        t = quark_str(o_ptr->inscription);
                                                        s = buf;
-                                                       while(*t && (*t != '#'))
+                                                       while (*t && (*t != '#'))
                                                        {
                                                                *s = *t;
                                                                t++;
@@ -858,8 +857,8 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_format(_("あなたは%sに敵を締め殺すよう命じた。", "You order the %s to strangle your opponent."), name);
                if (!get_aim_dir(user_ptr, &dir)) return FALSE;
-               if (hypodynamic_bolt(user_ptr, dir, 100))
-                       break;
+               hypodynamic_bolt(user_ptr, dir, 100);
+               break;
        }
 
        case ACT_HYPODYNAMIA_2:
@@ -1141,7 +1140,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                if (o_ptr->name1 == ART_HYOUSIGI)
                {
-                       msg_print(_("拍子木を打った。", "You beat Your wooden clappers."));
+                       msg_print(_("拍子木を打った。", "You beat your wooden clappers."));
                }
                else
                {
@@ -1188,14 +1187,14 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
 
        case ACT_SUMMON_ANIMAL:
        {
-               (void)summon_specific(-1, user_ptr->y, user_ptr->x, plev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET));
+               (void)summon_specific(user_ptr, -1, user_ptr->y, user_ptr->x, plev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET));
                break;
        }
 
        case ACT_SUMMON_PHANTOM:
        {
                msg_print(_("幻霊を召喚した。", "You summon a phantasmal servant."));
-               (void)summon_specific(-1, user_ptr->y, user_ptr->x, user_ptr->current_floor_ptr->dun_level, SUMMON_PHANTOM, (PM_ALLOW_GROUP | PM_FORCE_PET));
+               (void)summon_specific(user_ptr, -1, user_ptr->y, user_ptr->x, user_ptr->current_floor_ptr->dun_level, SUMMON_PHANTOM, (PM_ALLOW_GROUP | PM_FORCE_PET));
                break;
        }
 
@@ -1220,7 +1219,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        case ACT_SUMMON_DAWN:
        {
                msg_print(_("暁の師団を召喚した。", "You summon the Legion of the Dawn."));
-               (void)summon_specific(-1, user_ptr->y, user_ptr->x, user_ptr->current_floor_ptr->dun_level, SUMMON_DAWN, (PM_ALLOW_GROUP | PM_FORCE_PET));
+               (void)summon_specific(user_ptr, -1, user_ptr->y, user_ptr->x, user_ptr->current_floor_ptr->dun_level, SUMMON_DAWN, (PM_ALLOW_GROUP | PM_FORCE_PET));
                break;
        }
 
@@ -1462,27 +1461,27 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
                msg_print(_("明るく輝いている...", "It glows brightly..."));
                detect_all(user_ptr, DETECT_RAD_DEFAULT);
                probing(user_ptr);
-               identify_fully(user_ptr, FALSE);
+               identify_fully(user_ptr, FALSE, 0);
                break;
        }
 
        case ACT_ID_FULL:
        {
                msg_print(_("黄色く輝いている...", "It glows yellow..."));
-               identify_fully(user_ptr, FALSE);
+               identify_fully(user_ptr, FALSE, 0);
                break;
        }
 
        case ACT_ID_PLAIN:
        {
-               if (!ident_spell(user_ptr, FALSE)) return FALSE;
+               if (!ident_spell(user_ptr, FALSE, 0)) return FALSE;
                break;
        }
 
        case ACT_RUNE_EXPLO:
        {
                msg_print(_("明るい赤色に輝いている...", "It glows bright red..."));
-               explosive_rune(user_ptr->current_floor_ptr, user_ptr->y, user_ptr->x);
+               explosive_rune(user_ptr, user_ptr->y, user_ptr->x);
                break;
        }
 
@@ -1538,7 +1537,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        case ACT_TELEPORT:
        {
                msg_print(_("周りの空間が歪んでいる...", "It twists space around you..."));
-               teleport_player(user_ptr, 100, 0L);
+               teleport_player(user_ptr, 100, TELEPORT_SPONTANEOUS);
                break;
        }
 
@@ -1608,10 +1607,10 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
                switch (randint1(13))
                {
                case 1: case 2: case 3: case 4: case 5:
-                       teleport_player(user_ptr, 10, 0L);
+                       teleport_player(user_ptr, 10, TELEPORT_SPONTANEOUS);
                        break;
                case 6: case 7: case 8: case 9: case 10:
-                       teleport_player(user_ptr, 222, 0L);
+                       teleport_player(user_ptr, 222, TELEPORT_SPONTANEOUS);
                        break;
                case 11: case 12:
                        (void)stair_creation(user_ptr);
@@ -1664,7 +1663,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
 
        case ACT_PHASE_DOOR:
        {
-               teleport_player(user_ptr, 10, 0L);
+               teleport_player(user_ptr, 10, TELEPORT_SPONTANEOUS);
                break;
        }
 
@@ -1806,5 +1805,3 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
 
        return TRUE;
 }
-
-