-/* File: cmd1.c */
-
-/*
+/*!
+ * @file cmd1.c
+ * @brief ¥×¥ì¥¤¥ä¡¼¤Î¥³¥Þ¥ó¥É½èÍý1 / Movement commands (part 1)
+ * @date 2014/01/02
+ * @author
* Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
*
* This software may be copied and distributed for educational, research,
* are included in all such copies. Other copyrights may also apply.
*/
-/* Purpose: Movement commands (part 1) */
#include "angband.h"
-#define MAX_VAMPIRIC_DRAIN 50
+#define MAX_VAMPIRIC_DRAIN 50 /*!< µÛ·ì½èÍý¤ÎºÇÂç²óÉüHP */
-/*
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤«¤é¥â¥ó¥¹¥¿¡¼¤Ø¤Î¼Í·âÌ¿ÃæȽÄê /
* Determine if the player "hits" a monster (normal combat).
- * Note -- Always miss 5%, always hit 5%, otherwise random.
+ * @param chance ´ðËÜÌ¿ÃæÃÍ
+ * @param m_ptr ¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @param vis ÌÜɸ¤ò»ë³¦¤ËÊá¤é¤¨¤Æ¤¤¤ë¤Ê¤é¤ÐTRUE¤ò»ØÄê
+ * @param o_name ¥á¥Ã¥»¡¼¥¸É½¼¨»þ¤Î¥â¥ó¥¹¥¿¡¼Ì¾
+ * @return Ì¿Ãæ¤ÈȽÄꤵ¤ì¤¿¾ì¹çTRUE¤òÊÖ¤¹
+ * @note Always miss 5%, always hit 5%, otherwise random.
*/
-bool test_hit_fire(int chance, int ac, int vis)
+bool test_hit_fire(int chance, monster_type *m_ptr, int vis, char* o_name)
{
- int k;
+ int k, ac;
+ monster_race *r_ptr = &r_info[m_ptr->r_idx];
+
+ ac = r_ptr->ac;
+ if(m_ptr->r_idx == MON_GOEMON && !MON_CSLEEP(m_ptr)) ac *= 3;
/* Percentile dice */
k = randint0(100);
-
+
+ /* Snipers with high-concentration reduce instant miss percentage.*/
+ k += p_ptr->concent;
+
/* Hack -- Instant miss or hit */
if (k < 10) return (k < 5);
if (!vis) chance = (chance + 1) / 2;
/* Power competes against armor */
- if (randint0(chance) < (ac * 3 / 4)) return (FALSE);
+ if (randint0(chance) < (ac * 3 / 4))
+ {
+ if(m_ptr->r_idx == MON_GOEMON && !MON_CSLEEP(m_ptr))
+ {
+ char m_name[80];
+
+ /* Extract monster name */
+ monster_desc(m_name, m_ptr, 0);
+ msg_format(_("%s¤Ï%s¤ò»Â¤ê¼Î¤Æ¤¿¡ª", "%s cuts down %s!"), m_name, o_name);
+ }
+ return (FALSE);
+ }
/* Assume hit */
return (TRUE);
-/*
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤«¤é¥â¥ó¥¹¥¿¡¼¤Ø¤ÎÂÇ·âÌ¿ÃæȽÄê /
* Determine if the player "hits" a monster (normal combat).
- *
- * Note -- Always miss 5%, always hit 5%, otherwise random.
+ * @param chance ´ðËÜÌ¿ÃæÃÍ
+ * @param ac ¥â¥ó¥¹¥¿¡¼¤ÎAC
+ * @param vis ÌÜɸ¤ò»ë³¦¤ËÊá¤é¤¨¤Æ¤¤¤ë¤Ê¤é¤ÐTRUE¤ò»ØÄê
+ * @return Ì¿Ãæ¤ÈȽÄꤵ¤ì¤¿¾ì¹çTRUE¤òÊÖ¤¹
+ * @note Always miss 5%, always hit 5%, otherwise random.
*/
bool test_hit_norm(int chance, int ac, int vis)
{
-/*
- * Critical hits (from objects thrown by player)
- * Factor in item weight, total plusses, and player level.
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤«¤é¥â¥ó¥¹¥¿¡¼¤Ø¤Î¼Í·â¥¯¥ê¥Æ¥£¥«¥ëȽÄê /
+ * Critical hits (from objects thrown by player) Factor in item weight, total plusses, and player level.
+ * @param weight ÌðÃƤνÅÎÌ
+ * @param plus_ammo ÌðÃƤÎÌ¿Ã潤Àµ
+ * @param plus_bow µÝ¤ÎÌ¿Ã潤Àµ
+ * @param dam ¸½ºß»»½ÐÃæ¤Î¥À¥á¡¼¥¸ÃÍ
+ * @return ¥¯¥ê¥Æ¥£¥«¥ë½¤Àµ¤¬Æþ¤Ã¤¿¥À¥á¡¼¥¸ÃÍ
*/
-s16b critical_shot(int weight, int plus, int dam)
+s16b critical_shot(int weight, int plus_ammo, int plus_bow, int dam)
{
int i, k;
-
+ object_type *j_ptr = &inventory[INVEN_BOW];
+
/* Extract "shot" power */
- i = ((p_ptr->to_h_b + plus) * 4) + (p_ptr->lev * 2);
+ i = p_ptr->to_h_b + plus_ammo;
+
+ if (p_ptr->tval_ammo == TV_BOLT)
+ i = (p_ptr->skill_thb + (p_ptr->weapon_exp[0][j_ptr->sval] / 400 + i) * BTH_PLUS_ADJ);
+ else
+ i = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval] - (WEAPON_EXP_MASTER / 2)) / 200 + i) * BTH_PLUS_ADJ);
+
/* 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;
-
+
+ /* Good bow makes more critical */
+ i += plus_bow * 8 * (p_ptr->concent ? p_ptr->concent + 5 : 5);
+
/* Critical hit */
- if (randint1(5000) <= i)
+ if (randint1(10000) <= i)
{
k = weight * randint1(500);
-/*
- * Critical hits (by player)
- *
- * Factor in weapon weight, total plusses, player level.
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤«¤é¥â¥ó¥¹¥¿¡¼¤Ø¤ÎÂǷ⥯¥ê¥Æ¥£¥«¥ëȽÄê /
+ * Critical hits (by player) Factor in weapon weight, total plusses, player melee bonus
+ * @param weight ÌðÃƤνÅÎÌ
+ * @param plus Éð´ï¤ÎÌ¿Ã潤Àµ
+ * @param dam ¸½ºß»»½ÐÃæ¤Î¥À¥á¡¼¥¸ÃÍ
+ * @param meichuu ÂÇ·â¤Î´ðËÜÌ¿ÃæÎÏ
+ * @param mode ¥ª¥×¥·¥ç¥ó¥Õ¥é¥°
+ * @return ¥¯¥ê¥Æ¥£¥«¥ë½¤Àµ¤¬Æþ¤Ã¤¿¥À¥á¡¼¥¸ÃÍ
*/
s16b critical_norm(int weight, int plus, int dam, s16b meichuu, int mode)
{
int i, k;
-
+
/* Extract "blow" power */
- i = (weight + (meichuu * 3 + plus * 5) + (p_ptr->lev * 3));
+ i = (weight + (meichuu * 3 + plus * 5) + p_ptr->skill_thn);
/* Chance */
if ((randint1((p_ptr->pclass == CLASS_NINJA) ? 4444 : 5000) <= i) || (mode == HISSATSU_MAJIN) || (mode == HISSATSU_3DAN))
-/*
- * Extract the "total damage" from a given object hitting a given monster.
- *
- * Note that "flasks of oil" do NOT do fire damage, although they
- * certainly could be made to do so. XXX XXX
- *
- * Note that most brands and slays are x3, except Slay Animal (x2),
- * Slay Evil (x2), and Kill dragon (x5).
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¹¶·â¤Î¼ï²¥¹¥ì¥¤¥ó¥°ÇÜΨ·×»»
+ * @param mult »»½ÐÁ°¤Î´ðËÜÇÜΨ(/10ÇÜ)
+ * @param flgs ¥¹¥ì¥¤¥Õ¥é¥°ÇÛÎó
+ * @param m_ptr ÌÜɸ¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @return ¥¹¥ì¥¤¥ó¥°²ÃÌ£¸å¤ÎÇÜΨ(/10ÇÜ)
*/
-s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, int mode, bool thrown)
+static int mult_slaying(int mult, const u32b* flgs, const monster_type* m_ptr)
{
- 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);
+ 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];
- /* Some "weapons" and "ammo" do extra damage */
- switch (o_ptr->tval)
+ for (i = 0; i < sizeof(slay_table) / sizeof(slay_table[0]); ++ i)
{
- case TV_SHOT:
- case TV_ARROW:
- case TV_BOLT:
- case TV_HAFTED:
- case TV_POLEARM:
- case TV_SWORD:
- case TV_DIGGING:
- {
- /* Slay Animal */
- if ((have_flag(flgs, TR_SLAY_ANIMAL)) &&
- (r_ptr->flags3 & RF3_ANIMAL))
- {
- if (is_original_ap_and_seen(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_ANIMAL;
- }
-
- if (mult < 25) mult = 25;
- }
-
- /* Execute Animal */
- if ((have_flag(flgs, TR_KILL_ANIMAL)) &&
- (r_ptr->flags3 & RF3_ANIMAL))
- {
- if (is_original_ap_and_seen(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_ANIMAL;
- }
-
- if (mult < 40) mult = 40;
- }
-
- /* Slay Evil */
- if ((have_flag(flgs, TR_SLAY_EVIL)) &&
- (r_ptr->flags3 & RF3_EVIL))
- {
- if (is_original_ap_and_seen(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_EVIL;
- }
-
- if (mult < 20) mult = 20;
- }
-
- /* Execute Evil */
- if ((have_flag(flgs, TR_KILL_EVIL)) &&
- (r_ptr->flags3 & RF3_EVIL))
- {
- if (is_original_ap_and_seen(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_EVIL;
- }
-
- if (mult < 35) mult = 35;
- }
-
- /* Slay Human */
- if ((have_flag(flgs, TR_SLAY_HUMAN)) &&
- (r_ptr->flags2 & RF2_HUMAN))
- {
- if (is_original_ap_and_seen(m_ptr))
- {
- r_ptr->r_flags2 |= RF2_HUMAN;
- }
-
- if (mult < 25) mult = 25;
- }
-
- /* Execute Human */
- if ((have_flag(flgs, TR_KILL_HUMAN)) &&
- (r_ptr->flags2 & RF2_HUMAN))
- {
- if (is_original_ap_and_seen(m_ptr))
- {
- r_ptr->r_flags2 |= RF2_HUMAN;
- }
-
- if (mult < 40) mult = 40;
- }
-
- /* Slay Undead */
- if ((have_flag(flgs, TR_SLAY_UNDEAD)) &&
- (r_ptr->flags3 & RF3_UNDEAD))
- {
- if (is_original_ap_and_seen(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_UNDEAD;
- }
-
- if (mult < 30) mult = 30;
- }
-
- /* Execute Undead */
- if ((have_flag(flgs, TR_KILL_UNDEAD)) &&
- (r_ptr->flags3 & RF3_UNDEAD))
- {
- if (is_original_ap_and_seen(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_UNDEAD;
- }
-
- if (mult < 50) mult = 50;
- }
-
- /* Slay Demon */
- if ((have_flag(flgs, TR_SLAY_DEMON)) &&
- (r_ptr->flags3 & RF3_DEMON))
- {
- if (is_original_ap_and_seen(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_DEMON;
- }
-
- if (mult < 30) mult = 30;
- }
-
- /* Execute Demon */
- if ((have_flag(flgs, TR_KILL_DEMON)) &&
- (r_ptr->flags3 & RF3_DEMON))
- {
- if (is_original_ap_and_seen(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_DEMON;
- }
-
- if (mult < 50) mult = 50;
- }
-
- /* Slay Orc */
- if ((have_flag(flgs, TR_SLAY_ORC)) &&
- (r_ptr->flags3 & RF3_ORC))
- {
- if (is_original_ap_and_seen(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_ORC;
- }
-
- if (mult < 30) mult = 30;
- }
-
- /* Execute Orc */
- if ((have_flag(flgs, TR_KILL_ORC)) &&
- (r_ptr->flags3 & RF3_ORC))
- {
- if (is_original_ap_and_seen(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_ORC;
- }
-
- if (mult < 50) mult = 50;
- }
+ const struct slay_table_t* p = &slay_table[i];
- /* Slay Troll */
- if ((have_flag(flgs, TR_SLAY_TROLL)) &&
- (r_ptr->flags3 & RF3_TROLL))
+ if ((have_flag(flgs, p->slay_flag)) &&
+ (atoffset(u32b, r_ptr, p->flag_offset) & p->affect_race_flag))
+ {
+ if (is_original_ap_and_seen(m_ptr))
{
- if (is_original_ap_and_seen(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_TROLL;
- }
-
- if (mult < 30) mult = 30;
+ atoffset(u32b, r_ptr, p->r_flag_offset) |= p->affect_race_flag;
}
- /* Execute Troll */
- if ((have_flag(flgs, TR_KILL_TROLL)) &&
- (r_ptr->flags3 & RF3_TROLL))
- {
- if (is_original_ap_and_seen(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_TROLL;
- }
+ mult = MAX(mult, p->slay_mult);
+ }
+ }
- if (mult < 50) mult = 50;
- }
+ return mult;
+}
- /* Slay Giant */
- if ((have_flag(flgs, TR_SLAY_GIANT)) &&
- (r_ptr->flags3 & RF3_GIANT))
- {
- if (is_original_ap_and_seen(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_GIANT;
- }
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¹¶·â¤Î°À¥¹¥ì¥¤¥ó¥°ÇÜΨ·×»»
+ * @param mult »»½ÐÁ°¤Î´ðËÜÇÜΨ(/10ÇÜ)
+ * @param flgs ¥¹¥ì¥¤¥Õ¥é¥°ÇÛÎó
+ * @param m_ptr ÌÜɸ¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @return ¥¹¥ì¥¤¥ó¥°²ÃÌ£¸å¤ÎÇÜΨ(/10ÇÜ)
+ */
+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];
- if (mult < 30) mult = 30;
- }
+ for (i = 0; i < sizeof(brand_table) / sizeof(brand_table[0]); ++ i)
+ {
+ const struct brand_table_t* p = &brand_table[i];
- /* Execute Giant */
- if ((have_flag(flgs, TR_KILL_GIANT)) &&
- (r_ptr->flags3 & RF3_GIANT))
+ 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_flags3 |= RF3_GIANT;
+ r_ptr->r_flagsr |= (r_ptr->flagsr & p->resist_mask);
}
-
- if (mult < 50) mult = 50;
}
- /* Slay Dragon */
- if ((have_flag(flgs, TR_SLAY_DRAGON)) &&
- (r_ptr->flags3 & RF3_DRAGON))
+ /* Otherwise, take the damage */
+ else if (r_ptr->flags3 & p->hurt_flag)
{
if (is_original_ap_and_seen(m_ptr))
{
- r_ptr->r_flags3 |= RF3_DRAGON;
+ r_ptr->r_flags3 |= p->hurt_flag;
}
- if (mult < 30) mult = 30;
+ mult = MAX(mult, 50);
}
-
- /* Execute Dragon */
- if ((have_flag(flgs, TR_KILL_DRAGON)) &&
- (r_ptr->flags3 & RF3_DRAGON))
+ else
{
- if (is_original_ap_and_seen(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_DRAGON;
- }
-
- if (mult < 50) mult = 50;
-
- if ((o_ptr->name1 == ART_NOTHUNG) && (m_ptr->r_idx == MON_FAFNER))
- mult *= 3;
+ mult = MAX(mult, 25);
}
+ }
+ }
- /* Hex - Slay Good (Runesword) */
- if (hex_spelling(HEX_RUNESWORD) &&
- (r_ptr->flags3 & RF3_GOOD))
- {
- if (is_original_ap_and_seen(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_GOOD;
- }
-
- if (mult < 20) mult = 20;
- }
+ return mult;
+}
- /* 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 (is_original_ap_and_seen(m_ptr))
- {
- r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ACID_MASK);
- }
- }
+/*!
+ * @brief ¥À¥á¡¼¥¸¤Ë¥¹¥ì¥¤Í×ÁǤò²Ã¤¨¤ëÁí¹ç½èÍý¥ë¡¼¥Á¥ó /
+ * Extract the "total damage" from a given object hitting a given monster.
+ * @param o_ptr »ÈÍÑÉð´ï¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @param tdam ¸½ºß»»½ÐÅÓÃæ¤Î¥À¥á¡¼¥¸ÃÍ
+ * @param m_ptr ÌÜɸ¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @param thrown ¼Í·â½èÍý¤Ê¤é¤ÐTRUE¤ò»ØÄꤹ¤ë
+ * @return Áí¹çŪ¤Ê¥¹¥ì¥¤¤ò²ÃÌ£¤·¤¿¥À¥á¡¼¥¸ÃÍ
+ * @note
+ * Note that "flasks of oil" do NOT do fire damage, although they\n
+ * certainly could be made to do so. XXX XXX\n
+ *\n
+ * Note that most brands and slays are x3, except Slay Animal (x2),\n
+ * Slay Evil (x2), and Kill dragon (x5).\n
+ */
+s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, int mode, bool thrown)
+{
+ int mult = 10;
- /* Otherwise, take the damage */
- else
- {
- if (mult < 25) mult = 25;
- }
- }
+ u32b flgs[TR_FLAG_SIZE];
- /* 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 (is_original_ap_and_seen(m_ptr))
- {
- r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK);
- }
- }
+ /* Extract the flags */
+ object_flags(o_ptr, flgs);
+ torch_flags(o_ptr, flgs); /* torches has secret flags */
- /* 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 (!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);
+ }
- else
- {
- if (mult < 25) mult = 25;
- }
- }
+ /* Hex - Slay Good (Runesword) */
+ if (hex_spelling(HEX_RUNESWORD)) add_flag(flgs, TR_SLAY_GOOD);
- /* 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 (is_original_ap_and_seen(m_ptr))
- {
- r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK);
- }
- }
+ /* Some "weapons" and "ammo" do extra damage */
+ switch (o_ptr->tval)
+ {
+ case TV_SHOT:
+ case TV_ARROW:
+ case TV_BOLT:
+ case TV_HAFTED:
+ case TV_POLEARM:
+ case TV_SWORD:
+ case TV_DIGGING:
+ case TV_LITE:
+ {
+ /* Slaying */
+ mult = mult_slaying(mult, flgs, m_ptr);
- /* 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 (is_original_ap_and_seen(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 (is_original_ap_and_seen(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_HURT_FIRE;
- }
- }
- else if (mult < 25) mult = 25;
- }
- }
+ /* Elemental Brand */
+ mult = mult_brand(mult, flgs, m_ptr);
- /* Brand (Cold) */
- if (have_flag(flgs, TR_BRAND_COLD) || ((p_ptr->special_attack & (ATTACK_COLD)) && !thrown) || (mode == HISSATSU_COLD))
+ /* Hissatsu */
+ if (p_ptr->pclass == CLASS_SAMURAI)
{
- /* Notice immunity */
- if (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK)
- {
- if (is_original_ap_and_seen(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 (is_original_ap_and_seen(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 (is_original_ap_and_seen(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_HURT_COLD;
- }
- }
- else if (mult < 25) mult = 25;
- }
+ mult = mult_hissatsu(mult, flgs, m_ptr, mode);
}
- /* 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 (is_original_ap_and_seen(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 (is_original_ap_and_seen(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 (is_original_ap_and_seen(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_HURT_ROCK;
- }
- if (mult == 10) mult = 40;
- else if (mult < 60) mult = 60;
- }
+ /* Force Weapon */
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;
}
+
+ /* Hack -- The Nothung cause special damage to Fafner */
+ if ((o_ptr->name1 == ART_NOTHUNG) && (m_ptr->r_idx == MON_FAFNER))
+ mult = 150;
break;
}
}
}
-/*
+/*!
+ * @brief ÃÏ·Á¤ä¤½¤Î¾å¤Î¥¢¥¤¥Æ¥à¤Î±£¤µ¤ì¤¿Í×ÁǤòÌÀ¤«¤¹ /
* Search for hidden things
+ * @param y ÂоݤȤʤë¥Þ¥¹¤ÎYºÂɸ
+ * @param x ÂоݤȤʤë¥Þ¥¹¤ÎXºÂɸ
+ * @return ¤Ê¤·
*/
-void search(void)
+static void discover_hidden_things(int y, int x)
{
- int y, x, chance;
-
s16b this_o_idx, next_o_idx = 0;
cave_type *c_ptr;
+ /* Access the grid */
+ c_ptr = &cave[y][x];
- /* Start with base search ability */
- chance = p_ptr->skill_srh;
+ /* Invisible trap */
+ if (c_ptr->mimic && is_trap(c_ptr->feat))
+ {
+ /* Pick a trap */
+ disclose_grid(y, x);
- /* Penalize various conditions */
- if (p_ptr->blind || no_lite()) chance = chance / 10;
- if (p_ptr->confused || p_ptr->image) chance = chance / 10;
+ /* Message */
+ msg_print(_("¥È¥é¥Ã¥×¤òȯ¸«¤·¤¿¡£", "You have found a trap."));
- /* Search the nearby grids, which are always in bounds */
- for (y = (py - 1); y <= (py + 1); y++)
+ /* Disturb */
+ disturb(0, 1);
+ }
+
+ /* Secret door */
+ if (is_hidden_door(c_ptr))
{
- for (x = (px - 1); x <= (px + 1); x++)
- {
- /* Sometimes, notice things */
- if (randint0(100) < chance)
- {
- /* Access the grid */
- c_ptr = &cave[y][x];
+ /* Message */
+ msg_print(_("±£¤·¥É¥¢¤òȯ¸«¤·¤¿¡£", "You have found a secret door."));
- /* Invisible trap */
- if (c_ptr->mimic && is_trap(c_ptr->feat))
- {
- /* Pick a trap */
- disclose_grid(y, x);
+ /* Disclose */
+ disclose_grid(y, x);
- /* Message */
-#ifdef JP
- msg_print("¥È¥é¥Ã¥×¤òȯ¸«¤·¤¿¡£");
-#else
- msg_print("You have found a trap.");
-#endif
+ /* Disturb */
+ disturb(0, 0);
+ }
- /* Disturb */
- disturb(0, 1);
- }
+ /* Scan all objects in the grid */
+ for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
+ {
+ object_type *o_ptr;
- /* Secret door */
- if (is_hidden_door(c_ptr))
- {
- /* Message */
-#ifdef JP
- msg_print("±£¤·¥É¥¢¤òȯ¸«¤·¤¿¡£");
-#else
- msg_print("You have found a secret door.");
-#endif
+ /* Acquire object */
+ o_ptr = &o_list[this_o_idx];
- /* Disclose */
- disclose_grid(y, x);
+ /* Acquire next object */
+ next_o_idx = o_ptr->next_o_idx;
- /* Disturb */
- disturb(0, 0);
- }
+ /* Skip non-chests */
+ if (o_ptr->tval != TV_CHEST) continue;
- /* Scan all objects in the grid */
- for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
- {
- object_type *o_ptr;
+ /* Skip non-trapped chests */
+ if (!chest_traps[o_ptr->pval]) continue;
- /* Acquire object */
- o_ptr = &o_list[this_o_idx];
+ /* Identify once */
+ if (!object_is_known(o_ptr))
+ {
+ /* Message */
+ msg_print(_("È¢¤Ë»Å³Ý¤±¤é¤ì¤¿¥È¥é¥Ã¥×¤òȯ¸«¤·¤¿¡ª", "You have discovered a trap on the chest!"));
- /* Acquire next object */
- next_o_idx = o_ptr->next_o_idx;
+ /* Know the trap */
+ object_known(o_ptr);
- /* Skip non-chests */
- if (o_ptr->tval != TV_CHEST) continue;
+ /* Notice it */
+ disturb(0, 0);
+ }
+ }
+}
- /* Skip non-trapped chests */
- if (!chest_traps[o_ptr->pval]) continue;
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤Îõº÷½èÍýȽÄê
+ * @return ¤Ê¤·
+ */
+void search(void)
+{
+ int i, chance;
- /* Identify once */
- if (!object_is_known(o_ptr))
- {
- /* Message */
-#ifdef JP
- msg_print("È¢¤Ë»Å³Ý¤±¤é¤ì¤¿¥È¥é¥Ã¥×¤òȯ¸«¤·¤¿¡ª");
-#else
- msg_print("You have discovered a trap on the chest!");
-#endif
+ /* Start with base search ability */
+ chance = p_ptr->skill_srh;
- /* Know the trap */
- object_known(o_ptr);
+ /* Penalize various conditions */
+ if (p_ptr->blind || no_lite()) chance = chance / 10;
+ if (p_ptr->confused || p_ptr->image) chance = chance / 10;
- /* Notice it */
- disturb(0, 0);
- }
- }
- }
+ /* Search the nearby grids, which are always in bounds */
+ for (i = 0; i < 9; ++ i)
+ {
+ /* Sometimes, notice things */
+ if (randint0(100) < chance)
+ {
+ discover_hidden_things(py + ddy_ddd[i], px + ddx_ddd[i]);
}
}
}
-/*
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤¬¥ª¥Ö¥¸¥§¥¯¥È¤ò½¦¤Ã¤¿ºÝ¤Î¥á¥Ã¥»¡¼¥¸É½¼¨½èÍý /
* Helper routine for py_pickup() and py_pickup_floor().
- *
- * Add the given dungeon object to the character's inventory.
- *
- * Delete the object afterwards.
+ * @param o_idx ¼èÆÀ¤·¤¿¥ª¥Ö¥¸¥§¥¯¥È¤Î»²¾ÈID
+ * @return ¤Ê¤·
+ * @details
+ * ¥¢¥¤¥Æ¥à¤ò½¦¤Ã¤¿ºÝ¤Ë¡Ö£²¤Ä¤Î¥±¡¼¥¤ò»ý¤Ã¤Æ¤¤¤ë¡×\n
+ * "You have two cakes." ¤È¥¢¥¤¥Æ¥à¤ò½¦¤Ã¤¿¸å¤Î¹ç·×¤Î¤ß¤Îɽ¼¨¤¬¥ª¥ê¥¸¥Ê¥ë\n
+ * ¤À¤¬¡¢°ãÏ´¶¤¬\n
+ * ¤¢¤ë¤È¤¤¤¦»ØŦ¤ò¤¦¤±¤¿¤Î¤Ç¡¢¡Ö¡Á¤ò½¦¤Ã¤¿¡¢¡Á¤ò»ý¤Ã¤Æ¤¤¤ë¡×¤È¤¤¤¦É½¼¨\n
+ * ¤Ë¤«¤¨¤Æ¤¢¤ë¡£¤½¤Î¤¿¤á¤ÎÇÛÎó¡£\n
+ * Add the given dungeon object to the character's inventory.\n
+ * Delete the object afterwards.\n
*/
void py_pickup_aux(int o_idx)
{
- int slot, i;
+ int slot;
#ifdef JP
-/*
- * ¥¢¥¤¥Æ¥à¤ò½¦¤Ã¤¿ºÝ¤Ë¡Ö£²¤Ä¤Î¥±¡¼¥¤ò»ý¤Ã¤Æ¤¤¤ë¡×
- * "You have two cakes." ¤È¥¢¥¤¥Æ¥à¤ò½¦¤Ã¤¿¸å¤Î¹ç·×¤Î¤ß¤Îɽ¼¨¤¬¥ª¥ê¥¸¥Ê¥ë
- * ¤À¤¬¡¢°ãÏ´¶¤¬
- * ¤¢¤ë¤È¤¤¤¦»ØŦ¤ò¤¦¤±¤¿¤Î¤Ç¡¢¡Ö¡Á¤ò½¦¤Ã¤¿¡¢¡Á¤ò»ý¤Ã¤Æ¤¤¤ë¡×¤È¤¤¤¦É½¼¨
- * ¤Ë¤«¤¨¤Æ¤¢¤ë¡£¤½¤Î¤¿¤á¤ÎÇÛÎó¡£
- */
char o_name[MAX_NLEN];
char old_name[MAX_NLEN];
char kazu_str[80];
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);
}
-/*
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤¬¥ª¥Ö¥¸¥§¥¯¥È¾å¤Ë¾è¤Ã¤¿ºÝ¤Îɽ¼¨½èÍý
+ * @param pickup ¼«Æ°½¦¤¤½èÍý¤ò¹Ô¤¦¤Ê¤é¤ÐTRUE¤È¤¹¤ë
+ * @return ¤Ê¤·
+ * @details
* Player "wants" to pick up an object or gold.
* Note that we ONLY handle things that can be picked up.
* See "move_player()" for handling of other things.
next_o_idx = o_ptr->next_o_idx;
/* Hack -- disturb */
- disturb(0, 1);
+ disturb(0, 0);
/* Pick up gold */
if (o_ptr->tval == TV_GOLD)
}
-/*
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤Ø¤Î¥È¥é¥Ã¥×Ì¿ÃæȽÄê /
* Determine if a trap affects the player.
+ * @param power ´ðËܲóÈòÆñÅÙ
+ * @return ¥È¥é¥Ã¥×¤¬Ì¿Ã椷¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
+ * @details
* Always miss 5% of the time, Always hit 5% of the time.
* Otherwise, match trap power against player armor.
*/
}
-
-/*
- * Handle player hitting a real trap
+/*!
+ * @brief Íî¤È¤··ê·Ï¥È¥é¥Ã¥×¤ÎȽÄê¤È¥×¥ì¥¤¥ä¡¼¤ÎÈï³²½èÍý
+ * @param trap_feat_type¥È¥é¥Ã¥×¤Î¼ïÊÌID
+ * @return ¤Ê¤·
*/
-static void hit_trap(bool break_trap)
+static void hit_trap_pit(int trap_feat_type)
{
- int i, num, dam;
- int x = px, y = py;
+ int dam;
+ cptr trap_name = "";
+ cptr spike_name = "";
- /* 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;
+ switch (trap_feat_type)
+ {
+ case TRAP_PIT:
+ trap_name = _("Íî¤È¤··ê", "a pit trap");
+ break;
+ case TRAP_SPIKED_PIT:
+ trap_name = _("¥¹¥Ñ¥¤¥¯¤¬Éߤ«¤ì¤¿Íî¤È¤··ê", "a spiked pit");
+ spike_name = _("¥¹¥Ñ¥¤¥¯", "spikes");
+ break;
+ case TRAP_POISON_PIT:
+ trap_name = _("¥¹¥Ñ¥¤¥¯¤¬Éߤ«¤ì¤¿Íî¤È¤··ê", "a spiked pit");
+ spike_name = _("ÆǤòÅɤé¤ì¤¿¥¹¥Ñ¥¤¥¯", "poisonous spikes");
+ break;
+ default:
+ return;
+ }
-#ifdef JP
- cptr name = "¥È¥é¥Ã¥×";
-#else
- cptr name = "a trap";
-#endif
+ if (p_ptr->levitation)
+ {
+ msg_format(_("%s¤òÈô¤Ó±Û¤¨¤¿¡£", "You fly over %s."), trap_name);
+ return;
+ }
- /* Disturb the player */
- disturb(0, 1);
+ msg_format(_("%s¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª", "You have fallen into %s!"), trap_name);
- cave_alter_feat(y, x, FF_HIT_TRAP);
+ /* Base damage */
+ dam = damroll(2, 6);
- /* Analyze XXX XXX XXX */
- switch (trap_feat_type)
+ /* Extra spike damage */
+ if ((trap_feat_type == TRAP_SPIKED_PIT || trap_feat_type == TRAP_POISON_PIT) &&
+ one_in_(2))
{
- case TRAP_TRAPDOOR:
- {
- if (p_ptr->levitation)
- {
-#ifdef JP
- msg_print("Íî¤È¤·¸Í¤òÈô¤Ó±Û¤¨¤¿¡£");
-#else
- msg_print("You fly over a trap door.");
-#endif
+ msg_format(_("%s¤¬»É¤µ¤Ã¤¿¡ª", "You are impaled on %s!"), spike_name);
+ dam = dam * 2;
+ (void)set_cut(p_ptr->cut + randint1(dam));
+
+ if (trap_feat_type == TRAP_POISON_PIT) {
+ if (p_ptr->resist_pois || IS_OPPOSE_POIS())
+ {
+ msg_print(_("¤·¤«¤·ÆǤαƶÁ¤Ï¤Ê¤«¤Ã¤¿¡ª", "The poison does not affect you!"));
}
else
{
-#ifdef JP
- msg_print("Íî¤È¤·¸Í¤ËÍî¤Á¤¿¡ª");
- if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
- msg_print("¤¯¤Ã¤½¡Á¡ª");
-#else
- msg_print("You have fallen through a trap door!");
-#endif
-
- sound(SOUND_FALL);
- dam = damroll(2, 8);
-#ifdef JP
- name = "Íî¤È¤·¸Í";
-#else
- name = "a trap door";
-#endif
-
- take_hit(DAMAGE_NOESCAPE, dam, name, -1);
-
- /* Still alive and autosave enabled */
- if (autosave_l && (p_ptr->chp >= 0))
- do_cmd_save_game(TRUE);
-
-#ifdef JP
- do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "Íî¤È¤·¸Í¤ËÍî¤Á¤¿");
-#else
- do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "You have fallen through a trap door!");
-#endif
- prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
-
- /* Leaving */
- p_ptr->leaving = TRUE;
+ dam = dam * 2;
+ (void)set_poisoned(p_ptr->poisoned + randint1(dam));
}
- break;
}
+ }
- case TRAP_PIT:
- {
- if (p_ptr->levitation)
- {
-#ifdef JP
- msg_print("Íî¤È¤··ê¤òÈô¤Ó±Û¤¨¤¿¡£");
-#else
- msg_print("You fly over a pit trap.");
-#endif
+ /* Take the damage */
+ take_hit(DAMAGE_NOESCAPE, dam, trap_name, -1);
+}
- }
- else
- {
-#ifdef JP
- msg_print("Íî¤È¤··ê¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª");
-#else
- msg_print("You have fallen into a pit!");
-#endif
+/*!
+ * @brief ¥À¡¼¥Ä·Ï¥È¥é¥Ã¥×¡ÊÄ̾ï¥À¥á¡¼¥¸¡Ë¤ÎȽÄê¤È¥×¥ì¥¤¥ä¡¼¤ÎÈï³²½èÍý
+ * @return ¥À¡¼¥Ä¤¬Ì¿Ã椷¤¿¾ì¹çTRUE¤òÊÖ¤¹
+ */
+static bool hit_trap_dart(void)
+{
+ bool hit = FALSE;
- dam = damroll(2, 6);
-#ifdef JP
- name = "Íî¤È¤··ê";
-#else
- name = "a pit trap";
-#endif
+ if (check_hit(125))
+ {
+ msg_print(_("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤Æ»É¤µ¤Ã¤¿¡ª", "A small dart hits you!"));
- take_hit(DAMAGE_NOESCAPE, dam, name, -1);
- }
- break;
- }
+ take_hit(DAMAGE_ATTACK, damroll(1, 4), _("¥À¡¼¥Ä¤Îæ«", "a dart trap"), -1);
- case TRAP_SPIKED_PIT:
- {
- if (p_ptr->levitation)
- {
-#ifdef JP
- msg_print("¥È¥²¤Î¤¢¤ëÍî¤È¤··ê¤òÈô¤Ó±Û¤¨¤¿¡£");
-#else
- msg_print("You fly over a spiked pit.");
-#endif
+ if (!CHECK_MULTISHADOW()) hit = TRUE;
+ }
+ else
+ {
+ msg_print(_("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£", "A small dart barely misses you."));
+ }
- }
- else
- {
-#ifdef JP
- msg_print("¥¹¥Ñ¥¤¥¯¤¬Éߤ«¤ì¤¿Íî¤È¤··ê¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª");
-#else
- msg_print("You fall into a spiked pit!");
-#endif
+ return hit;
+}
+/*!
+ * @brief ¥À¡¼¥Ä·Ï¥È¥é¥Ã¥×¡ÊÄ̾ï¥À¥á¡¼¥¸¡ÜǽÎÏÃ͸º¾¯¡Ë¤ÎȽÄê¤È¥×¥ì¥¤¥ä¡¼¤ÎÈï³²½èÍý
+ * @param stat Äã²¼¤¹¤ëǽÎÏÃÍID
+ * @return ¤Ê¤·
+ */
+static void hit_trap_lose_stat(int stat)
+{
+ if (hit_trap_dart())
+ {
+ do_dec_stat(stat);
+ }
+}
- /* Base damage */
-#ifdef JP
- name = "Íî¤È¤··ê";
-#else
- name = "a pit trap";
-#endif
+/*!
+ * @brief ¥À¡¼¥Ä·Ï¥È¥é¥Ã¥×¡ÊÄ̾ï¥À¥á¡¼¥¸¡Ü¸ºÂ®¡Ë¤ÎȽÄê¤È¥×¥ì¥¤¥ä¡¼¤ÎÈï³²½èÍý
+ * @return ¤Ê¤·
+ */
+static void hit_trap_slow(void)
+{
+ if (hit_trap_dart())
+ {
+ set_slow(p_ptr->slow + randint0(20) + 20, FALSE);
+ }
+}
- dam = damroll(2, 6);
+/*!
+ * @brief ¥À¡¼¥Ä·Ï¥È¥é¥Ã¥×¡ÊÄ̾ï¥À¥á¡¼¥¸¡Ü¾õÂÖ°Û¾ï¡Ë¤ÎȽÄê¤È¥×¥ì¥¤¥ä¡¼¤ÎÈï³²½èÍý
+ * @param trap_messsage ¥á¥Ã¥»¡¼¥¸¤ÎÊ䴰ʸ»úÎó
+ * @param resist ¾õÂÖ°Û¾ï¤ËÄñ¹³¤¹¤ëȽÄ꤬½Ð¤¿¤Ê¤éTRUE
+ * @param set_status ¾õÂÖ°Û¾ï¤ò»ØÄꤹ¤ë´Ø¿ô¥Ý¥¤¥ó¥¿
+ * @param turn ¾õÂÖ°Û¾ï¤ÎÄɲå¿¡¼¥óÎÌ
+ * @return ¤Ê¤·
+ */
+static void hit_trap_set_abnormal_status(cptr trap_message, bool resist, bool (*set_status)(int turn), int turn)
+{
+ msg_print(trap_message);
- /* Extra spike damage */
- if (randint0(100) < 50)
- {
-#ifdef JP
- msg_print("¥¹¥Ñ¥¤¥¯¤¬»É¤µ¤Ã¤¿¡ª");
-#else
- msg_print("You are impaled!");
-#endif
+ if (!resist)
+ {
+ set_status(turn);
+ }
+}
+
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤Ø¤Î¥È¥é¥Ã¥×ºîÆ°½èÍý¥á¥¤¥ó¥ë¡¼¥Á¥ó /
+ * Handle player hitting a real trap
+ * @param break_trap ºîÆ°¸å¤Î¥È¥é¥Ã¥×Ç˲õ¤¬³ÎÄꤷ¤Æ¤¤¤ë¤Ê¤é¤ÐTRUE
+ * @return ¤Ê¤·
+ */
+static void hit_trap(bool break_trap)
+{
+ int i, num, dam;
+ int x = px, y = py;
+ /* 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
- name = "¥È¥²¤Î¤¢¤ëÍî¤È¤··ê";
+ cptr name = "¥È¥é¥Ã¥×";
#else
- name = "a spiked pit";
+ cptr name = "a trap";
#endif
- dam = dam * 2;
- (void)set_cut(p_ptr->cut + randint1(dam));
- }
+ /* Disturb the player */
+ disturb(0, 1);
- /* Take the damage */
- take_hit(DAMAGE_NOESCAPE, dam, name, -1);
- }
- break;
- }
+ cave_alter_feat(y, x, FF_HIT_TRAP);
- case TRAP_POISON_PIT:
+ /* Analyze XXX XXX XXX */
+ switch (trap_feat_type)
+ {
+ case TRAP_TRAPDOOR:
{
if (p_ptr->levitation)
{
#ifdef JP
- msg_print("¥È¥²¤Î¤¢¤ëÍî¤È¤··ê¤òÈô¤Ó±Û¤¨¤¿¡£");
+ msg_print("Íî¤È¤·¸Í¤òÈô¤Ó±Û¤¨¤¿¡£");
#else
- msg_print("You fly over a spiked pit.");
+ msg_print("You fly over a trap door.");
#endif
}
else
{
#ifdef JP
- msg_print("¥¹¥Ñ¥¤¥¯¤¬Éߤ«¤ì¤¿Íî¤È¤··ê¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª");
-#else
- msg_print("You fall into a spiked pit!");
-#endif
-
-
- /* Base damage */
- dam = damroll(2, 6);
-
-#ifdef JP
- name = "Íî¤È¤··ê";
-#else
- name = "a pit trap";
-#endif
-
-
- /* Extra spike damage */
- if (randint0(100) < 50)
- {
-#ifdef JP
- msg_print("ÆǤòÅɤé¤ì¤¿¥¹¥Ñ¥¤¥¯¤¬»É¤µ¤Ã¤¿¡ª");
+ msg_print("Íî¤È¤·¸Í¤ËÍî¤Á¤¿¡ª");
+ if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
+ msg_print("¤¯¤Ã¤½¡Á¡ª");
#else
- msg_print("You are impaled on poisonous spikes!");
+ msg_print("You have fallen through a trap door!");
#endif
-
+ sound(SOUND_FALL);
+ dam = damroll(2, 8);
#ifdef JP
- name = "¥È¥²¤Î¤¢¤ëÍî¤È¤··ê";
+ name = "Íî¤È¤·¸Í";
#else
- name = "a spiked pit";
+ name = "a trap door";
#endif
+ take_hit(DAMAGE_NOESCAPE, dam, name, -1);
- dam = dam * 2;
- (void)set_cut(p_ptr->cut + randint1(dam));
+ /* Still alive and autosave enabled */
+ if (autosave_l && (p_ptr->chp >= 0))
+ do_cmd_save_game(TRUE);
- if (p_ptr->resist_pois || IS_OPPOSE_POIS())
- {
#ifdef JP
- msg_print("¤·¤«¤·ÆǤαƶÁ¤Ï¤Ê¤«¤Ã¤¿¡ª");
+ do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "Íî¤È¤·¸Í¤ËÍî¤Á¤¿");
#else
- msg_print("The poison does not affect you!");
+ do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "You have fallen through a trap door!");
#endif
+ prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
- }
-
- else
- {
- dam = dam * 2;
- (void)set_poisoned(p_ptr->poisoned + randint1(dam));
- }
- }
-
- /* Take the damage */
- take_hit(DAMAGE_NOESCAPE, dam, name, -1);
+ /* Leaving */
+ p_ptr->leaving = TRUE;
}
+ break;
+ }
+ case TRAP_PIT:
+ case TRAP_SPIKED_PIT:
+ case TRAP_POISON_PIT:
+ {
+ hit_trap_pit(trap_feat_type);
break;
}
dam = damroll(4, 6);
#ifdef JP
- (void)fire_dam(dam, "±ê¤Î¥È¥é¥Ã¥×", -1);
+ (void)fire_dam(dam, "±ê¤Î¥È¥é¥Ã¥×", -1, FALSE);
#else
- (void)fire_dam(dam, "a fire trap", -1);
+ (void)fire_dam(dam, "a fire trap", -1, FALSE);
#endif
break;
dam = damroll(4, 6);
#ifdef JP
- (void)acid_dam(dam, "»À¤Î¥È¥é¥Ã¥×", -1);
+ (void)acid_dam(dam, "»À¤Î¥È¥é¥Ã¥×", -1, FALSE);
#else
- (void)acid_dam(dam, "an acid trap", -1);
+ (void)acid_dam(dam, "an acid trap", -1, FALSE);
#endif
break;
case TRAP_SLOW:
{
- if (check_hit(125))
- {
-#ifdef JP
- msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤Æ»É¤µ¤Ã¤¿¡ª");
-#else
- msg_print("A small dart hits you!");
-#endif
-
- dam = damroll(1, 4);
-#ifdef JP
- take_hit(DAMAGE_ATTACK, dam, "¥À¡¼¥Ä¤Îæ«", -1);
-#else
- take_hit(DAMAGE_ATTACK, dam, "a dart trap", -1);
-#endif
-
- if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(20) + 20, FALSE);
- }
- else
- {
-#ifdef JP
- msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£");
-#else
- msg_print("A small dart barely misses you.");
-#endif
-
- }
+ hit_trap_slow();
break;
}
case TRAP_LOSE_STR:
{
- if (check_hit(125))
- {
-#ifdef JP
- msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤Æ»É¤µ¤Ã¤¿¡ª");
-#else
- msg_print("A small dart hits you!");
-#endif
-
- dam = damroll(1, 4);
-#ifdef JP
- take_hit(DAMAGE_ATTACK, dam, "¥À¡¼¥Ä¤Îæ«", -1);
-#else
- take_hit(DAMAGE_ATTACK, dam, "a dart trap", -1);
-#endif
-
- if (!CHECK_MULTISHADOW()) (void)do_dec_stat(A_STR);
- }
- else
- {
-#ifdef JP
- msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£");
-#else
- msg_print("A small dart barely misses you.");
-#endif
-
- }
+ hit_trap_lose_stat(A_STR);
break;
}
case TRAP_LOSE_DEX:
{
- if (check_hit(125))
- {
-#ifdef JP
- msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤Æ»É¤µ¤Ã¤¿¡ª");
-#else
- msg_print("A small dart hits you!");
-#endif
-
- dam = damroll(1, 4);
-#ifdef JP
- take_hit(DAMAGE_ATTACK, dam, "¥À¡¼¥Ä¤Îæ«", -1);
-#else
- take_hit(DAMAGE_ATTACK, dam, "a dart trap", -1);
-#endif
-
- if (!CHECK_MULTISHADOW()) (void)do_dec_stat(A_DEX);
- }
- else
- {
-#ifdef JP
- msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£");
-#else
- msg_print("A small dart barely misses you.");
-#endif
-
- }
+ hit_trap_lose_stat(A_DEX);
break;
}
case TRAP_LOSE_CON:
{
- if (check_hit(125))
- {
-#ifdef JP
- msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤Æ»É¤µ¤Ã¤¿¡ª");
-#else
- msg_print("A small dart hits you!");
-#endif
-
- dam = damroll(1, 4);
-#ifdef JP
- take_hit(DAMAGE_ATTACK, dam, "¥À¡¼¥Ä¤Îæ«", -1);
-#else
- take_hit(DAMAGE_ATTACK, dam, "a dart trap", -1);
-#endif
-
- if (!CHECK_MULTISHADOW()) (void)do_dec_stat(A_CON);
- }
- else
- {
-#ifdef JP
- msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£");
-#else
- msg_print("A small dart barely misses you.");
-#endif
-
- }
+ hit_trap_lose_stat(A_CON);
break;
}
case TRAP_BLIND:
{
-#ifdef JP
- msg_print("¹õ¤¤¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª");
-#else
- msg_print("A black gas surrounds you!");
-#endif
-
- if (!p_ptr->resist_blind)
- {
- (void)set_blind(p_ptr->blind + randint0(50) + 25);
- }
+ hit_trap_set_abnormal_status(
+ _("¹õ¤¤¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª", "A black gas surrounds you!"),
+ p_ptr->resist_blind,
+ set_blind, p_ptr->blind + randint0(50) + 25);
break;
}
case TRAP_CONFUSE:
{
-#ifdef JP
- msg_print("¤¤é¤á¤¯¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª");
-#else
- msg_print("A gas of scintillating colors surrounds you!");
-#endif
-
- if (!p_ptr->resist_conf)
- {
- (void)set_confused(p_ptr->confused + randint0(20) + 10);
- }
+ hit_trap_set_abnormal_status(
+ _("¤¤é¤á¤¯¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª", "A gas of scintillating colors surrounds you!"),
+ p_ptr->resist_conf,
+ set_confused, p_ptr->confused + randint0(20) + 10);
break;
}
case TRAP_POISON:
{
-#ifdef JP
- msg_print("»É·ãŪ¤ÊÎп§¤Î¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª");
-#else
- msg_print("A pungent green gas surrounds you!");
-#endif
-
- if (!p_ptr->resist_pois && !IS_OPPOSE_POIS())
- {
- (void)set_poisoned(p_ptr->poisoned + randint0(20) + 10);
- }
+ hit_trap_set_abnormal_status(
+ _("»É·ãŪ¤ÊÎп§¤Î¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª", "A pungent green gas surrounds you!"),
+ p_ptr->resist_pois || IS_OPPOSE_POIS(),
+ set_poisoned, p_ptr->poisoned + randint0(20) + 10);
break;
}
}
-static void touch_zap_player(monster_type *m_ptr)
+/*!
+ * @brief Ũ¥ª¡¼¥é¤Ë¤è¤ë¥×¥ì¥¤¥ä¡¼¤Î¥À¥á¡¼¥¸½èÍý¡ÊÊä½õ¡Ë
+ * @param m_ptr ¥ª¡¼¥é¤ò»ý¤Ä¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @param immune ¥À¥á¡¼¥¸¤ò²óÈò¤Ç¤¤ëÌȱ֥ե饰
+ * @param flags_offset ¥ª¡¼¥é¥Õ¥é¥°ÇÛÎó¤Î»²¾È¥ª¥Õ¥»¥Ã¥È
+ * @param r_flags_offset ¥â¥ó¥¹¥¿¡¼¤ÎÂÑÀÇÛÎó¤Î»²¾È¥ª¥Õ¥»¥Ã¥È
+ * @param aura_flag ¥ª¡¼¥é¥Õ¥é¥°ÇÛÎó
+ * @param dam_func ¥À¥á¡¼¥¸½èÍý¤ò¹Ô¤¦´Ø¿ô¤Î»²¾È¥Ý¥¤¥ó¥¿
+ * @param message ¥ª¡¼¥é¥À¥á¡¼¥¸¤ò¼õ¤±¤¿ºÝ¤Î¥á¥Ã¥»¡¼¥¸
+ * @return ¤Ê¤·
+ */
+static void touch_zap_player_aux(monster_type *m_ptr, bool immune, int flags_offset, int r_flags_offset, u32b aura_flag,
+ int (*dam_func)(int dam, cptr kb_str, int monspell, bool aura), cptr message)
{
- int aura_damage = 0;
monster_race *r_ptr = &r_info[m_ptr->r_idx];
- if (r_ptr->flags2 & RF2_AURA_FIRE)
+ if ((atoffset(u32b, r_ptr, flags_offset) & aura_flag) && !immune)
{
- if (!p_ptr->immune_fire)
- {
- char aura_dam[80];
-
- aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
+ char mon_name[80];
+ int aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
- /* Hack -- Get the "died from" name */
- monster_desc(aura_dam, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
-
-#ifdef JP
- msg_print("ÆÍÁ³¤È¤Æ¤âÇ®¤¯¤Ê¤Ã¤¿¡ª");
-#else
- msg_print("You are suddenly very hot!");
-#endif
+ /* Hack -- Get the "died from" name */
+ monster_desc(mon_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
- 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;
+ msg_print(message);
- take_hit(DAMAGE_NOESCAPE, aura_damage, aura_dam, -1);
- if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= RF2_AURA_FIRE;
- handle_stuff();
- }
- }
+ dam_func(aura_damage, mon_name, -1, TRUE);
- if (r_ptr->flags3 & RF3_AURA_COLD)
- {
- if (!p_ptr->immune_cold)
+ if (is_original_ap_and_seen(m_ptr))
{
- char aura_dam[80];
-
- aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
-
- /* Hack -- Get the "died from" name */
- monster_desc(aura_dam, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
-
-#ifdef JP
- msg_print("ÆÍÁ³¤È¤Æ¤â´¨¤¯¤Ê¤Ã¤¿¡ª");
-#else
- msg_print("You are suddenly very cold!");
-#endif
-
- if (IS_OPPOSE_COLD()) aura_damage = (aura_damage + 2) / 3;
- if (p_ptr->resist_cold) aura_damage = (aura_damage + 2) / 3;
-
- take_hit(DAMAGE_NOESCAPE, aura_damage, aura_dam, -1);
- if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_AURA_COLD;
- handle_stuff();
+ atoffset(u32b, r_ptr, r_flags_offset) |= aura_flag;
}
- }
-
- if (r_ptr->flags2 & RF2_AURA_ELEC)
- {
- if (!p_ptr->immune_elec)
- {
- char aura_dam[80];
-
- aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
-
- /* Hack -- Get the "died from" name */
- monster_desc(aura_dam, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
-
- if (prace_is_(RACE_ANDROID)) aura_damage += aura_damage / 3;
- if (IS_OPPOSE_ELEC()) aura_damage = (aura_damage + 2) / 3;
- if (p_ptr->resist_elec) aura_damage = (aura_damage + 2) / 3;
-
-#ifdef JP
- msg_print("ÅÅ·â¤ò¤¯¤é¤Ã¤¿¡ª");
-#else
- msg_print("You get zapped!");
-#endif
- take_hit(DAMAGE_NOESCAPE, aura_damage, aura_dam, -1);
- if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= RF2_AURA_ELEC;
- handle_stuff();
- }
+ handle_stuff();
}
}
+/*!
+ * @brief Ũ¥ª¡¼¥é¤Ë¤è¤ë¥×¥ì¥¤¥ä¡¼¤Î¥À¥á¡¼¥¸½èÍý¡Ê¥á¥¤¥ó¡Ë
+ * @param m_ptr ¥ª¡¼¥é¤ò»ý¤Ä¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @return ¤Ê¤·
+ */
+static void touch_zap_player(monster_type *m_ptr)
+{
+ touch_zap_player_aux(m_ptr, p_ptr->immune_fire, offsetof(monster_race, flags2), offsetof(monster_race, r_flags2), RF2_AURA_FIRE,
+ fire_dam, _("ÆÍÁ³¤È¤Æ¤âÇ®¤¯¤Ê¤Ã¤¿¡ª", "You are suddenly very hot!"));
+ touch_zap_player_aux(m_ptr, p_ptr->immune_cold, offsetof(monster_race, flags3), offsetof(monster_race, r_flags3), RF3_AURA_COLD,
+ cold_dam, _("ÆÍÁ³¤È¤Æ¤â´¨¤¯¤Ê¤Ã¤¿¡ª", "You are suddenly very cold!"));
+ touch_zap_player_aux(m_ptr, p_ptr->immune_elec, offsetof(monster_race, flags2), offsetof(monster_race, r_flags2), RF2_AURA_ELEC,
+ elec_dam, _("ÅÅ·â¤ò¤¯¤é¤Ã¤¿¡ª", "You get zapped!"));
+}
+
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤ÎÊÑ°ÛÍ×ÁǤˤè¤ëÂÇ·â½èÍý
+ * @param m_idx ¹¶·âÌÜɸ¤È¤Ê¤Ã¤¿¥â¥ó¥¹¥¿¡¼¤Î»²¾ÈID
+ * @param attack ÊÑ°ÛÍ×ÁǤˤè¤ë¹¶·âÍ×ÁǤμïÎà
+ * @param fear ¹¶·â¤ò¼õ¤±¤¿¥â¥ó¥¹¥¿¡¼¤¬¶²¹²¾õÂ֤˴٤俤«¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
+ * @param mdeath ¹¶·â¤ò¼õ¤±¤¿¥â¥ó¥¹¥¿¡¼¤¬»àË´¤·¤¿¤«¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
+ * @return ¤Ê¤·
+ */
static void natural_attack(s16b m_idx, int attack, bool *fear, bool *mdeath)
{
int k, bonus, chance;
}
-
-/*
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤ÎÂÇ·â½èÍý¥µ¥Ö¥ë¡¼¥Á¥ó /
* Player attacks a (poor, defenseless) creature -RAK-
- *
+ * @param y ¹¶·âÌÜɸ¤ÎYºÂɸ
+ * @param x ¹¶·âÌÜɸ¤ÎXºÂɸ
+ * @param fear ¹¶·â¤ò¼õ¤±¤¿¥â¥ó¥¹¥¿¡¼¤¬¶²¹²¾õÂ֤˴٤俤«¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
+ * @param mdeath ¹¶·â¤ò¼õ¤±¤¿¥â¥ó¥¹¥¿¡¼¤¬»àË´¤·¤¿¤«¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
+ * @param hand ¹¶·â¤ò¹Ô¤¦¤¿¤á¤ÎÉð´ï¤ò»ý¤Ä¼ê
+ * @param mode ȯưÃæ¤Î·õ½ÑID
+ * @return ¤Ê¤·
+ * @details
* If no "weapon" is available, then "punch" the monster one time.
*/
static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int mode)
}
}
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤ÎÂÇ·â½èÍý¥á¥¤¥ó¥ë¡¼¥Á¥ó
+ * @param y ¹¶·âÌÜɸ¤ÎYºÂɸ
+ * @param x ¹¶·âÌÜɸ¤ÎXºÂɸ
+ * @param mode ȯưÃæ¤Î·õ½ÑID
+ * @return ¼ÂºÝ¤Ë¹¶·â½èÍý¤¬¹Ô¤ï¤ì¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
+ * @details
+ * If no "weapon" is available, then "punch" the monster one time.
+ */
bool py_attack(int y, int x, int mode)
{
bool fear = FALSE;
{
if (quest[p_ptr->inside_quest].type == QUEST_TYPE_FIND_EXIT)
{
- if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, p_ptr->inside_quest, NULL);
- quest[p_ptr->inside_quest].status = QUEST_STATUS_COMPLETED;
- quest[p_ptr->inside_quest].complev = (byte)p_ptr->lev;
-#ifdef JP
- msg_print("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª");
-#else
- msg_print("You accomplished your quest!");
-#endif
-
- msg_print(NULL);
+ complete_quest(p_ptr->inside_quest);
}
leave_quest_check();
/*
* Test for traveling
*/
-static bool travel_test(void)
+static int travel_test(int prev_dir)
{
- int prev_dir, new_dir, check_dir = 0;
- int row, col;
+ int new_dir = 0;
int i, max;
- bool stop = TRUE;
- cave_type *c_ptr;
-
- /* Where we came from */
- prev_dir = find_prevdir;
+ const cave_type *c_ptr;
+ int cost;
- /* Range of newly adjacent grids */
- max = (prev_dir & 0x01) + 1;
-
- for (i = 0; i < 8; i++)
+ /* Cannot travel when blind */
+ if (p_ptr->blind || no_lite())
{
- if (travel.cost[py+ddy_ddd[i]][px+ddx_ddd[i]] < travel.cost[py][px]) stop = FALSE;
+ msg_print(_("Ìܤ¬¸«¤¨¤Ê¤¤¡ª", "You cannot see!"));
+ return (0);
}
- if (stop) return (TRUE);
-
/* break run when leaving trap detected region */
if ((disturb_trap_detect || alert_trap_detect)
&& p_ptr->dtrap && !(cave[py][px].info & CAVE_IN_DETECT))
if (disturb_trap_detect)
{
/* Break Run */
- return(TRUE);
+ return (0);
}
}
}
- /* Cannot travel when blind */
- if (p_ptr->blind || no_lite())
- {
-#ifdef JP
- msg_print("Ìܤ¬¸«¤¨¤Ê¤¤¡ª");
-#else
- msg_print("You cannot see!");
-#endif
- return (TRUE);
- }
+ /* Range of newly adjacent grids */
+ max = (prev_dir & 0x01) + 1;
/* Look at every newly adjacent square. */
for (i = -max; i <= max; i++)
{
/* New direction */
- new_dir = cycle[chome[prev_dir] + i];
+ int dir = cycle[chome[prev_dir] + i];
/* New location */
- row = py + ddy[new_dir];
- col = px + ddx[new_dir];
+ 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 (TRUE);
+ if (m_ptr->ml) return (0);
}
+
}
- /* Failure */
- return (FALSE);
+ /* 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);
}
*/
void travel_step(void)
{
- int i;
- int dir = travel.dir;
-
- find_prevdir = dir;
+ /* Get travel direction */
+ travel.dir = travel_test(travel.dir);
/* disturb */
- if (travel_test())
+ if (!travel.dir)
{
if (travel.run == 255)
{
#else
msg_print("No route is found!");
#endif
+ travel.y = travel.x = 0;
}
disturb(0, 1);
return;
energy_use = 100;
- for (i = 1; i <= 9; i++)
- {
- if (i == 5) continue;
-
- if (travel.cost[py+ddy[i]][px+ddx[i]] < travel.cost[py+ddy[dir]][px+ddx[dir]])
- {
- dir = i;
- }
- }
-
- /* Close door */
- if (!easy_open && is_closed_door(cave[py+ddy[dir]][px+ddx[dir]].feat))
- {
- disturb(0, 1);
- return;
- }
-
- travel.dir = dir;
- move_player(dir, always_pickup, easy_disarm);
+ 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