OSDN Git Service

[Refactor] #38997 set_oppose_cold() に player_type * 引数を追加.
[hengband/hengband.git] / src / cmd-activate.c
index add8bca..e84a003 100644 (file)
 */
 
 #include "angband.h"
+#include "util.h"
+
 #include "cmd-activate.h"
+#include "cmd-basic.h"
+#include "floor.h"
 #include "object-hook.h"
+#include "sort.h"
+#include "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 "monster-status.h"
+#include "files.h"
+#include "objectkind.h"
+#include "object-ego.h"
+#include "grid.h"
+#include "targeting.h"
+#include "realm-song.h"
+#include "player-race.h"
+#include "player-class.h"
+#include "view-mainwindow.h"
 
 /*!
-* @brief ペット入りモンスターボールをソートするための比較関数
-* @param u 所持品配列の参照ポインタ
-* @param v 未使用
-* @param a 所持品ID1
-* @param b 所持品ID2
-* @return 1の方が大であればTRUE
-*/
-static bool ang_sort_comp_pet(vptr u, vptr v, int a, int b)
-{
-       u16b *who = (u16b*)(u);
-
-       int w1 = who[a];
-       int w2 = who[b];
-
-       monster_type *m_ptr1 = &m_list[w1];
-       monster_type *m_ptr2 = &m_list[w2];
-       monster_race *r_ptr1 = &r_info[m_ptr1->r_idx];
-       monster_race *r_ptr2 = &r_info[m_ptr2->r_idx];
-
-       /* Unused */
-       (void)v;
-
-       if (m_ptr1->nickname && !m_ptr2->nickname) return TRUE;
-       if (m_ptr2->nickname && !m_ptr1->nickname) return FALSE;
-
-       if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return TRUE;
-       if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return FALSE;
-
-       if (r_ptr1->level > r_ptr2->level) return TRUE;
-       if (r_ptr2->level > r_ptr1->level) return FALSE;
-
-       if (m_ptr1->hp > m_ptr2->hp) return TRUE;
-       if (m_ptr2->hp > m_ptr1->hp) return FALSE;
-
-       return w1 <= w2;
-}
+ * @brief 装備耐性に準じたブレス効果の選択テーブル /
+ * Define flags, effect type, name for dragon breath activation
+ */
+const dragonbreath_type dragonbreath_info[] = {
+       { TR_RES_ACID, GF_ACID, _("酸", "acid") },
+       { TR_RES_ELEC, GF_ELEC, _("電撃", "lightning") },
+       { TR_RES_FIRE, GF_FIRE, _("火炎", "fire") },
+       { TR_RES_COLD, GF_COLD, _("冷気", "cold") },
+       { TR_RES_POIS, GF_POIS, _("毒", "poison") },
+       { TR_RES_LITE, GF_LITE, _("閃光", "light") },
+       { TR_RES_DARK, GF_DARK, _("暗黒", "dark") },
+       { TR_RES_SHARDS, GF_SHARDS, _("破片", "shard") },
+       { TR_RES_CONF, GF_CONFUSION, _("混乱", "confusion") },
+       { TR_RES_SOUND, GF_SOUND, _("轟音", "sound") },
+       { TR_RES_NEXUS, GF_NEXUS, _("因果混乱", "nexus") },
+       { TR_RES_NETHER, GF_NETHER, _("地獄", "nether") },
+       { TR_RES_CHAOS, GF_CHAOS, _("カオス", "chaos") },
+       { TR_RES_DISEN, GF_DISENCHANT, _("劣化", "disenchant") },
+       { 0, 0, NULL }
+};
 
