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

魔法効果の実装/ Spell code (part 3) [詳解]

#include "angband.h"
#include "bldg.h"
#include "core.h"
#include "term.h"
#include "util.h"
#include "object-ego.h"
#include "creature.h"
#include "dungeon.h"
#include "floor.h"
#include "floor-town.h"
#include "object-boost.h"
#include "object-flavor.h"
#include "object-hook.h"
#include "melee.h"
#include "player-move.h"
#include "player-status.h"
#include "player-class.h"
#include "player-damage.h"
#include "player-inventory.h"
#include "spells-summon.h"
#include "quest.h"
#include "artifact.h"
#include "avatar.h"
#include "spells.h"
#include "spells-floor.h"
#include "grid.h"
#include "monster-process.h"
#include "monster-status.h"
#include "monster-spell.h"
#include "cmd-spell.h"
#include "cmd-dump.h"
#include "snipe.h"
#include "floor-save.h"
#include "files.h"
#include "player-effects.h"
#include "player-skill.h"
#include "player-personality.h"
#include "view-mainwindow.h"
#include "mind.h"
#include "wild.h"
#include "world.h"
#include "objectkind.h"
#include "autopick.h"
#include "targeting.h"
spells3.c の依存先関係図:

マクロ定義

#define MAX_TRIES   100
 テレポート先探索の試行数 / Maximum number of tries for teleporting [詳解]
 
#define MANA_CONST   2400
 
#define MANA_DIV   4
 
#define DEC_MANA_DIV   3
 

関数

bool teleport_away (player_type *caster_ptr, MONSTER_IDX m_idx, POSITION dis, BIT_FLAGS mode)
 モンスターのテレポートアウェイ処理 / Teleport a monster, normally up to "dis" grids away. [詳解]
 
void teleport_monster_to (MONSTER_IDX m_idx, POSITION ty, POSITION tx, int power, BIT_FLAGS mode)
 モンスターを指定された座標付近にテレポートする / Teleport monster next to a grid near the given location [詳解]
 
bool teleport_player_aux (player_type *creature_ptr, POSITION dis, BIT_FLAGS mode)
 プレイヤーのテレポート先選定と移動処理 / Teleport the player to a location up to "dis" grids away. [詳解]
 
void teleport_player (POSITION dis, BIT_FLAGS mode)
 プレイヤーのテレポート処理メインルーチン [詳解]
 
void teleport_player_away (MONSTER_IDX m_idx, POSITION dis)
 プレイヤーのテレポートアウェイ処理 / [詳解]
 
void teleport_player_to (player_type *creature_ptr, POSITION ny, POSITION nx, BIT_FLAGS mode)
 プレイヤーを指定位置近辺にテレポートさせる Teleport player to a grid near the given location [詳解]
 
void teleport_away_followable (MONSTER_IDX m_idx)
 
bool teleport_level_other (player_type *creature_ptr)
 
void teleport_level (player_type *creature_ptr, MONSTER_IDX m_idx)
 プレイヤー及びモンスターをレベルテレポートさせる / Teleport the player one level up or down (random when legal) [詳解]
 
bool recall_player (player_type *creature_ptr, TIME_EFFECT turns)
 プレイヤーの帰還発動及び中止処理 / Recall the player to town or dungeon [詳解]
 
bool free_level_recall (player_type *creature_ptr)
 
bool reset_recall (void)
 フロア・リセット処理 [詳解]
 
bool apply_disenchant (player_type *target_ptr, BIT_FLAGS mode)
 プレイヤーの装備劣化処理 / Apply disenchantment to the player's stuff [詳解]
 
static bool vanish_dungeon (floor_type *floor_ptr)
 虚無招来によるフロア中の全壁除去処理 / Vanish all walls in this floor [詳解]
 
void call_the_void (player_type *caster_ptr)
 虚無招来処理 / [詳解]
 
void fetch (player_type *caster_ptr, DIRECTION dir, WEIGHT wgt, bool require_los)
 アイテム引き寄せ処理 / Fetch an item (teleport it right underneath the caster) [詳解]
 
void alter_reality (void)
 現実変容処理 [詳解]
 
