OSDN Git Service

branch-mogami-TR をマージ。バージョンを1.3.0に上げた。
[hengband/hengband.git] / src / cmd2.c
index 16b07d6..3139af0 100644 (file)
@@ -147,10 +147,15 @@ if (get_check("
 #ifdef JP
                        if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
                                msg_print("¤Ê¤ó¤À¤³¤Î³¬Ãʤϡª");
-                       else
+                       else if (0 == dun_level)
+                               msg_print("ÃϾå¤ËÌá¤Ã¤¿¡£");
+                        else
                                msg_print("³¬Ãʤò¾å¤Ã¤Æ¿·¤¿¤Ê¤ë̵ܤؤÈ­¤òƧ¤ßÆþ¤ì¤¿¡£");
 #else
-                       msg_print("You enter a maze of up staircases.");
+                        if (0 == dun_level)
+                               msg_print("You go back to the surface.");
+                        else
+                                msg_print("You enter a maze of up staircases.");
 #endif
 
 
@@ -3058,7 +3063,7 @@ void do_cmd_stay(int pickup)
 
                energy_use = 0;
                /* Hack -- enter store */
-               command_new = 253;
+               command_new = SPECIAL_KEY_STORE;
        }
 
        /* Hack -- enter a building if we are on one -KMW- */
@@ -3070,7 +3075,7 @@ void do_cmd_stay(int pickup)
 
                energy_use = 0;
                /* Hack -- enter building */
-               command_new = 254;
+               command_new = SPECIAL_KEY_BUILDING;
        }
 
        /* Exit a quest if reach the quest exit */
@@ -3239,16 +3244,16 @@ static int breakage_chance(object_type *o_ptr)
 }
 
 
