Hengband
2.2.1
|
魔法効果の実装/ 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"
マクロ定義 | |
#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)
#define DEC_MANA_DIV 3 |
#define MANA_CONST 2400 |
#define MANA_DIV 4 |
#define MAX_TRIES 100 |
テレポート先探索の試行数 / Maximum number of tries for teleporting
bool alchemy | ( | void | ) |
アイテムの価値に応じた錬金術処理 / Turns an object into gold, gain some of its value in a shop
void alter_reality | ( | void | ) |
現実変容処理
bool apply_disenchant | ( | player_type * | target_ptr, |
BIT_FLAGS | mode | ||
) |
プレイヤーの装備劣化処理 / Apply disenchantment to the player's stuff
mode | 最下位ビットが1ならば劣化処理が若干低減される |
bool artifact_scroll | ( | void | ) |
アーティファクト生成の巻物処理 /
void blood_curse_to_enemy | ( | MONSTER_IDX | m_idx | ) |
bool booze | ( | player_type * | creature_ptr | ) |
void call_the_void | ( | player_type * | caster_ptr | ) |
虚無招来処理 /
Sorry, it becomes not (void)...
bool detonation | ( | player_type * | creature_ptr | ) |
bool dimension_door | ( | void | ) |
次元の扉処理のメインルーチン / Dimension Door
次元の扉処理 / Dimension Door
x | テレポート先のX座標 |
y | テレポート先のY座標 |
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.
bool eat_lock | ( | player_type * | caster_ptr | ) |
bool eat_magic | ( | player_type * | caster_ptr, |
int | power | ||
) |
魔力食い処理
power | 基本効力 |
呪文の経験値を返す / Returns experience of a spell
spell | 呪文ID |
use_realm | 魔法領域 |
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 |
bool fire_crimson | ( | player_type * | shooter_ptr | ) |
クリムゾンを発射する / Fire Crimson, evoluting gun.
@param shooter_ptr 射撃を行うクリーチャー参照
Need to analyze size of the window. Need more color coding.
bool free_level_recall | ( | player_type * | creature_ptr | ) |
アイテム鑑定のメインルーチン処理 / Identify an object in the p_ptr->inventory_list (or on the floor)
only_equip | 装備品のみを対象とするならばTRUEを返す |
This routine does not automatically combine objects. Returns TRUE if something was identified, else FALSE.
アイテム*鑑定*のメインルーチン処理 / Identify an object in the p_ptr->inventory_list (or on the floor)
only_equip | 装備品のみを対象とするならばTRUEを返す |
Fully "identify" an object in the p_ptr->inventory_list -BEN- This routine returns TRUE if an item was identified.
bool identify_item | ( | object_type * | o_ptr | ) |
アイテム鑑定処理 / Identify an object
o_ptr | 鑑定されるアイテムの情報参照ポインタ |
void identify_pack | ( | void | ) |
全所持アイテム鑑定処理 / Identify everything being carried.
Done by a potion of "self knowledge".
void massacre | ( | player_type * | caster_ptr | ) |
皆殺し(全方向攻撃)処理
py | プレイヤーY座標 |
px | プレイヤーX座標 |
bool mirror_tunnel | ( | void | ) |
鏡抜け処理のメインルーチン / Mirror Master's Dimension Door
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 | 魔法領域 |
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 | 修正前失敗率 |
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 | 修正前失敗率 |
アイテム凡庸化のメインルーチン処理 / Identify an object in the p_ptr->inventory_list (or on the floor)
only_equip | 装備品のみを対象とするならば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.
|
static |
変身処理向けにモンスターの近隣レベル帯モンスターを返す / Helper function – return a "nearby" race for polymorphing
r_idx | 基準となるモンスター種族ID |
Note that this function is one of the more "dangerous" ones...
bool polymorph_monster | ( | player_type * | caster_ptr, |
POSITION | y, | ||
POSITION | x | ||
) |
指定座標にいるモンスターを変身させる / Helper function – return a "nearby" race for polymorphing
y | 指定のY座標 |
x | 指定のX座標 |
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 |
bool recall_player | ( | player_type * | creature_ptr, |
TIME_EFFECT | turns | ||
) |
プレイヤーの帰還発動及び中止処理 / Recall the player to town or dungeon
turns | 発動までのターン数 |
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 | 充填パワー |
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".
int remove_all_curse | ( | player_type * | caster_ptr | ) |
装備の重い呪い解呪処理 / Remove all curses
int remove_curse | ( | player_type * | caster_ptr | ) |
装備の軽い呪い解呪処理 / Remove most curses
|
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.
bool reset_recall | ( | void | ) |
フロア・リセット処理
bool shock_power | ( | player_type * | caster_ptr | ) |
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 |
bool tele_town | ( | void | ) |
町間のテレポートを行うメインルーチン。
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 | オプション |
Attempt to move the monster at least "dis/2" grids away. But allow variation to prevent infinite loops.
void teleport_away_followable | ( | MONSTER_IDX | m_idx | ) |
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. |
bool teleport_level_other | ( | player_type * | creature_ptr | ) |
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 | オプション |
プレイヤーのテレポート処理メインルーチン
dis | 基本移動距離 |
mode | オプション |
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 | オプション |
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.
void teleport_player_away | ( | MONSTER_IDX | m_idx, |
POSITION | dis | ||
) |
プレイヤーのテレポートアウェイ処理 /
m_idx | アウェイを試みたプレイヤーID |
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
ny | 目標Y座標 |
nx | 目標X座標 |
mode | オプションフラグ |
This function is slightly obsessive about correctness. This function allows teleporting into vaults (!)
|
static |
虚無招来によるフロア中の全壁除去処理 / Vanish all walls in this floor