/* Extract the flags */
object_flags(o_ptr, flgs);
+ 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)
{
}
/* 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);
+plog(format("mult = %d", mult));
}
+
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));
extern void do_cmd_hissatsu(void);
extern void do_cmd_hissatsu_browse(void);
extern void do_cmd_gain_hissatsu(void);
+extern s16b mult_hissatsu(int mult, u32b *flgs, monster_type *m_ptr, int mode);
/* mutation.c */
extern int count_bits(u32b x);
p_ptr->update |= (PU_SPELLS);
}
+
+
+/*
+ * Calcurate magnification of hissatsu technics
+ */
+s16b mult_hissatsu(int mult, u32b *flgs, monster_type *m_ptr, int mode)
+{
+ monster_race *r_ptr = &r_info[m_ptr->r_idx];
+
+ /* Burning Strike (Fire) */
+ if (mode == HISSATSU_FIRE)
+ {
+ /* Notice immunity */
+ if (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK)
+ {
+ if (is_original_ap_and_seen(m_ptr))
+ {
+ r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK);
+ }
+ }
+
+ /* Otherwise, take the damage */
+ else if (have_flag(flgs, TR_BRAND_FIRE))
+ {
+ if (r_ptr->flags3 & RF3_HURT_FIRE)
+ {
+ if (mult < 70) mult = 70;
+ if (is_original_ap_and_seen(m_ptr))
+ {
+ r_ptr->r_flags3 |= RF3_HURT_FIRE;
+ }
+ }
+ else if (mult < 35) mult = 35;
+ }
+ else
+ {
+ if (r_ptr->flags3 & RF3_HURT_FIRE)
+ {
+ if (mult < 50) mult = 50;
+ if (is_original_ap_and_seen(m_ptr))
+ {
+ r_ptr->r_flags3 |= RF3_HURT_FIRE;
+ }
+ }
+ else if (mult < 25) mult = 25;
+ }
+ }
+
+ /* Serpent's Tongue (Poison) */
+ if (mode == HISSATSU_POISON)
+ {
+ /* Notice immunity */
+ if (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK)
+ {
+ if (is_original_ap_and_seen(m_ptr))
+ {
+ r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK);
+ }
+ }
+
+ /* Otherwise, take the damage */
+ else if (have_flag(flgs, TR_BRAND_POIS))
+ {
+ if (mult < 35) mult = 35;
+ }
+ else
+ {
+ if (mult < 25) mult = 25;
+ }
+ }
+
+ /* Zammaken (Nonliving Evil) */
+ if (mode == HISSATSU_ZANMA)
+ {
+ if (!monster_living(r_ptr) && (r_ptr->flags3 & RF3_EVIL))
+ {
+ if (mult < 15) mult = 25;
+ else if (mult < 50) mult = MIN(50, mult+20);
+ }
+ }
+
+ /* Rock Smash (Hurt Rock) */
+ if (mode == HISSATSU_HAGAN)
+ {
+ if (r_ptr->flags3 & RF3_HURT_ROCK)
+ {
+ if (is_original_ap_and_seen(m_ptr))
+ {
+ r_ptr->r_flags3 |= RF3_HURT_ROCK;
+ }
+ if (mult == 10) mult = 40;
+ else if (mult < 60) mult = 60;
+ }
+ }
+
+ /* Midare-Setsugekka (Cold) */
+ if (mode == HISSATSU_COLD)
+ {
+ /* Notice immunity */
+ if (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK)
+ {
+ if (is_original_ap_and_seen(m_ptr))
+ {
+ r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK);
+ }
+ }
+ /* Otherwise, take the damage */
+ else if (have_flag(flgs, TR_BRAND_COLD))
+ {
+ if (r_ptr->flags3 & RF3_HURT_COLD)
+ {
+ if (mult < 70) mult = 70;
+ if (is_original_ap_and_seen(m_ptr))
+ {
+ r_ptr->r_flags3 |= RF3_HURT_COLD;
+ }
+ }
+ else if (mult < 35) mult = 35;
+ }
+ else
+ {
+ if (r_ptr->flags3 & RF3_HURT_COLD)
+ {
+ if (mult < 50) mult = 50;
+ if (is_original_ap_and_seen(m_ptr))
+ {
+ r_ptr->r_flags3 |= RF3_HURT_COLD;
+ }
+ }
+ else if (mult < 25) mult = 25;
+ }
+ }
+
+ /* Lightning Eagle (Elec) */
+ if (mode == HISSATSU_ELEC)
+ {
+ /* Notice immunity */
+ if (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK)
+ {
+ if (is_original_ap_and_seen(m_ptr))
+ {
+ r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK);
+ }
+ }
+
+ /* Otherwise, take the damage */
+ else if (have_flag(flgs, TR_BRAND_ELEC))
+ {
+ if (mult < 70) mult = 70;
+ }
+ else
+ {
+ if (mult < 50) mult = 50;
+ }
+ }
+
+ /* Bloody Maelstrom */
+ 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;
+ }
+
+ /* Keiun-Kininken */
+ 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 (mult > 150) mult = 150;
+
+ return mult;
+}