+/*!
+ * @brief アイテムの発動効果テーブル /
+ * Define flags, levels, values of activations
+ */
+const activation_type activation_info[] =
+{
+       { "SUNLIGHT", ACT_SUNLIGHT, 10, 250, {10, 0},
+         _("太陽光線", "beam of sunlight") },
+       { "BO_MISS_1", ACT_BO_MISS_1, 10, 250, {2, 0},
+         _("マジック・ミサイル(2d6)", "magic missile (2d6)") },
+       { "BA_POIS_1", ACT_BA_POIS_1, 10, 300, {4, 0},
+         _("悪臭雲(12)", "stinking cloud (12)") },
+       { "BO_ELEC_1", ACT_BO_ELEC_1, 20, 250, {5, 0},
+         _("サンダー・ボルト(4d8)", "lightning bolt (4d8)") },
+       { "BO_ACID_1", ACT_BO_ACID_1, 20, 250, {6, 0},
+         _("アシッド・ボルト(5d8)", "acid bolt (5d8)") },
+       { "BO_COLD_1", ACT_BO_COLD_1, 20, 250, {7, 0},
+         _("アイス・ボルト(6d8)", "frost bolt (6d8)") },
+       { "BO_FIRE_1", ACT_BO_FIRE_1, 20, 250, {8, 0},
+         _("ファイア・ボルト(9d8)", "fire bolt (9d8)") },
+       { "BA_COLD_1", ACT_BA_COLD_1, 30, 750, {6, 0},
+         _("アイス・ボール(48)", "ball of cold (48)") },
+       { "BA_COLD_2", ACT_BA_COLD_2, 40, 1000, {12, 0},
+         _("アイス・ボール(100)", "ball of cold (100)") },
+       { "BA_COLD_3", ACT_BA_COLD_3, 70, 2500, {50, 0},
+         _("巨大アイス・ボール(400)", "ball of cold (400)") },
+       { "BA_FIRE_1", ACT_BA_FIRE_1, 30, 1000, {9, 0},
+         _("ファイア・ボール(72)", "ball of fire (72)") },
+       { "BA_FIRE_2", ACT_BA_FIRE_2, 40, 1500, {15, 0},
+         _("巨大ファイア・ボール(120)", "large fire ball (120)") },
+       { "BA_FIRE_3", ACT_BA_FIRE_3, 60, 1750, {40, 0},
+         _("巨大ファイア・ボール(300)", "fire ball (300)") },
+       { "BA_FIRE_4", ACT_BA_FIRE_4, 40, 1000, {12, 0},
+         _("ファイア・ボール(100)", "fire ball (100)") },
+       { "BA_ELEC_2", ACT_BA_ELEC_2, 40, 1000, {12, 0},
+         _("サンダー・ボール(100)", "ball of lightning (100)") },
+       { "BA_ELEC_3", ACT_BA_ELEC_3, 70, 2500, {70, 0},
+         _("巨大サンダー・ボール(500)", "ball of lightning (500)") },
+       { "BA_ACID_1", ACT_BA_ACID_1, 30, 1000, {12, 0},
+         _("アシッド・ボール(100)", "ball of acid (100)") },
+       { "BA_NUKE_1", ACT_BA_NUKE_1, 50, 1000, {12, 0},
+         _("放射能球(100)", "ball of nuke (100)") },
+       { "HYPODYNAMIA_1", ACT_HYPODYNAMIA_1, 30, 500, {12, 0},
+         _("窒息攻撃(100)", "a strangling attack (100)") },
+       { "HYPODYNAMIA_2", ACT_HYPODYNAMIA_2, 40, 750, {15, 0},
+         _("衰弱の矢(120)", "hypodynamic bolt (120)") },
+       { "DRAIN_1", ACT_DRAIN_1, 40, 1000, {20, 0},
+         _("吸収の矢(3*50)", "drain bolt (3*50)") },
+       { "BO_MISS_2", ACT_BO_MISS_2, 40, 1000, {20, 0},
+         _("矢(150)", "arrows (150)") },
+       { "WHIRLWIND", ACT_WHIRLWIND, 50, 7500, {25, 0},
+         _("カマイタチ", "whirlwind attack") },
+       { "DRAIN_2", ACT_DRAIN_2, 50, 2500, {40, 0},
+         _("吸収の矢(3*100)", "drain bolt (3*100)") },
+       { "CALL_CHAOS", ACT_CALL_CHAOS, 70, 5000, {35, 0},
+         _("混沌召来", "call chaos") },
+       { "ROCKET", ACT_ROCKET, 70, 5000, {20, 0},
+         _("ロケット(120+レベル)", "launch rocket (120+level)") },
+       { "DISP_EVIL", ACT_DISP_EVIL, 50, 4000, {50, 0},
+         _("邪悪退散(x5)", "dispel evil (x5)") },
+       { "BA_MISS_3", ACT_BA_MISS_3, 50, 1500, {50, 0},
+         _("エレメントのブレス(300)", "elemental breath (300)") },
+       { "DISP_GOOD", ACT_DISP_GOOD, 50, 3500, {50, 0},
+         _("善良退散(x5)", "dispel good (x5)") },
+       { "BO_MANA", ACT_BO_MANA, 40, 1500, {20, 0},
+         _("魔法の矢(150)", "a magical arrow (150)") },
+       { "BA_WATER", ACT_BA_WATER, 50, 2000, {25, 0},
+         _("ウォーター・ボール(200)", "water ball (200)") },
+       { "BA_STAR", ACT_BA_STAR, 50, 2200, {25, 0},
+         _("巨大スター・ボール(200)", "large star ball (200)") },
+       { "BA_DARK", ACT_BA_DARK, 50, 2200, {30, 0},
+         _("暗黒の嵐(250)", "darkness storm (250)") },
+       { "BA_MANA", ACT_BA_MANA, 70, 2500, {30, 0},
+         _("魔力の嵐(250)", "a mana storm (250)") },
+       { "PESTICIDE", ACT_PESTICIDE, 10, 500, {10, 0},
+         _("害虫の駆除", "dispel small life") },
+       { "BLINDING_LIGHT", ACT_BLINDING_LIGHT, 30, 5000, {40, 0},
+         _("眩しい光", "blinding light") },
+       { "BIZARRE", ACT_BIZARRE, 90, 10000, {50, 0},
+         _("信じ難いこと", "bizarre things") },
+       { "CAST_BA_STAR", ACT_CAST_BA_STAR, 70, 7500, {100, 0},
+         _("スター・ボール・ダスト(150)", "cast star balls (150)") },
+       { "BLADETURNER", ACT_BLADETURNER, 80, 20000, {80, 0},
+         _("エレメントのブレス(300), 士気高揚、祝福、耐性", "breathe elements (300), hero, bless, and resistance") },
+       { "BR_FIRE", ACT_BR_FIRE, 50, 5000, {-1, 0},
+         _("火炎のブレス (200)", "fire breath (200)") },
+       { "BR_COLD", ACT_BR_COLD, 50, 5000, {-1, 0},
+         _("冷気のブレス (200)", "cold breath (200)") },
+       { "BR_DRAGON", ACT_BR_DRAGON, 70, 10000, { 30, 0 },
+         "" /* built by item_activation_dragon_breath() */ },
+
+       { "CONFUSE", ACT_CONFUSE, 10, 500, {10, 0},
+         _("パニック・モンスター", "confuse monster") },
+       { "SLEEP", ACT_SLEEP, 10, 750, {15, 0},
+         _("周囲のモンスターを眠らせる", "sleep nearby monsters") },
+       { "QUAKE", ACT_QUAKE, 30, 600, {20, 0},
+         _("地震", "earthquake") },
+       { "TERROR", ACT_TERROR, 20, 2500, {-1, 0},
+         _("恐慌", "terror") },
+       { "TELE_AWAY", ACT_TELE_AWAY, 20, 2000, {15, 0},
+         _("テレポート・アウェイ", "teleport away") },
+       { "BANISH_EVIL", ACT_BANISH_EVIL, 40, 2000, {250, 0},
+         _("邪悪消滅", "banish evil") },
+       { "GENOCIDE", ACT_GENOCIDE, 50, 10000, {500, 0},
+         _("抹殺", "genocide") },
+       { "MASS_GENO", ACT_MASS_GENO, 50, 10000, {1000, 0},
+         _("周辺抹殺", "mass genocide") },
+       { "SCARE_AREA", ACT_SCARE_AREA, 20, 2500, {20, 0},
+         _("モンスター恐慌", "frighten monsters") },
+       { "AGGRAVATE", ACT_AGGRAVATE, 0, 100, {0, 0},
+         _("モンスターを怒らせる", "aggravete monsters") },
+
+       { "CHARM_ANIMAL", ACT_CHARM_ANIMAL, 40, 7500, {200, 0},
+         _("動物魅了", "charm animal") },
+       { "CHARM_UNDEAD", ACT_CHARM_UNDEAD, 40, 10000, {333, 0},
+         _("アンデッド従属", "enslave undead") },
+       { "CHARM_OTHER", ACT_CHARM_OTHER, 40, 10000, {400, 0},
+         _("モンスター魅了", "charm monster") },
+       { "CHARM_ANIMALS", ACT_CHARM_ANIMALS, 40, 12500, {500, 0},
+         _("動物友和", "animal friendship") },
+       { "CHARM_OTHERS", ACT_CHARM_OTHERS, 40, 17500, {750, 0},
+         _("周辺魅了", "mass charm") },
+       { "SUMMON_ANIMAL", ACT_SUMMON_ANIMAL, 50, 10000, {200, 300},
+         _("動物召喚", "summon animal") },
+       { "SUMMON_PHANTOM", ACT_SUMMON_PHANTOM, 50, 12000, {200, 200},
+         _("幻霊召喚", "summon phantasmal servant") },
+       { "SUMMON_ELEMENTAL", ACT_SUMMON_ELEMENTAL, 50, 15000, {750, 0},
+         _("エレメンタル召喚", "summon elemental") },
+       { "SUMMON_DEMON", ACT_SUMMON_DEMON, 50, 20000, {666, 0},
+         _("悪魔召喚", "summon demon") },
+       { "SUMMON_UNDEAD", ACT_SUMMON_UNDEAD, 50, 20000, {666, 0},
+         _("アンデッド召喚", "summon undead") },
+       { "SUMMON_HOUND", ACT_SUMMON_HOUND, 50, 15000, {300, 0},
+         _("ハウンド召喚", "summon hound") },
+       { "SUMMON_DAWN", ACT_SUMMON_DAWN, 50, 15000, {500, 0},
+         _("暁の師団召喚", "summon the Legion of the Dawn") },
+       { "SUMMON_OCTOPUS", ACT_SUMMON_OCTOPUS, 50, 15000, {300, 0},
+         _("蛸の大群召喚", "summon octopus") },
+
+       { "CHOIR_SINGS", ACT_CHOIR_SINGS, 60, 20000, {300, 0},
+         _("回復(777)、癒し、士気高揚", "heal 777 hit points, curing and HEROism") },
+       { "CURE_LW", ACT_CURE_LW, 10, 500, {10, 0},
+         _("恐怖除去/体力回復(30)", "remove fear and heal 30 hp") },
+       { "CURE_MW", ACT_CURE_MW, 20, 750, {3, 3},
+         _("傷回復(4d8)", "heal 4d8 and wounds") },
+       { "CURE_POISON", ACT_CURE_POISON, 10, 1000, {5, 0},
+         _("恐怖除去/毒消し", "remove fear and cure poison") },
+       { "REST_LIFE", ACT_REST_EXP, 40, 7500, {450, 0},
+         _("経験値復活", "restore experience") },
+       { "REST_ALL", ACT_REST_ALL, 30, 15000, {750, 0},
+         _("全ステータスと経験値復活", "restore stats and experience") },
+       { "CURE_700", ACT_CURE_700, 40, 10000, {250, 0},
+         _("体力回復(700)", "heal 700 hit points") },
+       { "CURE_1000", ACT_CURE_1000, 50, 15000, {888, 0},
+         _("体力回復(1000)", "heal 1000 hit points") },
+       { "CURING", ACT_CURING, 30, 5000, {100, 0},
+         _("癒し", "curing") },
+       { "CURE_MANA_FULL", ACT_CURE_MANA_FULL, 60, 20000, {777, 0},
+         _("魔力復活", "restore mana") },
+
+       { "ESP", ACT_ESP, 30, 1500, {100, 0},
+         _("テレパシー(期間 25+d30)", "telepathy (dur 25+d30)") },
+       { "BERSERK", ACT_BERSERK, 10, 800, {75, 0},
+         _("狂戦士化(25+d25ターン)", "berserk (25+d25 turns)") },
+       { "PROT_EVIL", ACT_PROT_EVIL, 30, 5000, {100, 0},
+         _("対邪悪結界(期間 3*レベル+d25)", "protect evil (dur level*3 + d25)") },
+       { "RESIST_ALL", ACT_RESIST_ALL, 30, 5000, {111, 0},
+         _("全耐性(期間 20+d20)", "resist elements (dur 20+d20)") },
+       { "SPEED", ACT_SPEED, 40, 15000, {250, 0},
+         _("加速(期間 20+d20)", "speed (dur 20+d20)") },
+       { "XTRA_SPEED", ACT_XTRA_SPEED, 40, 25000, {200, 200},
+         _("加速(期間 75+d75)", "speed (dur 75+d75)") },
+       { "WRAITH", ACT_WRAITH, 90, 25000, {1000, 0},
+         _("幽体化(期間 (レベル/2)+d(レベル/2))", "wraith form (dur level/2 + d(level/2))") },
+       { "INVULN", ACT_INVULN, 90, 25000, {1000, 0},
+         _("無敵化(期間 8+d8)", "invulnerability (dur 8+d8)") },
+       { "HERO", ACT_HERO, 10, 500, {30, 30},
+         _("士気高揚", "heroism") },
+       { "HERO_SPEED", ACT_HERO_SPEED, 30, 20000, {100, 200},
+         _("士気高揚, スピード(期間 50+d50ターン)", "hero and +10 to speed (50)") },
+       { "RESIST_ACID", ACT_RESIST_ACID, 20, 2000, {40, 40},
+         _("酸への耐性(期間 20+d20)", "resist acid (dur 20+d20)") },
+       { "RESIST_FIRE", ACT_RESIST_FIRE, 20, 2000, {40, 40},
+         _("火炎への耐性(期間 20+d20)", "resist fire (dur 20+d20)") },
+       { "RESIST_COLD", ACT_RESIST_COLD, 20, 2000, {40, 40},
+         _("冷気への耐性(期間 20+d20)", "resist cold (dur 20+d20)") },
+       { "RESIST_ELEC", ACT_RESIST_ELEC, 20, 2000, {40, 40},
+         _("電撃への耐性(期間 20+d20)", "resist elec (dur 20+d20)") },
+       { "RESIST_POIS", ACT_RESIST_POIS, 20, 2000, {40, 40},
+         _("毒への耐性(期間 20+d20)", "resist poison (dur 20+d20)") },
+
+       { "LIGHT", ACT_LIGHT, 10, 150, {10, 10},
+         _("イルミネーション", "light area (dam 2d15)") },
+       { "MAP_LIGHT", ACT_MAP_LIGHT, 30, 500, {50, 50},
+         _("魔法の地図と光", "light (dam 2d15) & map area") },
+       { "DETECT_ALL", ACT_DETECT_ALL, 30, 1000, {55, 55},
+         _("全感知", "detection") },
+       { "DETECT_XTRA", ACT_DETECT_XTRA, 50, 12500, {100, 0},
+         _("全感知、探索、*鑑定*", "detection, probing and identify true") },
+       { "ID_FULL", ACT_ID_FULL, 50, 10000, {75, 0},
+         _("*鑑定*", "identify true") },
+       { "ID_PLAIN", ACT_ID_PLAIN, 20, 1250, {10, 0},
+         _("鑑定", "identify spell") },
+       { "RUNE_EXPLO", ACT_RUNE_EXPLO, 40, 4000, {200, 0},
+         _("爆発のルーン", "explosive rune") },
+       { "RUNE_PROT", ACT_RUNE_PROT, 60, 10000, {400, 0},
+         _("守りのルーン", "rune of protection") },
+       { "SATIATE", ACT_SATIATE, 10, 2000, {200, 0},
+         _("空腹充足", "satisfy hunger") },
+       { "DEST_DOOR", ACT_DEST_DOOR, 10, 100, {10, 0},
+         _("ドア破壊", "destroy doors") },
+       { "STONE_MUD", ACT_STONE_MUD, 20, 1000, {3, 0},
+         _("岩石溶解", "stone to mud") },
+       { "RECHARGE", ACT_RECHARGE, 30, 1000, {70, 0},
+         _("魔力充填", "recharging") },
+       { "ALCHEMY", ACT_ALCHEMY, 50, 10000, {500, 0},
+         _("錬金術", "alchemy") },
+       { "DIM_DOOR", ACT_DIM_DOOR, 50, 10000, {100, 0},
+         _("次元の扉", "dimension door") },
+       { "TELEPORT", ACT_TELEPORT, 10, 2000, {25, 0},
+         _("テレポート", "teleport") },
+       { "RECALL", ACT_RECALL, 30, 7500, {200, 0},
+         _("帰還の詔", "word of recall") },
+       { "JUDGE", ACT_JUDGE, 90, 50000, {20, 20},
+         _("体力と引き替えに千里眼と帰還", "a telekinesis (500 lb)") },
+       { "TELEKINESIS", ACT_TELEKINESIS, 20, 5500, {25, 25},
+         _("物体を引き寄せる(重量25kgまで)", "clairvoyance and recall, draining you") },
+       { "DETECT_UNIQUE", ACT_DETECT_UNIQUE, 40, 10000, {200, 0},
+         _("この階にいるユニークモンスターを表示", "list of the uniques on the level") },
+       { "ESCAPE", ACT_ESCAPE, 10, 3000, {35, 0},
+         _("逃走", "a getaway") },
+       { "DISP_CURSE_XTRA", ACT_DISP_CURSE_XTRA, 40, 30000, {0, 0},
+         _("*解呪*と調査", "dispel curse and probing") },
+       { "BRAND_FIRE_BOLTS", ACT_BRAND_FIRE_BOLTS, 40, 20000, {999, 0},
+         _("刃先のファイア・ボルト", "fire branding of bolts") },
+       { "RECHARGE_XTRA", ACT_RECHARGE_XTRA, 70, 30000, {200, 0},
+         _("魔力充填", "recharge item") },
+       { "LORE", ACT_LORE, 10, 30000, {0, 0},
+         _("危険を伴う鑑定", "perilous identify") },
+       { "SHIKOFUMI", ACT_SHIKOFUMI, 10, 10000, {100, 100},
+         _("四股踏み", "shiko") },
+       { "PHASE_DOOR", ACT_PHASE_DOOR, 10, 1500, {10, 0},
+         _("ショート・テレポート", "blink") },
+       { "DETECT_ALL_MONS", ACT_DETECT_ALL_MONS, 30, 3000, {150, 0},
+         _("全モンスター感知", "detect all monsters") },
+       { "ULTIMATE_RESIST", ACT_ULTIMATE_RESIST, 90, 20000, {777, 0},
+         _("士気高揚、祝福、究極の耐性", "hero, bless, and ultimate resistance") },
+
+       { "CAST_OFF", ACT_CAST_OFF, 30, 15000, {100, 0},
+         _("脱衣と小宇宙燃焼", "cast it off and cosmic heroism") },
+       { "FISHING", ACT_FISHING, 0, 100, {0, 0},
+         _("釣りをする", "fishing") },
+       { "INROU", ACT_INROU, 40, 15000, {150, 150},
+         _("例のアレ", "reveal your identity") },
+       { "MURAMASA", ACT_MURAMASA, 0, 0, {-1, 0},
+         _("腕力の上昇", "increase STR") },
+       { "BLOODY_MOON", ACT_BLOODY_MOON, 0, 0, {3333, 0},
+         _("属性変更", "change zokusei") },
+       { "CRIMSON", ACT_CRIMSON, 0, 50000, {15, 0},
+         _("ファイア!", "fire!") },
+
+       { "STRAIN_HASTE", ACT_STRAIN_HASTE, 10, 1000, {120, 100},
+         _("体力と引き換えに加速", "haste with strain") },
+       { "GRAND_CROSS", ACT_GRAND_CROSS, 30, 15000, {250, 200},
+         _("グランド・クロス", "grand cross") },
+       { "TELEPORT_LEVEL", ACT_TELEPORT_LEVEL, 10, 1500, {100, 200},
+         _("テレポート・レベル", "teleort level") },
+       { "ARTS_FALLING_STAR", ACT_FALLING_STAR, 20, 5500, {30, 50},
+         _("魔剣・流れ星", "blade arts 'falling star'") },
+       { NULL, 0, 0, 0, {0, 0},
+         "" }
+};
 
 /*!
  * @brief 装備を発動するコマンドのサブルーチン /
@@ -60,11 +341,11 @@ static bool ang_sort_comp_pet(vptr u, vptr v, int a, int b)
  * <pre>
  * Currently, only (some) artifacts, and Dragon Scale Mail, can be activated.
  * But one could, for example, easily make an activatable "Ring of Plasma".
- * Note that it always takes a turn to activate an artifact, even if
+ * Note that it always takes a current_world_ptr->game_turn to activate an artifact, even if
  * the user hits "escape" at the "direction" prompt.
  * </pre>
  */
