OSDN Git Service

[Refactor] #38997 probing() に player_type * 引数を追加. / Add player_type * argument to...
[hengband/hengband.git] / src / spells.h
index 4ebde6a..cfc4294 100644 (file)
@@ -1,4 +1,9 @@
 #pragma once
+#include "realm.h"
+
+#define DETECT_RAD_DEFAULT 30
+#define DETECT_RAD_MAP     30
+#define DETECT_RAD_ALL     255
 
 #define SPOP_DISPLAY_MES    0x0001 // !< スペル処理オプション … メッセージを表示する
 #define SPOP_NO_UPDATE      0x0002 // !< スペル処理オプション … ステータス更新を解決後行う
 
 #define MAX_GF         117
 
+/*
+ * The "name" of spell 'N' is stored as spell_names[X][N],
+ * where X is 0 for mage-spells and 1 for priest-spells.
+ */
+typedef struct magic_type magic_type;
+
+struct magic_type
+{
+       PLAYER_LEVEL slevel;    /* Required level (to learn) */
+       MANA_POINT smana;               /* Required mana (to cast) */
+       PERCENTAGE sfail;               /* Minimum chance of failure */
+       EXP sexp;                               /* Encoded experience bonus */
+};
+
+extern int cap_mon;
+extern int cap_mspeed;
+extern HIT_POINT cap_hp;
+extern HIT_POINT cap_maxhp;
+extern STR_OFFSET cap_nickname;
+extern bool sukekaku;
+
+extern const magic_type technic_info[NUM_TECHNIC][32];
+
+/* spells1.c */
+extern PERCENTAGE beam_chance(player_type *caster_ptr);
+extern bool in_disintegration_range(floor_type *floor_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2);
+extern void breath_shape(floor_type *floor_ptr, u16b *path_g, int dist, int *pgrids, POSITION *gx, POSITION *gy, POSITION *gm, POSITION *pgm_rad, POSITION rad, POSITION y1, POSITION x1, POSITION y2, POSITION x2, EFFECT_ID typ);
+extern POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2);
+
+#define PROJECT_WHO_UNCTRL_POWER -1 /*!< 魔法効果の自然発生要因: 名状し難い力の解放 */
+#define PROJECT_WHO_GLASS_SHARDS -2 /*!< 魔法効果の自然発生要因: 破壊されたガラス地形の破片 */
+extern bool project(player_type *caster_ptr, MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell);
 
+extern int project_length;
+extern bool binding_field(player_type *caster_ptr, HIT_POINT dam);
+extern void seal_of_mirror(player_type *caster_ptr, HIT_POINT dam);
+extern concptr spell_category_name(OBJECT_TYPE_VALUE tval);
+
+/* spells2.c */
+extern bool detect_traps(player_type *caster_ptr, POSITION range, bool known);
+extern bool detect_doors(POSITION range);
+extern bool detect_stairs(POSITION range);
+extern bool detect_treasure(POSITION range);
+extern bool detect_objects_gold(player_type *caster_ptr, POSITION range);
+extern bool detect_objects_normal(POSITION range);
+extern bool detect_objects_magic(POSITION range);
+extern bool detect_monsters_normal(POSITION range);
+extern bool detect_monsters_invis(POSITION range);
+extern bool detect_monsters_evil(POSITION range);
+extern bool detect_monsters_xxx(POSITION range, u32b match_flag);
+extern bool detect_monsters_string(POSITION range, concptr);
+extern bool detect_monsters_nonliving(POSITION range);
+extern bool detect_monsters_mind(POSITION range);
+extern bool detect_all(POSITION range);
+extern bool wall_stone(void);
+extern bool speed_monsters(void);
+extern bool slow_monsters(int power);
+extern bool sleep_monsters(int power);
+extern void aggravate_monsters(MONSTER_IDX who);
+extern bool genocide_aux(player_type *caster_ptr, MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, concptr spell_name);
+extern bool symbol_genocide(player_type *caster_ptr, int power, bool player_cast);
+extern bool mass_genocide(player_type *caster_ptr, int power, bool player_cast);
+extern bool mass_genocide_undead(player_type *caster_ptr, int power, bool player_cast);
+extern bool probing(player_type *caster_ptr);
+extern bool banish_evil(int dist);
+extern bool dispel_evil(HIT_POINT dam);
+extern bool dispel_good(HIT_POINT dam);
+extern bool dispel_undead(HIT_POINT dam);
+extern bool dispel_monsters(HIT_POINT dam);
+extern bool dispel_living(HIT_POINT dam);
+extern bool dispel_demons(HIT_POINT dam);
+extern bool cleansing_nova(player_type *creature_ptr, bool magic, bool powerful);
+extern bool unleash_mana_storm(player_type *creature_ptr, bool powerful);
+extern bool crusade(player_type *caster_ptr);
+extern bool turn_undead(player_type *caster_ptr);
+extern void lite_room(POSITION y1, POSITION x1);
+extern bool starlight(bool magic);
+extern void unlite_room(POSITION y1, POSITION x1);
+extern bool lite_area(HIT_POINT dam, POSITION rad);
+extern bool unlite_area(HIT_POINT dam, POSITION rad);
+extern bool fire_ball(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad);
+extern bool fire_breath(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad);
+extern bool fire_rocket(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad);
+extern bool fire_ball_hide(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad);
+extern bool fire_meteor(MONSTER_IDX who, EFFECT_ID typ, POSITION x, POSITION y, HIT_POINT dam, POSITION rad);
+extern bool fire_bolt(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam);
+extern bool fire_blast(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, DICE_NUMBER dd, DICE_SID ds, int num, int dev);
+extern void call_chaos(player_type *caster_ptr);
+extern bool fire_beam(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam);
+extern bool fire_bolt_or_beam(PERCENTAGE prob, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam);
+extern bool lite_line(DIRECTION dir, HIT_POINT dam);
+extern bool hypodynamic_bolt(DIRECTION dir, HIT_POINT dam);
+extern bool death_ray(DIRECTION dir, PLAYER_LEVEL plev);
+extern bool wall_to_mud(DIRECTION dir, HIT_POINT dam);
+extern bool destroy_door(DIRECTION dir);
+extern bool disarm_trap(DIRECTION dir);
+extern bool wizard_lock(DIRECTION dir);
+extern bool teleport_monster(DIRECTION dir, int distance);
+extern bool door_creation(void);
+extern bool trap_creation(POSITION y, POSITION x);
+extern bool tree_creation(void);
+extern bool glyph_creation(void);
+extern bool destroy_doors_touch(void);
+extern bool disarm_traps_touch(void);
+extern bool animate_dead(MONSTER_IDX who, POSITION y, POSITION x);
+extern bool sleep_monsters_touch(void);
+extern bool activate_ty_curse(player_type *target_ptr, bool stop_ty, int *count);
+extern int activate_hi_summon(POSITION y, POSITION x, bool can_pet);
+extern void wall_breaker(player_type *caster_ptr);
+extern bool confuse_monsters(HIT_POINT dam);
+extern bool charm_monsters(HIT_POINT dam);
+extern bool charm_animals(HIT_POINT dam);
+extern bool stun_monsters(HIT_POINT dam);
+extern bool stasis_monsters(HIT_POINT dam);
+extern bool banish_monsters(int dist);
+extern bool turn_monsters(HIT_POINT dam);
+extern bool turn_evil(HIT_POINT dam);
+extern bool deathray_monsters(void);
+extern bool charm_monster(DIRECTION dir, PLAYER_LEVEL plev);
+extern bool control_one_undead(DIRECTION dir, PLAYER_LEVEL plev);
+extern bool control_one_demon(DIRECTION dir, PLAYER_LEVEL plev);
+extern bool charm_animal(DIRECTION dir, PLAYER_LEVEL plev);
+extern bool mindblast_monsters(HIT_POINT dam);
+extern bool teleport_swap(player_type *caster_ptr, DIRECTION dir);
+extern bool project_hook(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, BIT_FLAGS flg);
+extern bool project_all_los(player_type *caster_ptr, EFFECT_ID typ, HIT_POINT dam);
+extern bool eat_magic(player_type *caster_ptr, int power);
+extern void discharge_minion(player_type *caster_ptr);
+extern bool kawarimi(player_type *caster_ptr, bool success);
+extern bool rush_attack(player_type *attacker_ptr, bool *mdeath);
+extern void remove_all_mirrors(player_type *caster_ptr, bool explode);
+extern void ring_of_power(player_type *caster_ptr, DIRECTION dir);
+extern void wild_magic(player_type *caster_ptr, int spell);
+extern void cast_meteor(player_type *caster_ptr, HIT_POINT dam, POSITION rad);
+extern bool cast_wrath_of_the_god(player_type *caster_ptr, HIT_POINT dam, POSITION rad);
+extern void cast_wonder(player_type *caster_ptr, DIRECTION dir);
+extern void cast_invoke_spirits(player_type *caster_ptr, DIRECTION dir);
+extern void cast_shuffle(player_type *caster_ptr);
+extern void stop_mouth(player_type *caster_ptr);
+extern bool_hack vampirism(player_type *caster_ptr);
+extern bool panic_hit(void);
+extern bool psychometry(player_type *caster_ptr);
+extern bool draconian_breath(player_type *creature_ptr);
+extern bool android_inside_weapon(player_type *creature_ptr);
+extern bool create_ration(player_type *crature_ptr);
+extern void hayagake(player_type *creature_ptr);
+extern bool double_attack(player_type *creature_ptr);
+extern bool comvert_hp_to_mp(player_type *creature_ptr);
+extern bool comvert_mp_to_hp(player_type *creature_ptr);
+extern bool demonic_breath(player_type *creature_ptr);
+extern bool mirror_concentration(player_type *creature_ptr);
+extern bool sword_dancing(player_type *creature_ptr);
+extern bool confusing_light(player_type *creature_ptr);
+extern bool rodeo(player_type *creature_ptr);
+extern bool clear_mind(player_type *creature_ptr);
+extern bool concentration(player_type *creature_ptr);
+extern bool vanish_dungeon(player_type *caster_ptr);
+
+/*
+ * Bit flags for teleportation
+ */
+#define TELEPORT_NONMAGICAL 0x00000001
+#define TELEPORT_PASSIVE    0x00000002
+#define TELEPORT_DEC_VALOUR 0x00000004
 
 /* spells3.c */
-extern bool teleport_away(MONSTER_IDX m_idx, POSITION dis, BIT_FLAGS mode);
+extern bool teleport_away(player_type *caster_ptr, MONSTER_IDX m_idx, POSITION dis, BIT_FLAGS mode);
 extern void teleport_monster_to(MONSTER_IDX m_idx, POSITION ty, POSITION tx, int power, BIT_FLAGS mode);
-extern bool teleport_player_aux(POSITION dis, BIT_FLAGS mode);
-extern void teleport_player(POSITION dis, BIT_FLAGS mode);
-extern void teleport_player_away(MONSTER_IDX m_idx, POSITION dis);
-extern void teleport_player_to(POSITION ny, POSITION nx, BIT_FLAGS mode);
-extern void teleport_away_followable(MONSTER_IDX m_idx);
-extern bool teleport_level_other(player_type *creature_ptr);
-extern void teleport_level(MONSTER_IDX m_idx);
-extern DUNGEON_IDX choose_dungeon(concptr note, POSITION y, POSITION x);
+extern bool teleport_player_aux(player_type *creature_ptr, POSITION dis, BIT_FLAGS mode);
+extern void teleport_player(player_type *creature_ptr, POSITION dis, BIT_FLAGS mode);
+extern void teleport_player_away(MONSTER_IDX m_idx, player_type *target_ptr, POSITION dis);
+extern void teleport_player_to(player_type *creature_ptr, POSITION ny, POSITION nx, BIT_FLAGS mode);
+extern void teleport_away_followable(player_type *creature_ptr, MONSTER_IDX m_idx);
+extern bool teleport_level_other(player_type *caster_ptr);
+extern void teleport_level(player_type *creature_ptr, MONSTER_IDX m_idx);
 extern bool recall_player(player_type *creature_ptr, TIME_EFFECT turns);
 extern bool free_level_recall(player_type *creature_ptr);
 extern bool reset_recall(void);
-extern bool apply_disenchant(BIT_FLAGS mode);
-extern void brand_weapon(int brand_type);
-extern void call_the_(void);
-extern void fetch(DIRECTION dir, WEIGHT wgt, bool require_los);
-extern void alter_reality(void);
-extern void identify_pack(void);
-extern int remove_curse(void);
-extern int remove_all_curse(void);
-extern bool alchemy(void);
-extern bool enchant(object_type *o_ptr, int n, int eflag);
-extern bool enchant_spell(HIT_PROB num_hit, HIT_POINT num_dam, ARMOUR_CLASS num_ac);
+extern bool apply_disenchant(player_type *target_ptr, BIT_FLAGS mode);
+extern void call_the_void(player_type *caster_ptr);
+extern void fetch(player_type *caster_ptr, DIRECTION dir, WEIGHT wgt, bool require_los);
+extern void reserve_alter_reality(player_type *caster_ptr);
+extern void identify_pack(player_type *target_ptr);
+extern int remove_curse(player_type *caster_ptr);
+extern int remove_all_curse(player_type *caster_ptr);
+extern bool alchemy(player_type *caster_ptr);
+
 extern bool artifact_scroll(void);
-extern bool ident_spell(bool only_equip);
-extern bool mundane_spell(bool only_equip);
-extern bool identify_item(object_type *o_ptr);
+extern bool ident_spell(player_type *caster_ptr, bool only_equip);
+extern bool mundane_spell(player_type *ownner_ptr, bool only_equip);
+extern bool identify_item(player_type *owner_ptr, object_type *o_ptr);
 extern bool identify_fully(bool only_equip);
-extern bool recharge(int power);
-extern void display_spell_list(void);
-extern EXP experience_of_spell(SPELL_IDX spell, REALM_IDX use_realm);
+extern bool recharge(player_type *caster_ptr, int power);
+extern void display_spell_list(player_type *caster_ptr);
+extern EXP experience_of_spell(player_type *caster_ptr, SPELL_IDX spell, REALM_IDX use_realm);
 extern MANA_POINT mod_need_mana(MANA_POINT need_mana, SPELL_IDX spell, REALM_IDX realm);
-extern PERCENTAGE mod_spell_chance_1(PERCENTAGE chance);
-extern PERCENTAGE mod_spell_chance_2(PERCENTAGE chance);
-extern PERCENTAGE spell_chance(SPELL_IDX spell, REALM_IDX realm);
-extern void print_spells(SPELL_IDX target_spell, SPELL_IDX *spells, int num, TERM_LEN y, TERM_LEN x, REALM_IDX realm);
-extern bool polymorph_monster(POSITION y, POSITION x);
+extern PERCENTAGE mod_spell_chance_1(player_type *caster_ptr, PERCENTAGE chance);
+extern PERCENTAGE mod_spell_chance_2(player_type *caster_ptr, PERCENTAGE chance);
+extern PERCENTAGE spell_chance(player_type *caster_ptr, SPELL_IDX spell, REALM_IDX realm);
+extern void print_spells(player_type* caster_ptr, SPELL_IDX target_spell, SPELL_IDX *spells, int num, TERM_LEN y, TERM_LEN x, REALM_IDX realm);
+extern bool polymorph_monster(player_type *caster_ptr, POSITION y, POSITION x);
 extern bool dimension_door(void);
 extern bool mirror_tunnel(void);
-extern void massacre(void);
-extern bool eat_lock(void);
-extern bool shock_power(void);
+extern void massacre(player_type *caster_ptr);
+extern bool eat_lock(player_type *caster_ptr);
+extern bool shock_power(player_type *caster_ptr);
 extern bool booze(player_type *creature_ptr);
 extern bool detonation(player_type *creature_ptr);
-extern void blood_curse_to_enemy(MONSTER_IDX m_idx);
-extern bool fire_crimson(void);
-extern bool tele_town(void);
+extern void blood_curse_to_enemy(player_type *caster_ptr, MONSTER_IDX m_idx);
+extern bool fire_crimson(player_type *shooter_ptr);
+extern bool tele_town(player_type *caster_ptr);
+extern int project_length;
+
+/* Is "teleport level" ineffective to this target? */
+#define TELE_LEVEL_IS_INEFF(TARGET) \
+       (p_ptr->current_floor_ptr->inside_arena || p_ptr->phase_out || \
+        (p_ptr->current_floor_ptr->inside_quest && !random_quest_number(p_ptr->current_floor_ptr->dun_level)) || \
+        (((TARGET) <= 0) && (quest_number(p_ptr->current_floor_ptr->dun_level) || (p_ptr->current_floor_ptr->dun_level >= d_info[p_ptr->dungeon_idx].maxdepth)) && \
+         (p_ptr->current_floor_ptr->dun_level >= 1) && ironman_downward))
+