/* File: cmd1.c */
-/* Purpose: Movement commands (part 1) */
-
/*
- * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke
+ * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
*
- * This software may be copied and distributed for educational, research, and
- * not for profit purposes provided that this copyright and statement are
- * included in all such copies.
+ * This software may be copied and distributed for educational, research,
+ * and not for profit purposes provided that this copyright and statement
+ * are included in all such copies. Other copyrights may also apply.
*/
+/* Purpose: Movement commands (part 1) */
+
#include "angband.h"
#define MAX_VAMPIRIC_DRAIN 50
* Note that most brands and slays are x3, except Slay Animal (x2),
* Slay Evil (x2), and Kill dragon (x5).
*/
-s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, int mode)
+s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, int mode, bool thrown)
{
int mult = 10;
monster_race *r_ptr = &r_info[m_ptr->r_idx];
- u32b f1, f2, f3;
+ u32b flgs[TR_FLAG_SIZE];
/* Extract the flags */
- object_flags(o_ptr, &f1, &f2, &f3);
+ object_flags(o_ptr, flgs);
/* Some "weapons" and "ammo" do extra damage */
switch (o_ptr->tval)
case TV_DIGGING:
{
/* Slay Animal */
- if ((f1 & TR1_SLAY_ANIMAL) &&
+ if ((have_flag(flgs, TR_SLAY_ANIMAL)) &&
(r_ptr->flags3 & RF3_ANIMAL))
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags3 |= RF3_ANIMAL;
}
if (mult < 25) mult = 25;
}
+ /* Execute Animal */
+ if ((have_flag(flgs, TR_KILL_ANIMAL)) &&
+ (r_ptr->flags3 & RF3_ANIMAL))
+ {
+ if (m_ptr->ml && is_original_ap(m_ptr))
+ {
+ r_ptr->r_flags3 |= RF3_ANIMAL;
+ }
+
+ if (mult < 40) mult = 40;
+ }
+
/* Slay Evil */
- if ((f1 & TR1_SLAY_EVIL) &&
+ if ((have_flag(flgs, TR_SLAY_EVIL)) &&
(r_ptr->flags3 & RF3_EVIL))
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags3 |= RF3_EVIL;
}
if (mult < 20) mult = 20;
}
+ /* Execute Evil */
+ if ((have_flag(flgs, TR_KILL_EVIL)) &&
+ (r_ptr->flags3 & RF3_EVIL))
+ {
+ if (m_ptr->ml && is_original_ap(m_ptr))
+ {
+ r_ptr->r_flags3 |= RF3_EVIL;
+ }
+
+ if (mult < 35) mult = 35;
+ }
+
/* Slay Human */
- if ((f3 & TR3_SLAY_HUMAN) &&
+ if ((have_flag(flgs, TR_SLAY_HUMAN)) &&
(r_ptr->flags2 & RF2_HUMAN))
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags2 |= RF2_HUMAN;
}
if (mult < 25) mult = 25;
}
+ /* Execute Human */
+ if ((have_flag(flgs, TR_KILL_HUMAN)) &&
+ (r_ptr->flags2 & RF2_HUMAN))
+ {
+ if (m_ptr->ml && is_original_ap(m_ptr))
+ {
+ r_ptr->r_flags2 |= RF2_HUMAN;
+ }
+
+ if (mult < 40) mult = 40;
+ }
+
/* Slay Undead */
- if ((f1 & TR1_SLAY_UNDEAD) &&
+ if ((have_flag(flgs, TR_SLAY_UNDEAD)) &&
(r_ptr->flags3 & RF3_UNDEAD))
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags3 |= RF3_UNDEAD;
}
if (mult < 30) mult = 30;
}
+ /* Execute Undead */
+ if ((have_flag(flgs, TR_KILL_UNDEAD)) &&
+ (r_ptr->flags3 & RF3_UNDEAD))
+ {
+ if (m_ptr->ml && is_original_ap(m_ptr))
+ {
+ r_ptr->r_flags3 |= RF3_UNDEAD;
+ }
+
+ if (mult < 50) mult = 50;
+ }
+
/* Slay Demon */
- if ((f1 & TR1_SLAY_DEMON) &&
+ if ((have_flag(flgs, TR_SLAY_DEMON)) &&
(r_ptr->flags3 & RF3_DEMON))
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags3 |= RF3_DEMON;
}
if (mult < 30) mult = 30;
}
+ /* Execute Demon */
+ if ((have_flag(flgs, TR_KILL_DEMON)) &&
+ (r_ptr->flags3 & RF3_DEMON))
+ {
+ if (m_ptr->ml && is_original_ap(m_ptr))
+ {
+ r_ptr->r_flags3 |= RF3_DEMON;
+ }
+
+ if (mult < 50) mult = 50;
+ }
+
/* Slay Orc */
- if ((f1 & TR1_SLAY_ORC) &&
+ if ((have_flag(flgs, TR_SLAY_ORC)) &&
(r_ptr->flags3 & RF3_ORC))
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags3 |= RF3_ORC;
}
if (mult < 30) mult = 30;
}
+ /* Execute Orc */
+ if ((have_flag(flgs, TR_KILL_ORC)) &&
+ (r_ptr->flags3 & RF3_ORC))
+ {
+ if (m_ptr->ml && is_original_ap(m_ptr))
+ {
+ r_ptr->r_flags3 |= RF3_ORC;
+ }
+
+ if (mult < 50) mult = 50;
+ }
+
/* Slay Troll */
- if ((f1 & TR1_SLAY_TROLL) &&
+ if ((have_flag(flgs, TR_SLAY_TROLL)) &&
(r_ptr->flags3 & RF3_TROLL))
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags3 |= RF3_TROLL;
}
if (mult < 30) mult = 30;
}
+ /* Execute Troll */
+ if ((have_flag(flgs, TR_KILL_TROLL)) &&
+ (r_ptr->flags3 & RF3_TROLL))
+ {
+ if (m_ptr->ml && is_original_ap(m_ptr))
+ {
+ r_ptr->r_flags3 |= RF3_TROLL;
+ }
+
+ if (mult < 50) mult = 50;
+ }
+
/* Slay Giant */
- if ((f1 & TR1_SLAY_GIANT) &&
+ if ((have_flag(flgs, TR_SLAY_GIANT)) &&
(r_ptr->flags3 & RF3_GIANT))
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags3 |= RF3_GIANT;
}
if (mult < 30) mult = 30;
- if (o_ptr->name1 == ART_HRUNTING)
- mult *= 3;
+ }
+
+ /* Execute Giant */
+ if ((have_flag(flgs, TR_KILL_GIANT)) &&
+ (r_ptr->flags3 & RF3_GIANT))
+ {
+ if (m_ptr->ml && is_original_ap(m_ptr))
+ {
+ r_ptr->r_flags3 |= RF3_GIANT;
+ }
+
+ if (mult < 50) mult = 50;
}
/* Slay Dragon */
- if ((f1 & TR1_SLAY_DRAGON) &&
+ if ((have_flag(flgs, TR_SLAY_DRAGON)) &&
(r_ptr->flags3 & RF3_DRAGON))
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags3 |= RF3_DRAGON;
}
}
/* Execute Dragon */
- if ((f1 & TR1_KILL_DRAGON) &&
+ if ((have_flag(flgs, TR_KILL_DRAGON)) &&
(r_ptr->flags3 & RF3_DRAGON))
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags3 |= RF3_DRAGON;
}
}
/* Brand (Acid) */
- if ((f1 & TR1_BRAND_ACID) || (p_ptr->special_attack & (ATTACK_ACID)))
+ if (have_flag(flgs, TR_BRAND_ACID) || ((p_ptr->special_attack & (ATTACK_ACID)) && !thrown))
{
/* Notice immunity */
- if (r_ptr->flags3 & RF3_IM_ACID)
+ if (r_ptr->flagsr & RFR_EFF_IM_ACID_MASK)
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
- r_ptr->r_flags3 |= RF3_IM_ACID;
+ r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ACID_MASK);
}
}
}
/* Brand (Elec) */
- if ((f1 & TR1_BRAND_ELEC) || (p_ptr->special_attack & (ATTACK_ELEC)) || (mode == HISSATSU_ELEC))
+ if (have_flag(flgs, TR_BRAND_ELEC) || ((p_ptr->special_attack & (ATTACK_ELEC)) && !thrown) || (mode == HISSATSU_ELEC))
{
/* Notice immunity */
- if (r_ptr->flags3 & RF3_IM_ELEC)
+ if (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK)
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
- r_ptr->r_flags3 |= RF3_IM_ELEC;
+ r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK);
}
}
/* Otherwise, take the damage */
- else if (((f1 & TR1_BRAND_ELEC) || (p_ptr->special_attack & (ATTACK_ELEC))) && (mode == HISSATSU_ELEC))
+ else if ((have_flag(flgs, TR_BRAND_ELEC) || ((p_ptr->special_attack & (ATTACK_ELEC)) && !thrown)) && (mode == HISSATSU_ELEC))
{
if (mult < 70) mult = 70;
}
}
/* Brand (Fire) */
- if ((f1 & TR1_BRAND_FIRE) || (p_ptr->special_attack & (ATTACK_FIRE)) || (mode == HISSATSU_FIRE))
+ if (have_flag(flgs, TR_BRAND_FIRE) || ((p_ptr->special_attack & (ATTACK_FIRE)) && !thrown) || (mode == HISSATSU_FIRE))
{
/* Notice immunity */
- if (r_ptr->flags3 & RF3_IM_FIRE)
+ if (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK)
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
- r_ptr->r_flags3 |= RF3_IM_FIRE;
+ r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK);
}
}
/* Otherwise, take the damage */
- else if (((f1 & TR1_BRAND_FIRE) || (p_ptr->special_attack & (ATTACK_FIRE))) && (mode == HISSATSU_FIRE))
+ else if ((have_flag(flgs, TR_BRAND_FIRE) || ((p_ptr->special_attack & (ATTACK_FIRE)) && !thrown)) && (mode == HISSATSU_FIRE))
{
if (r_ptr->flags3 & RF3_HURT_FIRE)
{
if (mult < 70) mult = 70;
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags3 |= RF3_HURT_FIRE;
}
if (r_ptr->flags3 & RF3_HURT_FIRE)
{
if (mult < 50) mult = 50;
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags3 |= RF3_HURT_FIRE;
}
}
/* Brand (Cold) */
- if ((f1 & TR1_BRAND_COLD) || (p_ptr->special_attack & (ATTACK_COLD)) || (mode == HISSATSU_COLD))
+ if (have_flag(flgs, TR_BRAND_COLD) || ((p_ptr->special_attack & (ATTACK_COLD)) && !thrown) || (mode == HISSATSU_COLD))
{
/* Notice immunity */
- if (r_ptr->flags3 & RF3_IM_COLD)
+ if (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK)
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
- r_ptr->r_flags3 |= RF3_IM_COLD;
+ r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK);
}
}
/* Otherwise, take the damage */
- else if (((f1 & TR1_BRAND_COLD) || (p_ptr->special_attack & (ATTACK_COLD))) && (mode == HISSATSU_COLD))
+ else if ((have_flag(flgs, TR_BRAND_COLD) || ((p_ptr->special_attack & (ATTACK_COLD)) && !thrown)) && (mode == HISSATSU_COLD))
{
if (r_ptr->flags3 & RF3_HURT_COLD)
{
if (mult < 70) mult = 70;
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags3 |= RF3_HURT_COLD;
}
if (r_ptr->flags3 & RF3_HURT_COLD)
{
if (mult < 50) mult = 50;
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags3 |= RF3_HURT_COLD;
}
}
/* Brand (Poison) */
- if ((f1 & TR1_BRAND_POIS) || (p_ptr->special_attack & (ATTACK_POIS)) || (mode == HISSATSU_POISON))
+ if (have_flag(flgs, TR_BRAND_POIS) || ((p_ptr->special_attack & (ATTACK_POIS)) && !thrown) || (mode == HISSATSU_POISON))
{
/* Notice immunity */
- if (r_ptr->flags3 & RF3_IM_POIS)
+ if (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK)
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
- r_ptr->r_flags3 |= RF3_IM_POIS;
+ r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK);
}
}
/* Otherwise, take the damage */
- else if (((f1 & TR1_BRAND_POIS) || (p_ptr->special_attack & (ATTACK_POIS))) && (mode == HISSATSU_POISON))
+ else if ((have_flag(flgs, TR_BRAND_POIS) || ((p_ptr->special_attack & (ATTACK_POIS)) && !thrown)) && (mode == HISSATSU_POISON))
{
if (mult < 35) mult = 35;
}
if (mult < 25) mult = 25;
}
}
- if ((mode == HISSATSU_ZANMA) && (r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)) && (r_ptr->flags3 & RF3_EVIL))
+ if ((mode == HISSATSU_ZANMA) && !monster_living(r_ptr) && (r_ptr->flags3 & RF3_EVIL))
{
if (mult < 15) mult = 25;
else if (mult < 50) mult = MIN(50, mult+20);
{
if (r_ptr->flags3 & RF3_UNDEAD)
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags3 |= RF3_UNDEAD;
}
if (mult == 10) mult = 40;
else if (mult < 60) mult = MIN(60, mult+30);
}
- if ((mode == HISSATSU_SEKIRYUKA) && p_ptr->cut && !(r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)))
+ if ((mode == HISSATSU_SEKIRYUKA) && p_ptr->cut && monster_living(r_ptr))
{
int tmp = MIN(100, MAX(10, p_ptr->cut / 10));
if (mult < tmp) mult = tmp;
}
if ((mode == HISSATSU_HAGAN) && (r_ptr->flags3 & RF3_HURT_ROCK))
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags3 |= RF3_HURT_ROCK;
}
if (mult == 10) mult = 40;
else if (mult < 60) mult = 60;
}
- if ((p_ptr->pclass != CLASS_SAMURAI) && (f1 & TR1_FORCE_WEAPON) && (p_ptr->csp > (o_ptr->dd * o_ptr->ds / 5)))
+ if ((p_ptr->pclass != CLASS_SAMURAI) && (have_flag(flgs, TR_FORCE_WEAPON)) && (p_ptr->csp > (o_ptr->dd * o_ptr->ds / 5)))
{
p_ptr->csp -= (1+(o_ptr->dd * o_ptr->ds / 5));
p_ptr->redraw |= (PR_MANA);
- mult = MIN(60, mult * 7 / 2);
+ mult = mult * 3 / 2 + 20;
}
break;
}
c_ptr = &cave[y][x];
/* Invisible trap */
- if (c_ptr->info & CAVE_TRAP)
+ if (c_ptr->mimic && is_trap(c_ptr->feat))
{
/* Pick a trap */
- pick_trap(y, x);
+ disclose_grid(y, x);
/* Message */
#ifdef JP
msg_print("You have found a trap.");
#endif
-
/* Disturb */
disturb(0, 0);
}
/* Secret door */
- if (c_ptr->feat == FEAT_SECRET)
+ if (is_hidden_door(c_ptr))
{
/* Message */
#ifdef JP
msg_print("You have found a secret door.");
#endif
-
- /* Pick a door */
- place_closed_door(y, x);
+ /* Disclose */
+ disclose_grid(y, x);
/* Disturb */
disturb(0, 0);
if (!chest_traps[o_ptr->pval]) continue;
/* Identify once */
- if (!object_known_p(o_ptr))
+ if (!object_is_known(o_ptr))
{
/* Message */
#ifdef JP
msg_print("You have discovered a trap on the chest!");
#endif
-
/* Know the trap */
object_known(o_ptr);
char old_name[MAX_NLEN];
char kazu_str[80];
int hirottakazu;
- extern char *object_desc_kosuu(char *t, object_type *o_ptr);
#else
char o_name[MAX_NLEN];
#endif
#ifdef JP
/* Describe the object */
- object_desc(old_name, o_ptr, TRUE, 0);
+ object_desc(old_name, o_ptr, OD_NAME_ONLY);
object_desc_kosuu(kazu_str, o_ptr);
hirottakazu = o_ptr->number;
#endif
/* Delete the object */
delete_object_idx(o_idx);
- if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN) identify_item(o_ptr);
+ if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
+ {
+ bool old_known = identify_item(o_ptr);
+
+ /* Auto-inscription/destroy */
+ autopick_alter_item(slot, (bool)(destroy_identify && !old_known));
+
+ /* If it is destroyed, don't pick it up */
+ if (o_ptr->marked & OM_AUTODESTROY) return;
+ }
/* Describe the object */
- object_desc(o_name, o_ptr, TRUE, 3);
+ object_desc(o_name, o_ptr, 0);
/* Message */
#ifdef JP
}
-bool can_player_destroy_object(object_type *o_ptr)
-{
- /* Artifacts cannot be destroyed */
- if (artifact_p(o_ptr) || o_ptr->art_name)
- {
- byte feel = FEEL_SPECIAL;
-
- /* Hack -- Handle icky artifacts */
- if (cursed_p(o_ptr) || broken_p(o_ptr)) feel = FEEL_TERRIBLE;
-
- /* Hack -- inscribe the artifact */
- o_ptr->feeling = feel;
-
- /* We have "felt" it (again) */
- o_ptr->ident |= (IDENT_SENSE);
-
- /* Combine the pack */
- p_ptr->notice |= (PN_COMBINE);
-
- /* Redraw equippy chars */
- p_ptr->redraw |= (PR_EQUIPPY);
-
- /* Window stuff */
- p_ptr->window |= (PW_INVEN | PW_EQUIP);
-
- /* Done */
- return FALSE;
- }
-
- return TRUE;
-}
-
-/*
- * Easy auto-pick inscription
- */
-static bool is_autopick2( object_type *o_ptr) {
- cptr s;
-
- /* No inscription */
- if (!o_ptr->inscription) return (FALSE);
-
- /* Find a '=' */
- s = strchr(quark_str(o_ptr->inscription), '=');
-
- /* Process inscription */
- while (s)
- {
- /* Auto-pickup on "=g" */
- if (s[1] == 'g') return (TRUE);
-
- /* Find another '=' */
- s = strchr(s + 1, '=');
- }
-
- /* Don't auto pickup */
- return (FALSE);
-}
-
-/*
- * Automatically destroy items in this grid.
- */
-static bool is_opt_confirm_destroy(object_type *o_ptr)
-{
- if (!destroy_items) return FALSE;
-
- /* Known to be worthless? */
- if (leave_worth)
- if (object_value(o_ptr) > 0) return FALSE;
-
- if (leave_equip)
- if ((o_ptr->tval >= TV_SHOT) && (o_ptr->tval <= TV_DRAG_ARMOR)) return FALSE;
-
- if (leave_chest)
- if ((o_ptr->tval == TV_CHEST) && o_ptr->pval) return FALSE;
-
- if (leave_wanted)
- {
- if (o_ptr->tval == TV_CORPSE
- && object_is_shoukinkubi(o_ptr)) return FALSE;
- }
-
- if (leave_corpse)
- if (o_ptr->tval == TV_CORPSE) return FALSE;
-
- if (leave_junk)
- if ((o_ptr->tval == TV_SKELETON) || (o_ptr->tval == TV_BOTTLE) || (o_ptr->tval == TV_JUNK) || (o_ptr->tval == TV_STATUE)) return FALSE;
-
- if (o_ptr->tval == TV_GOLD) return FALSE;
-
- return TRUE;
-}
-
-/*
- * Automatically pickup/destroy items in this grid.
- */
-static void auto_pickup_items(cave_type *c_ptr)
-{
- s16b this_o_idx, next_o_idx = 0;
- s16b inscribe_flags(object_type *o_ptr, cptr out_val);
-
- char o_name[MAX_NLEN];
- int idx;
-
- /* Scan the pile of objects */
- for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
- {
- /* Acquire object */
- object_type *o_ptr = &o_list[this_o_idx];
-
- /* Acquire next object */
- next_o_idx = o_ptr->next_o_idx;
- idx = is_autopick(o_ptr);
-
- if (idx >= 0 && autopick_list[idx].insc && !o_ptr->inscription)
- o_ptr->inscription = inscribe_flags(o_ptr, autopick_list[idx].insc);
-
- if (is_autopick2(o_ptr) ||
- (idx >= 0 && (autopick_list[idx].action & DO_AUTOPICK)))
- {
- disturb(0,0);
-
- if (!inven_carry_okay(o_ptr)){
- /* Describe the object */
- object_desc(o_name, o_ptr, TRUE, 3);
- /* Message */
-#ifdef JP
- msg_format("¥¶¥Ã¥¯¤Ë¤Ï%s¤òÆþ¤ì¤ë·ä´Ö¤¬¤Ê¤¤¡£", o_name);
-#else
- msg_format("You have no room for %s.", o_name);
-#endif
- continue;
- }
- py_pickup_aux(this_o_idx);
-
- continue;
- }
-
- else if ((idx == -1 && is_opt_confirm_destroy(o_ptr)) ||
- (!always_pickup && (idx != -1 && (autopick_list[idx].action & DO_AUTODESTROY))))
- {
- disturb(0,0);
- /* Describe the object (with {terrible/special}) */
- object_desc(o_name, o_ptr, TRUE, 3);
- /* Artifact? */
- if (!can_player_destroy_object(o_ptr))
- {
- /* Message */
-#ifdef JP
- msg_format("%s¤ÏÇ˲õÉÔǽ¤À¡£", o_name);
-#else
- msg_format("You cannot auto-destroy %s.", o_name);
-#endif
-
- /* Done */
- continue;
- }
- autopick_free_entry(&autopick_entry_last_destroyed);
- autopick_entry_from_object(&autopick_entry_last_destroyed, o_ptr);
-
- /* Destroy the item */
- delete_object_idx(this_o_idx);
-
- /* Print a message */
-#ifdef JP
- msg_format("%s¤ò¼«Æ°Ç˲õ¤·¤Þ¤¹¡£", o_name);
-#else
- msg_format("Auto-destroying %s.", o_name);
-#endif
-
- continue;
- }
- }
-}
-
-
/*
* Player "wants" to pick up an object or gold.
* Note that we ONLY handle things that can be picked up.
* 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;
/* Message */
#ifdef JP
msg_format(" $%ld ¤Î²ÁÃͤ¬¤¢¤ë%s¤ò¸«¤Ä¤±¤¿¡£",
- (long)value, o_name);
+ (long)value, o_name);
#else
msg_format("You collect %ld gold pieces worth of %s.",
(long)value, o_name);
/* Pick up objects */
else
{
+ /* Hack - some objects were handled in autopick_pickup_items(). */
+ if (o_ptr->marked & OM_NOMSG)
+ {
+ /* Clear the flag. */
+ o_ptr->marked &= ~OM_NOMSG;
+ }
/* Describe the object */
- if (!pickup)
-
+ else if (!pickup)
{
#ifdef JP
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];
+
+ int trap_feat = c_ptr->feat;
#ifdef JP
- cptr name = "¥È¥é¥Ã¥×";
+ cptr name = "¥È¥é¥Ã¥×";
#else
cptr name = "a trap";
#endif
-
-
/* Disturb the player */
disturb(0, 0);
- /* 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)
{
case FEAT_TRAP_TRAPDOOR:
{
do_cmd_save_game(TRUE);
#ifdef JP
- do_cmd_write_nikki(NIKKI_STAIR, 1, "Í¸Í¤ËÍî¤Á¤¿");
+ do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "Í¸Í¤ËÍî¤Á¤¿");
#else
- do_cmd_write_nikki(NIKKI_STAIR, 1, "You have fallen through a trap door!");
+ do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "You have fallen through a trap door!");
#endif
- dun_level++;
+ 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_cut(p_ptr->cut + randint1(dam));
- if (p_ptr->resist_pois || p_ptr->oppose_pois)
+ if (p_ptr->resist_pois || IS_OPPOSE_POIS())
{
#ifdef JP
msg_print("¤·¤«¤·ÆǤαƶÁ¤Ï¤Ê¤«¤Ã¤¿¡ª");
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++)
{
- (void)summon_specific(0, y, x, dun_level, 0, TRUE, FALSE, FALSE, TRUE, TRUE);
+ (void)summon_specific(0, y, x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
}
if (dun_level > randint1(100)) /* No nasty effect for low levels */
msg_print("You hit a teleport trap!");
#endif
- teleport_player(100);
+ teleport_player(100, TRUE);
break;
}
dam = damroll(4, 6);
#ifdef JP
- fire_dam(dam, "±ê¤Î¥È¥é¥Ã¥×", -1);
+ (void)fire_dam(dam, "±ê¤Î¥È¥é¥Ã¥×", -1);
#else
- fire_dam(dam, "a fire trap", -1);
+ (void)fire_dam(dam, "a fire trap", -1);
#endif
break;
dam = damroll(4, 6);
#ifdef JP
- acid_dam(dam, "»À¤Î¥È¥é¥Ã¥×", -1);
+ (void)acid_dam(dam, "»À¤Î¥È¥é¥Ã¥×", -1);
#else
- acid_dam(dam, "an acid trap", -1);
+ (void)acid_dam(dam, "an acid trap", -1);
#endif
break;
msg_print("A pungent green gas surrounds you!");
#endif
- if (!p_ptr->resist_pois && !p_ptr->oppose_pois)
+ if (!p_ptr->resist_pois && !IS_OPPOSE_POIS())
{
(void)set_poisoned(p_ptr->poisoned + randint0(20) + 10);
}
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_OPEN:
+ {
+#ifdef JP
+ msg_print("Âç²»¶Á¤È¶¦¤Ë¤Þ¤ï¤ê¤ÎÊɤ¬Êø¤ì¤¿¡ª");
+#else
+ msg_print("Suddenly, surrounding walls are opened!");
+#endif
+ (void)project(0, 3, y, x, 0, GF_DISINTEGRATE, PROJECT_GRID | PROJECT_HIDE, -1);
+ (void)project(0, 3, y, x - 4, 0, GF_DISINTEGRATE, PROJECT_GRID | PROJECT_HIDE, -1);
+ (void)project(0, 3, y, x + 4, 0, GF_DISINTEGRATE, PROJECT_GRID | PROJECT_HIDE, -1);
+ aggravate_monsters(0);
+
+ break;
+ }
+
+ case FEAT_TRAP_ARMAGEDDON:
+ {
+ static int levs[10] = {0, 0, 20, 10, 5, 3, 2, 1, 1, 1};
+ int evil_idx = 0, good_idx = 0;
+
+ int lev;
+#ifdef JP
+ msg_print("ÆÍÁ³Å·³¦¤ÎÀïÁè¤Ë´¬¤¹þ¤Þ¤ì¤¿¡ª");
+#else
+ msg_print("Suddenly, you are surrounded by immotal beings!");
+#endif
+
+ /* Summon Demons and Angels */
+ for (lev = dun_level; lev >= 20; lev -= 1 + lev/16)
+ {
+ num = levs[MIN(lev/10, 9)];
+ for (i = 0; i < num; i++)
+ {
+ int x1 = rand_spread(x, 7);
+ int y1 = rand_spread(y, 5);
+
+ /* Skip illegal grids */
+ if (!in_bounds(y1, x1)) continue;
+
+ /* Require line of 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;
+
+ if (summon_specific(0, y1, x1, lev, SUMMON_ARMAGE_GOOD, (PM_NO_PET)))
+ {
+ good_idx = hack_m_idx_ii;
+ }
+
+ /* Let them fight each other */
+ if (evil_idx && good_idx)
+ {
+ monster_type *evil_ptr = &m_list[evil_idx];
+ monster_type *good_ptr = &m_list[good_idx];
+ evil_ptr->target_y = good_ptr->fy;
+ evil_ptr->target_x = good_ptr->fx;
+ good_ptr->target_y = evil_ptr->fy;
+ good_ptr->target_x = evil_ptr->fx;
+ }
+ }
+ }
+ break;
+ }
+
+ case FEAT_TRAP_PIRANHA:
+ {
+#ifdef JP
+ msg_print("ÆÍÁ³Êɤ«¤é¿å¤¬°î¤ì½Ð¤·¤¿¡ª¥Ô¥é¥Ë¥¢¤¬¤¤¤ë¡ª");
+#else
+ msg_print("Suddenly, the room is filled with water with piranhas!");
+#endif
+
+ /* Water fills room */
+ fire_ball_hide(GF_WATER_FLOW, 0, 1, 10);
+
+ /* Summon Piranhas */
+ num = 1 + dun_level/20;
+ for (i = 0; i < num; i++)
+ {
+ (void)summon_specific(0, y, x, dun_level, SUMMON_PIRANHAS, (PM_ALLOW_GROUP | PM_NO_PET));
+ }
+ break;
+ }
}
+
if (break_trap && is_trap(c_ptr->feat))
{
- cave_set_feat(y, x, floor_type[randint0(100)]);
+ cave_alter_feat(y, x, FF_DISARM);
#ifdef JP
msg_print("¥È¥é¥Ã¥×¤òÊ´ºÕ¤·¤¿¡£");
#else
}
-void touch_zap_player(monster_type *m_ptr)
+static void touch_zap_player(monster_type *m_ptr)
{
int aura_damage = 0;
monster_race *r_ptr = &r_info[m_ptr->r_idx];
aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
/* Hack -- Get the "died from" name */
- monster_desc(aura_dam, m_ptr, 0x288);
+ monster_desc(aura_dam, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
#ifdef JP
msg_print("ÆÍÁ³¤È¤Æ¤âÇ®¤¯¤Ê¤Ã¤¿¡ª");
#endif
- if (p_ptr->oppose_fire) aura_damage = (aura_damage + 2) / 3;
+ if (prace_is_(RACE_ENT)) aura_damage += aura_damage / 3;
+ if (IS_OPPOSE_FIRE()) aura_damage = (aura_damage + 2) / 3;
if (p_ptr->resist_fire) aura_damage = (aura_damage + 2) / 3;
take_hit(DAMAGE_NOESCAPE, aura_damage, aura_dam, -1);
- r_ptr->r_flags2 |= RF2_AURA_FIRE;
+ if (m_ptr->ml && is_original_ap(m_ptr)) r_ptr->r_flags2 |= RF2_AURA_FIRE;
handle_stuff();
}
}
aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
/* Hack -- Get the "died from" name */
- monster_desc(aura_dam, m_ptr, 0x288);
+ monster_desc(aura_dam, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
#ifdef JP
msg_print("ÆÍÁ³¤È¤Æ¤â´¨¤¯¤Ê¤Ã¤¿¡ª");
#endif
- if (p_ptr->oppose_cold) aura_damage = (aura_damage + 2) / 3;
+ if (IS_OPPOSE_COLD()) aura_damage = (aura_damage + 2) / 3;
if (p_ptr->resist_cold) aura_damage = (aura_damage + 2) / 3;
take_hit(DAMAGE_NOESCAPE, aura_damage, aura_dam, -1);
- r_ptr->r_flags3 |= RF3_AURA_COLD;
+ if (m_ptr->ml && is_original_ap(m_ptr)) r_ptr->r_flags3 |= RF3_AURA_COLD;
handle_stuff();
}
}
aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
/* Hack -- Get the "died from" name */
- monster_desc(aura_dam, m_ptr, 0x288);
+ monster_desc(aura_dam, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
- if (p_ptr->oppose_elec) aura_damage = (aura_damage + 2) / 3;
+ if (prace_is_(RACE_ANDROID)) aura_damage += aura_damage / 3;
+ if (IS_OPPOSE_ELEC()) aura_damage = (aura_damage + 2) / 3;
if (p_ptr->resist_elec) aura_damage = (aura_damage + 2) / 3;
#ifdef JP
#endif
take_hit(DAMAGE_NOESCAPE, aura_damage, aura_dam, -1);
- r_ptr->r_flags2 |= RF2_AURA_ELEC;
+ if (m_ptr->ml && is_original_ap(m_ptr)) r_ptr->r_flags2 |= RF2_AURA_ELEC;
handle_stuff();
}
}
int dss, ddd;
- char *atk_desc;
+ cptr atk_desc;
switch (attack)
{
k = mon_damage_mod(m_ptr, k, FALSE);
/* Complex message */
- if (wizard)
+ if (p_ptr->wizard)
{
#ifdef JP
msg_format("%d/%d ¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£", k, m_ptr->hp);
switch (attack)
{
case MUT2_SCOR_TAIL:
- project(0, 0, m_ptr->fy, m_ptr->fx, k, GF_POIS, PROJECT_KILL | PROJECT_NO_REF, -1);
+ project(0, 0, m_ptr->fy, m_ptr->fx, k, GF_POIS, PROJECT_KILL, -1);
*mdeath = (m_ptr->r_idx == 0);
break;
case MUT2_HORNS:
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 can_drain = FALSE;
int num_blow;
int drain_left = MAX_VAMPIRIC_DRAIN;
- u32b f1, f2, f3; /* A massive hack -- life-draining weapons */
+ u32b flgs[TR_FLAG_SIZE]; /* A massive hack -- life-draining weapons */
bool is_human = (r_ptr->d_char == 'p');
bool is_lowlevel = (r_ptr->level < (p_ptr->lev - 15));
bool zantetsu_mukou, e_j_mukou;
-
-
- if (((p_ptr->pclass == CLASS_ROGUE) || (p_ptr->pclass == CLASS_NINJA)) && inventory[INVEN_RARM+hand].tval)
+ 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->flags3 & RF3_RES_ALL))
+ case CLASS_ROGUE:
+ case CLASS_NINJA:
+ if (buki_motteruka(INVEN_RARM + hand) && !p_ptr->icky_wield[hand])
{
- fuiuchi = TRUE;
- }
- else if (m_ptr->monfear && m_ptr->ml)
- {
- 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 (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)
+ {
+ stab_fleeing = TRUE;
+ }
}
+ break;
+
+ case CLASS_MONK:
+ case CLASS_FORCETRAINER:
+ case CLASS_BERSERKER:
+ if (empty_hands(TRUE) & EMPTY_HAND_RARM) monk_attack = TRUE;
+ break;
}
- if(!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM))
+ if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM))
{
if ((r_ptr->level + 10) > p_ptr->lev)
{
- if (skill_exp[GINOU_SUDE] < s_info[p_ptr->pclass].s_max[GINOU_SUDE])
- {
- if (skill_exp[GINOU_SUDE] < 4000)
- skill_exp[GINOU_SUDE]+=40;
- else if((skill_exp[GINOU_SUDE] < 6000))
- skill_exp[GINOU_SUDE]+=5;
- else if((skill_exp[GINOU_SUDE] < 7000) && (p_ptr->lev > 19))
- skill_exp[GINOU_SUDE]+=1;
- else if((skill_exp[GINOU_SUDE] < 8000) && (p_ptr->lev > 34))
- if (one_in_(3)) skill_exp[GINOU_SUDE]+=1;
+ if (p_ptr->skill_exp[GINOU_SUDE] < s_info[p_ptr->pclass].s_max[GINOU_SUDE])
+ {
+ if (p_ptr->skill_exp[GINOU_SUDE] < WEAPON_EXP_BEGINNER)
+ p_ptr->skill_exp[GINOU_SUDE] += 40;
+ else if ((p_ptr->skill_exp[GINOU_SUDE] < WEAPON_EXP_SKILLED))
+ p_ptr->skill_exp[GINOU_SUDE] += 5;
+ else if ((p_ptr->skill_exp[GINOU_SUDE] < WEAPON_EXP_EXPERT) && (p_ptr->lev > 19))
+ p_ptr->skill_exp[GINOU_SUDE] += 1;
+ else if ((p_ptr->lev > 34))
+ if (one_in_(3)) p_ptr->skill_exp[GINOU_SUDE] += 1;
p_ptr->update |= (PU_BONUS);
}
}
{
if ((r_ptr->level + 10) > p_ptr->lev)
{
- 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 = weapon_exp[tval][sval];
+ int now_exp = p_ptr->weapon_exp[tval][sval];
if (now_exp < s_info[p_ptr->pclass].w_max[tval][sval])
{
int amount = 0;
- if (now_exp < 4000) amount = 80;
- else if(now_exp < 6000) amount = 10;
- else if((now_exp < 7000) && (p_ptr->lev > 19)) amount = 1;
- else if((p_ptr->lev > 34) && one_in_(2)) amount = 1;
- weapon_exp[tval][sval] += amount;
+ if (now_exp < WEAPON_EXP_BEGINNER) amount = 80;
+ else if (now_exp < WEAPON_EXP_SKILLED) amount = 10;
+ else if ((now_exp < WEAPON_EXP_EXPERT) && (p_ptr->lev > 19)) amount = 1;
+ else if ((p_ptr->lev > 34) && one_in_(2)) amount = 1;
+ p_ptr->weapon_exp[tval][sval] += amount;
p_ptr->update |= (PU_BONUS);
}
}
/* Disturb the monster */
m_ptr->csleep = 0;
- if (r_ptr->flags7 & (RF7_HAS_LITE_1 | RF7_HAS_LITE_2))
- p_ptr->update |= (PU_MON_LITE);
+ if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
/* Extract monster name (or "it") */
monster_desc(m_name, m_ptr, 0);
else num_blow = p_ptr->num_blow[hand];
/* Attack once for each legal blow */
- while ((num++ < num_blow) && !death)
+ while ((num++ < num_blow) && !p_ptr->is_dead)
{
if (((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) || (mode == HISSATSU_KYUSHO))
{
}
else success_hit = old_success_hit;
}
- else if ((p_ptr->pclass == CLASS_NINJA) && ((backstab || fuiuchi) && !(r_ptr->flags3 & RF3_RES_ALL))) success_hit = TRUE;
+ else if ((p_ptr->pclass == CLASS_NINJA) && ((backstab || fuiuchi) && !(r_ptr->flagsr & RFR_RES_ALL))) success_hit = TRUE;
else success_hit = test_hit_norm(chance, r_ptr->ac, m_ptr->ml);
/* Test for hit */
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) > 1)))
#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;
- object_flags(o_ptr, &f1, &f2, &f3);
+ object_flags(o_ptr, flgs);
/* Select a chaotic effect (50% chance) */
- if ((f1 & TR1_CHAOTIC) && one_in_(2))
+ if ((have_flag(flgs, TR_CHAOTIC)) && one_in_(2))
{
if (one_in_(10))
chg_virtue(V_CHANCE, 1);
}
/* Vampiric drain */
- if ((f1 & TR1_VAMPIRIC) || (chaos_effect == 1) || (mode == HISSATSU_DRAIN))
+ if ((have_flag(flgs, TR_VAMPIRIC)) || (chaos_effect == 1) || (mode == HISSATSU_DRAIN))
{
/* Only drain "living" monsters */
if (monster_living(r_ptr))
can_drain = FALSE;
}
- if ((f1 & TR1_VORPAL) && (randint1(vorpal_chance*3/2) == 1) && !zantetsu_mukou)
+ if ((have_flag(flgs, TR_VORPAL)) && (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) > 1))
+ if (monk_attack)
{
int special_effect = 0, stun_effect = 0, times = 0, max_times;
int min_level = 1;
{
old_ptr = ma_ptr;
- if (wizard && cheat_xtra)
+ if (p_ptr->wizard && cheat_xtra)
{
#ifdef JP
msg_print("¹¶·â¤òºÆÁªÂò¤·¤Þ¤·¤¿¡£");
#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)
-#ifdef JP
- msg_format("%^s¤Ï¤µ¤é¤Ë¥Õ¥é¥Õ¥é¤Ë¤Ê¤Ã¤¿¡£", m_name);
-#else
- msg_format("%^s is more stunned.", m_name);
-#endif
-
- else
#ifdef JP
- msg_format("%^s¤Ï¥Õ¥é¥Õ¥é¤Ë¤Ê¤Ã¤¿¡£", m_name);
+ if (m_ptr->stunned) msg_format("%^s¤Ï¤µ¤é¤Ë¥Õ¥é¥Õ¥é¤Ë¤Ê¤Ã¤¿¡£", m_name);
+ else msg_format("%^s¤Ï¥Õ¥é¥Õ¥é¤Ë¤Ê¤Ã¤¿¡£", m_name);
#else
- msg_format("%^s is stunned.", m_name);
+ if (m_ptr->stunned) msg_format("%^s is more stunned.", m_name);
+ else msg_format("%^s is stunned.", m_name);
#endif
-
m_ptr->stunned += stun_effect;
}
}
/* Handle normal weapon */
else if (o_ptr->k_idx)
{
- k = damroll(o_ptr->dd, o_ptr->ds);
- if (p_ptr->riding)
- {
- if((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
- {
- k += damroll(2, o_ptr->ds);
- }
- }
-
- k = tot_dam_aux(o_ptr, k, m_ptr, mode);
+ k = damroll(o_ptr->dd + p_ptr->to_dd[hand], o_ptr->ds + p_ptr->to_ds[hand]);
+ k = tot_dam_aux(o_ptr, k, m_ptr, mode, FALSE);
if (backstab)
{
{
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);
}
if (o_ptr->name1 == ART_VORPAL_BLADE)
{
#ifdef JP
- msg_print("Ìܤˤâ»ß¤Þ¤é¤Ì¥Ü¡¼¥Ñ¥ë¡¦¥Ö¥ì¡¼¥É¡¢¼êÏ£¤ÎÁá¶È¡ª");
+ msg_print("Ìܤˤâ»ß¤Þ¤é¤Ì¥ô¥©¡¼¥Ñ¥ë¥Ö¥ì¡¼¥É¡¢¼êÏ£¤ÎÁá¶È¡ª");
#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 */
k *= mult;
/* Ouch! */
- if (((r_ptr->flags3 & RF3_RES_ALL) ? k/100 : k) > m_ptr->hp)
+ if (((r_ptr->flagsr & RFR_RES_ALL) ? k/100 : k) > m_ptr->hp)
{
#ifdef JP
msg_format("%s¤ò¿¿¤ÃÆó¤Ä¤Ë¤·¤¿¡ª", m_name);
#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;
drain_result += p_ptr->to_d[hand];
if ((mode == HISSATSU_SUTEMI) || (mode == HISSATSU_3DAN)) k *= 2;
- if ((mode == HISSATSU_SEKIRYUKA) && (r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON | RF3_NONLIVING))) k = 0;
+ if ((mode == HISSATSU_SEKIRYUKA) && !monster_living(r_ptr)) k = 0;
if ((mode == HISSATSU_SEKIRYUKA) && !p_ptr->cut) k /= 2;
/* No negative damage */
if (k < 0) k = 0;
- if ((mode == HISSATSU_ZANMA) && !((r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)) && (r_ptr->flags3 & RF3_EVIL)))
+ if ((mode == HISSATSU_ZANMA) && !(!monster_living(r_ptr) && (r_ptr->flags3 & RF3_EVIL)))
{
k = 0;
}
if (m_ptr->stunned)
{
#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
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
}
else k = 1;
}
- else if ((p_ptr->pclass == CLASS_NINJA) && (!p_ptr->icky_wield[hand]) && ((p_ptr->cur_lite <= 0) || one_in_(7)))
+ else if ((p_ptr->pclass == CLASS_NINJA) && buki_motteruka(INVEN_RARM + hand) && !p_ptr->icky_wield[hand] && ((p_ptr->cur_lite <= 0) || one_in_(7)))
{
int maxhp = maxroll(r_ptr->hdice, r_ptr->hside);
if (one_in_(backstab ? 13 : (stab_fleeing || fuiuchi) ? 15 : 27))
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
}
}
}
/* Complex message */
- if (wizard || cheat_xtra)
+ if (p_ptr->wizard || cheat_xtra)
{
#ifdef JP
msg_format("%d/%d ¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£", k, m_ptr->hp);
#else
msg_format("You do %d (out of %d) damage.", k, m_ptr->hp);
#endif
-
}
if (k <= 0) can_drain = FALSE;
if (drain_result > m_ptr->hp)
- drain_result = m_ptr->hp;
+ drain_result = m_ptr->hp;
/* Damage, check for fear and death */
if (mon_take_hit(c_ptr->m_idx, k, fear, NULL))
#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;
}
/* Confuse the monster */
if (r_ptr->flags3 & RF3_NO_CONF)
{
- if (m_ptr->ml)
+ if (m_ptr->ml && is_original_ap(m_ptr))
{
r_ptr->r_flags3 |= RF3_NO_CONF;
}
{
bool resists_tele = FALSE;
- if (r_ptr->flags3 & RF3_RES_TELE)
+ if (r_ptr->flagsr & RFR_RES_TELE)
{
if (r_ptr->flags1 & RF1_UNIQUE)
{
- if (m_ptr->ml) r_ptr->r_flags3 |= RF3_RES_TELE;
+ if (m_ptr->ml && is_original_ap(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
#ifdef JP
- msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
+ msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
#else
msg_format("%^s is unaffected!", m_name);
#endif
}
else if (r_ptr->level > randint1(100))
{
- if (m_ptr->ml) r_ptr->r_flags3 |= RF3_RES_TELE;
+ if (m_ptr->ml && is_original_ap(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
#ifdef JP
msg_format("%^s¤ÏÄñ¹³ÎϤò»ý¤Ã¤Æ¤¤¤ë¡ª", m_name);
#else
#endif
teleport_away(c_ptr->m_idx, 50, FALSE);
- num = p_ptr->num_blow[hand] + 1; /* Can't hit it anymore! */
+ num = num_blow + 1; /* Can't hit it anymore! */
*mdeath = TRUE;
}
}
- else if ((chaos_effect == 5) && cave_floor_bold(y, x) &&
- (randint1(90) > r_ptr->level))
+ else if ((chaos_effect == 5) && (randint1(90) > r_ptr->level))
{
- if (!(r_ptr->flags1 & RF1_UNIQUE) &&
- !(r_ptr->flags4 & RF4_BR_CHAO) &&
- !(r_ptr->flags1 & RF1_QUESTOR))
+ if (!(r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) &&
+ !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
{
if (polymorph_monster(y, x))
{
else
{
#ifdef JP
- msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
+ msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
#else
msg_format("%^s is unaffected.", m_name);
#endif
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 = FALSE;
+ q_ptr->marked = 0;
m_ptr->hold_o_idx = q_ptr->next_o_idx;
q_ptr->next_o_idx = 0;
#ifdef JP
if ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE) && one_in_(3))
{
- u32b f1, f2, f3;
+ u32b flgs[TR_FLAG_SIZE];
/* Sound */
sound(SOUND_HIT);
#endif
/* Extract the flags */
- object_flags(o_ptr, &f1, &f2, &f3);
+ object_flags(o_ptr, flgs);
- k = damroll(o_ptr->dd, o_ptr->ds);
+ 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_YEEK:
case RACE_KLACKON:
- mult = 2;break;
+ case RACE_HUMAN:
+ case RACE_AMBERITE:
+ case RACE_DUNADAN:
+ mult = 25;break;
case RACE_HALF_ORC:
case RACE_HALF_TROLL:
case RACE_HALF_OGRE:
case RACE_HALF_TITAN:
case RACE_CYCLOPS:
case RACE_IMP:
- case RACE_GOLEM:
case RACE_SKELETON:
case RACE_ZOMBIE:
case RACE_VAMPIRE:
case RACE_SPECTRE:
case RACE_DEMON:
- mult = 3;break;
case RACE_DRACONIAN:
- mult = 5;break;
+ mult = 30;break;
default:
- mult = 1;break;
+ mult = 10;break;
}
break;
case MIMIC_DEMON:
case MIMIC_DEMON_LORD:
case MIMIC_VAMPIRE:
- mult = 3;break;
+ mult = 30;break;
default:
- mult = 1;break;
+ mult = 10;break;
}
- if (p_ptr->align < 0 && mult < 2)
- mult = 2;
- if (!(p_ptr->resist_acid || p_ptr->oppose_acid) && (mult < 3))
- mult = mult * 5 / 2;
- if (!(p_ptr->resist_elec || p_ptr->oppose_elec) && (mult < 3))
- mult = mult * 5 / 2;
- if (!(p_ptr->resist_fire || p_ptr->oppose_fire) && (mult < 3))
- mult = mult * 5 / 2;
- if (!(p_ptr->resist_cold || p_ptr->oppose_cold) && (mult < 3))
- mult = mult * 5 / 2;
- if (!(p_ptr->resist_pois || p_ptr->oppose_pois) && (mult < 3))
- mult = mult * 5 / 2;
-
- if ((p_ptr->pclass != CLASS_SAMURAI) && (f1 & TR1_FORCE_WEAPON) && (p_ptr->csp > (p_ptr->msp / 30)))
+ if (p_ptr->align < 0 && mult < 20)
+ mult = 20;
+ if (!(p_ptr->resist_acid || IS_OPPOSE_ACID() || p_ptr->immune_acid) && (mult < 25))
+ mult = 25;
+ if (!(p_ptr->resist_elec || IS_OPPOSE_ELEC() || p_ptr->immune_elec) && (mult < 25))
+ mult = 25;
+ if (!(p_ptr->resist_fire || IS_OPPOSE_FIRE() || p_ptr->immune_fire) && (mult < 25))
+ mult = 25;
+ if (!(p_ptr->resist_cold || IS_OPPOSE_COLD() || p_ptr->immune_cold) && (mult < 25))
+ mult = 25;
+ if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()) && (mult < 25))
+ mult = 25;
+
+ if ((p_ptr->pclass != CLASS_SAMURAI) && (have_flag(flgs, TR_FORCE_WEAPON)) && (p_ptr->csp > (p_ptr->msp / 30)))
{
p_ptr->csp -= (1+(p_ptr->msp / 30));
p_ptr->redraw |= (PR_MANA);
- mult = mult * 7 / 2;
+ mult = mult * 3 / 2 + 20;
}
k *= mult;
+ k /= 10;
}
k = critical_norm(o_ptr->weight, o_ptr->to_h, k, p_ptr->to_h[hand], mode);
}
k += (p_ptr->to_d[hand] + o_ptr->to_d);
+ if (k < 0) k = 0;
+
#ifdef JP
take_hit(DAMAGE_FORCE, k, "»à¤ÎÂç³ù", -1);
#else
cave_type *c_ptr = &cave[y][x];
monster_type *m_ptr = &m_list[c_ptr->m_idx];
+ monster_race *r_ptr = &r_info[m_ptr->r_idx];
char m_name[80];
/* Disturb the player */
if (m_ptr->csleep) /* It is not honorable etc to attack helpless victims */
{
- if (!(r_info[m_ptr->r_idx].flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
- if (!(r_info[m_ptr->r_idx].flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
+ 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);
}
/* Extract monster name (or "it") */
/* Track a new monster */
if (m_ptr->ml) health_track(c_ptr->m_idx);
- if ((r_info[m_ptr->r_idx].flags1 & RF1_FEMALE) &&
+ if ((r_ptr->flags1 & RF1_FEMALE) &&
!(p_ptr->stun || p_ptr->confused || p_ptr->image || !m_ptr->ml))
{
if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
!(p_ptr->stun || p_ptr->confused || p_ptr->image ||
p_ptr->shero || !m_ptr->ml))
{
- if (inventory[INVEN_RARM].art_name)
- {
- if (inventory[INVEN_RARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
- }
- if (inventory[INVEN_LARM].art_name)
- {
- if (inventory[INVEN_LARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
- }
+ if (inventory[INVEN_RARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
+ if (inventory[INVEN_LARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
if (stormbringer)
{
#ifdef JP
#else
msg_format("You stop to avoid hitting %s.", m_name);
#endif
- return FALSE;
+ return FALSE;
}
}
}
/* Disturb the monster */
m_ptr->csleep = 0;
- p_ptr->update |= (PU_MON_LITE);
+ if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
/* Done */
return FALSE;
if (p_ptr->migite && p_ptr->hidarite)
{
- if ((skill_exp[GINOU_NITOURYU] < s_info[p_ptr->pclass].s_max[GINOU_NITOURYU]) && ((skill_exp[GINOU_NITOURYU] - 1000) / 200 < r_info[m_ptr->r_idx].level))
+ if ((p_ptr->skill_exp[GINOU_NITOURYU] < s_info[p_ptr->pclass].s_max[GINOU_NITOURYU]) && ((p_ptr->skill_exp[GINOU_NITOURYU] - 1000) / 200 < r_ptr->level))
{
- if (skill_exp[GINOU_NITOURYU] < 4000)
- skill_exp[GINOU_NITOURYU]+=80;
- else if(skill_exp[GINOU_NITOURYU] < 6000)
- skill_exp[GINOU_NITOURYU]+=4;
- else if(skill_exp[GINOU_NITOURYU] < 7000)
- skill_exp[GINOU_NITOURYU]+=1;
- else if(skill_exp[GINOU_NITOURYU] < 8000)
- if (one_in_(3)) skill_exp[GINOU_NITOURYU]+=1;
+ if (p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_BEGINNER)
+ p_ptr->skill_exp[GINOU_NITOURYU] += 80;
+ else if(p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_SKILLED)
+ p_ptr->skill_exp[GINOU_NITOURYU] += 4;
+ else if(p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_EXPERT)
+ p_ptr->skill_exp[GINOU_NITOURYU] += 1;
+ else if(p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_MASTER)
+ if (one_in_(3)) p_ptr->skill_exp[GINOU_NITOURYU] += 1;
p_ptr->update |= (PU_BONUS);
}
}
+ /* Gain riding experience */
if (p_ptr->riding)
{
- int ridinglevel = r_info[m_list[p_ptr->riding].r_idx].level;
- if ((skill_exp[GINOU_RIDING] < s_info[p_ptr->pclass].s_max[GINOU_RIDING]) && ((skill_exp[GINOU_RIDING] - 1000) / 200 < r_info[m_ptr->r_idx].level) && (skill_exp[GINOU_RIDING]/100 - 2000 < ridinglevel))
- skill_exp[GINOU_RIDING]++;
- if ((skill_exp[GINOU_RIDING] < s_info[p_ptr->pclass].s_max[GINOU_RIDING]) && (skill_exp[GINOU_RIDING]/100 < ridinglevel))
+ int cur = p_ptr->skill_exp[GINOU_RIDING];
+ int max = s_info[p_ptr->pclass].s_max[GINOU_RIDING];
+
+ if (cur < max)
{
- if (ridinglevel*100 > (skill_exp[GINOU_RIDING] + 1500))
- skill_exp[GINOU_RIDING] += (1+(ridinglevel - skill_exp[GINOU_RIDING]/100 - 15));
- else skill_exp[GINOU_RIDING]++;
+ int ridinglevel = r_info[m_list[p_ptr->riding].r_idx].level;
+ int targetlevel = r_ptr->level;
+ int inc = 0;
+
+ if ((cur / 200 - 5) < targetlevel)
+ inc += 1;
+
+ /* Extra experience */
+ if ((cur / 100) < ridinglevel)
+ {
+ if ((cur / 100 + 15) < ridinglevel)
+ inc += 1 + (ridinglevel - (cur / 100 + 15));
+ else
+ inc += 1;
+ }
+
+ p_ptr->skill_exp[GINOU_RIDING] = MIN(max, cur + inc);
+
+ p_ptr->update |= (PU_BONUS);
}
- p_ptr->update |= (PU_BONUS);
}
riding_t_m_idx = c_ptr->m_idx;
}
-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 (cave[n_y][n_x].feat == FEAT_PATTERN_START)
+ if (!is_pattern_tile_cur && !is_pattern_tile_new) return TRUE;
+
+ pattern_type_cur = is_pattern_tile_cur ? cur_f_ptr->power : NOT_PATTERN_TILE;
+ pattern_type_new = is_pattern_tile_new ? new_f_ptr->power : 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 (wizard)
+ if (p_ptr->wizard)
#ifdef JP
- msg_format("¤ª¤«¤·¤Ê¥Ñ¥¿¡¼¥óÊâ¹Ô¡¢%d¡£", cave[c_y][c_x]);
+ msg_format("¤ª¤«¤·¤Ê¥Ñ¥¿¡¼¥óÊâ¹Ô¡¢%d¡£", pattern_type_cur);
#else
- msg_format("Funny Pattern walking, %d.", cave[c_y][c_x]);
+ 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->ffall) 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 oy, int ox, int ny, int nx, u32b mpe_mode)
{
- bool pass_wall;
+ cave_type *c_ptr = &cave[ny][nx];
+ feature_type *f_ptr = &f_info[c_ptr->feat];
- /* Player can not walk through "walls" unless in Shadow Form */
- if (p_ptr->wraith_form || p_ptr->pass_wall || p_ptr->kabenuke)
- pass_wall = TRUE;
- else
- pass_wall = FALSE;
+ if (!(mpe_mode & MPE_STAYING))
+ {
+ 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);
+
+ if (mpe_mode & MPE_FORGET_FLOW) forget_flow();
+
+ /* Check for new panel (redraw map) */
+ verify_panel();
+
+ /* 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);
+
+ /* 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))
+ {
+#ifdef JP
+ msg_print("¤³¤³¤Ç¤ÏÁÇÁ᤯ư¤±¤Ê¤¤¡£");
+#else
+ msg_print("You cannot run in wall.");
+#endif
+ set_action(ACTION_NONE);
+ }
+ }
- switch (feature)
+ if (mpe_mode & MPE_ENERGY_USE)
{
- case FEAT_DEEP_WATER:
- case FEAT_SHAL_LAVA:
- case FEAT_DEEP_LAVA:
- return (TRUE);
+ 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;
+ }
- case FEAT_DARK_PIT:
+ /* Spontaneous Searching */
+ if ((p_ptr->skill_fos >= 50) || (0 == randint0(50 - p_ptr->skill_fos)))
{
- if (p_ptr->ffall)
- return (TRUE);
- else
- return (FALSE);
+ search();
}
- case FEAT_TREES:
+ /* Continuous Searching */
+ if (p_ptr->action == ACTION_SEARCH)
{
- return (TRUE);
+ search();
}
+ }
+
+ /* Handle "objects" */
+ if (!(mpe_mode & MPE_DONT_PICKUP))
+ {
+ carry((mpe_mode & MPE_DO_PICKUP) ? TRUE : FALSE);
+ }
+
+ /* Handle "store doors" */
+ if (have_flag(f_ptr->flags, FF_STORE))
+ {
+ /* Disturb */
+ disturb(0, 0);
+
+ energy_use = 0;
+ /* Hack -- Enter store */
+ command_new = SPECIAL_KEY_STORE;
+ }
+
+ /* Handle "building doors" -KMW- */
+ else if (have_flag(f_ptr->flags, FF_BLDG))
+ {
+ /* Disturb */
+ disturb(0, 0);
+
+ 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, 0);
- 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:
+ 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)
{
- return (pass_wall);
+ 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);
}
- case FEAT_MOUNTAIN:
+ 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, 0);
+
+ /* Hidden trap */
+ if (c_ptr->mimic || have_flag(f_ptr->flags, FF_SECRET))
{
- return (!dun_level && p_ptr->ffall);
+ /* Message */
+#ifdef JP
+ msg_print("¥È¥é¥Ã¥×¤À¡ª");
+#else
+ msg_print("You found a trap!");
+#endif
+
+ /* Pick a trap */
+ disclose_grid(py, px);
}
- case FEAT_PERM_EXTRA:
- case FEAT_PERM_INNER:
- case FEAT_PERM_OUTER:
- case FEAT_PERM_SOLID:
+
+ /* 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))
{
- return (FALSE);
+ if (alert_trap_detect)
+ {
+#ifdef JP
+ msg_print("* Ãí°Õ:¤³¤ÎÀè¤Ï¥È¥é¥Ã¥×¤Î´¶ÃÎÈϰϳ°¤Ç¤¹¡ª *");
+#else
+ msg_print("*Leaving trap detect region!*");
+#endif
+ }
+
+ if (disturb_trap_detect) disturb(0, 0);
}
}
- return (TRUE);
+ return player_bold(ny, nx) && !p_ptr->is_dead && !p_ptr->leaving;
+}
+
+
+bool trap_can_be_ignored(int feat)
+{
+ switch (feat)
+ {
+ case FEAT_TRAP_TRAPDOOR:
+ case FEAT_TRAP_PIT:
+ case FEAT_TRAP_SPIKED_PIT:
+ case FEAT_TRAP_POISON_PIT:
+ if (p_ptr->ffall) return TRUE;
+ break;
+ case FEAT_TRAP_TELEPORT:
+ if (p_ptr->anti_tele) return TRUE;
+ break;
+ case FEAT_TRAP_FIRE:
+ if (p_ptr->immune_fire) return TRUE;
+ break;
+ case FEAT_TRAP_ACID:
+ if (p_ptr->immune_acid) return TRUE;
+ break;
+ case FEAT_TRAP_BLIND:
+ if (p_ptr->resist_blind) return TRUE;
+ break;
+ case FEAT_TRAP_CONFUSE:
+ if (p_ptr->resist_conf) return TRUE;
+ break;
+ case FEAT_TRAP_POISON:
+ if (p_ptr->resist_pois) return TRUE;
+ break;
+ case FEAT_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];
+ monster_race *riding_r_ptr = &r_info[p_ptr->riding ? riding_m_ptr->r_idx : 0]; /* Paranoia */
+
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))
p_ptr->wilderness_x--;
p_ptr->oldpy = cur_hgt - 2;
p_ptr->oldpx = cur_wid - 2;
- ambush_flag = FALSE;
+ ambush_flag = FALSE;
}
else if ((y == 0) && (x == MAX_WID - 1))
p_ptr->wilderness_x++;
p_ptr->oldpy = cur_hgt - 2;
p_ptr->oldpx = 1;
- ambush_flag = FALSE;
+ ambush_flag = FALSE;
}
else if ((y == MAX_HGT - 1) && (x == 0))
p_ptr->wilderness_x--;
p_ptr->oldpy = 1;
p_ptr->oldpx = cur_wid - 2;
- ambush_flag = FALSE;
+ ambush_flag = FALSE;
}
else if ((y == MAX_HGT - 1) && (x == MAX_WID - 1))
p_ptr->wilderness_x++;
p_ptr->oldpy = 1;
p_ptr->oldpx = 1;
- ambush_flag = FALSE;
+ ambush_flag = FALSE;
}
else if (y == 0)
p_ptr->wilderness_y--;
p_ptr->oldpy = cur_hgt - 2;
p_ptr->oldpx = x;
- ambush_flag = FALSE;
+ ambush_flag = FALSE;
}
else if (y == MAX_HGT - 1)
p_ptr->wilderness_y++;
p_ptr->oldpy = 1;
p_ptr->oldpx = x;
- ambush_flag = FALSE;
+ ambush_flag = FALSE;
}
else if (x == 0)
p_ptr->wilderness_x--;
p_ptr->oldpx = cur_wid - 2;
p_ptr->oldpy = y;
- ambush_flag = FALSE;
+ ambush_flag = FALSE;
}
else if (x == MAX_WID - 1)
p_ptr->wilderness_x++;
p_ptr->oldpx = 1;
p_ptr->oldpy = y;
- ambush_flag = FALSE;
+ ambush_flag = FALSE;
}
- p_ptr->leftbldg = TRUE;
p_ptr->leaving = TRUE;
energy_use = 100;
return;
}
- oktomove = FALSE;
+ /* "Blocked" message appears later */
+ /* oktomove = FALSE; */
+ p_can_enter = FALSE;
}
/* Get the monster */
m_ptr = &m_list[c_ptr->m_idx];
- if (inventory[INVEN_RARM].art_name)
- {
- if (inventory[INVEN_RARM].name1 == ART_STORMBRINGER)
- stormbringer = TRUE;
- }
- else if (inventory[INVEN_LARM].art_name)
- {
- if (inventory[INVEN_LARM].name1 == ART_STORMBRINGER)
- stormbringer = TRUE;
- }
+ if (inventory[INVEN_RARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
+ if (inventory[INVEN_LARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
/* Player can not walk through "walls"... */
/* unless in Shadow Form */
- 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;
- }
-
- if (p_ptr->riding)
- {
- cave[py][px].m_idx = 0;
- }
+ p_can_kill_walls = p_ptr->kill_wall && have_flag(f_ptr->flags, FF_TUNNEL) &&
+ (!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];
/* Attack -- only if we can see it OR it is not in a wall */
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;
- p_ptr->update |= (PU_MON_LITE);
+ if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
/* 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 */
+ 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_info[m_ptr->r_idx]) &&
- (cave_floor_bold(py, px) || cave[py][px].feat == FEAT_TREES ||
- (r_info[m_ptr->r_idx].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, 0);
+ }
+ else if (riding_m_ptr->monfear)
+ {
+ 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_format("%s¤¬¶²Éݤ·¤Æ¤¤¤ÆÀ©¸æ¤Ç¤¤Ê¤¤¡£", m_name);
+#else
+ msg_format("%^s is too scared to control.", m_name);
+#endif
+ oktomove = FALSE;
+ disturb(0, 0);
+ }
+ else if (p_ptr->riding_ryoute)
+ {
+ oktomove = FALSE;
+ disturb(0, 0);
+ }
+ else if (have_flag(f_ptr->flags, FF_CAN_FLY) && (riding_r_ptr->flags7 & RF7_CAN_FLY))
+ {
+ /* Allow moving */
+ }
+ 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("You can't climb the mountains!");
+ msg_print("Can't swim.");
#endif
-
- running = 0;
energy_use = 0;
oktomove = FALSE;
+ disturb(0, 0);
}
- }
- /*
- * 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_trap(c_ptr->feat))
- {
- bool ignore = FALSE;
- switch (c_ptr->feat)
+ else if (!have_flag(f_ptr->flags, FF_WATER) && (riding_r_ptr->flags7 & RF7_AQUATIC))
{
- 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;
+#ifdef JP
+ msg_format("%s¤«¤é¾å¤¬¤ì¤Ê¤¤¡£", f_name + f_info[get_feat_mimic(&cave[py][px])].name);
+#else
+ msg_print("Can't land.");
+#endif
+ energy_use = 0;
+ oktomove = FALSE;
+ disturb(0, 0);
}
-
- if (!ignore)
+ else if (have_flag(f_ptr->flags, FF_LAVA) && !(riding_r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK))
{
- (void)do_cmd_disarm_aux(y, x, dir);
- return;
- }
- }
-
-#endif /* ALLOW_EASY_DISARM -- TNB */
- else if (p_ptr->riding && (r_info[m_list[p_ptr->riding].r_idx].flags1 & RF1_NEVER_MOVE))
- {
#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("Too hot to go through.");
#endif
- energy_use = 0;
- oktomove = FALSE;
- disturb(0, 0);
- }
-
- else if (p_ptr->riding && m_list[p_ptr->riding].monfear)
- {
- char m_name[80];
-
- /* Acquire the monster name */
- monster_desc(m_name, &m_list[p_ptr->riding], 0);
+ energy_use = 0;
+ oktomove = FALSE;
+ disturb(0, 0);
+ }
- /* Dump a message */
+ if (oktomove && riding_m_ptr->stunned && one_in_(2))
+ {
+ char m_name[80];
+ monster_desc(m_name, riding_m_ptr, 0);
#ifdef JP
-msg_format("%s¤¬¶²Éݤ·¤Æ¤¤¤ÆÀ©¸æ¤Ç¤¤Ê¤¤¡£", m_name);
+ msg_format("%s¤¬Û¯Û°¤È¤·¤Æ¤¤¤Æ¤¦¤Þ¤¯Æ°¤±¤Ê¤¤¡ª",m_name);
#else
- msg_format("%^s is too scared to control.", m_name);
+ msg_format("You cannot control stunned %s!",m_name);
#endif
- oktomove = FALSE;
- disturb(0, 0);
+ oktomove = FALSE;
+ disturb(0, 0);
+ }
}
- else if (p_ptr->riding && p_ptr->riding_ryoute)
+ if (!oktomove)
{
- oktomove = FALSE;
- disturb(0, 0);
}
- else if ((p_ptr->riding && (r_info[m_list[p_ptr->riding].r_idx].flags7 & RF7_AQUATIC)) && (c_ptr->feat != FEAT_SHAL_WATER) && (c_ptr->feat != FEAT_DEEP_WATER))
+ else if (!have_flag(f_ptr->flags, FF_MOVE) && have_flag(f_ptr->flags, FF_CAN_FLY) && !p_ptr->ffall)
{
#ifdef JP
- msg_print("Φ¾å¤Ë¾å¤¬¤ì¤Ê¤¤¡£");
+ msg_format("¶õ¤òÈô¤Ð¤Ê¤¤¤È%s¤Î¾å¤Ë¤Ï¹Ô¤±¤Ê¤¤¡£", f_name + f_info[get_feat_mimic(c_ptr)].name);
#else
- msg_print("Can't land.");
+ 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;
- oktomove = FALSE;
- disturb(0, 0);
- }
- else if ((p_ptr->riding && !(r_info[m_list[p_ptr->riding].r_idx].flags7 & (RF7_AQUATIC | RF7_CAN_SWIM | RF7_CAN_FLY))) && (c_ptr->feat == FEAT_DEEP_WATER))
- {
-#ifdef JP
- msg_print("¿å¾å¤Ë¹Ô¤±¤Ê¤¤¡£");
-#else
- msg_print("Can't swim.");
-#endif
energy_use = 0;
+ running = 0;
oktomove = FALSE;
- disturb(0, 0);
}
- else if ((p_ptr->riding && (r_info[m_list[p_ptr->riding].r_idx].flags2 & (RF2_AURA_FIRE)) && !(r_info[m_list[p_ptr->riding].r_idx].flags7 & (RF7_CAN_FLY))) && (c_ptr->feat == FEAT_SHAL_WATER))
+ /*
+ * 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)
{
-#ifdef JP
- msg_print("¿å¾å¤Ë¹Ô¤±¤Ê¤¤¡£");
-#else
- msg_print("Can't swim.");
-#endif
- energy_use = 0;
- oktomove = FALSE;
- disturb(0, 0);
+ if ((p_ptr->pclass != CLASS_RANGER) && !p_ptr->ffall) energy_use *= 2;
}
- else if ((p_ptr->riding && !(r_info[m_list[p_ptr->riding].r_idx].flags7 & (RF7_CAN_FLY)) && !(r_info[m_list[p_ptr->riding].r_idx].flags3 & (RF3_IM_FIRE))) && ((c_ptr->feat == FEAT_SHAL_LAVA) || (c_ptr->feat == FEAT_DEEP_LAVA)))
- {
-#ifdef JP
- msg_print("ÍÏ´ä¤Î¾å¤Ë¹Ô¤±¤Ê¤¤¡£");
-#else
- msg_print("Too hot to go through.");
-#endif
- energy_use = 0;
- oktomove = FALSE;
- disturb(0, 0);
- }
+#ifdef ALLOW_EASY_DISARM /* TNB */
- else if (p_ptr->riding && m_list[p_ptr->riding].stunned && one_in_(2))
+ /* Disarm a visible trap */
+ else if ((do_pickup != easy_disarm) && have_flag(f_ptr->flags, FF_DISARM) && !c_ptr->mimic)
{
- char m_name[80];
- monster_desc(m_name, &m_list[p_ptr->riding], 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 (!trap_can_be_ignored(c_ptr->feat))
+ {
+ (void)do_cmd_disarm_aux(y, x, dir);
+ return;
+ }
}
+#endif /* ALLOW_EASY_DISARM -- TNB */
+
/* Player can not walk through "walls" unless in wraith form...*/
- else if ((!cave_floor_bold(y, x)) &&
- (!p_can_pass_walls))
+ else if (!p_can_enter && !p_can_kill_walls)
{
+ /* Feature code (applying "mimic" field) */
+ s16b feat = get_feat_mimic(c_ptr);
+ feature_type *mimic_f_ptr = &f_info[feat];
+ cptr name = f_name + mimic_f_ptr->name;
+
oktomove = FALSE;
/* Disturb the player */
disturb(0, 0);
/* 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 (c_ptr->feat == FEAT_RUBBLE)
+ /* Boundary floor mimic */
+ if (boundary_floor(c_ptr, f_ptr, mimic_f_ptr))
{
#ifdef JP
- msg_print("´äÀФ¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£");
+ msg_print("¤½¤ì°Ê¾åÀè¤Ë¤Ï¿Ê¤á¤Ê¤¤¤è¤¦¤À¡£");
#else
- msg_print("You feel some rubble blocking your way.");
+ msg_print("You feel you cannot go any more.");
#endif
-
- c_ptr->info |= (CAVE_MARK);
- lite_spot(y, x);
- }
-
- /* Closed door */
- else if (c_ptr->feat < FEAT_SECRET)
- {
-#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);
}
/* Wall (or secret door) */
else
{
#ifdef JP
- msg_print("Êɤ¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£");
+ msg_format("%s¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£", name);
#else
- msg_print("You feel a wall blocking your way.");
+ 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 (c_ptr->feat == FEAT_RUBBLE)
+ /* Boundary floor mimic */
+ if (boundary_floor(c_ptr, f_ptr, mimic_f_ptr))
{
#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 (c_ptr->feat < FEAT_SECRET)
- {
-#ifdef ALLOW_EASY_OPEN
-
- if (easy_open && easy_open_door(y, x)) return;
-
-#endif /* ALLOW_EASY_OPEN */
-
-#ifdef JP
- msg_print("¥É¥¢¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¡£");
+ msg_print("¤½¤ì°Ê¾åÀè¤Ë¤Ï¿Ê¤á¤Ê¤¤¡£");
#else
- msg_print("There is a closed door blocking your way.");
+ 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 ALLOW_EASY_OPEN
+ /* Closed doors */
+ if (easy_open && is_closed_door(feat) && easy_open_door(y, x)) return;
+#endif /* ALLOW_EASY_OPEN */
+
#ifdef JP
- msg_print("Êɤ¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¡£");
+ msg_format("%s¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¡£", name);
#else
- msg_print("There is a wall blocking your way.");
+ msg_format("There is %s %s blocking your way.",
+ is_a_vowel(name[0]) ? "an" : "a", name);
#endif
-
+ /*
+ * 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;
}
}
/* Sound */
- sound(SOUND_HITWALL);
+ if (!boundary_floor(c_ptr, f_ptr, mimic_f_ptr)) sound(SOUND_HITWALL);
}
/* Normal movement */
- if (!pattern_seq(py, px, y, x))
+ if (oktomove && !pattern_seq(py, px, y, x))
{
if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
{
/* Normal movement */
if (oktomove)
{
- int oy, ox;
+ u32b mpe_mode = MPE_ENERGY_USE;
if (p_ptr->warning)
{
- if(!process_frakir(x,y))
+ if (!process_warning(x, y))
{
energy_use = 25;
return;
#else
msg_format("You push past %s.", m_name);
#endif
-
- m_ptr->fy = py;
- m_ptr->fx = px;
- cave[py][px].m_idx = c_ptr->m_idx;
- c_ptr->m_idx = 0;
- update_mon(cave[py][px].m_idx, TRUE);
}
/* 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;
+ 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 && (r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_KILL_WALL))
+ if (p_can_kill_walls)
{
- if (cave[py][px].feat > FEAT_SECRET && cave[py][px].feat < FEAT_PERM_SOLID)
- {
- /* Forget the wall */
- cave[py][px].info &= ~(CAVE_MARK);
+ cave_alter_feat(y, x, FF_HURT_DISI);
- /* 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[py][px].feat = floor_type[randint0(100)];
- cave[py][px].info &= ~(CAVE_MASK);
- cave[py][px].info |= CAVE_FLOOR;
- }
- }
- /* Update some things -- similar to GF_KILL_WALL */
+ /* Update some things -- similar to GF_KILL_WALL */
p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
}
- /* 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)
- {
- search();
- }
-
- /* Handle "objects" */
-
#ifdef ALLOW_EASY_DISARM /* TNB */
- carry(do_pickup != always_pickup);
+ if (do_pickup != always_pickup) mpe_mode |= MPE_DO_PICKUP;
#else /* ALLOW_EASY_DISARM -- TNB */
- carry(do_pickup);
+ if (do_pickup) mpe_mode |= MPE_DO_PICKUP;
#endif /* ALLOW_EASY_DISARM -- TNB */
- /* Handle "store doors" */
- if (((c_ptr->feat >= FEAT_SHOP_HEAD) &&
- (c_ptr->feat <= FEAT_SHOP_TAIL)) ||
- (c_ptr->feat == FEAT_MUSEUM))
- {
- /* Disturb */
- disturb(0, 0);
-
- energy_use = 0;
- /* Hack -- Enter store */
- command_new = 253;
- }
-
- /* Handle "building doors" -KMW- */
- else if ((c_ptr->feat >= FEAT_BLDG_HEAD) &&
- (c_ptr->feat <= FEAT_BLDG_TAIL))
- {
- /* Disturb */
- disturb(0, 0);
-
- energy_use = 0;
- /* Hack -- Enter building */
- command_new = 254;
- }
-
- /* Handle quest areas -KMW- */
- else if (cave[y][x].feat == FEAT_QUEST_ENTER)
- {
- /* Disturb */
- disturb(0, 0);
-
- energy_use = 0;
- /* Hack -- Enter quest level */
- command_new = 255;
- }
-
- else if (cave[y][x].feat == FEAT_QUEST_EXIT)
- {
- 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);
- }
-
- leave_quest_check();
-
- p_ptr->inside_quest = cave[y][x].special;
- dun_level = 0;
- p_ptr->oldpx = 0;
- p_ptr->oldpy = 0;
- p_ptr->leaving = TRUE;
- }
-
- /* Discover invisible traps */
- else if (c_ptr->info & CAVE_TRAP)
- {
- /* Disturb */
- disturb(0, 0);
+ if (break_trap) mpe_mode |= MPE_BREAK_TRAP;
- /* Message */
-#ifdef JP
- msg_print("¥È¥é¥Ã¥×¤À¡ª");
-#else
- msg_print("You found a trap!");
-#endif
-
-
- /* Pick a trap */
- pick_trap(py, px);
-
- /* Hit the trap */
- hit_trap(break_trap);
- }
-
- /* Set off an visible trap */
- else if (is_trap(c_ptr->feat))
- {
- /* Disturb */
- disturb(0, 0);
-
- /* Hit the trap */
- hit_trap(break_trap);
- }
-
- /* Warn when leaving trap detected region */
- if (disturb_trap_detect && p_ptr->dtrap_x && p_ptr->dtrap_y && p_ptr->dtrap_rad)
- {
- if (distance(py, px, p_ptr->dtrap_y, p_ptr->dtrap_x) >= p_ptr->dtrap_rad)
- {
- p_ptr->dtrap_x=0;
- p_ptr->dtrap_y=0;
- p_ptr->dtrap_rad=0;
-#ifdef JP
- msg_print("* Ãí°Õ:¤³¤ÎÀè¤Ï¥È¥é¥Ã¥×¤Î´¶ÃÎÈϰϳ°¤Ç¤¹¡ª *");
-#else
- msg_print("*Leaving trap detect region!*");
-#endif
-
- disturb(0, 0);
- }
- }
- }
-
- if (p_ptr->riding)
- {
- m_list[p_ptr->riding].fy = py;
- m_list[p_ptr->riding].fx = px;
- cave[py][px].m_idx = p_ptr->riding;
- update_mon(cave[py][px].m_idx, TRUE);
- p_ptr->update |= (PU_MON_LITE);
+ /* Move the player */
+ (void)move_player_effect(py, px, 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;
+
/* Get the new location */
y += ddy[dir];
x += ddx[dir];
/* Illegal grids are not known walls */
if (!in_bounds2(y, x)) return (FALSE);
- /* Non-wall grids are not known walls */
- if (cave[y][x].feat < FEAT_SECRET) return (FALSE);
-
- if ((cave[y][x].feat >= FEAT_DEEP_WATER) &&
- (cave[y][x].feat <= FEAT_GRASS)) return (FALSE);
-
- if ((cave[y][x].feat >= FEAT_SHOP_HEAD) &&
- (cave[y][x].feat <= FEAT_SHOP_TAIL)) return (FALSE);
-
- if (cave[y][x].feat == FEAT_DEEP_GRASS) return (FALSE);
- if (cave[y][x].feat == FEAT_FLOWER) return (FALSE);
-
- if (cave[y][x].feat == FEAT_MUSEUM) return (FALSE);
+ /* Access grid */
+ c_ptr = &cave[y][x];
- if ((cave[y][x].feat >= FEAT_BLDG_HEAD) &&
- (cave[y][x].feat <= FEAT_BLDG_TAIL)) return (FALSE);
+ /* Must be known to the player */
+ if (c_ptr->info & (CAVE_MARK))
+ {
+ /* Feature code (applying "mimic" field) */
+ s16b feat = get_feat_mimic(c_ptr);
+ feature_type *f_ptr = &f_info[feat];
-/* if (cave[y][x].feat == FEAT_TREES) return (FALSE); */
+ /* Wall grids are known walls */
+ if (!player_can_enter(feat, 0)) return !have_flag(f_ptr->flags, FF_DOOR);
- /* Must be known to the player */
- if (!(cave[y][x].info & (CAVE_MARK))) return (FALSE);
+ /* Don't run on a tree unless explicitly requested */
+ if (have_flag(f_ptr->flags, FF_AVOID_RUN) && !ignore_avoid_run)
+ return TRUE;
- if (cave[y][x].feat >= FEAT_TOWN) return (FALSE);
+ /* 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);
+ }
- /* Default */
- return (TRUE);
+ 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);
* stop at 1. Another run right and down will enter the corridor
* and make the corner, stopping at the 2.
*
- * #@x 1
+ * ##################
+ * o@x 1
* ########### ######
- * 2 #
+ * #2 #
* #############
- * #
*
* After any move, the function area_affect is called to
* determine the new surroundings, and the direction of
* respectively) to which you were not previously adjacent,
* marked as '!' in the diagrams below.
*
- * ...! ...
- * .o@! .o.!
- * ...! ..@!
- * !!!
+ * ...! ...
+ * .o@! (normal) .o.! (diagonal)
+ * ...! (east) ..@! (south east)
+ * !!!
*
* You STOP if any of the new squares are interesting in any way:
* for example, if they contain visible monsters or treasure.
* We assign "option" to the straight-on grid, and "option2" to the
* diagonal grid, and "check_dir" to the grid marked 's'.
*
- * .s
+ * ##s
* @x?
- * #?
+ * #.?
*
- * If they are both seen to be closed, then it is seen that no
- * benefit is gained from moving straight. It is a known corner.
- * To cut the corner, go diagonally, otherwise go straight, but
- * pretend you stepped diagonally into that next location for a
- * full view next time. Conversely, if one of the ? squares is
- * not seen to be closed, then there is a potential choice. We check
- * to see whether it is a potential corner or an intersection/room entrance.
- * If the square two spaces straight ahead, and the space marked with 's'
- * are both blank, then it is a potential corner and enter if find_examine
- * is set, otherwise must stop because it is not a corner.
+ * If they are both seen to be closed, then it is seen that no benefit
+ * is gained from moving straight. It is a known corner. To cut the
+ * corner, go diagonally, otherwise go straight, but pretend you
+ * stepped diagonally into that next location for a full view next
+ * time. Conversely, if one of the ? squares is not seen to be closed,
+ * then there is a potential choice. We check to see whether it is a
+ * potential corner or an intersection/room entrance. If the square
+ * two spaces straight ahead, and the space marked with 's' are both
+ * unknown space, then it is a potential corner and enter if
+ * find_examine is set, otherwise must stop because it is not a
+ * corner. (find_examine option is removed and always is TRUE.)
*/
row = py + ddy[dir];
col = px + ddx[dir];
+ ignore_avoid_run = have_flag(f_flags_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;
+ s16b feat;
+ feature_type *f_ptr;
/* Where we came from */
prev_dir = find_prevdir;
max = (prev_dir & 0x01) + 1;
/* break run when leaving trap detected region */
- if (disturb_trap_detect && p_ptr->dtrap_x && p_ptr->dtrap_y && p_ptr->dtrap_rad)
+ if ((disturb_trap_detect || alert_trap_detect)
+ && p_ptr->dtrap && !(cave[py][px].info & CAVE_IN_DETECT))
{
- if (distance(py, px, p_ptr->dtrap_y, p_ptr->dtrap_x) >= p_ptr->dtrap_rad)
+ /* No duplicate warning */
+ p_ptr->dtrap = FALSE;
+
+ /* You are just on the edge */
+ if (!(cave[py][px].info & CAVE_UNSAFE))
{
- p_ptr->dtrap_x=0;
- p_ptr->dtrap_y=0;
- p_ptr->dtrap_rad=0;
+ if (alert_trap_detect)
+ {
#ifdef JP
- msg_print("* Ãí°Õ:¤³¤ÎÀè¤Ï¥È¥é¥Ã¥×¤Î´¶ÃÎÈϰϳ°¤Ç¤¹¡ª *");
+ msg_print("* Ãí°Õ:¤³¤ÎÀè¤Ï¥È¥é¥Ã¥×¤Î´¶ÃÎÈϰϳ°¤Ç¤¹¡ª *");
#else
- msg_print("*Leaving trap detect region!*");
+ msg_print("*Leaving trap detect region!*");
#endif
+ }
- /* Break Run */
- return(TRUE);
+ if (disturb_trap_detect)
+ {
+ /* Break Run */
+ return(TRUE);
+ }
}
}
{
s16b this_o_idx, next_o_idx = 0;
-
/* New direction */
new_dir = cycle[chome[prev_dir] + i];
/* Access grid */
c_ptr = &cave[row][col];
+ /* Feature code (applying "mimic" field) */
+ feat = get_feat_mimic(c_ptr);
+ f_ptr = &f_info[feat];
/* Visible monsters abort running */
if (c_ptr->m_idx)
if (o_ptr->marked) return (TRUE);
}
-
/* Assume unknown */
inv = TRUE;
/* Check memorized grids */
if (c_ptr->info & (CAVE_MARK))
{
- bool notice = TRUE;
-
- /* Examine the terrain */
- switch (c_ptr->feat)
- {
- /* Floors */
- case FEAT_FLOOR:
-
- /* Invis traps */
- case FEAT_INVIS:
-
- /* Secret doors */
- case FEAT_SECRET:
-
- /* Normal veins */
- case FEAT_MAGMA:
- case FEAT_QUARTZ:
-
- /* Hidden treasure */
- case FEAT_MAGMA_H:
- case FEAT_QUARTZ_H:
-
- /* Walls */
- 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:
+ bool notice = have_flag(f_ptr->flags, FF_NOTICE);
+
+ if (notice && have_flag(f_ptr->flags, FF_MOVE))
+ {
+ /* 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 (p_ptr->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->ffall || p_ptr->can_swim ||
+ p_ptr->total_weight <= (((u32b)adj_str_wgt[p_ptr->stat_ind[A_STR]]*(p_ptr->pclass == CLASS_BERSERKER ? 150 : 100)) / 2)))
{
/* 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;
}
}
inv = FALSE;
}
- /* Analyze unknown grids and floors */
-/* if (inv || cave_floor_bold(row, col) || */
-/* (cave[row][col].feat == FEAT_TREES)) */
- if (inv || cave_floor_bold(row, col))
+ /* Analyze unknown grids and floors considering mimic */
+ if (inv || !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];
-
- /* Unknown grid or non-wall XXX XXX XXX cave_floor_grid(c_ptr)) */
- if (!(c_ptr->info & (CAVE_MARK)) ||
- ((c_ptr->feat < FEAT_SECRET) ||
- (c_ptr->feat == FEAT_FLOWER) ||
- (c_ptr->feat == FEAT_DEEP_GRASS) ||
- ((c_ptr->feat >= FEAT_DEEP_WATER) &&
- (c_ptr->feat <= FEAT_GRASS))))
-
+ /* 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];
-
- /* Unknown grid or non-wall XXX XXX XXX cave_floor_grid(c_ptr)) */
- if (!(c_ptr->info & (CAVE_MARK)) ||
- ((c_ptr->feat < FEAT_SECRET) ||
- (c_ptr->feat == FEAT_FLOWER) ||
- (c_ptr->feat == FEAT_DEEP_GRASS) ||
- ((c_ptr->feat >= FEAT_DEEP_WATER) &&
- (c_ptr->feat <= FEAT_GRASS))))
-
+ /* 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
{
}
/* Two options, examining corners */
- else if (find_examine && !find_cut)
+ else if (!find_cut)
{
/* Primary option */
find_current = option;
{
/* Can not see anything ahead and in the direction we */
/* are turning, assume that it is a potential corner. */
- if (find_examine &&
- see_nothing(option, row, col) &&
+ if (see_nothing(option, row, col) &&
see_nothing(option2, row, col))
{
find_current = option;
}
}
-
/* About to hit a known wall, stop */
if (see_wall(find_current, py, px))
{
return (TRUE);
}
-
/* Failure */
return (FALSE);
}
/* Start running */
if (dir)
{
+ /* Ignore AVOID_RUN on a first step */
+ ignore_avoid_run = TRUE;
+
/* Hack -- do not start silly run */
- if (see_wall(dir, py, px) &&
- (cave[py+ddy[dir]][px+ddx[dir]].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);
return;
}
- /* Calculate torch radius */
- p_ptr->update |= (PU_TORCH);
-
/* Initialize */
run_init(dir);
}
#endif /* ALLOW_EASY_DISARM -- TNB */
- if ((py == p_ptr->run_py) && (px == p_ptr->run_px))
+ if (player_bold(p_ptr->run_py, p_ptr->run_px))
{
p_ptr->run_py = 0;
p_ptr->run_px = 0;