Hengband  2.2.1
マクロ定義 | 関数 | 変数
monster2.c ファイル

モンスター処理 / 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"
monster2.c の依存先関係図:

マクロ定義

#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_racereal_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

日付
2014/07/08
著者
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.

マクロ定義詳解

◆ HORDE_NOEVIL

#define HORDE_NOEVIL   0x02

(未実装フラグ)HORDE生成でEVILなモンスターの生成を禁止する?

◆ HORDE_NOGOOD

#define HORDE_NOGOOD   0x01

(未実装フラグ)HORDE生成でGOODなモンスターの生成を禁止する?

◆ MON_SCAT_MAXD

#define MON_SCAT_MAXD   10

mon_scatter()関数によるモンスター配置で許される中心からの最大距離

関数詳解

◆ alloc_guardian()

bool alloc_guardian ( bool  def_val)

ダンジョンの主生成を試みる / Put the Guardian

引数
def_val現在の主の生成状態
戻り値
生成に成功したらtrue
呼び出し関係図:

◆ alloc_horde()

bool alloc_horde ( POSITION  y,
POSITION  x 
)

指定地点に1種類のモンスター種族による群れを生成する

引数
y生成地点y座標
x生成地点x座標
戻り値
生成に成功したらtrue
呼び出し関係図:

◆ alloc_monster()

bool alloc_monster ( POSITION  dis,
BIT_FLAGS  mode 
)

ダンジョンの初期配置モンスターを生成1回生成する / Attempt to allocate a random monster in the dungeon.

引数
disプレイヤーから離れるべき最低距離
mode生成オプション
戻り値
生成に成功したらtrue

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

呼び出し関係図:

◆ choose_new_monster()

void choose_new_monster ( MONSTER_IDX  m_idx,
bool  born,
MONRACE_IDX  r_idx 
)

モンスターの変身処理

引数
m_idx変身処理を受けるモンスター情報のID
born生成時の初変身先指定ならばtrue
r_idx旧モンスター種族のID
戻り値
なし
呼び出し関係図:

◆ compact_monsters()

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.

呼び出し関係図:

◆ compact_monsters_aux()

static void compact_monsters_aux ( MONSTER_IDX  i1,
MONSTER_IDX  i2 
)
static

モンスター情報を配列内移動する / Move an object from index i1 to index i2 in the object list

引数
i1配列移動元添字
i2配列移動先添字
戻り値
なし
呼び出し関係図:
被呼び出し関係図:

◆ delete_monster()

void delete_monster ( POSITION  y,
POSITION  x 
)

指定位置に存在するモンスターを削除する / Delete the monster, if any, at a given location

引数
x削除位置x座標
y削除位置y座標
戻り値
なし
呼び出し関係図:

◆ delete_monster_idx()

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.

呼び出し関係図:

◆ get_mon_num()

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.

呼び出し関係図:

◆ get_mon_num_prep()

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
戻り値
エラーコード
呼び出し関係図:

◆ get_monster_crowd_number()

int get_monster_crowd_number ( MONSTER_IDX  m_idx)

指定したモンスターに隣接しているモンスターの数を返す。 / Count number of adjacent monsters

引数
m_idx隣接数を調べたいモンスターのID
戻り値
隣接しているモンスターの数

◆ get_mspeed()

SPEED get_mspeed ( monster_race r_ptr)

モンスターの個体加速を設定する / Get initial monster speed

引数
r_ptrモンスター種族の参照ポインタ
戻り値
加速値

◆ initial_r_appearance()

static MONRACE_IDX initial_r_appearance ( MONRACE_IDX  r_idx,
BIT_FLAGS  generate_mode 
)
static

モンスターの表層IDを設定する / Set initial racial appearance of a monster

引数
r_idxモンスター種族ID
戻り値
モンスター種族の表層ID
呼び出し関係図:
被呼び出し関係図:

◆ lore_do_probe()

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-

◆ lore_treasure()

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.

◆ m_pop()

MONSTER_IDX m_pop ( void  )

モンスター配列の空きを探す / Acquires and returns the index of a "free" monster.

戻り値
利用可能なモンスター配列の添字

This routine should almost never fail, but it can happen.

呼び出し関係図:

◆ message_pain()

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

呼び出し関係図:

◆ mon_scatter()

static bool mon_scatter ( MONRACE_IDX  r_idx,
POSITION yp,
POSITION xp,
POSITION  y,
POSITION  x,
POSITION  max_dist 
)
static

モンスター1体を目標地点に可能な限り近い位置に生成する / improved version of scatter() for place monster

