OSDN Git Service

Add new option -- show_ammo_detail / show_ammo_no_crit
[hengband/hengband.git] / src / spells3.c
index 5ccf46a..39199df 100644 (file)
@@ -3532,6 +3532,8 @@ s = "
        if (object_is_cursed(o_ptr))
        {
                if (((o_ptr->curse_flags & TRC_HEAVY_CURSE) && (randint1(100) < 33)) ||
+                       have_flag(flgs, TR_ADD_L_CURSE) ||
+                       have_flag(flgs, TR_ADD_H_CURSE) ||
                    (o_ptr->curse_flags & TRC_PERMA_CURSE))
                {
 #ifdef JP
@@ -3930,7 +3932,7 @@ void display_spell_list(void)
        int             i, j;
        int             y, x;
        int             m[9];
-       magic_type      *s_ptr;
+       const magic_type *s_ptr;
        char            name[80];
        char            out_val[160];
 
@@ -3942,6 +3944,13 @@ void display_spell_list(void)
        if (p_ptr->pclass == CLASS_SORCERER) return;
        if (p_ptr->pclass == CLASS_RED_MAGE) return;
 
+       /* Snipers */
+       if (p_ptr->pclass == CLASS_SNIPER)
+       {
+               display_snipe_list();
+               return;
+       }
+
        /* mind.c type classes */
        if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
            (p_ptr->pclass == CLASS_BERSERKER) ||
@@ -4227,7 +4236,7 @@ int mod_spell_chance_2(int chance)
 s16b spell_chance(int spell, int use_realm)
 {
        int             chance, minfail;
-       magic_type      *s_ptr;
+       const magic_type *s_ptr;
        int             need_mana;
        int penalty = (mp_ptr->spell_stat == A_WIS) ? 10 : 4;
 
@@ -4288,9 +4297,19 @@ s16b spell_chance(int spell, int use_realm)
 
        chance = mod_spell_chance_1(chance);
 
-       if ((use_realm == REALM_NATURE) && ((p_ptr->align > 50) || (p_ptr->align < -50))) chance += penalty;
-       if (((use_realm == REALM_LIFE) || (use_realm == REALM_CRUSADE)) && (p_ptr->align < -20)) chance += penalty;
-       if (((use_realm == REALM_DEATH) || (use_realm == REALM_DAEMON)) && (p_ptr->align > 20)) chance += penalty;
+       /* Goodness or evilness gives a penalty to failure rate */
+       switch (use_realm)
+       {
+       case REALM_NATURE:
+               if ((p_ptr->align > 50) || (p_ptr->align < -50)) chance += penalty;
+               break;
+       case REALM_LIFE: case REALM_CRUSADE:
+               if (p_ptr->align < -20) chance += penalty;
+               break;
+       case REALM_DEATH: case REALM_DAEMON: case REALM_HEX:
+               if (p_ptr->align > 20) chance += penalty;
+               break;
+       }
 
        /* Minimum failure rate */
        if (chance < minfail) chance = minfail;
@@ -4323,7 +4342,7 @@ s16b spell_chance(int spell, int use_realm)
  */
 bool spell_okay(int spell, bool learned, bool study_pray, int use_realm)
 {
-       magic_type *s_ptr;
+       const magic_type *s_ptr;
 
        /* Access the spell */
        if (!is_magic(use_realm))
@@ -4370,7 +4389,7 @@ bool spell_okay(int spell, bool learned, bool study_pray, int use_realm)
 void print_spells(int target_spell, byte *spells, int num, int y, int x, int use_realm)
 {
        int             i, spell, exp_level, increment = 64;
-       magic_type      *s_ptr;
+       const magic_type *s_ptr;
        cptr            comment;
        char            info[80];
        char            out_val[160];
@@ -4700,6 +4719,7 @@ bool hates_fire(object_type *o_ptr)
                case TV_CRUSADE_BOOK:
                case TV_MUSIC_BOOK:
                case TV_HISSATSU_BOOK:
+               case TV_HEX_BOOK:
                {
                        return (TRUE);
                }
@@ -4969,7 +4989,7 @@ msg_format("%s
 /*
  * Hurt the player with Acid
  */
-int acid_dam(int dam, cptr kb_str, int monspell)
+int acid_dam(int dam, cptr kb_str, int monspell, bool aura)
 {
        int get_damage;  
        int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
@@ -4990,7 +5010,7 @@ int acid_dam(int dam, cptr kb_str, int monspell)
        if (p_ptr->resist_acid) dam = (dam + 2) / 3;
        if (double_resist) dam = (dam + 2) / 3;
 
-       if (!CHECK_MULTISHADOW())
+       if (aura || !CHECK_MULTISHADOW())
        {
                if ((!(double_resist || p_ptr->resist_acid)) &&
                    one_in_(HURT_CHANCE))
@@ -5001,10 +5021,10 @@ int acid_dam(int dam, cptr kb_str, int monspell)
        }
 
        /* Take damage */
-       get_damage = take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
+       get_damage = take_hit(aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell);
 
        /* Inventory damage */
-       if (!(double_resist && p_ptr->resist_acid))
+       if (!aura && !(double_resist && p_ptr->resist_acid))
                inven_damage(set_acid_destroy, inv);
        return get_damage;
 }
@@ -5013,7 +5033,7 @@ int acid_dam(int dam, cptr kb_str, int monspell)
 /*
  * Hurt the player with electricity
  */
-int elec_dam(int dam, cptr kb_str, int monspell)
+int elec_dam(int dam, cptr kb_str, int monspell, bool aura)
 {
        int get_damage;  
        int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
@@ -5035,15 +5055,18 @@ int elec_dam(int dam, cptr kb_str, int monspell)
        if (p_ptr->resist_elec) dam = (dam + 2) / 3;
        if (double_resist) dam = (dam + 2) / 3;
 
-       if ((!(double_resist || p_ptr->resist_elec)) &&
-           one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
-               (void)do_dec_stat(A_DEX);
+       if (aura || !CHECK_MULTISHADOW())
+       {
+               if ((!(double_resist || p_ptr->resist_elec)) &&
+                   one_in_(HURT_CHANCE))
+                       (void)do_dec_stat(A_DEX);
+       }
 
        /* Take damage */
-       get_damage = take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
+       get_damage = take_hit(aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell);
 
        /* Inventory damage */
-       if (!(double_resist && p_ptr->resist_elec))
+       if (!aura && !(double_resist && p_ptr->resist_elec))
                inven_damage(set_elec_destroy, inv);
 
        return get_damage;
@@ -5053,7 +5076,7 @@ int elec_dam(int dam, cptr kb_str, int monspell)
 /*
  * Hurt the player with Fire
  */
-int fire_dam(int dam, cptr kb_str, int monspell)
+int fire_dam(int dam, cptr kb_str, int monspell, bool aura)
 {
        int get_damage;  
        int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
@@ -5075,15 +5098,18 @@ int fire_dam(int dam, cptr kb_str, int monspell)
        if (p_ptr->resist_fire) dam = (dam + 2) / 3;
        if (double_resist) dam = (dam + 2) / 3;
 
-       if ((!(double_resist || p_ptr->resist_fire)) &&
-           one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
-               (void)do_dec_stat(A_STR);
+       if (aura || !CHECK_MULTISHADOW())
+       {
+               if ((!(double_resist || p_ptr->resist_fire)) &&
+                   one_in_(HURT_CHANCE))
+                       (void)do_dec_stat(A_STR);
+       }
 
        /* Take damage */
-       get_damage = take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
+       get_damage = take_hit(aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell);
 
        /* Inventory damage */
-       if (!(double_resist && p_ptr->resist_fire))
+       if (!aura && !(double_resist && p_ptr->resist_fire))
                inven_damage(set_fire_destroy, inv);
 
        return get_damage;
@@ -5093,7 +5119,7 @@ int fire_dam(int dam, cptr kb_str, int monspell)
 /*
  * Hurt the player with Cold
  */
-int cold_dam(int dam, cptr kb_str, int monspell)
+int cold_dam(int dam, cptr kb_str, int monspell, bool aura)
 {
        int get_damage;  
        int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
@@ -5114,15 +5140,18 @@ int cold_dam(int dam, cptr kb_str, int monspell)
        if (p_ptr->resist_cold) dam = (dam + 2) / 3;
        if (double_resist) dam = (dam + 2) / 3;
 
-       if ((!(double_resist || p_ptr->resist_cold)) &&
-           one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
-               (void)do_dec_stat(A_STR);
+       if (aura || !CHECK_MULTISHADOW())
+       {
+               if ((!(double_resist || p_ptr->resist_cold)) &&
+                   one_in_(HURT_CHANCE))
+                       (void)do_dec_stat(A_STR);
+       }
 
        /* Take damage */
-       get_damage = take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
+       get_damage = take_hit(aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell);
 
        /* Inventory damage */
-       if (!(double_resist && p_ptr->resist_cold))
+       if (!aura && !(double_resist && p_ptr->resist_cold))
                inven_damage(set_cold_destroy, inv);
 
        return get_damage;
@@ -5280,22 +5309,14 @@ msg_format("
 /*
  * Curse the players weapon
  */
-bool curse_weapon(bool force, int slot)
+bool curse_weapon_object(bool force, object_type *o_ptr)
 {
        int i;
-
-       object_type *o_ptr;
-
        char o_name[MAX_NLEN];
 
-
-       /* Curse the weapon */
-       o_ptr = &inventory[slot];
-
        /* Nothing to curse */
        if (!o_ptr->k_idx) return (FALSE);
 
-
        /* Describe */
        object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
 
@@ -5304,13 +5325,12 @@ bool curse_weapon(bool force, int slot)
        {
                /* Cool */
 #ifdef JP
-msg_format("%s¤¬%s¤òÊñ¤ß¹þ¤â¤¦¤È¤·¤¿¤¬¡¢%s¤Ï¤½¤ì¤òÄ·¤ÍÊÖ¤·¤¿¡ª",
-"¶²ÉݤΰŹõ¥ª¡¼¥é", "Éð´ï", o_name);
+               msg_format("%s¤¬%s¤òÊñ¤ß¹þ¤â¤¦¤È¤·¤¿¤¬¡¢%s¤Ï¤½¤ì¤òÄ·¤ÍÊÖ¤·¤¿¡ª",
+                               "¶²ÉݤΰŹõ¥ª¡¼¥é", "Éð´ï", o_name);
 #else
                msg_format("A %s tries to %s, but your %s resists the effects!",
-                          "terrible black aura", "surround your weapon", o_name);
+                               "terrible black aura", "surround your weapon", o_name);
 #endif
-
        }
 
        /* not artifact or failed save... */
@@ -5318,11 +5338,10 @@ msg_format("%s
        {
                /* Oops */
 #ifdef JP
-if (!force) msg_format("¶²ÉݤΰŹõ¥ª¡¼¥é¤¬¤¢¤Ê¤¿¤Î%s¤òÊñ¤ß¹þ¤ó¤À¡ª", o_name);
+               if (!force) msg_format("¶²ÉݤΰŹõ¥ª¡¼¥é¤¬¤¢¤Ê¤¿¤Î%s¤òÊñ¤ß¹þ¤ó¤À¡ª", o_name);
 #else
                if (!force) msg_format("A terrible black aura blasts your %s!", o_name);
 #endif
-
                chg_virtue(V_ENCHANT, -5);
 
                /* Shatter the weapon */
@@ -5338,7 +5357,6 @@ if (!force) msg_format("
                for (i = 0; i < TR_FLAG_SIZE; i++)
                        o_ptr->art_flags[i] = 0;
 
-
                /* Curse it */
                o_ptr->curse_flags = TRC_CURSED;
 
@@ -5359,6 +5377,12 @@ if (!force) msg_format("
        return (TRUE);
 }
 
+bool curse_weapon(bool force, int slot)
+{
+       /* Curse the weapon */
+       return curse_weapon_object(force, &inventory[slot]);
+}
+
 
 /*
  * Enchant some bolts
@@ -5993,7 +6017,7 @@ bool summon_kin_player(int level, int y, int x, u32b mode)
                        case RACE_NIBELUNG:
                        case RACE_DARK_ELF:
                        case RACE_MIND_FLAYER:
-                       case RACE_KUTA:
+                       case RACE_KUTAR:
                        case RACE_S_FAIRY:
                                summon_kin_type = 'h';
                                break;