OSDN Git Service

Integrate aura damage into elec_dam, fire_dam and cold_dam
[hengband/hengband.git] / src / cmd1.c
index 8889970..977bfa2 100644 (file)
@@ -251,11 +251,11 @@ static int mult_slaying(int mult, const u32b* flgs, const monster_type* m_ptr)
                const struct slay_table_t* p = &slay_table[i];
 
                if ((have_flag(flgs, p->slay_flag)) &&
-                   (*(u32b*)(((char*)r_ptr) + p->flag_offset) & p->affect_race_flag))
+                   (atoffset(u32b, r_ptr, p->flag_offset) & p->affect_race_flag))
                {
                        if (is_original_ap_and_seen(m_ptr))
                        {
-                               *(u32b*)(((char*)r_ptr) + p->r_flag_offset) |= p->affect_race_flag;
+                               atoffset(u32b, r_ptr, p->r_flag_offset) |= p->affect_race_flag;
                        }
 
                        mult = MAX(mult, p->slay_mult);
@@ -395,102 +395,91 @@ s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, int mode, bo
 /*
  * Search for hidden things
  */
-void search(void)
+static void discover_hidden_things(int y, int x)
 {
-       int y, x, chance;
-
        s16b this_o_idx, next_o_idx = 0;
 
        cave_type *c_ptr;
 
+       /* Access the grid */
+       c_ptr = &cave[y][x];
 
-       /* Start with base search ability */
-       chance = p_ptr->skill_srh;
+       /* Invisible trap */
+       if (c_ptr->mimic && is_trap(c_ptr->feat))
+       {
+               /* Pick a trap */
+               disclose_grid(y, x);
 
-       /* Penalize various conditions */
-       if (p_ptr->blind || no_lite()) chance = chance / 10;
-       if (p_ptr->confused || p_ptr->image) chance = chance / 10;
+               /* Message */
+               msg_print(_("¥È¥é¥Ã¥×¤òȯ¸«¤·¤¿¡£", "You have found a trap."));
 
-       /* Search the nearby grids, which are always in bounds */
-       for (y = (py - 1); y <= (py + 1); y++)
+               /* Disturb */
+               disturb(0, 1);
+       }
+
+       /* Secret door */
+       if (is_hidden_door(c_ptr))
        {
-               for (x = (px - 1); x <= (px + 1); x++)
-               {
-                       /* Sometimes, notice things */
-                       if (randint0(100) < chance)
-                       {
-                               /* Access the grid */
-                               c_ptr = &cave[y][x];
+               /* Message */
+               msg_print(_("±£¤·¥É¥¢¤òȯ¸«¤·¤¿¡£", "You have found a secret door."));
 
-                               /* Invisible trap */
-                               if (c_ptr->mimic && is_trap(c_ptr->feat))
-                               {
-                                       /* Pick a trap */
-                                       disclose_grid(y, x);
+               /* Disclose */
+               disclose_grid(y, x);
 
-                                       /* Message */
-#ifdef JP
-                                       msg_print("¥È¥é¥Ã¥×¤òȯ¸«¤·¤¿¡£");
-#else
-                                       msg_print("You have found a trap.");
-#endif
+               /* Disturb */
+               disturb(0, 0);
+       }
 
-                                       /* Disturb */
-                                       disturb(0, 1);
-                               }
+       /* Scan all objects in the grid */
+       for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
+       {
+               object_type *o_ptr;
 
-                               /* Secret door */
-                               if (is_hidden_door(c_ptr))
-                               {
-                                       /* Message */
-#ifdef JP
-                                       msg_print("±£¤·¥É¥¢¤òȯ¸«¤·¤¿¡£");
-#else
-                                       msg_print("You have found a secret door.");
-#endif
+               /* Acquire object */
+               o_ptr = &o_list[this_o_idx];
 
-                                       /* Disclose */
-                                       disclose_grid(y, x);
+               /* Acquire next object */
+               next_o_idx = o_ptr->next_o_idx;
 
-                                       /* Disturb */
-                                       disturb(0, 0);
-                               }
+               /* Skip non-chests */
+               if (o_ptr->tval != TV_CHEST) continue;
 
-                               /* Scan all objects in the grid */
-                               for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
-                               {
-                                       object_type *o_ptr;
+               /* Skip non-trapped chests */
+               if (!chest_traps[o_ptr->pval]) continue;
 
-                                       /* Acquire object */
-                                       o_ptr = &o_list[this_o_idx];
+               /* Identify once */
+               if (!object_is_known(o_ptr))
+               {
+                       /* Message */
+                       msg_print(_("È¢¤Ë»Å³Ý¤±¤é¤ì¤¿¥È¥é¥Ã¥×¤òȯ¸«¤·¤¿¡ª", "You have discovered a trap on the chest!"));
 
-                                       /* Acquire next object */
-                                       next_o_idx = o_ptr->next_o_idx;
+                       /* Know the trap */
+                       object_known(o_ptr);
 
-                                       /* Skip non-chests */
-                                       if (o_ptr->tval != TV_CHEST) continue;
+                       /* Notice it */
+                       disturb(0, 0);
+               }
+       }
+}
 
-                                       /* Skip non-trapped chests */
-                                       if (!chest_traps[o_ptr->pval]) continue;
+void search(void)
+{
+       int i, chance;
 
-                                       /* Identify once */
-                                       if (!object_is_known(o_ptr))
-                                       {
-                                               /* Message */
-#ifdef JP
-                                               msg_print("È¢¤Ë»Å³Ý¤±¤é¤ì¤¿¥È¥é¥Ã¥×¤òȯ¸«¤·¤¿¡ª");
-#else
-                                               msg_print("You have discovered a trap on the chest!");
-#endif
+       /* Start with base search ability */
+       chance = p_ptr->skill_srh;
 
-                                               /* Know the trap */
-                                               object_known(o_ptr);
+       /* Penalize various conditions */
+       if (p_ptr->blind || no_lite()) chance = chance / 10;
+       if (p_ptr->confused || p_ptr->image) chance = chance / 10;
 
-                                               /* Notice it */
-                                               disturb(0, 0);
-                                       }
-                               }
-                       }
+       /* Search the nearby grids, which are always in bounds */
+       for (i = 0; i < 9; ++ i)
+       {
+               /* Sometimes, notice things */
+               if (randint0(100) < chance)
+               {
+                       discover_hidden_things(py + ddy_ddd[i], px + ddx_ddd[i]);
                }
        }
 }
@@ -505,7 +494,7 @@ void search(void)
  */
 void py_pickup_aux(int o_idx)
 {
-       int slot, i;
+       int slot;
 
 #ifdef JP
 /*
@@ -588,25 +577,7 @@ void py_pickup_aux(int o_idx)
        record_turn = turn;
 
 
-       /* Check if completed a quest */
-       for (i = 0; i < max_quests; i++)
-       {
-               if ((quest[i].type == QUEST_TYPE_FIND_ARTIFACT) &&
-                   (quest[i].status == QUEST_STATUS_TAKEN) &&
-                          (quest[i].k_idx == o_ptr->name1))
-               {
-                       if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, i, NULL);
-                       quest[i].status = QUEST_STATUS_COMPLETED;
-                       quest[i].complev = (byte)p_ptr->lev;
-#ifdef JP
-                       msg_print("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª");
-#else
-                       msg_print("You completed your quest!");
-#endif
-
-                       msg_print(NULL);
-               }
-       }
+       check_find_art_quest_completion(o_ptr);
 }
 
 
@@ -804,6 +775,112 @@ static int check_hit(int power)
 
 
 
+static void hit_trap_pit(int trap_feat_type)
+{
+       int dam;
+       cptr trap_name = "";
+       cptr spike_name = "";
+
+       switch (trap_feat_type)
+       {
+       case TRAP_PIT:
+               trap_name = _("Íî¤È¤··ê", "a pit trap");
+               break;
+       case TRAP_SPIKED_PIT:
+               trap_name = _("¥¹¥Ñ¥¤¥¯¤¬Éߤ«¤ì¤¿Íî¤È¤··ê", "a spiked pit");
+               spike_name = _("¥¹¥Ñ¥¤¥¯", "spikes");
+               break;
+       case TRAP_POISON_PIT:
+               trap_name = _("¥¹¥Ñ¥¤¥¯¤¬Éߤ«¤ì¤¿Íî¤È¤··ê", "a spiked pit");
+               spike_name = _("ÆǤòÅɤé¤ì¤¿¥¹¥Ñ¥¤¥¯", "poisonous spikes");
+               break;
+       default:
+               return;
+       }
+
+       if (p_ptr->levitation)
+       {
+               msg_format(_("%s¤òÈô¤Ó±Û¤¨¤¿¡£", "You fly over %s."), trap_name);
+               return;
+       }
+
+       msg_format(_("%s¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª", "You have fallen into %s!"), trap_name);
+
+       /* Base damage */
+       dam = damroll(2, 6);
+
+       /* Extra spike damage */
+       if ((trap_feat_type == TRAP_SPIKED_PIT || trap_feat_type == TRAP_POISON_PIT) &&
+           one_in_(2))
+       {
+               msg_format(_("%s¤¬»É¤µ¤Ã¤¿¡ª", "You are impaled on %s!"), spike_name);
+
+               dam = dam * 2;
+               (void)set_cut(p_ptr->cut + randint1(dam));
+
+               if (trap_feat_type == TRAP_POISON_PIT) {
+                       if (p_ptr->resist_pois || IS_OPPOSE_POIS())
+                       {
+                               msg_print(_("¤·¤«¤·ÆǤαƶÁ¤Ï¤Ê¤«¤Ã¤¿¡ª", "The poison does not affect you!"));
+                       }
+                       else
+                       {
+                               dam = dam * 2;
+                               (void)set_poisoned(p_ptr->poisoned + randint1(dam));
+                       }
+               }
+       }
+
+       /* Take the damage */
+       take_hit(DAMAGE_NOESCAPE, dam, trap_name, -1);
+}
+
+static bool hit_trap_dart(void)
+{
+       bool hit = FALSE;
+
+       if (check_hit(125))
+       {
+               msg_print(_("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤­¤Æ»É¤µ¤Ã¤¿¡ª", "A small dart hits you!"));
+
+               take_hit(DAMAGE_ATTACK, damroll(1, 4), _("¥À¡¼¥Ä¤Îæ«", "a dart trap"), -1);
+
+               if (!CHECK_MULTISHADOW()) hit = TRUE;
+       }
+       else
+       {
+               msg_print(_("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤­¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£", "A small dart barely misses you."));
+       }
+
+       return hit;
+}
+
+static void hit_trap_lose_stat(int stat)
+{
+       if (hit_trap_dart())
+       {
+               do_dec_stat(stat);
+       }
+}
+
+static void hit_trap_slow(void)
+{
+       if (hit_trap_dart())
+       {
+               set_slow(p_ptr->slow + randint0(20) + 20, FALSE);
+       }
+}
+
+static void hit_trap_set_abnormal_status(cptr trap_message, bool resist, bool (*set_status)(int turn), int turn)
+{
+       msg_print(trap_message);
+
+       if (!resist)
+       {
+               set_status(turn);
+       }
+}
+
 /*
  * Handle player hitting a real trap
  */
@@ -880,162 +957,10 @@ static void hit_trap(bool break_trap)
                }
 
                case TRAP_PIT:
