Hengband
2.2.1
|
モンスター処理 / misc code for monsters [詳解]
#include "angband.h"
#include "util.h"
#include "core.h"
#include "cmd-dump.h"
#include "cmd-pet.h"
#include "dungeon.h"
#include "floor.h"
#include "object-flavor.h"
#include "monsterrace-hook.h"
#include "monster-status.h"
#include "monster.h"
#include "spells.h"
#include "spells-summon.h"
#include "quest.h"
#include "grid.h"
#include "player-move.h"
#include "player-status.h"
#include "player-race.h"
#include "player-class.h"
#include "player-personality.h"
#include "wild.h"
#include "warning.h"
#include "monster-spell.h"
#include "files.h"
#include "view-mainwindow.h"
#include "world.h"
#include "monsterrace.h"
#include "creature.h"
#include "targeting.h"
#include "realm-song.h"
#include "melee.h"
マクロ定義 | |
#define | HORDE_NOGOOD 0x01 |
(未実装フラグ)HORDE生成でGOODなモンスターの生成を禁止する? [詳解] | |
#define | HORDE_NOEVIL 0x02 |
(未実装フラグ)HORDE生成でEVILなモンスターの生成を禁止する? [詳解] | |
#define | MON_SCAT_MAXD 10 |
mon_scatter()関数によるモンスター配置で許される中心からの最大距離 [詳解] | |
関数 | |
void | set_target (monster_type *m_ptr, POSITION y, POSITION x) |
モンスターの目標地点をセットする / Set the target of counter attack [詳解] | |
void | reset_target (monster_type *m_ptr) |
モンスターの目標地点をリセットする / Reset the target of counter attack [詳解] | |
monster_race * | real_r_ptr (monster_type *m_ptr) |
モンスターの真の種族を返す / Extract monster race pointer of a monster's true form [詳解] | |
MONRACE_IDX | real_r_idx (monster_type *m_ptr) |
void | delete_monster_idx (MONSTER_IDX i) |
モンスター配列からモンスターを消去する / Delete a monster by index. [詳解] | |
void | delete_monster (POSITION y, POSITION x) |
指定位置に存在するモンスターを削除する / Delete the monster, if any, at a given location [詳解] | |
static void | compact_monsters_aux (MONSTER_IDX i1, MONSTER_IDX i2) |
モンスター情報を配列内移動する / Move an object from index i1 to index i2 in the object list [詳解] | |
void | compact_monsters (int size) |
モンスター情報配列を圧縮する / Compact and Reorder the monster list [詳解] | |
void | wipe_m_list (void) |
プレイヤーのフロア離脱に伴う全モンスター配列の消去 / Delete/Remove all the monsters when the player leaves the level [詳解] | |
MONSTER_IDX | m_pop (void) |
モンスター配列の空きを探す / Acquires and returns the index of a "free" monster. [詳解] | |
static bool | summon_specific_aux (MONRACE_IDX summoner_idx, MONRACE_IDX r_idx) |
指定されたモンスター種族がsummon_specific_typeで指定された召喚条件に合うかどうかを返す [詳解] | |
static bool | restrict_monster_to_dungeon (DUNGEON_IDX d_idx, MONRACE_IDX r_idx) |
指定されたモンスター種族がダンジョンの制限にかかるかどうかをチェックする / Some dungeon types restrict the possible monsters. [詳解] | |
errr | get_mon_num_prep (monsterrace_hook_type monster_hook, monsterrace_hook_type monster_hook2) |
モンスター生成制限関数最大2つから / Apply a "monster restriction function" to the "monster allocation table" [詳解] | |
MONRACE_IDX | get_mon_num (DEPTH level) |
生成モンスター種族を1種生成テーブルから選択する [詳解] | |
void | monster_desc (char *desc, monster_type *m_ptr, BIT_FLAGS mode) |
モンスターの呼称を作成する / Build a string describing a monster in some way. [詳解] | |
void | monster_name (MONSTER_IDX m_idx, char *m_name) |
モンスターIDを取り、モンスター名をm_nameに代入する / [詳解] | |
int | lore_do_probe (MONRACE_IDX r_idx) |
モンスターの調査による思い出補完処理 / Learn about a monster (by "probing" it) [詳解] | |
void | lore_treasure (MONSTER_IDX m_idx, ITEM_NUMBER num_item, ITEM_NUMBER num_gold) |
モンスターの撃破に伴うドロップ情報の保管処理 / Take note that the given monster just dropped some treasure [詳解] | |
void | update_monster (MONSTER_IDX m_idx, bool full) |
モンスターの各情報を更新する / This function updates the monster record of the given monster [詳解] | |
void | update_monsters (bool full) |
単純に生存している全モンスターの更新処理を行う / This function simply updates all the (non-dead) monsters (see above). [詳解] | |
static bool | monster_hook_chameleon_lord (MONRACE_IDX r_idx) |
カメレオンの王の変身対象となるモンスターかどうか判定する / Hack – the index of the summoning monster [詳解] | |
static bool | monster_hook_chameleon (MONRACE_IDX r_idx) |
カメレオンの変身対象となるモンスターかどうか判定する / Hack – the index of the summoning monster [詳解] | |
void | choose_new_monster (MONSTER_IDX m_idx, bool born, MONRACE_IDX r_idx) |
モンスターの変身処理 [詳解] | |
static bool | monster_hook_tanuki (MONRACE_IDX r_idx) |
たぬきの変身対象となるモンスターかどうか判定する / Hook for Tanuki [詳解] | |
static MONRACE_IDX | initial_r_appearance (MONRACE_IDX r_idx, BIT_FLAGS generate_mode) |
モンスターの表層IDを設定する / Set initial racial appearance of a monster [詳解] | |
SPEED | get_mspeed (monster_race *r_ptr) |
モンスターの個体加速を設定する / Get initial monster speed [詳解] | |
static bool | place_monster_one (MONSTER_IDX who, POSITION y, POSITION x, MONRACE_IDX r_idx, BIT_FLAGS mode) |
モンスターを一体生成する / Attempt to place a monster of the given race at the given location. [詳解] | |
static bool | mon_scatter (MONRACE_IDX r_idx, POSITION *yp, POSITION *xp, POSITION y, POSITION x, POSITION max_dist) |
モンスター1体を目標地点に可能な限り近い位置に生成する / improved version of scatter() for place monster [詳解] | |
static bool | place_monster_group (MONSTER_IDX who, POSITION y, POSITION x, MONRACE_IDX r_idx, BIT_FLAGS mode) |
モンスターを目標地点に集団生成する / Attempt to place a "group" of monsters around the given location [詳解] | |
static bool | place_monster_can_escort (MONRACE_IDX r_idx) |
モンスター種族が召喚主の護衛となれるかどうかをチェックする / Hack – help pick an escort type [詳解] | |
bool | place_monster_aux (MONSTER_IDX who, POSITION y, POSITION x, MONRACE_IDX r_idx, BIT_FLAGS mode) |
一般的なモンスター生成処理のサブルーチン / Attempt to place a monster of the given race at the given location [詳解] | |
bool | place_monster (POSITION y, POSITION x, BIT_FLAGS mode) |
一般的なモンスター生成処理のメインルーチン / Attempt to place a monster of the given race at the given location [詳解] | |
bool | alloc_horde (POSITION y, POSITION x) |
指定地点に1種類のモンスター種族による群れを生成する [詳解] | |
bool | alloc_guardian (bool def_val) |
ダンジョンの主生成を試みる / Put the Guardian [詳解] | |
bool | alloc_monster (POSITION dis, BIT_FLAGS mode) |
ダンジョンの初期配置モンスターを生成1回生成する / Attempt to allocate a random monster in the dungeon. [詳解] | |
static bool | summon_specific_okay (MONRACE_IDX r_idx) |
モンスターが召喚の基本条件に合っているかをチェックする / Hack – help decide if a monster race is "okay" to summon [詳解] | |
bool | summon_specific (MONSTER_IDX who, POSITION y1, POSITION x1, DEPTH lev, int type, BIT_FLAGS mode) |
モンスターを召喚により配置する / Place a monster (of the specified "type") near the given location. [詳解] | |
bool | summon_named_creature (MONSTER_IDX who, POSITION oy, POSITION ox, MONRACE_IDX r_idx, BIT_FLAGS mode) |
特定モンスター種族を召喚により生成する / A "dangerous" function, creates a pet of the specified type [詳解] | |
bool | multiply_monster (MONSTER_IDX m_idx, bool clone, BIT_FLAGS mode) |
モンスターを増殖生成する / Let the given monster attempt to reproduce. [詳解] | |
void | message_pain (MONSTER_IDX m_idx, HIT_POINT dam) |
ダメージを受けたモンスターの様子を記述する / Dump a message describing a monster's reaction to damage [詳解] | |
void | update_smart_learn (MONSTER_IDX m_idx, int what) |
SMART(適格に攻撃を行う)モンスターの学習状況を更新する / Learn about an "observed" resistance. [詳解] | |
void | monster_drop_carried_objects (monster_type *m_ptr) |
モンスターが盗みや拾いで確保していたアイテムを全てドロップさせる / Drop all items carried by a monster [詳解] | |
int | get_monster_crowd_number (MONSTER_IDX m_idx) |
指定したモンスターに隣接しているモンスターの数を返す。 / Count number of adjacent monsters [詳解] | |
変数 | |
MONSTER_IDX | hack_m_idx = 0 |
MONSTER_IDX | hack_m_idx_ii = 0 |
static int | summon_specific_type = 0 |
召喚条件を指定するグローバル変数 / Hack – the "type" of the current "summon specific" [詳解] | |
static int | summon_specific_who = -1 |
召喚を行ったプレイヤーあるいはモンスターのIDを示すグローバル変数 / Hack – the index of the summoning monster [詳解] | |
static bool | summon_unique_okay = FALSE |
召喚対象にユニークを含めるかを示すグローバル変数 / summoning unique enable [詳解] | |
static int | chameleon_change_m_idx = 0 |
カメレオンの変身先モンスターIDを受け渡すためのグローバル変数 [詳解] | |
monsterrace_hook_type | get_mon_num_hook |
monsterrace_hook_type | get_mon_num2_hook |
static MONSTER_IDX | place_monster_idx = 0 |
護衛対象となるモンスター種族IDを渡すグローバル変数 / Hack – help pick an escort type [詳解] | |
static MONSTER_IDX | place_monster_m_idx = 0 |
護衛対象となるモンスターIDを渡すグローバル変数 / Hack – help pick an escort type [詳解] | |
モンスター処理 / misc code for monsters
#define HORDE_NOEVIL 0x02 |
(未実装フラグ)HORDE生成でEVILなモンスターの生成を禁止する?
#define HORDE_NOGOOD 0x01 |
(未実装フラグ)HORDE生成でGOODなモンスターの生成を禁止する?
#define MON_SCAT_MAXD 10 |
mon_scatter()関数によるモンスター配置で許される中心からの最大距離
ダンジョンの主生成を試みる / Put the Guardian
def_val | 現在の主の生成状態 |
指定地点に1種類のモンスター種族による群れを生成する
y | 生成地点y座標 |
x | 生成地点x座標 |
ダンジョンの初期配置モンスターを生成1回生成する / Attempt to allocate a random monster in the dungeon.
dis | プレイヤーから離れるべき最低距離 |
mode | 生成オプション |
Place the monster at least "dis" distance from the player. Use "slp" to choose the initial "sleep" status Use "p_ptr->current_floor_ptr->monster_level" for the monster level
void choose_new_monster | ( | MONSTER_IDX | m_idx, |
bool | born, | ||
MONRACE_IDX | r_idx | ||
) |
モンスターの変身処理
m_idx | 変身処理を受けるモンスター情報のID |
born | 生成時の初変身先指定ならばtrue |
r_idx | 旧モンスター種族のID |
void compact_monsters | ( | int | size | ) |
モンスター情報配列を圧縮する / Compact and Reorder the monster list
size | 圧縮後のモンスター件数目標 |
This function can be very dangerous, use with caution!
When actually "compacting" monsters, we base the saving throw on a combination of monster level, distance from player, and current "desperation".
After "compacting" (if needed), we "reorder" the monsters into a more compact order, and we reset the allocation info, and the "live" array.
|
static |
モンスター情報を配列内移動する / Move an object from index i1 to index i2 in the object list
i1 | 配列移動元添字 |
i2 | 配列移動先添字 |
指定位置に存在するモンスターを削除する / Delete the monster, if any, at a given location
x | 削除位置x座標 |
y | 削除位置y座標 |
void delete_monster_idx | ( | MONSTER_IDX | i | ) |
モンスター配列からモンスターを消去する / Delete a monster by index.
i | 消去するモンスターのID |
モンスターを削除するとそのモンスターが拾っていたアイテムも同時に削除される。 / When a monster is deleted, all of its objects are deleted.
MONRACE_IDX get_mon_num | ( | DEPTH | level | ) |
生成モンスター種族を1種生成テーブルから選択する
level | 生成階 |
Choose a monster race that seems "appropriate" to the given level
This function uses the "prob2" field of the "monster allocation table", and various local information, to calculate the "prob3" field of the same table, which is then used to choose an "appropriate" monster, in a relatively efficient manner.
Note that "town" monsters will only be created in the town, and "normal" monsters will never be created in the town, unless the "level" is "modified", for example, by polymorph or summoning.
There is a small chance (1/50) of "boosting" the given depth by a small amount (up to four levels), except in the town.
It is (slightly) more likely to acquire a monster of the given level than one of a lower level. This is done by choosing several monsters appropriate to the given level and keeping the "hardest" one.
Note that if no monsters are "appropriate", then this function will fail, and return zero, but this should almost never happen.
errr get_mon_num_prep | ( | monsterrace_hook_type | monster_hook, |
monsterrace_hook_type | monster_hook2 | ||
) |
モンスター生成制限関数最大2つから / Apply a "monster restriction function" to the "monster allocation table"
monster_hook | 制限関数1 |
monster_hook2 | 制限関数2 |
int get_monster_crowd_number | ( | MONSTER_IDX | m_idx | ) |
指定したモンスターに隣接しているモンスターの数を返す。 / Count number of adjacent monsters
m_idx | 隣接数を調べたいモンスターのID |
SPEED get_mspeed | ( | monster_race * | r_ptr | ) |
モンスターの個体加速を設定する / Get initial monster speed
r_ptr | モンスター種族の参照ポインタ |
|
static |
モンスターの表層IDを設定する / Set initial racial appearance of a monster
r_idx | モンスター種族ID |
int lore_do_probe | ( | MONRACE_IDX | r_idx | ) |
モンスターの調査による思い出補完処理 / Learn about a monster (by "probing" it)
r_idx | 補完されるモンスター種族ID |
Return the number of new flags learnt. -Mogami-
void lore_treasure | ( | MONSTER_IDX | m_idx, |
ITEM_NUMBER | num_item, | ||
ITEM_NUMBER | num_gold | ||
) |
モンスターの撃破に伴うドロップ情報の保管処理 / Take note that the given monster just dropped some treasure
m_idx | モンスター情報のID |
num_item | 手に入れたアイテム数 |
num_gold | 手に入れた財宝の単位数 |
Note that learning the "GOOD"/"GREAT" flags gives information about the treasure (even when the monster is killed for the first time, such as uniques, and the treasure has not been examined yet).
This "indirect" method is used to prevent the player from learning exactly how much treasure a monster can drop from observing only a single example of a drop. This method actually observes how much gold and items are dropped, and remembers that information to be described later by the monster recall code.
MONSTER_IDX m_pop | ( | void | ) |
モンスター配列の空きを探す / Acquires and returns the index of a "free" monster.
This routine should almost never fail, but it can happen.
void message_pain | ( | MONSTER_IDX | m_idx, |
HIT_POINT | dam | ||
) |
ダメージを受けたモンスターの様子を記述する / Dump a message describing a monster's reaction to damage
m_idx | モンスター情報ID |
dam | 与えたダメージ |
Technically should attempt to treat "Beholder"'s as jelly's
|
static |
モンスター1体を目標地点に可能な限り近い位置に生成する / improved version of scatter() for place monster
r_idx | 生成モンスター種族 |
yp | 結果生成位置y座標 |
xp | 結果生成位置x座標 |
y | 中心生成位置y座標 |
x | 中心生成位置x座標 |
max_dist | 生成位置の最大半径 |
void monster_desc | ( | char * | desc, |
monster_type * | m_ptr, | ||
BIT_FLAGS | mode | ||
) |
モンスターの呼称を作成する / Build a string describing a monster in some way.
desc | 記述出力先の文字列参照ポインタ |
m_ptr | モンスターの参照ポインタ |
mode | 呼称オプション |
We can correctly describe monsters based on their visibility. We can force all monsters to be treated as visible or invisible. We can build nominatives, objectives, possessives, or reflexives. We can selectively pronominalize hidden, visible, or all monsters. We can use definite or indefinite descriptions for hidden monsters. We can use definite or indefinite descriptions for visible monsters.
Pronominalization involves the gender whenever possible and allowed, so that by cleverly requesting pronominalization / visibility, you can get messages like "You hit someone. She screams in agony!".
Reflexives are acquired by requesting Objective plus Possessive.
If no m_ptr arg is given (?), the monster is assumed to be hidden, unless the "Assume Visible" mode is requested.
If no r_ptr arg is given, it is extracted from m_ptr and r_info If neither m_ptr nor r_ptr is given, the monster is assumed to be neuter, singular, and hidden (unless "Assume Visible" is set), in which case you may be in trouble... :-)
I am assuming that no monster name is more than 70 characters long, so that "char desc[80];" is sufficiently large for any result.
Mode Flags: MD_OBJECTIVE --> Objective (or Reflexive) MD_POSSESSIVE --> Possessive (or Reflexive) MD_INDEF_HIDDEN --> Use indefinites for hidden monsters ("something") MD_INDEF_VISIBLE --> Use indefinites for visible monsters ("a kobold") MD_PRON_HIDDEN --> Pronominalize hidden monsters MD_PRON_VISIBLE --> Pronominalize visible monsters MD_ASSUME_HIDDEN --> Assume the monster is hidden MD_ASSUME_VISIBLE --> Assume the monster is visible MD_TRUE_NAME --> Chameleon's true name MD_IGNORE_HALLU --> Ignore hallucination, and penetrate shape change
Useful Modes: 0x00 --> Full nominative name ("the kobold") or "it" MD_INDEF_HIDDEN --> Full nominative name ("the kobold") or "something" MD_ASSUME_VISIBLE --> Genocide resistance name ("the kobold") MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE --> Killing name ("a kobold") MD_PRON_VISIBLE | MD_POSSESSIVE --> Possessive, genderized if visable ("his") or "its" MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE --> Reflexive, genderized if visable ("himself") or "itself"
void monster_drop_carried_objects | ( | monster_type * | m_ptr | ) |
モンスターが盗みや拾いで確保していたアイテムを全てドロップさせる / Drop all items carried by a monster
m_ptr | モンスター参照ポインタ |
|
static |
カメレオンの変身対象となるモンスターかどうか判定する / Hack – the index of the summoning monster
r_idx | モンスター種族ID |
|
static |
カメレオンの王の変身対象となるモンスターかどうか判定する / Hack – the index of the summoning monster
r_idx | モンスター種族ID |
|
static |
たぬきの変身対象となるモンスターかどうか判定する / Hook for Tanuki
r_idx | モンスター種族ID |
void monster_name | ( | MONSTER_IDX | m_idx, |
char * | m_name | ||
) |
モンスターIDを取り、モンスター名をm_nameに代入する /
m_idx | モンスターID |
m_name | モンスター名を入力する配列 |
bool multiply_monster | ( | MONSTER_IDX | m_idx, |
bool | clone, | ||
BIT_FLAGS | mode | ||
) |
モンスターを増殖生成する / Let the given monster attempt to reproduce.
m_idx | 増殖するモンスター情報ID |
clone | クローン・モンスター処理ならばtrue |
mode | 生成オプション |
Note that "reproduction" REQUIRES empty space.
一般的なモンスター生成処理のメインルーチン / Attempt to place a monster of the given race at the given location
y | 生成地点y座標 |
x | 生成地点x座標 |
mode | 生成オプション |
bool place_monster_aux | ( | MONSTER_IDX | who, |
POSITION | y, | ||
POSITION | x, | ||
MONRACE_IDX | r_idx, | ||
BIT_FLAGS | mode | ||
) |
一般的なモンスター生成処理のサブルーチン / Attempt to place a monster of the given race at the given location
who | 召喚主のモンスター情報ID |
y | 生成地点y座標 |
x | 生成地点x座標 |
r_idx | 生成するモンスターの種族ID |
mode | 生成オプション |
Note that certain monsters are now marked as requiring "friends". These monsters, if successfully placed, and if the "grp" parameter is TRUE, will be surrounded by a "group" of identical monsters.
Note that certain monsters are now marked as requiring an "escort", which is a collection of monsters with similar "race" but lower level.
Some monsters induce a fake "group" flag on their escorts.
Note the "bizarre" use of non-recursion to prevent annoying output when running a code profiler.
Note the use of the new "monster allocation table" code to restrict the "get_mon_num()" function to "legal" escort types.
|
static |
モンスター種族が召喚主の護衛となれるかどうかをチェックする / Hack – help pick an escort type
r_idx | チェックするモンスター種族のID |
|
static |
モンスターを目標地点に集団生成する / Attempt to place a "group" of monsters around the given location
who | 召喚主のモンスター情報ID |
y | 中心生成位置y座標 |
x | 中心生成位置x座標 |
r_idx | 生成モンスター種族 |
mode | 生成オプション |
|
static |
モンスターを一体生成する / Attempt to place a monster of the given race at the given location.
who | 召喚を行ったモンスターID |
y | 生成位置y座標 |
x | 生成位置x座標 |
r_idx | 生成モンスター種族 |
mode | 生成オプション |
To give the player a sporting chance, any monster that appears in line-of-sight and is extremely dangerous can be marked as "FORCE_SLEEP", which will cause them to be placed with low energy, which often (but not always) lets the player move before they do.
This routine refuses to place out-of-depth "FORCE_DEPTH" monsters.
Use special "here" and "dead" flags for unique monsters, remove old "cur_num" and "max_num" fields.
Actually, do something similar for artifacts, to simplify the "preserve" mode, and to make the "what artifacts" flag more useful.
This is the only function which may place a monster in the dungeon, except for the savefile loading code.
MONRACE_IDX real_r_idx | ( | monster_type * | m_ptr | ) |
monster_race* real_r_ptr | ( | monster_type * | m_ptr | ) |
モンスターの真の種族を返す / Extract monster race pointer of a monster's true form
m_ptr | モンスターの参照ポインタ |
void reset_target | ( | monster_type * | m_ptr | ) |
モンスターの目標地点をリセットする / Reset the target of counter attack
m_ptr | モンスターの参照ポインタ |
|
static |
指定されたモンスター種族がダンジョンの制限にかかるかどうかをチェックする / Some dungeon types restrict the possible monsters.
r_idx | チェックするモンスター種族ID |
void set_target | ( | monster_type * | m_ptr, |
POSITION | y, | ||
POSITION | x | ||
) |
モンスターの目標地点をセットする / Set the target of counter attack
m_ptr | モンスターの参照ポインタ |
y | 目標y座標 |
x | 目標x座標 |
bool summon_named_creature | ( | MONSTER_IDX | who, |
POSITION | oy, | ||
POSITION | ox, | ||
MONRACE_IDX | r_idx, | ||
BIT_FLAGS | mode | ||
) |
特定モンスター種族を召喚により生成する / A "dangerous" function, creates a pet of the specified type
who | 召喚主のモンスター情報ID |
oy | 目標地点y座標 |
ox | 目標地点x座標 |
r_idx | 生成するモンスター種族ID |
mode | 生成オプション |
bool summon_specific | ( | MONSTER_IDX | who, |
POSITION | y1, | ||
POSITION | x1, | ||
DEPTH | lev, | ||
int | type, | ||
BIT_FLAGS | mode | ||
) |
モンスターを召喚により配置する / Place a monster (of the specified "type") near the given location.
Return TRUE if a monster was actually summoned.
who | 召喚主のモンスター情報ID |
y1 | 目標地点y座標 |
x1 | 目標地点x座標 |
lev | 相当生成階 |
type | 召喚種別 |
mode | 生成オプション |
We will attempt to place the monster up to 10 times before giving up.
Note: SUMMON_UNIQUE and SUMMON_AMBERITES will summon Unique's Note: SUMMON_HI_UNDEAD and SUMMON_HI_DRAGON may summon Unique's Note: None of the other summon codes will ever summon Unique's.
This function has been changed. We now take the "monster level" of the summoning monster as a parameter, and use that, along with the current dungeon level, to help determine the level of the desired monster. Note that this is an upper bound, and also tends to "prefer" monsters of that level. Currently, we use the average of the dungeon and monster levels, and then add five to allow slight increases in monster power.
Note that we use the new "monster allocation table" creation code to restrict the "get_mon_num()" function to the set of "legal" monsters, making this function much faster and more reliable.
Note that this function may not succeed, though this is very rare.
|
static |
指定されたモンスター種族がsummon_specific_typeで指定された召喚条件に合うかどうかを返す
|
static |
モンスターが召喚の基本条件に合っているかをチェックする / Hack – help decide if a monster race is "okay" to summon
r_idx | チェックするモンスター種族ID |
void update_monster | ( | MONSTER_IDX | m_idx, |
bool | full | ||
) |
モンスターの各情報を更新する / This function updates the monster record of the given monster
m_idx | 更新するモンスター情報のID |
full | プレイヤーとの距離更新を行うならばtrue |
This involves extracting the distance to the player (if requested), and then checking for visibility (natural, infravision, see-invis, telepathy), updating the monster visibility flag, redrawing (or erasing) the monster when its visibility changes, and taking note of any interesting monster flags (cold-blooded, invisible, etc).
Note the new "mflag" field which encodes several monster state flags, including "view" for when the monster is currently in line of sight, and "mark" for when the monster is currently visible via detection.
The only monster fields that are changed here are "cdis" (the distance from the player), "ml" (visible to the player), and "mflag" (to maintain the "MFLAG_VIEW" flag).
Note the special "update_monsters()" function which can be used to call this function once for every monster.
Note the "full" flag which requests that the "cdis" field be updated, this is only needed when the monster (or the player) has moved.
Every time a monster moves, we must call this function for that monster, and update the distance, and the visibility. Every time the player moves, we must call this function for every monster, and update the distance, and the visibility. Whenever the player "state" changes in certain ways ("blindness", "infravision", "telepathy", and "see invisible"), we must call this function for every monster, and update the visibility.
Routines that change the "illumination" of a grid must also call this function for any monster in that grid, since the "visibility" of some monsters may be based on the illumination of their grid.
Note that this function is called once per monster every time the player moves. When the player is running, this function is one of the primary bottlenecks, along with "update_view()" and the "process_monsters()" code, so efficiency is important.
Note the optimized "inline" version of the "distance()" function.
A monster is "visible" to the player if (1) it has been detected by the player, (2) it is close to the player and the player has telepathy, or (3) it is close to the player, and in line of sight of the player, and it is "illuminated" by some combination of infravision, torch light, or permanent light (invisible monsters are only affected by "light" if the player can see invisible).
Monsters which are not on the current panel may be "visible" to the player, and their descriptions will include an "offscreen" reference. Currently, offscreen monsters cannot be targetted or viewed directly, but old targets will remain set. XXX XXX
The player can choose to be disturbed by several things, including "disturb_move" (monster which is viewable moves in some way), and "disturb_near" (monster which is "easily" viewable moves in some way). Note that "moves" includes "appears" and "disappears".
void update_monsters | ( | bool | full | ) |
単純に生存している全モンスターの更新処理を行う / This function simply updates all the (non-dead) monsters (see above).
full | 距離更新を行うならtrue |
void update_smart_learn | ( | MONSTER_IDX | m_idx, |
int | what | ||
) |
SMART(適格に攻撃を行う)モンスターの学習状況を更新する / Learn about an "observed" resistance.
m_idx | 更新を行う「モンスター情報ID |
what | 学習対象ID |
void wipe_m_list | ( | void | ) |
プレイヤーのフロア離脱に伴う全モンスター配列の消去 / Delete/Remove all the monsters when the player leaves the level
This is an efficient method of simulating multiple calls to the "delete_monster()" function, with no visual effects.
|
static |
カメレオンの変身先モンスターIDを受け渡すためのグローバル変数
monsterrace_hook_type get_mon_num2_hook |
monsterrace_hook_type get_mon_num_hook |
MONSTER_IDX hack_m_idx = 0 |
MONSTER_IDX hack_m_idx_ii = 0 |
|
static |
護衛対象となるモンスター種族IDを渡すグローバル変数 / Hack – help pick an escort type
|
static |
護衛対象となるモンスターIDを渡すグローバル変数 / Hack – help pick an escort type
|
static |
召喚条件を指定するグローバル変数 / Hack – the "type" of the current "summon specific"
|
static |
召喚を行ったプレイヤーあるいはモンスターのIDを示すグローバル変数 / Hack – the index of the summoning monster