引数
r_idx生成モンスター種族
yp結果生成位置y座標
xp結果生成位置x座標
y中心生成位置y座標
x中心生成位置x座標
max_dist生成位置の最大半径
戻り値
成功したらtrue
呼び出し関係図:
被呼び出し関係図:

◆ monster_desc()

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"

呼び出し関係図:

◆ monster_drop_carried_objects()

void monster_drop_carried_objects ( monster_type m_ptr)

モンスターが盗みや拾いで確保していたアイテムを全てドロップさせる / Drop all items carried by a monster

引数
m_ptrモンスター参照ポインタ
戻り値
なし
呼び出し関係図:

◆ monster_hook_chameleon()

static bool monster_hook_chameleon ( MONRACE_IDX  r_idx)
static

カメレオンの変身対象となるモンスターかどうか判定する / Hack – the index of the summoning monster

引数
r_idxモンスター種族ID
戻り値
対象にできるならtrueを返す
todo:
グローバル変数対策の上 monster_hook.cへ移す。
呼び出し関係図:
被呼び出し関係図:

◆ monster_hook_chameleon_lord()

static bool monster_hook_chameleon_lord ( MONRACE_IDX  r_idx)
static

カメレオンの王の変身対象となるモンスターかどうか判定する / Hack – the index of the summoning monster

引数
r_idxモンスター種族ID
戻り値
対象にできるならtrueを返す
呼び出し関係図:
被呼び出し関係図:

◆ monster_hook_tanuki()

static bool monster_hook_tanuki ( MONRACE_IDX  r_idx)
static

たぬきの変身対象となるモンスターかどうか判定する / Hook for Tanuki

引数
r_idxモンスター種族ID
戻り値
対象にできるならtrueを返す
todo:
グローバル変数対策の上 monster_hook.cへ移す。
呼び出し関係図:
被呼び出し関係図:

◆ monster_name()

void monster_name ( MONSTER_IDX  m_idx,
char *  m_name 
)

モンスターIDを取り、モンスター名をm_nameに代入する /

引数
m_idxモンスターID
m_nameモンスター名を入力する配列
呼び出し関係図:

◆ multiply_monster()

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生成オプション
戻り値
生成できたらtrueを返す

Note that "reproduction" REQUIRES empty space.

呼び出し関係図:

◆ place_monster()

bool place_monster ( POSITION  y,
POSITION  x,
BIT_FLAGS  mode 
)

一般的なモンスター生成処理のメインルーチン / Attempt to place a monster of the given race at the given location

引数
y生成地点y座標
x生成地点x座標
mode生成オプション
戻り値
生成に成功したらtrue
呼び出し関係図:

◆ place_monster_aux()

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生成オプション
戻り値
生成に成功したらtrue

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.

呼び出し関係図:

◆ place_monster_can_escort()

static bool place_monster_can_escort ( MONRACE_IDX  r_idx)
static

モンスター種族が召喚主の護衛となれるかどうかをチェックする / Hack – help pick an escort type

引数
r_idxチェックするモンスター種族のID
戻り値
護衛にできるならばtrue
呼び出し関係図:
被呼び出し関係図:

◆ place_monster_group()

static bool place_monster_group ( MONSTER_IDX  who,
POSITION  y,
POSITION  x,
MONRACE_IDX  r_idx,
BIT_FLAGS  mode 
)
static

モンスターを目標地点に集団生成する / Attempt to place a "group" of monsters around the given location

引数
who召喚主のモンスター情報ID
y中心生成位置y座標
x中心生成位置x座標
r_idx生成モンスター種族
mode生成オプション
戻り値
成功したらtrue
呼び出し関係図:
被呼び出し関係図:

◆ place_monster_one()

static bool place_monster_one ( MONSTER_IDX  who,
POSITION  y,
POSITION  x,
MONRACE_IDX  r_idx,
BIT_FLAGS  mode 
)
static

モンスターを一体生成する / Attempt to place a monster of the given race at the given location.

引数
who召喚を行ったモンスターID
y生成位置y座標
x生成位置x座標
r_idx生成モンスター種族
mode生成オプション
戻り値
成功したらtrue

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.

呼び出し関係図:
被呼び出し関係図:

◆ real_r_idx()

MONRACE_IDX real_r_idx ( monster_type m_ptr)

◆ real_r_ptr()

monster_race* real_r_ptr ( monster_type m_ptr)

モンスターの真の種族を返す / Extract monster race pointer of a monster's true form

引数
m_ptrモンスターの参照ポインタ
戻り値
本当のモンスター種族参照ポインタ
呼び出し関係図:

◆ reset_target()

