OSDN Git Service

In English spell descriptions, use "cuts" rather than "cut status" or "cut", "poisons...
[hengband/hengband.git] / src / realm-life.c
index 0f6ec7e..7c3c070 100644 (file)
@@ -1,13 +1,21 @@
 #include "angband.h"
 #include "cmd-spell.h"
+#include "spells-status.h"
+#include "spells-floor.h"
+#include "spells.h"
+#include "player-status.h"
+#include "player-effects.h"
+#include "floor.h"
+#include "targeting.h"
 
 /*!
 * @brief 生命領域魔法の各処理を行う
+* @param caster_ptr プレーヤーへの参照ポインタ
 * @param spell 魔法ID
 * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_INFO / SPELL_CAST)
 * @return SPELL_NAME / SPELL_DESC / SPELL_INFO 時には文字列ポインタを返す。SPELL_CAST時はNULL文字列を返す。
 */
-cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
+concptr do_life_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode)
 {
        bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
        bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
@@ -15,24 +23,24 @@ cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
        bool cast = (mode == SPELL_CAST) ? TRUE : FALSE;
 
        DIRECTION dir;
-       int plev = p_ptr->lev;
+       PLAYER_LEVEL plev = caster_ptr->lev;
 
        switch (spell)
        {
        case 0:
                if (name) return _("軽傷の治癒", "Cure Light Wounds");
-               if (desc) return _("怪我と体力を少し回復させる。", "Heals cut and HP a little.");
+               if (desc) return _("怪我と体力を少し回復させる。", "Heals cuts and HP a little.");
                {
-                       int dice = 2;
-                       int sides = 10;
+                       DICE_NUMBER dice = 2;
+                       DICE_SID sides = 10;
                        if (info) return info_heal(dice, sides, 0);
-                       if (cast) (void)cure_light_wounds(dice, sides);                 
+                       if (cast) (void)cure_light_wounds(caster_ptr, dice, sides);
                }
                break;
 
        case 1:
                if (name) return _("祝福", "Bless");
-               if (desc) return _("一定時間、命中率とACにボーナスを得る。", "Gives bonus to hit and AC for a few turns.");
+               if (desc) return _("一定時間、命中率とACにボーナスを得る。", "Gives bonus to hit and AC for a few turns.");
                {
                        int base = 12;
 
@@ -40,7 +48,7 @@ cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (cast)
                        {
-                               set_blessed(randint1(base) + base, FALSE);
+                               set_blessed(caster_ptr, randint1(base) + base, FALSE);
                        }
                }
                break;
@@ -49,15 +57,15 @@ cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (name) return _("軽傷", "Cause Light Wounds");
                if (desc) return _("1体のモンスターに小ダメージを与える。抵抗されると無効。", "Wounds a monster a little unless resisted.");
                {
-                       int dice = 3 + (plev - 1) / 5;
-                       int sides = 4;
+                       DICE_NUMBER dice = 3 + (plev - 1) / 5;
+                       DICE_SID sides = 4;
 
                        if (info) return info_damage(dice, sides, 0);
 
                        if (cast)
                        {
-                               if (!get_aim_dir(&dir)) return NULL;
-                               fire_ball_hide(GF_WOUNDS, dir, damroll(dice, sides), 0);
+                               if (!get_aim_dir(caster_ptr, &dir)) return NULL;
+                               fire_ball_hide(caster_ptr, GF_WOUNDS, dir, damroll(dice, sides), 0);
                        }
                }
                break;
@@ -66,15 +74,15 @@ cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (name) return _("光の召喚", "Call Light");
                if (desc) return _("光源が照らしている範囲か部屋全体を永久に明るくする。", "Lights up nearby area and the inside of a room permanently.");
                {
-                       int dice = 2;
-                       int sides = plev / 2;
+                       DICE_NUMBER dice = 2;
+                       DICE_SID sides = plev / 2;
                        POSITION rad = plev / 10 + 1;
 
                        if (info) return info_damage(dice, sides, 0);
 
                        if (cast)
                        {
-                               lite_area(damroll(dice, sides), rad);
+                               lite_area(caster_ptr, damroll(dice, sides), rad);
                        }
                }
                break;
@@ -89,32 +97,32 @@ cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (cast)
                        {
-                               detect_traps(rad, TRUE);
-                               detect_doors(rad);
-                               detect_stairs(rad);
+                               detect_traps(caster_ptr, rad, TRUE);
+                               detect_doors(caster_ptr, rad);
+                               detect_stairs(caster_ptr, rad);
                        }
                }
                break;
 
        case 5:
                if (name) return _("重傷の治癒", "Cure Medium Wounds");
-               if (desc) return _("怪我と体力を中程度回復させる。", "Heals cut and HP more.");
+               if (desc) return _("怪我と体力を中程度回復させる。", "Heals cuts and HP more.");
                {
-                       int dice = 4;
-                       int sides = 10;
+                       DICE_NUMBER dice = 4;
+                       DICE_SID sides = 10;
 
                        if (info) return info_heal(dice, sides, 0);
-                       if (cast) (void)cure_serious_wounds(dice, sides);
+                       if (cast) (void)cure_serious_wounds(caster_ptr, dice, sides);
                }
                break;
 
        case 6:
                if (name) return _("解毒", "Cure Poison");
-               if (desc) return _("体内の毒を取り除く。", "Cure poison status.");
+               if (desc) return _("体内の毒を取り除く。", "Cures yourself of any poisons.");
                {
                        if (cast)
                        {
-                               set_poisoned(0);
+                               set_poisoned(caster_ptr, 0);
                        }
                }
                break;
@@ -125,7 +133,7 @@ cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        if (cast)
                        {
-                               set_food(PY_FOOD_MAX - 1);
+                               set_food(caster_ptr, PY_FOOD_MAX - 1);
                        }
                }
                break;
@@ -134,13 +142,7 @@ cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (name) return _("解呪", "Remove Curse");
                if (desc) return _("アイテムにかかった弱い呪いを解除する。", "Removes normal curses from equipped items.");
                {
-                       if (cast)
-                       {
-                               if (remove_curse())
-                               {
-                                       msg_print(_("誰かに見守られているような気がする。", "You feel as if someone is watching over you."));
-                               }
-                       }
+                       if (cast) (void)remove_curse(caster_ptr);
                }
                break;
 
@@ -148,35 +150,35 @@ cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (name) return _("重傷", "Cause Medium Wounds");
                if (desc) return _("1体のモンスターに中ダメージを与える。抵抗されると無効。", "Wounds a monster unless resisted.");
                {
-                       int sides = 8 + (plev - 5) / 4;
-                       int dice = 8;
+                       DICE_SID sides = 8 + (plev - 5) / 4;
+                       DICE_NUMBER dice = 8;
 
                        if (info) return info_damage(dice, sides, 0);
 
                        if (cast)
                        {
-                               if (!get_aim_dir(&dir)) return NULL;
-                               fire_ball_hide(GF_WOUNDS, dir, damroll(dice, sides), 0);
+                               if (!get_aim_dir(caster_ptr, &dir)) return NULL;
+                               fire_ball_hide(caster_ptr, GF_WOUNDS, dir, damroll(dice, sides), 0);
                        }
                }
                break;
 
        case 10:
                if (name) return _("致命傷の治癒", "Cure Critical Wounds");
-               if (desc) return _("体力を大幅に回復させ、負傷と朦朧状態も全快する。", "Heals cut, stun and HP greatly.");
+               if (desc) return _("体力を大幅に回復させ、負傷と朦朧状態も全快する。", "Heals HP greatly. Also cures cuts and being stunned.");
                {
-                       int dice = 8;
-                       int sides = 10;
+                       DICE_NUMBER dice = 8;
+                       DICE_SID sides = 10;
 
                        if (info) return info_heal(dice, sides, 0);
-                       if (cast) (void)cure_critical_wounds(damroll(dice, sides));
+                       if (cast) (void)cure_critical_wounds(caster_ptr, damroll(dice, sides));
                }
                break;
 
        case 11:
                if (name) return _("耐熱耐寒", "Resist Heat and Cold");
                if (desc) return _("一定時間、火炎と冷気に対する耐性を得る。装備による耐性に累積する。",
-                       "Gives resistance to fire and cold. These resistances can be added to which from equipment for more powerful resistances.");
+                       "Gives resistance to fire and cold. These resistances can be added to those from equipment for more powerful resistances.");
 
                {
                        int base = 20;
@@ -185,8 +187,8 @@ cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (cast)
                        {
-                               set_oppose_cold(randint1(base) + base, FALSE);
-                               set_oppose_fire(randint1(base) + base, FALSE);
+                               set_oppose_cold(caster_ptr, randint1(base) + base, FALSE);
+                               set_oppose_fire(caster_ptr, randint1(base) + base, FALSE);
                        }
                }
                break;
