/*!
* @file melee1.c
- * @brief モンスターの打撃処理 / Monster attacks
+ * @brief 打撃処理 / Melee process.
* @date 2014/01/17
* @author
* Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
#include "monsterrace-hook.h"
#include "melee.h"
#include "projection.h"
+#include "monster.h"
#include "monster-status.h"
+#include "monster-spell.h"
#include "avatar.h"
#include "player-status.h"
#include "realm-hex.h"
PERCENTAGE hit_chance(HIT_RELIABILITY reli, ARMOUR_CLASS ac)
{
PERCENTAGE chance = 5, chance_left = 90;
- if (reli <= 0) return 5;
- if (p_ptr->pseikaku == SEIKAKU_NAMAKE) chance_left = (chance_left * 19 + 9) / 20;
+ if(reli <= 0) return 5;
+ if(p_ptr->pseikaku == SEIKAKU_NAMAKE) chance_left = (chance_left * 19 + 9) / 20;
chance += (100 - ((ac * 75) / reli)) * chance_left / 100;
-
+ if (chance < 5) chance = 5;
return chance;
}
const struct slay_table_t* p = &slay_table[i];
if ((have_flag(flgs, p->slay_flag)) &&
- (atoffset(u32b, r_ptr, p->flag_offset) & p->affect_race_flag))
+ (atoffset(BIT_FLAGS, r_ptr, p->flag_offset) & p->affect_race_flag))
{
if (is_original_ap_and_seen(m_ptr))
{
- atoffset(u32b, r_ptr, p->r_flag_offset) |= p->affect_race_flag;
+ atoffset(BIT_FLAGS, r_ptr, p->r_flag_offset) |= p->affect_race_flag;
}
mult = MAX(mult, p->slay_mult);
}
/*!
+ * @brief 剣術のスレイ倍率計算を行う /
+ * Calcurate magnification of hissatsu technics
+ * @param mult 剣術のスレイ効果以前に算出している多要素の倍率(/10倍)
+ * @param flgs 剣術に使用する武器のスレイフラグ配列
+ * @param m_ptr 目標となるモンスターの構造体参照ポインタ
+ * @param mode 剣術のスレイ型ID
+ * @return スレイの倍率(/10倍)
+ */
+static MULTIPLY mult_hissatsu(MULTIPLY mult, BIT_FLAGS *flgs, monster_type *m_ptr, BIT_FLAGS 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(m_ptr->r_idx) && (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(m_ptr->r_idx))
+ {
+ MULTIPLY 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;
+}
+
+/*!
* @brief ダメージにスレイ要素を加える総合処理ルーチン /
* Extract the "total damage" from a given object hitting a given monster.
* @param o_ptr 使用武器オブジェクトの構造体参照ポインタ
* @param tdam 現在算出途中のダメージ値
* @param m_ptr 目標モンスターの構造体参照ポインタ
* @param mode 剣術のID
- * @param thrown 射撃処理ならばTRUEを指定する
+ * @param thrown 投擲処理ならばTRUEを指定する
* @return 総合的なスレイを加味したダメージ値
* @note
* Note that "flasks of oil" do NOT do fire damage, although they\n
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_POIS)) add_flag(flgs, TR_BRAND_POIS);
}
- /* Hex - Slay Good (Runesword) */
if (hex_spelling(HEX_RUNESWORD)) add_flag(flgs, TR_SLAY_GOOD);
- /* Some "weapons" and "ammo" do extra damage */
switch (o_ptr->tval)
{
case TV_SHOT:
case TV_DIGGING:
case TV_LITE:
{
- /* Slaying */
mult = mult_slaying(mult, flgs, m_ptr);
- /* Elemental Brand */
mult = mult_brand(mult, flgs, m_ptr);
- /* Hissatsu */
if (p_ptr->pclass == CLASS_SAMURAI)
{
mult = mult_hissatsu(mult, flgs, m_ptr, mode);
}
- /* Force Weapon */
if ((p_ptr->pclass != CLASS_SAMURAI) && (have_flag(flgs, TR_FORCE_WEAPON)) && (p_ptr->csp > (o_ptr->dd * o_ptr->ds / 5)))
{
p_ptr->csp -= (1 + (o_ptr->dd * o_ptr->ds / 5));
mult = mult * 3 / 2 + 20;
}
- /* Hack -- The Nothung cause special damage to Fafner */
if ((o_ptr->name1 == ART_NOTHUNG) && (m_ptr->r_idx == MON_FAFNER))
mult = 150;
break;
}
if (mult > 150) mult = 150;
- /* Return the total damage */
return (tdam * mult / 10);
}
{
monster_race *r_ptr = &r_info[m_ptr->r_idx];
- if ((atoffset(u32b, r_ptr, flags_offset) & aura_flag) && !immune)
+ if ((atoffset(BIT_FLAGS, r_ptr, flags_offset) & aura_flag) && !immune)
{
GAME_TEXT mon_name[MAX_NLEN];
int aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
- /* Hack -- Get the "died from" name */
- monster_desc(mon_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
-
+ monster_desc(mon_name, m_ptr, MD_WRONGDOER_NAME);
msg_print(message);
-
dam_func(aura_damage, mon_name, -1, TRUE);
if (is_original_ap_and_seen(m_ptr))
{
- atoffset(u32b, r_ptr, r_flags_offset) |= aura_flag;
+ atoffset(BIT_FLAGS, r_ptr, r_flags_offset) |= aura_flag;
}
handle_stuff();
* @details
* If no "weapon" is available, then "punch" the monster one time.
*/
-static void py_attack_aux(POSITION y, POSITION x, bool *fear, bool *mdeath, s16b hand, BIT_FLAGS mode)
+static void py_attack_aux(POSITION y, POSITION x, bool *fear, bool *mdeath, s16b hand, COMBAT_OPTION_IDX mode)
{
int num = 0, bonus, chance, vir;
HIT_POINT k;
* @details
* If no "weapon" is available, then "punch" the monster one time.
*/
-bool py_attack(POSITION y, POSITION x, BIT_FLAGS mode)
+bool py_attack(POSITION y, POSITION x, COMBAT_OPTION_IDX mode)
{
bool fear = FALSE;
bool mdeath = FALSE;
/* Extract the effective monster level */
rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1);
-
/* Get the monster name (or "it") */
monster_desc(m_name, m_ptr, 0);
- /* Get the "died from" information (i.e. "a kobold") */
- monster_desc(ddesc, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
+ monster_desc(ddesc, m_ptr, MD_WRONGDOER_NAME);
if (p_ptr->special_defense & KATA_IAI)
{
int d_dice = r_ptr->blow[ap_cnt].d_dice;
int d_side = r_ptr->blow[ap_cnt].d_side;
-
- if (!m_ptr->r_idx) break;
+ if (!monster_is_valid(m_ptr)) break;
/* Hack -- no more attacks */
if (!method) break;
/* Visible monsters */
if (m_ptr->ml)
{
- /* Disturbing */
disturb(TRUE, TRUE);
#ifdef JP