int i, k;
/* Extract "shot" power */
- i = (weight + ((p_ptr->to_h_b + plus) * 4) + (p_ptr->lev * 2));
+ i = ((p_ptr->to_h_b + plus) * 4) + (p_ptr->lev * 2);
+
+ /* Snipers can shot more critically with crossbows */
+ if (p_ptr->concent) i += ((i * p_ptr->concent) / 5);
+ if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->tval_ammo == TV_BOLT)) i *= 2;
/* Critical hit */
if (randint1(5000) <= i)
{
- k = weight + randint1(500);
+ k = weight * randint1(500);
- if (k < 500)
+ if (k < 900)
{
#ifdef JP
msg_print("¼ê¤´¤¿¤¨¤¬¤¢¤Ã¤¿¡ª");
msg_print("It was a good hit!");
#endif
- dam = 2 * dam + 5;
+ dam += (dam / 2);
}
- else if (k < 1000)
+ else if (k < 1350)
{
#ifdef JP
msg_print("¤«¤Ê¤ê¤Î¼ê¤´¤¿¤¨¤¬¤¢¤Ã¤¿¡ª");
msg_print("It was a great hit!");
#endif
- dam = 2 * dam + 10;
+ dam *= 2;
}
else
{
msg_print("It was a superb hit!");
#endif
- dam = 3 * dam + 15;
+ dam *= 3;
}
}
+static int mult_slaying(int mult, const u32b* flgs, const monster_type* m_ptr)
+{
+ static const struct slay_table_t {
+ int slay_flag;
+ u32b affect_race_flag;
+ int slay_mult;
+ size_t flag_offset;
+ size_t r_flag_offset;
+ } slay_table[] = {
+#define OFFSET(X) offsetof(monster_race, X)
+ {TR_SLAY_ANIMAL, RF3_ANIMAL, 25, OFFSET(flags3), OFFSET(r_flags3)},
+ {TR_KILL_ANIMAL, RF3_ANIMAL, 40, OFFSET(flags3), OFFSET(r_flags3)},
+ {TR_SLAY_EVIL, RF3_EVIL, 20, OFFSET(flags3), OFFSET(r_flags3)},
+ {TR_KILL_EVIL, RF3_EVIL, 35, OFFSET(flags3), OFFSET(r_flags3)},
+ {TR_SLAY_GOOD, RF3_GOOD, 20, OFFSET(flags3), OFFSET(r_flags3)},
+ {TR_KILL_GOOD, RF3_GOOD, 35, OFFSET(flags3), OFFSET(r_flags3)},
+ {TR_SLAY_HUMAN, RF2_HUMAN, 25, OFFSET(flags2), OFFSET(r_flags2)},
+ {TR_KILL_HUMAN, RF2_HUMAN, 40, OFFSET(flags2), OFFSET(r_flags2)},
+ {TR_SLAY_UNDEAD, RF3_UNDEAD, 30, OFFSET(flags3), OFFSET(r_flags3)},
+ {TR_KILL_UNDEAD, RF3_UNDEAD, 50, OFFSET(flags3), OFFSET(r_flags3)},
+ {TR_SLAY_DEMON, RF3_DEMON, 30, OFFSET(flags3), OFFSET(r_flags3)},
+ {TR_KILL_DEMON, RF3_DEMON, 50, OFFSET(flags3), OFFSET(r_flags3)},
+ {TR_SLAY_ORC, RF3_ORC, 30, OFFSET(flags3), OFFSET(r_flags3)},
+ {TR_KILL_ORC, RF3_ORC, 50, OFFSET(flags3), OFFSET(r_flags3)},
+ {TR_SLAY_TROLL, RF3_TROLL, 30, OFFSET(flags3), OFFSET(r_flags3)},
+ {TR_KILL_TROLL, RF3_TROLL, 50, OFFSET(flags3), OFFSET(r_flags3)},
+ {TR_SLAY_GIANT, RF3_GIANT, 30, OFFSET(flags3), OFFSET(r_flags3)},
+ {TR_KILL_GIANT, RF3_GIANT, 50, OFFSET(flags3), OFFSET(r_flags3)},
+ {TR_SLAY_DRAGON, RF3_DRAGON, 30, OFFSET(flags3), OFFSET(r_flags3)},
+ {TR_KILL_DRAGON, RF3_DRAGON, 50, OFFSET(flags3), OFFSET(r_flags3)},
+#undef OFFSET
+ };
+ int i;
+ monster_race* r_ptr = &r_info[m_ptr->r_idx];
+
+ for (i = 0; i < sizeof(slay_table) / sizeof(slay_table[0]); ++ i)
+ {
+ const struct slay_table_t* p = &slay_table[i];
+
+ if ((have_flag(flgs, p->slay_flag)) &&
+ (*(u32b*)(((char*)r_ptr) + p->flag_offset) & p->affect_race_flag))
+ {
+ if (is_original_ap_and_seen(m_ptr))
+ {
+ *(u32b*)(((char*)r_ptr) + p->r_flag_offset) |= p->affect_race_flag;
+ }
+
+ mult = MAX(mult, p->slay_mult);
+ }
+ }
+
+ return mult;
+}
+
+static int mult_brand(int mult, const u32b* flgs, const monster_type* m_ptr)
+{
+ static const struct brand_table_t {
+ int brand_flag;
+ u32b resist_mask;
+ u32b hurt_flag;
+ } brand_table[] = {
+ {TR_BRAND_ACID, RFR_EFF_IM_ACID_MASK, 0U },
+ {TR_BRAND_ELEC, RFR_EFF_IM_ELEC_MASK, 0U },
+ {TR_BRAND_FIRE, RFR_EFF_IM_FIRE_MASK, RF3_HURT_FIRE},
+ {TR_BRAND_COLD, RFR_EFF_IM_COLD_MASK, RF3_HURT_COLD},
+ {TR_BRAND_POIS, RFR_EFF_IM_POIS_MASK, 0U },
+ };
+ int i;
+ monster_race* r_ptr = &r_info[m_ptr->r_idx];
+
+ for (i = 0; i < sizeof(brand_table) / sizeof(brand_table[0]); ++ i)
+ {
+ const struct brand_table_t* p = &brand_table[i];
+
+ if (have_flag(flgs, p->brand_flag))
+ {
+ /* Notice immunity */
+ if (r_ptr->flagsr & p->resist_mask)
+ {
+ if (is_original_ap_and_seen(m_ptr))
+ {
+ r_ptr->r_flagsr |= (r_ptr->flagsr & p->resist_mask);
+ }
+ }
+
+ /* Otherwise, take the damage */
+ else if (r_ptr->flags3 & p->hurt_flag)
+ {
+ if (is_original_ap_and_seen(m_ptr))
+ {
+ r_ptr->r_flags3 |= p->hurt_flag;
+ }
+
+ mult = MAX(mult, 50);
+ }
+ else
+ {
+ mult = MAX(mult, 25);
+ }
+ }
+ }
+
+ return mult;
+}
/*
* Extract the "total damage" from a given object hitting a given monster.
*
{
int mult = 10;
- monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
u32b flgs[TR_FLAG_SIZE];
/* Extract the flags */
object_flags(o_ptr, flgs);
+ torch_flags(o_ptr, flgs); /* torches has secret flags */
+
+ if (!thrown)
+ {
+ /* Magical Swords */
+ if (p_ptr->special_attack & (ATTACK_ACID)) add_flag(flgs, TR_BRAND_ACID);
+ if (p_ptr->special_attack & (ATTACK_COLD)) add_flag(flgs, TR_BRAND_COLD);
+ if (p_ptr->special_attack & (ATTACK_ELEC)) add_flag(flgs, TR_BRAND_ELEC);
+ if (p_ptr->special_attack & (ATTACK_FIRE)) add_flag(flgs, TR_BRAND_FIRE);
+ if (p_ptr->special_attack & (ATTACK_POIS)) add_flag(flgs, TR_BRAND_POIS);
+ }
+
+ /* Hex - Slay Good (Runesword) */
+ if (hex_spelling(HEX_RUNESWORD)) add_flag(flgs, TR_SLAY_GOOD);
/* Some "weapons" and "ammo" do extra damage */
switch (o_ptr->tval)
case TV_POLEARM:
case TV_SWORD:
case TV_DIGGING:
+ case TV_LITE:
{
- /* Slay Animal */
- if ((have_flag(flgs, TR_SLAY_ANIMAL)) &&
- (r_ptr->flags3 & RF3_ANIMAL))
- {
- if (m_ptr->ml && is_original_ap(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_ANIMAL;
- }
-
- if (mult < 25) mult = 25;
- }
+ /* Slaying */
+ mult = mult_slaying(mult, flgs, m_ptr);
- /* 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;
- }
+ /* Elemental Brand */
+ mult = mult_brand(mult, flgs, m_ptr);
- /* Slay Evil */
- if ((have_flag(flgs, TR_SLAY_EVIL)) &&
- (r_ptr->flags3 & RF3_EVIL))
+ /* Hissatsu */
+ if (p_ptr->pclass == CLASS_SAMURAI)
{
- if (m_ptr->ml && is_original_ap(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_EVIL;
- }
-
- if (mult < 20) mult = 20;
+ mult = mult_hissatsu(mult, flgs, m_ptr, mode);
}
- /* Execute Evil */
- if ((have_flag(flgs, TR_KILL_EVIL)) &&
- (r_ptr->flags3 & RF3_EVIL))
+ /* Force Weapon */
+ if ((p_ptr->pclass != CLASS_SAMURAI) && (have_flag(flgs, TR_FORCE_WEAPON)) && (p_ptr->csp > (o_ptr->dd * o_ptr->ds / 5)))
{
- if (m_ptr->ml && is_original_ap(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_EVIL;
- }
-
- if (mult < 35) mult = 35;
+ p_ptr->csp -= (1+(o_ptr->dd * o_ptr->ds / 5));
+ p_ptr->redraw |= (PR_MANA);
+ mult = mult * 3 / 2 + 20;
}
- /* 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;
- }
+ /* Hack -- The Nothung cause special damage to Fafner */
+ if ((o_ptr->name1 == ART_NOTHUNG) && (m_ptr->r_idx == MON_FAFNER))
+ mult = 150;
+ break;
+ }
+ }
+ if (mult > 150) mult = 150;
- if (mult < 25) mult = 25;
- }
+ /* Return the total damage */
+ return (tdam * mult / 10);
+}
- /* 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;
- }
+/*
+ * Search for hidden things
+ */
+static void discover_hidden_things(int y, int x)
+{
+ s16b this_o_idx, next_o_idx = 0;
- /* Slay Undead */
- if ((have_flag(flgs, TR_SLAY_UNDEAD)) &&
- (r_ptr->flags3 & RF3_UNDEAD))
- {
- if (m_ptr->ml && is_original_ap(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_UNDEAD;
- }
+ cave_type *c_ptr;
- if (mult < 30) mult = 30;
- }
+ /* Access the grid */
+ c_ptr = &cave[y][x];
- /* 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;
- }
+ /* Invisible trap */
+ if (c_ptr->mimic && is_trap(c_ptr->feat))
+ {
+ /* Pick a trap */
+ disclose_grid(y, x);
- if (mult < 50) mult = 50;
- }
+ /* Message */
+ msg_print(_("¥È¥é¥Ã¥×¤òȯ¸«¤·¤¿¡£", "You have found a trap."));
- /* Slay Demon */
- if ((have_flag(flgs, TR_SLAY_DEMON)) &&
- (r_ptr->flags3 & RF3_DEMON))
- {
- if (m_ptr->ml && is_original_ap(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_DEMON;
- }
+ /* Disturb */
+ disturb(0, 1);
+ }
- if (mult < 30) mult = 30;
- }
+ /* Secret door */
+ if (is_hidden_door(c_ptr))
+ {
+ /* Message */
+ msg_print(_("±£¤·¥É¥¢¤òȯ¸«¤·¤¿¡£", "You have found a secret door."));
- /* 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;
- }
+ /* Disclose */
+ disclose_grid(y, x);
- if (mult < 50) mult = 50;
- }
+ /* Disturb */
+ disturb(0, 0);
+ }
- /* Slay Orc */
- if ((have_flag(flgs, TR_SLAY_ORC)) &&
- (r_ptr->flags3 & RF3_ORC))
- {
- if (m_ptr->ml && is_original_ap(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_ORC;
- }
+ /* 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;
- if (mult < 30) mult = 30;
- }
+ /* Acquire object */
+ o_ptr = &o_list[this_o_idx];
- /* 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;
- }
+ /* Acquire next object */
+ next_o_idx = o_ptr->next_o_idx;
- if (mult < 50) mult = 50;
- }
+ /* Skip non-chests */
+ if (o_ptr->tval != TV_CHEST) continue;
- /* Slay Troll */
- if ((have_flag(flgs, TR_SLAY_TROLL)) &&
- (r_ptr->flags3 & RF3_TROLL))
- {
- if (m_ptr->ml && is_original_ap(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_TROLL;
- }
+ /* Skip non-trapped chests */
+ if (!chest_traps[o_ptr->pval]) continue;
- if (mult < 30) mult = 30;
- }
+ /* Identify once */
+ if (!object_is_known(o_ptr))
+ {
+ /* Message */
+ msg_print(_("È¢¤Ë»Å³Ý¤±¤é¤ì¤¿¥È¥é¥Ã¥×¤òȯ¸«¤·¤¿¡ª", "You have discovered a trap on the chest!"));
- /* 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;
- }
+ /* Know the trap */
+ object_known(o_ptr);
- if (mult < 50) mult = 50;
- }
+ /* Notice it */
+ disturb(0, 0);
+ }
+ }
+}
- /* Slay Giant */
- if ((have_flag(flgs, TR_SLAY_GIANT)) &&
- (r_ptr->flags3 & RF3_GIANT))
- {
- if (m_ptr->ml && is_original_ap(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_GIANT;
- }
+void search(void)
+{
+ int i, chance;
- if (mult < 30) mult = 30;
- if (o_ptr->name1 == ART_HRUNTING)
- mult *= 3;
- }
+ /* Start with base search ability */
+ chance = p_ptr->skill_srh;
- /* 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;
- }
+ /* Penalize various conditions */
+ if (p_ptr->blind || no_lite()) chance = chance / 10;
+ if (p_ptr->confused || p_ptr->image) chance = chance / 10;
- if (mult < 50) mult = 50;
- }
+ /* 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]);
+ }
+ }
+}
- /* Slay Dragon */
- if ((have_flag(flgs, TR_SLAY_DRAGON)) &&
- (r_ptr->flags3 & RF3_DRAGON))
- {
- if (m_ptr->ml && is_original_ap(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_DRAGON;
- }
- if (mult < 30) mult = 30;
- }
+/*
+ * Helper routine for py_pickup() and py_pickup_floor().
+ *
+ * Add the given dungeon object to the character's inventory.
+ *
+ * Delete the object afterwards.
+ */
+void py_pickup_aux(int o_idx)
+{
+ int slot;
- /* Execute Dragon */
- if ((have_flag(flgs, TR_KILL_DRAGON)) &&
- (r_ptr->flags3 & RF3_DRAGON))
- {
- if (m_ptr->ml && is_original_ap(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_DRAGON;
- }
+#ifdef JP
+/*
+ * ¥¢¥¤¥Æ¥à¤ò½¦¤Ã¤¿ºÝ¤Ë¡Ö£²¤Ä¤Î¥±¡¼¥¤ò»ý¤Ã¤Æ¤¤¤ë¡×
+ * "You have two cakes." ¤È¥¢¥¤¥Æ¥à¤ò½¦¤Ã¤¿¸å¤Î¹ç·×¤Î¤ß¤Îɽ¼¨¤¬¥ª¥ê¥¸¥Ê¥ë
+ * ¤À¤¬¡¢°ãÏ´¶¤¬
+ * ¤¢¤ë¤È¤¤¤¦»ØŦ¤ò¤¦¤±¤¿¤Î¤Ç¡¢¡Ö¡Á¤ò½¦¤Ã¤¿¡¢¡Á¤ò»ý¤Ã¤Æ¤¤¤ë¡×¤È¤¤¤¦É½¼¨
+ * ¤Ë¤«¤¨¤Æ¤¢¤ë¡£¤½¤Î¤¿¤á¤ÎÇÛÎó¡£
+ */
+ char o_name[MAX_NLEN];
+ char old_name[MAX_NLEN];
+ char kazu_str[80];
+ int hirottakazu;
+#else
+ char o_name[MAX_NLEN];
+#endif
- if (mult < 50) mult = 50;
+ object_type *o_ptr;
- if ((o_ptr->name1 == ART_NOTHUNG) && (m_ptr->r_idx == MON_FAFNER))
- mult *= 3;
- }
+ o_ptr = &o_list[o_idx];
- /* Brand (Acid) */
- if (have_flag(flgs, TR_BRAND_ACID) || ((p_ptr->special_attack & (ATTACK_ACID)) && !thrown))
- {
- /* Notice immunity */
- if (r_ptr->flagsr & RFR_EFF_IM_ACID_MASK)
- {
- if (m_ptr->ml && is_original_ap(m_ptr))
- {
- r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ACID_MASK);
- }
- }
+#ifdef JP
+ /* Describe the object */
+ object_desc(old_name, o_ptr, OD_NAME_ONLY);
+ object_desc_kosuu(kazu_str, o_ptr);
+ hirottakazu = o_ptr->number;
+#endif
+ /* Carry the object */
+ slot = inven_carry(o_ptr);
- /* Otherwise, take the damage */
- else
- {
- if (mult < 25) mult = 25;
- }
- }
+ /* Get the object again */
+ o_ptr = &inventory[slot];
- /* Brand (Elec) */
- if (have_flag(flgs, TR_BRAND_ELEC) || ((p_ptr->special_attack & (ATTACK_ELEC)) && !thrown) || (mode == HISSATSU_ELEC))
- {
- /* Notice immunity */
- if (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK)
- {
- if (m_ptr->ml && is_original_ap(m_ptr))
- {
- r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK);
- }
- }
+ /* Delete the object */
+ delete_object_idx(o_idx);
- /* Otherwise, take the damage */
- else if ((have_flag(flgs, TR_BRAND_ELEC) || ((p_ptr->special_attack & (ATTACK_ELEC)) && !thrown)) && (mode == HISSATSU_ELEC))
- {
- if (mult < 70) mult = 70;
- }
- else if (mode == HISSATSU_ELEC)
- {
- if (mult < 50) mult = 50;
- }
+ if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
+ {
+ bool old_known = identify_item(o_ptr);
- else
- {
- if (mult < 25) mult = 25;
- }
- }
+ /* Auto-inscription/destroy */
+ autopick_alter_item(slot, (bool)(destroy_identify && !old_known));
- /* Brand (Fire) */
- if (have_flag(flgs, TR_BRAND_FIRE) || ((p_ptr->special_attack & (ATTACK_FIRE)) && !thrown) || (mode == HISSATSU_FIRE))
- {
- /* Notice immunity */
- if (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK)
- {
- if (m_ptr->ml && is_original_ap(m_ptr))
- {
- r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK);
- }
- }
+ /* If it is destroyed, don't pick it up */
+ if (o_ptr->marked & OM_AUTODESTROY) return;
+ }
- /* Otherwise, take the damage */
- 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 && is_original_ap(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_HURT_FIRE;
- }
- }
- else if (mult < 35) mult = 35;
- }
- else
- {
- if (r_ptr->flags3 & RF3_HURT_FIRE)
- {
- if (mult < 50) mult = 50;
- if (m_ptr->ml && is_original_ap(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_HURT_FIRE;
- }
- }
- else if (mult < 25) mult = 25;
- }
- }
-
- /* Brand (Cold) */
- if (have_flag(flgs, TR_BRAND_COLD) || ((p_ptr->special_attack & (ATTACK_COLD)) && !thrown) || (mode == HISSATSU_COLD))
- {
- /* Notice immunity */
- if (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK)
- {
- if (m_ptr->ml && is_original_ap(m_ptr))
- {
- r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK);
- }
- }
- /* Otherwise, take the damage */
- 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 && is_original_ap(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_HURT_COLD;
- }
- }
- else if (mult < 35) mult = 35;
- }
- else
- {
- if (r_ptr->flags3 & RF3_HURT_COLD)
- {
- if (mult < 50) mult = 50;
- if (m_ptr->ml && is_original_ap(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_HURT_COLD;
- }
- }
- else if (mult < 25) mult = 25;
- }
- }
-
- /* Brand (Poison) */
- if (have_flag(flgs, TR_BRAND_POIS) || ((p_ptr->special_attack & (ATTACK_POIS)) && !thrown) || (mode == HISSATSU_POISON))
- {
- /* Notice immunity */
- if (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK)
- {
- if (m_ptr->ml && is_original_ap(m_ptr))
- {
- r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK);
- }
- }
-
- /* Otherwise, take the damage */
- else if ((have_flag(flgs, TR_BRAND_POIS) || ((p_ptr->special_attack & (ATTACK_POIS)) && !thrown)) && (mode == HISSATSU_POISON))
- {
- if (mult < 35) mult = 35;
- }
- else
- {
- if (mult < 25) mult = 25;
- }
- }
- 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 (mode == HISSATSU_UNDEAD)
- {
- if (r_ptr->flags3 & RF3_UNDEAD)
- {
- if (m_ptr->ml && is_original_ap(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_UNDEAD;
- }
- if (mult == 10) mult = 70;
- else if (mult < 140) mult = MIN(140, mult+60);
- }
- if (mult == 10) mult = 40;
- else if (mult < 60) mult = MIN(60, mult+30);
- }
- 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 && 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) && (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 = mult * 3 / 2 + 20;
- }
- break;
- }
- }
- if (mult > 150) mult = 150;
-
- /* Return the total damage */
- return (tdam * mult / 10);
-}
-
-
-/*
- * Search for hidden things
- */
-void search(void)
-{
- int y, x, chance;
-
- s16b this_o_idx, next_o_idx = 0;
-
- cave_type *c_ptr;
-
-
- /* Start with base search ability */
- chance = p_ptr->skill_srh;
-
- /* Penalize various conditions */
- if (p_ptr->blind || no_lite()) chance = chance / 10;
- if (p_ptr->confused || p_ptr->image) chance = chance / 10;
-
- /* Search the nearby grids, which are always in bounds */
- for (y = (py - 1); y <= (py + 1); y++)
- {
- for (x = (px - 1); x <= (px + 1); x++)
- {
- /* Sometimes, notice things */
- if (randint0(100) < chance)
- {
- /* Access the grid */
- c_ptr = &cave[y][x];
-
- /* Invisible trap */
- if (c_ptr->mimic && is_trap(c_ptr->feat))
- {
- /* Pick a trap */
- disclose_grid(y, x);
-
- /* Message */
-#ifdef JP
- msg_print("¥È¥é¥Ã¥×¤òȯ¸«¤·¤¿¡£");
-#else
- msg_print("You have found a trap.");
-#endif
-
-
- /* Disturb */
- disturb(0, 0);
- }
-
- /* Secret door */
- if (is_hidden_door(c_ptr))
- {
- /* Message */
-#ifdef JP
- msg_print("±£¤·¥É¥¢¤òȯ¸«¤·¤¿¡£");
-#else
- msg_print("You have found a secret door.");
-#endif
-
- /* Disclose */
- disclose_grid(y, x);
-
- /* Disturb */
- disturb(0, 0);
- }
-
- /* 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;
-
- /* Acquire object */
- o_ptr = &o_list[this_o_idx];
-
- /* Acquire next object */
- next_o_idx = o_ptr->next_o_idx;
-
- /* Skip non-chests */
- if (o_ptr->tval != TV_CHEST) continue;
-
- /* Skip non-trapped chests */
- if (!chest_traps[o_ptr->pval]) continue;
-
- /* Identify once */
- if (!object_known_p(o_ptr))
- {
- /* Message */
-#ifdef JP
- msg_print("È¢¤Ë»Å³Ý¤±¤é¤ì¤¿¥È¥é¥Ã¥×¤òȯ¸«¤·¤¿¡ª");
-#else
- msg_print("You have discovered a trap on the chest!");
-#endif
-
-
- /* Know the trap */
- object_known(o_ptr);
-
- /* Notice it */
- disturb(0, 0);
- }
- }
- }
- }
- }
-}
-
-
-/*
- * Helper routine for py_pickup() and py_pickup_floor().
- *
- * Add the given dungeon object to the character's inventory.
- *
- * Delete the object afterwards.
- */
-void py_pickup_aux(int o_idx)
-{
- int slot, i;
-
-#ifdef JP
-/*
- * ¥¢¥¤¥Æ¥à¤ò½¦¤Ã¤¿ºÝ¤Ë¡Ö£²¤Ä¤Î¥±¡¼¥¤ò»ý¤Ã¤Æ¤¤¤ë¡×
- * "You have two cakes." ¤È¥¢¥¤¥Æ¥à¤ò½¦¤Ã¤¿¸å¤Î¹ç·×¤Î¤ß¤Îɽ¼¨¤¬¥ª¥ê¥¸¥Ê¥ë
- * ¤À¤¬¡¢°ãÏ´¶¤¬
- * ¤¢¤ë¤È¤¤¤¦»ØŦ¤ò¤¦¤±¤¿¤Î¤Ç¡¢¡Ö¡Á¤ò½¦¤Ã¤¿¡¢¡Á¤ò»ý¤Ã¤Æ¤¤¤ë¡×¤È¤¤¤¦É½¼¨
- * ¤Ë¤«¤¨¤Æ¤¢¤ë¡£¤½¤Î¤¿¤á¤ÎÇÛÎó¡£
- */
- char o_name[MAX_NLEN];
- char old_name[MAX_NLEN];
- char kazu_str[80];
- int hirottakazu;
-#else
- char o_name[MAX_NLEN];
-#endif
-
- object_type *o_ptr;
-
- o_ptr = &o_list[o_idx];
-
-#ifdef JP
- /* Describe the object */
- object_desc(old_name, o_ptr, TRUE, 0);
- object_desc_kosuu(kazu_str, o_ptr);
- hirottakazu = o_ptr->number;
-#endif
- /* Carry the object */
- slot = inven_carry(o_ptr);
-
- /* Get the object again */
- o_ptr = &inventory[slot];
-
- /* Delete the object */
- delete_object_idx(o_idx);
-
- if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
- {
- int idx;
- bool old_known = identify_item(o_ptr);
-
- /* Auto-inscription/destroy */
- idx = is_autopick(o_ptr);
- auto_inscribe_item(slot, idx);
- if (destroy_identify && !old_known)
- {
- if (auto_destroy_item(slot, idx))
- {
- if (o_ptr->marked & OM_AUTODESTROY) return;
- }
- }
- }
-
- /* Describe the object */
- object_desc(o_name, o_ptr, TRUE, 3);
+ /* Describe the object */
+ object_desc(o_name, o_ptr, 0);
/* Message */
#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);
}
* Note that we ONLY handle things that can be picked up.
* See "move_player()" for handling of other things.
*/
-void carry(int pickup)
+void carry(bool pickup)
{
cave_type *c_ptr = &cave[py][px];
handle_stuff();
/* Automatically pickup/destroy/inscribe items */
- auto_pickup_items(c_ptr);
+ autopick_pickup_items(c_ptr);
#ifdef ALLOW_EASY_FLOOR
#endif /* ALLOW_EASY_SENSE -- TNB */
/* Describe the object */
- object_desc(o_name, o_ptr, TRUE, 3);
+ object_desc(o_name, o_ptr, 0);
/* Acquire next object */
next_o_idx = o_ptr->next_o_idx;
/* Pick up objects */
else
{
- /* Hack - some objects were handled in auto_pickup_items(). */
+ /* Hack - some objects were handled in autopick_pickup_items(). */
if (o_ptr->marked & OM_NOMSG)
{
/* Clear the flag. */
}
/* Describe the object */
else if (!pickup)
-
{
#ifdef JP
msg_format("%s¤¬¤¢¤ë¡£", o_name);
int i, num, dam;
int x = px, y = py;
- cave_type *c_ptr;
+ /* Get the cave grid */
+ cave_type *c_ptr = &cave[y][x];
+ feature_type *f_ptr = &f_info[c_ptr->feat];
+ int trap_feat_type = have_flag(f_ptr->flags, FF_TRAP) ? f_ptr->subtype : NOT_TRAP;
#ifdef JP
- cptr name = "¥È¥é¥Ã¥×";
+ cptr name = "¥È¥é¥Ã¥×";
#else
cptr name = "a trap";
#endif
-
-
/* Disturb the player */
- disturb(0, 0);
+ disturb(0, 1);
- /* Get the cave grid */
- c_ptr = &cave[y][x];
+ cave_alter_feat(y, x, FF_HIT_TRAP);
/* Analyze XXX XXX XXX */
- switch (c_ptr->feat)
+ switch (trap_feat_type)
{
- case FEAT_TRAP_TRAPDOOR:
+ case TRAP_TRAPDOOR:
{
- if (p_ptr->ffall)
+ if (p_ptr->levitation)
{
#ifdef JP
- msg_print("Í¸Í¤òÈô¤Ó±Û¤¨¤¿¡£");
+ msg_print("Íî¤Ȥ·¸Í¤òÈô¤Ó±Û¤¨¤¿¡£");
#else
msg_print("You fly over a trap door.");
#endif
else
{
#ifdef JP
- msg_print("Í¸Í¤ËÍî¤Á¤¿¡ª");
+ msg_print("Íî¤Ȥ·¸Í¤ËÍî¤Á¤¿¡ª");
if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
msg_print("¤¯¤Ã¤½¡Á¡ª");
#else
sound(SOUND_FALL);
dam = damroll(2, 8);
#ifdef JP
- name = "Í¸Í";
+ name = "Íî¤Ȥ·¸Í";
#else
name = "a trap door";
#endif
do_cmd_save_game(TRUE);
#ifdef JP
- do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "Í¸Í¤ËÍî¤Á¤¿");
+ 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);
+ prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
/* Leaving */
p_ptr->leaving = TRUE;
break;
}
- case FEAT_TRAP_PIT:
+ case TRAP_PIT:
{
- if (p_ptr->ffall)
+ if (p_ptr->levitation)
{
#ifdef JP
- msg_print("Í·ê¤òÈô¤Ó±Û¤¨¤¿¡£");
+ msg_print("Íî¤Ȥ··ê¤òÈô¤Ó±Û¤¨¤¿¡£");
#else
msg_print("You fly over a pit trap.");
#endif
else
{
#ifdef JP
- msg_print("Í·ê¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª");
+ msg_print("Íî¤Ȥ··ê¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª");
#else
msg_print("You have fallen into a pit!");
#endif
dam = damroll(2, 6);
#ifdef JP
- name = "Í·ê";
+ name = "Íî¤Ȥ··ê";
#else
name = "a pit trap";
#endif
break;
}
- case FEAT_TRAP_SPIKED_PIT:
+ case TRAP_SPIKED_PIT:
{
- if (p_ptr->ffall)
+ if (p_ptr->levitation)
{
#ifdef JP
- msg_print("¥È¥²¤Î¤¢¤ëÍ·ê¤òÈô¤Ó±Û¤¨¤¿¡£");
+ msg_print("¥È¥²¤Î¤¢¤ëÍî¤Ȥ··ê¤òÈô¤Ó±Û¤¨¤¿¡£");
#else
msg_print("You fly over a spiked pit.");
#endif
else
{
#ifdef JP
- msg_print("¥¹¥Ñ¥¤¥¯¤¬Éߤ«¤ì¤¿Í·ê¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª");
+ msg_print("¥¹¥Ñ¥¤¥¯¤¬Éߤ«¤ì¤¿Íî¤È¤··ê¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª");
#else
msg_print("You fall into a spiked pit!");
#endif
/* Base damage */
#ifdef JP
- name = "Í·ê";
+ name = "Íî¤Ȥ··ê";
#else
name = "a pit trap";
#endif
#ifdef JP
- name = "¥È¥²¤Î¤¢¤ëÍ·ê";
+ name = "¥È¥²¤Î¤¢¤ëÍî¤Ȥ··ê";
#else
name = "a spiked pit";
#endif
break;
}
- case FEAT_TRAP_POISON_PIT:
+ case TRAP_POISON_PIT:
{
- if (p_ptr->ffall)
+ if (p_ptr->levitation)
{
#ifdef JP
- msg_print("¥È¥²¤Î¤¢¤ëÍ·ê¤òÈô¤Ó±Û¤¨¤¿¡£");
+ msg_print("¥È¥²¤Î¤¢¤ëÍî¤Ȥ··ê¤òÈô¤Ó±Û¤¨¤¿¡£");
#else
msg_print("You fly over a spiked pit.");
#endif
else
{
#ifdef JP
- msg_print("¥¹¥Ñ¥¤¥¯¤¬Éߤ«¤ì¤¿Í·ê¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª");
+ msg_print("¥¹¥Ñ¥¤¥¯¤¬Éߤ«¤ì¤¿Íî¤Ȥ··ê¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª");
#else
msg_print("You fall into a spiked pit!");
#endif
dam = damroll(2, 6);
#ifdef JP
- name = "Í·ê";
+ name = "Íî¤Ȥ··ê";
#else
name = "a pit trap";
#endif
#ifdef JP
- name = "¥È¥²¤Î¤¢¤ëÍ·ê";
+ name = "¥È¥²¤Î¤¢¤ëÍî¤Ȥ··ê";
#else
name = "a spiked pit";
#endif
break;
}
- case FEAT_TRAP_TY_CURSE:
+ case TRAP_TY_CURSE:
{
#ifdef JP
msg_print("²¿¤«¤¬¥Ô¥«¥Ã¤È¸÷¤Ã¤¿¡ª");
msg_print("There is a flash of shimmering light!");
#endif
- c_ptr->info &= ~(CAVE_MARK);
- cave_set_feat(y, x, floor_type[randint0(100)]);
num = 2 + randint1(3);
for (i = 0; i < num; i++)
{
break;
}
- case FEAT_TRAP_TELEPORT:
+ case TRAP_TELEPORT:
{
#ifdef JP
msg_print("¥Æ¥ì¥Ý¡¼¥È¡¦¥È¥é¥Ã¥×¤Ë¤Ò¤Ã¤«¤«¤Ã¤¿¡ª");
msg_print("You hit a teleport trap!");
#endif
- teleport_player(100);
+ teleport_player(100, TELEPORT_PASSIVE);
break;
}
- case FEAT_TRAP_FIRE:
+ case TRAP_FIRE:
{
#ifdef JP
msg_print("±ê¤ËÊñ¤Þ¤ì¤¿¡ª");
break;
}
- case FEAT_TRAP_ACID:
+ case TRAP_ACID:
{
#ifdef JP
msg_print("»À¤¬¿á¤¤«¤±¤é¤ì¤¿¡ª");
break;
}
- case FEAT_TRAP_SLOW:
+ case TRAP_SLOW:
{
if (check_hit(125))
{
#endif
dam = damroll(1, 4);
- take_hit(DAMAGE_ATTACK, dam, name, -1);
- (void)set_slow(p_ptr->slow + randint0(20) + 20, FALSE);
+#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
{
break;
}
- case FEAT_TRAP_LOSE_STR:
+ case TRAP_LOSE_STR:
{
if (check_hit(125))
{
take_hit(DAMAGE_ATTACK, dam, "a dart trap", -1);
#endif
- (void)do_dec_stat(A_STR);
+ if (!CHECK_MULTISHADOW()) (void)do_dec_stat(A_STR);
}
else
{
break;
}
- case FEAT_TRAP_LOSE_DEX:
+ case TRAP_LOSE_DEX:
{
if (check_hit(125))
{
take_hit(DAMAGE_ATTACK, dam, "a dart trap", -1);
#endif
- (void)do_dec_stat(A_DEX);
+ if (!CHECK_MULTISHADOW()) (void)do_dec_stat(A_DEX);
}
else
{
break;
}
- case FEAT_TRAP_LOSE_CON:
+ case TRAP_LOSE_CON:
{
if (check_hit(125))
{
take_hit(DAMAGE_ATTACK, dam, "a dart trap", -1);
#endif
- (void)do_dec_stat(A_CON);
+ if (!CHECK_MULTISHADOW()) (void)do_dec_stat(A_CON);
}
else
{
break;
}
- case FEAT_TRAP_BLIND:
+ case TRAP_BLIND:
{
#ifdef JP
msg_print("¹õ¤¤¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª");
break;
}
- case FEAT_TRAP_CONFUSE:
+ case TRAP_CONFUSE:
{
#ifdef JP
msg_print("¤¤é¤á¤¯¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª");
break;
}
- case FEAT_TRAP_POISON:
+ case TRAP_POISON:
{
#ifdef JP
msg_print("»É·ãŪ¤ÊÎп§¤Î¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª");
break;
}
- case FEAT_TRAP_SLEEP:
+ case TRAP_SLEEP:
{
#ifdef JP
msg_print("´ñ̯¤ÊÇò¤¤Ì¸¤ËÊñ¤Þ¤ì¤¿¡ª");
break;
}
- case FEAT_TRAP_TRAPS:
+ case TRAP_TRAPS:
{
#ifdef JP
msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª");
msg_print("There is a bright flash of light!");
#endif
-
- /* Destroy this trap */
- 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:
+ case TRAP_ALARM:
{
#ifdef JP
msg_print("¤±¤¿¤¿¤Þ¤·¤¤²»¤¬ÌĤê¶Á¤¤¤¿¡ª");
break;
}
- case FEAT_TRAP_OPEN:
+ case TRAP_OPEN:
{
#ifdef JP
msg_print("Âç²»¶Á¤È¶¦¤Ë¤Þ¤ï¤ê¤ÎÊɤ¬Êø¤ì¤¿¡ª");
break;
}
- case FEAT_TRAP_ARMAGEDDON:
+ case TRAP_ARMAGEDDON:
{
static int levs[10] = {0, 0, 20, 10, 5, 3, 2, 1, 1, 1};
int evil_idx = 0, good_idx = 0;
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)
{
/* Skip illegal grids */
if (!in_bounds(y1, x1)) continue;
- /* Require line of sight */
- if (!player_has_los_bold(y1, x1)) continue;
+ /* Require line of projection */
+ if (!projectable(py, px, y1, x1)) continue;
if (summon_specific(0, y1, x1, lev, SUMMON_ARMAGE_EVIL, (PM_NO_PET)))
evil_idx = hack_m_idx_ii;
break;
}
- case FEAT_TRAP_PIRANHA:
+ case TRAP_PIRANHA:
{
#ifdef JP
msg_print("ÆÍÁ³Êɤ«¤é¿å¤¬°î¤ì½Ð¤·¤¿¡ª¥Ô¥é¥Ë¥¢¤¬¤¤¤ë¡ª");
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);
break;
}
}
+
if (break_trap && is_trap(c_ptr->feat))
{
- cave_set_feat(y, x, floor_type[randint0(100)]);
+ cave_alter_feat(y, x, FF_DISARM);
#ifdef JP
msg_print("¥È¥é¥Ã¥×¤òÊ´ºÕ¤·¤¿¡£");
#else
msg_print("You are suddenly very hot!");
#endif
-
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);
- if (m_ptr->ml && is_original_ap(m_ptr)) r_ptr->r_flags2 |= RF2_AURA_FIRE;
+ if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= RF2_AURA_FIRE;
handle_stuff();
}
}
msg_print("You are suddenly very cold!");
#endif
-
if (IS_OPPOSE_COLD()) aura_damage = (aura_damage + 2) / 3;
if (p_ptr->resist_cold) aura_damage = (aura_damage + 2) / 3;
take_hit(DAMAGE_NOESCAPE, aura_damage, aura_dam, -1);
- if (m_ptr->ml && is_original_ap(m_ptr)) r_ptr->r_flags3 |= RF3_AURA_COLD;
+ if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_AURA_COLD;
handle_stuff();
}
}
#endif
take_hit(DAMAGE_NOESCAPE, aura_damage, aura_dam, -1);
- if (m_ptr->ml && is_original_ap(m_ptr)) r_ptr->r_flags2 |= RF2_AURA_ELEC;
+ if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= RF2_AURA_ELEC;
handle_stuff();
}
}
monster_type *m_ptr = &m_list[c_ptr->m_idx];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
- object_type *o_ptr;
+ /* Access the weapon */
+ object_type *o_ptr = &inventory[INVEN_RARM + hand];
char m_name[80];
bool success_hit = FALSE;
- bool old_success_hit = FALSE;
bool backstab = FALSE;
bool vorpal_cut = FALSE;
int chaos_effect = 0;
bool stab_fleeing = FALSE;
bool fuiuchi = FALSE;
+ bool monk_attack = FALSE;
bool do_quake = FALSE;
bool weak = FALSE;
bool drain_msg = TRUE;
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)) && buki_motteruka(INVEN_RARM + hand) && !p_ptr->icky_wield[hand])
+ switch (p_ptr->pclass)
{
- int tmp = p_ptr->lev*6+(p_ptr->skill_stl+10)*4;
- if (p_ptr->monlite && (mode != HISSATSU_NYUSIN)) tmp /= 3;
- 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) && (randint0(tmp) > (r_ptr->level+20)) && m_ptr->ml && !(r_ptr->flagsr & RFR_RES_ALL))
- {
- fuiuchi = TRUE;
- }
- else if (m_ptr->monfear && m_ptr->ml)
+ case CLASS_ROGUE:
+ case CLASS_NINJA:
+ if (buki_motteruka(INVEN_RARM + hand) && !p_ptr->icky_wield[hand])
{
- stab_fleeing = TRUE;
+ int tmp = p_ptr->lev * 6 + (p_ptr->skill_stl + 10) * 4;
+ if (p_ptr->monlite && (mode != HISSATSU_NYUSIN)) tmp /= 3;
+ if (p_ptr->cursed & TRC_AGGRAVATE) tmp /= 2;
+ if (r_ptr->level > (p_ptr->lev * p_ptr->lev / 20 + 10)) tmp /= 3;
+ if (MON_CSLEEP(m_ptr) && m_ptr->ml)
+ {
+ /* Can't backstab creatures that we can't see, right? */
+ backstab = TRUE;
+ }
+ 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;
+ }
+ else if (MON_MONFEAR(m_ptr) && m_ptr->ml)
+ {
+ stab_fleeing = TRUE;
+ }
}
+ break;
+
+ case CLASS_MONK:
+ case CLASS_FORCETRAINER:
+ case CLASS_BERSERKER:
+ if ((empty_hands(TRUE) & EMPTY_HAND_RARM) && !p_ptr->riding) monk_attack = TRUE;
+ break;
}
- if(!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM))
+ if (!o_ptr->k_idx) /* Empty hand */
{
if ((r_ptr->level + 10) > p_ptr->lev)
{
}
}
}
- else
+ else if (object_is_melee_weapon(o_ptr))
{
if ((r_ptr->level + 10) > p_ptr->lev)
{
- int tval = inventory[INVEN_RARM+hand].tval - TV_BOW;
+ int tval = inventory[INVEN_RARM+hand].tval - TV_WEAPON_BEGIN;
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])
}
/* Disturb the monster */
- m_ptr->csleep = 0;
- if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
+ (void)set_monster_csleep(c_ptr->m_idx, 0);
/* Extract monster name (or "it") */
monster_desc(m_name, m_ptr, 0);
- /* Access the weapon */
- o_ptr = &inventory[INVEN_RARM+hand];
-
/* Calculate the "attack quality" */
bonus = p_ptr->to_h[hand] + o_ptr->to_h;
chance = (p_ptr->skill_thn + (bonus * BTH_PLUS_ADJ));
else if (mode == HISSATSU_COLD) num_blow = p_ptr->num_blow[hand]+2;
else num_blow = p_ptr->num_blow[hand];
+ /* Hack -- DOKUBARI always hit once */
+ if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) num_blow = 1;
+
/* Attack once for each legal blow */
while ((num++ < num_blow) && !p_ptr->is_dead)
{
if (((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) || (mode == HISSATSU_KYUSHO))
{
+ int n = 1;
+
if (p_ptr->migite && p_ptr->hidarite)
{
- success_hit = one_in_(2);
+ n *= 2;
}
- else success_hit = TRUE;
- }
- else if (mode == HISSATSU_MAJIN)
- {
- if (num == 1)
+ if (mode == HISSATSU_3DAN)
{
- if (one_in_(2))
- success_hit = FALSE;
- old_success_hit = success_hit;
+ n *= 2;
}
- else success_hit = old_success_hit;
+
+ success_hit = one_in_(n);
}
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);
+ if (mode == HISSATSU_MAJIN)
+ {
+ if (one_in_(2))
+ success_hit = FALSE;
+ }
+
/* Test for hit */
if (success_hit)
{
sound(SOUND_HIT);
/* Message */
- if (backstab)
-#ifdef JP
- msg_format("¤¢¤Ê¤¿¤ÏÎä¹ó¤Ë¤â̲¤Ã¤Æ¤¤¤ë̵ÎϤÊ%s¤òÆͤ»É¤·¤¿¡ª",
-#else
- msg_format("You cruelly stab the helpless, sleeping %s!",
-#endif
-
- m_name);
- else if (fuiuchi)
-#ifdef JP
- msg_format("ÉÔ°Õ¤òÆͤ¤¤Æ%s¤Ë¶¯Îõ¤Ê°ì·â¤ò¶ô¤é¤ï¤»¤¿¡ª",
-#else
- msg_format("You make surprise attack, and hit %s with a powerful blow!",
-#endif
-
- m_name);
- else if (stab_fleeing)
-#ifdef JP
- msg_format("ƨ¤²¤ë%s¤òÇØÃ椫¤éÆͤ»É¤·¤¿¡ª",
-#else
- msg_format("You backstab the fleeing %s!",
-#endif
-
- m_name);
- else
- {
- if (!(((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_BERSERKER)) && (empty_hands(TRUE) & EMPTY_HAND_RARM)))
#ifdef JP
- msg_format("%s¤ò¹¶·â¤·¤¿¡£", m_name);
+ if (backstab) msg_format("¤¢¤Ê¤¿¤ÏÎä¹ó¤Ë¤â̲¤Ã¤Æ¤¤¤ë̵ÎϤÊ%s¤òÆͤ»É¤·¤¿¡ª", m_name);
+ else if (fuiuchi) msg_format("ÉÔ°Õ¤òÆͤ¤¤Æ%s¤Ë¶¯Îõ¤Ê°ì·â¤ò¶ô¤é¤ï¤»¤¿¡ª", m_name);
+ else if (stab_fleeing) msg_format("ƨ¤²¤ë%s¤òÇØÃ椫¤éÆͤ»É¤·¤¿¡ª", m_name);
+ else if (!monk_attack) msg_format("%s¤ò¹¶·â¤·¤¿¡£", m_name);
#else
- msg_format("You hit %s.", m_name);
+ if (backstab) msg_format("You cruelly stab the helpless, sleeping %s!", m_name);
+ else if (fuiuchi) msg_format("You make surprise attack, and hit %s with a powerful blow!", m_name);
+ else if (stab_fleeing) msg_format("You backstab the fleeing %s!", m_name);
+ else if (!monk_attack) msg_format("You hit %s.", m_name);
#endif
- }
-
/* Hack -- bare hands do one damage */
k = 1;
}
/* Vampiric drain */
- if ((have_flag(flgs, TR_VAMPIRIC)) || (chaos_effect == 1) || (mode == HISSATSU_DRAIN))
+ if ((have_flag(flgs, TR_VAMPIRIC)) || (chaos_effect == 1) || (mode == HISSATSU_DRAIN) || hex_spelling(HEX_VAMP_BLADE))
{
/* Only drain "living" monsters */
if (monster_living(r_ptr))
can_drain = FALSE;
}
- if ((have_flag(flgs, TR_VORPAL)) && (randint1(vorpal_chance*3/2) == 1) && !zantetsu_mukou)
+ if ((have_flag(flgs, TR_VORPAL) || hex_spelling(HEX_RUNESWORD)) && (randint1(vorpal_chance*3/2) == 1) && !zantetsu_mukou)
vorpal_cut = TRUE;
else vorpal_cut = FALSE;
- if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_BERSERKER)) && (empty_hands(TRUE) & EMPTY_HAND_RARM))
+ if (monk_attack)
{
int special_effect = 0, stun_effect = 0, times = 0, max_times;
int min_level = 1;
- martial_arts *ma_ptr = &ma_blows[0], *old_ptr = &ma_blows[0];
+ const martial_arts *ma_ptr = &ma_blows[0], *old_ptr = &ma_blows[0];
int resist_stun = 0;
int weight = 8;
#else
msg_print("Attack re-selected.");
#endif
-
}
}
else
if (p_ptr->pclass == CLASS_FORCETRAINER) min_level = MAX(1, ma_ptr->min_level - 3);
else min_level = ma_ptr->min_level;
- k = damroll(ma_ptr->dd, ma_ptr->ds);
+ k = damroll(ma_ptr->dd + p_ptr->to_dd[hand], ma_ptr->ds + p_ptr->to_ds[hand]);
if (p_ptr->special_attack & ATTACK_SUIKEN) k *= 2;
if (ma_ptr->effect == MA_KNEE)
else if (ma_ptr->effect == MA_SLOW)
{
if (!((r_ptr->flags1 & RF1_NEVER_MOVE) ||
- strchr("~#{}.UjmeEv$,DdsbBFIJQSXclnw!=?", r_ptr->d_char)))
+ my_strchr("~#{}.UjmeEv$,DdsbBFIJQSXclnw!=?", r_ptr->d_char)))
{
#ifdef JP
msg_format("%s¤Î¼ó¤Ë´ØÀá½³¤ê¤ò¤¯¤é¤ï¤·¤¿¡ª", m_name);
{
if (p_ptr->lev > randint1(r_ptr->level + resist_stun + 10))
{
- if (m_ptr->stunned)
+ if (set_monster_stunned(c_ptr->m_idx, stun_effect + MON_STUNNED(m_ptr)))
+ {
#ifdef JP
- msg_format("%^s¤Ï¤µ¤é¤Ë¥Õ¥é¥Õ¥é¤Ë¤Ê¤Ã¤¿¡£", m_name);
+ msg_format("%^s¤Ï¥Õ¥é¥Õ¥é¤Ë¤Ê¤Ã¤¿¡£", m_name);
#else
- msg_format("%^s is more stunned.", m_name);
+ msg_format("%^s is stunned.", m_name);
#endif
-
+ }
else
+ {
#ifdef JP
- msg_format("%^s¤Ï¥Õ¥é¥Õ¥é¤Ë¤Ê¤Ã¤¿¡£", m_name);
+ msg_format("%^s¤Ï¤µ¤é¤Ë¥Õ¥é¥Õ¥é¤Ë¤Ê¤Ã¤¿¡£", m_name);
#else
- msg_format("%^s is stunned.", m_name);
+ msg_format("%^s is more stunned.", m_name);
#endif
-
-
- m_ptr->stunned += stun_effect;
+ }
}
}
}
{
char chainsword_noise[1024];
#ifdef JP
- if (!get_rnd_line("chainswd_j.txt", 0, chainsword_noise))
+ if (!get_rnd_line("chainswd_j.txt", 0, chainsword_noise))
#else
if (!get_rnd_line("chainswd.txt", 0, chainsword_noise))
#endif
-
{
msg_print(chainsword_noise);
}
#else
msg_print("Your Vorpal Blade goes snicker-snack!");
#endif
-
}
else
{
#else
msg_format("Your weapon cuts deep into %s!", m_name);
#endif
-
}
/* Try to increase the damage */
#else
msg_format("You cut %s in half!", m_name);
#endif
-
}
else
{
- switch(mult)
+ switch (mult)
{
#ifdef JP
-case 2: msg_format("%s¤ò»Â¤Ã¤¿¡ª", m_name); break;
-#else
- case 2: msg_format("You gouge %s!", m_name); break;
-#endif
-
-#ifdef JP
-case 3: msg_format("%s¤ò¤Ö¤Ã¤¿»Â¤Ã¤¿¡ª", m_name); break;
-#else
- case 3: msg_format("You maim %s!", m_name); break;
-#endif
-
-#ifdef JP
-case 4: msg_format("%s¤ò¥á¥Ã¥¿»Â¤ê¤Ë¤·¤¿¡ª", m_name); break;
-#else
- case 4: msg_format("You carve %s!", m_name); break;
-#endif
-
-#ifdef JP
-case 5: msg_format("%s¤ò¥á¥Ã¥¿¥á¥¿¤Ë»Â¤Ã¤¿¡ª", m_name); break;
-#else
- case 5: msg_format("You cleave %s!", m_name); break;
-#endif
-
-#ifdef JP
-case 6: msg_format("%s¤ò»É¿È¤Ë¤·¤¿¡ª", m_name); break;
-#else
- case 6: msg_format("You smite %s!", m_name); break;
-#endif
-
-#ifdef JP
-case 7: msg_format("%s¤ò»Â¤Ã¤Æ»Â¤Ã¤Æ»Â¤ê¤Þ¤¯¤Ã¤¿¡ª", m_name); break;
-#else
- case 7: msg_format("You eviscerate %s!", m_name); break;
-#endif
-
-#ifdef JP
-default: msg_format("%s¤òºÙÀÚ¤ì¤Ë¤·¤¿¡ª", m_name); break;
-#else
- default: msg_format("You shred %s!", m_name); break;
+ case 2: msg_format("%s¤ò»Â¤Ã¤¿¡ª", m_name); break;
+ case 3: msg_format("%s¤ò¤Ö¤Ã¤¿»Â¤Ã¤¿¡ª", m_name); break;
+ case 4: msg_format("%s¤ò¥á¥Ã¥¿»Â¤ê¤Ë¤·¤¿¡ª", m_name); break;
+ case 5: msg_format("%s¤ò¥á¥Ã¥¿¥á¥¿¤Ë»Â¤Ã¤¿¡ª", m_name); break;
+ case 6: msg_format("%s¤ò»É¿È¤Ë¤·¤¿¡ª", m_name); break;
+ case 7: msg_format("%s¤ò»Â¤Ã¤Æ»Â¤Ã¤Æ»Â¤ê¤Þ¤¯¤Ã¤¿¡ª", m_name); break;
+ default: msg_format("%s¤òºÙÀÚ¤ì¤Ë¤·¤¿¡ª", m_name); break;
+#else
+ case 2: msg_format("You gouge %s!", m_name); break;
+ case 3: msg_format("You maim %s!", m_name); break;
+ case 4: msg_format("You carve %s!", m_name); break;
+ case 5: msg_format("You cleave %s!", m_name); break;
+ case 6: msg_format("You smite %s!", m_name); break;
+ case 7: msg_format("You eviscerate %s!", m_name); break;
+ default: msg_format("You shred %s!", m_name); break;
#endif
-
}
}
drain_result = drain_result * 3 / 2;
if (!(r_ptr->flags3 & (RF3_NO_STUN)))
{
/* Get stunned */
- if (m_ptr->stunned)
+ if (MON_STUNNED(m_ptr))
{
#ifdef JP
-msg_format("%s¤Ï¤Ò¤É¤¯¤â¤¦¤í¤¦¤È¤·¤¿¡£", m_name);
+ msg_format("%s¤Ï¤Ò¤É¤¯¤â¤¦¤í¤¦¤È¤·¤¿¡£", m_name);
#else
msg_format("%s is more dazed.", m_name);
#endif
else
{
#ifdef JP
-msg_format("%s ¤Ï¤â¤¦¤í¤¦¤È¤·¤¿¡£", m_name);
+ msg_format("%s ¤Ï¤â¤¦¤í¤¦¤È¤·¤¿¡£", m_name);
#else
msg_format("%s is dazed.", m_name);
#endif
}
/* Apply stun */
- m_ptr->stunned = (tmp < 200) ? tmp : 200;
+ (void)set_monster_stunned(c_ptr->m_idx, MON_STUNNED(m_ptr) + tmp);
}
else
{
#ifdef JP
-msg_format("%s ¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
+ msg_format("%s ¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
#else
- msg_format("%s is not effected.", m_name);
+ msg_format("%s is not effected.", m_name);
#endif
}
}
{
k = m_ptr->hp + 1;
#ifdef JP
-msg_format("%s¤ÎµÞ½ê¤òÆͤ»É¤·¤¿¡ª", m_name);
+ msg_format("%s¤ÎµÞ½ê¤òÆͤ»É¤·¤¿¡ª", m_name);
#else
msg_format("You hit %s on a fatal spot!", m_name);
#endif
k *= 5;
drain_result *= 2;
#ifdef JP
-msg_format("¿Ï¤¬%s¤Ë¿¼¡¹¤ÈÆͤ»É¤µ¤Ã¤¿¡ª", m_name);
+ msg_format("¿Ï¤¬%s¤Ë¿¼¡¹¤ÈÆͤ»É¤µ¤Ã¤¿¡ª", m_name);
#else
msg_format("You critically injured %s!", m_name);
#endif
k = MAX(k*5, m_ptr->hp/2);
drain_result *= 2;
#ifdef JP
-msg_format("%s¤ËÃ×Ì¿½ý¤òÉé¤ï¤»¤¿¡ª", m_name);
+ msg_format("%s¤ËÃ×Ì¿½ý¤òÉé¤ï¤»¤¿¡ª", m_name);
#else
- msg_format("You fatally injured %s!", m_name);
+ msg_format("You fatally injured %s!", m_name);
#endif
}
else
{
k = m_ptr->hp + 1;
#ifdef JP
-msg_format("¿Ï¤¬%s¤ÎµÞ½ê¤ò´Ó¤¤¤¿¡ª", m_name);
+ msg_format("¿Ï¤¬%s¤ÎµÞ½ê¤ò´Ó¤¤¤¿¡ª", m_name);
#else
- msg_format("You hit %s on a fatal spot!", m_name);
+ msg_format("You hit %s on a fatal spot!", m_name);
#endif
}
}
#else
msg_format("You do %d (out of %d) damage.", k, m_ptr->hp);
#endif
-
}
if (k <= 0) can_drain = FALSE;
#ifdef JP
msg_print("¤Þ¤¿¤Ä¤Þ¤é¤Ì¤â¤Î¤ò»Â¤Ã¤Æ¤·¤Þ¤Ã¤¿¡¥¡¥¡¥");
#else
- msg_print("Sign..Another trifling thing I've cut....");
+ msg_print("Sigh... Another trifling thing I've cut....");
#endif
break;
}
{
drain_heal = damroll(2, drain_result / 6);
+ /* Hex */
+ if (hex_spelling(HEX_VAMP_BLADE)) drain_heal *= 2;
+
if (cheat_xtra)
{
#ifdef JP
}
m_ptr->maxhp -= (k+7)/8;
if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
+ if (m_ptr->maxhp < 1) m_ptr->maxhp = 1;
weak = TRUE;
}
can_drain = FALSE;
drain_result = 0;
/* Confusion attack */
- if ((p_ptr->special_attack & ATTACK_CONFUSE) || (chaos_effect == 3) || (mode == HISSATSU_CONF))
+ if ((p_ptr->special_attack & ATTACK_CONFUSE) || (chaos_effect == 3) || (mode == HISSATSU_CONF) || hex_spelling(HEX_CONFUSION))
{
/* Cancel glowing hands */
if (p_ptr->special_attack & ATTACK_CONFUSE)
/* Confuse the monster */
if (r_ptr->flags3 & RF3_NO_CONF)
{
- if (m_ptr->ml && is_original_ap(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_NO_CONF;
- }
+ if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_NO_CONF;
#ifdef JP
msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
msg_format("%^s appears confused.", m_name);
#endif
- m_ptr->confused += 10 + randint0(p_ptr->lev) / 5;
+ (void)set_monster_confused(c_ptr->m_idx, MON_CONFUSED(m_ptr) + 10 + randint0(p_ptr->lev) / 5);
}
}
{
if (r_ptr->flags1 & RF1_UNIQUE)
{
- if (m_ptr->ml && is_original_ap(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
+ if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
#ifdef JP
msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
#else
}
else if (r_ptr->level > randint1(100))
{
- if (m_ptr->ml && is_original_ap(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
+ if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
#ifdef JP
msg_format("%^s¤ÏÄñ¹³ÎϤò»ý¤Ã¤Æ¤¤¤ë¡ª", m_name);
#else
msg_format("%^s disappears!", m_name);
#endif
- teleport_away(c_ptr->m_idx, 50, FALSE);
+ teleport_away(c_ptr->m_idx, 50, TELEPORT_PASSIVE);
num = num_blow + 1; /* Can't hit it anymore! */
*mdeath = TRUE;
}
}
- else if ((chaos_effect == 5) && cave_floor_bold(y, x) &&
- (randint1(90) > r_ptr->level))
+ else if ((chaos_effect == 5) && (randint1(90) > r_ptr->level))
{
if (!(r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) &&
!(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
msg_format("%^s changes!", m_name);
#endif
-
- /* Hack -- Get new monster */
- m_ptr = &m_list[c_ptr->m_idx];
-
- /* Oops, we need a different name... */
- monster_desc(m_name, m_ptr, 0);
-
- /* Hack -- Get new race */
- r_ptr = &r_info[m_ptr->r_idx];
-
*fear = FALSE;
weak = FALSE;
}
#else
msg_format("%^s is unaffected.", m_name);
#endif
-
}
+
+ /* Hack -- Get new monster */
+ m_ptr = &m_list[c_ptr->m_idx];
+
+ /* Oops, we need a different name... */
+ monster_desc(m_name, m_ptr, 0);
+
+ /* Hack -- Get new race */
+ r_ptr = &r_info[m_ptr->r_idx];
}
}
else if (o_ptr->name1 == ART_G_HAMMER)
object_type *q_ptr = &o_list[m_ptr->hold_o_idx];
char o_name[MAX_NLEN];
- object_desc(o_name, q_ptr, TRUE, 0);
+ object_desc(o_name, q_ptr, OD_NAME_ONLY);
q_ptr->held_m_idx = 0;
- q_ptr->marked = 0;
+ q_ptr->marked = OM_TOUCHED;
m_ptr->hold_o_idx = q_ptr->next_o_idx;
q_ptr->next_o_idx = 0;
#ifdef JP
/* Extract the flags */
object_flags(o_ptr, flgs);
- k = damroll(o_ptr->dd, o_ptr->ds);
+ k = damroll(o_ptr->dd + p_ptr->to_dd[hand], o_ptr->ds + p_ptr->to_ds[hand]);
{
int mult;
switch (p_ptr->mimic_form)
case RACE_HUMAN:
case RACE_AMBERITE:
case RACE_DUNADAN:
+ case RACE_BARBARIAN:
+ case RACE_BEASTMAN:
mult = 25;break;
case RACE_HALF_ORC:
case RACE_HALF_TROLL:
char m_name[80];
/* Disturb the player */
- disturb(0, 0);
+ disturb(0, 1);
energy_use = 100;
- if (m_ptr->csleep) /* It is not honorable etc to attack helpless victims */
+ if (!p_ptr->migite && !p_ptr->hidarite &&
+ !(p_ptr->muta2 & (MUT2_HORNS | MUT2_BEAK | MUT2_SCOR_TAIL | MUT2_TRUNK | MUT2_TENTACLES)))
{
- if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
- if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
+#ifdef JP
+ msg_format("%s¹¶·â¤Ç¤¤Ê¤¤¡£", (empty_hands(FALSE) == EMPTY_HAND_NONE) ? "ξ¼ê¤¬¤Õ¤µ¤¬¤Ã¤Æ" : "");
+#else
+ msg_print("You cannot do attacking.");
+#endif
+ return FALSE;
}
/* Extract monster name (or "it") */
monster_desc(m_name, m_ptr, 0);
- /* Auto-Recall if possible and visible */
- if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
+ if (m_ptr->ml)
+ {
+ /* Auto-Recall if possible and visible */
+ if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
- /* Track a new monster */
- if (m_ptr->ml) health_track(c_ptr->m_idx);
+ /* Track a new monster */
+ health_track(c_ptr->m_idx);
+ }
if ((r_ptr->flags1 & RF1_FEMALE) &&
!(p_ptr->stun || p_ptr->confused || p_ptr->image || !m_ptr->ml))
/* Message */
if (m_ptr->ml)
#ifdef JP
- msg_format("¶²¤¯¤Æ%s¤ò¹¶·â¤Ç¤¤Ê¤¤¡ª", m_name);
+ msg_format("¶²¤¯¤Æ%s¤ò¹¶·â¤Ç¤¤Ê¤¤¡ª", m_name);
#else
msg_format("You are too afraid to attack %s!", m_name);
#endif
#endif
/* Disturb the monster */
- m_ptr->csleep = 0;
- if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
+ (void)set_monster_csleep(c_ptr->m_idx, 0);
/* Done */
return FALSE;
}
+ if (MON_CSLEEP(m_ptr)) /* It is not honorable etc to attack helpless victims */
+ {
+ if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
+ if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
+ }
+
if (p_ptr->migite && p_ptr->hidarite)
{
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_ptr->level))
}
-static bool pattern_seq(int c_y, int c_x, int n_y, int n_x)
+bool pattern_seq(int c_y, int c_x, int n_y, int n_x)
{
- if (!pattern_tile(c_y, c_x) && !pattern_tile(n_y, n_x))
- return TRUE;
+ feature_type *cur_f_ptr = &f_info[cave[c_y][c_x].feat];
+ feature_type *new_f_ptr = &f_info[cave[n_y][n_x].feat];
+ bool is_pattern_tile_cur = have_flag(cur_f_ptr->flags, FF_PATTERN);
+ bool is_pattern_tile_new = have_flag(new_f_ptr->flags, FF_PATTERN);
+ int pattern_type_cur, pattern_type_new;
+
+ if (!is_pattern_tile_cur && !is_pattern_tile_new) return TRUE;
- if (cave[n_y][n_x].feat == FEAT_PATTERN_START)
+ pattern_type_cur = is_pattern_tile_cur ? cur_f_ptr->subtype : NOT_PATTERN_TILE;
+ pattern_type_new = is_pattern_tile_new ? new_f_ptr->subtype : NOT_PATTERN_TILE;
+
+ if (pattern_type_new == PATTERN_TILE_START)
{
- if (!pattern_tile(c_y, c_x) &&
- !p_ptr->confused && !p_ptr->stun && !p_ptr->image)
+ if (!is_pattern_tile_cur && !p_ptr->confused && !p_ptr->stun && !p_ptr->image)
{
#ifdef JP
if (get_check("¥Ñ¥¿¡¼¥ó¤Î¾å¤òÊ⤻Ϥá¤ë¤È¡¢Á´¤Æ¤òÊ⤫¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£¤¤¤¤¤Ç¤¹¤«¡©"))
#else
if (get_check("If you start walking the Pattern, you must walk the whole way. Ok? "))
#endif
-
return TRUE;
else
return FALSE;
else
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))
+ else if ((pattern_type_new == PATTERN_TILE_OLD) ||
+ (pattern_type_new == PATTERN_TILE_END) ||
+ (pattern_type_new == PATTERN_TILE_WRECKED))
{
- if (pattern_tile(c_y, c_x))
+ if (is_pattern_tile_cur)
{
return TRUE;
}
return FALSE;
}
}
- else if ((cave[n_y][n_x].feat == FEAT_PATTERN_XTRA1) ||
- (cave[c_y][c_x].feat == FEAT_PATTERN_XTRA1))
+ else if ((pattern_type_new == PATTERN_TILE_TELEPORT) ||
+ (pattern_type_cur == PATTERN_TILE_TELEPORT))
{
return TRUE;
}
- else if (cave[c_y][c_x].feat == FEAT_PATTERN_START)
+ else if (pattern_type_cur == PATTERN_TILE_START)
{
- if (pattern_tile(n_y, n_x))
+ if (is_pattern_tile_new)
return TRUE;
else
{
return FALSE;
}
}
- 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))
+ else if ((pattern_type_cur == PATTERN_TILE_OLD) ||
+ (pattern_type_cur == PATTERN_TILE_END) ||
+ (pattern_type_cur == PATTERN_TILE_WRECKED))
{
- if (!pattern_tile(n_y, n_x))
+ if (!is_pattern_tile_new)
{
#ifdef JP
msg_print("¥Ñ¥¿¡¼¥ó¤òƧ¤ß³°¤·¤Æ¤Ï¤¤¤±¤Þ¤»¤ó¡£");
}
else
{
- if (!pattern_tile(c_y, c_x))
+ if (!is_pattern_tile_cur)
{
#ifdef JP
msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤òÊ⤯¤Ë¤Ï¥¹¥¿¡¼¥ÈÃÏÅÀ¤«¤éÊ⤻Ϥá¤Ê¤¯¤Æ¤Ï¤Ê¤ê¤Þ¤»¤ó¡£");
}
else
{
- byte ok_move = FEAT_PATTERN_START;
- switch (cave[c_y][c_x].feat)
+ byte ok_move = PATTERN_TILE_START;
+ switch (pattern_type_cur)
{
- case FEAT_PATTERN_1:
- ok_move = FEAT_PATTERN_2;
+ case PATTERN_TILE_1:
+ ok_move = PATTERN_TILE_2;
break;
- case FEAT_PATTERN_2:
- ok_move = FEAT_PATTERN_3;
+ case PATTERN_TILE_2:
+ ok_move = PATTERN_TILE_3;
break;
- case FEAT_PATTERN_3:
- ok_move = FEAT_PATTERN_4;
+ case PATTERN_TILE_3:
+ ok_move = PATTERN_TILE_4;
break;
- case FEAT_PATTERN_4:
- ok_move = FEAT_PATTERN_1;
+ case PATTERN_TILE_4:
+ ok_move = PATTERN_TILE_1;
break;
default:
if (p_ptr->wizard)
#ifdef JP
- msg_format("¤ª¤«¤·¤Ê¥Ñ¥¿¡¼¥óÊâ¹Ô¡¢%d¡£", cave[c_y][c_x].feat);
+ msg_format("¤ª¤«¤·¤Ê¥Ñ¥¿¡¼¥óÊâ¹Ô¡¢%d¡£", pattern_type_cur);
#else
- msg_format("Funny Pattern walking, %d.", cave[c_y][c_x].feat);
+ msg_format("Funny Pattern walking, %d.", pattern_type_cur);
#endif
return TRUE; /* Goof-up */
}
- if ((cave[n_y][n_x].feat == ok_move) ||
- (cave[n_y][n_x].feat == cave[c_y][c_x].feat))
+ if ((pattern_type_new == ok_move) ||
+ (pattern_type_new == pattern_type_cur))
return TRUE;
else
{
- if (!pattern_tile(n_y, n_x))
+ if (!is_pattern_tile_new)
#ifdef JP
msg_print("¥Ñ¥¿¡¼¥ó¤òƧ¤ß³°¤·¤Æ¤Ï¤¤¤±¤Þ¤»¤ó¡£");
#else
msg_print("You may not step off from the Pattern.");
#endif
-
else
#ifdef JP
msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤ÏÀµ¤·¤¤½ç½ø¤ÇÊ⤫¤Í¤Ð¤Ê¤ê¤Þ¤»¤ó¡£");
msg_print("You must walk the Pattern in correct order.");
#endif
-
return FALSE;
}
}
}
+bool player_can_enter(s16b feature, u16b mode)
+{
+ feature_type *f_ptr = &f_info[feature];
+
+ if (p_ptr->riding) return monster_can_cross_terrain(feature, &r_info[m_list[p_ptr->riding].r_idx], mode | CEM_RIDING);
+
+ /* Pattern */
+ if (have_flag(f_ptr->flags, FF_PATTERN))
+ {
+ if (!(mode & CEM_P_CAN_ENTER_PATTERN)) return FALSE;
+ }
+
+ /* "CAN" flags */
+ if (have_flag(f_ptr->flags, FF_CAN_FLY) && p_ptr->levitation) return TRUE;
+ if (have_flag(f_ptr->flags, FF_CAN_SWIM) && p_ptr->can_swim) return TRUE;
+ if (have_flag(f_ptr->flags, FF_CAN_PASS) && p_ptr->pass_wall) return TRUE;
+
+ if (!have_flag(f_ptr->flags, FF_MOVE)) return FALSE;
+
+ return TRUE;
+}
+
-bool player_can_enter(byte feature)
+/*
+ * Move the player
+ */
+bool move_player_effect(int ny, int nx, u32b mpe_mode)
{
- switch (feature)
+ cave_type *c_ptr = &cave[ny][nx];
+ feature_type *f_ptr = &f_info[c_ptr->feat];
+
+ if (!(mpe_mode & MPE_STAYING))
{
- 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;
+ int oy = py;
+ int ox = px;
+ cave_type *oc_ptr = &cave[oy][ox];
+ int om_idx = oc_ptr->m_idx;
+ int nm_idx = c_ptr->m_idx;
+
+ /* Move the player */
+ py = ny;
+ px = nx;
+
+ /* Hack -- For moving monster or riding player's moving */
+ if (!(mpe_mode & MPE_DONT_SWAP_MON))
+ {
+ /* Swap two monsters */
+ c_ptr->m_idx = om_idx;
+ oc_ptr->m_idx = nm_idx;
+
+ if (om_idx > 0) /* Monster on old spot (or p_ptr->riding) */
+ {
+ monster_type *om_ptr = &m_list[om_idx];
+ om_ptr->fy = ny;
+ om_ptr->fx = nx;
+ update_mon(om_idx, TRUE);
+ }
+
+ if (nm_idx > 0) /* Monster on new spot */
+ {
+ monster_type *nm_ptr = &m_list[nm_idx];
+ nm_ptr->fy = oy;
+ nm_ptr->fx = ox;
+ update_mon(nm_idx, TRUE);
+ }
+ }
+
+ /* Redraw old spot */
+ lite_spot(oy, ox);
+
+ /* Redraw new spot */
+ lite_spot(ny, nx);
+
+ /* Check for new panel (redraw map) */
+ verify_panel();
+
+ if (mpe_mode & MPE_FORGET_FLOW)
+ {
+ forget_flow();
+
+ /* Mega-Hack -- Forget the view */
+ p_ptr->update |= (PU_UN_VIEW);
+
+ /* Redraw map */
+ p_ptr->redraw |= (PR_MAP);
+ }
+
+ /* Update stuff */
+ p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_DISTANCE);
+
+ /* Window stuff */
+ p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+
+ /* Remove "unsafe" flag */
+ if ((!p_ptr->blind && !no_lite()) || !is_trap(c_ptr->feat)) c_ptr->info &= ~(CAVE_UNSAFE);
+
+ /* For get everything when requested hehe I'm *NASTY* */
+ if (dun_level && (d_info[dungeon_type].flags1 & DF1_FORGET)) wiz_dark();
+
+ /* Handle stuff */
+ if (mpe_mode & MPE_HANDLE_STUFF) handle_stuff();
+
+ if (p_ptr->pclass == CLASS_NINJA)
+ {
+ if (c_ptr->info & (CAVE_GLOW)) set_superstealth(FALSE);
+ else if (p_ptr->cur_lite <= 0) set_superstealth(TRUE);
+ }
+
+ if ((p_ptr->action == ACTION_HAYAGAKE) &&
+ (!have_flag(f_ptr->flags, FF_PROJECT) ||
+ (!p_ptr->levitation && have_flag(f_ptr->flags, FF_DEEP))))
+ {
+#ifdef JP
+ msg_print("¤³¤³¤Ç¤ÏÁÇÁ᤯ư¤±¤Ê¤¤¡£");
+#else
+ msg_print("You cannot run in here.");
+#endif
+ set_action(ACTION_NONE);
+ }
+ }
+
+ if (mpe_mode & MPE_ENERGY_USE)
+ {
+ if (music_singing(MUSIC_WALL))
+ {
+ (void)project(0, 0, py, px, (60 + p_ptr->lev), GF_DISINTEGRATE,
+ PROJECT_KILL | PROJECT_ITEM, -1);
+
+ if (!player_bold(ny, nx) || p_ptr->is_dead || p_ptr->leaving) return FALSE;
+ }
+
+ /* Spontaneous Searching */
+ if ((p_ptr->skill_fos >= 50) || (0 == randint0(50 - p_ptr->skill_fos)))
+ {
+ search();
+ }
+
+ /* Continuous Searching */
+ if (p_ptr->action == ACTION_SEARCH)
+ {
+ search();
+ }
+ }
+
+ /* Handle "objects" */
+ if (!(mpe_mode & MPE_DONT_PICKUP))
+ {
+ carry((mpe_mode & MPE_DO_PICKUP) ? TRUE : FALSE);
+ }
- case FEAT_DARK_PIT:
- return p_ptr->ffall;
+ /* Handle "store doors" */
+ if (have_flag(f_ptr->flags, FF_STORE))
+ {
+ /* Disturb */
+ disturb(0, 1);
- case FEAT_MOUNTAIN:
- return !dun_level && p_ptr->ffall;
+ energy_use = 0;
+ /* Hack -- Enter store */
+ command_new = SPECIAL_KEY_STORE;
}
- /* Assume okay */
- return TRUE;
+ /* Handle "building doors" -KMW- */
+ else if (have_flag(f_ptr->flags, FF_BLDG))
+ {
+ /* Disturb */
+ disturb(0, 1);
+
+ energy_use = 0;
+ /* Hack -- Enter building */
+ command_new = SPECIAL_KEY_BUILDING;
+ }
+
+ /* Handle quest areas -KMW- */
+ else if (have_flag(f_ptr->flags, FF_QUEST_ENTER))
+ {
+ /* Disturb */
+ disturb(0, 1);
+
+ energy_use = 0;
+ /* Hack -- Enter quest level */
+ command_new = SPECIAL_KEY_QUEST;
+ }
+
+ else if (have_flag(f_ptr->flags, FF_QUEST_EXIT))
+ {
+ if (quest[p_ptr->inside_quest].type == QUEST_TYPE_FIND_EXIT)
+ {
+ complete_quest(p_ptr->inside_quest);
+ }
+
+ leave_quest_check();
+
+ p_ptr->inside_quest = c_ptr->special;
+ dun_level = 0;
+ p_ptr->oldpx = 0;
+ p_ptr->oldpy = 0;
+
+ p_ptr->leaving = TRUE;
+ }
+
+ /* Set off a trap */
+ else if (have_flag(f_ptr->flags, FF_HIT_TRAP) && !(mpe_mode & MPE_STAYING))
+ {
+ /* Disturb */
+ disturb(0, 1);
+
+ /* Hidden trap */
+ if (c_ptr->mimic || have_flag(f_ptr->flags, FF_SECRET))
+ {
+ /* Message */
+#ifdef JP
+ msg_print("¥È¥é¥Ã¥×¤À¡ª");
+#else
+ msg_print("You found a trap!");
+#endif
+
+ /* Pick a trap */
+ disclose_grid(py, px);
+ }
+
+ /* Hit the trap */
+ hit_trap((mpe_mode & MPE_BREAK_TRAP) ? TRUE : FALSE);
+
+ if (!player_bold(ny, nx) || p_ptr->is_dead || p_ptr->leaving) return FALSE;
+ }
+
+ /* Warn when leaving trap detected region */
+ if (!(mpe_mode & MPE_STAYING) && (disturb_trap_detect || alert_trap_detect)
+ && p_ptr->dtrap && !(c_ptr->info & CAVE_IN_DETECT))
+ {
+ /* No duplicate warning */
+ p_ptr->dtrap = FALSE;
+
+ /* You are just on the edge */
+ if (!(c_ptr->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, 1);
+ }
+ }
+
+ return player_bold(ny, nx) && !p_ptr->is_dead && !p_ptr->leaving;
+}
+
+
+bool trap_can_be_ignored(int feat)
+{
+ feature_type *f_ptr = &f_info[feat];
+
+ if (!have_flag(f_ptr->flags, FF_TRAP)) return TRUE;
+
+ switch (f_ptr->subtype)
+ {
+ case TRAP_TRAPDOOR:
+ case TRAP_PIT:
+ case TRAP_SPIKED_PIT:
+ case TRAP_POISON_PIT:
+ if (p_ptr->levitation) return TRUE;
+ break;
+ case TRAP_TELEPORT:
+ if (p_ptr->anti_tele) return TRUE;
+ break;
+ case TRAP_FIRE:
+ if (p_ptr->immune_fire) return TRUE;
+ break;
+ case TRAP_ACID:
+ if (p_ptr->immune_acid) return TRUE;
+ break;
+ case TRAP_BLIND:
+ if (p_ptr->resist_blind) return TRUE;
+ break;
+ case TRAP_CONFUSE:
+ if (p_ptr->resist_conf) return TRUE;
+ break;
+ case TRAP_POISON:
+ if (p_ptr->resist_pois) return TRUE;
+ break;
+ case TRAP_SLEEP:
+ if (p_ptr->free_act) return TRUE;
+ break;
+ }
+
+ return FALSE;
}
/*
+ * Determine if a "boundary" grid is "floor mimic"
+ */
+#define boundary_floor(C, F, MF) \
+ ((C)->mimic && permanent_wall(F) && \
+ (have_flag((MF)->flags, FF_MOVE) || have_flag((MF)->flags, FF_CAN_FLY)) && \
+ have_flag((MF)->flags, FF_PROJECT) && \
+ !have_flag((MF)->flags, FF_OPEN))
+
+/*
* Move player in the given direction, with the given "pickup" flag.
*
* This routine should (probably) always induce energy expenditure.
* any monster which might be in the destination grid. Previously,
* moving into walls was "free" and did NOT hit invisible monsters.
*/
-void move_player(int dir, int do_pickup, bool break_trap)
+void move_player(int dir, bool do_pickup, bool break_trap)
{
- int y, x;
+ /* Find the result of moving */
+ int y = py + ddy[dir];
+ int x = px + ddx[dir];
+
+ /* Examine the destination */
+ cave_type *c_ptr = &cave[y][x];
+
+ feature_type *f_ptr = &f_info[c_ptr->feat];
- cave_type *c_ptr;
monster_type *m_ptr;
monster_type *riding_m_ptr = &m_list[p_ptr->riding];
char m_name[80];
- bool p_can_pass_walls = FALSE;
+ bool p_can_enter = player_can_enter(c_ptr->feat, CEM_P_CAN_ENTER_PATTERN);
+ bool p_can_kill_walls = FALSE;
bool stormbringer = FALSE;
bool oktomove = TRUE;
bool do_past = FALSE;
- /* Find the result of moving */
- y = py + ddy[dir];
- x = px + ddx[dir];
-
- /* Examine the destination */
- c_ptr = &cave[y][x];
-
/* Exit the area */
if (!dun_level && !p_ptr->wild_mode &&
((x == 0) || (x == MAX_WID - 1) ||
(y == 0) || (y == MAX_HGT - 1)))
{
/* Can the player enter the grid? */
- if (c_ptr->mimic && player_can_enter(c_ptr->mimic))
+ if (c_ptr->mimic && player_can_enter(c_ptr->mimic, 0))
{
/* Hack: move to new area */
if ((y == 0) && (x == 0))
ambush_flag = FALSE;
}
- /* Clear all saved floors */
- prepare_change_floor_mode(CFM_CLEAR_ALL);
-
p_ptr->leaving = TRUE;
energy_use = 100;
return;
}
- oktomove = FALSE;
+ /* "Blocked" message appears later */
+ /* oktomove = FALSE; */
+ p_can_enter = FALSE;
}
/* Get the monster */
/* Player can not walk through "walls"... */
/* unless in Shadow Form */
- if (p_ptr->wraith_form || p_ptr->pass_wall || p_ptr->kabenuke)
- p_can_pass_walls = TRUE;
- if ((cave[y][x].feat >= FEAT_PERM_EXTRA) &&
- (cave[y][x].feat <= FEAT_PERM_SOLID))
- {
- p_can_pass_walls = FALSE;
- }
+ p_can_kill_walls = p_ptr->kill_wall && have_flag(f_ptr->flags, FF_HURT_DISI) &&
+ (!p_can_enter || !have_flag(f_ptr->flags, FF_LOS)) &&
+ !have_flag(f_ptr->flags, FF_PERMANENT);
/* Hack -- attack monsters */
- if (c_ptr->m_idx && (m_ptr->ml || cave_floor_bold(y, x) || p_can_pass_walls))
+ if (c_ptr->m_idx && (m_ptr->ml || p_can_enter || p_can_kill_walls))
{
monster_race *r_ptr = &r_info[m_ptr->r_idx];
if (!is_hostile(m_ptr) &&
!(p_ptr->confused || p_ptr->image || !m_ptr->ml || p_ptr->stun ||
((p_ptr->muta2 & MUT2_BERS_RAGE) && p_ptr->shero)) &&
- (pattern_seq(py, px, y, x)) &&
- ((cave_floor_bold(y, x)) || (c_ptr->feat == FEAT_TREES) || (p_can_pass_walls)))
+ pattern_seq(py, px, y, x) && (p_can_enter || p_can_kill_walls))
{
- m_ptr->csleep = 0;
- if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
+ /* Disturb the monster */
+ (void)set_monster_csleep(c_ptr->m_idx, 0);
/* Extract monster name (or "it") */
monster_desc(m_name, m_ptr, 0);
- /* Auto-Recall if possible and visible */
- if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
+ if (m_ptr->ml)
+ {
+ /* Auto-Recall if possible and visible */
+ if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
- /* Track a new monster */
- if (m_ptr->ml) health_track(c_ptr->m_idx);
+ /* Track a new monster */
+ health_track(c_ptr->m_idx);
+ }
/* displace? */
if ((stormbringer && (randint1(1000) > 666)) || (p_ptr->pclass == CLASS_BERSERKER))
py_attack(y, x, 0);
oktomove = FALSE;
}
- else if (monster_can_cross_terrain(cave[py][px].feat, r_ptr) &&
- (cave_floor_bold(py, px) || cave[py][px].feat == FEAT_TREES ||
- (r_ptr->flags2 & RF2_PASS_WALL)))
+ else if (monster_can_cross_terrain(cave[py][px].feat, r_ptr, 0))
{
do_past = TRUE;
}
}
}
- if (!oktomove)
- {
- }
-
- else if ((c_ptr->feat == FEAT_DARK_PIT) && !p_ptr->ffall)
+ if (oktomove && p_ptr->riding)
{
+ if (riding_r_ptr->flags1 & RF1_NEVER_MOVE)
+ {
#ifdef JP
- msg_print("Îö¤±Ìܤò²£Àڤ뤳¤È¤Ï¤Ç¤¤Þ¤»¤ó¡£");
+ msg_print("Æ°¤±¤Ê¤¤¡ª");
#else
- msg_print("You can't cross the chasm.");
+ msg_print("Can't move!");
#endif
+ energy_use = 0;
+ oktomove = FALSE;
+ disturb(0, 1);
+ }
+ else if (MON_MONFEAR(riding_m_ptr))
+ {
+ char m_name[80];
- energy_use = 0;
- running = 0;
- oktomove = FALSE;
- }
+ /* Acquire the monster name */
+ monster_desc(m_name, riding_m_ptr, 0);
- else if (c_ptr->feat == FEAT_MOUNTAIN)
- {
- if (dun_level || !p_ptr->ffall)
- {
+ /* Dump a message */
#ifdef JP
- msg_print("»³¤Ë¤ÏÅФì¤Þ¤»¤ó¡ª");
+ msg_format("%s¤¬¶²Éݤ·¤Æ¤¤¤ÆÀ©¸æ¤Ç¤¤Ê¤¤¡£", m_name);
#else
- msg_print("You can't climb the mountains!");
+ msg_format("%^s is too scared to control.", m_name);
#endif
-
- running = 0;
- energy_use = 0;
oktomove = FALSE;
+ disturb(0, 1);
}
- }
- /*
- * Player can move through trees and
- * has effective -10 speed
- * Rangers can move without penality
- */
- else if (c_ptr->feat == FEAT_TREES)
- {
- oktomove = TRUE;
- if ((p_ptr->pclass != CLASS_RANGER) && !p_ptr->ffall) energy_use *= 2;
- }
-
- else if ((c_ptr->feat >= FEAT_QUEST_ENTER) &&
- (c_ptr->feat <= FEAT_QUEST_EXIT))
- {
- oktomove = TRUE;
- }
-
-#ifdef ALLOW_EASY_DISARM /* TNB */
-
- /* Disarm a visible trap */
- else if ((do_pickup != easy_disarm) && is_known_trap(c_ptr))
- {
- bool ignore = FALSE;
- switch (c_ptr->feat)
+ else if (p_ptr->riding_ryoute)
{
- case FEAT_TRAP_TRAPDOOR:
- case FEAT_TRAP_PIT:
- case FEAT_TRAP_SPIKED_PIT:
- case FEAT_TRAP_POISON_PIT:
- if (p_ptr->ffall) ignore = TRUE;
- break;
- case FEAT_TRAP_TELEPORT:
- if (p_ptr->anti_tele) ignore = TRUE;
- break;
- case FEAT_TRAP_FIRE:
- if (p_ptr->immune_fire) ignore = TRUE;
- break;
- case FEAT_TRAP_ACID:
- if (p_ptr->immune_acid) ignore = TRUE;
- break;
- case FEAT_TRAP_BLIND:
- if (p_ptr->resist_blind) ignore = TRUE;
- break;
- case FEAT_TRAP_CONFUSE:
- if (p_ptr->resist_conf) ignore = TRUE;
- break;
- case FEAT_TRAP_POISON:
- if (p_ptr->resist_pois) ignore = TRUE;
- break;
- case FEAT_TRAP_SLEEP:
- if (p_ptr->free_act) ignore = TRUE;
- break;
+ oktomove = FALSE;
+ disturb(0, 1);
}
-
- if (!ignore)
+ else if (have_flag(f_ptr->flags, FF_CAN_FLY) && (riding_r_ptr->flags7 & RF7_CAN_FLY))
{
- (void)do_cmd_disarm_aux(y, x, dir);
- return;
+ /* Allow moving */
}
- }
-
-#endif /* ALLOW_EASY_DISARM -- TNB */
- else if (p_ptr->riding && (riding_r_ptr->flags1 & RF1_NEVER_MOVE))
- {
+ else if (have_flag(f_ptr->flags, FF_CAN_SWIM) && (riding_r_ptr->flags7 & RF7_CAN_SWIM))
+ {
+ /* Allow moving */
+ }
+ else if (have_flag(f_ptr->flags, FF_WATER) &&
+ !(riding_r_ptr->flags7 & RF7_AQUATIC) &&
+ (have_flag(f_ptr->flags, FF_DEEP) || (riding_r_ptr->flags2 & RF2_AURA_FIRE)))
+ {
#ifdef JP
- msg_print("Æ°¤±¤Ê¤¤¡ª");
+ msg_format("%s¤Î¾å¤Ë¹Ô¤±¤Ê¤¤¡£", f_name + f_info[get_feat_mimic(c_ptr)].name);
#else
- msg_print("Can't move!");
+ msg_print("Can't swim.");
#endif
- energy_use = 0;
- oktomove = FALSE;
- disturb(0, 0);
- }
-
- else if (p_ptr->riding && riding_m_ptr->monfear)
- {
- char m_name[80];
-
- /* Acquire the monster name */
- monster_desc(m_name, riding_m_ptr, 0);
-
- /* Dump a message */
+ energy_use = 0;
+ oktomove = FALSE;
+ disturb(0, 1);
+ }
+ else if (!have_flag(f_ptr->flags, FF_WATER) && (riding_r_ptr->flags7 & RF7_AQUATIC))
+ {
#ifdef JP
- msg_format("%s¤¬¶²Éݤ·¤Æ¤¤¤ÆÀ©¸æ¤Ç¤¤Ê¤¤¡£", m_name);
+ msg_format("%s¤«¤é¾å¤¬¤ì¤Ê¤¤¡£", f_name + f_info[get_feat_mimic(&cave[py][px])].name);
#else
- msg_format("%^s is too scared to control.", m_name);
+ msg_print("Can't land.");
#endif
- oktomove = FALSE;
- disturb(0, 0);
- }
-
- else if (p_ptr->riding && p_ptr->riding_ryoute)
- {
- oktomove = FALSE;
- disturb(0, 0);
- }
-
- else if ((p_ptr->riding && (riding_r_ptr->flags7 & RF7_AQUATIC)) && (c_ptr->feat != FEAT_SHAL_WATER) && (c_ptr->feat != FEAT_DEEP_WATER))
- {
+ energy_use = 0;
+ oktomove = FALSE;
+ disturb(0, 1);
+ }
+ else if (have_flag(f_ptr->flags, FF_LAVA) && !(riding_r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK))
+ {
#ifdef JP
- msg_print("Φ¾å¤Ë¾å¤¬¤ì¤Ê¤¤¡£");
+ msg_format("%s¤Î¾å¤Ë¹Ô¤±¤Ê¤¤¡£", f_name + f_info[get_feat_mimic(c_ptr)].name);
#else
- msg_print("Can't land.");
+ msg_print("Too hot to go through.");
#endif
- energy_use = 0;
- oktomove = FALSE;
- disturb(0, 0);
- }
+ energy_use = 0;
+ oktomove = FALSE;
+ disturb(0, 1);
+ }
- else if ((p_ptr->riding && !(riding_r_ptr->flags7 & (RF7_AQUATIC | RF7_CAN_SWIM | RF7_CAN_FLY))) && (c_ptr->feat == FEAT_DEEP_WATER))
- {
+ if (oktomove && MON_STUNNED(riding_m_ptr) && one_in_(2))
+ {
+ char m_name[80];
+ monster_desc(m_name, riding_m_ptr, 0);
#ifdef JP
- msg_print("¿å¾å¤Ë¹Ô¤±¤Ê¤¤¡£");
+ msg_format("%s¤¬Û¯Û°¤È¤·¤Æ¤¤¤Æ¤¦¤Þ¤¯Æ°¤±¤Ê¤¤¡ª",m_name);
#else
- msg_print("Can't swim.");
+ msg_format("You cannot control stunned %s!",m_name);
#endif
- energy_use = 0;
- oktomove = FALSE;
- disturb(0, 0);
+ oktomove = FALSE;
+ disturb(0, 1);
+ }
}
- else if ((p_ptr->riding && (riding_r_ptr->flags2 & RF2_AURA_FIRE) && !(riding_r_ptr->flags7 & RF7_CAN_FLY)) && (c_ptr->feat == FEAT_SHAL_WATER))
+ if (!oktomove)
{
-#ifdef JP
- msg_print("¿å¾å¤Ë¹Ô¤±¤Ê¤¤¡£");
-#else
- msg_print("Can't swim.");
-#endif
- energy_use = 0;
- oktomove = FALSE;
- disturb(0, 0);
}
- else if ((p_ptr->riding && !(riding_r_ptr->flags7 & RF7_CAN_FLY) && !(riding_r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK)) && ((c_ptr->feat == FEAT_SHAL_LAVA) || (c_ptr->feat == FEAT_DEEP_LAVA)))
+ else if (!have_flag(f_ptr->flags, FF_MOVE) && have_flag(f_ptr->flags, FF_CAN_FLY) && !p_ptr->levitation)
{
#ifdef JP
- msg_print("ÍÏ´ä¤Î¾å¤Ë¹Ô¤±¤Ê¤¤¡£");
+ msg_format("¶õ¤òÈô¤Ð¤Ê¤¤¤È%s¤Î¾å¤Ë¤Ï¹Ô¤±¤Ê¤¤¡£", f_name + f_info[get_feat_mimic(c_ptr)].name);
#else
- msg_print("Too hot to go through.");
+ msg_format("You need to fly to go through the %s.", f_name + f_info[get_feat_mimic(c_ptr)].name);
#endif
+
energy_use = 0;
+ running = 0;
oktomove = FALSE;
- disturb(0, 0);
}
- else if (p_ptr->riding && riding_m_ptr->stunned && one_in_(2))
+ /*
+ * Player can move through trees and
+ * has effective -10 speed
+ * Rangers can move without penality
+ */
+ else if (have_flag(f_ptr->flags, FF_TREE) && !p_can_kill_walls)
{
- char m_name[80];
- monster_desc(m_name, riding_m_ptr, 0);
-#ifdef JP
- msg_format("%s¤¬Û¯Û°¤È¤·¤Æ¤¤¤Æ¤¦¤Þ¤¯Æ°¤±¤Ê¤¤¡ª",m_name);
-#else
- msg_format("You cannot control stunned %s!",m_name);
-#endif
- oktomove = FALSE;
- disturb(0, 0);
+ if ((p_ptr->pclass != CLASS_RANGER) && !p_ptr->levitation && (!p_ptr->riding || !(riding_r_ptr->flags8 & RF8_WILD_WOOD))) energy_use *= 2;
}
- /* Player can not walk through "walls" unless in wraith form...*/
- else if ((!cave_floor_bold(y, x)) &&
- (!p_can_pass_walls))
+#ifdef ALLOW_EASY_DISARM /* TNB */
+
+ /* Disarm a visible trap */
+ else if ((do_pickup != easy_disarm) && have_flag(f_ptr->flags, FF_DISARM) && !c_ptr->mimic)
{
- byte feat;
+ if (!trap_can_be_ignored(c_ptr->feat))
+ {
+ (void)do_cmd_disarm_aux(y, x, dir);
+ return;
+ }
+ }
- oktomove = FALSE;
+#endif /* ALLOW_EASY_DISARM -- TNB */
+ /* Player can not walk through "walls" unless in wraith form...*/
+ else if (!p_can_enter && !p_can_kill_walls)
+ {
/* Feature code (applying "mimic" field) */
- feat = f_info[c_ptr->mimic ? c_ptr->mimic : c_ptr->feat].mimic;
+ s16b feat = get_feat_mimic(c_ptr);
+ feature_type *mimic_f_ptr = &f_info[feat];
+ cptr name = f_name + mimic_f_ptr->name;
- /* Disturb the player */
- disturb(0, 0);
+ oktomove = FALSE;
/* Notice things in the dark */
- if ((!(c_ptr->info & (CAVE_MARK))) &&
- (p_ptr->blind || !(c_ptr->info & (CAVE_LITE))))
+ if (!(c_ptr->info & CAVE_MARK) && !player_can_see_bold(y, x))
{
- /* Rubble */
- if (feat == FEAT_RUBBLE)
- {
-#ifdef JP
- msg_print("´äÀФ¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£");
-#else
- msg_print("You feel some rubble blocking your way.");
-#endif
-
- c_ptr->info |= (CAVE_MARK);
- lite_spot(y, x);
- }
-
- /* Closed door */
- else if (is_closed_door(feat))
- {
-#ifdef JP
- msg_print("¥É¥¢¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£");
-#else
- msg_print("You feel a closed door blocking your way.");
-#endif
-
- c_ptr->info |= (CAVE_MARK);
- lite_spot(y, x);
- }
-
/* Boundary floor mimic */
- else if (boundary_floor_grid(c_ptr))
+ if (boundary_floor(c_ptr, f_ptr, mimic_f_ptr))
{
#ifdef JP
msg_print("¤½¤ì°Ê¾åÀè¤Ë¤Ï¿Ê¤á¤Ê¤¤¤è¤¦¤À¡£");
else
{
#ifdef JP
- msg_format("%s¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£", (feat == FEAT_TREES) ? "ÌÚ" : "ÊÉ");
+ msg_format("%s¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£", name);
#else
- msg_format("You feel a %s blocking your way.", (feat == FEAT_TREES) ? "tree" : "wall");
+ msg_format("You feel %s %s blocking your way.",
+ is_a_vowel(name[0]) ? "an" : "a", name);
#endif
c_ptr->info |= (CAVE_MARK);
}
/* Notice things */
- else
- {
- /* Rubble */
- if (feat == FEAT_RUBBLE)
- {
-#ifdef JP
- msg_print("´äÀФ¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¡£");
-#else
- msg_print("There is rubble blocking your way.");
-#endif
-
- if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
- energy_use = 0;
-
- /*
- * Well, it makes sense that you lose time bumping into
- * a wall _if_ you are confused, stunned or blind; but
- * typing mistakes should not cost you a turn...
- */
- }
- /* Closed doors */
- else if (is_closed_door(feat))
- {
-#ifdef ALLOW_EASY_OPEN
-
- if (easy_open && easy_open_door(y, x)) return;
-
-#endif /* ALLOW_EASY_OPEN */
-
-#ifdef JP
- msg_print("¥É¥¢¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¡£");
-#else
- 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;
- }
-
- /* Wall (or secret door) */
- else
- {
-#ifdef JP
- msg_format("%s¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¡£", (feat == FEAT_TREES) ? "ÌÚ" : "ÊÉ");
-#else
- 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 */
- if (!boundary_floor_grid(c_ptr)) sound(SOUND_HITWALL);
- }
-
- /* Normal movement */
- if (!pattern_seq(py, px, y, x))
- {
- if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
- {
- energy_use = 0;
- }
-
- /* To avoid a loop with running */
- disturb(0, 0);
-
- oktomove = FALSE;
- }
-
- /* Normal movement */
- if (oktomove)
- {
- int oy, ox;
-
- if (p_ptr->warning)
- {
- if(!process_warning(x, y))
- {
- energy_use = 25;
- return;
- }
- }
-
- /* Hack -- For moving monster or riding player's moving */
- cave[py][px].m_idx = c_ptr->m_idx;
- c_ptr->m_idx = 0;
-
- if (do_past)
- {
-#ifdef JP
- msg_format("%s¤ò²¡¤·Âऱ¤¿¡£", m_name);
-#else
- msg_format("You push past %s.", m_name);
-#endif
-
- m_ptr->fy = py;
- m_ptr->fx = px;
- update_mon(cave[py][px].m_idx, TRUE);
- }
-
- /* Change oldpx and oldpy to place the player well when going back to big mode */
- if (p_ptr->wild_mode)
- {
- if(ddy[dir] > 0) p_ptr->oldpy = 1;
- if(ddy[dir] < 0) p_ptr->oldpy = MAX_HGT - 2;
- if(ddy[dir] == 0) p_ptr->oldpy = MAX_HGT / 2;
- if(ddx[dir] > 0) p_ptr->oldpx = 1;
- if(ddx[dir] < 0) p_ptr->oldpx = MAX_WID - 2;
- if(ddx[dir] == 0) p_ptr->oldpx = MAX_WID / 2;
- }
-
- /* Save old location */
- oy = py;
- ox = px;
-
- /* Move the player */
- py = y;
- px = x;
-
- if (p_ptr->riding && (riding_r_ptr->flags2 & RF2_KILL_WALL))
- {
- 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[randint0(100)]);
- }
- }
-
- if (music_singing(MUSIC_WALL))
- {
- project(0, 0, py, px,
- (60 + p_ptr->lev), GF_DISINTEGRATE, PROJECT_KILL | PROJECT_ITEM, -1);
- }
- else if (p_ptr->kill_wall)
- {
- if (cave_valid_bold(py, px) &&
- (cave[py][px].feat < FEAT_PATTERN_START ||
- cave[py][px].feat > FEAT_PATTERN_XTRA2) &&
- (cave[py][px].feat < FEAT_DEEP_WATER ||
- cave[py][px].feat > FEAT_GRASS))
- {
- if (cave[py][px].feat == FEAT_TREES)
- cave_set_feat(py, px, FEAT_GRASS);
- else
- 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);
-
- if (p_ptr->riding)
- {
- riding_m_ptr->fy = py;
- riding_m_ptr->fx = px;
- cave[py][px].m_idx = p_ptr->riding;
- update_mon(p_ptr->riding, TRUE);
- }
-
- /* Redraw new spot */
- lite_spot(py, px);
-
- /* Redraw old spot */
- lite_spot(oy, ox);
-
- /* Sound */
- /* sound(SOUND_WALK); */
-
- /* 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();
- }
-
- if ((p_ptr->pclass == CLASS_NINJA))
- {
- if (c_ptr->info & (CAVE_GLOW)) set_superstealth(FALSE);
- else if (p_ptr->cur_lite <= 0) set_superstealth(TRUE);
- }
- if ((p_ptr->action == ACTION_HAYAGAKE) && !cave_floor_bold(py, px))
- {
-#ifdef JP
- msg_print("¤³¤³¤Ç¤ÏÁÇÁ᤯ư¤±¤Ê¤¤¡£");
-#else
- msg_print("You cannot run in wall.");
-#endif
- set_action(ACTION_NONE);
- }
-
- /* Update stuff */
- p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
-
- /* Update the monsters */
- p_ptr->update |= (PU_DISTANCE);
-
- /* Window stuff */
- p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-
- /* Spontaneous Searching */
- if ((p_ptr->skill_fos >= 50) ||
- (0 == randint0(50 - p_ptr->skill_fos)))
- {
- search();
- }
-
- /* Continuous Searching */
- if (p_ptr->action == ACTION_SEARCH)
+ else
{
- search();
- }
+ /* Boundary floor mimic */
+ if (boundary_floor(c_ptr, f_ptr, mimic_f_ptr))
+ {
+#ifdef JP
+ msg_print("¤½¤ì°Ê¾åÀè¤Ë¤Ï¿Ê¤á¤Ê¤¤¡£");
+#else
+ msg_print("You cannot go any more.");
+#endif
- /* Handle "objects" */
+ if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
+ energy_use = 0;
+ }
-#ifdef ALLOW_EASY_DISARM /* TNB */
+ /* Wall (or secret door) */
+ else
+ {
+#ifdef ALLOW_EASY_OPEN
+ /* Closed doors */
+ if (easy_open && is_closed_door(feat) && easy_open_door(y, x)) return;
+#endif /* ALLOW_EASY_OPEN */
- carry(do_pickup != always_pickup);
+#ifdef JP
+ msg_format("%s¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¡£", name);
+#else
+ msg_format("There is %s %s blocking your way.",
+ is_a_vowel(name[0]) ? "an" : "a", name);
+#endif
-#else /* ALLOW_EASY_DISARM -- TNB */
+ /*
+ * Well, it makes sense that you lose time bumping into
+ * a wall _if_ you are confused, stunned or blind; but
+ * typing mistakes should not cost you a turn...
+ */
+ if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
+ energy_use = 0;
+ }
+ }
- carry(do_pickup);
+ /* Disturb the player */
+ disturb(0, 1);
-#endif /* ALLOW_EASY_DISARM -- TNB */
+ /* Sound */
+ if (!boundary_floor(c_ptr, f_ptr, mimic_f_ptr)) sound(SOUND_HITWALL);
+ }
- /* Handle "store doors" */
- if (((c_ptr->feat >= FEAT_SHOP_HEAD) &&
- (c_ptr->feat <= FEAT_SHOP_TAIL)) ||
- (c_ptr->feat == FEAT_MUSEUM))
+ /* Normal movement */
+ if (oktomove && !pattern_seq(py, px, y, x))
+ {
+ if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
{
- /* Disturb */
- disturb(0, 0);
-
energy_use = 0;
- /* Hack -- Enter store */
- command_new = SPECIAL_KEY_STORE;
}
- /* Handle "building doors" -KMW- */
- else if ((c_ptr->feat >= FEAT_BLDG_HEAD) &&
- (c_ptr->feat <= FEAT_BLDG_TAIL))
- {
- /* Disturb */
- disturb(0, 0);
+ /* To avoid a loop with running */
+ disturb(0, 1);
- energy_use = 0;
- /* Hack -- Enter building */
- command_new = SPECIAL_KEY_BUILDING;
- }
+ oktomove = FALSE;
+ }
- /* Handle quest areas -KMW- */
- else if (cave[y][x].feat == FEAT_QUEST_ENTER)
- {
- /* Disturb */
- disturb(0, 0);
+ /* Normal movement */
+ if (oktomove)
+ {
+ u32b mpe_mode = MPE_ENERGY_USE;
- energy_use = 0;
- /* Hack -- Enter quest level */
- command_new = SPECIAL_KEY_QUEST;
+ if (p_ptr->warning)
+ {
+ if (!process_warning(x, y))
+ {
+ energy_use = 25;
+ return;
+ }
}
- else if (cave[y][x].feat == FEAT_QUEST_EXIT)
+ if (do_past)
{
- 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("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª");
+ msg_format("%s¤ò²¡¤·Âऱ¤¿¡£", m_name);
#else
- msg_print("You accomplished your quest!");
+ msg_format("You push past %s.", m_name);
#endif
+ }
- msg_print(NULL);
- }
-
- leave_quest_check();
-
- p_ptr->inside_quest = cave[y][x].special;
- dun_level = 0;
- p_ptr->oldpx = 0;
- p_ptr->oldpy = 0;
+ /* Change oldpx and oldpy to place the player well when going back to big mode */
+ if (p_ptr->wild_mode)
+ {
+ if (ddy[dir] > 0) p_ptr->oldpy = 1;
+ if (ddy[dir] < 0) p_ptr->oldpy = MAX_HGT - 2;
+ if (ddy[dir] == 0) p_ptr->oldpy = MAX_HGT / 2;
+ if (ddx[dir] > 0) p_ptr->oldpx = 1;
+ if (ddx[dir] < 0) p_ptr->oldpx = MAX_WID - 2;
+ if (ddx[dir] == 0) p_ptr->oldpx = MAX_WID / 2;
+ }
- /* Clear all saved floors */
- prepare_change_floor_mode(CFM_CLEAR_ALL);
+ if (p_can_kill_walls)
+ {
+ cave_alter_feat(y, x, FF_HURT_DISI);
- p_ptr->leaving = TRUE;
+ /* Update some things -- similar to GF_KILL_WALL */
+ p_ptr->update |= (PU_FLOW);
}
- /* Set off a trap */
- else if (is_trap(c_ptr->feat))
- {
- /* Disturb */
- disturb(0, 0);
+ /* Sound */
+ /* sound(SOUND_WALK); */
- /* Hidden trap */
- if (c_ptr->mimic)
- {
- /* Message */
-#ifdef JP
- msg_print("¥È¥é¥Ã¥×¤À¡ª");
-#else
- msg_print("You found a trap!");
-#endif
+#ifdef ALLOW_EASY_DISARM /* TNB */
- /* Pick a trap */
- disclose_grid(py, px);
- }
+ if (do_pickup != always_pickup) mpe_mode |= MPE_DO_PICKUP;
- /* Hit the trap */
- hit_trap(break_trap);
- }
+#else /* ALLOW_EASY_DISARM -- TNB */
- /* Warn 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;
+ if (do_pickup) mpe_mode |= MPE_DO_PICKUP;
- /* 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
- }
+#endif /* ALLOW_EASY_DISARM -- TNB */
- if (disturb_trap_detect)
- {
- disturb(0, 0);
- }
- }
- }
+ if (break_trap) mpe_mode |= MPE_BREAK_TRAP;
+
+ /* Move the player */
+ (void)move_player_effect(y, x, mpe_mode);
}
}
+static bool ignore_avoid_run;
+
/*
* Hack -- Check for a "known wall" (see below)
*/
static int see_wall(int dir, int y, int x)
{
cave_type *c_ptr;
- byte feat;
/* Get the new location */
y += ddy[dir];
/* Access grid */
c_ptr = &cave[y][x];
- /* Feature code (applying "mimic" field) */
- feat = f_info[c_ptr->mimic ? c_ptr->mimic : c_ptr->feat].mimic;
-
/* Must be known to the player */
if (c_ptr->info & (CAVE_MARK))
{
- /* Rubble, Magma, Quartz, Wall, Perm wall */
- if (feat >= FEAT_RUBBLE && feat <= FEAT_PERM_SOLID) return TRUE;
+ /* Feature code (applying "mimic" field) */
+ s16b feat = get_feat_mimic(c_ptr);
+ feature_type *f_ptr = &f_info[feat];
+
+ /* Wall grids are known walls */
+ if (!player_can_enter(feat, 0)) return !have_flag(f_ptr->flags, FF_DOOR);
- /* Tree */
- if (feat == FEAT_TREES) return TRUE;
+ /* Don't run on a tree unless explicitly requested */
+ if (have_flag(f_ptr->flags, FF_AVOID_RUN) && !ignore_avoid_run)
+ return TRUE;
- /* Mountain */
- if (feat == FEAT_MOUNTAIN) return TRUE;
+ /* Don't run in a wall */
+ if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY))
+ return !have_flag(f_ptr->flags, FF_DOOR);
}
return FALSE;
/* Memorized grids are always known */
if (cave[y][x].info & (CAVE_MARK)) return (FALSE);
- /* Non-floor grids are unknown */
- if (!cave_floor_bold(y, x)) return (TRUE);
-
/* Viewable door/wall grids are known */
if (player_can_see_bold(y, x)) return (FALSE);
row = py + ddy[dir];
col = px + ddx[dir];
+ ignore_avoid_run = cave_have_flag_bold(row, col, FF_AVOID_RUN);
+
/* Extract cycle index */
i = chome[dir];
int i, max, inv;
int option = 0, option2 = 0;
cave_type *c_ptr;
- byte feat;
+ s16b feat;
+ feature_type *f_ptr;
/* Where we came from */
prev_dir = find_prevdir;
{
s16b this_o_idx, next_o_idx = 0;
-
/* New direction */
new_dir = cycle[chome[prev_dir] + i];
c_ptr = &cave[row][col];
/* Feature code (applying "mimic" field) */
- feat = f_info[c_ptr->mimic ? c_ptr->mimic : c_ptr->feat].mimic;
+ feat = get_feat_mimic(c_ptr);
+ f_ptr = &f_info[feat];
/* Visible monsters abort running */
if (c_ptr->m_idx)
next_o_idx = o_ptr->next_o_idx;
/* Visible object */
- if (o_ptr->marked) return (TRUE);
+ if (o_ptr->marked & OM_FOUND) return (TRUE);
}
-
/* Assume unknown */
inv = TRUE;
/* Check memorized grids */
if (c_ptr->info & (CAVE_MARK))
{
- bool notice = TRUE;
+ bool notice = have_flag(f_ptr->flags, FF_NOTICE);
- /* Examine the terrain */
- switch (feat)
+ if (notice && have_flag(f_ptr->flags, FF_MOVE))
{
- /* Floors */
- case FEAT_FLOOR:
-
- /* Invis traps */
- case FEAT_INVIS:
-
- /* Normal veins */
- case FEAT_MAGMA:
- case FEAT_QUARTZ:
-
- /* Hidden treasure */
- 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_WALL_SOLID:
- case FEAT_PERM_EXTRA:
- case FEAT_PERM_INNER:
- case FEAT_PERM_OUTER:
- case FEAT_PERM_SOLID:
- /* dirt, grass, trees, ... */
- case FEAT_SHAL_WATER:
- case FEAT_DIRT:
- case FEAT_GRASS:
- case FEAT_DEEP_GRASS:
- case FEAT_FLOWER:
- case FEAT_DARK_PIT:
- case FEAT_TREES:
- case FEAT_MOUNTAIN:
+ /* Open doors */
+ if (find_ignore_doors && have_flag(f_ptr->flags, FF_DOOR) && have_flag(f_ptr->flags, FF_CLOSE))
{
- /* Ignore */
+ /* Option -- ignore */
notice = FALSE;
-
- /* Done */
- break;
}
- /* quest features */
- case FEAT_QUEST_ENTER:
- case FEAT_QUEST_EXIT:
+ /* Stairs */
+ else if (find_ignore_stairs && have_flag(f_ptr->flags, FF_STAIRS))
{
- /* Notice */
- notice = TRUE;
-
- /* Done */
- break;
+ /* Option -- ignore */
+ notice = FALSE;
}
- case FEAT_DEEP_LAVA:
- case FEAT_SHAL_LAVA:
+ /* Lava */
+ else if (have_flag(f_ptr->flags, FF_LAVA) && (p_ptr->immune_fire || IS_INVULN()))
{
/* Ignore */
- if (IS_INVULN() || p_ptr->immune_fire) notice = FALSE;
-
- /* Done */
- break;
+ notice = FALSE;
}
- case FEAT_DEEP_WATER:
+ /* Deep water */
+ else if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) &&
+ (p_ptr->levitation || p_ptr->can_swim || (p_ptr->total_weight <= weight_limit())))
{
/* Ignore */
- 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;
- }
-
- /* Open doors */
- case FEAT_OPEN:
- case FEAT_BROKEN:
- {
- /* Option -- ignore */
- if (find_ignore_doors) notice = FALSE;
-
- /* Done */
- break;
- }
-
- /* Stairs */
- case FEAT_LESS:
- case FEAT_MORE:
- case FEAT_LESS_LESS:
- case FEAT_MORE_MORE:
- case FEAT_ENTRANCE:
- {
- /* Option -- ignore */
- if (find_ignore_stairs) notice = FALSE;
-
- /* Done */
- break;
+ notice = FALSE;
}
}
}
/* Analyze unknown grids and floors considering mimic */
- if (inv || feat_floor(feat))
+ if (inv || !see_wall(0, row, col))
{
/* Looking for open area */
if (find_openarea)
}
}
-
/* Looking for open area */
if (find_openarea)
{
/* Hack -- look again */
for (i = -max; i < 0; i++)
{
- new_dir = cycle[chome[prev_dir] + i];
-
- row = py + ddy[new_dir];
- col = px + ddx[new_dir];
-
- /* Access grid */
- c_ptr = &cave[row][col];
-
- /* Feature code (applying "mimic" field) */
- feat = f_info[c_ptr->mimic ? c_ptr->mimic : c_ptr->feat].mimic;
-
- /* Unknown grid or non-wall XXX XXX XXX cave_floor_grid(c_ptr)) */
- if (!(c_ptr->info & (CAVE_MARK)) ||
- ((feat <= FEAT_DOOR_TAIL) ||
- (feat == FEAT_FLOWER) ||
- (feat == FEAT_DEEP_GRASS) ||
- ((feat >= FEAT_DEEP_WATER) &&
- (feat <= FEAT_GRASS))))
-
+ /* Unknown grid or non-wall */
+ if (!see_wall(cycle[chome[prev_dir] + i], py, px))
{
/* Looking to break right */
if (find_breakright)
/* Hack -- look again */
for (i = max; i > 0; i--)
{
- new_dir = cycle[chome[prev_dir] + i];
-
- row = py + ddy[new_dir];
- col = px + ddx[new_dir];
-
- /* Access grid */
- c_ptr = &cave[row][col];
-
- /* Feature code (applying "mimic" field) */
- feat = f_info[c_ptr->mimic ? c_ptr->mimic : c_ptr->feat].mimic;
-
- /* Unknown grid or non-wall XXX XXX XXX cave_floor_grid(c_ptr)) */
- if (!(c_ptr->info & (CAVE_MARK)) ||
- ((feat <= FEAT_DOOR_TAIL) ||
- (feat == FEAT_FLOWER) ||
- (feat == FEAT_DEEP_GRASS) ||
- ((feat >= FEAT_DEEP_WATER) &&
- (feat <= FEAT_GRASS))))
-
+ /* Unknown grid or non-wall */
+ if (!see_wall(cycle[chome[prev_dir] + i], py, px))
{
/* Looking to break left */
if (find_breakleft)
}
}
-
/* Not looking for open area */
else
{
}
}
-
/* About to hit a known wall, stop */
if (see_wall(find_current, py, px))
{
return (TRUE);
}
-
/* Failure */
return (FALSE);
}
/* 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 = f_info[c_ptr->mimic ? c_ptr->mimic : c_ptr->feat].mimic;
+ /* Ignore AVOID_RUN on a first step */
+ ignore_avoid_run = TRUE;
/* Hack -- do not start silly run */
- if (see_wall(dir, py, px) &&
- (feat != FEAT_TREES))
+ if (see_wall(dir, py, px))
{
/* Message */
#ifdef JP
- msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¹Ô¤±¤Þ¤»¤ó¡£");
+ msg_print("¤½¤ÎÊý¸þ¤Ë¤ÏÁö¤ì¤Þ¤»¤ó¡£");
#else
msg_print("You cannot run in that direction.");
#endif
-
/* Disturb */
disturb(0, 0);
disturb(0, 0);
}
}
+
+
+#ifdef TRAVEL
+/*
+ * Test for traveling
+ */
+static int travel_test(int prev_dir)
+{
+ int new_dir = 0;
+ int i, max;
+ const cave_type *c_ptr;
+ int cost;
+
+ /* Cannot travel when blind */
+ if (p_ptr->blind || no_lite())
+ {
+ msg_print(_("Ìܤ¬¸«¤¨¤Ê¤¤¡ª", "You cannot see!"));
+ return (0);
+ }
+
+ /* 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 (0);
+ }
+ }
+ }
+
+ /* Range of newly adjacent grids */
+ max = (prev_dir & 0x01) + 1;
+
+ /* Look at every newly adjacent square. */
+ for (i = -max; i <= max; i++)
+ {
+ /* New direction */
+ int dir = cycle[chome[prev_dir] + i];
+
+ /* New location */
+ int row = py + ddy[dir];
+ int col = px + ddx[dir];
+
+ /* Access grid */
+ c_ptr = &cave[row][col];
+
+ /* Visible monsters abort running */
+ if (c_ptr->m_idx)
+ {
+ monster_type *m_ptr = &m_list[c_ptr->m_idx];
+
+ /* Visible monster */
+ if (m_ptr->ml) return (0);
+ }
+
+ }
+
+ /* Travel cost of current grid */
+ cost = travel.cost[py][px];
+
+ /* Determine travel direction */
+ for (i = 0; i < 8; ++ i) {
+ int dir_cost = travel.cost[py+ddy_ddd[i]][px+ddx_ddd[i]];
+
+ if (dir_cost < cost)
+ {
+ new_dir = ddd[i];
+ cost = dir_cost;
+ }
+ }
+
+ if (!new_dir) return (0);
+
+ /* Access newly move grid */
+ c_ptr = &cave[py+ddy[new_dir]][px+ddx[new_dir]];
+
+ /* Close door abort traveling */
+ if (!easy_open && is_closed_door(c_ptr->feat)) return (0);
+
+ /* Visible and unignorable trap abort tarveling */
+ if (!c_ptr->mimic && !trap_can_be_ignored(c_ptr->feat)) return (0);
+
+ /* Move new grid */
+ return (new_dir);
+}
+
+
+/*
+ * Travel command
+ */
+void travel_step(void)
+{
+ /* Get travel direction */
+ travel.dir = travel_test(travel.dir);
+
+ /* disturb */
+ if (!travel.dir)
+ {
+ if (travel.run == 255)
+ {
+#ifdef JP
+ msg_print("Æ»¶Ú¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó¡ª");
+#else
+ msg_print("No route is found!");
+#endif
+ travel.y = travel.x = 0;
+ }
+ disturb(0, 1);
+ return;
+ }
+
+ energy_use = 100;
+
+ 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--;
+
+ /* Travel Delay */
+ Term_xtra(TERM_XTRA_DELAY, delay_factor);
+}
+#endif