@@ -202,7 +204,7 @@ cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (cast)
                        {
-                               map_area(rad);
+                               map_area(caster_ptr, rad);
                        }
                }
                break;
@@ -214,19 +216,19 @@ cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        if (cast)
                        {
-                               turn_undead();
+                               turn_undead(caster_ptr);
                        }
                }
                break;
 
        case 14:
                if (name) return _("体力回復", "Healing");
-               if (desc) return _("極めて強力な回復呪文で、負傷と朦朧状態も全快する。", "Much powerful healing magic, and heals cut and stun completely.");
+               if (desc) return _("極めて強力な回復呪文で、負傷と朦朧状態も全快する。", "Is very powerful healing magic. Also completely cures cuts and being stunned.");
 
                {
                        int heal = 300;
                        if (info) return info_heal(0, 0, heal);
-                       if (cast) (void)cure_critical_wounds(heal);
+                       if (cast) (void)cure_critical_wounds(caster_ptr, heal);
                }
                break;
 
@@ -238,7 +240,7 @@ cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        if (cast)
                        {
-                               warding_glyph();
+                               warding_glyph(caster_ptr);
                        }
                }
                break;
@@ -246,15 +248,8 @@ cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
        case 16:
                if (name) return _("*解呪*", "Dispel Curse");
                if (desc) return _("アイテムにかかった強力な呪いを解除する。", "Removes normal and heavy curse from equipped items.");
-
                {
-                       if (cast)
-                       {
-                               if (remove_all_curse())
-                               {
-                                       msg_print(_("誰かに見守られているような気がする。", "You feel as if someone is watching over you."));
-                               }
-                       }
+                       if (cast) (void)remove_all_curse(caster_ptr);
                }
                break;
 
@@ -265,7 +260,7 @@ cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        if (cast)
                        {
-                               if (!ident_spell(FALSE)) return NULL;
+                               if (!ident_spell(caster_ptr, FALSE)) return NULL;
                        }
                }
                break;
@@ -275,14 +270,14 @@ cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (desc) return _("視界内の全てのアンデッドにダメージを与える。", "Damages all undead monsters in sight.");
 
                {
-                       int dice = 1;
-                       int sides = plev * 5;
+                       DICE_NUMBER dice = 1;
+                       DICE_SID sides = plev * 5;
 
                        if (info) return info_damage(dice, sides, 0);
 
                        if (cast)
                        {
-                               dispel_undead(damroll(dice, sides));
+                               dispel_undead(caster_ptr, damroll(dice, sides));
                        }
                }
                break;
@@ -298,7 +293,7 @@ cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (cast)
                        {
-                               charm_monsters(power);
+                               charm_monsters(caster_ptr, power);
                        }
                }
                break;
@@ -308,15 +303,15 @@ cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (desc) return _("1体のモンスターに大ダメージを与える。抵抗されると無効。", "Wounds a monster critically unless resisted.");
 
                {
-                       int dice = 5 + (plev - 5) / 3;
-                       int sides = 15;
+                       DICE_NUMBER dice = 5 + (plev - 5) / 3;
+                       DICE_SID sides = 15;
 
                        if (info) return info_damage(dice, sides, 0);
 
                        if (cast)
                        {
-                               if (!get_aim_dir(&dir)) return NULL;
-                               fire_ball_hide(GF_WOUNDS, dir, damroll(dice, sides), 0);
+                               if (!get_aim_dir(caster_ptr, &dir)) return NULL;
+                               fire_ball_hide(caster_ptr, GF_WOUNDS, dir, damroll(dice, sides), 0);
                        }
                }
                break;
@@ -327,13 +322,13 @@ cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                {
                        int base = 15;
-                       int sides = 20;
+                       DICE_SID sides = 20;
 
                        if (info) return info_delay(base, sides);
 
                        if (cast)
                        {
-                               if (!word_of_recall()) return NULL;
+                               if (!recall_player(caster_ptr, randint0(21) + 15)) return NULL;
                        }
                }
                break;
@@ -344,13 +339,13 @@ cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                {
                        int base = 15;
-                       int sides = 20;
+                       DICE_SID sides = 20;
 
                        if (info) return info_delay(base, sides);
 
                        if (cast)
                        {
-                               alter_reality();
+                               reserve_alter_reality(caster_ptr);
                        }
                }
                break;
@@ -366,8 +361,8 @@ cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (cast)
                        {
-                               warding_glyph();
-                               glyph_creation();
+                               warding_glyph(caster_ptr);
+                               glyph_creation(caster_ptr, caster_ptr->y, caster_ptr->x);
                        }
                }
                break;
@@ -379,7 +374,7 @@ cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        if (cast)
                        {
-                               num_repro += MAX_REPRO;
+                               caster_ptr->current_floor_ptr->num_repro += MAX_REPRO;
                        }
                }
                break;
@@ -395,7 +390,7 @@ cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (cast)
                        {
-                               detect_all(rad);
+                               detect_all(caster_ptr, rad);
                        }
                }
                break;
@@ -412,7 +407,7 @@ cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (cast)
                        {
-                               mass_genocide_undead(power, TRUE);
+                               mass_genocide_undead(caster_ptr, power, TRUE);
                        }
                }
                break;
@@ -424,7 +419,7 @@ cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        if (cast)
                        {
-                               wiz_lite(FALSE);
+                               wiz_lite(caster_ptr, FALSE);
                        }
                }
                break;
@@ -436,20 +431,20 @@ cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        if (cast)
                        {
-                               (void)restore_all_status();
-                               restore_level();
+                               (void)restore_all_status(caster_ptr);
+                               restore_level(caster_ptr);
                        }
                }
                break;
 
        case 29:
                if (name) return _("*体力回復*", "Healing True");
-               if (desc) return _("最強の治癒の魔法で、負傷と朦朧状態も全快する。", "The greatest healing magic. Heals all HP, cut and stun.");
+               if (desc) return _("最強の治癒の魔法で、負傷と朦朧状態も全快する。", "Is the greatest healing magic. Heals all HP, cuts and being stunned.");
 
                {
                        int heal = 2000;
                        if (info) return info_heal(0, 0, heal);
-                       if (cast) (void)cure_critical_wounds(heal);
+                       if (cast) (void)cure_critical_wounds(caster_ptr, heal);
                }
                break;
 
@@ -460,7 +455,7 @@ cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        if (cast)
                        {
-                               if (!identify_fully(FALSE)) return NULL;
+                               if (!identify_fully(caster_ptr, FALSE)) return NULL;
                        }
                }
                break;
@@ -477,13 +472,13 @@ cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        if (cast)
                        {
                                TIME_EFFECT v = randint1(base) + base;
-                               set_fast(v, FALSE);
-                               set_oppose_acid(v, FALSE);
-                               set_oppose_elec(v, FALSE);
-                               set_oppose_fire(v, FALSE);
-                               set_oppose_cold(v, FALSE);
-                               set_oppose_pois(v, FALSE);
-                               set_ultimate_res(v, FALSE);
+                               set_fast(caster_ptr, v, FALSE);
+                               set_oppose_acid(caster_ptr, v, FALSE);
+                               set_oppose_elec(caster_ptr, v, FALSE);
+                               set_oppose_fire(caster_ptr, v, FALSE);
+                               set_oppose_cold(caster_ptr, v, FALSE);
+                               set_oppose_pois(caster_ptr, v, FALSE);
+                               set_ultimate_res(caster_ptr, v, FALSE);
                        }
                }
                break;