X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Fmspells1.c;h=70d5ef1911a8d03240119ce64e428f068ebc793f;hb=eb2f15d1cfc313fda1f0578f2685246f3b76af4d;hp=517d605862bcc4f6abefb0ee7bba18701cdaca9d;hpb=621a5e9f40127e72e5779fe6bfcd0a1afcd63ae7;p=hengband%2Fhengband.git diff --git a/src/mspells1.c b/src/mspells1.c index 517d60586..70d5ef191 100644 --- a/src/mspells1.c +++ b/src/mspells1.c @@ -1,6 +1,6 @@ -/*! +/*! * @file mspells1.c - * @brief ¥â¥ó¥¹¥¿¡¼ËâË¡¤Î¼ÂÁõ / Monster spells (attack player) + * @brief モンスター魔法の実装 / Monster spells (attack player) * @date 2014/01/17 * @author * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n @@ -39,16 +39,17 @@ */ #include "angband.h" +#include "object-curse.h" /*! - * @brief ¥â¥ó¥¹¥¿¡¼¤¬¥×¥ì¥¤¥ä¡¼¤Î¼åÅÀ¤ò¤Ä¤¤¤¿ÁªÂò¤ò¼è¤ë¤«¤É¤¦¤«¤ÎȽÄê / + * @brief モンスターがプレイヤーの弱点をついた選択を取るかどうかの判定 / * Internal probability routine - * @param r_ptr ¥â¥ó¥¹¥¿¡¼¼ï²¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿ - * @param prob ´ðËܳÎΨ(%) - * @return Ŭ¤·¤¿ÁªÂò¤ò¼è¤ë¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£ + * @param r_ptr モンスター種族の構造体参照ポインタ + * @param prob 基本確率(%) + * @return 適した選択を取るならばTRUEを返す。 */ -static bool int_outof(monster_race *r_ptr, int prob) +static bool int_outof(monster_race *r_ptr, PERCENTAGE prob) { /* Non-Smart monsters are half as "smart" */ if (!(r_ptr->flags2 & RF2_SMART)) prob = prob / 2; @@ -59,15 +60,15 @@ static bool int_outof(monster_race *r_ptr, int prob) /*! - * @brief ¥â¥ó¥¹¥¿¡¼¤ÎËâË¡°ìÍ÷¤«¤éÀï½ÑŪ¤ËŬ¤µ¤Ê¤¤ËâË¡¤ò½ü³°¤¹¤ë / + * @brief モンスターの魔法一覧から戦術的に適さない魔法を除外する / * Remove the "bad" spells from a spell list - * @param m_idx ¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿ - * @param f4p ¥â¥ó¥¹¥¿¡¼ËâË¡¤Î¥Õ¥é¥°¥ê¥¹¥È1 - * @param f5p ¥â¥ó¥¹¥¿¡¼ËâË¡¤Î¥Õ¥é¥°¥ê¥¹¥È2 - * @param f6p ¥â¥ó¥¹¥¿¡¼ËâË¡¤Î¥Õ¥é¥°¥ê¥¹¥È3 - * @return ¤Ê¤· + * @param m_idx モンスターの構造体参照ポインタ + * @param f4p モンスター魔法のフラグリスト1 + * @param f5p モンスター魔法のフラグリスト2 + * @param f6p モンスター魔法のフラグリスト3 + * @return なし */ -static void remove_bad_spells(int m_idx, u32b *f4p, u32b *f5p, u32b *f6p) +static void remove_bad_spells(MONSTER_IDX m_idx, u32b *f4p, u32b *f5p, u32b *f6p) { monster_type *m_ptr = &m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; @@ -332,7 +333,6 @@ static void remove_bad_spells(int m_idx, u32b *f4p, u32b *f5p, u32b *f6p) if (int_outof(r_ptr, 150)) f5 &= ~(RF5_BO_PLAS); if (int_outof(r_ptr, 150)) f5 &= ~(RF5_BO_ICEE); if (int_outof(r_ptr, 150)) f5 &= ~(RF5_MISSILE); - if (int_outof(r_ptr, 150)) f4 &= ~(RF4_SHOOT); } if (smart & (SM_IMM_FREE)) @@ -346,7 +346,7 @@ static void remove_bad_spells(int m_idx, u32b *f4p, u32b *f5p, u32b *f6p) f5 &= ~(RF5_DRAIN_MANA); } - /* XXX XXX XXX No spells left? */ + /* No spells left? */ /* if (!f4 && !f5 && !f6) ... */ (*f4p) = f4; @@ -356,15 +356,15 @@ static void remove_bad_spells(int m_idx, u32b *f4p, u32b *f5p, u32b *f6p) /*! - * @brief ¥â¥ó¥¹¥¿¡¼¤Ë¤È¤Ã¤Æ½êÄê¤ÎÃÏÅÀ¤¬¾¤´Ô¤ËÁê±þ¤·¤¤ÃÏÅÀ¤«¤É¤¦¤«¤òÊÖ¤¹¡£ / + * @brief モンスターにとって所定の地点が召還に相応しい地点かどうかを返す。 / * Determine if there is a space near the player in which a summoned creature can appear - * @param y1 ȽÄê¤ò¹Ô¤¤¤¿¤¤¥Þ¥¹¤ÎYºÂɸ - * @param x1 ȽÄê¤ò¹Ô¤¤¤¿¤¤¥Þ¥¹¤ÎXºÂɸ - * @return ¾¤´Ô¤ËÁê±þ¤·¤¤¤Ê¤é¤ÐTRUE¤òÊÖ¤¹ + * @param y1 判定を行いたいマスのY座標 + * @param x1 判定を行いたいマスのX座標 + * @return 召還に相応しいならばTRUEを返す */ -bool summon_possible(int y1, int x1) +bool summon_possible(POSITION y1, POSITION x1) { - int y, x; + POSITION y, x; /* Start at the player's location, and check 2 grids in each dir */ for (y = y1 - 2; y <= y1 + 2; y++) @@ -390,17 +390,17 @@ bool summon_possible(int y1, int x1) /*! - * @brief ¥â¥ó¥¹¥¿¡¼¤Ë¤È¤Ã¤Æ»à¼ÔÉü³è¤ò¹Ô¤¦¤Ù¤­¾õÂÖ¤«¤É¤¦¤«¤òÊÖ¤¹ / + * @brief モンスターにとって死者復活を行うべき状態かどうかを返す / * Determine if there is a space near the player in which a summoned creature can appear - * @param m_ptr ȽÄê¤ò¹Ô¤¤¤¿¤¤¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿ - * @return »à¼ÔÉü³è¤¬Í­¸ú¤Ê¾õÂ֤ʤé¤ÐTRUE¤òÊÖ¤¹¡£ + * @param m_ptr 判定を行いたいモンスターの構造体参照ポインタ + * @return 死者復活が有効な状態ならばTRUEを返す。 */ bool raise_possible(monster_type *m_ptr) { - int xx, yy; - int y = m_ptr->fy; - int x = m_ptr->fx; - s16b this_o_idx, next_o_idx = 0; + POSITION xx, yy; + POSITION y = m_ptr->fy; + POSITION x = m_ptr->fx; + OBJECT_IDX this_o_idx, next_o_idx = 0; cave_type *c_ptr; for (xx = x - 5; xx <= x + 5; xx++) @@ -415,7 +415,6 @@ bool raise_possible(monster_type *m_ptr) /* Scan the pile of objects */ for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) { - /* Acquire object */ object_type *o_ptr = &o_list[this_o_idx]; /* Acquire next object */ @@ -435,14 +434,14 @@ bool raise_possible(monster_type *m_ptr) /*! - * @brief ¥â¥ó¥¹¥¿¡¼¤Ë¤È¤Ã¤Æ¥Ü¥ë¥È·¿ËâË¡¤¬Í­¸ú¤Ê¾õÂÖ¤«¤òÊÖ¤¹ / + * @brief モンスターにとってボルト型魔法が有効な状態かを返す / * Determine if a bolt spell will hit the player. - * @param y1 ¥Ü¥ë¥ÈËâˡȯ¼ÍÃÏÅÀ¤ÎYºÂɸ - * @param x1 ¥Ü¥ë¥ÈËâˡȯ¼ÍÃÏÅÀ¤ÎXºÂɸ - * @param y2 ¥Ü¥ë¥ÈËâË¡ÌÜɸÃÏÅÀ¤ÎYºÂɸ - * @param x2 ¥Ü¥ë¥ÈËâË¡ÌÜɸÃÏÅÀ¤ÎXºÂɸ - * @param is_friend ¥â¥ó¥¹¥¿¡¼¤¬¥×¥ì¥¤¥ä¡¼¤Ë³²°Õ¤ò»ý¤¿¤Ê¤¤(¥Ú¥Ã¥È¤«Í§¹¥Åª)¤Ê¤é¤ÐTRUE¤ò¤Ä¤±¤ë - * @return ¥Ü¥ë¥È·¿ËâË¡¤¬Í­¸ú¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£ + * @param y1 ボルト魔法発射地点のY座標 + * @param x1 ボルト魔法発射地点のX座標 + * @param y2 ボルト魔法目標地点のY座標 + * @param x2 ボルト魔法目標地点のX座標 + * @param is_friend モンスターがプレイヤーに害意を持たない(ペットか友好的)ならばTRUEをつける + * @return ボルト型魔法が有効ならばTRUEを返す。 * @details * Originally, it was possible for a friendly to shoot another friendly.\n * Change it so a "clean shot" means no equally friendly monster is\n @@ -453,11 +452,12 @@ bool raise_possible(monster_type *m_ptr) * no equally friendly monster is\n * between the attacker and target.\n */ -bool clean_shot(int y1, int x1, int y2, int x2, bool is_friend) +bool clean_shot(POSITION y1, POSITION x1, POSITION y2, POSITION x2, bool is_friend) { /* Must be the same as projectable() */ - int i, y, x; + int i; + POSITION y, x; int grid_n = 0; u16b grid_g[512]; @@ -499,28 +499,28 @@ bool clean_shot(int y1, int x1, int y2, int x2, bool is_friend) } /*! - * @brief ¥â¥ó¥¹¥¿¡¼¤Î¥Ü¥ë¥È·¿ËâË¡½èÍý / + * @brief モンスターのボルト型魔法処理 / * Cast a bolt at the player Stop if we hit a monster Affect monsters and the player - * @param m_idx ¥â¥ó¥¹¥¿¡¼¤ÎID - * @param y ÌÜɸ¤ÎYºÂɸ - * @param x ÌÜɸ¤ÎXºÂɸ - * @param typ ¸ú²Ì°À­ID - * @param dam_hp °ÒÎÏ - * @param monspell ¥â¥ó¥¹¥¿¡¼ËâË¡¤ÎID - * @param spell_type ¥â¥ó¥¹¥¿¡¼¤«¤é¥â¥ó¥¹¥¿¡¼¤Ø·â¤Ä¤Ê¤éSPELL_MON_TO_MON¡¢¥â¥ó¥¹¥¿¡¼¤«¤é¥×¥ì¥¤¥ä¡¼¤Ê¤éSPELL_MON_TO_PLAYER - * @return ¤Ê¤· + * @param m_idx モンスターのID + * @param y 目標のY座標 + * @param x 目標のX座標 + * @param typ 効果属性ID + * @param dam_hp 威力 + * @param monspell モンスター魔法のID + * @param target_type モンスターからモンスターへ撃つならMONSTER_TO_MONSTER、モンスターからプレイヤーならMONSTER_TO_PLAYER + * @return なし */ -void bolt(int m_idx, int y, int x, int typ, int dam_hp, int monspell, int spell_type) +void bolt(MONSTER_IDX m_idx, POSITION y, POSITION x, EFFECT_ID typ, int dam_hp, int monspell, int target_type) { - int flg; + BIT_FLAGS flg = 0; bool learnable = spell_learnable(m_idx); - switch (spell_type) + switch (target_type) { - case SPELL_MON_TO_MON: + case MONSTER_TO_MONSTER: flg = PROJECT_STOP | PROJECT_KILL; break; - case SPELL_MON_TO_PLAYER: + case MONSTER_TO_PLAYER: flg = PROJECT_STOP | PROJECT_KILL | PROJECT_PLAYER; break; } @@ -531,27 +531,27 @@ void bolt(int m_idx, int y, int x, int typ, int dam_hp, int monspell, int spell_ } /*! - * @brief ¥â¥ó¥¹¥¿¡¼¤Î¥Ó¡¼¥à·¿ËâË¡½èÍý / - * @param m_idx ¥â¥ó¥¹¥¿¡¼¤ÎID - * @param y ÌÜɸ¤ÎYºÂɸ - * @param x ÌÜɸ¤ÎXºÂɸ - * @param typ ¸ú²Ì°À­ID - * @param dam_hp °ÒÎÏ - * @param monspell ¥â¥ó¥¹¥¿¡¼ËâË¡¤ÎID - * @param spell_type ¥â¥ó¥¹¥¿¡¼¤«¤é¥â¥ó¥¹¥¿¡¼¤Ø·â¤Ä¤Ê¤éSPELL_MON_TO_MON¡¢¥â¥ó¥¹¥¿¡¼¤«¤é¥×¥ì¥¤¥ä¡¼¤Ê¤éSPELL_MON_TO_PLAYER - * @return ¤Ê¤· + * @brief モンスターのビーム型魔法処理 / + * @param m_idx モンスターのID + * @param y 目標のY座標 + * @param x 目標のX座標 + * @param typ 効果属性ID + * @param dam_hp 威力 + * @param monspell モンスター魔法のID + * @param target_type モンスターからモンスターへ撃つならMONSTER_TO_MONSTER、モンスターからプレイヤーならMONSTER_TO_PLAYER + * @return なし */ -void beam(int m_idx, int y, int x, int typ, int dam_hp, int monspell, int spell_type) +void beam(MONSTER_IDX m_idx, POSITION y, POSITION x, EFFECT_ID typ, int dam_hp, int monspell, int target_type) { - int flg; + BIT_FLAGS flg = 0; bool learnable = spell_learnable(m_idx); - switch (spell_type) + switch (target_type) { - case SPELL_MON_TO_MON: + case MONSTER_TO_MONSTER: flg = PROJECT_BEAM | PROJECT_KILL | PROJECT_THRU; break; - case SPELL_MON_TO_PLAYER: + case MONSTER_TO_PLAYER: flg = PROJECT_BEAM | PROJECT_KILL | PROJECT_THRU | PROJECT_PLAYER; break; } @@ -562,32 +562,32 @@ void beam(int m_idx, int y, int x, int typ, int dam_hp, int monspell, int spell_ /*! - * @brief ¥â¥ó¥¹¥¿¡¼¤Î¥Ü¡¼¥ë·¿¡õ¥Ö¥ì¥¹·¿ËâË¡½èÍý / + * @brief モンスターのボール型&ブレス型魔法処理 / * Cast a breath (or ball) attack at the player Pass over any monsters that may be in the way Affect grids, objects, monsters, and the player - * @param y ÌÜɸÃÏÅÀ¤ÎYºÂɸ - * @param x ÌÜɸÃÏÅÀ¤ÎXºÂɸ - * @param m_idx ¥â¥ó¥¹¥¿¡¼¤ÎID - * @param typ ¸ú²Ì°À­ID - * @param dam_hp °ÒÎÏ - * @param rad Ⱦ·Â - * @param breath TRUE¤Ê¤é¤Ð¥Ö¥ì¥¹½èÍý¡¢FALSE¤Ê¤é¤Ð¥Ü¡¼¥ë½èÍý - * @param monspell ¥â¥ó¥¹¥¿¡¼ËâË¡¤ÎID - * @param spell_type ¥â¥ó¥¹¥¿¡¼¤«¤é¥â¥ó¥¹¥¿¡¼¤Ø·â¤Ä¤Ê¤éSPELL_MON_TO_MON¡¢¥â¥ó¥¹¥¿¡¼¤«¤é¥×¥ì¥¤¥ä¡¼¤Ê¤éSPELL_MON_TO_PLAYER - * @return ¤Ê¤· + * @param y 目標地点のY座標 + * @param x 目標地点のX座標 + * @param m_idx モンスターのID + * @param typ 効果属性ID + * @param dam_hp 威力 + * @param rad 半径 + * @param breath + * @param monspell モンスター魔法のID + * @param target_type モンスターからモンスターへ撃つならMONSTER_TO_MONSTER、モンスターからプレイヤーならMONSTER_TO_PLAYER + * @return なし */ -void breath(int y, int x, int m_idx, int typ, int dam_hp, int rad, bool breath, int monspell, int spell_type) +void breath(POSITION y, POSITION x, MONSTER_IDX m_idx, EFFECT_ID typ, int dam_hp, POSITION rad, bool breath, int monspell, int target_type) { monster_type *m_ptr = &m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; bool learnable = spell_learnable(m_idx); - int flg; + BIT_FLAGS flg = 0x00; - switch (spell_type) + switch (target_type) { - case SPELL_MON_TO_MON: + case MONSTER_TO_MONSTER: flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL; break; - case SPELL_MON_TO_PLAYER: + case MONSTER_TO_PLAYER: flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_PLAYER; break; } @@ -619,118 +619,14 @@ void breath(int y, int x, int m_idx, int typ, int dam_hp, int rad, bool breath, (void)project(m_idx, rad, y, x, dam_hp, typ, flg, (learnable ? monspell : -1)); } -/*! - * @brief ¥â¥ó¥¹¥¿¡¼¤Î¥Ü¡¼¥ë·¿¡õ¥Ö¥ì¥¹·¿ËâË¡½èÍý / - * @param power ¼ö¤¤¤ÎÃʳ¬ - * @param o_ptr ¼ö¤¤¤ò¤«¤±¤é¤ì¤ëÁõÈ÷¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿ - * @return Í¿¤¨¤ë¼ö¤¤¤ÎID - */ -u32b get_curse(int power, object_type *o_ptr) -{ - u32b new_curse; - - while(1) - { - new_curse = (1 << (randint0(MAX_CURSE)+4)); - if (power == 2) - { - if (!(new_curse & TRC_HEAVY_MASK)) continue; - } - else if (power == 1) - { - if (new_curse & TRC_SPECIAL_MASK) continue; - } - else if (power == 0) - { - if (new_curse & TRC_HEAVY_MASK) continue; - } - if (new_curse == TRC_LOW_MELEE && !object_is_weapon(o_ptr)) continue; - if (new_curse == TRC_LOW_AC && !object_is_armour(o_ptr)) continue; - break; - } - return new_curse; -} - -/*! - * @brief ÁõÈ÷¤Ø¤Î¼ö¤¤ÉÕ²ÃȽÄê¤ÈÉղýèÍý / - * @param chance ¼ö¤¤¤Î´ðËܳÎΨ - * @param heavy_chance ½Å¤¤¼ö¤¤¤òÁªÂò»è¤ËÆþ¤ì¤ë¤«Èݤ«¡£ - * @return ¤Ê¤· - */ -void curse_equipment(int chance, int heavy_chance) -{ - bool changed = FALSE; - int curse_power = 0; - u32b new_curse; - u32b oflgs[TR_FLAG_SIZE]; - object_type *o_ptr = &inventory[INVEN_RARM + randint0(12)]; - char o_name[MAX_NLEN]; - - if (randint1(100) > chance) return; - - if (!o_ptr->k_idx) return; - - object_flags(o_ptr, oflgs); - - object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); - - /* Extra, biased saving throw for blessed items */ - if (have_flag(oflgs, TR_BLESSED) && (randint1(888) > chance)) - { -#ifdef JP -msg_format("%s¤Ï¼ö¤¤¤òÄ·¤ÍÊÖ¤·¤¿¡ª", o_name, -#else - msg_format("Your %s resist%s cursing!", o_name, -#endif - ((o_ptr->number > 1) ? "" : "s")); - /* Hmmm -- can we wear multiple items? If not, this is unnecessary */ - return; - } - - if ((randint1(100) <= heavy_chance) && - (object_is_artifact(o_ptr) || object_is_ego(o_ptr))) - { - if (!(o_ptr->curse_flags & TRC_HEAVY_CURSE)) - changed = TRUE; - o_ptr->curse_flags |= TRC_HEAVY_CURSE; - o_ptr->curse_flags |= TRC_CURSED; - curse_power++; - } - else - { - if (!object_is_cursed(o_ptr)) - changed = TRUE; - o_ptr->curse_flags |= TRC_CURSED; - } - if (heavy_chance >= 50) curse_power++; - - new_curse = get_curse(curse_power, o_ptr); - if (!(o_ptr->curse_flags & new_curse)) - { - changed = TRUE; - o_ptr->curse_flags |= new_curse; - } - - if (changed) - { -#ifdef JP -msg_format("°­°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name); -#else - msg_format("There is a malignant black aura surrounding %s...", o_name); -#endif - - o_ptr->feeling = FEEL_NONE; - } - p_ptr->update |= (PU_BONUS); -} /*! - * @brief IDÃͤ¬Àµ¤·¤¤¥â¥ó¥¹¥¿¡¼ËâË¡ID¤«¤É¤¦¤«¤òÊÖ¤¹ / + * @brief ID値が正しいモンスター魔法IDかどうかを返す / * Return TRUE if a spell is good for hurting the player (directly). - * @param spell ȽÄêÂоݤÎID - * @return Àµ¤·¤¤ID¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£ + * @param spell 判定対象のID + * @return 正しいIDならばTRUEを返す。 */ static bool spell_attack(byte spell) { @@ -755,10 +651,10 @@ static bool spell_attack(byte spell) /*! - * @brief IDÃͤ¬ÂàÈòÌÜŪ¤ËŬ¤·¤¿¥â¥ó¥¹¥¿¡¼ËâË¡ID¤«¤É¤¦¤«¤òÊÖ¤¹ / + * @brief ID値が退避目的に適したモンスター魔法IDかどうかを返す / * Return TRUE if a spell is good for escaping. - * @param spell ȽÄêÂоݤÎID - * @return Ŭ¤·¤¿ËâË¡¤ÎID¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£ + * @param spell 判定対象のID + * @return 適した魔法のIDならばTRUEを返す。 */ static bool spell_escape(byte spell) { @@ -773,10 +669,10 @@ static bool spell_escape(byte spell) } /*! - * @brief IDÃͤ¬Ë¸³²ÌÜŪ¤ËŬ¤·¤¿¥â¥ó¥¹¥¿¡¼ËâË¡ID¤«¤É¤¦¤«¤òÊÖ¤¹ / + * @brief ID値が妨害目的に適したモンスター魔法IDかどうかを返す / * Return TRUE if a spell is good for annoying the player. - * @param spell ȽÄêÂоݤÎID - * @return Ŭ¤·¤¿ËâË¡¤ÎID¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£ + * @param spell 判定対象のID + * @return 適した魔法のIDならばTRUEを返す。 */ static bool spell_annoy(byte spell) { @@ -803,10 +699,10 @@ static bool spell_annoy(byte spell) } /*! - * @brief IDÃͤ¬¾¤´­·¿¤Î¥â¥ó¥¹¥¿¡¼ËâË¡ID¤«¤É¤¦¤«¤òÊÖ¤¹ / + * @brief ID値が召喚型のモンスター魔法IDかどうかを返す / * Return TRUE if a spell is good for annoying the player. - * @param spell ȽÄêÂоݤÎID - * @return ¾¤´­·¿ËâË¡¤ÎID¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£ + * @param spell 判定対象のID + * @return 召喚型魔法のIDならばTRUEを返す。 */ static bool spell_summon(byte spell) { @@ -819,10 +715,10 @@ static bool spell_summon(byte spell) /*! - * @brief IDÃͤ¬»à¼ÔÉü³è½èÍý¤«¤É¤¦¤«¤òÊÖ¤¹ / + * @brief ID値が死者復活処理かどうかを返す / * Return TRUE if a spell is good for annoying the player. - * @param spell ȽÄêÂоݤÎID - * @return »à¼ÔÉü³è¤Î½èÍý¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£ + * @param spell 判定対象のID + * @return 死者復活の処理ならばTRUEを返す。 */ static bool spell_raise(byte spell) { @@ -834,10 +730,10 @@ static bool spell_raise(byte spell) } /*! - * @brief IDÃͤ¬Àï½ÑŪ¤Ê¥â¥ó¥¹¥¿¡¼ËâË¡ID¤«¤É¤¦¤«¤òÊÖ¤¹ / + * @brief ID値が戦術的なモンスター魔法IDかどうかを返す / * Return TRUE if a spell is good in a tactical situation. - * @param spell ȽÄêÂоݤÎID - * @return Àï½ÑŪ¤ÊËâË¡¤ÎID¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£ + * @param spell 判定対象のID + * @return 戦術的な魔法のIDならばTRUEを返す。 */ static bool spell_tactic(byte spell) { @@ -849,10 +745,10 @@ static bool spell_tactic(byte spell) } /*! - * @brief IDÃͤ¬ÌµÅ¨²½¤¹¤ë¥â¥ó¥¹¥¿¡¼ËâË¡ID¤«¤É¤¦¤«¤òÊÖ¤¹ / + * @brief ID値が無敵化するモンスター魔法IDかどうかを返す / * Return TRUE if a spell makes invulnerable. - * @param spell ȽÄêÂоݤÎID - * @return ¾¤´­·¿ËâË¡¤ÎID¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£ + * @param spell 判定対象のID + * @return 召喚型魔法のIDならばTRUEを返す。 */ static bool spell_invulner(byte spell) { @@ -864,10 +760,10 @@ static bool spell_invulner(byte spell) } /*! - * @brief IDÃͤ¬²Ã®¤¹¤ë¥â¥ó¥¹¥¿¡¼ËâË¡ID¤«¤É¤¦¤«¤òÊÖ¤¹ / + * @brief ID値が加速するモンスター魔法IDかどうかを返す / * Return TRUE if a spell hastes. - * @param spell ȽÄêÂоݤÎID - * @return ¾¤´­·¿ËâË¡¤ÎID¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£ + * @param spell 判定対象のID + * @return 召喚型魔法のIDならばTRUEを返す。 */ static bool spell_haste(byte spell) { @@ -880,10 +776,10 @@ static bool spell_haste(byte spell) /*! - * @brief IDÃͤ¬»þ´ÖÄä»ß¤ò¹Ô¤¦¥â¥ó¥¹¥¿¡¼ËâË¡ID¤«¤É¤¦¤«¤òÊÖ¤¹ / + * @brief ID値が時間停止を行うモンスター魔法IDかどうかを返す / * Return TRUE if a spell world. - * @param spell ȽÄêÂоݤÎID - * @return »þ´ÖÄä»ßËâË¡¤ÎID¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£ + * @param spell 判定対象のID + * @return 時間停止魔法のIDならばTRUEを返す。 */ static bool spell_world(byte spell) { @@ -893,10 +789,10 @@ static bool spell_world(byte spell) /*! - * @brief IDÃͤ¬ÆÃÊ̸ú²Ì¤Î¥â¥ó¥¹¥¿¡¼ËâË¡ID¤«¤É¤¦¤«¤òÊÖ¤¹ / + * @brief ID値が特別効果のモンスター魔法IDかどうかを返す / * Return TRUE if a spell special. - * @param spell ȽÄêÂоݤÎID - * @return ÆÃÊ̸ú²ÌËâË¡¤ÎID¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£ + * @param spell 判定対象のID + * @return 特別効果魔法のIDならばTRUEを返す。 */ static bool spell_special(byte spell) { @@ -907,10 +803,10 @@ static bool spell_special(byte spell) /*! - * @brief IDÃͤ¬¸÷¤Î·õ¤Î¥â¥ó¥¹¥¿¡¼ËâË¡ID¤«¤É¤¦¤«¤òÊÖ¤¹ / + * @brief ID値が光の剣のモンスター魔法IDかどうかを返す / * Return TRUE if a spell psycho-spear. - * @param spell ȽÄêÂоݤÎID - * @return ¸÷¤Î·õ¤ÎID¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£ + * @param spell 判定対象のID + * @return 光の剣のIDならばTRUEを返す。 */ static bool spell_psy_spe(byte spell) { @@ -923,10 +819,10 @@ static bool spell_psy_spe(byte spell) /*! - * @brief IDÃͤ¬¼£ÌþËâË¡¤«¤É¤¦¤«¤òÊÖ¤¹ / + * @brief ID値が治癒魔法かどうかを返す / * Return TRUE if a spell is good for healing. - * @param spell ȽÄêÂоݤÎID - * @return ¼£ÌþËâË¡¤ÎID¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£ + * @param spell 判定対象のID + * @return 治癒魔法のIDならばTRUEを返す。 */ static bool spell_heal(byte spell) { @@ -939,10 +835,10 @@ static bool spell_heal(byte spell) /*! - * @brief IDÃͤ¬ËâÎϾõ¤É¤¦¤«¤òÊÖ¤¹ / + * @brief ID値が魔力消去かどうかを返す / * Return TRUE if a spell is good for dispel. - * @param spell ȽÄêÂоݤÎID - * @return ËâÎϾõî¤ÎID¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£ + * @param spell 判定対象のID + * @return 魔力消去のIDならばTRUEを返す。 */ static bool spell_dispel(byte spell) { @@ -955,12 +851,12 @@ static bool spell_dispel(byte spell) /*! - * @brief ¥â¥ó¥¹¥¿¡¼¤¬¥×¥ì¥¤¥ä¡¼¤ËËâÎϾõî¤òÍ¿¤¨¤ë¤Ù¤­¤«¤òȽÄꤹ¤ë¥ë¡¼¥Á¥ó + * @brief モンスターがプレイヤーに魔力消去を与えるべきかを判定するルーチン * Check should monster cast dispel spell. - * @param m_idx ¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤ÂÎÇÛÎóID - * @return ËâÎϾõî¤ò¤«¤±¤ë¤Ù¤­¤Ê¤éTRUE¤òÊÖ¤¹¡£ + * @param m_idx モンスターの構造体配列ID + * @return 魔力消去をかけるべきならTRUEを返す。 */ -bool dispel_check(int m_idx) +bool dispel_check(MONSTER_IDX m_idx) { monster_type *m_ptr = &m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; @@ -1059,12 +955,12 @@ bool dispel_check(int m_idx) /*! - * @brief ¥â¥ó¥¹¥¿¡¼¤ÎËâË¡ÁªÂò¥ë¡¼¥Á¥ó + * @brief モンスターの魔法選択ルーチン * Have a monster choose a spell from a list of "useful" spells. - * @param m_idx ¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤ÂÎÇÛÎóID - * @param spells ¸õÊäËâË¡ID¤ò¤Þ¤È¤á¤¿ÇÛÎó - * @param num spells¤ÎŤµ - * @return ÁªÂò¤·¤¿¥â¥ó¥¹¥¿¡¼ËâË¡¤ÎID + * @param m_idx モンスターの構造体配列ID + * @param spells 候補魔法IDをまとめた配列 + * @param num spellsの長さ + * @return 選択したモンスター魔法のID * @details * Note that this list does NOT include spells that will just hit\n * other monsters, and the list is restricted when the monster is\n @@ -1077,7 +973,7 @@ bool dispel_check(int m_idx) *\n * This function may well be an efficiency bottleneck.\n */ -static int choose_attack_spell(int m_idx, byte spells[], byte num) +static int choose_attack_spell(MONSTER_IDX m_idx, byte spells[], byte num) { monster_type *m_ptr = &m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; @@ -1210,7 +1106,7 @@ static int choose_attack_spell(int m_idx, byte spells[], byte num) } /* Player is close and we have attack spells, blink away */ - if ((distance(py, px, m_ptr->fy, m_ptr->fx) < 4) && (attack_num || (r_ptr->flags6 & RF6_TRAPS)) && (randint0(100) < 75) && !world_monster) + if ((distance(p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx) < 4) && (attack_num || (r_ptr->a_ability_flags2 & RF6_TRAPS)) && (randint0(100) < 75) && !world_monster) { /* Choose tactical spell */ if (tactic_num) return (tactic[randint0(tactic_num)]); @@ -1301,12 +1197,12 @@ static int choose_attack_spell(int m_idx, byte spells[], byte num) /*! - * @brief IDÃͤ¬ÈóËâ½ÑŪ¤ÊÆü쵻ǽ¤«¤É¤¦¤«¤òÊÖ¤¹ / + * @brief ID値が非魔術的な特殊技能かどうかを返す / * Return TRUE if a spell is inate spell. - * @param spell ȽÄêÂоݤÎID - * @return ÈóËâ½ÑŪ¤ÊÆü쵻ǽ¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£ + * @param spell 判定対象のID + * @return 非魔術的な特殊技能ならばTRUEを返す。 */ -bool spell_is_inate(u16b spell) +bool spell_is_inate(SPELL_IDX spell) { if (spell < 32 * 4) /* Set RF4 */ { @@ -1327,16 +1223,16 @@ bool spell_is_inate(u16b spell) /*! - * @brief ¥â¥ó¥¹¥¿¡¼¤¬¥×¥ì¥¤¥ä¡¼¤Ë¥À¥á¡¼¥¸¤òÍ¿¤¨¤ë¤¿¤á¤ÎºÇŬ¤ÊºÂɸ¤ò»»½Ð¤¹¤ë / - * @param m_ptr µ»Ç½¤ò»ÈÍѤ¹¤ë¥â¥ó¥¹¥¿¡¼¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿ - * @param yp ºÇŬ¤ÊÌÜɸÃÏÅÀ¤ÎYºÂɸ¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿ - * @param xp ºÇŬ¤ÊÌÜɸÃÏÅÀ¤ÎXºÂɸ¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿ - * @param f_flag ¼ÍÀþ¤ËÆþ¤ì¤ë¤Î¤òÈò¤±¤ëÃÏ·Á¤Î½ê»ý¥Õ¥é¥° - * @param path_check ¼ÍÀþ¤òȽÄꤹ¤ë¤¿¤á¤Î´Ø¿ô¥Ý¥¤¥ó¥¿ - * @return Í­¸ú¤ÊºÂɸ¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹ + * @brief モンスターがプレイヤーにダメージを与えるための最適な座標を算出する / + * @param m_ptr 技能を使用するモンスター構造体の参照ポインタ + * @param yp 最適な目標地点のY座標を返す参照ポインタ + * @param xp 最適な目標地点のX座標を返す参照ポインタ + * @param f_flag 射線に入れるのを避ける地形の所持フラグ + * @param path_check 射線を判定するための関数ポインタ + * @return 有効な座標があった場合TRUEを返す */ -static bool adjacent_grid_check(monster_type *m_ptr, int *yp, int *xp, - int f_flag, bool (*path_check)(int, int, int, int)) +static bool adjacent_grid_check(monster_type *m_ptr, POSITION *yp, POSITION *xp, + int f_flag, bool (*path_check)(POSITION, POSITION, POSITION, POSITION)) { int i; int tonari; @@ -1349,9 +1245,9 @@ static bool adjacent_grid_check(monster_type *m_ptr, int *yp, int *xp, {-1, 0, 1, -1, 1, -1, 0, 1}, { 1, 0, -1, 1, -1, 1, 0, -1}}; - if (m_ptr->fy < py && m_ptr->fx < px) tonari = 0; - else if (m_ptr->fy < py) tonari = 1; - else if (m_ptr->fx < px) tonari = 2; + if (m_ptr->fy < p_ptr->y && m_ptr->fx < p_ptr->x) tonari = 0; + else if (m_ptr->fy < p_ptr->y) tonari = 1; + else if (m_ptr->fx < p_ptr->x) tonari = 2; else tonari = 3; for (i = 0; i < 8; i++) @@ -1383,19 +1279,19 @@ static bool adjacent_grid_check(monster_type *m_ptr, int *yp, int *xp, #define DO_SPELL_BA_LITE 3 /*! - * @brief ¥â¥ó¥¹¥¿¡¼¤ÎÆü쵻ǽ¥á¥¤¥ó¥ë¡¼¥Á¥ó / + * @brief モンスターの特殊技能メインルーチン / * Creatures can cast spells, shoot missiles, and breathe. - * @param m_idx ¥â¥ó¥¹¥¿¡¼¹½Â¤ÂÎÇÛÎó¤ÎID - * @return ¼ÂºÝ¤ËÆü쵻ǽ¤òÍøÍѤ·¤¿¤éTRUE¤òÊÖ¤¹ + * @param m_idx モンスター構造体配列のID + * @return 実際に特殊技能を利用したらTRUEを返す * @details * Returns "TRUE" if a spell (or whatever) was (successfully) cast.\n *\n - * XXX XXX XXX This function could use some work, but remember to\n + * This function could use some work, but remember to\n * keep it as optimized as possible, while retaining generic code.\n *\n * Verify the various "blind-ness" checks in the code.\n *\n - * XXX XXX XXX Note that several effects should really not be "seen"\n + * Note that several effects should really not be "seen"\n * if the player is blind. See also "effects.c" for other "mistakes".\n *\n * Perhaps monsters should breathe at locations *near* the player,\n @@ -1440,41 +1336,34 @@ static bool adjacent_grid_check(monster_type *m_ptr, int *yp, int *xp, * Note the special "MFLAG_NICE" flag, which prevents a monster from using\n * any spell attacks until the player has had a single chance to move.\n */ -bool make_attack_spell(int m_idx) +bool make_attack_spell(MONSTER_IDX m_idx) { - int k, thrown_spell = 0, rlev, failrate; + int k; + SPELL_IDX thrown_spell = 0; + DEPTH rlev; + PERCENTAGE failrate; byte spell[96], num = 0; - u32b f4, f5, f6; - monster_type *m_ptr = &m_list[m_idx]; - monster_race *r_ptr = &r_info[m_ptr->r_idx]; - char m_name[80]; + BIT_FLAGS f4, f5, f6; + monster_type *m_ptr = &m_list[m_idx]; + monster_race *r_ptr = &r_info[m_ptr->r_idx]; + char m_name[80]; #ifndef JP - char m_poss[80]; + char m_poss[80]; #endif bool no_inate = FALSE; bool do_spell = DO_SPELL_NONE; int dam = 0; - u32b mode = 0L; - int s_num_6 = (easy_band ? 2 : 6); - int s_num_4 = (easy_band ? 1 : 4); - int rad = 0; //For elemental spells /* Target location */ - int x = px; - int y = py; + POSITION x = p_ptr->x; + POSITION y = p_ptr->y; /* Target location for lite breath */ - int x_br_lite = 0; - int y_br_lite = 0; - - /* Summon count */ - int count = 0; - - /* Extract the blind-ness */ - bool blind = (p_ptr->blind ? TRUE : FALSE); + POSITION x_br_lite = 0; + POSITION y_br_lite = 0; /* Extract the "see-able-ness" */ - bool seen = (!blind && m_ptr->ml); + bool seen = (!p_ptr->blind && m_ptr->ml); bool maneable = player_has_los_bold(m_ptr->fy, m_ptr->fx); /* Check "projectable" */ @@ -1502,13 +1391,13 @@ bool make_attack_spell(int m_idx) /* Sometimes forbid inate attacks (breaths) */ if (randint0(100) >= (r_ptr->freq_spell * 2)) no_inate = TRUE; - /* XXX XXX XXX Handle "track_target" option (?) */ + /* Handle "track_target" option (?) */ /* Extract the racial spell flags */ f4 = r_ptr->flags4; - f5 = r_ptr->flags5; - f6 = r_ptr->flags6; + f5 = r_ptr->a_ability_flags1; + f6 = r_ptr->a_ability_flags2; /*** require projectable player ***/ @@ -1577,7 +1466,7 @@ bool make_attack_spell(int m_idx) } else if ((f5 & RF5_BA_LITE) && (m_ptr->cdis <= MAX_RANGE)) { - int by = y, bx = x; + POSITION by = y, bx = x; get_project_point(m_ptr->fy, m_ptr->fx, &by, &bx, 0L); if ((distance(by, bx, y, x) <= 3) && los(by, bx, y, x) && one_in_(5)) { @@ -1696,7 +1585,7 @@ bool make_attack_spell(int m_idx) if (((f4 & RF4_BOLT_MASK) || (f5 & RF5_BOLT_MASK) || (f6 & RF6_BOLT_MASK)) && - !clean_shot(m_ptr->fy, m_ptr->fx, py, px, FALSE)) + !clean_shot(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x, FALSE)) { /* Remove spells that will only hurt friends */ f4 &= ~(RF4_BOLT_MASK); @@ -1739,19 +1628,19 @@ bool make_attack_spell(int m_idx) /* Extract the "inate" spells */ for (k = 0; k < 32; k++) { - if (f4 & (1L << k)) spell[num++] = k + 32 * 3; + if (f4 & (1L << k)) spell[num++] = k + RF4_SPELL_START; } /* Extract the "normal" spells */ for (k = 0; k < 32; k++) { - if (f5 & (1L << k)) spell[num++] = k + 32 * 4; + if (f5 & (1L << k)) spell[num++] = k + RF5_SPELL_START; } /* Extract the "bizarre" spells */ for (k = 0; k < 32; k++) { - if (f6 & (1L << k)) spell[num++] = k + 32 * 5; + if (f6 & (1L << k)) spell[num++] = k + RF6_SPELL_START; } /* No spells left */ @@ -1813,9 +1702,8 @@ bool make_attack_spell(int m_idx) if (!spell_is_inate(thrown_spell) && (in_no_magic_dungeon || (MON_STUNNED(m_ptr) && one_in_(2)) || (randint0(100) < failrate))) { - disturb(1, 1); - /* Message */ - msg_format(_("%^s¤Ï¼öʸ¤ò¾§¤¨¤è¤¦¤È¤·¤¿¤¬¼ºÇÔ¤·¤¿¡£", "%^s tries to cast a spell, but fails."), m_name); + disturb(TRUE, TRUE); + msg_format(_("%^sは呪文を唱えようとしたが失敗した。", "%^s tries to cast a spell, but fails."), m_name); return (TRUE); } @@ -1823,7 +1711,7 @@ bool make_attack_spell(int m_idx) /* Hex: Anti Magic Barrier */ if (!spell_is_inate(thrown_spell) && magic_barrier(m_idx)) { - msg_format(_("È¿ËâË¡¥Ð¥ê¥¢¤¬%^s¤Î¼öʸ¤ò¤«¤­¾Ã¤·¤¿¡£", "Anti magic barrier cancels the spell which %^s casts."), m_name); + msg_format(_("反魔法バリアが%^sの呪文をかき消した。", "Anti magic barrier cancels the spell which %^s casts."), m_name); return (TRUE); } @@ -1871,112 +1759,9 @@ bool make_attack_spell(int m_idx) } } - /* Cast the spell. */ - switch (thrown_spell) - { - case 96 + 0: MP_spell_RF4_SHRIEK(m_idx); break; /* RF4_SHRIEK */ - case 96 + 1: break; /* RF4_XXX1 */ - case 96 + 2: MP_spell_RF4_DISPEL(m_idx); break; /* RF4_DISPEL */ - case 96 + 3: dam = MP_spell_RF4_ROCKET(y, x, m_idx); break; /* RF4_ROCKET */ - case 96 + 4: dam = spell_RF4_SHOOT(y, x, m_idx); break; /* RF4_SHOOT */ - case 96 + 5: break; /* RF4_XXX2 */ - case 96 + 6: break; /* RF4_XXX3 */ - case 96 + 7: break; /* RF4_XXX4 */ - case 96 + 8: dam = spell_RF4_BREATH(GF_ACID, y, x, m_idx); break; /* RF4_BR_ACID */ - case 96 + 9: dam = spell_RF4_BREATH(GF_ELEC, y, x, m_idx); break; /* RF4_BR_ELEC */ - case 96 + 10: dam = spell_RF4_BREATH(GF_FIRE, y, x, m_idx); break; /* RF4_BR_FIRE */ - case 96 + 11: dam = spell_RF4_BREATH(GF_COLD, y, x, m_idx); break; /* RF4_BR_COLD */ - case 96 + 12: dam = spell_RF4_BREATH(GF_POIS, y, x, m_idx); break; /* RF4_BR_POIS */ - case 96 + 13: dam = spell_RF4_BREATH(GF_NETHER, y, x, m_idx); break; /* RF4_BR_NETH */ - case 96 + 14: dam = spell_RF4_BREATH(GF_LITE, y_br_lite, x_br_lite, m_idx); break; /* RF4_BR_LITE */ - case 96 + 15: dam = spell_RF4_BREATH(GF_DARK, y, x, m_idx); break; /* RF4_BR_DARK */ - case 96 + 16: dam = spell_RF4_BREATH(GF_CONFUSION, y, x, m_idx); break; /* RF4_BR_CONF */ - case 96 + 17: dam = spell_RF4_BREATH(GF_SOUND, y, x, m_idx); break; /* RF4_BR_SOUN */ - case 96 + 18: dam = spell_RF4_BREATH(GF_CHAOS, y, x, m_idx); break; /* RF4_BR_CHAO */ - case 96 + 19: dam = spell_RF4_BREATH(GF_DISENCHANT, y, x, m_idx); break; /* RF4_BR_DISE */ - case 96 + 20: dam = spell_RF4_BREATH(GF_NEXUS, y, x, m_idx); break; /* RF4_BR_NEXU */ - case 96 + 21: dam = spell_RF4_BREATH(GF_TIME, y, x, m_idx); break; /* RF4_BR_TIME */ - case 96 + 22: dam = spell_RF4_BREATH(GF_INERTIA, y, x, m_idx); break; /* RF4_BR_INER */ - case 96 + 23: dam = spell_RF4_BREATH(GF_GRAVITY, y, x, m_idx); break; /* RF4_BR_GRAV */ - case 96 + 24: dam = spell_RF4_BREATH(GF_SHARDS, y, x, m_idx); break; /* RF4_BR_SHAR */ - case 96 + 25: dam = spell_RF4_BREATH(GF_PLASMA, y, x, m_idx); break; /* RF4_BR_PLAS */ - case 96 + 26: dam = spell_RF4_BREATH(GF_FORCE, y, x, m_idx); break; /* RF4_BR_WALL */ - case 96 + 27: dam = spell_RF4_BREATH(GF_MANA, y, x, m_idx); break; /* RF4_BR_MANA */ - case 96 + 28: dam = spell_RF4_BA_NUKE(y, x, m_idx); break; /* RF4_BA_NUKE */ - case 96 + 29: dam = spell_RF4_BREATH(GF_NUKE, y, x, m_idx); break; /* RF4_BR_NUKE */ - case 96 + 30: dam = spell_RF4_BA_CHAO(y, x, m_idx); break; /* RF4_BA_CHAO */ - case 96 + 31: dam = spell_RF4_BREATH(GF_DISINTEGRATE, y, x, m_idx); break; /* RF4_BR_DISI */ - case 128 + 0: dam = spell_RF5_BA_ACID(y, x, m_idx); break; /* RF5_BA_ACID */ - case 128 + 1: dam = spell_RF5_BA_ELEC(y, x, m_idx); break; /* RF5_BA_ELEC */ - case 128 + 2: dam = spell_RF5_BA_FIRE(y, x, m_idx); break; /* RF5_BA_FIRE */ - case 128 + 3: dam = spell_RF5_BA_COLD(y, x, m_idx); break; /* RF5_BA_COLD */ - case 128 + 4: dam = spell_RF5_BA_POIS(y, x, m_idx); break; /* RF5_BA_POIS */ - case 128 + 5: dam = spell_RF5_BA_NETH(y, x, m_idx); break; /* RF5_BA_NETH */ - case 128 + 6: dam = spell_RF5_BA_WATE(y, x, m_idx); break; /* RF5_BA_WATE */ - case 128 + 7: dam = spell_RF5_BA_MANA(y, x, m_idx); break; /* RF5_BA_MANA */ - case 128 + 8: dam = spell_RF5_BA_DARK(y, x, m_idx); break; /* RF5_BA_DARK */ - case 128 + 9: dam = spell_RF5_DRAIN_MANA(y, x, m_idx); break; /* RF5_DRAIN_MANA */ - case 128 + 10: dam = spell_RF5_MIND_BLAST(y, x, m_idx); break; /* RF5_MIND_BLAST */ - case 128 + 11: dam = spell_RF5_BRAIN_SMASH(y, x, m_idx); break; /* RF5_MIND_BLAST */ - case 128 + 12: dam = spell_RF5_CAUSE_1(y, x, m_idx); break; /* RF5_CAUSE_1 */ - case 128 + 13: dam = spell_RF5_CAUSE_2(y, x, m_idx); break; /* RF5_CAUSE_2 */ - case 128 + 14: dam = spell_RF5_CAUSE_3(y, x, m_idx); break; /* RF5_CAUSE_3 */ - case 128 + 15: dam = spell_RF5_CAUSE_4(y, x, m_idx); break; /* RF5_CAUSE_4 */ - case 128 + 16: dam = spell_RF5_BO_ACID(y, x, m_idx); break; /* RF5_BO_ACID */ - case 128 + 17: dam = spell_RF5_BO_ELEC(y, x, m_idx); break; /* RF5_BO_ELEC */ - case 128 + 18: dam = spell_RF5_BO_FIRE(y, x, m_idx); break; /* RF5_BO_FIRE */ - case 128 + 19: dam = spell_RF5_BO_COLD(y, x, m_idx); break; /* RF5_BO_COLD */ - case 128 + 20: dam = spell_RF5_BA_LITE(y, x, m_idx); break; /* RF5_BA_LITE */ - case 128 + 21: dam = spell_RF5_BO_NETH(y, x, m_idx); break; /* RF5_BO_NETH */ - case 128 + 22: dam = spell_RF5_BO_WATE(y, x, m_idx); break; /* RF5_BO_WATE */ - case 128 + 23: dam = spell_RF5_BO_MANA(y, x, m_idx); break; /* RF5_BO_MANA */ - case 128 + 24: dam = spell_RF5_BO_PLAS(y, x, m_idx); break; /* RF5_BO_PLAS */ - case 128 + 25: dam = spell_RF5_BO_ICEE(y, x, m_idx); break; /* RF5_BO_ICEE */ - case 128 + 26: dam = spell_RF5_MISSILE(y, x, m_idx); break; /* RF5_MISSILE */ - case 128 + 27: spell_RF5_SCARE(y, x, m_idx); break; /* RF5_SCARE */ - case 128 + 28: spell_RF5_BLIND(y, x, m_idx); break; /* RF5_BLIND */ - case 128 + 29: spell_RF5_CONF(y, x, m_idx); break; /* RF5_CONF */ - case 128 + 30: spell_RF5_SLOW(y, x, m_idx); break; /* RF5_SLOW */ - case 128 + 31: spell_RF5_HOLD(y, x, m_idx); break; /* RF5_HOLD */ - case 160 + 0: spell_RF6_HASTE(m_idx); break; /* RF6_HASTE */ - case 160 + 1: dam = spell_RF6_HAND_DOOM(y, x, m_idx); break; /* RF6_HAND_DOOM */ - case 160 + 2: spell_RF6_HEAL(m_idx); break; /* RF6_HEAL */ - case 160 + 3: spell_RF6_INVULNER(m_idx); break; /* RF6_INVULNER */ - case 160 + 4: spell_RF6_BLINK(m_idx); break; /* RF6_BLINK */ - case 160 + 5: spell_RF6_TPORT(m_idx); break; /* RF6_TPORT */ - case 160 + 6: dam = spell_RF6_WORLD(m_idx); break; /* RF6_WORLD */ - - /* RF6_SPECIAL */ - case 160 + 7: - dam = spell_RF6_SPECIAL(y, x, m_idx); - if (dam < 0) return FALSE; - break; - - case 160 + 8: spell_RF6_TELE_TO(m_idx); break; /* RF6_TELE_TO */ - case 160 + 9: spell_RF6_TELE_AWAY(m_idx); break; /* RF6_TELE_AWAY */ - case 160 + 10: spell_RF6_TELE_LEVEL(m_idx); break; /* RF6_TELE_LEVEL */ - case 160 + 11: spell_RF6_PSY_SPEAR(y, x, m_idx); break; /* RF6_PSY_SPEAR */ - case 160 + 12: spell_RF6_DARKNESS(m_idx); break; /* RF6_DARKNESS */ - case 160 + 13: spell_RF6_TRAPS(y, x, m_idx); break; /* RF6_TRAPS */ - case 160 + 14: spell_RF6_FORGET(m_idx); break; /* RF6_FORGET */ - case 160 + 15: spell_RF6_RAISE_DEAD(m_idx); break; /* RF6_RAISE_DEAD */ - case 160 + 16: spell_RF6_S_KIN(y, x, m_idx); break; /* RF6_S_KIN */ - case 160 + 17: spell_RF6_S_CYBER(y, x, m_idx); break; /* RF6_S_CYBER */ - case 160 + 18: spell_RF6_S_MONSTER(y, x, m_idx); break; /* RF6_S_MONSTER */ - case 160 + 19: spell_RF6_S_MONSTERS(y, x, m_idx); break; /* RF6_S_MONSTER */ - case 160 + 20: spell_RF6_S_ANT(y, x, m_idx); break; /* RF6_S_ANT */ - case 160 + 21: spell_RF6_S_SPIDER(y, x, m_idx); break; /* RF6_S_SPIDER */ - case 160 + 22: spell_RF6_S_HOUND(y, x, m_idx); break; /* RF6_S_HOUND */ - case 160 + 23: spell_RF6_S_HYDRA(y, x, m_idx); break; /* RF6_S_HYDRA */ - case 160 + 24: spell_RF6_S_ANGEL(y, x, m_idx); break; /* RF6_S_ANGEL */ - case 160 + 25: spell_RF6_S_DEMON(y, x, m_idx); break; /* RF6_S_DEMON */ - case 160 + 26: spell_RF6_S_UNDEAD(y, x, m_idx); break; /* RF6_S_UNDEAD */ - case 160 + 27: spell_RF6_S_DRAGON(y, x, m_idx); break; /* RF6_S_DRAGON */ - case 160 + 28: spell_RF6_S_HI_UNDEAD(y, x, m_idx); break; /* RF6_S_HI_UNDEAD */ - case 160 + 29: spell_RF6_S_HI_DRAGON(y, x, m_idx); break; /* RF6_S_HI_DRAGON */ - case 160 + 30: spell_RF6_S_AMBERITES(y, x, m_idx); break; /* RF6_S_AMBERITES */ - case 160 + 31: spell_RF6_S_UNIQUE(y, x, m_idx); break; /* RF6_S_UNIQUE */ - } + /* Cast the spell. */ + dam = monspell_to_player(thrown_spell, y, x, m_idx); + if (dam < 0) return FALSE; if ((p_ptr->action == ACTION_LEARN) && thrown_spell > 175) {