/* File: cmd1.c */
-/* Purpose: Movement commands (part 1) */
-
/*
- * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke
+ * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
*
- * This software may be copied and distributed for educational, research, and
- * not for profit purposes provided that this copyright and statement are
- * included in all such copies.
+ * This software may be copied and distributed for educational, research,
+ * and not for profit purposes provided that this copyright and statement
+ * are included in all such copies. Other copyrights may also apply.
*/
+/* Purpose: Movement commands (part 1) */
+
#include "angband.h"
#define MAX_VAMPIRIC_DRAIN 50
int k;
/* Percentile dice */
- k = rand_int(100);
+ k = randint0(100);
/* Hack -- Instant miss or hit */
if (k < 10) return (k < 5);
if (!vis) chance = (chance + 1) / 2;
/* Power competes against armor */
- if (rand_int(chance) < (ac * 3 / 4)) return (FALSE);
+ if (randint0(chance) < (ac * 3 / 4)) return (FALSE);
/* Assume hit */
return (TRUE);
int k;
/* Percentile dice */
- k = rand_int(100);
+ k = randint0(100);
/* Hack -- Instant miss or hit */
if (k < 10) return (k < 5);
+ if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
+ if (one_in_(20)) return (FALSE);
+
/* Wimpy attack never hits */
if (chance <= 0) return (FALSE);
if (!vis) chance = (chance + 1) / 2;
/* Power must defeat armor */
- if (rand_int(chance) < (ac * 3 / 4)) return (FALSE);
+ if (randint0(chance) < (ac * 3 / 4)) return (FALSE);
/* Assume hit */
return (TRUE);
i = (weight + ((p_ptr->to_h_b + plus) * 4) + (p_ptr->lev * 2));
/* Critical hit */
- if (randint(5000) <= i)
+ if (randint1(5000) <= i)
{
- k = weight + randint(500);
+ k = weight + randint1(500);
if (k < 500)
{
i = (weight + (meichuu * 3 + plus * 5) + (p_ptr->lev * 3));
/* Chance */
- if ((randint((p_ptr->pclass == CLASS_NINJA) ? 4444 : 5000) <= i) || (mode == HISSATSU_MAJIN) || (mode == HISSATSU_3DAN))
+ if ((randint1((p_ptr->pclass == CLASS_NINJA) ? 4444 : 5000) <= i) || (mode == HISSATSU_MAJIN) || (mode == HISSATSU_3DAN))
{
- k = weight + randint(650);
- if ((mode == HISSATSU_MAJIN) || (mode == HISSATSU_3DAN)) k+= randint(650);
+ k = weight + randint1(650);
+ if ((mode == HISSATSU_MAJIN) || (mode == HISSATSU_3DAN)) k+= randint1(650);
if (k < 400)
{
* Note that most brands and slays are x3, except Slay Animal (x2),
* Slay Evil (x2), and Kill dragon (x5).
*/
-s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, int mode)
+s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, int mode, bool thrown)
{
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)
case TV_DIGGING:
{
/* Slay Animal */
- if ((f1 & TR1_SLAY_ANIMAL) &&
+ if ((have_flag(flgs, TR_SLAY_ANIMAL)) &&
(r_ptr->flags3 & RF3_ANIMAL))
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags3 |= RF3_ANIMAL;
}
- if (mult < 20) mult = 20;
+ if (mult < 25) mult = 25;
+ }
+
+ /* Execute Animal */
+ if ((have_flag(flgs, TR_KILL_ANIMAL)) &&
+ (r_ptr->flags3 & RF3_ANIMAL))
+ {
+ if (m_ptr->ml && is_original_ap(m_ptr))
+ {
+ r_ptr->r_flags3 |= RF3_ANIMAL;
+ }
+
+ if (mult < 40) mult = 40;
}
/* Slay Evil */
- if ((f1 & TR1_SLAY_EVIL) &&
+ if ((have_flag(flgs, TR_SLAY_EVIL)) &&
(r_ptr->flags3 & RF3_EVIL))
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags3 |= RF3_EVIL;
}
if (mult < 20) mult = 20;
}
+ /* Execute Evil */
+ if ((have_flag(flgs, TR_KILL_EVIL)) &&
+ (r_ptr->flags3 & RF3_EVIL))
+ {
+ if (m_ptr->ml && is_original_ap(m_ptr))
+ {
+ r_ptr->r_flags3 |= RF3_EVIL;
+ }
+
+ if (mult < 35) mult = 35;
+ }
+
+ /* Slay Human */
+ if ((have_flag(flgs, TR_SLAY_HUMAN)) &&
+ (r_ptr->flags2 & RF2_HUMAN))
+ {
+ if (m_ptr->ml && is_original_ap(m_ptr))
+ {
+ r_ptr->r_flags2 |= RF2_HUMAN;
+ }
+
+ if (mult < 25) mult = 25;
+ }
+
+ /* Execute Human */
+ if ((have_flag(flgs, TR_KILL_HUMAN)) &&
+ (r_ptr->flags2 & RF2_HUMAN))
+ {
+ if (m_ptr->ml && is_original_ap(m_ptr))
+ {
+ r_ptr->r_flags2 |= RF2_HUMAN;
+ }
+
+ if (mult < 40) mult = 40;
+ }
+
/* Slay Undead */
- if ((f1 & TR1_SLAY_UNDEAD) &&
+ if ((have_flag(flgs, TR_SLAY_UNDEAD)) &&
(r_ptr->flags3 & RF3_UNDEAD))
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags3 |= RF3_UNDEAD;
}
if (mult < 30) mult = 30;
}
+ /* Execute Undead */
+ if ((have_flag(flgs, TR_KILL_UNDEAD)) &&
+ (r_ptr->flags3 & RF3_UNDEAD))
+ {
+ if (m_ptr->ml && is_original_ap(m_ptr))
+ {
+ r_ptr->r_flags3 |= RF3_UNDEAD;
+ }
+
+ if (mult < 50) mult = 50;
+ }
+
/* Slay Demon */
- if ((f1 & TR1_SLAY_DEMON) &&
+ if ((have_flag(flgs, TR_SLAY_DEMON)) &&
(r_ptr->flags3 & RF3_DEMON))
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags3 |= RF3_DEMON;
}
if (mult < 30) mult = 30;
}
+ /* Execute Demon */
+ if ((have_flag(flgs, TR_KILL_DEMON)) &&
+ (r_ptr->flags3 & RF3_DEMON))
+ {
+ if (m_ptr->ml && is_original_ap(m_ptr))
+ {
+ r_ptr->r_flags3 |= RF3_DEMON;
+ }
+
+ if (mult < 50) mult = 50;
+ }
+
/* Slay Orc */
- if ((f1 & TR1_SLAY_ORC) &&
+ if ((have_flag(flgs, TR_SLAY_ORC)) &&
(r_ptr->flags3 & RF3_ORC))
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags3 |= RF3_ORC;
}
if (mult < 30) mult = 30;
}
+ /* Execute Orc */
+ if ((have_flag(flgs, TR_KILL_ORC)) &&
+ (r_ptr->flags3 & RF3_ORC))
+ {
+ if (m_ptr->ml && is_original_ap(m_ptr))
+ {
+ r_ptr->r_flags3 |= RF3_ORC;
+ }
+
+ if (mult < 50) mult = 50;
+ }
+
/* Slay Troll */
- if ((f1 & TR1_SLAY_TROLL) &&
+ if ((have_flag(flgs, TR_SLAY_TROLL)) &&
(r_ptr->flags3 & RF3_TROLL))
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags3 |= RF3_TROLL;
}
if (mult < 30) mult = 30;
}
+ /* Execute Troll */
+ if ((have_flag(flgs, TR_KILL_TROLL)) &&
+ (r_ptr->flags3 & RF3_TROLL))
+ {
+ if (m_ptr->ml && is_original_ap(m_ptr))
+ {
+ r_ptr->r_flags3 |= RF3_TROLL;
+ }
+
+ if (mult < 50) mult = 50;
+ }
+
/* Slay Giant */
- if ((f1 & TR1_SLAY_GIANT) &&
+ if ((have_flag(flgs, TR_SLAY_GIANT)) &&
(r_ptr->flags3 & RF3_GIANT))
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags3 |= RF3_GIANT;
}
mult *= 3;
}
+ /* Execute Giant */
+ if ((have_flag(flgs, TR_KILL_GIANT)) &&
+ (r_ptr->flags3 & RF3_GIANT))
+ {
+ if (m_ptr->ml && is_original_ap(m_ptr))
+ {
+ r_ptr->r_flags3 |= RF3_GIANT;
+ }
+
+ if (mult < 50) mult = 50;
+ }
+
/* Slay Dragon */
- if ((f1 & TR1_SLAY_DRAGON) &&
+ if ((have_flag(flgs, TR_SLAY_DRAGON)) &&
(r_ptr->flags3 & RF3_DRAGON))
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags3 |= RF3_DRAGON;
}
}
/* Execute Dragon */
- if ((f1 & TR1_KILL_DRAGON) &&
+ if ((have_flag(flgs, TR_KILL_DRAGON)) &&
(r_ptr->flags3 & RF3_DRAGON))
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags3 |= RF3_DRAGON;
}
if (mult < 50) mult = 50;
- if ((o_ptr->name1 == ART_AEGLIN) && (m_ptr->r_idx == MON_FAFNER))
+ if ((o_ptr->name1 == ART_NOTHUNG) && (m_ptr->r_idx == MON_FAFNER))
mult *= 3;
}
/* 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)) && !thrown))
{
/* Notice immunity */
- if (r_ptr->flags3 & RF3_IM_ACID)
+ if (r_ptr->flagsr & RFR_EFF_IM_ACID_MASK)
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
- r_ptr->r_flags3 |= RF3_IM_ACID;
+ r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ACID_MASK);
}
}
}
/* Brand (Elec) */
- if ((f1 & TR1_BRAND_ELEC) || (p_ptr->special_attack & (ATTACK_ELEC)) || (mode == HISSATSU_ELEC))
+ if (have_flag(flgs, TR_BRAND_ELEC) || ((p_ptr->special_attack & (ATTACK_ELEC)) && !thrown) || (mode == HISSATSU_ELEC))
{
/* Notice immunity */
- if (r_ptr->flags3 & RF3_IM_ELEC)
+ if (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK)
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
- r_ptr->r_flags3 |= RF3_IM_ELEC;
+ r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK);
}
}
/* Otherwise, take the damage */
- else if (((f1 & TR1_BRAND_ELEC) || (p_ptr->special_attack & (ATTACK_ELEC))) && (mode == HISSATSU_ELEC))
+ else if ((have_flag(flgs, TR_BRAND_ELEC) || ((p_ptr->special_attack & (ATTACK_ELEC)) && !thrown)) && (mode == HISSATSU_ELEC))
{
if (mult < 70) mult = 70;
}
}
/* Brand (Fire) */
- if ((f1 & TR1_BRAND_FIRE) || (p_ptr->special_attack & (ATTACK_FIRE)) || (mode == HISSATSU_FIRE))
+ if (have_flag(flgs, TR_BRAND_FIRE) || ((p_ptr->special_attack & (ATTACK_FIRE)) && !thrown) || (mode == HISSATSU_FIRE))
{
/* Notice immunity */
- if (r_ptr->flags3 & RF3_IM_FIRE)
+ if (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK)
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
- r_ptr->r_flags3 |= RF3_IM_FIRE;
+ r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK);
}
}
/* Otherwise, take the damage */
- else if (((f1 & TR1_BRAND_FIRE) || (p_ptr->special_attack & (ATTACK_FIRE))) && (mode == HISSATSU_FIRE))
+ else if ((have_flag(flgs, TR_BRAND_FIRE) || ((p_ptr->special_attack & (ATTACK_FIRE)) && !thrown)) && (mode == HISSATSU_FIRE))
{
if (r_ptr->flags3 & RF3_HURT_FIRE)
{
if (mult < 70) mult = 70;
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags3 |= RF3_HURT_FIRE;
}
if (r_ptr->flags3 & RF3_HURT_FIRE)
{
if (mult < 50) mult = 50;
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags3 |= RF3_HURT_FIRE;
}
}
/* Brand (Cold) */
- if ((f1 & TR1_BRAND_COLD) || (p_ptr->special_attack & (ATTACK_COLD)) || (mode == HISSATSU_COLD))
+ if (have_flag(flgs, TR_BRAND_COLD) || ((p_ptr->special_attack & (ATTACK_COLD)) && !thrown) || (mode == HISSATSU_COLD))
{
/* Notice immunity */
- if (r_ptr->flags3 & RF3_IM_COLD)
+ if (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK)
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
- r_ptr->r_flags3 |= RF3_IM_COLD;
+ r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK);
}
}
/* Otherwise, take the damage */
- else if (((f1 & TR1_BRAND_COLD) || (p_ptr->special_attack & (ATTACK_COLD))) && (mode == HISSATSU_COLD))
+ else if ((have_flag(flgs, TR_BRAND_COLD) || ((p_ptr->special_attack & (ATTACK_COLD)) && !thrown)) && (mode == HISSATSU_COLD))
{
if (r_ptr->flags3 & RF3_HURT_COLD)
{
if (mult < 70) mult = 70;
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags3 |= RF3_HURT_COLD;
}
if (r_ptr->flags3 & RF3_HURT_COLD)
{
if (mult < 50) mult = 50;
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags3 |= RF3_HURT_COLD;
}
}
/* Brand (Poison) */
- if ((f1 & TR1_BRAND_POIS) || (p_ptr->special_attack & (ATTACK_POIS)) || (mode == HISSATSU_POISON))
+ if (have_flag(flgs, TR_BRAND_POIS) || ((p_ptr->special_attack & (ATTACK_POIS)) && !thrown) || (mode == HISSATSU_POISON))
{
/* Notice immunity */
- if (r_ptr->flags3 & RF3_IM_POIS)
+ if (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK)
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
- r_ptr->r_flags3 |= RF3_IM_POIS;
+ r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK);
}
}
/* Otherwise, take the damage */
- else if (((f1 & TR1_BRAND_POIS) || (p_ptr->special_attack & (ATTACK_POIS))) && (mode == HISSATSU_POISON))
+ else if ((have_flag(flgs, TR_BRAND_POIS) || ((p_ptr->special_attack & (ATTACK_POIS)) && !thrown)) && (mode == HISSATSU_POISON))
{
if (mult < 35) mult = 35;
}
if (mult < 25) mult = 25;
}
}
- if ((mode == HISSATSU_ZANMA) && (r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)) && (r_ptr->flags3 & RF3_EVIL))
+ if ((mode == HISSATSU_ZANMA) && !monster_living(r_ptr) && (r_ptr->flags3 & RF3_EVIL))
{
if (mult < 15) mult = 25;
else if (mult < 50) mult = MIN(50, mult+20);
{
if (r_ptr->flags3 & RF3_UNDEAD)
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags3 |= RF3_UNDEAD;
}
if (mult == 10) mult = 40;
else if (mult < 60) mult = MIN(60, mult+30);
}
- if ((mode == HISSATSU_SEKIRYUKA) && p_ptr->cut && !(r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)))
+ if ((mode == HISSATSU_SEKIRYUKA) && p_ptr->cut && monster_living(r_ptr))
{
int tmp = MIN(100, MAX(10, p_ptr->cut / 10));
if (mult < tmp) mult = tmp;
}
if ((mode == HISSATSU_HAGAN) && (r_ptr->flags3 & RF3_HURT_ROCK))
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags3 |= RF3_HURT_ROCK;
}
if (mult == 10) mult = 40;
else if (mult < 60) mult = 60;
}
- if ((p_ptr->pclass != CLASS_SAMURAI) && (f1 & TR1_FORCE_WEPON) && (p_ptr->csp > (o_ptr->dd * o_ptr->ds / 5)))
+ if ((p_ptr->pclass != CLASS_SAMURAI) && (have_flag(flgs, TR_FORCE_WEAPON)) && (p_ptr->csp > (o_ptr->dd * o_ptr->ds / 5)))
{
p_ptr->csp -= (1+(o_ptr->dd * o_ptr->ds / 5));
p_ptr->redraw |= (PR_MANA);
- mult = MIN(60, mult * 7 / 2);
+ mult = mult * 3 / 2 + 20;
}
break;
}
for (x = (px - 1); x <= (px + 1); x++)
{
/* Sometimes, notice things */
- if (rand_int(100) < chance)
+ if (randint0(100) < chance)
{
/* Access the grid */
c_ptr = &cave[y][x];
-#ifdef USE_SCRIPT
- if (player_search_grid_callback(y, x))
- {
- /* Disturb */
- disturb(0, 0);
-
- return;
- }
-#endif /* USE_SCRIPT */
-
/* Invisible trap */
- if (c_ptr->info & CAVE_TRAP)
+ if (c_ptr->mimic && is_trap(c_ptr->feat))
{
/* Pick a trap */
- pick_trap(y, x);
+ disclose_grid(y, x);
/* Message */
#ifdef JP
}
/* Secret door */
- if (c_ptr->feat == FEAT_SECRET)
+ if (is_hidden_door(c_ptr))
{
/* Message */
#ifdef JP
msg_print("You have found a secret door.");
#endif
-
- /* Pick a door */
- place_closed_door(y, x);
+ /* Disclose */
+ disclose_grid(y, x);
/* Disturb */
disturb(0, 0);
char old_name[MAX_NLEN];
char kazu_str[80];
int hirottakazu;
- extern char *object_desc_kosuu(char *t, object_type *o_ptr);
#else
char o_name[MAX_NLEN];
#endif
(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 = p_ptr->lev;
+ quest[i].complev = (byte)p_ptr->lev;
#ifdef JP
msg_print("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª");
#else
}
-bool can_player_destroy_object(object_type *o_ptr)
-{
- /* Artifacts cannot be destroyed */
- if (artifact_p(o_ptr) || o_ptr->art_name)
- {
- byte feel = FEEL_SPECIAL;
-
- /* Hack -- Handle icky artifacts */
- if (cursed_p(o_ptr) || broken_p(o_ptr)) feel = FEEL_TERRIBLE;
-
- /* Hack -- inscribe the artifact */
- o_ptr->feeling = feel;
-
- /* We have "felt" it (again) */
- o_ptr->ident |= (IDENT_SENSE);
-
- /* Combine the pack */
- p_ptr->notice |= (PN_COMBINE);
-
- /* Redraw equippy chars */
- p_ptr->redraw |= (PR_EQUIPPY);
-
- /* Window stuff */
- p_ptr->window |= (PW_INVEN | PW_EQUIP);
-
- /* Done */
- return FALSE;
- }
-
- return TRUE;
-}
-
-/** ¼«Æ°½¦¤¤È½Äê **/
-
-int is_autopick(object_type *o_ptr)
-{
- int i;
- unsigned char o_name[MAX_NLEN];
- cptr str;
-#ifdef JP
- static char kanji_colon[] = "¡§";
-#endif
-
- if (o_ptr->tval == TV_GOLD) return -1;
-
- object_desc(o_name, o_ptr, FALSE, 3);
- for (i = 0; o_name[i]; i++)
- {
-#ifdef JP
- if (iskanji(o_name[i]))
- i++;
- else
-#endif
- if (isupper(o_name[i]))
- o_name[i] = tolower(o_name[i]);
- }
-
- for (i=0; i<max_autopick; i++)
- {
- int len = 0;
- bool collectable = FALSE;
- bool flag = FALSE;
-
- str = autopick_name[i];
-
-#ifdef JP
- /*** ¤¹¤Ù¤Æ¤Î... ***/
- if (!strncmp(str, "¤¹¤Ù¤Æ¤Î", 8)) str+= 8;
-
- /*** ´û¤Ë»ý¤Ã¤Æ¤¤¤ë¥¢¥¤¥Æ¥à ***/
- if (!strncmp(str, "¼ý½¸Ãæ¤Î", 8))
- {
- collectable = TRUE;
- str+= 8;
- }
-
- /*** ̤´ÕÄê¤Î... ***/
- if (!strncmp(str, "̤´ÕÄê¤Î",8) &&
- !object_known_p(o_ptr) && !( (o_ptr->ident)&IDENT_SENSE)) str+= 8;
-
- /*** ´ÕÄêºÑ¤ß¤Î... ***/
- if (!strncmp(str, "´ÕÄêºÑ¤ß¤Î",10) &&
- object_known_p(o_ptr) ) str+= 10;
-
- /*** *´ÕÄê*ºÑ¤ß¤Î... ***/
- if (!strncmp(str, "*´ÕÄê*ºÑ¤ß¤Î",12) &&
- object_known_p(o_ptr) && (o_ptr->ident & IDENT_MENTAL) ) str+= 12;
-
- /*** ̵ÌäÎ... ***/
- if (!strncmp(str, "̵ÌäÎ", 6)
- && (object_known_p(o_ptr)) && !o_ptr->inscription
- && (!o_ptr->name1 && !o_ptr->name2 && !o_ptr->art_name))
- {
- switch (o_ptr->tval)
- {
- case TV_SHOT: case TV_ARROW: case TV_BOLT: case TV_BOW:
- case TV_DIGGING: case TV_HAFTED: case TV_POLEARM: case TV_SWORD:
- case TV_BOOTS: case TV_GLOVES: case TV_HELM: case TV_CROWN:
- case TV_SHIELD: case TV_CLOAK:
- case TV_SOFT_ARMOR: case TV_HARD_ARMOR: case TV_DRAG_ARMOR:
- case TV_LITE: case TV_AMULET: case TV_RING: case TV_CARD:
- str += 6;
- }
- }
-
- /*** ̤ȽÌÀ¤Î... ***/
- if (!strncmp(str, "̤ȽÌÀ¤Î",8) &&
- !object_aware_p(o_ptr)) str+= 8;
-
- /*** ̵²ÁÃͤÎ... ***/
- if (!strncmp(str, "̵²ÁÃͤÎ", 8)
- && object_value(o_ptr) <= 0) str+= 8;
-
- /*** ¥À¥¤¥¹ÌÜ2 ***/
- if (o_ptr->tval != TV_BOW && !strncmp(str, "¥À¥¤¥¹Ìܤΰ㤦", 14))
- {
- object_kind *k_ptr = &k_info[o_ptr->k_idx];
-
- if ((o_ptr->dd != k_ptr->dd) || (o_ptr->ds != k_ptr->ds))
- {
- str += 14;
- }
- }
-
- /*** ¥À¥¤¥¹ÌÜ ***/
- if (!strncmp(str, "¥À¥¤¥¹ÌÜ", 8) && isdigit(*(str + 8)) && isdigit(*(str + 9))){
- if ( (o_ptr->dd) * (o_ptr->ds) >= (*(str+8)-'0') * 10 + (*(str + 9)-'0')) str+= 10;
- if (!strncmp(str, "°Ê¾å¤Î", 6)) str+= 6;
- }
-
- /*** ¾Þ¶â¼ó¤Î»àÂÎ/¹ü ***/
- if (!strncmp(str, "¾Þ¶â¼ó¤Î", 8) &&
- (o_ptr->tval == TV_CORPSE) &&
- object_is_shoukinkubi(o_ptr)) str+= 8;
-
- /*** ¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼¤Î»àÂÎ/¹ü ***/
- if (!strncmp(str, "¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼¤Î", 22) &&
- ((o_ptr->tval == TV_CORPSE) || (o_ptr->tval == TV_STATUE)) &&
- (r_info[o_ptr->pval].flags1 & RF1_UNIQUE)) str+= 22;
-
- /*** ¿Í´Ö¤Î»àÂÎ/¹ü (for Daemon) ***/
- if (!strncmp(str, "¿Í´Ö¤Î", 6) &&
- (o_ptr->tval == TV_CORPSE) &&
- (strchr("pht", r_info[o_ptr->pval].d_char))) str+= 6;
-
- /*** º£¤Î¿¦¶È¤Ç»È¤¨¤Ê¤¤ËâË¡½ñ ***/
- if (!strncmp(str, "Æɤá¤Ê¤¤", 8) &&
- (o_ptr->tval >= TV_LIFE_BOOK) &&
- !check_book_realm(o_ptr->tval, o_ptr->sval)) str += 8;
-
- /*** Âè°ìÎΰè¤ÎËâË¡½ñ ***/
- if (!strncmp(str, "Âè°ìÎΰè¤Î", 10) &&
- !(p_ptr->pclass == CLASS_SORCERER) &&
- !(p_ptr->pclass == CLASS_RED_MAGE) &&
- (o_ptr->tval >= TV_LIFE_BOOK) &&
- (REALM1_BOOK == o_ptr->tval) ) str += 10;
-
- /*** ÂèÆóÎΰè¤ÎËâË¡½ñ ***/
- if (!strncmp(str, "ÂèÆóÎΰè¤Î", 10) &&
- !(p_ptr->pclass == CLASS_SORCERER) &&
- !(p_ptr->pclass == CLASS_RED_MAGE) &&
- (o_ptr->tval >= TV_LIFE_BOOK) &&
- (REALM2_BOOK == o_ptr->tval) ) str += 10;
-
- /*** nºýÌܤÎËâË¡½ñ ***/
- if (!strncmp(str + 1, "ºýÌܤÎ", 6) &&
- (o_ptr->tval >= TV_LIFE_BOOK) &&
- (*str == '1' + o_ptr->sval) ) str += 6 + 1;
-
-
- /*** ¥¢¥¤¥Æ¥à¤Î¥«¥Æ¥´¥ê»ØÄêͽÌó¸ì ***/
- if (!strncmp(str, "¥¢¥¤¥Æ¥à",8)) len = 8;
-
- else if (!strncmp(str, "Éð´ï", 4)){
- switch( o_ptr->tval ){
- case TV_BOW:
- case TV_HAFTED:
- case TV_POLEARM:
- case TV_SWORD:
- case TV_DIGGING:
- {len = 4; break;}
- }
- }
-
- else if (!strncmp(str, "Ëɶñ", 4)){
- switch( o_ptr->tval ){
- case TV_BOOTS:
- case TV_GLOVES:
- case TV_CLOAK:
- case TV_CROWN:
- case TV_HELM:
- case TV_SHIELD:
- case TV_SOFT_ARMOR:
- case TV_HARD_ARMOR:
- case TV_DRAG_ARMOR:
- {len = 4; break;}
- }
- }
-
- else if (!strncmp(str, "Ìð", 2)){
- switch( o_ptr->tval ){
- case TV_SHOT:
- case TV_BOLT:
- case TV_ARROW:
- {len = 2;break;}
- }
- }
-
- else if (!strncmp(str, "ËâË¡¥¢¥¤¥Æ¥à", 12)){
- switch( o_ptr->tval ){
- case TV_SCROLL:
- case TV_STAFF:
- case TV_WAND:
- case TV_ROD:
- {len = 12; break;}
- }
- }
-
- else if (!strncmp(str, "¸÷¸»", 4)){
- switch( o_ptr->tval ){
- case TV_LITE:
- {len = 4; break;}
- }
- }
-
- else if (!strncmp(str, "¤¬¤é¤¯¤¿", 8)){
- switch( o_ptr->tval ){
- case TV_SKELETON:
- case TV_BOTTLE:
- case TV_JUNK:
- case TV_STATUE:
- {len = 8; break;}
- }
- }
- else if (!strncmp(str, "ËâË¡½ñ", 6) &&
- o_ptr->tval >= TV_LIFE_BOOK) len = 6;
- else if (!strncmp(str, "Æß´ï", 4) &&
- o_ptr->tval == TV_HAFTED) len = 4;
- else if (!strncmp(str, "½â", 2) &&
- o_ptr->tval == TV_SHIELD) len = 2;
- else if (!strncmp(str, "µÝ", 2) &&
- o_ptr->tval == TV_BOW) len = 2;
- else if (!strncmp(str, "»ØÎØ", 4) &&
- o_ptr->tval == TV_RING) len = 4;
- else if (!strncmp(str, "¥¢¥ß¥å¥ì¥Ã¥È", 12) &&
- o_ptr->tval == TV_AMULET) len = 12;
- else if (!strncmp(str, "³»", 2) &&
- (o_ptr->tval == TV_DRAG_ARMOR || o_ptr->tval == TV_HARD_ARMOR ||
- o_ptr->tval == TV_SOFT_ARMOR)) len = 2;
- else if (!strncmp(str, "¥¯¥í¡¼¥¯", 8) &&
- o_ptr->tval == TV_CLOAK) len = 8;
- else if (!strncmp(str, "³õ", 2) &&
- (o_ptr->tval == TV_CROWN || o_ptr->tval == TV_HELM)) len = 2;
- else if (!strncmp(str, "äƼê", 4) &&
- o_ptr->tval == TV_GLOVES) len = 4;
- else if (!strncmp(str, "·¤", 2) &&
- o_ptr->tval == TV_BOOTS) len = 2;
-
- str += len;
- if (*str == 0)
- flag = TRUE;
- else if (*str == ':')
- str += 1;
- else if (*str == kanji_colon[0] && *(str+1) == kanji_colon[1])
- str += 2;
- else if (len)
- continue;
-#else
-#define NEXT_WORD(len) (void)(str += len, str += (' '==*str)?1:0)
-
- /*** ¤¹¤Ù¤Æ¤Î... ***/
- if (!strncmp(str, "all", 3)) NEXT_WORD(3);
-
- /*** ´û¤Ë»ý¤Ã¤Æ¤¤¤ë¥¢¥¤¥Æ¥à ***/
- if (!strncmp(str, "collecting", 10))
- {
- collectable = TRUE;
- NEXT_WORD(10);
- }
-
- /*** ̤´ÕÄê¤Î... ***/
- if (!strncmp(str, "unidentified",12) &&
- !object_known_p(o_ptr) && !( (o_ptr->ident)&IDENT_SENSE)) NEXT_WORD(12);
-
- /*** ´ÕÄêºÑ¤ß¤Î... ***/
- if (!strncmp(str, "identified",10) &&
- object_known_p(o_ptr) ) NEXT_WORD(10);
-
- /*** *´ÕÄê*ºÑ¤ß¤Î... ***/
- if (!strncmp(str, "*identified*",12) &&
- object_known_p(o_ptr) && (o_ptr->ident & IDENT_MENTAL) ) NEXT_WORD(12);
-
- /*** ̵ÌäÎ... ***/
- if (!strncmp(str, "nameless", 8)
- && (object_known_p(o_ptr)) && !o_ptr->inscription
- && (!o_ptr->name1 && !o_ptr->name2 && !o_ptr->art_name))
- {
- switch (o_ptr->tval)
- {
- case TV_SHOT: case TV_ARROW: case TV_BOLT: case TV_BOW:
- case TV_DIGGING: case TV_HAFTED: case TV_POLEARM: case TV_SWORD:
- case TV_BOOTS: case TV_GLOVES: case TV_HELM: case TV_CROWN:
- case TV_SHIELD: case TV_CLOAK:
- case TV_SOFT_ARMOR: case TV_HARD_ARMOR: case TV_DRAG_ARMOR:
- case TV_LITE: case TV_AMULET: case TV_RING: case TV_CARD:
- str += 9;
- }
- }
-
- /*** ̤ȽÌÀ¤Î... ***/
- if (!strncmp(str, "unaware",7) &&
- !object_aware_p(o_ptr)) NEXT_WORD(7);
-
- /*** ̵²ÁÃͤÎ... ***/
- if (!strncmp(str, "worthless", 9)
- && object_value(o_ptr) <= 0) NEXT_WORD(9);
-
- /*** ¥À¥¤¥¹ÌÜ2 ***/
- if (o_ptr->tval != TV_BOW && !strncmp(str, "dice boosted", 12))
- {
- object_kind *k_ptr = &k_info[o_ptr->k_idx];
- if ((o_ptr->dd != k_ptr->dd) || (o_ptr->ds != k_ptr->ds))
- str += 13;
- }
-
- /*** ¥À¥¤¥¹ÌÜ ***/
- if (!strncmp(str, "more than ", 10) &&
- !strncmp(str+2+10, " dice ", 6) &&
- isdigit(str[10]) && isdigit(str[11]) &&
- o_ptr->dd * o_ptr->ds >= (str[10]-'0') * 10 + (str[11]-'0'))
- NEXT_WORD(10+2+6);
-
- /*** ¾Þ¶â¼ó¤Î»àÂÎ/¹ü ***/
- if (!strncmp(str, "wanted", 6) &&
- (o_ptr->tval == TV_CORPSE) &&
- object_is_shoukinkubi(o_ptr)) NEXT_WORD(6);
-
- /*** ¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼¤Î»àÂÎ/¹ü ***/
- if (!strncmp(str, "unique monster's", 16) &&
- ((o_ptr->tval == TV_CORPSE) || (o_ptr->tval == TV_STATUE)) &&
- (r_info[o_ptr->pval].flags1 & RF1_UNIQUE)) NEXT_WORD(16);
-
- /*** ¿Í´Ö¤Î»àÂÎ/¹ü (for Daemon) ***/
- if (!strncmp(str, "human", 5) &&
- (o_ptr->tval == TV_CORPSE) &&
- (strchr("pht", r_info[o_ptr->pval].d_char))) NEXT_WORD(5);
-
- /*** º£¤Î¿¦¶È¤Ç»È¤¨¤Ê¤¤ËâË¡½ñ ***/
- if (!strncmp(str, "unreadable", 10) &&
- (o_ptr->tval >= TV_LIFE_BOOK) &&
- !check_book_realm(o_ptr->tval, o_ptr->sval)) NEXT_WORD(10);
-
- /*** Âè°ìÎΰè¤ÎËâË¡½ñ ***/
- if (!strncmp(str, "first realm's", 13) &&
- !(p_ptr->pclass == CLASS_SORCERER) &&
- !(p_ptr->pclass == CLASS_RED_MAGE) &&
- (o_ptr->tval >= TV_LIFE_BOOK) &&
- (REALM1_BOOK == o_ptr->tval) ) NEXT_WORD(13);
-
- /*** ÂèÆóÎΰè¤ÎËâË¡½ñ ***/
- if (!strncmp(str, "second realm's", 14) &&
- !(p_ptr->pclass == CLASS_SORCERER) &&
- !(p_ptr->pclass == CLASS_RED_MAGE) &&
- (o_ptr->tval >= TV_LIFE_BOOK) &&
- (REALM2_BOOK == o_ptr->tval) ) NEXT_WORD(14);
-
- /*** nºýÌܤÎËâË¡½ñ ***/
- if (!strncmp(str, "first", 5) &&
- (o_ptr->tval >= TV_LIFE_BOOK) &&
- (0 == o_ptr->sval) ) NEXT_WORD(5);
- if (!strncmp(str, "second", 6) &&
- (o_ptr->tval >= TV_LIFE_BOOK) &&
- (1 == o_ptr->sval) ) NEXT_WORD(6);
- if (!strncmp(str, "third", 5) &&
- (o_ptr->tval >= TV_LIFE_BOOK) &&
- (2 == o_ptr->sval) ) NEXT_WORD(5);
- if (!strncmp(str, "fourth", 6) &&
- (o_ptr->tval >= TV_LIFE_BOOK) &&
- (3 == o_ptr->sval) ) NEXT_WORD(6);
-
- /*** ¥¢¥¤¥Æ¥à¤Î¥«¥Æ¥´¥ê»ØÄêͽÌó¸ì ***/
- if (!strncmp(str, "items",5)) len = 5;
-
- else if (!strncmp(str, "artifacts", 9)){
- if (object_known_p(o_ptr)
- && (artifact_p(o_ptr) || o_ptr->art_name))
- len = 9;
- }
-
- else if (!strncmp(str, "weapons", 7)){
- switch( o_ptr->tval ){
- case TV_BOW:
- case TV_HAFTED:
- case TV_POLEARM:
- case TV_SWORD:
- case TV_DIGGING:
- {len = 7; break;}
- }
- }
-
- else if (!strncmp(str, "armors", 6)){
- switch( o_ptr->tval ){
- case TV_BOOTS:
- case TV_GLOVES:
- case TV_CLOAK:
- case TV_CROWN:
- case TV_HELM:
- case TV_SHIELD:
- case TV_SOFT_ARMOR:
- case TV_HARD_ARMOR:
- case TV_DRAG_ARMOR:
- {len = 6; break;}
- }
- }
-
- else if (!strncmp(str, "missiles", 8)){
- switch( o_ptr->tval ){
- case TV_SHOT:
- case TV_BOLT:
- case TV_ARROW:
- {len = 8;break;}
- }
- }
-
- else if (!strncmp(str, "magical devices", 15)){
- switch( o_ptr->tval ){
- case TV_SCROLL:
- case TV_STAFF:
- case TV_WAND:
- case TV_ROD:
- {len = 15; break;}
- }
- }
-
- else if (!strncmp(str, "lights", 6)){
- switch( o_ptr->tval ){
- case TV_LITE:
- {len = 6; break;}
- }
- }
-
- else if (!strncmp(str, "junks", 5)){
- switch( o_ptr->tval ){
- case TV_SKELETON:
- case TV_BOTTLE:
- case TV_JUNK:
- case TV_STATUE:
- {len = 5; break;}
- }
- }
- else if (!strncmp(str, "spellbooks", 10) &&
- o_ptr->tval >= TV_LIFE_BOOK) len = 10;
- else if (!strncmp(str, "hafted weapons", 14) &&
- o_ptr->tval == TV_HAFTED) len = 14;
- else if (!strncmp(str, "shields", 7) &&
- o_ptr->tval == TV_SHIELD) len = 7;
- else if (!strncmp(str, "bows", 4) &&
- o_ptr->tval == TV_BOW) len = 4;
- else if (!strncmp(str, "rings", 5) &&
- o_ptr->tval == TV_RING) len = 5;
- else if (!strncmp(str, "amulets", 7) &&
- o_ptr->tval == TV_AMULET) len = 7;
- else if (!strncmp(str, "suits", 5) &&
- (o_ptr->tval == TV_DRAG_ARMOR || o_ptr->tval == TV_HARD_ARMOR ||
- o_ptr->tval == TV_SOFT_ARMOR)) len = 5;
- else if (!strncmp(str, "cloaks", 6) &&
- o_ptr->tval == TV_CLOAK) len = 6;
- else if (!strncmp(str, "helms", 5) &&
- (o_ptr->tval == TV_CROWN || o_ptr->tval == TV_HELM)) len = 5;
- else if (!strncmp(str, "gloves", 6) &&
- o_ptr->tval == TV_GLOVES) len = 6;
- else if (!strncmp(str, "boots", 5) &&
- o_ptr->tval == TV_BOOTS) len = 5;
-
- str += len;
- if (*str == 0)
- flag = TRUE;
- else if (*str == ':')
- str += 1;
- else if (len)
- continue;
-#endif
-
- if (*str == '^')
- {
- str++;
- if (!strncmp(o_name, str, strlen(str)))
- flag = TRUE;
- }
- else
-#ifdef JP
- if (strstr_j(o_name, str))
-#else
- if (strstr(o_name, str))
-#endif
- {
- flag = TRUE;
- }
-
- if (flag)
- {
- int j;
- if (!collectable)
- return i;
- /* Check if there is a same item */
- for (j = 0; j < INVEN_PACK; j++)
- {
- if (inventory[j].k_idx == o_ptr->k_idx)
- return i;
- }
- }
- }/* for */
-
- return -1;
-}
-
-
-static bool is_autopick2( object_type *o_ptr) {
- cptr s;
-
- /* No inscription */
- if (!o_ptr->inscription) return (FALSE);
-
- /* Find a '=' */
- s = strchr(quark_str(o_ptr->inscription), '=');
-
- /* Process inscription */
- while (s)
- {
- /* Auto-pickup on "=g" */
- if (s[1] == 'g') return (TRUE);
-
- /* Find another '=' */
- s = strchr(s + 1, '=');
- }
-
- /* Don't auto pickup */
- return (FALSE);
-}
-
-/*
- * Automatically destroy items in this grid.
- */
-static bool is_opt_confirm_destroy(object_type *o_ptr)
-{
- if (!destroy_items) return FALSE;
-
- /* Known to be worthless? */
- if (leave_worth)
- if (object_value(o_ptr) > 0) return FALSE;
-
- if (leave_equip)
- if ((o_ptr->tval >= TV_SHOT) && (o_ptr->tval <= TV_DRAG_ARMOR)) return FALSE;
-
- if (leave_chest)
- if ((o_ptr->tval == TV_CHEST) && o_ptr->pval) return FALSE;
-
- if (leave_wanted)
- {
- if (o_ptr->tval == TV_CORPSE
- && object_is_shoukinkubi(o_ptr)) return FALSE;
- }
-
- if (leave_corpse)
- if (o_ptr->tval == TV_CORPSE) return FALSE;
-
- if (leave_junk)
- if ((o_ptr->tval == TV_SKELETON) || (o_ptr->tval == TV_BOTTLE) || (o_ptr->tval == TV_JUNK) || (o_ptr->tval == TV_STATUE)) return FALSE;
-
- if (o_ptr->tval == TV_GOLD) return FALSE;
-
- return TRUE;
-}
-
-/*
- * Automatically pickup/destroy items in this grid.
- */
-static void auto_pickup_items(cave_type *c_ptr)
-{
- s16b this_o_idx, next_o_idx = 0;
- s16b inscribe_flags(object_type *o_ptr, cptr out_val);
-
- char o_name[MAX_NLEN];
- int idx;
-
- /* 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 */
- next_o_idx = o_ptr->next_o_idx;
- idx = is_autopick(o_ptr);
-
- if (idx >= 0 && autopick_insc[idx] && !o_ptr->inscription)
- o_ptr->inscription = inscribe_flags(o_ptr, autopick_insc[idx]);
-
- if (is_autopick2(o_ptr) ||
- (idx >= 0 && autopick_action[idx] == DO_AUTOPICK))
- {
- disturb(0,0);
-
- if (!inven_carry_okay(o_ptr)){
- /* Describe the object */
- object_desc(o_name, o_ptr, TRUE, 3);
- /* Message */
-#ifdef JP
- msg_format("¥¶¥Ã¥¯¤Ë¤Ï%s¤òÆþ¤ì¤ë·ä´Ö¤¬¤Ê¤¤¡£", o_name);
-#else
- msg_format("You have no room for %s.", o_name);
-#endif
- continue;
- }
- py_pickup_aux(this_o_idx);
-
- continue;
- }
-
- else if ((idx == -1 && is_opt_confirm_destroy(o_ptr)) ||
- (!always_pickup && (idx != -1 && autopick_action[idx] == DO_AUTODESTROY)))
- {
- disturb(0,0);
- /* Describe the object (with {terrible/special}) */
- object_desc(o_name, o_ptr, TRUE, 3);
- /* Artifact? */
- if (!can_player_destroy_object(o_ptr))
- {
- /* Message */
-#ifdef JP
- msg_format("%s¤ÏÇ˲õÉÔǽ¤À¡£", o_name);
-#else
- msg_format("You cannot auto-destroy %s.", o_name);
-#endif
-
- /* Done */
- continue;
- }
- /* Destroy the item */
- delete_object_idx(this_o_idx);
-
- /* Print a message */
-#ifdef JP
- msg_format("%s¤ò¼«Æ°Ç˲õ¤·¤Þ¤¹¡£", o_name);
-#else
- msg_format("Auto-destroying %s.", o_name);
-#endif
-
- continue;
- }
- }
-}
-
-
/*
* Player "wants" to pick up an object or gold.
* Note that we ONLY handle things that can be picked up.
/* Message */
#ifdef JP
msg_format(" $%ld ¤Î²ÁÃͤ¬¤¢¤ë%s¤ò¸«¤Ä¤±¤¿¡£",
- (long)value, o_name);
+ (long)value, o_name);
#else
msg_format("You collect %ld gold pieces worth of %s.",
(long)value, o_name);
/* Pick up objects */
else
{
+ /* Hack - some objects were handled in auto_pickup_items(). */
+ if (o_ptr->marked & OM_NOMSG)
+ {
+ /* Clear the flag. */
+ o_ptr->marked &= ~OM_NOMSG;
+ }
/* Describe the object */
- if (!pickup)
+ else if (!pickup)
{
#ifdef JP
int k, ac;
/* Percentile dice */
- k = rand_int(100);
+ k = randint0(100);
/* Hack -- 5% hit, 5% miss */
if (k < 10) return (k < 5);
if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
- if (one_in_(20)) return (FALSE);
+ if (one_in_(20)) return (TRUE);
/* Paranoia -- No power */
if (power <= 0) return (FALSE);
ac = p_ptr->ac + p_ptr->to_a;
/* Power competes against Armor */
- if (randint(power) > ((ac * 3) / 4)) return (TRUE);
+ if (randint1(power) > ((ac * 3) / 4)) return (TRUE);
/* Assume miss */
return (FALSE);
if (autosave_l && (p_ptr->chp >= 0))
do_cmd_save_game(TRUE);
- do_cmd_write_nikki(NIKKI_STAIR, 1, "Í¸Í¤ËÍî¤Á¤¿");
- dun_level++;
+#ifdef JP
+ do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "Í¸Í¤ËÍî¤Á¤¿");
+#else
+ do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "You have fallen through a trap door!");
+#endif
+ prepare_change_floor_mode(CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
/* Leaving */
p_ptr->leaving = TRUE;
dam = damroll(2, 6);
/* Extra spike damage */
- if (rand_int(100) < 50)
+ if (randint0(100) < 50)
{
#ifdef JP
msg_print("¥¹¥Ñ¥¤¥¯¤¬»É¤µ¤Ã¤¿¡ª");
#endif
dam = dam * 2;
- (void)set_cut(p_ptr->cut + randint(dam));
+ (void)set_cut(p_ptr->cut + randint1(dam));
}
/* Take the damage */
/* Extra spike damage */
- if (rand_int(100) < 50)
+ if (randint0(100) < 50)
{
#ifdef JP
msg_print("ÆǤòÅɤé¤ì¤¿¥¹¥Ñ¥¤¥¯¤¬»É¤µ¤Ã¤¿¡ª");
dam = dam * 2;
- (void)set_cut(p_ptr->cut + randint(dam));
+ (void)set_cut(p_ptr->cut + randint1(dam));
- if (p_ptr->resist_pois || p_ptr->oppose_pois)
+ if (p_ptr->resist_pois || IS_OPPOSE_POIS())
{
#ifdef JP
msg_print("¤·¤«¤·ÆǤαƶÁ¤Ï¤Ê¤«¤Ã¤¿¡ª");
else
{
dam = dam * 2;
- (void)set_poisoned(p_ptr->poisoned + randint(dam));
+ (void)set_poisoned(p_ptr->poisoned + randint1(dam));
}
}
#endif
c_ptr->info &= ~(CAVE_MARK);
- cave_set_feat(y, x, floor_type[rand_int(100)]);
- num = 2 + randint(3);
+ cave_set_feat(y, x, floor_type[randint0(100)]);
+ num = 2 + randint1(3);
for (i = 0; i < num; i++)
{
- (void)summon_specific(0, y, x, dun_level, 0, TRUE, FALSE, FALSE, TRUE, TRUE);
+ (void)summon_specific(0, y, x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
}
- if (dun_level > randint(100)) /* No nasty effect for low levels */
+ if (dun_level > randint1(100)) /* No nasty effect for low levels */
{
bool stop_ty = FALSE;
int count = 0;
{
stop_ty = activate_ty_curse(stop_ty, &count);
}
- while (randint(6) == 1);
+ while (one_in_(6));
}
break;
}
dam = damroll(4, 6);
#ifdef JP
- fire_dam(dam, "±ê¤Î¥È¥é¥Ã¥×", -1);
+ (void)fire_dam(dam, "±ê¤Î¥È¥é¥Ã¥×", -1);
#else
- fire_dam(dam, "a fire trap", -1);
+ (void)fire_dam(dam, "a fire trap", -1);
#endif
break;
dam = damroll(4, 6);
#ifdef JP
- acid_dam(dam, "»À¤Î¥È¥é¥Ã¥×", -1);
+ (void)acid_dam(dam, "»À¤Î¥È¥é¥Ã¥×", -1);
#else
- acid_dam(dam, "an acid trap", -1);
+ (void)acid_dam(dam, "an acid trap", -1);
#endif
break;
dam = damroll(1, 4);
take_hit(DAMAGE_ATTACK, dam, name, -1);
- (void)set_slow(p_ptr->slow + rand_int(20) + 20, FALSE);
+ (void)set_slow(p_ptr->slow + randint0(20) + 20, FALSE);
}
else
{
if (!p_ptr->resist_blind)
{
- (void)set_blind(p_ptr->blind + rand_int(50) + 25);
+ (void)set_blind(p_ptr->blind + randint0(50) + 25);
}
break;
}
if (!p_ptr->resist_conf)
{
- (void)set_confused(p_ptr->confused + rand_int(20) + 10);
+ (void)set_confused(p_ptr->confused + randint0(20) + 10);
}
break;
}
msg_print("A pungent green gas surrounds you!");
#endif
- if (!p_ptr->resist_pois && !p_ptr->oppose_pois)
+ if (!p_ptr->resist_pois && !IS_OPPOSE_POIS())
{
- (void)set_poisoned(p_ptr->poisoned + rand_int(20) + 10);
+ (void)set_poisoned(p_ptr->poisoned + randint0(20) + 10);
}
break;
}
/* Remove the monster restriction */
get_mon_num_prep(NULL, NULL);
}
- (void)set_paralyzed(p_ptr->paralyzed + rand_int(10) + 5);
+ (void)set_paralyzed(p_ptr->paralyzed + randint0(10) + 5);
}
break;
}
/* Destroy this trap */
- cave_set_feat(y, x, floor_type[rand_int(100)]);
+ cave_set_feat(y, x, floor_type[randint0(100)]);
/* Make some new traps */
project(0, 1, y, x, 0, GF_MAKE_TRAP, PROJECT_HIDE | PROJECT_JUMP | PROJECT_GRID, -1);
break;
}
+
+ case FEAT_TRAP_ALARM:
+ {
+#ifdef JP
+ msg_print("¤±¤¿¤¿¤Þ¤·¤¤²»¤¬ÌĤê¶Á¤¤¤¿¡ª");
+#else
+ msg_print("An alarm sounds!");
+#endif
+
+ aggravate_monsters(0);
+
+ break;
+ }
+
+ case FEAT_TRAP_OPEN:
+ {
+#ifdef JP
+ msg_print("Âç²»¶Á¤È¶¦¤Ë¤Þ¤ï¤ê¤ÎÊɤ¬Êø¤ì¤¿¡ª");
+#else
+ msg_print("Suddenly, surrounding walls are opened!");
+#endif
+ (void)project(0, 3, y, x, 0, GF_DISINTEGRATE, PROJECT_GRID | PROJECT_HIDE, -1);
+ (void)project(0, 3, y, x - 4, 0, GF_DISINTEGRATE, PROJECT_GRID | PROJECT_HIDE, -1);
+ (void)project(0, 3, y, x + 4, 0, GF_DISINTEGRATE, PROJECT_GRID | PROJECT_HIDE, -1);
+ aggravate_monsters(0);
+
+ break;
+ }
+
+ case FEAT_TRAP_ARMAGEDDON:
+ {
+ static int levs[10] = {0, 0, 20, 10, 5, 3, 2, 1, 1, 1};
+ int evil_idx = 0, good_idx = 0;
+
+ int lev;
+#ifdef JP
+ msg_print("ÆÍÁ³Å·³¦¤ÎÀïÁè¤Ë´¬¤¹þ¤Þ¤ì¤¿¡ª");
+#else
+ msg_print("Suddenly, you are surrounded by immotal beings!");
+#endif
+
+ /* Destroy this trap */
+ cave_set_feat(y, x, floor_type[randint0(100)]);
+
+ /* Summon Demons and Angels */
+ for (lev = dun_level; lev >= 20; lev -= 1 + lev/16)
+ {
+ num = levs[MIN(lev/10, 9)];
+ for (i = 0; i < num; i++)
+ {
+ int x1 = rand_spread(x, 7);
+ int y1 = rand_spread(y, 5);
+
+ /* Skip illegal grids */
+ if (!in_bounds(y1, x1)) continue;
+
+ /* Require line of sight */
+ if (!player_has_los_bold(y1, x1)) continue;
+
+ if (summon_specific(0, y1, x1, lev, SUMMON_ARMAGE_EVIL, (PM_NO_PET)))
+ evil_idx = hack_m_idx_ii;
+
+ if (summon_specific(0, y1, x1, lev, SUMMON_ARMAGE_GOOD, (PM_NO_PET)))
+ {
+ good_idx = hack_m_idx_ii;
+ }
+
+ /* Let them fight each other */
+ if (evil_idx && good_idx)
+ {
+ monster_type *evil_ptr = &m_list[evil_idx];
+ monster_type *good_ptr = &m_list[good_idx];
+ evil_ptr->target_y = good_ptr->fy;
+ evil_ptr->target_x = good_ptr->fx;
+ good_ptr->target_y = evil_ptr->fy;
+ good_ptr->target_x = evil_ptr->fx;
+ }
+ }
+ }
+ break;
+ }
+
+ case FEAT_TRAP_PIRANHA:
+ {
+#ifdef JP
+ msg_print("ÆÍÁ³Êɤ«¤é¿å¤¬°î¤ì½Ð¤·¤¿¡ª¥Ô¥é¥Ë¥¢¤¬¤¤¤ë¡ª");
+#else
+ msg_print("Suddenly, the room is filled with water with piranhas!");
+#endif
+
+ /* Destroy this trap */
+ cave_set_feat(y, x, floor_type[randint0(100)]);
+
+ /* Water fills room */
+ fire_ball_hide(GF_WATER_FLOW, 0, 1, 10);
+
+ /* Summon Piranhas */
+ num = 1 + dun_level/20;
+ for (i = 0; i < num; i++)
+ {
+ (void)summon_specific(0, y, x, dun_level, SUMMON_PIRANHAS, (PM_ALLOW_GROUP | PM_NO_PET));
+ }
+ break;
+ }
}
if (break_trap && is_trap(c_ptr->feat))
{
- cave_set_feat(y, x, floor_type[rand_int(100)]);
+ cave_set_feat(y, x, floor_type[randint0(100)]);
#ifdef JP
msg_print("¥È¥é¥Ã¥×¤òÊ´ºÕ¤·¤¿¡£");
#else
}
-void touch_zap_player(monster_type *m_ptr)
+static void touch_zap_player(monster_type *m_ptr)
{
int aura_damage = 0;
monster_race *r_ptr = &r_info[m_ptr->r_idx];
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, 0x88);
+ monster_desc(aura_dam, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
#ifdef JP
msg_print("ÆÍÁ³¤È¤Æ¤âÇ®¤¯¤Ê¤Ã¤¿¡ª");
#endif
- if (p_ptr->oppose_fire) aura_damage = (aura_damage + 2) / 3;
+ 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;
take_hit(DAMAGE_NOESCAPE, aura_damage, aura_dam, -1);
- r_ptr->r_flags2 |= RF2_AURA_FIRE;
+ if (m_ptr->ml && is_original_ap(m_ptr)) r_ptr->r_flags2 |= RF2_AURA_FIRE;
handle_stuff();
}
}
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, 0x88);
+ monster_desc(aura_dam, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
#ifdef JP
msg_print("ÆÍÁ³¤È¤Æ¤â´¨¤¯¤Ê¤Ã¤¿¡ª");
#endif
- if (p_ptr->oppose_cold) aura_damage = (aura_damage + 2) / 3;
+ 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);
- r_ptr->r_flags3 |= RF3_AURA_COLD;
+ if (m_ptr->ml && is_original_ap(m_ptr)) r_ptr->r_flags3 |= RF3_AURA_COLD;
handle_stuff();
}
}
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, 0x88);
+ monster_desc(aura_dam, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
- if (p_ptr->oppose_elec) aura_damage = (aura_damage + 2) / 3;
+ 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
#endif
take_hit(DAMAGE_NOESCAPE, aura_damage, aura_dam, -1);
- r_ptr->r_flags2 |= RF2_AURA_ELEC;
+ if (m_ptr->ml && is_original_ap(m_ptr)) r_ptr->r_flags2 |= RF2_AURA_ELEC;
handle_stuff();
}
}
int dss, ddd;
- char *atk_desc;
+ cptr atk_desc;
switch (attack)
{
chance = (p_ptr->skill_thn + (bonus * BTH_PLUS_ADJ));
/* Test for hit */
- if ((!(r_ptr->flags2 & RF2_QUANTUM) || !rand_int(2)) && test_hit_norm(chance, r_ptr->ac, m_ptr->ml))
+ if ((!(r_ptr->flags2 & RF2_QUANTUM) || !randint0(2)) && test_hit_norm(chance, r_ptr->ac, m_ptr->ml))
{
/* Sound */
sound(SOUND_HIT);
k = damroll(ddd, dss);
- k = critical_norm(n_weight, bonus, k, bonus, 0);
+ k = critical_norm(n_weight, bonus, k, (s16b)bonus, 0);
/* Apply the player damage bonuses */
k += p_ptr->to_d_m;
k = mon_damage_mod(m_ptr, k, FALSE);
/* Complex message */
- if (wizard)
+ if (p_ptr->wizard)
{
#ifdef JP
msg_format("%d/%d ¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£", k, m_ptr->hp);
switch (attack)
{
case MUT2_SCOR_TAIL:
- project(0, 0, m_ptr->fy, m_ptr->fx, k, GF_POIS, PROJECT_KILL | PROJECT_NO_REF, -1);
+ project(0, 0, m_ptr->fy, m_ptr->fx, k, GF_POIS, PROJECT_KILL, -1);
*mdeath = (m_ptr->r_idx == 0);
break;
case MUT2_HORNS:
bool stab_fleeing = FALSE;
bool fuiuchi = FALSE;
bool do_quake = FALSE;
+ bool weak = FALSE;
bool drain_msg = TRUE;
int drain_result = 0, drain_heal = 0;
bool can_drain = FALSE;
int num_blow;
int drain_left = MAX_VAMPIRIC_DRAIN;
- u32b f1, f2, f3; /* A massive hack -- life-draining weapons */
+ u32b flgs[TR_FLAG_SIZE]; /* A massive hack -- life-draining weapons */
bool is_human = (r_ptr->d_char == 'p');
bool is_lowlevel = (r_ptr->level < (p_ptr->lev - 15));
bool zantetsu_mukou, e_j_mukou;
if (((p_ptr->pclass == CLASS_ROGUE) || (p_ptr->pclass == CLASS_NINJA)) && inventory[INVEN_RARM+hand].tval)
{
- int tmp = p_ptr->lev*8+50;
+ int tmp = p_ptr->lev*6+(p_ptr->skill_stl+10)*4;
if (p_ptr->monlite && (mode != HISSATSU_NYUSIN)) tmp /= 3;
- if (p_ptr->aggravate) tmp /= 2;
+ if (p_ptr->cursed & TRC_AGGRAVATE) tmp /= 2;
if (r_ptr->level > (p_ptr->lev*p_ptr->lev/20+10)) tmp /= 3;
if (m_ptr->csleep && m_ptr->ml)
{
/* Can't backstab creatures that we can't see, right? */
backstab = TRUE;
}
- else if ((p_ptr->special_defense & NINJA_S_STEALTH) && (rand_int(tmp) > (r_ptr->level+20)) && m_ptr->ml)
+ else if ((p_ptr->special_defense & NINJA_S_STEALTH) && (randint0(tmp) > (r_ptr->level+20)) && m_ptr->ml && !(r_ptr->flagsr & RFR_RES_ALL))
{
fuiuchi = TRUE;
}
{
if ((r_ptr->level + 10) > p_ptr->lev)
{
- if (skill_exp[GINOU_SUDE] < skill_exp_settei[p_ptr->pclass][GINOU_SUDE][1])
- {
- if (skill_exp[GINOU_SUDE] < 4000)
- skill_exp[GINOU_SUDE]+=40;
- else if((skill_exp[GINOU_SUDE] < 6000))
- skill_exp[GINOU_SUDE]+=5;
- else if((skill_exp[GINOU_SUDE] < 7000) && (p_ptr->lev > 19))
- skill_exp[GINOU_SUDE]+=1;
- else if((skill_exp[GINOU_SUDE] < 8000) && (p_ptr->lev > 34))
- if (one_in_(3)) skill_exp[GINOU_SUDE]+=1;
+ if (p_ptr->skill_exp[GINOU_SUDE] < s_info[p_ptr->pclass].s_max[GINOU_SUDE])
+ {
+ if (p_ptr->skill_exp[GINOU_SUDE] < WEAPON_EXP_BEGINNER)
+ p_ptr->skill_exp[GINOU_SUDE] += 40;
+ else if ((p_ptr->skill_exp[GINOU_SUDE] < WEAPON_EXP_SKILLED))
+ p_ptr->skill_exp[GINOU_SUDE] += 5;
+ else if ((p_ptr->skill_exp[GINOU_SUDE] < WEAPON_EXP_EXPERT) && (p_ptr->lev > 19))
+ p_ptr->skill_exp[GINOU_SUDE] += 1;
+ else if ((p_ptr->lev > 34))
+ if (one_in_(3)) p_ptr->skill_exp[GINOU_SUDE] += 1;
p_ptr->update |= (PU_BONUS);
}
}
{
if ((r_ptr->level + 10) > p_ptr->lev)
{
- if (weapon_exp[inventory[INVEN_RARM+hand].tval-TV_BOW][inventory[INVEN_RARM+hand].sval] < weapon_exp_settei[p_ptr->pclass][inventory[INVEN_RARM+hand].tval-TV_BOW][inventory[INVEN_RARM+hand].sval][1])
- {
- if (weapon_exp[inventory[INVEN_RARM+hand].tval-TV_BOW][inventory[INVEN_RARM+hand].sval] < 4000)
- weapon_exp[inventory[INVEN_RARM+hand].tval-TV_BOW][inventory[INVEN_RARM+hand].sval]+=80;
- else if((weapon_exp[inventory[INVEN_RARM+hand].tval-TV_BOW][inventory[INVEN_RARM+hand].sval] < 6000))
- weapon_exp[inventory[INVEN_RARM+hand].tval-TV_BOW][inventory[INVEN_RARM+hand].sval]+=10;
- else if((weapon_exp[inventory[INVEN_RARM+hand].tval-TV_BOW][inventory[INVEN_RARM+hand].sval] < 7000) && (p_ptr->lev > 19))
- weapon_exp[inventory[INVEN_RARM+hand].tval-TV_BOW][inventory[INVEN_RARM+hand].sval]+=1;
- else if((weapon_exp[inventory[INVEN_RARM+hand].tval-TV_BOW][inventory[INVEN_RARM+hand].sval] < 8000) && (p_ptr->lev > 34))
- if (one_in_(2)) weapon_exp[inventory[INVEN_RARM+hand].tval-TV_BOW][inventory[INVEN_RARM+hand].sval]+=1;
+ int tval = inventory[INVEN_RARM+hand].tval - TV_BOW;
+ int sval = inventory[INVEN_RARM+hand].sval;
+ int now_exp = p_ptr->weapon_exp[tval][sval];
+ if (now_exp < s_info[p_ptr->pclass].w_max[tval][sval])
+ {
+ int amount = 0;
+ if (now_exp < WEAPON_EXP_BEGINNER) amount = 80;
+ else if (now_exp < WEAPON_EXP_SKILLED) amount = 10;
+ else if ((now_exp < WEAPON_EXP_EXPERT) && (p_ptr->lev > 19)) amount = 1;
+ else if ((p_ptr->lev > 34) && one_in_(2)) amount = 1;
+ p_ptr->weapon_exp[tval][sval] += amount;
p_ptr->update |= (PU_BONUS);
}
}
/* Disturb the monster */
m_ptr->csleep = 0;
- if (r_ptr->flags7 & (RF7_HAS_LITE_1 | RF7_HAS_LITE_2))
+ if (r_ptr->flags7 & RF7_HAS_LD_MASK)
p_ptr->update |= (PU_MON_LITE);
/* Extract monster name (or "it") */
else num_blow = p_ptr->num_blow[hand];
/* Attack once for each legal blow */
- while ((num++ < num_blow) && !death)
+ while ((num++ < num_blow) && !p_ptr->is_dead)
{
if (((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) || (mode == HISSATSU_KYUSHO))
{
if (p_ptr->migite && p_ptr->hidarite)
{
- success_hit = (randint(2) == 1);
+ success_hit = one_in_(2);
}
else success_hit = TRUE;
}
}
else success_hit = old_success_hit;
}
- else if ((p_ptr->pclass == CLASS_NINJA) && ((backstab || fuiuchi) && !(r_ptr->flags3 & RF3_RES_ALL))) success_hit = TRUE;
+ else if ((p_ptr->pclass == CLASS_NINJA) && ((backstab || fuiuchi) && !(r_ptr->flagsr & RFR_RES_ALL))) success_hit = TRUE;
else success_hit = test_hit_norm(chance, r_ptr->ac, m_ptr->ml);
/* Test for hit */
if (success_hit)
{
+ int vorpal_chance = ((o_ptr->name1 == ART_VORPAL_BLADE) || (o_ptr->name1 == ART_CHAINSWORD)) ? 2 : 4;
+
/* Sound */
sound(SOUND_HIT);
/* Hack -- bare hands do one damage */
k = 1;
- object_flags(o_ptr, &f1, &f2, &f3);
+ object_flags(o_ptr, flgs);
/* Select a chaotic effect (50% chance) */
- if ((f1 & TR1_CHAOTIC) && (randint(2) == 1))
+ if ((have_flag(flgs, TR_CHAOTIC)) && one_in_(2))
{
- if (randint(10)==1)
+ if (one_in_(10))
chg_virtue(V_CHANCE, 1);
- if (randint(5) < 3)
+ if (randint1(5) < 3)
{
/* Vampiric (20%) */
chaos_effect = 1;
}
- else if (randint(250) == 1)
+ else if (one_in_(250))
{
/* Quake (0.12%) */
chaos_effect = 2;
}
- else if (randint(10) != 1)
+ else if (!one_in_(10))
{
/* Confusion (26.892%) */
chaos_effect = 3;
}
- else if (randint(2) == 1)
+ else if (one_in_(2))
{
/* Teleport away (1.494%) */
chaos_effect = 4;
}
/* Vampiric drain */
- if ((f1 & TR1_VAMPIRIC) || (chaos_effect == 1) || (mode == HISSATSU_DRAIN))
+ if ((have_flag(flgs, TR_VAMPIRIC)) || (chaos_effect == 1) || (mode == HISSATSU_DRAIN))
{
/* Only drain "living" monsters */
if (monster_living(r_ptr))
can_drain = FALSE;
}
- if ((f1 & TR1_VORPAL) && (randint((o_ptr->name1 == ART_VORPAL_BLADE) ? 3 : 6) == 1) && !zantetsu_mukou)
+ if ((have_flag(flgs, TR_VORPAL)) && (randint1(vorpal_chance*3/2) == 1) && !zantetsu_mukou)
vorpal_cut = TRUE;
else vorpal_cut = FALSE;
int min_level = 1;
martial_arts *ma_ptr = &ma_blows[0], *old_ptr = &ma_blows[0];
int resist_stun = 0;
+ int weight = 8;
if (r_ptr->flags1 & RF1_UNIQUE) resist_stun += 88;
if (r_ptr->flags3 & RF3_NO_STUN) resist_stun += 66;
{
do
{
- ma_ptr = &ma_blows[rand_int(MAX_MA)];
+ ma_ptr = &ma_blows[randint0(MAX_MA)];
if ((p_ptr->pclass == CLASS_FORCETRAINER) && (ma_ptr->min_level > 1)) min_level = ma_ptr->min_level + 3;
else min_level = ma_ptr->min_level;
}
while ((min_level > p_ptr->lev) ||
- (randint(p_ptr->lev) < ma_ptr->chance));
+ (randint1(p_ptr->lev) < ma_ptr->chance));
/* keep the highest level attack available we found */
if ((ma_ptr->min_level > old_ptr->min_level) &&
{
old_ptr = ma_ptr;
- if (wizard && cheat_xtra)
+ if (p_ptr->wizard && cheat_xtra)
{
#ifdef JP
msg_print("¹¶·â¤òºÆÁªÂò¤·¤Þ¤·¤¿¡£");
{
if (ma_ptr->effect)
{
- stun_effect = (ma_ptr->effect / 2) + randint(ma_ptr->effect / 2);
+ stun_effect = (ma_ptr->effect / 2) + randint1(ma_ptr->effect / 2);
}
msg_format(ma_ptr->desc, m_name);
}
- k = critical_norm(p_ptr->lev * randint((p_ptr->special_defense & KAMAE_SUZAKU) ? 5 : 10), min_level, k, p_ptr->to_h[0], 0);
+ if (p_ptr->special_defense & KAMAE_SUZAKU) weight = 4;
+ if ((p_ptr->pclass == CLASS_FORCETRAINER) && (p_ptr->magic_num1[0]))
+ {
+ weight += (p_ptr->magic_num1[0]/30);
+ if (weight > 20) weight = 20;
+ }
+
+ k = critical_norm(p_ptr->lev * weight, min_level, k, p_ptr->to_h[0], 0);
if ((special_effect == MA_KNEE) && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
{
msg_format("%^s moans in agony!", m_name);
#endif
- stun_effect = 7 + randint(13);
+ stun_effect = 7 + randint1(13);
resist_stun /= 3;
}
else if ((special_effect == MA_SLOW) && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
{
if (!(r_ptr->flags1 & RF1_UNIQUE) &&
- (randint(p_ptr->lev) > r_ptr->level) &&
+ (randint1(p_ptr->lev) > r_ptr->level) &&
m_ptr->mspeed > 60)
{
#ifdef JP
if (stun_effect && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
{
- if (p_ptr->lev > randint(r_ptr->level + resist_stun + 10))
+ if (p_ptr->lev > randint1(r_ptr->level + resist_stun + 10))
{
if (m_ptr->stunned)
#ifdef JP
/* Handle normal weapon */
else if (o_ptr->k_idx)
{
- k = damroll(o_ptr->dd, o_ptr->ds);
- if (p_ptr->riding)
- {
- if((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
- {
- k += damroll(2, o_ptr->ds);
- }
- }
-
- k = tot_dam_aux(o_ptr, k, m_ptr, mode);
+ k = damroll(o_ptr->dd + p_ptr->to_dd[hand], o_ptr->ds + p_ptr->to_ds[hand]);
+ k = tot_dam_aux(o_ptr, k, m_ptr, mode, FALSE);
if (backstab)
{
k = (3 * k) / 2;
}
- if ((p_ptr->impact[hand] && ((k > 50) || randint(7) == 1)) ||
+ if ((p_ptr->impact[hand] && ((k > 50) || one_in_(7))) ||
(chaos_effect == 2) || (mode == HISSATSU_QUAKE))
{
do_quake = TRUE;
{
int mult = 2;
- int inc_chance = (o_ptr->name1 == ART_VORPAL_BLADE) ? 2 : 4;
-
- if ((o_ptr->name1 == ART_CHAINSWORD) && (randint(2) != 1))
+ if ((o_ptr->name1 == ART_CHAINSWORD) && !one_in_(2))
{
char chainsword_noise[1024];
#ifdef JP
if (o_ptr->name1 == ART_VORPAL_BLADE)
{
#ifdef JP
- msg_print("Ìܤˤâ»ß¤Þ¤é¤Ì¥Ü¡¼¥Ñ¥ë¡¦¥Ö¥ì¡¼¥É¡¢¼êÏ£¤ÎÁá¶È¡ª");
+ msg_print("Ìܤˤâ»ß¤Þ¤é¤Ì¥ô¥©¡¼¥Ñ¥ë¥Ö¥ì¡¼¥É¡¢¼êÏ£¤ÎÁá¶È¡ª");
#else
msg_print("Your Vorpal Blade goes snicker-snack!");
#endif
}
/* Try to increase the damage */
- while (one_in_(inc_chance))
+ while (one_in_(vorpal_chance))
{
mult++;
}
k *= mult;
/* Ouch! */
- if (((r_ptr->flags3 & RF3_RES_ALL) ? k/100 : k) > m_ptr->hp)
+ if (((r_ptr->flagsr & RFR_RES_ALL) ? k/100 : k) > m_ptr->hp)
{
#ifdef JP
msg_format("%s¤ò¿¿¤ÃÆó¤Ä¤Ë¤·¤¿¡ª", m_name);
drain_result += p_ptr->to_d[hand];
if ((mode == HISSATSU_SUTEMI) || (mode == HISSATSU_3DAN)) k *= 2;
- if ((mode == HISSATSU_SEKIRYUKA) && (r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON | RF3_NONLIVING))) k = 0;
+ if ((mode == HISSATSU_SEKIRYUKA) && !monster_living(r_ptr)) k = 0;
if ((mode == HISSATSU_SEKIRYUKA) && !p_ptr->cut) k /= 2;
/* No negative damage */
if (k < 0) k = 0;
- if ((mode == HISSATSU_ZANMA) && !((r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)) && (r_ptr->flags3 & RF3_EVIL)))
+ if ((mode == HISSATSU_ZANMA) && !(!monster_living(r_ptr) && (r_ptr->flags3 & RF3_EVIL)))
{
k = 0;
}
if (mode == HISSATSU_MINEUCHI)
{
- int tmp = (10 + randint(15) + p_ptr->lev / 5);
+ int tmp = (10 + randint1(15) + p_ptr->lev / 5);
k = 0;
anger_monster(m_ptr);
}
/* Modify the damage */
- k = mon_damage_mod(m_ptr, k, (((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE)) || ((p_ptr->pclass == CLASS_BERSERKER) && one_in_(2))));
+ k = mon_damage_mod(m_ptr, k, (bool)(((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE)) || ((p_ptr->pclass == CLASS_BERSERKER) && one_in_(2))));
if (((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) || (mode == HISSATSU_KYUSHO))
{
- if ((randint(randint(r_ptr->level/7)+5) == 1) && !(r_ptr->flags1 & RF1_UNIQUE) && !(r_ptr->flags7 & RF7_UNIQUE2))
+ if ((randint1(randint1(r_ptr->level/7)+5) == 1) && !(r_ptr->flags1 & RF1_UNIQUE) && !(r_ptr->flags7 & RF7_UNIQUE2))
{
k = m_ptr->hp + 1;
#ifdef JP
msg_format("You critically injured %s!", m_name);
#endif
}
- else if (((m_ptr->hp < maxhp/2) && one_in_((p_ptr->num_blow[0]+p_ptr->num_blow[1]+1)*10)) || (((one_in_(666)) || ((backstab || fuiuchi) && one_in_(11))) && !(r_ptr->flags1 & RF1_UNIQUE) && !(r_ptr->flags7 & RF7_UNIQUE2)))
+ else if (((m_ptr->hp < maxhp/2) && one_in_((p_ptr->num_blow[0]+p_ptr->num_blow[1]+1)*10)) || ((one_in_(666) || ((backstab || fuiuchi) && one_in_(11))) && !(r_ptr->flags1 & RF1_UNIQUE) && !(r_ptr->flags7 & RF7_UNIQUE2)))
{
if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE2) || (m_ptr->hp >= maxhp/2))
{
}
/* Complex message */
- if (wizard || cheat_xtra)
+ if (p_ptr->wizard || cheat_xtra)
{
#ifdef JP
msg_format("%d/%d ¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£", k, m_ptr->hp);
if (k <= 0) can_drain = FALSE;
if (drain_result > m_ptr->hp)
- drain_result = m_ptr->hp;
+ drain_result = m_ptr->hp;
/* Damage, check for fear and death */
if (mon_take_hit(c_ptr->m_idx, k, fear, NULL))
}
m_ptr->maxhp -= (k+7)/8;
if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
-#ifdef JP
- msg_format("%s¤Ï¼å¤¯¤Ê¤Ã¤¿¤è¤¦¤À¡£", m_name);
-#else
- msg_format("%^s seems weakened.", m_name);
-#endif
+ weak = TRUE;
}
can_drain = FALSE;
drain_result = 0;
/* Confuse the monster */
if (r_ptr->flags3 & RF3_NO_CONF)
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags3 |= RF3_NO_CONF;
}
#endif
}
- else if (rand_int(100) < r_ptr->level)
+ else if (randint0(100) < r_ptr->level)
{
#ifdef JP
msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
msg_format("%^s appears confused.", m_name);
#endif
- m_ptr->confused += 10 + rand_int(p_ptr->lev) / 5;
+ m_ptr->confused += 10 + randint0(p_ptr->lev) / 5;
}
}
{
bool resists_tele = FALSE;
- if (r_ptr->flags3 & RF3_RES_TELE)
+ if (r_ptr->flagsr & RFR_RES_TELE)
{
if (r_ptr->flags1 & RF1_UNIQUE)
{
- if (m_ptr->ml) r_ptr->r_flags3 |= RF3_RES_TELE;
+ if (m_ptr->ml && is_original_ap(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
#ifdef JP
- msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
+ msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
#else
msg_format("%^s is unaffected!", m_name);
#endif
resists_tele = TRUE;
}
- else if (r_ptr->level > randint(100))
+ else if (r_ptr->level > randint1(100))
{
- if (m_ptr->ml) r_ptr->r_flags3 |= RF3_RES_TELE;
+ if (m_ptr->ml && is_original_ap(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
#ifdef JP
msg_format("%^s¤ÏÄñ¹³ÎϤò»ý¤Ã¤Æ¤¤¤ë¡ª", m_name);
#else
#endif
teleport_away(c_ptr->m_idx, 50, FALSE);
- num = p_ptr->num_blow[hand] + 1; /* Can't hit it anymore! */
+ num = num_blow + 1; /* Can't hit it anymore! */
*mdeath = TRUE;
}
}
else if ((chaos_effect == 5) && cave_floor_bold(y, x) &&
- (randint(90) > r_ptr->level))
+ (randint1(90) > r_ptr->level))
{
- if (!(r_ptr->flags1 & RF1_UNIQUE) &&
- !(r_ptr->flags4 & RF4_BR_CHAO) &&
- !(r_ptr->flags1 & RF1_QUESTOR))
+ if (!(r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) &&
+ !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
{
if (polymorph_monster(y, x))
{
r_ptr = &r_info[m_ptr->r_idx];
*fear = FALSE;
+ weak = FALSE;
}
else
{
#ifdef JP
- msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
+ msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
#else
msg_format("%^s is unaffected.", m_name);
#endif
object_desc(o_name, q_ptr, TRUE, 0);
q_ptr->held_m_idx = 0;
- q_ptr->marked = FALSE;
+ q_ptr->marked = 0;
m_ptr->hold_o_idx = q_ptr->next_o_idx;
q_ptr->next_o_idx = 0;
#ifdef JP
backstab = FALSE; /* Clumsy! */
fuiuchi = FALSE; /* Clumsy! */
- if ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE) && (randint(3) == 1))
+ if ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE) && one_in_(3))
{
- u32b f1, f2, f3;
+ u32b flgs[TR_FLAG_SIZE];
/* Sound */
sound(SOUND_HIT);
#endif
/* Extract the flags */
- object_flags(o_ptr, &f1, &f2, &f3);
+ object_flags(o_ptr, flgs);
k = damroll(o_ptr->dd, o_ptr->ds);
{
{
case RACE_YEEK:
case RACE_KLACKON:
- mult = 2;break;
+ case RACE_HUMAN:
+ case RACE_AMBERITE:
+ case RACE_DUNADAN:
+ mult = 25;break;
case RACE_HALF_ORC:
case RACE_HALF_TROLL:
case RACE_HALF_OGRE:
case RACE_HALF_TITAN:
case RACE_CYCLOPS:
case RACE_IMP:
- case RACE_GOLEM:
case RACE_SKELETON:
case RACE_ZOMBIE:
case RACE_VAMPIRE:
case RACE_SPECTRE:
case RACE_DEMON:
- mult = 3;break;
case RACE_DRACONIAN:
- mult = 5;break;
+ mult = 30;break;
default:
- mult = 1;break;
+ mult = 10;break;
}
break;
case MIMIC_DEMON:
case MIMIC_DEMON_LORD:
case MIMIC_VAMPIRE:
- mult = 3;break;
+ mult = 30;break;
default:
- mult = 1;break;
+ mult = 10;break;
}
- if (p_ptr->align < 0 && mult < 2)
- mult = 2;
- if (!(p_ptr->resist_acid || p_ptr->oppose_acid) && (mult < 3))
- mult = mult * 5 / 2;
- if (!(p_ptr->resist_elec || p_ptr->oppose_elec) && (mult < 3))
- mult = mult * 5 / 2;
- if (!(p_ptr->resist_fire || p_ptr->oppose_fire) && (mult < 3))
- mult = mult * 5 / 2;
- if (!(p_ptr->resist_cold || p_ptr->oppose_cold) && (mult < 3))
- mult = mult * 5 / 2;
- if (!(p_ptr->resist_pois || p_ptr->oppose_pois) && (mult < 3))
- mult = mult * 5 / 2;
-
- if ((p_ptr->pclass != CLASS_SAMURAI) && (f1 & TR1_FORCE_WEPON) && (p_ptr->csp > (p_ptr->msp / 30)))
+ if (p_ptr->align < 0 && mult < 20)
+ mult = 20;
+ if (!(p_ptr->resist_acid || IS_OPPOSE_ACID() || p_ptr->immune_acid) && (mult < 25))
+ mult = 25;
+ if (!(p_ptr->resist_elec || IS_OPPOSE_ELEC() || p_ptr->immune_elec) && (mult < 25))
+ mult = 25;
+ if (!(p_ptr->resist_fire || IS_OPPOSE_FIRE() || p_ptr->immune_fire) && (mult < 25))
+ mult = 25;
+ if (!(p_ptr->resist_cold || IS_OPPOSE_COLD() || p_ptr->immune_cold) && (mult < 25))
+ mult = 25;
+ if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()) && (mult < 25))
+ mult = 25;
+
+ if ((p_ptr->pclass != CLASS_SAMURAI) && (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);
- mult = mult * 7 / 2;
+ mult = mult * 3 / 2 + 20;
}
k *= mult;
+ k /= 10;
}
k = critical_norm(o_ptr->weight, o_ptr->to_h, k, p_ptr->to_h[hand], mode);
- if (randint(6) == 1)
+ if (one_in_(6))
{
int mult = 2;
#ifdef JP
}
k += (p_ptr->to_d[hand] + o_ptr->to_d);
+ if (k < 0) k = 0;
+
#ifdef JP
take_hit(DAMAGE_FORCE, k, "»à¤ÎÂç³ù", -1);
#else
}
+ if (weak && !(*mdeath))
+ {
+#ifdef JP
+ msg_format("%s¤Ï¼å¤¯¤Ê¤Ã¤¿¤è¤¦¤À¡£", m_name);
+#else
+ msg_format("%^s seems weakened.", m_name);
+#endif
+ }
if (drain_left != MAX_VAMPIRIC_DRAIN)
{
- if (randint(4)==1)
+ if (one_in_(4))
{
chg_virtue(V_UNLIFE, 1);
}
monster_desc(m_name, m_ptr, 0);
/* Auto-Recall if possible and visible */
- if (m_ptr->ml) monster_race_track((m_ptr->mflag2 & MFLAG_KAGE), m_ptr->r_idx);
+ if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
/* Track a new monster */
if (m_ptr->ml) health_track(c_ptr->m_idx);
!(p_ptr->stun || p_ptr->confused || p_ptr->image ||
p_ptr->shero || !m_ptr->ml))
{
- if (inventory[INVEN_RARM].art_name)
- {
- if (inventory[INVEN_RARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
- }
- if (inventory[INVEN_LARM].art_name)
- {
- if (inventory[INVEN_LARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
- }
+ if (inventory[INVEN_RARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
+ if (inventory[INVEN_LARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
if (stormbringer)
{
#ifdef JP
if (p_ptr->migite && p_ptr->hidarite)
{
- if ((skill_exp[GINOU_NITOURYU] < skill_exp_settei[p_ptr->pclass][GINOU_NITOURYU][1]) && ((skill_exp[GINOU_NITOURYU] - 1000) / 200 < r_info[m_ptr->r_idx].level))
+ if ((p_ptr->skill_exp[GINOU_NITOURYU] < s_info[p_ptr->pclass].s_max[GINOU_NITOURYU]) && ((p_ptr->skill_exp[GINOU_NITOURYU] - 1000) / 200 < r_info[m_ptr->r_idx].level))
{
- if (skill_exp[GINOU_NITOURYU] < 4000)
- skill_exp[GINOU_NITOURYU]+=80;
- else if(skill_exp[GINOU_NITOURYU] < 6000)
- skill_exp[GINOU_NITOURYU]+=4;
- else if(skill_exp[GINOU_NITOURYU] < 7000)
- skill_exp[GINOU_NITOURYU]+=1;
- else if(skill_exp[GINOU_NITOURYU] < 8000)
- if (one_in_(3)) skill_exp[GINOU_NITOURYU]+=1;
+ if (p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_BEGINNER)
+ p_ptr->skill_exp[GINOU_NITOURYU] += 80;
+ else if(p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_SKILLED)
+ p_ptr->skill_exp[GINOU_NITOURYU] += 4;
+ else if(p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_EXPERT)
+ p_ptr->skill_exp[GINOU_NITOURYU] += 1;
+ else if(p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_MASTER)
+ if (one_in_(3)) p_ptr->skill_exp[GINOU_NITOURYU] += 1;
p_ptr->update |= (PU_BONUS);
}
}
+ /* Gain riding experience */
if (p_ptr->riding)
{
- int ridinglevel = r_info[m_list[p_ptr->riding].r_idx].level;
- if ((skill_exp[GINOU_RIDING] < skill_exp_settei[p_ptr->pclass][GINOU_RIDING][1]) && ((skill_exp[GINOU_RIDING] - 1000) / 200 < r_info[m_ptr->r_idx].level) && (skill_exp[GINOU_RIDING]/100 - 2000 < ridinglevel))
- skill_exp[GINOU_RIDING]++;
- if ((skill_exp[GINOU_RIDING] < skill_exp_settei[p_ptr->pclass][GINOU_RIDING][1]) && (skill_exp[GINOU_RIDING]/100 < ridinglevel))
+ int cur = p_ptr->skill_exp[GINOU_RIDING];
+ int max = s_info[p_ptr->pclass].s_max[GINOU_RIDING];
+
+ if (cur < max)
{
- if (ridinglevel*100 > (skill_exp[GINOU_RIDING] + 1500))
- skill_exp[GINOU_RIDING] += (1+(ridinglevel - skill_exp[GINOU_RIDING]/100 - 15));
- else skill_exp[GINOU_RIDING]++;
+ int ridinglevel = r_info[m_list[p_ptr->riding].r_idx].level;
+ int targetlevel = r_info[m_ptr->r_idx].level;
+ int inc = 0;
+
+ if ((cur / 200 - 5) < targetlevel)
+ inc += 1;
+
+ /* Extra experience */
+ if ((cur / 100) < ridinglevel)
+ {
+ if ((cur / 100 + 15) < ridinglevel)
+ inc += 1 + (ridinglevel - (cur / 100 + 15));
+ else
+ inc += 1;
+ }
+
+ p_ptr->skill_exp[GINOU_RIDING] = MIN(max, cur + inc);
+
+ p_ptr->update |= (PU_BONUS);
}
- p_ptr->update |= (PU_BONUS);
}
riding_t_m_idx = c_ptr->m_idx;
return TRUE;
}
else if ((cave[n_y][n_x].feat == FEAT_PATTERN_OLD) ||
- (cave[n_y][n_x].feat == FEAT_PATTERN_END) ||
- (cave[n_y][n_x].feat == FEAT_PATTERN_XTRA2))
+ (cave[n_y][n_x].feat == FEAT_PATTERN_END) ||
+ (cave[n_y][n_x].feat == FEAT_PATTERN_XTRA2))
{
if (pattern_tile(c_y, c_x))
{
}
}
else if ((cave[n_y][n_x].feat == FEAT_PATTERN_XTRA1) ||
- (cave[c_y][c_x].feat == FEAT_PATTERN_XTRA1))
+ (cave[c_y][c_x].feat == FEAT_PATTERN_XTRA1))
{
return TRUE;
}
}
}
else if ((cave[c_y][c_x].feat == FEAT_PATTERN_OLD) ||
- (cave[c_y][c_x].feat == FEAT_PATTERN_END) ||
- (cave[c_y][c_x].feat == FEAT_PATTERN_XTRA2))
+ (cave[c_y][c_x].feat == FEAT_PATTERN_END) ||
+ (cave[c_y][c_x].feat == FEAT_PATTERN_XTRA2))
{
if (!pattern_tile(n_y, n_x))
{
ok_move = FEAT_PATTERN_1;
break;
default:
- if (wizard)
+ if (p_ptr->wizard)
#ifdef JP
- msg_format("¤ª¤«¤·¤Ê¥Ñ¥¿¡¼¥óÊâ¹Ô¡¢%d¡£", cave[c_y][c_x]);
+ msg_format("¤ª¤«¤·¤Ê¥Ñ¥¿¡¼¥óÊâ¹Ô¡¢%d¡£", cave[c_y][c_x].feat);
#else
- msg_format("Funny Pattern walking, %d.", cave[c_y][c_x]);
+ msg_format("Funny Pattern walking, %d.", cave[c_y][c_x].feat);
#endif
return TRUE; /* Goof-up */
bool player_can_enter(byte feature)
{
- bool pass_wall;
-
- /* Player can not walk through "walls" unless in Shadow Form */
- if (p_ptr->wraith_form || p_ptr->pass_wall || p_ptr->kabenuke)
- pass_wall = TRUE;
- else
- pass_wall = FALSE;
-
switch (feature)
{
- case FEAT_DEEP_WATER:
- case FEAT_SHAL_LAVA:
- case FEAT_DEEP_LAVA:
- return (TRUE);
-
- case FEAT_DARK_PIT:
- {
- if (p_ptr->ffall)
- return (TRUE);
- else
- return (FALSE);
- }
-
- case FEAT_TREES:
- {
- return (TRUE);
- }
+ case FEAT_DOOR_HEAD: /* Nasty hack -- Doors */
+ case FEAT_DOOR_HEAD + 0x01:
+ case FEAT_DOOR_HEAD + 0x02:
+ case FEAT_DOOR_HEAD + 0x03:
+ case FEAT_DOOR_HEAD + 0x04:
+ case FEAT_DOOR_HEAD + 0x05:
+ case FEAT_DOOR_HEAD + 0x06:
+ case FEAT_DOOR_HEAD + 0x07:
+ case FEAT_DOOR_HEAD + 0x08:
+ case FEAT_DOOR_HEAD + 0x09:
+ case FEAT_DOOR_HEAD + 0x0a:
+ case FEAT_DOOR_HEAD + 0x0b:
+ case FEAT_DOOR_HEAD + 0x0c:
+ case FEAT_DOOR_HEAD + 0x0d:
+ case FEAT_DOOR_HEAD + 0x0e:
+ case FEAT_DOOR_TAIL: /* Equals FEAT_DOOR_HEAD + 0x0f */
+ case FEAT_SECRET:
+ case FEAT_RUBBLE:
+ case FEAT_MAGMA:
+ case FEAT_QUARTZ:
+ case FEAT_MAGMA_H:
+ case FEAT_QUARTZ_H:
+ case FEAT_MAGMA_K:
+ case FEAT_QUARTZ_K:
+ case FEAT_WALL_EXTRA:
+ case FEAT_WALL_INNER:
+ case FEAT_WALL_OUTER:
+ case FEAT_WALL_SOLID:
+ /* Player can not walk through "walls" unless in Shadow Form */
+ return p_ptr->wraith_form || p_ptr->pass_wall || p_ptr->kabenuke;
+
+ case FEAT_PERM_EXTRA:
+ case FEAT_PERM_INNER:
+ case FEAT_PERM_OUTER:
+ case FEAT_PERM_SOLID:
+ case FEAT_PATTERN_START:
+ case FEAT_PATTERN_1:
+ case FEAT_PATTERN_2:
+ case FEAT_PATTERN_3:
+ case FEAT_PATTERN_4:
+ case FEAT_PATTERN_END:
+ case FEAT_PATTERN_OLD:
+ case FEAT_PATTERN_XTRA1:
+ case FEAT_PATTERN_XTRA2:
+ return FALSE;
- case FEAT_RUBBLE:
- case FEAT_MAGMA:
- case FEAT_QUARTZ:
- case FEAT_MAGMA_H:
- case FEAT_QUARTZ_H:
- case FEAT_MAGMA_K:
- case FEAT_QUARTZ_K:
- case FEAT_WALL_EXTRA:
- case FEAT_WALL_INNER:
- case FEAT_WALL_OUTER:
- case FEAT_WALL_SOLID:
- {
- return (pass_wall);
- }
+ case FEAT_DARK_PIT:
+ return p_ptr->ffall;
- case FEAT_MOUNTAIN:
- {
- return (!dun_level && p_ptr->ffall);
- }
- case FEAT_PERM_EXTRA:
- case FEAT_PERM_INNER:
- case FEAT_PERM_OUTER:
- case FEAT_PERM_SOLID:
- {
- return (FALSE);
- }
+ case FEAT_MOUNTAIN:
+ return !dun_level && p_ptr->ffall;
}
- return (TRUE);
+ /* Assume okay */
+ return TRUE;
}
/* Examine the destination */
c_ptr = &cave[y][x];
-
/* Exit the area */
if (!dun_level && !p_ptr->wild_mode &&
((x == 0) || (x == MAX_WID - 1) ||
p_ptr->wilderness_x--;
p_ptr->oldpy = cur_hgt - 2;
p_ptr->oldpx = cur_wid - 2;
- ambush_flag = FALSE;
+ ambush_flag = FALSE;
}
else if ((y == 0) && (x == MAX_WID - 1))
p_ptr->wilderness_x++;
p_ptr->oldpy = cur_hgt - 2;
p_ptr->oldpx = 1;
- ambush_flag = FALSE;
+ ambush_flag = FALSE;
}
else if ((y == MAX_HGT - 1) && (x == 0))
p_ptr->wilderness_x--;
p_ptr->oldpy = 1;
p_ptr->oldpx = cur_wid - 2;
- ambush_flag = FALSE;
+ ambush_flag = FALSE;
}
else if ((y == MAX_HGT - 1) && (x == MAX_WID - 1))
p_ptr->wilderness_x++;
p_ptr->oldpy = 1;
p_ptr->oldpx = 1;
- ambush_flag = FALSE;
+ ambush_flag = FALSE;
}
else if (y == 0)
p_ptr->wilderness_y--;
p_ptr->oldpy = cur_hgt - 2;
p_ptr->oldpx = x;
- ambush_flag = FALSE;
+ ambush_flag = FALSE;
}
else if (y == MAX_HGT - 1)
p_ptr->wilderness_y++;
p_ptr->oldpy = 1;
p_ptr->oldpx = x;
- ambush_flag = FALSE;
+ ambush_flag = FALSE;
}
else if (x == 0)
p_ptr->wilderness_x--;
p_ptr->oldpx = cur_wid - 2;
p_ptr->oldpy = y;
- ambush_flag = FALSE;
+ ambush_flag = FALSE;
}
else if (x == MAX_WID - 1)
p_ptr->wilderness_x++;
p_ptr->oldpx = 1;
p_ptr->oldpy = y;
- ambush_flag = FALSE;
+ ambush_flag = FALSE;
}
p_ptr->leftbldg = TRUE;
m_ptr = &m_list[c_ptr->m_idx];
- if (inventory[INVEN_RARM].art_name)
- {
- if (inventory[INVEN_RARM].name1 == ART_STORMBRINGER)
- stormbringer = TRUE;
- }
- else if (inventory[INVEN_LARM].art_name)
- {
- if (inventory[INVEN_LARM].name1 == ART_STORMBRINGER)
- stormbringer = TRUE;
- }
+ if (inventory[INVEN_RARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
+ if (inventory[INVEN_LARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
/* Player can not walk through "walls"... */
/* unless in Shadow Form */
monster_desc(m_name, m_ptr, 0);
/* Auto-Recall if possible and visible */
- if (m_ptr->ml) monster_race_track((m_ptr->mflag2 & MFLAG_KAGE), m_ptr->r_idx);
+ if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
/* Track a new monster */
if (m_ptr->ml) health_track(c_ptr->m_idx);
/* displace? */
- if ((stormbringer && (randint(1000) > 666)) || (p_ptr->pclass == CLASS_BERSERKER))
+ if ((stormbringer && (randint1(1000) > 666)) || (p_ptr->pclass == CLASS_BERSERKER))
{
py_attack(y, x, 0);
oktomove = FALSE;
#ifdef ALLOW_EASY_DISARM /* TNB */
/* Disarm a visible trap */
- else if ((do_pickup != easy_disarm) && is_trap(c_ptr->feat))
+ else if ((do_pickup != easy_disarm) && is_known_trap(c_ptr))
{
bool ignore = FALSE;
switch (c_ptr->feat)
disturb(0, 0);
}
- else if ((p_ptr->riding && !(r_info[m_list[p_ptr->riding].r_idx].flags7 & (RF7_CAN_FLY)) && !(r_info[m_list[p_ptr->riding].r_idx].flags3 & (RF3_IM_FIRE))) && ((c_ptr->feat == FEAT_SHAL_LAVA) || (c_ptr->feat == FEAT_DEEP_LAVA)))
+ else if ((p_ptr->riding && !(r_info[m_list[p_ptr->riding].r_idx].flags7 & (RF7_CAN_FLY)) && !(r_info[m_list[p_ptr->riding].r_idx].flagsr & RFR_EFF_IM_FIRE_MASK)) && ((c_ptr->feat == FEAT_SHAL_LAVA) || (c_ptr->feat == FEAT_DEEP_LAVA)))
{
#ifdef JP
msg_print("ÍÏ´ä¤Î¾å¤Ë¹Ô¤±¤Ê¤¤¡£");
else if ((!cave_floor_bold(y, x)) &&
(!p_can_pass_walls))
{
+ byte feat;
+
oktomove = FALSE;
+ /* Feature code (applying "mimic" field) */
+ feat = c_ptr->mimic ? f_info[c_ptr->mimic].mimic : f_info[c_ptr->feat].mimic;
+
/* Disturb the player */
disturb(0, 0);
(p_ptr->blind || !(c_ptr->info & (CAVE_LITE))))
{
/* Rubble */
- if (c_ptr->feat == FEAT_RUBBLE)
+ if (feat == FEAT_RUBBLE)
{
#ifdef JP
- msg_print("´äÀФ¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£");
+ msg_print("´äÀФ¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£");
#else
msg_print("You feel some rubble blocking your way.");
#endif
}
/* Closed door */
- else if (c_ptr->feat < FEAT_SECRET)
+ else if (is_closed_door(feat))
{
#ifdef JP
- msg_print("¥É¥¢¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£");
+ msg_print("¥É¥¢¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£");
#else
msg_print("You feel a closed door blocking your way.");
#endif
lite_spot(y, x);
}
+ /* Boundary floor mimic */
+ else if (boundary_floor_grid(c_ptr))
+ {
+#ifdef JP
+ msg_print("¤½¤ì°Ê¾åÀè¤Ë¤Ï¿Ê¤á¤Ê¤¤¤è¤¦¤À¡£");
+#else
+ msg_print("You feel you cannot go any more.");
+#endif
+ }
+
/* Wall (or secret door) */
else
{
#ifdef JP
- msg_print("Êɤ¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£");
+ msg_format("%s¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£", (feat == FEAT_TREES) ? "ÌÚ" : "ÊÉ");
#else
- msg_print("You feel a wall blocking your way.");
+ msg_format("You feel a %s blocking your way.", (feat == FEAT_TREES) ? "tree" : "wall");
#endif
c_ptr->info |= (CAVE_MARK);
else
{
/* Rubble */
- if (c_ptr->feat == FEAT_RUBBLE)
+ if (feat == FEAT_RUBBLE)
{
#ifdef JP
msg_print("´äÀФ¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¡£");
msg_print("There is rubble blocking your way.");
#endif
-
if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
energy_use = 0;
*/
}
/* Closed doors */
- else if (c_ptr->feat < FEAT_SECRET)
+ else if (is_closed_door(feat))
{
#ifdef ALLOW_EASY_OPEN
msg_print("There is a closed door blocking your way.");
#endif
+ if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
+ energy_use = 0;
+ }
+
+ /* Boundary floor mimic */
+ else if (boundary_floor_grid(c_ptr))
+ {
+#ifdef JP
+ msg_print("¤½¤ì°Ê¾åÀè¤Ë¤Ï¿Ê¤á¤Ê¤¤¡£");
+#else
+ msg_print("You cannot go any more.");
+#endif
if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
energy_use = 0;
else
{
#ifdef JP
- msg_print("Êɤ¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¡£");
+ msg_format("%s¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¡£", (feat == FEAT_TREES) ? "ÌÚ" : "ÊÉ");
#else
- msg_print("There is a wall blocking your way.");
+ msg_format("There is a %s blocking your way.", (feat == FEAT_TREES) ? "tree" : "wall");
#endif
-
if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
energy_use = 0;
}
}
/* Sound */
- sound(SOUND_HITWALL);
+ if (!boundary_floor_grid(c_ptr)) sound(SOUND_HITWALL);
}
/* Normal movement */
{
int oy, ox;
-#ifdef USE_SCRIPT
- if (player_enter_grid_callback(y, x)) return;
-
- /* Player movement callback */
- if (player_move_callback(y, x)) return;
-#endif /* USE_SCRIPT */
-
-#ifdef USE_FRAKIR
- if (p_ptr->warning)
- {
- if(!process_frakir(x,y))
- {
- energy_use = 25;return;
- }
- }
-#endif
+ if (p_ptr->warning)
+ {
+ if(!process_warning(x, y))
+ {
+ energy_use = 25;
+ return;
+ }
+ }
if (do_past)
{
msg_format("You push past %s.", m_name);
#endif
- m_ptr->fy = (byte)py;
- m_ptr->fx = (byte)px;
+ m_ptr->fy = py;
+ m_ptr->fx = px;
cave[py][px].m_idx = c_ptr->m_idx;
c_ptr->m_idx = 0;
update_mon(cave[py][px].m_idx, TRUE);
if (p_ptr->riding && (r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_KILL_WALL))
{
- if (cave[py][px].feat > FEAT_SECRET && cave[py][px].feat < FEAT_PERM_SOLID)
+ if (cave[py][px].feat >= FEAT_RUBBLE && cave[py][px].feat < FEAT_PERM_SOLID)
{
/* Forget the wall */
cave[py][px].info &= ~(CAVE_MARK);
/* Notice */
- cave_set_feat(py, px, floor_type[rand_int(100)]);
+ cave_set_feat(py, px, floor_type[randint0(100)]);
}
}
if (music_singing(MUSIC_WALL))
if (cave[py][px].feat == FEAT_TREES)
cave_set_feat(py, px, FEAT_GRASS);
else
- {
- cave[py][px].feat = floor_type[rand_int(100)];
- cave[py][px].info &= ~(CAVE_MASK);
- cave[py][px].info |= CAVE_FLOOR;
- }
+ cave_set_feat(py, px, floor_type[randint0(100)]);
}
/* Update some things -- similar to GF_KILL_WALL */
p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
}
+ /* Remove "unsafe" flag */
+ if ((!p_ptr->blind && !no_lite()) || !is_trap(c_ptr->feat)) c_ptr->info &= ~(CAVE_UNSAFE);
+
/* Redraw new spot */
lite_spot(py, px);
/* Check for new panel (redraw map) */
verify_panel();
- /* For get everything when requested hehe I'm *NASTY* */
- if (dun_level && (d_info[dungeon_type].flags1 & DF1_FORGET))
- {
- wiz_dark();
- }
+ /* For get everything when requested hehe I'm *NASTY* */
+ if (dun_level && (d_info[dungeon_type].flags1 & DF1_FORGET))
+ {
+ wiz_dark();
+ }
if ((p_ptr->pclass == CLASS_NINJA))
{
/* Spontaneous Searching */
if ((p_ptr->skill_fos >= 50) ||
- (0 == rand_int(50 - p_ptr->skill_fos)))
+ (0 == randint0(50 - p_ptr->skill_fos)))
{
search();
}
energy_use = 0;
/* Hack -- Enter store */
- command_new = '_';
+ command_new = SPECIAL_KEY_STORE;
}
/* Handle "building doors" -KMW- */
energy_use = 0;
/* Hack -- Enter building */
- command_new = ']';
+ command_new = SPECIAL_KEY_BUILDING;
}
/* Handle quest areas -KMW- */
energy_use = 0;
/* Hack -- Enter quest level */
-// command_new = '[';
- command_new = 255;
+ command_new = SPECIAL_KEY_QUEST;
}
else if (cave[y][x].feat == FEAT_QUEST_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 = p_ptr->lev;
+ quest[p_ptr->inside_quest].complev = (byte)p_ptr->lev;
#ifdef JP
msg_print("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª");
#else
msg_print(NULL);
}
- leaving_quest = p_ptr->inside_quest;
-
- /* Leaving an 'only once' quest marks it as failed */
- if (leaving_quest &&
- ((quest[leaving_quest].flags & QUEST_FLAG_ONCE) || (quest[leaving_quest].type == QUEST_TYPE_RANDOM)) &&
- (quest[leaving_quest].status == QUEST_STATUS_TAKEN))
- {
- if ((quest[leaving_quest].type == QUEST_TYPE_RANDOM) && record_rand_quest)
- do_cmd_write_nikki(NIKKI_RAND_QUEST_F, leaving_quest, NULL);
- else if (record_fix_quest)
- do_cmd_write_nikki(NIKKI_FIX_QUEST_F, leaving_quest, NULL);
- quest[leaving_quest].status = QUEST_STATUS_FAILED;
- quest[leaving_quest].complev = p_ptr->lev;
- if (quest[leaving_quest].type == QUEST_TYPE_RANDOM)
- r_info[quest[leaving_quest].r_idx].flags1 &= ~(RF1_QUESTOR);
- }
+ leave_quest_check();
p_ptr->inside_quest = cave[y][x].special;
dun_level = 0;
p_ptr->leaving = TRUE;
}
- /* Discover invisible traps */
- else if (c_ptr->info & CAVE_TRAP)
+ /* Set off a trap */
+ else if (is_trap(c_ptr->feat))
{
/* Disturb */
disturb(0, 0);
- /* Message */
+ /* Hidden trap */
+ if (c_ptr->mimic)
+ {
+ /* Message */
#ifdef JP
- msg_print("¥È¥é¥Ã¥×¤À¡ª");
+ msg_print("¥È¥é¥Ã¥×¤À¡ª");
#else
- msg_print("You found a trap!");
+ msg_print("You found a trap!");
#endif
-
- /* Pick a trap */
- pick_trap(py, px);
+ /* Pick a trap */
+ disclose_grid(py, px);
+ }
/* Hit the trap */
hit_trap(break_trap);
}
- /* Set off an visible trap */
- else if (is_trap(c_ptr->feat))
+ /* Warn when leaving trap detected region */
+ if ((disturb_trap_detect || alert_trap_detect)
+ && p_ptr->dtrap && !(cave[py][px].info & CAVE_IN_DETECT))
{
- /* Disturb */
- disturb(0, 0);
+ /* No duplicate warning */
+ p_ptr->dtrap = FALSE;
- /* Hit the trap */
- hit_trap(break_trap);
+ /* You are just on the edge */
+ if (!(cave[py][px].info & CAVE_UNSAFE))
+ {
+ if (alert_trap_detect)
+ {
+#ifdef JP
+ msg_print("* Ãí°Õ:¤³¤ÎÀè¤Ï¥È¥é¥Ã¥×¤Î´¶ÃÎÈϰϳ°¤Ç¤¹¡ª *");
+#else
+ msg_print("*Leaving trap detect region!*");
+#endif
+ }
+
+ if (disturb_trap_detect)
+ {
+ disturb(0, 0);
+ }
+ }
}
}
+
if (p_ptr->riding)
{
m_list[p_ptr->riding].fy = py;
*/
static int see_wall(int dir, int y, int x)
{
+ cave_type *c_ptr;
+ byte feat;
+
/* Get the new location */
y += ddy[dir];
x += ddx[dir];
/* Illegal grids are not known walls */
if (!in_bounds2(y, x)) return (FALSE);
- /* Non-wall grids are not known walls */
- if (cave[y][x].feat < FEAT_SECRET) return (FALSE);
-
- if ((cave[y][x].feat >= FEAT_DEEP_WATER) &&
- (cave[y][x].feat <= FEAT_GRASS)) return (FALSE);
-
- if ((cave[y][x].feat >= FEAT_SHOP_HEAD) &&
- (cave[y][x].feat <= FEAT_SHOP_TAIL)) return (FALSE);
-
- if (cave[y][x].feat == FEAT_DEEP_GRASS) return (FALSE);
- if (cave[y][x].feat == FEAT_FLOWER) return (FALSE);
-
- if (cave[y][x].feat == FEAT_MUSEUM) return (FALSE);
-
- if ((cave[y][x].feat >= FEAT_BLDG_HEAD) &&
- (cave[y][x].feat <= FEAT_BLDG_TAIL)) return (FALSE);
+ /* Access grid */
+ c_ptr = &cave[y][x];
-// if (cave[y][x].feat == FEAT_TREES) return (FALSE);
+ /* Feature code (applying "mimic" field) */
+ feat = c_ptr->mimic ? f_info[c_ptr->mimic].mimic : f_info[c_ptr->feat].mimic;
/* Must be known to the player */
- if (!(cave[y][x].info & (CAVE_MARK))) return (FALSE);
+ if (c_ptr->info & (CAVE_MARK))
+ {
+ /* Rubble, Magma, Quartz, Wall, Perm wall */
+ if (feat >= FEAT_RUBBLE && feat <= FEAT_PERM_SOLID) return TRUE;
- if (cave[y][x].feat >= FEAT_TOWN) return (FALSE);
+ /* Tree */
+ if (feat == FEAT_TREES) return TRUE;
- /* Default */
- return (TRUE);
+ /* Mountain */
+ if (feat == FEAT_MOUNTAIN) return TRUE;
+ }
+
+ return FALSE;
}
* stop at 1. Another run right and down will enter the corridor
* and make the corner, stopping at the 2.
*
- * #@x 1
+ * ##################
+ * o@x 1
* ########### ######
- * 2 #
+ * #2 #
* #############
- * #
*
* After any move, the function area_affect is called to
* determine the new surroundings, and the direction of
* respectively) to which you were not previously adjacent,
* marked as '!' in the diagrams below.
*
- * ...! ...
- * .o@! .o.!
- * ...! ..@!
- * !!!
+ * ...! ...
+ * .o@! (normal) .o.! (diagonal)
+ * ...! (east) ..@! (south east)
+ * !!!
*
* You STOP if any of the new squares are interesting in any way:
* for example, if they contain visible monsters or treasure.
* We assign "option" to the straight-on grid, and "option2" to the
* diagonal grid, and "check_dir" to the grid marked 's'.
*
- * .s
+ * ##s
* @x?
- * #?
+ * #.?
*
- * If they are both seen to be closed, then it is seen that no
- * benefit is gained from moving straight. It is a known corner.
- * To cut the corner, go diagonally, otherwise go straight, but
- * pretend you stepped diagonally into that next location for a
- * full view next time. Conversely, if one of the ? squares is
- * not seen to be closed, then there is a potential choice. We check
- * to see whether it is a potential corner or an intersection/room entrance.
- * If the square two spaces straight ahead, and the space marked with 's'
- * are both blank, then it is a potential corner and enter if find_examine
- * is set, otherwise must stop because it is not a corner.
+ * If they are both seen to be closed, then it is seen that no benefit
+ * is gained from moving straight. It is a known corner. To cut the
+ * corner, go diagonally, otherwise go straight, but pretend you
+ * stepped diagonally into that next location for a full view next
+ * time. Conversely, if one of the ? squares is not seen to be closed,
+ * then there is a potential choice. We check to see whether it is a
+ * potential corner or an intersection/room entrance. If the square
+ * two spaces straight ahead, and the space marked with 's' are both
+ * unknown space, then it is a potential corner and enter if
+ * find_examine is set, otherwise must stop because it is not a
+ * corner.
*/
int i, max, inv;
int option = 0, option2 = 0;
cave_type *c_ptr;
+ byte feat;
/* Where we came from */
prev_dir = find_prevdir;
/* Range of newly adjacent grids */
max = (prev_dir & 0x01) + 1;
+ /* break run when leaving trap detected region */
+ if ((disturb_trap_detect || alert_trap_detect)
+ && p_ptr->dtrap && !(cave[py][px].info & CAVE_IN_DETECT))
+ {
+ /* No duplicate warning */
+ p_ptr->dtrap = FALSE;
+
+ /* You are just on the edge */
+ if (!(cave[py][px].info & CAVE_UNSAFE))
+ {
+ if (alert_trap_detect)
+ {
+#ifdef JP
+ msg_print("* Ãí°Õ:¤³¤ÎÀè¤Ï¥È¥é¥Ã¥×¤Î´¶ÃÎÈϰϳ°¤Ç¤¹¡ª *");
+#else
+ msg_print("*Leaving trap detect region!*");
+#endif
+ }
+
+ if (disturb_trap_detect)
+ {
+ /* Break Run */
+ return(TRUE);
+ }
+ }
+ }
/* Look at every newly adjacent square. */
for (i = -max; i <= max; i++)
/* Access grid */
c_ptr = &cave[row][col];
+ /* Feature code (applying "mimic" field) */
+ feat = c_ptr->mimic ? f_info[c_ptr->mimic].mimic : f_info[c_ptr->feat].mimic;
/* Visible monsters abort running */
if (c_ptr->m_idx)
bool notice = TRUE;
/* Examine the terrain */
- switch (c_ptr->feat)
+ switch (feat)
{
/* Floors */
case FEAT_FLOOR:
/* Invis traps */
case FEAT_INVIS:
- /* Secret doors */
- case FEAT_SECRET:
-
/* Normal veins */
case FEAT_MAGMA:
case FEAT_QUARTZ:
case FEAT_MAGMA_H:
case FEAT_QUARTZ_H:
+ /* Known treasure (almost uninteresting) */
+ case FEAT_MAGMA_K:
+ case FEAT_QUARTZ_K:
+
/* Walls */
+ case FEAT_RUBBLE:
case FEAT_WALL_EXTRA:
case FEAT_WALL_INNER:
case FEAT_WALL_OUTER:
case FEAT_SHAL_LAVA:
{
/* Ignore */
- if (p_ptr->invuln || p_ptr->immune_fire) notice = FALSE;
+ if (IS_INVULN() || p_ptr->immune_fire) notice = FALSE;
/* Done */
break;
case FEAT_DEEP_WATER:
{
/* Ignore */
- if (p_ptr->ffall) notice = FALSE;
+ if (p_ptr->ffall || p_ptr->total_weight<= (((u32b)adj_str_wgt[p_ptr->stat_ind[A_STR]]*(p_ptr->pclass == CLASS_BERSERKER ? 150 : 100))/2)) notice = FALSE;
/* Done */
break;
inv = FALSE;
}
- /* Analyze unknown grids and floors */
-// if (inv || cave_floor_bold(row, col) ||
-// (cave[row][col].feat == FEAT_TREES))
- if (inv || cave_floor_bold(row, col))
+ /* Analyze unknown grids and floors considering mimic */
+ if (inv || feat_floor(feat))
{
/* Looking for open area */
if (find_openarea)
/* Access grid */
c_ptr = &cave[row][col];
+ /* Feature code (applying "mimic" field) */
+ feat = c_ptr->mimic ? f_info[c_ptr->mimic].mimic : f_info[c_ptr->feat].mimic;
+
/* Unknown grid or non-wall XXX XXX XXX cave_floor_grid(c_ptr)) */
if (!(c_ptr->info & (CAVE_MARK)) ||
- ((c_ptr->feat < FEAT_SECRET) ||
- (c_ptr->feat == FEAT_FLOWER) ||
- (c_ptr->feat == FEAT_DEEP_GRASS) ||
- ((c_ptr->feat >= FEAT_DEEP_WATER) &&
- (c_ptr->feat <= FEAT_GRASS))))
+ ((feat <= FEAT_DOOR_TAIL) ||
+ (feat == FEAT_FLOWER) ||
+ (feat == FEAT_DEEP_GRASS) ||
+ ((feat >= FEAT_DEEP_WATER) &&
+ (feat <= FEAT_GRASS))))
{
/* Looking to break right */
/* Access grid */
c_ptr = &cave[row][col];
+ /* Feature code (applying "mimic" field) */
+ feat = c_ptr->mimic ? f_info[c_ptr->mimic].mimic : f_info[c_ptr->feat].mimic;
+
/* Unknown grid or non-wall XXX XXX XXX cave_floor_grid(c_ptr)) */
if (!(c_ptr->info & (CAVE_MARK)) ||
- ((c_ptr->feat < FEAT_SECRET) ||
- (c_ptr->feat == FEAT_FLOWER) ||
- (c_ptr->feat == FEAT_DEEP_GRASS) ||
- ((c_ptr->feat >= FEAT_DEEP_WATER) &&
- (c_ptr->feat <= FEAT_GRASS))))
+ ((feat <= FEAT_DOOR_TAIL) ||
+ (feat == FEAT_FLOWER) ||
+ (feat == FEAT_DEEP_GRASS) ||
+ ((feat >= FEAT_DEEP_WATER) &&
+ (feat <= FEAT_GRASS))))
{
/* Looking to break left */
/* Start running */
if (dir)
{
+ cave_type *c_ptr;
+ byte feat;
+
+ /* Access grid */
+ c_ptr = &cave[py+ddy[dir]][px+ddx[dir]];
+
+ /* Feature code (applying "mimic" field) */
+ feat = c_ptr->mimic ? f_info[c_ptr->mimic].mimic : f_info[c_ptr->feat].mimic;
+
/* Hack -- do not start silly run */
if (see_wall(dir, py, px) &&
- (cave[py+ddy[dir]][px+ddx[dir]].feat != FEAT_TREES))
+ (feat != FEAT_TREES))
{
/* Message */
#ifdef JP
#endif /* ALLOW_EASY_DISARM -- TNB */
- if ((py == p_ptr->run_py) && (px == p_ptr->run_px))
+ if (player_bold(p_ptr->run_py, p_ptr->run_px))
{
p_ptr->run_py = 0;
p_ptr->run_px = 0;