void identify_pack (void)
 全所持アイテム鑑定処理 / Identify everything being carried. [詳解]
 
static int remove_curse_aux (player_type *creature_ptr, int all)
 装備の解呪処理 / Removes curses from items in p_ptr->inventory_list [詳解]
 
int remove_curse (player_type *caster_ptr)
 装備の軽い呪い解呪処理 / Remove most curses [詳解]
 
int remove_all_curse (player_type *caster_ptr)
 装備の重い呪い解呪処理 / Remove all curses [詳解]
 
bool alchemy (void)
 アイテムの価値に応じた錬金術処理 / Turns an object into gold, gain some of its value in a shop [詳解]
 
bool artifact_scroll (void)
 アーティファクト生成の巻物処理 / [詳解]
 
bool identify_item (object_type *o_ptr)
 アイテム鑑定処理 / Identify an object [詳解]
 
bool ident_spell (bool only_equip)
 アイテム鑑定のメインルーチン処理 / Identify an object in the p_ptr->inventory_list (or on the floor) [詳解]
 
bool mundane_spell (bool only_equip)
 アイテム凡庸化のメインルーチン処理 / Identify an object in the p_ptr->inventory_list (or on the floor) [詳解]
 
bool identify_fully (bool only_equip)
 アイテム*鑑定*のメインルーチン処理 / Identify an object in the p_ptr->inventory_list (or on the floor) [詳解]
 
bool recharge (int power)
 魔力充填処理 / Recharge a wand/staff/rod from the pack or on the floor. [詳解]
 
void display_spell_list (player_type *caster_ptr)
 クリーチャー全既知呪文を表示する / Hack – Display all known spells in a window [詳解]
 
EXP experience_of_spell (SPELL_IDX spell, REALM_IDX use_realm)
 呪文の経験値を返す / Returns experience of a spell [詳解]
 
MANA_POINT mod_need_mana (MANA_POINT need_mana, SPELL_IDX spell, REALM_IDX realm)
 呪文の消費MPを返す / Modify mana consumption rate using spell exp and p_ptr->dec_mana [詳解]
 
PERCENTAGE mod_spell_chance_1 (PERCENTAGE chance)
 呪文の失敗率修正処理1(呪い、消費魔力減少、呪文簡易化) / Modify spell fail rate Using p_ptr->to_m_chance, p_ptr->dec_mana, p_ptr->easy_spell and p_ptr->heavy_spell [詳解]
 
PERCENTAGE mod_spell_chance_2 (PERCENTAGE chance)
 呪文の失敗率修正処理2(消費魔力減少、呪い、負値修正) / Modify spell fail rate Using p_ptr->to_m_chance, p_ptr->dec_mana, p_ptr->easy_spell and p_ptr->heavy_spell [詳解]
 
PERCENTAGE spell_chance (player_type *caster_ptr, SPELL_IDX spell, REALM_IDX use_realm)
 呪文の失敗率計算メインルーチン / Returns spell chance of failure for spell -RAK- [詳解]
 
void print_spells (player_type *caster_ptr, SPELL_IDX target_spell, SPELL_IDX *spells, int num, TERM_LEN y, TERM_LEN x, REALM_IDX use_realm)
 呪文情報の表示処理 / Print a list of spells (for browsing or casting or viewing) [詳解]
 
static MONRACE_IDX poly_r_idx (MONRACE_IDX r_idx)
 変身処理向けにモンスターの近隣レベル帯モンスターを返す / Helper function – return a "nearby" race for polymorphing [詳解]
 
bool polymorph_monster (player_type *caster_ptr, POSITION y, POSITION x)
 指定座標にいるモンスターを変身させる / Helper function – return a "nearby" race for polymorphing [詳解]
 
static bool dimension_door_aux (DEPTH x, DEPTH y)
 次元の扉処理 / Dimension Door [詳解]
 
bool dimension_door (void)
 次元の扉処理のメインルーチン / Dimension Door [詳解]
 
bool mirror_tunnel (void)
 鏡抜け処理のメインルーチン / Mirror Master's Dimension Door [詳解]
 
bool eat_magic (player_type *caster_ptr, int power)
 魔力食い処理 [詳解]
 
void massacre (player_type *caster_ptr)
 皆殺し(全方向攻撃)処理 [詳解]
 
bool eat_lock (player_type *caster_ptr)
 
bool shock_power (player_type *caster_ptr)
 
bool booze (player_type *creature_ptr)
 
bool detonation (player_type *creature_ptr)
 
void blood_curse_to_enemy (MONSTER_IDX m_idx)
 
bool fire_crimson (player_type *shooter_ptr)
 クリムゾンを発射する / Fire Crimson, evoluting gun. [詳解]
 
bool tele_town (void)
 町間のテレポートを行うメインルーチン。 [詳解]
 

詳解

魔法効果の実装/ Spell code (part 3)

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

マクロ定義詳解

◆ DEC_MANA_DIV

#define DEC_MANA_DIV   3

◆ MANA_CONST

#define MANA_CONST   2400

◆ MANA_DIV

#define MANA_DIV   4

◆ MAX_TRIES

#define MAX_TRIES   100

テレポート先探索の試行数 / Maximum number of tries for teleporting

関数詳解

◆ alchemy()

bool alchemy ( void  )

アイテムの価値に応じた錬金術処理 / Turns an object into gold, gain some of its value in a shop

戻り値
処理が実際に行われたらTRUEを返す
呼び出し関係図:

◆ alter_reality()

void alter_reality ( void  )

現実変容処理

戻り値
なし
呼び出し関係図:

◆ apply_disenchant()

bool apply_disenchant ( player_type target_ptr,
BIT_FLAGS  mode 
)

プレイヤーの装備劣化処理 / Apply disenchantment to the player's stuff

引数
mode最下位ビットが1ならば劣化処理が若干低減される
戻り値
劣化処理に関するメッセージが発せられた場合はTRUEを返す / Return "TRUE" if the player notices anything
呼び出し関係図:

◆ artifact_scroll()

bool artifact_scroll ( void  )

アーティファクト生成の巻物処理 /

戻り値
生成が実際に試みられたらTRUEを返す
呼び出し関係図:

◆ blood_curse_to_enemy()

void blood_curse_to_enemy ( MONSTER_IDX  m_idx)
呼び出し関係図:

◆ booze()

bool booze ( player_type creature_ptr)
呼び出し関係図:

◆ call_the_void()

void call_the_void ( player_type caster_ptr)

虚無招来処理 /

戻り値
なし

Sorry, it becomes not (void)...

呼び出し関係図:

◆ detonation()

bool detonation ( player_type creature_ptr)
呼び出し関係図:

◆ dimension_door()

bool dimension_door ( void  )

次元の扉処理のメインルーチン / Dimension Door

戻り値
ターンを消費した場合TRUEを返す
呼び出し関係図:

◆ dimension_door_aux()

static bool dimension_door_aux ( DEPTH  x,
DEPTH  y 
)
static

次元の扉処理 / Dimension Door

引数
xテレポート先のX座標
yテレポート先のY座標
戻り値
目標に指定通りテレポートできたならばTRUEを返す
呼び出し関係図:
被呼び出し関係図:

◆ display_spell_list()

void display_spell_list ( player_type caster_ptr)

クリーチャー全既知呪文を表示する / Hack – Display all known spells in a window

引数
caster_ptr術者の参照ポインタ return なし

Need to analyze size of the window. Need more color coding.

呼び出し関係図:

◆ eat_lock()

bool eat_lock ( player_type caster_ptr)
呼び出し関係図:

◆ eat_magic()

bool eat_magic ( player_type caster_ptr,
int  power 
)

魔力食い処理

引数
power基本効力
戻り値
ターンを消費した場合TRUEを返す
呼び出し関係図:

◆ experience_of_spell()

EXP experience_of_spell ( SPELL_IDX  spell,
REALM_IDX  use_realm 
)

呪文の経験値を返す / Returns experience of a spell

引数
spell呪文ID
use_realm魔法領域
戻り値
経験値

◆ fetch()

void fetch ( player_type caster_ptr,
DIRECTION  dir,
WEIGHT  wgt,
bool  require_los 
)

アイテム引き寄せ処理 / Fetch an item (teleport it right underneath the caster)

引数
dir魔法の発動方向
wgt許容重量
require_los射線の通りを要求するならばTRUE
戻り値
なし
呼び出し関係図:

◆ fire_crimson()

bool fire_crimson ( player_type shooter_ptr)

クリムゾンを発射する / Fire Crimson, evoluting gun.

@param shooter_ptr 射撃を行うクリーチャー参照

戻り値
キャンセルした場合 false.

Need to analyze size of the window. Need more color coding.

呼び出し関係図:

◆ free_level_recall()

bool free_level_recall ( player_type creature_ptr)
呼び出し関係図:

◆ ident_spell()

bool ident_spell ( bool  only_equip)

アイテム鑑定のメインルーチン処理 / Identify an object in the p_ptr->inventory_list (or on the floor)

引数
only_equip装備品のみを対象とするならばTRUEを返す
戻り値
実際に鑑定を行ったならばTRUEを返す

This routine does not automatically combine objects. Returns TRUE if something was identified, else FALSE.

呼び出し関係図:

◆ identify_fully()

bool identify_fully ( bool  only_equip)

アイテム*鑑定*のメインルーチン処理 / Identify an object in the p_ptr->inventory_list (or on the floor)

引数
only_equip装備品のみを対象とするならばTRUEを返す
戻り値
実際に鑑定を行ったならばTRUEを返す

Fully "identify" an object in the p_ptr->inventory_list -BEN- This routine returns TRUE if an item was identified.

呼び出し関係図:

◆ identify_item()

bool identify_item ( object_type o_ptr)

アイテム鑑定処理 / Identify an object

引数
o_ptr鑑定されるアイテムの情報参照ポインタ
戻り値
実際に鑑定できたらTRUEを返す
呼び出し関係図:

◆ identify_pack()

void identify_pack ( void  )

全所持アイテム鑑定処理 / Identify everything being carried.

Done by a potion of "self knowledge".

戻り値
なし
呼び出し関係図:

◆ massacre()

void massacre ( player_type caster_ptr)

皆殺し(全方向攻撃)処理

引数
pyプレイヤーY座標
pxプレイヤーX座標
戻り値
なし

◆ mirror_tunnel()

bool mirror_tunnel ( void  )

鏡抜け処理のメインルーチン / Mirror Master's Dimension Door

戻り値
ターンを消費した場合TRUEを返す
呼び出し関係図:

◆ mod_need_mana()

MANA_POINT mod_need_mana ( MANA_POINT  need_mana,
SPELL_IDX  spell,
REALM_IDX  realm 
)

呪文の消費MPを返す / Modify mana consumption rate using spell exp and p_ptr->dec_mana

引数
need_mana基本消費MP
spell呪文ID
realm魔法領域
戻り値
消費MP
呼び出し関係図:

◆ mod_spell_chance_1()

PERCENTAGE mod_spell_chance_1 ( PERCENTAGE  chance)

呪文の失敗率修正処理1(呪い、消費魔力減少、呪文簡易化) / Modify spell fail rate Using p_ptr->to_m_chance, p_ptr->dec_mana, p_ptr->easy_spell and p_ptr->heavy_spell

引数
chance修正前失敗率
戻り値
失敗率(%)
todo:
統合を検討

◆ mod_spell_chance_2()

PERCENTAGE mod_spell_chance_2 ( PERCENTAGE  chance)

呪文の失敗率修正処理2(消費魔力減少、呪い、負値修正) / Modify spell fail rate Using p_ptr->to_m_chance, p_ptr->dec_mana, p_ptr->easy_spell and p_ptr->heavy_spell

引数
chance修正前失敗率
戻り値
失敗率(%) Modify spell fail rate (as "suffix" process) Using p_ptr->dec_mana, p_ptr->easy_spell and p_ptr->heavy_spell Note: variable "chance" cannot be negative.
todo:
統合を検討

◆ mundane_spell()

bool mundane_spell ( bool  only_equip)

アイテム凡庸化のメインルーチン処理 / Identify an object in the p_ptr->inventory_list (or on the floor)

引数
only_equip装備品のみを対象とするならばTRUEを返す
戻り値
実際に凡庸化をを行ったならばTRUEを返す
Mundanify an object in the p_ptr->inventory_list (or on the floor)
This routine does *not* automatically combine objects.
Returns TRUE if something was mundanified, else FALSE.
呼び出し関係図:

◆ poly_r_idx()

static MONRACE_IDX poly_r_idx ( MONRACE_IDX  r_idx)
static

変身処理向けにモンスターの近隣レベル帯モンスターを返す / Helper function – return a "nearby" race for polymorphing

引数
r_idx基準となるモンスター種族ID
戻り値
変更先のモンスター種族ID

Note that this function is one of the more "dangerous" ones...

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

◆ polymorph_monster()

bool polymorph_monster ( player_type caster_ptr,
POSITION  y,
POSITION  x 
)

指定座標にいるモンスターを変身させる / Helper function – return a "nearby" race for polymorphing

引数
y指定のY座標
x指定のX座標
戻り値
実際に変身したらTRUEを返す
呼び出し関係図:

◆ print_spells()

void print_spells ( player_type caster_ptr,
SPELL_IDX  target_spell,
SPELL_IDX spells,
int  num,
TERM_LEN  y,
TERM_LEN  x,
REALM_IDX  use_realm 
)

呪文情報の表示処理 / Print a list of spells (for browsing or casting or viewing)

引数
target_spell呪文ID
caster_ptr術者の参照ポインタ
spells表示するスペルID配列の参照ポインタ
num表示するスペルの数(spellsの要素数)
y表示メッセージ左上Y座標
x表示メッセージ左上X座標
use_realm魔法領域ID
戻り値
なし
呼び出し関係図:

◆ recall_player()

bool recall_player ( player_type creature_ptr,
TIME_EFFECT  turns 
)

プレイヤーの帰還発動及び中止処理 / Recall the player to town or dungeon

引数
turns発動までのターン数
戻り値
常にTRUEを返す
呼び出し関係図:

◆ recharge()

bool recharge ( int  power)

魔力充填処理 / Recharge a wand/staff/rod from the pack or on the floor.

This function has been rewritten in Oangband and ZAngband.

引数
power充填パワー
戻り値
ターン消費を要する処理まで進んだらTRUEを返す

Sorcery/Arcane – Recharge --> recharge(plev * 4) Chaos – Arcane Binding --> recharge(90)

Scroll of recharging --> recharge(130) Artifact activation/Thingol --> recharge(130)

It is harder to recharge high level, and highly charged wands, staffs, and rods. The more wands in a stack, the more easily and strongly they recharge. Staffs, however, each get fewer charges if stacked.

Beware of "sliding index errors".

呼び出し関係図:

◆ remove_all_curse()

int remove_all_curse ( player_type caster_ptr)

装備の重い呪い解呪処理 / Remove all curses

戻り値
解呪に成功した装備数
呼び出し関係図:

◆ remove_curse()

int remove_curse ( player_type caster_ptr)

装備の軽い呪い解呪処理 / Remove most curses

戻り値
解呪に成功した装備数
呼び出し関係図:

◆ remove_curse_aux()

static int remove_curse_aux ( player_type creature_ptr,
int  all 
)
static

装備の解呪処理 / Removes curses from items in p_ptr->inventory_list

引数
all軽い呪いまでの解除ならば0
戻り値
解呪されたアイテムの数
Note that Items which are "Perma-Cursed" (The One Ring,
The Crown of Morgoth) can NEVER be uncursed.
Note that if "all" is FALSE, then Items which are
"Heavy-Cursed" (Mormegil, Calris, and Weapons of Morgul)
will not be uncursed.
呼び出し関係図:
被呼び出し関係図:

◆ reset_recall()

bool reset_recall ( void  )

フロア・リセット処理

戻り値
リセット処理が実際に行われたらTRUEを返す
呼び出し関係図:

◆ shock_power()

bool shock_power ( player_type caster_ptr)
呼び出し関係図:

◆ spell_chance()

PERCENTAGE spell_chance ( player_type caster_ptr,
SPELL_IDX  spell,
REALM_IDX  use_realm 
)

呪文の失敗率計算メインルーチン / Returns spell chance of failure for spell -RAK-

引数
spell呪文ID
use_realm魔法領域ID
戻り値
失敗率(%)
呼び出し関係図:

◆ tele_town()

bool tele_town ( void  )

町間のテレポートを行うメインルーチン。

戻り値
テレポート処理を決定したか否か
呼び出し関係図:

◆ teleport_away()

bool teleport_away ( player_type caster_ptr,
MONSTER_IDX  m_idx,
POSITION  dis,
BIT_FLAGS  mode 
)

モンスターのテレポートアウェイ処理 / Teleport a monster, normally up to "dis" grids away.

引数
m_idxモンスターID
disテレポート距離
modeオプション
戻り値
テレポートが実際に行われたらtrue

Attempt to move the monster at least "dis/2" grids away. But allow variation to prevent infinite loops.

呼び出し関係図:

◆ teleport_away_followable()

void teleport_away_followable ( MONSTER_IDX  m_idx)
呼び出し関係図:

◆ teleport_level()

void teleport_level ( player_type creature_ptr,
MONSTER_IDX  m_idx 
)

プレイヤー及びモンスターをレベルテレポートさせる / Teleport the player one level up or down (random when legal)

引数
m_idxテレポートの対象となるモンスターID(0ならばプレイヤー) / If m_idx <= 0, target is player.
戻り値
なし
呼び出し関係図:

◆ teleport_level_other()

bool teleport_level_other ( player_type creature_ptr)
呼び出し関係図:

◆ teleport_monster_to()

void teleport_monster_to ( MONSTER_IDX  m_idx,
POSITION  ty,
POSITION  tx,
int  power,
BIT_FLAGS  mode 
)

モンスターを指定された座標付近にテレポートする / Teleport monster next to a grid near the given location

引数
m_idxモンスターID
ty目安Y座標
tx目安X座標
powerテレポート成功確率
modeオプション
戻り値
なし
呼び出し関係図:

◆ teleport_player()

void teleport_player ( POSITION  dis,
BIT_FLAGS  mode 
)

プレイヤーのテレポート処理メインルーチン

引数
dis基本移動距離
modeオプション
戻り値
なし
呼び出し関係図:

◆ teleport_player_aux()

bool teleport_player_aux ( player_type creature_ptr,
POSITION  dis,
BIT_FLAGS  mode 
)

プレイヤーのテレポート先選定と移動処理 / Teleport the player to a location up to "dis" grids away.

引数
dis基本移動距離
modeオプション
戻り値
実際にテレポート処理が行われたらtrue
If no such spaces are readily available, the distance may increase.
Try very hard to move the player at least a quarter that distance.
There was a nasty tendency for a long time; which was causing the
player to "bounce" between two or three different spots because
these are the only spots that are "far enough" way to satisfy the
algorithm.
But this tendency is now removed; in the new algorithm, a list of
candidates is selected first, which includes at least 50% of all
floor grids within the distance, and any single grid in this list
of candidates has equal possibility to be choosen as a destination.
呼び出し関係図:

◆ teleport_player_away()

void teleport_player_away ( MONSTER_IDX  m_idx,
POSITION  dis 
)

プレイヤーのテレポートアウェイ処理 /

引数
m_idxアウェイを試みたプレイヤーID
disテレポート距離
戻り値
なし
呼び出し関係図:

◆ teleport_player_to()

void teleport_player_to ( player_type creature_ptr,
POSITION  ny,
POSITION  nx,
BIT_FLAGS  mode 
)

プレイヤーを指定位置近辺にテレポートさせる Teleport player to a grid near the given location

引数
ny目標Y座標
nx目標X座標
modeオプションフラグ
戻り値
なし
This function is slightly obsessive about correctness.
This function allows teleporting into vaults (!)
呼び出し関係図:

◆ vanish_dungeon()

static bool vanish_dungeon ( floor_type floor_ptr)
static

虚無招来によるフロア中の全壁除去処理 / Vanish all walls in this floor

戻り値
実際に処理が反映された場合TRUE
呼び出し関係図:
被呼び出し関係図: