Hengband  2.1.4
 全て データ構造 ファイル 関数 変数 型定義 マクロ定義 ページ
マクロ定義 | 関数
mspells1.c

モンスター魔法の実装 / Monster spells (attack player) [詳細]

#include "angband.h"
mspells1.cのインクルード依存関係図

マクロ定義

#define DO_SPELL_NONE   0
 
#define DO_SPELL_BR_LITE   1
 
#define DO_SPELL_BR_DISI   2
 
#define DO_SPELL_BA_LITE   3
 

関数

static bool int_outof (monster_race *r_ptr, int prob)
 モンスターがプレイヤーの弱点をついた選択を取るかどうかの判定 / Internal probability routine [詳細]
 
static void remove_bad_spells (int m_idx, u32b *f4p, u32b *f5p, u32b *f6p)
 モンスターの魔法一覧から戦術的に適さない魔法を除外する / Remove the "bad" spells from a spell list [詳細]
 
bool summon_possible (int y1, int x1)
 モンスターにとって所定の地点が召還に相応しい地点かどうかを返す。 / Determine if there is a space near the player in which a summoned creature can appear [詳細]
 
bool raise_possible (monster_type *m_ptr)
 モンスターにとって死者復活を行うべき状態かどうかを返す / Determine if there is a space near the player in which a summoned creature can appear [詳細]
 
bool clean_shot (int y1, int x1, int y2, int x2, bool is_friend)
 モンスターにとってボルト型魔法が有効な状態かを返す / Determine if a bolt spell will hit the player. [詳細]
 
void bolt (int m_idx, int y, int x, int typ, int dam_hp, int monspell, int target_type)
 モンスターのボルト型魔法処理 / Cast a bolt at the player Stop if we hit a monster Affect monsters and the player [詳細]
 
void beam (int m_idx, int y, int x, int typ, int dam_hp, int monspell, int target_type)
 モンスターのビーム型魔法処理 / [詳細]
 
void breath (int y, int x, int m_idx, int typ, int dam_hp, int rad, bool breath, int monspell, int target_type)
 モンスターのボール型&ブレス型魔法処理 / Cast a breath (or ball) attack at the player Pass over any monsters that may be in the way Affect grids, objects, monsters, and the player [詳細]
 
u32b get_curse (int power, object_type *o_ptr)
 モンスターのボール型&ブレス型魔法処理 / [詳細]
 
void curse_equipment (int chance, int heavy_chance)
 装備への呪い付加判定と付加処理 / [詳細]
 
static bool spell_attack (byte spell)
 ID値が正しいモンスター魔法IDかどうかを返す / Return TRUE if a spell is good for hurting the player (directly). [詳細]
 
static bool spell_escape (byte spell)
 ID値が退避目的に適したモンスター魔法IDかどうかを返す / Return TRUE if a spell is good for escaping. [詳細]
 
static bool spell_annoy (byte spell)
 ID値が妨害目的に適したモンスター魔法IDかどうかを返す / Return TRUE if a spell is good for annoying the player. [詳細]
 
static bool spell_summon (byte spell)
 ID値が召喚型のモンスター魔法IDかどうかを返す / Return TRUE if a spell is good for annoying the player. [詳細]
 
static bool spell_raise (byte spell)
 ID値が死者復活処理かどうかを返す / Return TRUE if a spell is good for annoying the player. [詳細]
 
static bool spell_tactic (byte spell)
 ID値が戦術的なモンスター魔法IDかどうかを返す / Return TRUE if a spell is good in a tactical situation. [詳細]
 
static bool spell_invulner (byte spell)
 ID値が無敵化するモンスター魔法IDかどうかを返す / Return TRUE if a spell makes invulnerable. [詳細]
 
static bool spell_haste (byte spell)
 ID値が加速するモンスター魔法IDかどうかを返す / Return TRUE if a spell hastes. [詳細]
 
static bool spell_world (byte spell)
 ID値が時間停止を行うモンスター魔法IDかどうかを返す / Return TRUE if a spell world. [詳細]
 
static bool spell_special (byte spell)
 ID値が特別効果のモンスター魔法IDかどうかを返す / Return TRUE if a spell special. [詳細]
 
static bool spell_psy_spe (byte spell)
 ID値が光の剣のモンスター魔法IDかどうかを返す / Return TRUE if a spell psycho-spear. [詳細]
 
static bool spell_heal (byte spell)
 ID値が治癒魔法かどうかを返す / Return TRUE if a spell is good for healing. [詳細]
 
static bool spell_dispel (byte spell)
 ID値が魔力消去かどうかを返す / Return TRUE if a spell is good for dispel. [詳細]
 
bool dispel_check (int m_idx)
 モンスターがプレイヤーに魔力消去を与えるべきかを判定するルーチン Check should monster cast dispel spell. [詳細]
 
static int choose_attack_spell (int m_idx, byte spells[], byte num)
 モンスターの魔法選択ルーチン Have a monster choose a spell from a list of "useful" spells. [詳細]
 
bool spell_is_inate (u16b spell)
 ID値が非魔術的な特殊技能かどうかを返す / Return TRUE if a spell is inate spell. [詳細]
 
static bool adjacent_grid_check (monster_type *m_ptr, int *yp, int *xp, int f_flag, bool(*path_check)(int, int, int, int))
 モンスターがプレイヤーにダメージを与えるための最適な座標を算出する / [詳細]
 
bool make_attack_spell (int m_idx)
 モンスターの特殊技能メインルーチン / Creatures can cast spells, shoot missiles, and breathe. [詳細]
 

説明

モンスター魔法の実装 / Monster spells (attack player)

日付
2014/01/17
作者
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. Other copyrights may also apply.
2014 Deskull rearranged comment for Doxygen.

And now for Intelligent monster attacks (including spells).

Original idea and code by "DRS" (David Reeves Sward).
Major modifications by "BEN" (Ben Harrison).

Give monsters more intelligent attack/spell selection based on
observations of previous attacks on the player, and/or by allowing
the monster to "cheat" and know the player status.

Maintain an idea of the player status, and use that information
to occasionally eliminate "ineffective" spell attacks. We could
also eliminate ineffective normal attacks, but there is no reason
for the monster to do this, since he gains no benefit.
Note that MINDLESS monsters are not allowed to use this code.
And non-INTELLIGENT monsters only use it partially effectively.

Actually learn what the player resists, and use that information
to remove attacks or spells before using them. This will require
much less space, if I am not mistaken. Thus, each monster gets a
set of 32 bit flags, "smart", build from the various "SM_*" flags.

This has the added advantage that attacks and spells are related.
The "smart_learn" option means that the monster "learns" the flags
that should be set, and "smart_cheat" means that he "knows" them.
So "smart_cheat" means that the "smart" field is always up to date,
while "smart_learn" means that the "smart" field is slowly learned.
Both of them have the same effect on the "choose spell" routine.

マクロ定義

#define DO_SPELL_BA_LITE   3
#define DO_SPELL_BR_DISI   2
#define DO_SPELL_BR_LITE   1
#define DO_SPELL_NONE   0

関数

static bool adjacent_grid_check ( monster_type m_ptr,
int *  yp,
int *  xp,
int  f_flag,
bool(*)(int, int, int, int)  path_check 
)
static

モンスターがプレイヤーにダメージを与えるための最適な座標を算出する /

引数
m_ptr技能を使用するモンスター構造体の参照ポインタ
yp最適な目標地点のY座標を返す参照ポインタ
xp最適な目標地点のX座標を返す参照ポインタ
f_flag射線に入れるのを避ける地形の所持フラグ
path_check射線を判定するための関数ポインタ
戻り値
有効な座標があった場合TRUEを返す

呼出しグラフ:

void beam ( int  m_idx,
int  y,
int  x,
int  typ,
int  dam_hp,
int  monspell,
int  target_type 
)

モンスターのビーム型魔法処理 /

引数
m_idxモンスターのID
y目標のY座標
x目標のX座標
typ効果属性ID
dam_hp威力
monspellモンスター魔法のID
target_typeモンスターからモンスターへ撃つならMONSTER_TO_MONSTER、モンスターからプレイヤーならMONSTER_TO_PLAYER
戻り値
なし

関数の呼び出しグラフ:

呼出しグラフ:

void bolt ( int  m_idx,
int  y,
int  x,
int  typ,
int  dam_hp,
int  monspell,
int  target_type 
)

モンスターのボルト型魔法処理 / Cast a bolt at the player Stop if we hit a monster Affect monsters and the player

引数
m_idxモンスターのID
y目標のY座標
x目標のX座標
typ効果属性ID
dam_hp威力
monspellモンスター魔法のID
target_typeモンスターからモンスターへ撃つならMONSTER_TO_MONSTER、モンスターからプレイヤーならMONSTER_TO_PLAYER
戻り値
なし

関数の呼び出しグラフ:

呼出しグラフ:

void breath ( int  y,
int  x,
int  m_idx,
int  typ,
int  dam_hp,
int  rad,
bool  breath,
int  monspell,
int  target_type 
)

モンスターのボール型&ブレス型魔法処理 / Cast a breath (or ball) attack at the player Pass over any monsters that may be in the way Affect grids, objects, monsters, and the player

引数
y目標地点のY座標
x目標地点のX座標
m_idxモンスターのID
typ効果属性ID
dam_hp威力
rad半径
breathTRUEならばブ・E構萢・.ALSEならばボー・E萢
monspellモンスター魔法のID
target_typeモンスターからモンスターへ撃つならMONSTER_TO_MONSTER、モンスターからプレイヤーならMONSTER_TO_PLAYER
戻り値
なし

関数の呼び出しグラフ:

呼出しグラフ:

static int choose_attack_spell ( int  m_idx,
byte  spells[],
byte  num 
)
static

モンスターの魔法選択ルーチン Have a monster choose a spell from a list of "useful" spells.

引数
m_idxモンスターの構造体配列ID
spells候補魔法IDをまとめた配列
numspellsの長さ
戻り値
選択したモンスター魔法のID

Note that this list does NOT include spells that will just hit
other monsters, and the list is restricted when the monster is
"desperate". Should that be the job of this function instead?

Stupid monsters will just pick a spell randomly. Smart monsters
will choose more "intelligently".

Use the helper functions above to put spells into categories.

This function may well be an efficiency bottleneck.

関数の呼び出しグラフ:

呼出しグラフ:

bool clean_shot ( int  y1,
int  x1,
int  y2,
int  x2,
bool  is_friend 
)

モンスターにとってボルト型魔法が有効な状態かを返す / Determine if a bolt spell will hit the player.

引数
y1ボルト魔法発射地点のY座標
x1ボルト魔法発射地点のX座標
y2ボルト魔法目標地点のY座標
x2ボルト魔法目標地点のX座標
is_friendモンスターがプレイヤーに害意を持たない(ペットか友好的)ならばTRUEをつける
戻り値
ボルト型魔法が有効ならばTRUEを返す。

Originally, it was possible for a friendly to shoot another friendly.
Change it so a "clean shot" means no equally friendly monster is
between the attacker and target.

This is exactly like "projectable", but it will
return FALSE if a monster is in the way.
no equally friendly monster is
between the attacker and target.

関数の呼び出しグラフ:

呼出しグラフ:

void curse_equipment ( int  chance,
int  heavy_chance 
)

装備への呪い付加判定と付加処理 /

引数
chance呪いの基本確率
heavy_chance重い呪いを選択肢に入れるか否か。
戻り値
なし

関数の呼び出しグラフ:

呼出しグラフ:

bool dispel_check ( int  m_idx)

モンスターがプレイヤーに魔力消去を与えるべきかを判定するルーチン Check should monster cast dispel spell.

引数
m_idxモンスターの構造体配列ID
戻り値
魔力消去をかけるべきならTRUEを返す。

呼出しグラフ:

u32b get_curse ( int  power,
object_type o_ptr 
)

モンスターのボール型&ブレス型魔法処理 /

引数
power呪いの段階
o_ptr呪いをかけられる装備オブジェクトの構造体参照ポインタ
戻り値
与える呪いのID

関数の呼び出しグラフ:

呼出しグラフ:

static bool int_outof ( monster_race r_ptr,
int  prob 
)
static

モンスターがプレイヤーの弱点をついた選択を取るかどうかの判定 / Internal probability routine

引数
r_ptrモンスター種族の構造体参照ポインタ
prob基本確率(%)
戻り値
適した選択を取るならばTRUEを返す。

呼出しグラフ:

bool make_attack_spell ( int  m_idx)

モンスターの特殊技能メインルーチン / Creatures can cast spells, shoot missiles, and breathe.

引数
m_idxモンスター構造体配列のID
戻り値
実際に特殊技能を利用したらTRUEを返す

Returns "TRUE" if a spell (or whatever) was (successfully) cast.

XXX XXX XXX This function could use some work, but remember to
keep it as optimized as possible, while retaining generic code.

Verify the various "blind-ness" checks in the code.

XXX XXX XXX Note that several effects should really not be "seen"
if the player is blind. See also "effects.c" for other "mistakes".

Perhaps monsters should breathe at locations near the player,
since this would allow them to inflict "partial" damage.

Perhaps smart monsters should decline to use "bolt" spells if
there is a monster in the way, unless they wish to kill it.

Note that, to allow the use of the "track_target" option at some
later time, certain non-optimal things are done in the code below,
including explicit checks against the "direct" variable, which is
currently always true by the time it is checked, but which should
really be set according to an explicit "projectable()" test, and
the use of generic "x,y" locations instead of the player location,
with those values being initialized with the player location.

It will not be possible to "correctly" handle the case in which a
monster attempts to attack a location which is thought to contain
the player, but which in fact is nowhere near the player, since this
might induce all sorts of messages about the attack itself, and about
the effects of the attack, which the player might or might not be in
a position to observe. Thus, for simplicity, it is probably best to
only allow "faulty" attacks by a monster if one of the important grids
(probably the initial or final grid) is in fact in view of the player.
It may be necessary to actually prevent spell attacks except when the
monster actually has line of sight to the player. Note that a monster
could be left in a bizarre situation after the player ducked behind a
pillar and then teleported away, for example.

覚え書き
that certain spell attacks do not use the "project()" function
but "simulate" it via the "direct" variable, which is always at least
as restrictive as the "project()" function. This is necessary to
prevent "blindness" attacks and such from bending around walls, etc,
and to allow the use of the "track_target" option in the future.

Note that this function attempts to optimize the use of spells for the
cases in which the monster has no spells, or has spells but cannot use
them, or has spells but they will have no "useful" effect. Note that
this function has been an efficiency bottleneck in the past.

Note the special "MFLAG_NICE" flag, which prevents a monster from using
any spell attacks until the player has had a single chance to move.

関数の呼び出しグラフ:

呼出しグラフ:

bool raise_possible ( monster_type m_ptr)

モンスターにとって死者復活を行うべき状態かどうかを返す / Determine if there is a space near the player in which a summoned creature can appear

引数
m_ptr判定を行いたいモンスターの構造体参照ポインタ
戻り値
死者復活が有効な状態ならばTRUEを返す。

関数の呼び出しグラフ:

呼出しグラフ:

static void remove_bad_spells ( int  m_idx,
u32b f4p,
u32b f5p,
u32b f6p 
)
static

モンスターの魔法一覧から戦術的に適さない魔法を除外する / Remove the "bad" spells from a spell list

引数
m_idxモンスターの構造体参照ポインタ
f4pモンスター魔法のフラグリスト1
f5pモンスター魔法のフラグリスト2
f6pモンスター魔法のフラグリスト3
戻り値
なし

関数の呼び出しグラフ:

呼出しグラフ:

static bool spell_annoy ( byte  spell)
static

ID値が妨害目的に適したモンスター魔法IDかどうかを返す / Return TRUE if a spell is good for annoying the player.