-void do_cmd_activate_aux(INVENTORY_IDX item)
+void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
 {
        DIRECTION dir;
        DEPTH lev;
@@ -72,22 +353,20 @@ void do_cmd_activate_aux(INVENTORY_IDX item)
        object_type *o_ptr;
        bool success;
 
-
        /* Get the item (in the pack) */
        if (item >= 0)
        {
-               o_ptr = &inventory[item];
+               o_ptr = &user_ptr->inventory_list[item];
        }
 
        /* Get the item (on the floor) */
        else
        {
-               o_ptr = &o_list[0 - item];
+               o_ptr = &current_floor_ptr->o_list[0 - item];
        }
 
-       p_ptr->energy_use = 100;
+       take_turn(user_ptr, 100);
 
-       /* Extract the item level */
        lev = k_info[o_ptr->k_idx].level;
 
        /* Hack -- use artifact level instead */
@@ -102,10 +381,10 @@ void do_cmd_activate_aux(INVENTORY_IDX item)
        else if (((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET)) && o_ptr->name2) lev = e_info[o_ptr->name2].level;
 
        /* Base chance of success */
-       chance = p_ptr->skill_dev;
+       chance = user_ptr->skill_dev;
 
        /* Confusion hurts skill */
-       if (p_ptr->confused) chance = chance / 2;
+       if (user_ptr->confused) chance = chance / 2;
 
        fail = lev+5;
        if (chance > fail) fail -= (chance - fail)*2;
@@ -113,15 +392,9 @@ void do_cmd_activate_aux(INVENTORY_IDX item)
        if (fail < USE_DEVICE) fail = USE_DEVICE;
        if (chance < USE_DEVICE) chance = USE_DEVICE;
 
-       if (world_player)
-       {
-               if (flush_failure) flush();
-               msg_print(_("止まった時の中ではうまく働かないようだ。", "It shows no reaction."));
-               sound(SOUND_FAIL);
-               return;
-       }
+       if(cmd_limit_time_walk(user_ptr)) return;
 
-       if (p_ptr->pclass == CLASS_BERSERKER) success = FALSE;
+       if (user_ptr->pclass == CLASS_BERSERKER) success = FALSE;
        else if (chance > fail)
        {
                if (randint0(chance*2) < fail) success = FALSE;
@@ -154,7 +427,7 @@ void do_cmd_activate_aux(INVENTORY_IDX item)
                ((o_ptr->sval == SV_LITE_TORCH) || (o_ptr->sval == SV_LITE_LANTERN)))
        {
                msg_print(_("燃料がない。", "It has no fuel."));
-               p_ptr->energy_use = 0;
+               free_turn(user_ptr);
                return;
        }
 
@@ -168,7 +441,7 @@ void do_cmd_activate_aux(INVENTORY_IDX item)
        {
                (void)activate_artifact(o_ptr);
 
-               p_ptr->window |= (PW_INVEN | PW_EQUIP);
+               user_ptr->window |= (PW_INVEN | PW_EQUIP);
 
                /* Success */
                return;
@@ -177,40 +450,36 @@ void do_cmd_activate_aux(INVENTORY_IDX item)
        /* Special items */
        else if (o_ptr->tval == TV_WHISTLE)
        {
-               if (music_singing_any()) stop_singing();
+               if (music_singing_any()) stop_singing(user_ptr);
                if (hex_spelling_any()) stop_hex_spell_all();
 
                {
-                       IDX pet_ctr, i;
-                       IDX *who;
+                       MONSTER_IDX pet_ctr, i;
+                       MONSTER_IDX *who;
                        int max_pet = 0;
                        u16b dummy_why;
 
                        /* Allocate the "who" array */
-                       C_MAKE(who, max_m_idx, IDX);
+                       C_MAKE(who, current_floor_ptr->max_m_idx, MONSTER_IDX);
 
                        /* Process the monsters (backwards) */
-                       for (pet_ctr = m_max - 1; pet_ctr >= 1; pet_ctr--)
+                       for (pet_ctr = current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--)
                        {
-                               if (is_pet(&m_list[pet_ctr]) && (p_ptr->riding != pet_ctr))
+                               if (is_pet(&current_floor_ptr->m_list[pet_ctr]) && (user_ptr->riding != pet_ctr))
                                  who[max_pet++] = pet_ctr;
                        }
 
-                       /* Select the sort method */
-                       ang_sort_comp = ang_sort_comp_pet;
-                       ang_sort_swap = ang_sort_swap_hook;
-
-                       ang_sort(who, &dummy_why, max_pet);
+                       ang_sort(who, &dummy_why, max_pet, ang_sort_comp_pet, ang_sort_swap_hook);
 
                        /* Process the monsters (backwards) */
                        for (i = 0; i < max_pet; i++)
                        {
                                pet_ctr = who[i];
-                               teleport_monster_to(pet_ctr, p_ptr->y, p_ptr->x, 100, TELEPORT_PASSIVE);
+                               teleport_monster_to(pet_ctr, user_ptr->y, user_ptr->x, 100, TELEPORT_PASSIVE);
                        }
 
                        /* Free the "who" array */
-                       C_KILL(who, max_m_idx, IDX);
+                       C_KILL(who, current_floor_ptr->max_m_idx, MONSTER_IDX);
                }
                o_ptr->timeout = 100 + randint1(100);
                return;
@@ -236,7 +505,7 @@ void do_cmd_activate_aux(INVENTORY_IDX item)
                                o_ptr->xtra5 = (XTRA16)cap_maxhp;
                                if (cap_nickname)
                                {
-                                       cptr t;
+                                       concptr t;
                                        char *s;
                                        char buf[80] = "";
 
@@ -277,18 +546,18 @@ void do_cmd_activate_aux(INVENTORY_IDX item)
                {
                        success = FALSE;
                        if (!get_direction(&dir, FALSE, FALSE)) return;
-                       if (monster_can_enter(p_ptr->y + ddy[dir], p_ptr->x + ddx[dir], &r_info[o_ptr->pval], 0))
+                       if (monster_can_enter(user_ptr->y + ddy[dir], user_ptr->x + ddx[dir], &r_info[o_ptr->pval], 0))
                        {
-                               if (place_monster_aux(0, p_ptr->y + ddy[dir], p_ptr->x + ddx[dir], o_ptr->pval, (PM_FORCE_PET | PM_NO_KAGE)))
+                               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 (o_ptr->xtra3) m_list[hack_m_idx_ii].mspeed = o_ptr->xtra3;
-                                       if (o_ptr->xtra5) m_list[hack_m_idx_ii].max_maxhp = o_ptr->xtra5;
-                                       if (o_ptr->xtra4) m_list[hack_m_idx_ii].hp = o_ptr->xtra4;
-                                       m_list[hack_m_idx_ii].maxhp = m_list[hack_m_idx_ii].max_maxhp;
+                                       if (o_ptr->xtra3) current_floor_ptr->m_list[hack_m_idx_ii].mspeed = o_ptr->xtra3;
+                                       if (o_ptr->xtra5) current_floor_ptr->m_list[hack_m_idx_ii].max_maxhp = o_ptr->xtra5;
+                                       if (o_ptr->xtra4) current_floor_ptr->m_list[hack_m_idx_ii].hp = o_ptr->xtra4;
+                                       current_floor_ptr->m_list[hack_m_idx_ii].maxhp = current_floor_ptr->m_list[hack_m_idx_ii].max_maxhp;
                                        if (o_ptr->inscription)
                                        {
                                                char buf[80];
-                                               cptr t;
+                                               concptr t;
 #ifndef JP
                                                bool quote = FALSE;
 #endif
@@ -326,7 +595,7 @@ void do_cmd_activate_aux(INVENTORY_IDX item)
                                                                s--;
 #endif
                                                        *s = '\0';
-                                                       m_list[hack_m_idx_ii].nickname = quark_add(buf);
+                                                       current_floor_ptr->m_list[hack_m_idx_ii].nickname = quark_add(buf);
                                                        t = quark_str(o_ptr->inscription);
                                                        s = buf;
                                                        while(*t && (*t != '#'))
@@ -361,21 +630,15 @@ void do_cmd_activate_aux(INVENTORY_IDX item)
  * @brief 装備を発動するコマンドのメインルーチン /
  * @return なし
  */
-void do_cmd_activate(void)
+void do_cmd_activate(player_type *user_ptr)
 {
        OBJECT_IDX item;
-       cptr q, s;
+       concptr q, s;
 
-       if (p_ptr->wild_mode) return;
-
-       if (p_ptr->inside_arena)
-       {
-               msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));
-               msg_print(NULL);
-               return;
-       }
+       if (user_ptr->wild_mode) return;
+       if (cmd_limit_arena(user_ptr)) return;
 
-       if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
+       if (user_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
        {
                set_action(ACTION_NONE);
        }
@@ -385,10 +648,10 @@ void do_cmd_activate(void)
        q = _("どのアイテムを始動させますか? ", "Activate which item? ");
        s = _("始動できるアイテムを装備していない。", "You have nothing to activate.");
 
-       if (!choose_object(&item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT))) return;
+       if (!choose_object(&item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0)) return;
 
        /* Activate the item */
-       do_cmd_activate_aux(item);
+       exe_activate(user_ptr, item);
 }
 
 /*!
@@ -401,7 +664,7 @@ static bool activate_dragon_breath(object_type *o_ptr)
 {
        BIT_FLAGS flgs[TR_FLAG_SIZE]; /* for resistance flags */
        int type[20];
-       cptr name[20];
+       concptr name[20];
        int i, t, n = 0;
        DIRECTION dir;
 
@@ -418,12 +681,10 @@ static bool activate_dragon_breath(object_type *o_ptr)
                        n++;
                }
        }
-
-       /* Paranoia */
        if (n == 0) return FALSE;
 
        /* Stop speaking */
-       if (music_singing_any()) stop_singing();
+       if (music_singing_any()) stop_singing(p_ptr);
        if (hex_spelling_any()) stop_hex_spell_all();
 
        t = randint0(n);
@@ -443,10 +704,8 @@ bool activate_artifact(object_type *o_ptr)
        PLAYER_LEVEL plev = p_ptr->lev;
        int k, dummy = 0;
        DIRECTION dir;
-       cptr name = k_name + k_info[o_ptr->k_idx].name;
+       concptr name = k_name + k_info[o_ptr->k_idx].name;
        const activation_type* const act_ptr = find_activation_info(o_ptr);
-
-       /* Paranoia */
        if (!act_ptr) {
                /* Maybe forgot adding information to activation_info table ? */
                msg_print("Activation information is not found.");
@@ -622,7 +881,7 @@ bool activate_artifact(object_type *o_ptr)
                for (dummy = 0; dummy < 3; dummy++)
                {
                        if (hypodynamic_bolt(dir, 50))
-                               hp_player(50);
+                               hp_player(p_ptr, 50);
                }
                break;
        }
@@ -647,7 +906,7 @@ bool activate_artifact(object_type *o_ptr)
                for (dummy = 0; dummy < 3; dummy++)
                {
                        if (hypodynamic_bolt(dir, 100))
-                               hp_player(100);
+                               hp_player(p_ptr, 100);
                }
                break;
        }
@@ -775,14 +1034,14 @@ bool activate_artifact(object_type *o_ptr)
                msg_print(_("あなたはエレメントのブレスを吐いた。", "You breathe the elements."));
                fire_breath(GF_MISSILE, dir, 300, 4);
                msg_print(_("鎧が様々な色に輝いた...", "Your armor glows many colours..."));
-               (void)set_afraid(0);
-               (void)set_hero(randint1(50) + 50, FALSE);
-               (void)hp_player(10);
-               (void)set_blessed(randint1(50) + 50, FALSE);
-               (void)set_oppose_acid(randint1(50) + 50, FALSE);
-               (void)set_oppose_elec(randint1(50) + 50, FALSE);
-               (void)set_oppose_fire(randint1(50) + 50, FALSE);
-               (void)set_oppose_cold(randint1(50) + 50, FALSE);
+               (void)set_afraid(p_ptr, 0);
+               (void)set_hero(p_ptr, randint1(50) + 50, FALSE);
+               (void)hp_player(p_ptr, 10);
+               (void)set_blessed(p_ptr, randint1(50) + 50, FALSE);
+               (void)set_oppose_acid(p_ptr, randint1(50) + 50, FALSE);
+               (void)set_oppose_elec(p_ptr, randint1(50) + 50, FALSE);
+               (void)set_oppose_fire(p_ptr, randint1(50) + 50, FALSE);
+               (void)set_oppose_cold(p_ptr, randint1(50) + 50, FALSE);
                (void)set_oppose_pois(randint1(50) + 50, FALSE);
                break;
        }
@@ -793,7 +1052,7 @@ bool activate_artifact(object_type *o_ptr)
                fire_breath(GF_FIRE, dir, 200, 2);
                if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
                {
-                       (void)set_oppose_fire(randint1(20) + 20, FALSE);
+                       (void)set_oppose_fire(p_ptr, randint1(20) + 20, FALSE);
                }
                break;
        }