void reset_target ( monster_type m_ptr)

モンスターの目標地点をリセットする / Reset the target of counter attack

引数
m_ptrモンスターの参照ポインタ
戻り値
なし
呼び出し関係図:

◆ restrict_monster_to_dungeon()

static bool restrict_monster_to_dungeon ( DUNGEON_IDX  d_idx,
MONRACE_IDX  r_idx 
)
static

指定されたモンスター種族がダンジョンの制限にかかるかどうかをチェックする / Some dungeon types restrict the possible monsters.

引数
r_idxチェックするモンスター種族ID
戻り値
召喚条件が一致するならtrue / Return TRUE is the monster is OK and FALSE otherwise
被呼び出し関係図:

◆ set_target()

void set_target ( monster_type m_ptr,
POSITION  y,
POSITION  x 
)

モンスターの目標地点をセットする / Set the target of counter attack

引数
m_ptrモンスターの参照ポインタ
y目標y座標
x目標x座標
戻り値
なし

◆ summon_named_creature()

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生成オプション
戻り値
召喚できたらtrueを返す
呼び出し関係図:

◆ summon_specific()

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生成オプション
戻り値
召喚できたらtrueを返す

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.

呼び出し関係図:

◆ summon_specific_aux()

static bool summon_specific_aux ( MONRACE_IDX  summoner_idx,
MONRACE_IDX  r_idx 
)
static

指定されたモンスター種族がsummon_specific_typeで指定された召喚条件に合うかどうかを返す

戻り値
召喚条件が一致するならtrue
呼び出し関係図:
被呼び出し関係図:

◆ summon_specific_okay()

static bool summon_specific_okay ( MONRACE_IDX  r_idx)
static

モンスターが召喚の基本条件に合っているかをチェックする / Hack – help decide if a monster race is "okay" to summon

引数
r_idxチェックするモンスター種族ID
戻り値
召喚対象にできるならばTRUE
呼び出し関係図:
被呼び出し関係図:

◆ update_monster()

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".

呼び出し関係図:

◆ update_monsters()

void update_monsters ( bool  full)

単純に生存している全モンスターの更新処理を行う / This function simply updates all the (non-dead) monsters (see above).

引数
full距離更新を行うならtrue
戻り値
なし
呼び出し関係図:

◆ update_smart_learn()

void update_smart_learn ( MONSTER_IDX  m_idx,
int  what 
)

SMART(適格に攻撃を行う)モンスターの学習状況を更新する / Learn about an "observed" resistance.

引数
m_idx更新を行う「モンスター情報ID
what学習対象ID
戻り値
なし

◆ wipe_m_list()

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.

呼び出し関係図:

変数詳解

◆ chameleon_change_m_idx

chameleon_change_m_idx = 0
static

カメレオンの変身先モンスターIDを受け渡すためのグローバル変数

todo:
変数渡しの問題などもあるができればchameleon_change_m_idxのグローバル変数を除去し、関数引き渡しに移行すること

◆ get_mon_num2_hook

monsterrace_hook_type get_mon_num2_hook

◆ get_mon_num_hook

monsterrace_hook_type get_mon_num_hook

◆ hack_m_idx

MONSTER_IDX hack_m_idx = 0

◆ hack_m_idx_ii

MONSTER_IDX hack_m_idx_ii = 0

◆ place_monster_idx

place_monster_idx = 0
static

護衛対象となるモンスター種族IDを渡すグローバル変数 / Hack – help pick an escort type

todo:
関数ポインタの都合を配慮しながら、グローバル変数place_monster_idxを除去し、関数引数化する

◆ place_monster_m_idx

place_monster_m_idx = 0
static

護衛対象となるモンスターIDを渡すグローバル変数 / Hack – help pick an escort type

todo:
関数ポインタの都合を配慮しながら、グローバル変数place_monster_m_idxを除去し、関数引数化する

◆ summon_specific_type

summon_specific_type = 0
static

召喚条件を指定するグローバル変数 / Hack – the "type" of the current "summon specific"

todo:
summon_specific_typeグローバル変数の除去と関数引数への代替を行う

◆ summon_specific_who

summon_specific_who = -1
static

召喚を行ったプレイヤーあるいはモンスターのIDを示すグローバル変数 / Hack – the index of the summoning monster

todo:
summon_specific_who グローバル変数の除去と関数引数への代替を行う

◆ summon_unique_okay

summon_unique_okay = FALSE
static

召喚対象にユニークを含めるかを示すグローバル変数 / summoning unique enable

todo:
summon_unique_okay グローバル変数の除去と関数引数への代替を行う