引数
spell判定対象のID
戻り値
適した魔法のIDならばTRUEを返す。

呼出しグラフ:

static bool spell_attack ( byte  spell)
static

ID値が正しいモンスター魔法IDかどうかを返す / Return TRUE if a spell is good for hurting the player (directly).

引数
spell判定対象のID
戻り値
正しいIDならばTRUEを返す。

呼出しグラフ:

static bool spell_dispel ( byte  spell)
static

ID値が魔力消去かどうかを返す / Return TRUE if a spell is good for dispel.

引数
spell判定対象のID
戻り値
魔力消去のIDならばTRUEを返す。

呼出しグラフ:

static bool spell_escape ( byte  spell)
static

ID値が退避目的に適したモンスター魔法IDかどうかを返す / Return TRUE if a spell is good for escaping.

引数
spell判定対象のID
戻り値
適した魔法のIDならばTRUEを返す。

呼出しグラフ:

static bool spell_haste ( byte  spell)
static

ID値が加速するモンスター魔法IDかどうかを返す / Return TRUE if a spell hastes.

引数
spell判定対象のID
戻り値
召喚型魔法のIDならばTRUEを返す。

呼出しグラフ:

static bool spell_heal ( byte  spell)
static

ID値が治癒魔法かどうかを返す / Return TRUE if a spell is good for healing.

引数
spell判定対象のID
戻り値
治癒魔法のIDならばTRUEを返す。

呼出しグラフ:

static bool spell_invulner ( byte  spell)
static

ID値が無敵化するモンスター魔法IDかどうかを返す / Return TRUE if a spell makes invulnerable.

引数
spell判定対象のID
戻り値
召喚型魔法のIDならばTRUEを返す。

呼出しグラフ:

bool spell_is_inate ( u16b  spell)

ID値が非魔術的な特殊技能かどうかを返す / Return TRUE if a spell is inate spell.

引数
spell判定対象のID
戻り値
非魔術的な特殊技能ならばTRUEを返す。

呼出しグラフ:

static bool spell_psy_spe ( byte  spell)
static

ID値が光の剣のモンスター魔法IDかどうかを返す / Return TRUE if a spell psycho-spear.

引数
spell判定対象のID
戻り値
光の剣のIDならばTRUEを返す。

呼出しグラフ:

static bool spell_raise ( byte  spell)
static

ID値が死者復活処理かどうかを返す / Return TRUE if a spell is good for annoying the player.

引数
spell判定対象のID
戻り値
死者復活の処理ならばTRUEを返す。

呼出しグラフ:

static bool spell_special ( byte  spell)
static

ID値が特別効果のモンスター魔法IDかどうかを返す / Return TRUE if a spell special.

引数
spell判定対象のID
戻り値
特別効果魔法のIDならばTRUEを返す。

呼出しグラフ:

static bool spell_summon ( byte  spell)
static

ID値が召喚型のモンスター魔法IDかどうかを返す / Return TRUE if a spell is good for annoying the player.

引数
spell判定対象のID
戻り値
召喚型魔法のIDならばTRUEを返す。

呼出しグラフ:

static bool spell_tactic ( byte  spell)
static

ID値が戦術的なモンスター魔法IDかどうかを返す / Return TRUE if a spell is good in a tactical situation.

引数
spell判定対象のID
戻り値
戦術的な魔法のIDならばTRUEを返す。

呼出しグラフ:

static bool spell_world ( byte  spell)
static

ID値が時間停止を行うモンスター魔法IDかどうかを返す / Return TRUE if a spell world.

引数
spell判定対象のID
戻り値
時間停止魔法のIDならばTRUEを返す。

呼出しグラフ:

bool summon_possible ( int  y1,
int  x1 
)

モンスターにとって所定の地点が召還に相応しい地点かどうかを返す。 / Determine if there is a space near the player in which a summoned creature can appear

引数
y1判定を行いたいマスのY座標
x1判定を行いたいマスのX座標
戻り値
召還に相応しいならばTRUEを返す

関数の呼び出しグラフ:

呼出しグラフ: