/*
* 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]);
}
}
}
*/
void py_pickup_aux(int o_idx)
{
- int slot, i;
+ int slot;
#ifdef JP
/*
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);
}
+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
*/
}
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;
}
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;
}
{
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();
#else
msg_print("No route is found!");
#endif
+ travel.y = travel.x = 0;
}
disturb(0, 1);
return;
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--;