@@ -804,7 +1063,7 @@ bool activate_artifact(object_type *o_ptr)
                fire_breath(GF_COLD, dir, 200, 2);
                if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
                {
-                       (void)set_oppose_cold(randint1(20) + 20, FALSE);
+                       (void)set_oppose_cold(p_ptr, randint1(20) + 20, FALSE);
                }
                break;
        }
@@ -833,7 +1092,7 @@ bool activate_artifact(object_type *o_ptr)
 
        case ACT_QUAKE:
        {
-               earthquake(p_ptr->y, p_ptr->x, 5);
+               earthquake(p_ptr->y, p_ptr->x, 5, 0);
                break;
        }
 
@@ -875,7 +1134,7 @@ bool activate_artifact(object_type *o_ptr)
 
        case ACT_SCARE_AREA:
        {
-               if (music_singing_any()) stop_singing();
+               if (music_singing_any()) stop_singing(p_ptr);
                if (hex_spelling_any()) stop_hex_spell_all();
                msg_print(_("あなたは力強い突風を吹き鳴らした。周囲の敵が震え上っている!",
                        "You wind a mighty blast; your enemies tremble!"));
@@ -934,37 +1193,20 @@ bool activate_artifact(object_type *o_ptr)
 
        case ACT_SUMMON_ANIMAL:
        {
-               (void)summon_specific(-1, p_ptr->y, p_ptr->x, plev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET), '\0');
+               (void)summon_specific(-1, p_ptr->y, p_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, p_ptr->y, p_ptr->x, dun_level, SUMMON_PHANTOM, (PM_ALLOW_GROUP | PM_FORCE_PET), '\0');
+               (void)summon_specific(-1, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_PHANTOM, (PM_ALLOW_GROUP | PM_FORCE_PET));
                break;
        }
 
        case ACT_SUMMON_ELEMENTAL:
-       {
-               bool pet = one_in_(3);
-               BIT_FLAGS mode = 0L;
-
-               if (!(pet && (plev < 50))) mode |= PM_ALLOW_GROUP;
-               if (pet) mode |= PM_FORCE_PET;
-               else mode |= PM_NO_PET;
-
-               if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, ((plev * 3) / 2), SUMMON_ELEMENTAL, mode, '\0'))
-               {
-                       msg_print(_("エレメンタルが現れた...", "An elemental materializes..."));
-                       if (pet)
-                               msg_print(_("あなたに服従しているようだ。", "It seems obedient to you."));
-                       else
-                               msg_print(_("それをコントロールできなかった!", "You fail to control it!"));
-               }
-
+               if (!cast_summon_elemental(p_ptr, (plev * 3) / 2)) return FALSE;
                break;
-       }
 
        case ACT_SUMMON_DEMON:
        {
@@ -973,76 +1215,23 @@ bool activate_artifact(object_type *o_ptr)
        }
 
        case ACT_SUMMON_UNDEAD:
-       {
-               bool pet = one_in_(3);
-               int type;
-               BIT_FLAGS mode = 0L;
-
-               type = (plev > 47 ? SUMMON_HI_UNDEAD : SUMMON_UNDEAD);
-
-               if (!pet || ((plev > 24) && one_in_(3))) mode |= PM_ALLOW_GROUP;
-               if (pet) mode |= PM_FORCE_PET;
-               else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
-
-               if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, ((plev * 3) / 2), type, mode, '\0'))
-               {
-                       msg_print(_("冷たい風があなたの周りに吹き始めた。それは腐敗臭を運んでいる...",
-                               "Cold winds begin to blow around you, carrying with them the stench of decay..."));
-                       if (pet)
-                               msg_print(_("古えの死せる者共があなたに仕えるため土から甦った!",
-                                       "Ancient, long-dead forms arise from the ground to serve you!"));
-                       else
-                               msg_print(_("死者が甦った。眠りを妨げるあなたを罰するために!",
-                                       "'The dead arise... to punish you for disturbing them!'"));
-               }
-
+               if (!cast_summon_undead(p_ptr, (plev * 3) / 2)) return FALSE;
                break;
-       }
 
        case ACT_SUMMON_HOUND:
-       {
-               BIT_FLAGS mode = PM_ALLOW_GROUP;
-               bool pet = !one_in_(5);
-               if (pet) mode |= PM_FORCE_PET;
-               else mode |= PM_NO_PET;
-
-               if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, ((p_ptr->lev * 3) / 2), SUMMON_HOUND, mode, '\0'))
-               {
-
-                       if (pet)
-                               msg_print(_("ハウンドがあなたの下僕として出現した。",
-                                       "A group of hounds appear as your servant."));
-                       else
-                               msg_print(_("ハウンドはあなたに牙を向けている!",
-                                       "A group of hounds appear as your enemy!"));
-               }
-
+               if (!cast_summon_hound(p_ptr, (plev * 3) / 2)) return FALSE;
                break;
-       }
 
        case ACT_SUMMON_DAWN:
        {
                msg_print(_("暁の師団を召喚した。", "You summon the Legion of the Dawn."));
-               (void)summon_specific(-1, p_ptr->y, p_ptr->x, dun_level, SUMMON_DAWN, (PM_ALLOW_GROUP | PM_FORCE_PET), '\0');
+               (void)summon_specific(-1, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DAWN, (PM_ALLOW_GROUP | PM_FORCE_PET));
                break;
        }
 
        case ACT_SUMMON_OCTOPUS:
-       {
-               BIT_FLAGS mode = PM_ALLOW_GROUP;
-               bool pet = !one_in_(5);
-               if (pet) mode |= PM_FORCE_PET;
-
-               if (summon_named_creature(0, p_ptr->y, p_ptr->x, MON_JIZOTAKO, mode))
-               {
-                       if (pet)
-                               msg_print(_("蛸があなたの下僕として出現した。", "A group of octopuses appear as your servant."));
-                       else
-                               msg_print(_("蛸はあなたを睨んでいる!", "A group of octopuses appear as your enemy!"));
-               }
-
+               if(!cast_summon_octopus(p_ptr)) return FALSE;
                break;
-       }
 
        /* Activate for healing */
 
@@ -1050,14 +1239,14 @@ bool activate_artifact(object_type *o_ptr)
        {
                msg_print(_("天国の歌が聞こえる...", "A heavenly choir sings..."));
                (void)cure_critical_wounds(777);
-               (void)set_hero(randint1(25) + 25, FALSE);
+               (void)set_hero(p_ptr, randint1(25) + 25, FALSE);
                break;
        }
 
        case ACT_CURE_LW:
        {
-               (void)set_afraid(0);
-               (void)hp_player(30);
+               (void)set_afraid(p_ptr, 0);
+               (void)hp_player(p_ptr, 30);
                break;
        }
 
@@ -1071,8 +1260,8 @@ bool activate_artifact(object_type *o_ptr)
        case ACT_CURE_POISON:
        {
                msg_print(_("深青色に輝いている...", "It glows deep blue..."));
-               (void)set_afraid(0);
-               (void)set_poisoned(0);
+               (void)set_afraid(p_ptr, 0);
+               (void)set_poisoned(p_ptr, 0);
                break;
        }
 
@@ -1139,17 +1328,17 @@ bool activate_artifact(object_type *o_ptr)
        {
                msg_format(_("%sから鋭い音が流れ出た...", "The %s lets out a shrill wail..."), name);
                k = 3 * p_ptr->lev;
-               (void)set_protevil(randint1(25) + k, FALSE);
+               (void)set_protevil(p_ptr, randint1(25) + k, FALSE);
                break;
        }
 
        case ACT_RESIST_ALL:
        {
                msg_print(_("様々な色に輝いている...", "It glows many colours..."));
-               (void)set_oppose_acid(randint1(40) + 40, FALSE);
-               (void)set_oppose_elec(randint1(40) + 40, FALSE);
-               (void)set_oppose_fire(randint1(40) + 40, FALSE);
-               (void)set_oppose_cold(randint1(40) + 40, FALSE);
+               (void)set_oppose_acid(p_ptr, randint1(40) + 40, FALSE);
+               (void)set_oppose_elec(p_ptr, randint1(40) + 40, FALSE);
+               (void)set_oppose_fire(p_ptr, randint1(40) + 40, FALSE);
+               (void)set_oppose_cold(p_ptr, randint1(40) + 40, FALSE);
                (void)set_oppose_pois(randint1(40) + 40, FALSE);
                break;
        }
@@ -1157,14 +1346,14 @@ bool activate_artifact(object_type *o_ptr)
        case ACT_SPEED:
        {
                msg_print(_("明るく緑色に輝いている...", "It glows bright green..."));
-               (void)set_fast(randint1(20) + 20, FALSE);
+               (void)set_fast(p_ptr, randint1(20) + 20, FALSE);
                break;
        }
 
        case ACT_XTRA_SPEED:
        {
                msg_print(_("明るく輝いている...", "It glows brightly..."));
-               (void)set_fast(randint1(75) + 75, FALSE);
+               (void)set_fast(p_ptr, randint1(75) + 75, FALSE);
                break;
        }
 
@@ -1176,7 +1365,7 @@ bool activate_artifact(object_type *o_ptr)
 
        case ACT_INVULN:
        {
-               (void)set_invuln(randint1(8) + 8, FALSE);
+               (void)set_invuln(p_ptr, randint1(8) + 8, FALSE);
                break;
        }
 
@@ -1188,7 +1377,7 @@ bool activate_artifact(object_type *o_ptr)
 
        case ACT_HERO_SPEED:
        {
-               (void)set_fast(randint1(50) + 50, FALSE);
+               (void)set_fast(p_ptr, randint1(50) + 50, FALSE);
                (void)heroism(50);
                break;
        }
@@ -1201,7 +1390,7 @@ bool activate_artifact(object_type *o_ptr)
                        if (!get_aim_dir(&dir)) return FALSE;
                        fire_ball(GF_ACID, dir, 100, 2);
                }
-               (void)set_oppose_acid(randint1(20) + 20, FALSE);
+               (void)set_oppose_acid(p_ptr, randint1(20) + 20, FALSE);
                break;
        }
 
@@ -1213,7 +1402,7 @@ bool activate_artifact(object_type *o_ptr)
                        if (!get_aim_dir(&dir)) return FALSE;
                        fire_ball(GF_FIRE, dir, 100, 2);
                }
-               (void)set_oppose_fire(randint1(20) + 20, FALSE);
+               (void)set_oppose_fire(p_ptr, randint1(20) + 20, FALSE);
                break;
        }
 
@@ -1225,7 +1414,7 @@ bool activate_artifact(object_type *o_ptr)
                        if (!get_aim_dir(&dir)) return FALSE;
                        fire_ball(GF_COLD, dir, 100, 2);
                }
-               (void)set_oppose_cold(randint1(20) + 20, FALSE);
+               (void)set_oppose_cold(p_ptr, randint1(20) + 20, FALSE);
                break;
        }
 
@@ -1237,7 +1426,7 @@ bool activate_artifact(object_type *o_ptr)
                        if (!get_aim_dir(&dir)) return FALSE;
                        fire_ball(GF_ELEC, dir, 100, 2);
                }
-               (void)set_oppose_elec(randint1(20) + 20, FALSE);
+               (void)set_oppose_elec(p_ptr, randint1(20) + 20, FALSE);
                break;
        }
 
@@ -1361,7 +1550,7 @@ bool activate_artifact(object_type *o_ptr)
        case ACT_RECALL:
        {
                msg_print(_("やわらかな白色に輝いている...", "It glows soft white..."));
-               if (!word_of_recall()) return FALSE;
+               if (!recall_player(p_ptr, randint0(21) + 15)) return FALSE;
                break;
        }
 
@@ -1381,7 +1570,7 @@ bool activate_artifact(object_type *o_ptr)
 
                if (get_check(_("帰還の力を使いますか?", "Activate recall? ")))
                {
-                       (void)word_of_recall();
+                       (void)recall_player(p_ptr, randint0(21) + 15);
                }
 
                break;
@@ -1402,13 +1591,13 @@ bool activate_artifact(object_type *o_ptr)
                monster_race *r_ptr;
                msg_print(_("奇妙な場所が頭の中に浮かんだ...", "Some strange places show up in your mind. And you see ..."));
                /* Process the monsters (backwards) */
-               for (i = m_max - 1; i >= 1; i--)
+               for (i = current_floor_ptr->m_max - 1; i >= 1; i--)
                {
                        /* Access the monster */
-                       m_ptr = &m_list[i];
+                       m_ptr = &current_floor_ptr->m_list[i];
 
                        /* Ignore "dead" monsters */
-                       if (!m_ptr->r_idx) continue;
+                       if (!monster_is_valid(m_ptr)) continue;
 
                        r_ptr = &r_info[m_ptr->r_idx];
 
@@ -1437,8 +1626,6 @@ bool activate_artifact(object_type *o_ptr)
                        if (get_check(_("この階を去りますか?", "Leave this level? ")))
                        {
                                if (autosave_l) do_cmd_save_game(TRUE);
-
-                               /* Leaving */
                                p_ptr->leaving = TRUE;
                        }
                }
@@ -1468,51 +1655,15 @@ bool activate_artifact(object_type *o_ptr)
        }
 
        case ACT_LORE:
-       {
                msg_print(_("石が隠された秘密を写し出した...", "The stone reveals hidden mysteries..."));
-               if (!ident_spell(FALSE)) return FALSE;
-
-               if (mp_ptr->spell_book)
-               {
-                       /* Sufficient mana */
-                       if (20 <= p_ptr->csp)
-                       {
-                               /* Use some mana */
-                               p_ptr->csp -= 20;
-                       }
-
-                       /* Over-exert the player */
-                       else
-                       {
-                               int oops = 20 - p_ptr->csp;
-
-                               /* No mana left */
-                               p_ptr->csp = 0;
-                               p_ptr->csp_frac = 0;
-
-                               msg_print(_("石を制御できない!", "You are too weak to control the stone!"));
-                               /* Hack -- Bypass free action */
-                               (void)set_paralyzed(p_ptr->paralyzed + randint1(5 * oops + 1));
-
-                               /* Confusing. */
-                               (void)set_confused(p_ptr->confused + randint1(5 * oops + 1));
-                       }
-                       p_ptr->redraw |= (PR_MANA);
-               }
-               take_hit(DAMAGE_LOSELIFE, damroll(1, 12), _("危険な秘密", "perilous secrets"), -1);
-               /* Confusing. */
-               if (one_in_(5)) (void)set_confused(p_ptr->confused + randint1(10));
-
-               /* Exercise a little care... */
-               if (one_in_(20)) take_hit(DAMAGE_LOSELIFE, damroll(4, 10), _("危険な秘密", "perilous secrets"), -1);
+               if(!perilous_secrets(p_ptr)) return FALSE;
                break;
-       }
 
        case ACT_SHIKOFUMI:
        {
                msg_print(_("力強く四股を踏んだ。", "You stamp. (as if you are in a ring.)"));
-               (void)set_afraid(0);
-               (void)set_hero(randint1(20) + 20, FALSE);
+               (void)set_afraid(p_ptr, 0);
+               (void)set_hero(p_ptr, randint1(20) + 20, FALSE);
                dispel_evil(p_ptr->lev * 3);
                break;
        }
@@ -1533,66 +1684,22 @@ bool activate_artifact(object_type *o_ptr)
        case ACT_ULTIMATE_RESIST:
        {
                TIME_EFFECT v = randint1(25) + 25;
-               (void)set_afraid(0);
-               (void)set_hero(v, FALSE);
-               (void)hp_player(10);
-               (void)set_blessed(v, FALSE);
-               (void)set_oppose_acid(v, FALSE);
-               (void)set_oppose_elec(v, FALSE);
-               (void)set_oppose_fire(v, FALSE);
-               (void)set_oppose_cold(v, FALSE);
+               (void)set_afraid(p_ptr, 0);
+               (void)set_hero(p_ptr, v, FALSE);
+               (void)hp_player(p_ptr, 10);
+               (void)set_blessed(p_ptr, v, FALSE);
+               (void)set_oppose_acid(p_ptr, v, FALSE);
+               (void)set_oppose_elec(p_ptr, v, FALSE);
+               (void)set_oppose_fire(p_ptr, v, FALSE);
+               (void)set_oppose_cold(p_ptr, v, FALSE);
                (void)set_oppose_pois(v, FALSE);
                (void)set_ultimate_res(v, FALSE);
                break;
        }
 
-
-       /* Unique activation */
        case ACT_CAST_OFF:
-       {
-               INVENTORY_IDX inv;
-               int t;
-               OBJECT_IDX o_idx;
-               GAME_TEXT o_name[MAX_NLEN];
-               object_type forge;
-
-               /* Cast off activated item */
-               for (inv = INVEN_RARM; inv <= INVEN_FEET; inv++)
-               {
-                       if (o_ptr == &inventory[inv]) break;
-               }
-
-               /* Paranoia */
-               if (inv > INVEN_FEET) return FALSE;
-
-               object_copy(&forge, o_ptr);
-               inven_item_increase(inv, (0 - o_ptr->number));
-               inven_item_optimize(inv);
-               o_idx = drop_near(&forge, 0, p_ptr->y, p_ptr->x);
-               o_ptr = &o_list[o_idx];
-
-               object_desc(o_name, o_ptr, OD_NAME_ONLY);
-               msg_format(_("%sを脱ぎ捨てた。", "You cast off %s."), o_name);
-
-               /* Get effects */
-               msg_print(_("「燃え上がれ俺の小宇宙!」", "You say, 'Burn up my cosmo!"));
-               t = 20 + randint1(20);
-               (void)set_blind(p_ptr->blind + t);
-               (void)set_afraid(0);
-               (void)set_tim_esp(p_ptr->tim_esp + t, FALSE);
-               (void)set_tim_regen(p_ptr->tim_regen + t, FALSE);
-               (void)set_hero(p_ptr->hero + t, FALSE);
-               (void)set_blessed(p_ptr->blessed + t, FALSE);
-               (void)set_fast(p_ptr->fast + t, FALSE);
-               (void)set_shero(p_ptr->shero + t, FALSE);
-               if (p_ptr->pclass == CLASS_FORCETRAINER)
-               {
-                       P_PTR_KI = plev * 5 + 190;
-                       msg_print(_("気が爆発寸前になった。", "Your force are immediatly before explosion."));
-               }
-
+               cosmic_cast_off(p_ptr, o_ptr);
                break;
-       }
 
        case ACT_FALLING_STAR:
        {
@@ -1622,85 +1729,17 @@ bool activate_artifact(object_type *o_ptr)
                msg_format(_("%sはあなたの体力を奪った...", "The %s drains your vitality..."), name);
                take_hit(DAMAGE_LOSELIFE, damroll(3, 8), _("加速した疲労", "the strain of haste"), -1);
                t = 25 + randint1(25);
-               (void)set_fast(p_ptr->fast + t, FALSE);
+               (void)set_fast(p_ptr, p_ptr->fast + t, FALSE);
                break;
        }
 
        case ACT_FISHING:
-       {
-               POSITION x, y;
-
-               if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
-               y = p_ptr->y + ddy[dir];
-               x = p_ptr->x + ddx[dir];
-               p_ptr->fishing_dir = dir;
-               if (!cave_have_flag_bold(y, x, FF_WATER))
-               {
-                       msg_print(_("そこは水辺ではない。", "There is no fishing place."));
-                       return FALSE;
-               }
-               else if (cave[y][x].m_idx)
-               {
-                       GAME_TEXT m_name[MAX_NLEN];
-                       monster_desc(m_name, &m_list[cave[y][x].m_idx], 0);
-                       msg_format(_("%sが邪魔だ!", "%^s is stand in your way."), m_name);
-                       p_ptr->energy_use = 0;
-                       return FALSE;
-               }
-               set_action(ACTION_FISH);
-               p_ptr->redraw |= (PR_STATE);
+               if(!fishing(p_ptr)) return FALSE;
                break;
-       }
 
        case ACT_INROU:
-       {
-               int count = 0, i;
-               monster_type *m_ptr;
-               cptr kakusan = "";
-
-               if (summon_named_creature(0, p_ptr->y, p_ptr->x, MON_SUKE, PM_FORCE_PET))
-               {
-                       msg_print(_("『助さん』が現れた。", "Suke-san apperars."));
-                       kakusan = "Suke-san";
-                       count++;
-               }
-               if (summon_named_creature(0, p_ptr->y, p_ptr->x, MON_KAKU, PM_FORCE_PET))
-               {
-                       msg_print(_("『格さん』が現れた。", "Kaku-san appears."));
-                       kakusan = "Kaku-san";
-                       count++;
-               }
-               if (!count)
-               {
-                       for (i = m_max - 1; i > 0; i--)
-                       {
-                               m_ptr = &m_list[i];
-                               if (!m_ptr->r_idx) continue;
-                               if (!((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) continue;
-                               if (!los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)) continue;
-                               if (!projectable(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)) continue;
-                               count++;
-                               break;
-                       }
-               }
-
-               if (count)
-               {
-                       msg_format(_("「者ども、ひかえおろう!!!このお方をどなたとこころえる。」",
-                               "%^s says 'WHO do you think this person is! Bow your head, down your knees!'"), kakusan);
-                       sukekaku = TRUE;
-                       stun_monsters(120);
-                       confuse_monsters(120);
-                       turn_monsters(120);
-                       stasis_monsters(120);
-                       sukekaku = FALSE;
-               }
-               else
-               {
-                       msg_print(_("しかし、何も起きなかった。", "Nothing happen."));
-               }
+               mitokohmon();
                break;
-       }
 
        case ACT_MURAMASA:
        {
@@ -1731,46 +1770,10 @@ bool activate_artifact(object_type *o_ptr)
        }
 
        case ACT_CRIMSON:
-       {
-               int num = 1;
-               int i;
-               BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
-               int tx, ty;
-
-               /* Only for Crimson */
                if (o_ptr->name1 != ART_CRIMSON) return FALSE;
-
                msg_print(_("せっかくだから『クリムゾン』をぶっぱなすぜ!", "I'll fire CRIMSON! SEKKAKUDAKARA!"));
-
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               /* Use the given direction */
-               tx = p_ptr->x + 99 * ddx[dir];
-               ty = p_ptr->y + 99 * ddy[dir];
-
-               /* Hack -- Use an actual "target" */
-               if ((dir == 5) && target_okay())
-               {
-                       tx = target_col;
-                       ty = target_row;
-               }
-
-               if (p_ptr->pclass == CLASS_ARCHER)
-               {
-                       /* Extra shot at level 10 */
-                       if (p_ptr->lev >= 10) num++;
-
-                       /* Extra shot at level 30 */
-                       if (p_ptr->lev >= 30) num++;
-
-                       /* Extra shot at level 45 */
-                       if (p_ptr->lev >= 45) num++;
-               }
-
-               for (i = 0; i < num; i++)
-                       project(0, p_ptr->lev / 20 + 1, ty, tx, p_ptr->lev*p_ptr->lev * 6 / 50, GF_ROCKET, flg, -1);
+               if(!fire_crimson()) return FALSE;
                break;
-       }
 
        default:
        {
@@ -1810,38 +1813,3 @@ bool activate_artifact(object_type *o_ptr)
        return TRUE;
 }
 
-/*!
- * @brief 固定アーティファクト『ブラッディムーン』の特性を変更する。
- * @details スレイ2d2種、及びone_resistance()による耐性1d2種、pval2種を得る。
- * @param o_ptr 対象のオブジェクト構造体(ブラッディムーン)のポインタ
- * @return なし
- */
-void get_bloody_moon_flags(object_type *o_ptr)
-{
-       int dummy, i;
-
-       for (i = 0; i < TR_FLAG_SIZE; i++)
-               o_ptr->art_flags[i] = a_info[ART_BLOOD].flags[i];
-
-       dummy = randint1(2) + randint1(2);
-       for (i = 0; i < dummy; i++)
-       {
-               int flag = randint0(26);
-               if (flag >= 20) add_flag(o_ptr->art_flags, TR_KILL_UNDEAD + flag - 20);
-               else if (flag == 19) add_flag(o_ptr->art_flags, TR_KILL_ANIMAL);
-               else if (flag == 18) add_flag(o_ptr->art_flags, TR_SLAY_HUMAN);
-               else add_flag(o_ptr->art_flags, TR_CHAOTIC + flag);
-       }
-
-       dummy = randint1(2);
-       for (i = 0; i < dummy; i++) one_resistance(o_ptr);
-
-       for (i = 0; i < 2; i++)
-       {
-               int tmp = randint0(11);
-               if (tmp < 6) add_flag(o_ptr->art_flags, TR_STR + tmp);
-               else add_flag(o_ptr->art_flags, TR_STEALTH + tmp - 6);
-       }
-}
-
-