-s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
+static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
 {
        int mult = 10;
 
        monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
-       u32b f1, f2, f3;
+       u32b flgs[TR_FLAG_SIZE];
 
        /* Extract the flags */
-       object_flags(o_ptr, &f1, &f2, &f3);
+       object_flags(o_ptr, flgs);
 
        /* Some "weapons" and "ammo" do extra damage */
        switch (o_ptr->tval)
@@ -3258,7 +3263,7 @@ s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                case TV_BOLT:
                {
                        /* Slay Animal */
-                       if ((f1 & TR1_SLAY_ANIMAL) &&
+                       if ((have_flag(flgs, TR_SLAY_ANIMAL)) &&
                            (r_ptr->flags3 & RF3_ANIMAL))
                        {
                                if (m_ptr->ml)
@@ -3270,7 +3275,7 @@ s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        }
 
                        /* Slay Evil */
-                       if ((f1 & TR1_SLAY_EVIL) &&
+                       if ((have_flag(flgs, TR_SLAY_EVIL)) &&
                            (r_ptr->flags3 & RF3_EVIL))
                        {
                                if (m_ptr->ml)
@@ -3282,7 +3287,7 @@ s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        }
 
                        /* Slay Human */
-                       if ((f3 & TR3_SLAY_HUMAN) &&
+                       if ((have_flag(flgs, TR_SLAY_HUMAN)) &&
                            (r_ptr->flags2 & RF2_HUMAN))
                        {
                                if (m_ptr->ml)
@@ -3294,7 +3299,7 @@ s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        }
 
                        /* Slay Undead */
-                       if ((f1 & TR1_SLAY_UNDEAD) &&
+                       if ((have_flag(flgs, TR_SLAY_UNDEAD)) &&
                            (r_ptr->flags3 & RF3_UNDEAD))
                        {
                                if (m_ptr->ml)
@@ -3306,7 +3311,7 @@ s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        }
 
                        /* Slay Demon */
-                       if ((f1 & TR1_SLAY_DEMON) &&
+                       if ((have_flag(flgs, TR_SLAY_DEMON)) &&
                            (r_ptr->flags3 & RF3_DEMON))
                        {
                                if (m_ptr->ml)
@@ -3318,7 +3323,7 @@ s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        }
 
                        /* Slay Orc */
-                       if ((f1 & TR1_SLAY_ORC) &&
+                       if ((have_flag(flgs, TR_SLAY_ORC)) &&
                            (r_ptr->flags3 & RF3_ORC))
                        {
                                if (m_ptr->ml)
@@ -3330,7 +3335,7 @@ s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        }
 
                        /* Slay Troll */
-                       if ((f1 & TR1_SLAY_TROLL) &&
+                       if ((have_flag(flgs, TR_SLAY_TROLL)) &&
                            (r_ptr->flags3 & RF3_TROLL))
                        {
                                if (m_ptr->ml)
@@ -3342,7 +3347,7 @@ s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        }
 
                        /* Slay Giant */
-                       if ((f1 & TR1_SLAY_GIANT) &&
+                       if ((have_flag(flgs, TR_SLAY_GIANT)) &&
                            (r_ptr->flags3 & RF3_GIANT))
                        {
                                if (m_ptr->ml)
@@ -3354,7 +3359,7 @@ s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        }
 
                        /* Slay Dragon  */
-                       if ((f1 & TR1_SLAY_DRAGON) &&
+                       if ((have_flag(flgs, TR_SLAY_DRAGON)) &&
                            (r_ptr->flags3 & RF3_DRAGON))
                        {
                                if (m_ptr->ml)
@@ -3366,7 +3371,7 @@ s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        }
 
                        /* Execute Dragon */
-                       if ((f1 & TR1_KILL_DRAGON) &&
+                       if ((have_flag(flgs, TR_KILL_DRAGON)) &&
                            (r_ptr->flags3 & RF3_DRAGON))
                        {
                                if (m_ptr->ml)
@@ -3383,7 +3388,7 @@ s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        }
 
                        /* Brand (Acid) */
-                       if ((f1 & TR1_BRAND_ACID) || (p_ptr->special_attack & (ATTACK_ACID)))
+                       if ((have_flag(flgs, TR_BRAND_ACID)) || (p_ptr->special_attack & (ATTACK_ACID)))
                        {
                                /* Notice immunity */
                                if (r_ptr->flags3 & RF3_IM_ACID)
@@ -3402,7 +3407,7 @@ s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        }
 
                        /* Brand (Elec) */
-                       if ((f1 & TR1_BRAND_ELEC) || (p_ptr->special_attack & (ATTACK_ELEC)))
+                       if ((have_flag(flgs, TR_BRAND_ELEC)) || (p_ptr->special_attack & (ATTACK_ELEC)))
                        {
                                /* Notice immunity */
                                if (r_ptr->flags3 & RF3_IM_ELEC)
@@ -3421,7 +3426,7 @@ s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        }
 
                        /* Brand (Fire) */
-                       if ((f1 & TR1_BRAND_FIRE) || (p_ptr->special_attack & (ATTACK_FIRE)))
+                       if ((have_flag(flgs, TR_BRAND_FIRE)) || (p_ptr->special_attack & (ATTACK_FIRE)))
                        {
                                /* Notice immunity */
                                if (r_ptr->flags3 & RF3_IM_FIRE)
@@ -3440,7 +3445,7 @@ s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        }
 
                        /* Brand (Cold) */
-                       if ((f1 & TR1_BRAND_COLD) || (p_ptr->special_attack & (ATTACK_COLD)))
+                       if ((have_flag(flgs, TR_BRAND_COLD)) || (p_ptr->special_attack & (ATTACK_COLD)))
                        {
                                /* Notice immunity */
                                if (r_ptr->flags3 & RF3_IM_COLD)
@@ -3458,7 +3463,7 @@ s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        }
 
                        /* Brand (Poison) */
-                       if ((f1 & TR1_BRAND_POIS) || (p_ptr->special_attack & (ATTACK_POIS)))
+                       if ((have_flag(flgs, TR_BRAND_POIS)) || (p_ptr->special_attack & (ATTACK_POIS)))
                        {
                                /* Notice immunity */
                                if (r_ptr->flags3 & RF3_IM_POIS)
@@ -3476,7 +3481,7 @@ s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                                }
                        }
 
-                       if ((f1 & TR1_FORCE_WEAPON) && (p_ptr->csp > (p_ptr->msp / 30)))
+                       if ((have_flag(flgs, TR_FORCE_WEAPON)) && (p_ptr->csp > (p_ptr->msp / 30)))
                        {
                                p_ptr->csp -= (1+(p_ptr->msp / 30));
                                p_ptr->redraw |= (PR_MANA);
@@ -3567,9 +3572,9 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
        /* Actually "fire" the object */
        bonus = (p_ptr->to_h_b + o_ptr->to_h + j_ptr->to_h);
        if ((j_ptr->sval == SV_LIGHT_XBOW) || (j_ptr->sval == SV_HEAVY_XBOW))
-               chance = (p_ptr->skill_thb + ((weapon_exp[0][j_ptr->sval])/400 + bonus) * BTH_PLUS_ADJ);
+               chance = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval])/400 + bonus) * BTH_PLUS_ADJ);
        else
-               chance = (p_ptr->skill_thb + ((weapon_exp[0][j_ptr->sval]-4000)/200 + bonus) * BTH_PLUS_ADJ);
+               chance = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval]-4000)/200 + bonus) * BTH_PLUS_ADJ);
 
        energy_use = bow_energy(j_ptr->sval);
        tmul = bow_tmul(j_ptr->sval);
@@ -3721,7 +3726,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
 
                        if ((r_ptr->level + 10) > p_ptr->lev)
                        {
-                               int now_exp = weapon_exp[0][j_ptr->sval];
+                               int now_exp = p_ptr->weapon_exp[0][j_ptr->sval];
                                if (now_exp < s_info[p_ptr->pclass].w_max[0][j_ptr->sval])
                                {
                                        int amount = 0;
@@ -3729,16 +3734,16 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                                        else if (now_exp <  6000) amount = 25;
                                        else if ((now_exp < 7000) && (p_ptr->lev > 19)) amount = 10;
                                        else if (p_ptr->lev > 34) amount = 2;
-                                       weapon_exp[0][j_ptr->sval] += amount;
+                                       p_ptr->weapon_exp[0][j_ptr->sval] += amount;
                                        p_ptr->update |= (PU_BONUS);
                                }
                        }
 
                        if (p_ptr->riding)
                        {
-                               if (skill_exp[GINOU_RIDING] < s_info[p_ptr->pclass].s_max[GINOU_RIDING] && ((skill_exp[GINOU_RIDING] - 1000) / 200 < r_info[m_list[p_ptr->riding].r_idx].level) && one_in_(2))
+                               if (p_ptr->skill_exp[GINOU_RIDING] < s_info[p_ptr->pclass].s_max[GINOU_RIDING] && ((p_ptr->skill_exp[GINOU_RIDING] - 1000) / 200 < r_info[m_list[p_ptr->riding].r_idx].level) && one_in_(2))
                                {
-                                       skill_exp[GINOU_RIDING]+=1;
+                                       p_ptr->skill_exp[GINOU_RIDING]+=1;
                                        p_ptr->update |= (PU_BONUS);
                                }
                        }
@@ -3828,7 +3833,7 @@ note_dies = "
                                tdam = mon_damage_mod(m_ptr, tdam, FALSE);
 
                                /* Complex message */
-                               if (wizard || cheat_xtra)
+                               if (p_ptr->wizard || cheat_xtra)
                                {
 #ifdef JP
                                        msg_format("%d/%d ¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£",
@@ -4051,7 +4056,7 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
 
        int msec = delay_factor * delay_factor * delay_factor;
 
-       u32b f1, f2, f3;
+       u32b flgs[TR_FLAG_SIZE];
        cptr q, s;
        bool come_back = FALSE;
        bool do_drop = TRUE;
@@ -4129,11 +4134,25 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                msg_print("Hmmm, it seems to be cursed.");
 #endif
 
-
                /* Nope */
                return FALSE;
        }
 
+       if (p_ptr->inside_arena)
+       {
+               if (o_ptr->tval != 5)
+               {
+#ifdef JP
+                       msg_print("¥¢¥ê¡¼¥Ê¤Ç¤Ï¥¢¥¤¥Æ¥à¤ò»È¤¨¤Ê¤¤¡ª");
+#else
+                       msg_print("You're in the arena now. This is hand-to-hand!");
+#endif
+                       msg_print(NULL);
+
+                       /* Nope */
+                       return FALSE;
+               }
+       }
 
        /* Get local object */
        q_ptr = &forge;
@@ -4142,7 +4161,7 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
        object_copy(q_ptr, o_ptr);
 
        /* Extract the thrown object's flags. */
-       object_flags(q_ptr, &f1, &f2, &f3);
+       object_flags(q_ptr, flgs);
 
        /* Distribute the charges of rods/wands between the stacks */
        distribute_charges(o_ptr, q_ptr, 1);
@@ -4161,7 +4180,7 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
 
        /* Enforce a minimum "weight" of one pound */
        div = ((q_ptr->weight > 10) ? q_ptr->weight : 10);
-       if ((f2 & (TR2_THROW)) || boomerang) div /= 2;
+       if ((have_flag(flgs, TR_THROW)) || boomerang) div /= 2;
 
        /* Hack -- Distance -- Reward strength, penalize weight */
        tdis = (adj_str_blow[p_ptr->stat_ind[A_STR]] + 20) * mul / div;
@@ -4235,11 +4254,11 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
        /* Hack -- Handle stuff */
        handle_stuff();
 
-       if ((p_ptr->pclass == CLASS_NINJA) && ((q_ptr->tval == TV_SPIKE) || ((f2 & TR2_THROW) && (q_ptr->tval == TV_SWORD)))) shuriken = TRUE;
+       if ((p_ptr->pclass == CLASS_NINJA) && ((q_ptr->tval == TV_SPIKE) || ((have_flag(flgs, TR_THROW)) && (q_ptr->tval == TV_SWORD)))) shuriken = TRUE;
        else shuriken = FALSE;
 
        /* Chance of hitting */
-       if (f2 & (TR2_THROW)) chance = ((p_ptr->skill_tht) +
+       if (have_flag(flgs, TR_THROW)) chance = ((p_ptr->skill_tht) +
                ((p_ptr->to_h_b + q_ptr->to_h) * BTH_PLUS_ADJ));
        else chance = (p_ptr->skill_tht + (p_ptr->to_h_b * BTH_PLUS_ADJ));
 
@@ -4398,7 +4417,7 @@ note_dies = "
                                        tdam *= (mult+p_ptr->num_blow[item - INVEN_RARM]);
                                        tdam += p_ptr->to_d_m;
                                }
-                               else if (f2 & (TR2_THROW))
+                               else if (have_flag(flgs, TR_THROW))
                                {
                                        tdam *= (3+mult);
                                        tdam += p_ptr->to_d_m;
@@ -4419,7 +4438,7 @@ note_dies = "
                                tdam = mon_damage_mod(m_ptr, tdam, FALSE);
 
                                /* Complex message */
-                               if (wizard)
+                               if (p_ptr->wizard)
                                {
 #ifdef JP
                                        msg_format("%d/%d¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£",