-               {
-                       if (p_ptr->levitation)
-                       {
-#ifdef JP
-                               msg_print("Íî¤È¤··ê¤òÈô¤Ó±Û¤¨¤¿¡£");
-#else
-                               msg_print("You fly over a pit trap.");
-#endif
-
-                       }
-                       else
-                       {
-#ifdef JP
-                               msg_print("Íî¤È¤··ê¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª");
-#else
-                               msg_print("You have fallen into a pit!");
-#endif
-
-                               dam = damroll(2, 6);
-#ifdef JP
-                               name = "Íî¤È¤··ê";
-#else
-                               name = "a pit trap";
-#endif
-
-                               take_hit(DAMAGE_NOESCAPE, dam, name, -1);
-                       }
-                       break;
-               }
-
                case TRAP_SPIKED_PIT:
-               {
-                       if (p_ptr->levitation)
-                       {
-#ifdef JP
-                               msg_print("¥È¥²¤Î¤¢¤ëÍî¤È¤··ê¤òÈô¤Ó±Û¤¨¤¿¡£");
-#else
-                               msg_print("You fly over a spiked pit.");
-#endif
-
-                       }
-                       else
-                       {
-#ifdef JP
-                               msg_print("¥¹¥Ñ¥¤¥¯¤¬Éߤ«¤ì¤¿Íî¤È¤··ê¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª");
-#else
-                               msg_print("You fall into a spiked pit!");
-#endif
-
-
-                               /* Base damage */
-#ifdef JP
-                               name = "Íî¤È¤··ê";
-#else
-                               name = "a pit trap";
-#endif
-
-                               dam = damroll(2, 6);
-
-                               /* Extra spike damage */
-                               if (randint0(100) < 50)
-                               {
-#ifdef JP
-                                       msg_print("¥¹¥Ñ¥¤¥¯¤¬»É¤µ¤Ã¤¿¡ª");
-#else
-                                       msg_print("You are impaled!");
-#endif
-
-
-#ifdef JP
-                                       name = "¥È¥²¤Î¤¢¤ëÍî¤È¤··ê";
-#else
-                                       name = "a spiked pit";
-#endif
-
-                                       dam = dam * 2;
-                                       (void)set_cut(p_ptr->cut + randint1(dam));
-                               }
-
-                               /* Take the damage */
-                               take_hit(DAMAGE_NOESCAPE, dam, name, -1);
-                       }
-                       break;
-               }
-
                case TRAP_POISON_PIT:
                {
-                       if (p_ptr->levitation)
-                       {
-#ifdef JP
-                               msg_print("¥È¥²¤Î¤¢¤ëÍî¤È¤··ê¤òÈô¤Ó±Û¤¨¤¿¡£");
-#else
-                               msg_print("You fly over a spiked pit.");
-#endif
-
-                       }
-                       else
-                       {
-#ifdef JP
-                       msg_print("¥¹¥Ñ¥¤¥¯¤¬Éߤ«¤ì¤¿Íî¤È¤··ê¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª");
-#else
-                               msg_print("You fall into a spiked pit!");
-#endif
-
-
-                               /* Base damage */
-                               dam = damroll(2, 6);
-
-#ifdef JP
-                               name = "Íî¤È¤··ê";
-#else
-                               name = "a pit trap";
-#endif
-
-
-                               /* Extra spike damage */
-                               if (randint0(100) < 50)
-                               {
-#ifdef JP
-                                       msg_print("ÆǤòÅɤé¤ì¤¿¥¹¥Ñ¥¤¥¯¤¬»É¤µ¤Ã¤¿¡ª");
-#else
-                                       msg_print("You are impaled on poisonous spikes!");
-#endif
-
-
-#ifdef JP
-                                       name = "¥È¥²¤Î¤¢¤ëÍî¤È¤··ê";
-#else
-                                       name = "a spiked pit";
-#endif
-
-
-                                       dam = dam * 2;
-                                       (void)set_cut(p_ptr->cut + randint1(dam));
-
-                                       if (p_ptr->resist_pois || IS_OPPOSE_POIS())
-                                       {
-#ifdef JP
-                                               msg_print("¤·¤«¤·ÆǤαƶÁ¤Ï¤Ê¤«¤Ã¤¿¡ª");
-#else
-                                               msg_print("The poison does not affect you!");
-#endif
-
-                                       }
-
-                                       else
-                                       {
-                                               dam = dam * 2;
-                                               (void)set_poisoned(p_ptr->poisoned + randint1(dam));
-                                       }
-                               }
-
-                               /* Take the damage */
-                               take_hit(DAMAGE_NOESCAPE, dam, name, -1);
-                       }
-
+                       hit_trap_pit(trap_feat_type);
                        break;
                }
 
@@ -1089,9 +1014,9 @@ static void hit_trap(bool break_trap)
 
                        dam = damroll(4, 6);
 #ifdef JP
-                       (void)fire_dam(dam, "±ê¤Î¥È¥é¥Ã¥×", -1);
+                       (void)fire_dam(dam, "±ê¤Î¥È¥é¥Ã¥×", -1, FALSE);
 #else
-                       (void)fire_dam(dam, "a fire trap", -1);
+                       (void)fire_dam(dam, "a fire trap", -1, FALSE);
 #endif
 
                        break;
@@ -1107,9 +1032,9 @@ static void hit_trap(bool break_trap)
 
                        dam = damroll(4, 6);
 #ifdef JP
-                       (void)acid_dam(dam, "»À¤Î¥È¥é¥Ã¥×", -1);
+                       (void)acid_dam(dam, "»À¤Î¥È¥é¥Ã¥×", -1, FALSE);
 #else
-                       (void)acid_dam(dam, "an acid trap", -1);
+                       (void)acid_dam(dam, "an acid trap", -1, FALSE);
 #endif
 
                        break;
@@ -1117,170 +1042,52 @@ static void hit_trap(bool break_trap)
 
                case TRAP_SLOW:
                {
-                       if (check_hit(125))
-                       {
-#ifdef JP
-                               msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤­¤Æ»É¤µ¤Ã¤¿¡ª");
-#else
-                               msg_print("A small dart hits you!");
-#endif
-
-                               dam = damroll(1, 4);
-#ifdef JP
-                               take_hit(DAMAGE_ATTACK, dam, "¥À¡¼¥Ä¤Îæ«", -1);
-#else
-                               take_hit(DAMAGE_ATTACK, dam, "a dart trap", -1);
-#endif
-
-                               if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(20) + 20, FALSE);
-                       }
-                       else
-                       {
-#ifdef JP
-                               msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤­¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£");
-#else
-                               msg_print("A small dart barely misses you.");
-#endif
-
-                       }
+                       hit_trap_slow();
                        break;
                }
 
                case TRAP_LOSE_STR:
                {
-                       if (check_hit(125))
-                       {
-#ifdef JP
-                               msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤­¤Æ»É¤µ¤Ã¤¿¡ª");
-#else
-                               msg_print("A small dart hits you!");
-#endif
-
-                               dam = damroll(1, 4);
-#ifdef JP
-                               take_hit(DAMAGE_ATTACK, dam, "¥À¡¼¥Ä¤Îæ«", -1);
-#else
-                               take_hit(DAMAGE_ATTACK, dam, "a dart trap", -1);
-#endif
-
-                               if (!CHECK_MULTISHADOW()) (void)do_dec_stat(A_STR);
-                       }
-                       else
-                       {
-#ifdef JP
-                               msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤­¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£");
-#else
-                               msg_print("A small dart barely misses you.");
-#endif
-
-                       }
+                       hit_trap_lose_stat(A_STR);
                        break;
                }
 
                case TRAP_LOSE_DEX:
                {
-                       if (check_hit(125))
-                       {
-#ifdef JP
-                               msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤­¤Æ»É¤µ¤Ã¤¿¡ª");
-#else
-                               msg_print("A small dart hits you!");
-#endif
-
-                               dam = damroll(1, 4);
-#ifdef JP
-                               take_hit(DAMAGE_ATTACK, dam, "¥À¡¼¥Ä¤Îæ«", -1);
-#else
-                               take_hit(DAMAGE_ATTACK, dam, "a dart trap", -1);
-#endif
-
-                               if (!CHECK_MULTISHADOW()) (void)do_dec_stat(A_DEX);
-                       }
-                       else
-                       {
-#ifdef JP
-                               msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤­¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£");
-#else
-                               msg_print("A small dart barely misses you.");
-#endif
-
-                       }
+                       hit_trap_lose_stat(A_DEX);
                        break;
                }
 
                case TRAP_LOSE_CON:
                {
-                       if (check_hit(125))
-                       {
-#ifdef JP
-                               msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤­¤Æ»É¤µ¤Ã¤¿¡ª");
-#else
-                               msg_print("A small dart hits you!");
-#endif
-
-                               dam = damroll(1, 4);
-#ifdef JP
-                               take_hit(DAMAGE_ATTACK, dam, "¥À¡¼¥Ä¤Îæ«", -1);
-#else
-                               take_hit(DAMAGE_ATTACK, dam, "a dart trap", -1);
-#endif
-
-                               if (!CHECK_MULTISHADOW()) (void)do_dec_stat(A_CON);
-                       }
-                       else
-                       {
-#ifdef JP
-                               msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤­¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£");
-#else
-                               msg_print("A small dart barely misses you.");
-#endif
-
-                       }
+                       hit_trap_lose_stat(A_CON);
                        break;
                }
 
                case TRAP_BLIND:
                {
-#ifdef JP
-                       msg_print("¹õ¤¤¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª");
-#else
-                       msg_print("A black gas surrounds you!");
-#endif
-
-                       if (!p_ptr->resist_blind)
-                       {
-                               (void)set_blind(p_ptr->blind + randint0(50) + 25);
-                       }
+                       hit_trap_set_abnormal_status(
+                               _("¹õ¤¤¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª", "A black gas surrounds you!"),
+                               p_ptr->resist_blind,
+                               set_blind, p_ptr->blind + randint0(50) + 25);
                        break;
                }
 
                case TRAP_CONFUSE:
                {
-#ifdef JP
-                       msg_print("¤­¤é¤á¤¯¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª");
-#else
-                       msg_print("A gas of scintillating colors surrounds you!");
-#endif
-
-                       if (!p_ptr->resist_conf)
-                       {
-                               (void)set_confused(p_ptr->confused + randint0(20) + 10);
-                       }
+                       hit_trap_set_abnormal_status(
+                               _("¤­¤é¤á¤¯¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª", "A gas of scintillating colors surrounds you!"),
+                               p_ptr->resist_conf,
+                               set_confused, p_ptr->confused + randint0(20) + 10);
                        break;
                }
 
                case TRAP_POISON:
                {
-#ifdef JP
-                       msg_print("»É·ãŪ¤ÊÎп§¤Î¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª");
-#else
-                       msg_print("A pungent green gas surrounds you!");
-#endif
-
-                       if (!p_ptr->resist_pois && !IS_OPPOSE_POIS())
-                       {
-                               (void)set_poisoned(p_ptr->poisoned + randint0(20) + 10);
-                       }
+                       hit_trap_set_abnormal_status(
+                               _("»É·ãŪ¤ÊÎп§¤Î¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª", "A pungent green gas surrounds you!"),
+                               p_ptr->resist_pois || IS_OPPOSE_POIS(),
+                               set_poisoned, p_ptr->poisoned + randint0(20) + 10);
                        break;
                }
 
@@ -1449,92 +1256,42 @@ msg_print("
 }
 
 
-static void touch_zap_player(monster_type *m_ptr)
+static void touch_zap_player_aux(monster_type *m_ptr, bool immune, int flags_offset, int r_flags_offset, u32b aura_flag,
+                                int (*dam_func)(int dam, cptr kb_str, int monspell, bool aura), cptr message)
 {
-       int aura_damage = 0;
        monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
-       if (r_ptr->flags2 & RF2_AURA_FIRE)
+       if ((atoffset(u32b, r_ptr, flags_offset) & aura_flag) && !immune)
        {
-               if (!p_ptr->immune_fire)
-               {
-                       char aura_dam[80];
-
-                       aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
+               char mon_name[80];
+               int aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
 
-                       /* Hack -- Get the "died from" name */
-                       monster_desc(aura_dam, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
+               /* Hack -- Get the "died from" name */
+               monster_desc(mon_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
 
-#ifdef JP
-                       msg_print("ÆÍÁ³¤È¤Æ¤âÇ®¤¯¤Ê¤Ã¤¿¡ª");
-#else
-                       msg_print("You are suddenly very hot!");
-#endif
+               msg_print(message);
 
-                       if (prace_is_(RACE_ENT)) aura_damage += aura_damage / 3;
-                       if (IS_OPPOSE_FIRE()) aura_damage = (aura_damage + 2) / 3;
-                       if (p_ptr->resist_fire) aura_damage = (aura_damage + 2) / 3;
+               dam_func(aura_damage, mon_name, -1, TRUE);
 
-                       take_hit(DAMAGE_NOESCAPE, aura_damage, aura_dam, -1);
-                       if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= RF2_AURA_FIRE;
-                       handle_stuff();
-               }
-       }
-
-       if (r_ptr->flags3 & RF3_AURA_COLD)
-       {
-               if (!p_ptr->immune_cold)
+               if (is_original_ap_and_seen(m_ptr))
                {
-                       char aura_dam[80];
-
-                       aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
-
-                       /* Hack -- Get the "died from" name */
-                       monster_desc(aura_dam, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
-
-#ifdef JP
-                       msg_print("ÆÍÁ³¤È¤Æ¤â´¨¤¯¤Ê¤Ã¤¿¡ª");
-#else
-                       msg_print("You are suddenly very cold!");
-#endif
-
-                       if (IS_OPPOSE_COLD()) aura_damage = (aura_damage + 2) / 3;
-                       if (p_ptr->resist_cold) aura_damage = (aura_damage + 2) / 3;
-
-                       take_hit(DAMAGE_NOESCAPE, aura_damage, aura_dam, -1);
-                       if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_AURA_COLD;
-                       handle_stuff();
+                       atoffset(u32b, r_ptr, r_flags_offset) |= aura_flag;
                }
-       }
-
-       if (r_ptr->flags2 & RF2_AURA_ELEC)
-       {
-               if (!p_ptr->immune_elec)
-               {
-                       char aura_dam[80];
-
-                       aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
-
-                       /* Hack -- Get the "died from" name */
-                       monster_desc(aura_dam, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
-
-                       if (prace_is_(RACE_ANDROID)) aura_damage += aura_damage / 3;
-                       if (IS_OPPOSE_ELEC()) aura_damage = (aura_damage + 2) / 3;
-                       if (p_ptr->resist_elec) aura_damage = (aura_damage + 2) / 3;
-
-#ifdef JP
-                       msg_print("ÅÅ·â¤ò¤¯¤é¤Ã¤¿¡ª");
-#else
-                       msg_print("You get zapped!");
-#endif
 
-                       take_hit(DAMAGE_NOESCAPE, aura_damage, aura_dam, -1);
-                       if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= RF2_AURA_ELEC;
-                       handle_stuff();
-               }
+               handle_stuff();
        }
 }
 
+static void touch_zap_player(monster_type *m_ptr)
+{
+       touch_zap_player_aux(m_ptr, p_ptr->immune_fire, offsetof(monster_race, flags2), offsetof(monster_race, r_flags2), RF2_AURA_FIRE,
+                            fire_dam, _("ÆÍÁ³¤È¤Æ¤âÇ®¤¯¤Ê¤Ã¤¿¡ª", "You are suddenly very hot!"));
+       touch_zap_player_aux(m_ptr, p_ptr->immune_cold, offsetof(monster_race, flags3), offsetof(monster_race, r_flags3), RF3_AURA_COLD,
+                            cold_dam, _("ÆÍÁ³¤È¤Æ¤â´¨¤¯¤Ê¤Ã¤¿¡ª", "You are suddenly very cold!"));
+       touch_zap_player_aux(m_ptr, p_ptr->immune_elec, offsetof(monster_race, flags2), offsetof(monster_race, r_flags2), RF2_AURA_ELEC,
+                            elec_dam, _("ÅÅ·â¤ò¤¯¤é¤Ã¤¿¡ª", "You get zapped!"));
+}
+
 
 static void natural_attack(s16b m_idx, int attack, bool *fear, bool *mdeath)
 {
@@ -3368,16 +3125,7 @@ bool move_player_effect(int ny, int nx, u32b mpe_mode)
        {
                if (quest[p_ptr->inside_quest].type == QUEST_TYPE_FIND_EXIT)
                {
-                       if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, p_ptr->inside_quest, NULL);
-                       quest[p_ptr->inside_quest].status = QUEST_STATUS_COMPLETED;
-                       quest[p_ptr->inside_quest].complev = (byte)p_ptr->lev;
-#ifdef JP
-                       msg_print("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª");
-#else
-                       msg_print("You accomplished your quest!");
-#endif
-
-                       msg_print(NULL);
+                       complete_quest(p_ptr->inside_quest);
                }
 
                leave_quest_check();
@@ -4855,6 +4603,7 @@ void travel_step(void)
 #else
                        msg_print("No route is found!");
 #endif
+                       travel.y = travel.x = 0;
                }
                disturb(0, 1);
                return;
@@ -4865,7 +4614,10 @@ void travel_step(void)
        move_player(travel.dir, always_pickup, FALSE);
 
        if ((py == travel.y) && (px == travel.x))
+       {
                travel.run = 0;
+               travel.y = travel.x = 0;
+       }
        else if (travel.run > 0)
                travel.run--;