/* Extract the flags */
object_flags(o_ptr, flgs);
+ torch_flags(o_ptr, flgs); /* torches has secret flags */
+
+ if (!thrown)
+ {
+ /* Magical Swords */
+ if (p_ptr->special_attack & (ATTACK_ACID)) add_flag(flgs, TR_BRAND_ACID);
+ if (p_ptr->special_attack & (ATTACK_COLD)) add_flag(flgs, TR_BRAND_COLD);
+ if (p_ptr->special_attack & (ATTACK_ELEC)) add_flag(flgs, TR_BRAND_ELEC);
+ if (p_ptr->special_attack & (ATTACK_FIRE)) add_flag(flgs, TR_BRAND_FIRE);
+ if (p_ptr->special_attack & (ATTACK_POIS)) add_flag(flgs, TR_BRAND_POIS);
+ }
/* Some "weapons" and "ammo" do extra damage */
switch (o_ptr->tval)
case TV_POLEARM:
case TV_SWORD:
case TV_DIGGING:
+ case TV_LITE:
{
/* Slay Animal */
if ((have_flag(flgs, TR_SLAY_ANIMAL)) &&
}
/* Brand (Acid) */
- if (have_flag(flgs, TR_BRAND_ACID) || ((p_ptr->special_attack & (ATTACK_ACID)) && !thrown))
+ if (have_flag(flgs, TR_BRAND_ACID))
{
/* Notice immunity */
if (r_ptr->flagsr & RFR_EFF_IM_ACID_MASK)
}
/* Brand (Elec) */
- if (have_flag(flgs, TR_BRAND_ELEC) || ((p_ptr->special_attack & (ATTACK_ELEC)) && !thrown) || (mode == HISSATSU_ELEC))
+ if (have_flag(flgs, TR_BRAND_ELEC))
{
/* Notice immunity */
if (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK)
}
/* Otherwise, take the damage */
- else if ((have_flag(flgs, TR_BRAND_ELEC) || ((p_ptr->special_attack & (ATTACK_ELEC)) && !thrown)) && (mode == HISSATSU_ELEC))
- {
- if (mult < 70) mult = 70;
- }
- else if (mode == HISSATSU_ELEC)
- {
- if (mult < 50) mult = 50;
- }
-
else
{
if (mult < 25) mult = 25;
}
/* Brand (Fire) */
- if (have_flag(flgs, TR_BRAND_FIRE) || ((p_ptr->special_attack & (ATTACK_FIRE)) && !thrown) || (mode == HISSATSU_FIRE))
+ if (have_flag(flgs, TR_BRAND_FIRE))
{
/* Notice immunity */
if (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK)
}
/* Otherwise, take the damage */
- else if ((have_flag(flgs, TR_BRAND_FIRE) || ((p_ptr->special_attack & (ATTACK_FIRE)) && !thrown)) && (mode == HISSATSU_FIRE))
- {
- if (r_ptr->flags3 & RF3_HURT_FIRE)
- {
- if (mult < 70) mult = 70;
- if (is_original_ap_and_seen(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_HURT_FIRE;
- }
- }
- else if (mult < 35) mult = 35;
- }
else
{
if (r_ptr->flags3 & RF3_HURT_FIRE)
}
/* Brand (Cold) */
- if (have_flag(flgs, TR_BRAND_COLD) || ((p_ptr->special_attack & (ATTACK_COLD)) && !thrown) || (mode == HISSATSU_COLD))
+ if (have_flag(flgs, TR_BRAND_COLD))
{
/* Notice immunity */
if (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK)
}
}
/* Otherwise, take the damage */
- else if ((have_flag(flgs, TR_BRAND_COLD) || ((p_ptr->special_attack & (ATTACK_COLD)) && !thrown)) && (mode == HISSATSU_COLD))
- {
- if (r_ptr->flags3 & RF3_HURT_COLD)
- {
- if (mult < 70) mult = 70;
- if (is_original_ap_and_seen(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_HURT_COLD;
- }
- }
- else if (mult < 35) mult = 35;
- }
else
{
if (r_ptr->flags3 & RF3_HURT_COLD)
}
/* Brand (Poison) */
- if (have_flag(flgs, TR_BRAND_POIS) || ((p_ptr->special_attack & (ATTACK_POIS)) && !thrown) || (mode == HISSATSU_POISON))
+ if (have_flag(flgs, TR_BRAND_POIS))
{
/* Notice immunity */
if (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK)
}
/* Otherwise, take the damage */
- else if ((have_flag(flgs, TR_BRAND_POIS) || ((p_ptr->special_attack & (ATTACK_POIS)) && !thrown)) && (mode == HISSATSU_POISON))
- {
- if (mult < 35) mult = 35;
- }
else
{
if (mult < 25) mult = 25;
}
}
- if ((mode == HISSATSU_ZANMA) && !monster_living(r_ptr) && (r_ptr->flags3 & RF3_EVIL))
- {
- if (mult < 15) mult = 25;
- else if (mult < 50) mult = MIN(50, mult+20);
- }
- if (mode == HISSATSU_UNDEAD)
- {
- if (r_ptr->flags3 & RF3_UNDEAD)
- {
- if (is_original_ap_and_seen(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_UNDEAD;
- }
- if (mult == 10) mult = 70;
- else if (mult < 140) mult = MIN(140, mult+60);
- }
- if (mult == 10) mult = 40;
- else if (mult < 60) mult = MIN(60, mult+30);
- }
- if ((mode == HISSATSU_SEKIRYUKA) && p_ptr->cut && monster_living(r_ptr))
- {
- int tmp = MIN(100, MAX(10, p_ptr->cut / 10));
- if (mult < tmp) mult = tmp;
- }
- if ((mode == HISSATSU_HAGAN) && (r_ptr->flags3 & RF3_HURT_ROCK))
+
+ /* Hissatsu */
+ if (p_ptr->pclass == CLASS_SAMURAI)
{
- if (is_original_ap_and_seen(m_ptr))
- {
- r_ptr->r_flags3 |= RF3_HURT_ROCK;
- }
- if (mult == 10) mult = 40;
- else if (mult < 60) mult = 60;
+ mult = mult_hissatsu(mult, flgs, m_ptr, mode);
}
+
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));
next_o_idx = o_ptr->next_o_idx;
/* Hack -- disturb */
- disturb(0, 1);
+ disturb(0, 0);
/* Pick up gold */
if (o_ptr->tval == TV_GOLD)
/*
* Test for traveling
*/
-static bool travel_test(void)
+static int travel_test(int prev_dir)
{
- int prev_dir, new_dir, check_dir = 0;
- int row, col;
+ int new_dir = 0;
int i, max;
- bool stop = TRUE;
- cave_type *c_ptr;
-
- /* Where we came from */
- prev_dir = find_prevdir;
+ const cave_type *c_ptr;
+ int cost;
- /* Range of newly adjacent grids */
- max = (prev_dir & 0x01) + 1;
-
- for (i = 0; i < 8; i++)
+ /* Cannot travel when blind */
+ if (p_ptr->blind || no_lite())
{
- if (travel.cost[py+ddy_ddd[i]][px+ddx_ddd[i]] < travel.cost[py][px]) stop = FALSE;
+ msg_print(_("Ìܤ¬¸«¤¨¤Ê¤¤¡ª", "You cannot see!"));
+ return (0);
}
- if (stop) return (TRUE);
-
/* break run when leaving trap detected region */
if ((disturb_trap_detect || alert_trap_detect)
&& p_ptr->dtrap && !(cave[py][px].info & CAVE_IN_DETECT))
if (disturb_trap_detect)
{
/* Break Run */
- return(TRUE);
+ return (0);
}
}
}
- /* Cannot travel when blind */
- if (p_ptr->blind || no_lite())
- {
-#ifdef JP
- msg_print("Ìܤ¬¸«¤¨¤Ê¤¤¡ª");
-#else
- msg_print("You cannot see!");
-#endif
- return (TRUE);
- }
+ /* Range of newly adjacent grids */
+ max = (prev_dir & 0x01) + 1;
/* Look at every newly adjacent square. */
for (i = -max; i <= max; i++)
{
/* New direction */
- new_dir = cycle[chome[prev_dir] + i];
+ int dir = cycle[chome[prev_dir] + i];
/* New location */
- row = py + ddy[new_dir];
- col = px + ddx[new_dir];
+ int row = py + ddy[dir];
+ int col = px + ddx[dir];
/* Access grid */
c_ptr = &cave[row][col];
-
/* Visible monsters abort running */
if (c_ptr->m_idx)
{
monster_type *m_ptr = &m_list[c_ptr->m_idx];
/* Visible monster */
- if (m_ptr->ml) return (TRUE);
+ if (m_ptr->ml) return (0);
}
+
}
- /* Failure */
- return (FALSE);
+ /* Travel cost of current grid */
+ cost = travel.cost[py][px];
+
+ /* Determine travel direction */
+ for (i = 0; i < 8; ++ i) {
+ int dir_cost = travel.cost[py+ddy_ddd[i]][px+ddx_ddd[i]];
+
+ if (dir_cost < cost)
+ {
+ new_dir = ddd[i];
+ cost = dir_cost;
+ }
+ }
+
+ if (!new_dir) return (0);
+
+ /* Access newly move grid */
+ c_ptr = &cave[py+ddy[new_dir]][px+ddx[new_dir]];
+
+ /* Close door abort traveling */
+ if (!easy_open && is_closed_door(c_ptr->feat)) return (0);
+
+ /* Visible and unignorable trap abort tarveling */
+ if (!c_ptr->mimic && !trap_can_be_ignored(c_ptr->feat)) return (0);
+
+ /* Move new grid */
+ return (new_dir);
}
*/
void travel_step(void)
{
- int i;
- int dir = travel.dir;
-
- find_prevdir = dir;
+ /* Get travel direction */
+ travel.dir = travel_test(travel.dir);
/* disturb */
- if (travel_test())
+ if (!travel.dir)
{
if (travel.run == 255)
{
energy_use = 100;
- for (i = 1; i <= 9; i++)
- {
- if (i == 5) continue;
-
- if (travel.cost[py+ddy[i]][px+ddx[i]] < travel.cost[py+ddy[dir]][px+ddx[dir]])
- {
- dir = i;
- }
- }
-
- /* Close door */
- if (!easy_open && is_closed_door(cave[py+ddy[dir]][px+ddx[dir]].feat))
- {
- disturb(0, 1);
- return;
- }
-
- travel.dir = dir;
- move_player(dir, always_pickup, easy_disarm);
+ move_player(travel.dir, always_pickup, FALSE);
if ((py == travel.y) && (px == travel.x))
travel.run = 0;
else if (travel.run > 0)
travel.run--;
+
+ /* Travel Delay */
+ Term_xtra(TERM_XTRA_DELAY, delay_factor);
}
#endif