From: Hourier Date: Thu, 30 Jul 2020 11:59:41 +0000 (+0900) Subject: [Refactor] #40573 Made mind-numbers.h to *genocide* magic numbers in mind-*.c X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=0e0b9826d27a429f74413a2bb1be1d03ecdaf82d;p=hengband%2Fhengband.git [Refactor] #40573 Made mind-numbers.h to *genocide* magic numbers in mind-*.c --- diff --git a/Hengband/Hengband/Hengband.vcxproj b/Hengband/Hengband/Hengband.vcxproj index b565281d8..1aa09dd8d 100644 --- a/Hengband/Hengband/Hengband.vcxproj +++ b/Hengband/Hengband/Hengband.vcxproj @@ -834,6 +834,7 @@ + diff --git a/Hengband/Hengband/Hengband.vcxproj.filters b/Hengband/Hengband/Hengband.vcxproj.filters index fa3a932b1..b406d73d6 100644 --- a/Hengband/Hengband/Hengband.vcxproj.filters +++ b/Hengband/Hengband/Hengband.vcxproj.filters @@ -4195,6 +4195,9 @@ cmd-action + + mind + diff --git a/src/Makefile.am b/src/Makefile.am index d81428b9c..21dd729c5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -398,6 +398,7 @@ hengband_SOURCES = \ mind/mind-mindcrafter.c mind/mind-mindcrafter.h \ mind/mind-mirror-master.c mind/mind-mirror-master.h \ mind/mind-ninja.c mind/mind-ninja.h \ + mind/mind-numbers.h \ mind/mind-power-getter.c mind/mind-power-getter.h \ mind/mind-samurai.c mind/mind-samurai.h \ mind/mind-sniper.c mind/mind-sniper.h \ diff --git a/src/mind/mind-berserker.c b/src/mind/mind-berserker.c index aa836b053..3c41da1f7 100644 --- a/src/mind/mind-berserker.c +++ b/src/mind/mind-berserker.c @@ -5,6 +5,7 @@ #include "game-option/input-options.h" #include "grid/feature.h" #include "grid/grid.h" +#include "mind/mind-numbers.h" #include "player-attack/player-attack.h" #include "player/player-move.h" #include "spell-kind/earthquake.h" @@ -19,17 +20,15 @@ * @param spell 発動する特殊技能のID * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。 */ -bool cast_berserk_spell(player_type *caster_ptr, int spell) +bool cast_berserk_spell(player_type *caster_ptr, mind_berserker_type spell) { POSITION y, x; DIRECTION dir; - - // todo enum化する! switch (spell) { - case 0: + case DETECT_MANACE: detect_monsters_mind(caster_ptr, DETECT_RAD_DEFAULT); break; - case 1: { + case CHARGE: { if (caster_ptr->riding) { msg_print(_("乗馬中には無理だ。", "You cannot do it when riding.")); return FALSE; @@ -60,7 +59,7 @@ bool cast_berserk_spell(player_type *caster_ptr, int spell) break; } - case 2: { + case SMASH_TRAP: { if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return FALSE; @@ -69,10 +68,10 @@ bool cast_berserk_spell(player_type *caster_ptr, int spell) exe_movement(caster_ptr, dir, easy_disarm, TRUE); break; } - case 3: + case QUAKE: earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 8 + randint0(5), 0); break; - case 4: + case MASSACRE: massacre(caster_ptr); break; default: diff --git a/src/mind/mind-berserker.h b/src/mind/mind-berserker.h index 920b92986..c95538b03 100644 --- a/src/mind/mind-berserker.h +++ b/src/mind/mind-berserker.h @@ -2,4 +2,5 @@ #include "system/angband.h" -bool cast_berserk_spell(player_type *caster_ptr, int spell); +typedef enum mind_berserker_type mind_berserker_type; +bool cast_berserk_spell(player_type *caster_ptr, mind_berserker_type spell); diff --git a/src/mind/mind-explanations-table.c b/src/mind/mind-explanations-table.c index c066e514d..066198fd8 100644 --- a/src/mind/mind-explanations-table.c +++ b/src/mind/mind-explanations-table.c @@ -9,11 +9,13 @@ mind_power const mind_powers[MAX_MIND_KINDS] = { { 3, 2, 25, _("次元の瞬き", "Minor Displacement") }, { 7, 6, 35, _("虚空の幻影", "Major Displacement") }, { 9, 7, 50, _("精神支配", "Domination") }, + { 11, 7, 30, _("念動衝撃弾", "Pulverise") }, { 13, 12, 50, _("鎧化", "Character Armour") }, { 15, 12, 60, _("サイコメトリー", "Psychometry") }, { 18, 10, 45, _("精神波動", "Mind Wave") }, { 23, 15, 50, _("アドレナリン・ドーピング", "Adrenaline Channeling") }, + { 26, 28, 60, _("テレキネシス", "Telekinesis") }, { 28, 10, 40, _("サイキック・ドレイン", "Psychic Drain") }, { 35, 35, 75, _("光の剣", "Psycho-Spear") }, @@ -34,13 +36,15 @@ mind_power const mind_powers[MAX_MIND_KINDS] = { { 5, 6, 35, _("舞空術", "Flying Technique") }, { 8, 5, 40, _("カメハメ波", "Kamehameha") }, { 10, 7, 45, _("対魔法防御", "Magic Resistance") }, + { 13, 5, 60, _("練気", "Improve Force") }, { 17, 17, 50, _("纏闘気", "Aura of Force") }, { 20, 20, 50, _("衝波", "Shock Power") }, { 23, 18, 55, _("彗龍", "Large Force Ball") }, { 25, 30, 70, _("いてつく波動", "Dispel Magic") }, + { 28, 26, 50, _("幻霊召喚", "Summon Ghost") }, - { 32, 35, 65, _("煉獄火炎", "Exploding Frame") }, + { 32, 35, 65, _("煉獄火炎", "Exploding Flame") }, { 38, 42, 75, _("超カメハメ波", "Super Kamehameha") }, { 44, 50, 80, _("光速移動", "Light Speed") }, { 99, 0, 0, "" }, @@ -84,24 +88,25 @@ mind_power const mind_powers[MAX_MIND_KINDS] = { { 2, 2, 20, _("光のしずく", "Drip of Light") }, { 3, 2, 20, _("歪んだ鏡", "Warped Mirror") }, { 5, 3, 35, _("閃光鏡", "Mirror of Light") }, - { 6, 5, 35, _("彷える鏡", "Mirror of Wandering") }, + { 6, 5, 35, _("彷える鏡", "Mirror of Wandering") }, { 10, 5, 30, _("微塵隠れ", "Robe of Dust") }, { 12, 12, 30, _("追放の鏡", "Banishing Mirror") }, { 15, 15, 30, _("鏡砕き", "Mirror Clashing") }, { 19, 13, 30, _("催眠鏡", "Mirror Sleeping") }, - { 23, 18, 50, _("シーカーレイ", "Seeker Ray") }, + { 23, 18, 50, _("シーカーレイ", "Seeker Ray") }, { 25, 20, 40, _("鏡の封印", "Seal of Mirror") }, { 27, 30, 60, _("水鏡の盾", "Shield of Water") }, { 29, 30, 60, _("スーパーレイ", "Super Ray") }, { 31, 35, 60, _("幻惑の光", "Illusion Light") }, - { 33, 50, 80, _("鏡の国", "Mirror Shift") }, + { 33, 50, 80, _("鏡の国", "Mirror Shift") }, { 36, 30, 80, _("鏡抜け", "Mirror Tunnel") }, { 38, 40, 70, _("帰還の鏡", "Mirror of Recall") }, { 40, 50, 55, _("影分身", "Multi-Shadow") }, { 43, 55, 70, _("封魔結界", "Binding Field") }, + { 46, 70, 75, _("ラフノールの鏡", "Mirror of Ruffnor") }, } }, @@ -109,19 +114,22 @@ mind_power const mind_powers[MAX_MIND_KINDS] = { /* Level gained, cost, %fail, name */ { 1, 1, 20, _("暗闇生成", "Create Darkness") }, { 2, 2, 25, _("周辺調査", "Detect Near") }, - { 3, 3, 25, _("葉隠れ", "Hide in Leafs") }, + { 3, 3, 25, _("葉隠れ", "Hide in Leaves") }, { 5, 3, 30, _("変わり身", "Kawarimi") }, { 7, 8, 35, _("高飛び", "Absconding") }, + { 8, 10, 35, _("一撃離脱", "Hit and Away") }, { 10, 10, 40, _("金縛り", "Bind Monster") }, { 12, 12, 70, _("古の口伝", "Ancient Knowledge") }, { 15, 10, 50, _("浮雲", "Floating") }, { 17, 12, 45, _("火遁", "Hide in Flame") }, + { 18, 20, 40, _("入身", "Nyusin") }, { 20, 5, 50, _("八方手裏剣", "Syuriken Spreading") }, { 22, 15, 55, _("鎖鎌", "Chain Hook") }, { 25, 32, 60, _("煙玉", "Smoke Ball") }, { 28, 32, 60, _("転身", "Swap Position") }, + { 30, 30, 70, _("爆発の紋章", "Glyph of Explosion") }, { 32, 40, 40, _("土遁", "Hide in Mud") }, { 34, 35, 50, _("霧隠れ", "Hide in Mist") }, diff --git a/src/mind/mind-force-trainer.c b/src/mind/mind-force-trainer.c index d72636f4f..6750c8758 100644 --- a/src/mind/mind-force-trainer.c +++ b/src/mind/mind-force-trainer.c @@ -11,6 +11,7 @@ #include "game-option/disturbance-options.h" #include "grid/grid.h" #include "mind/mind-magic-resistance.h" +#include "mind/mind-numbers.h" #include "monster-floor/monster-summon.h" #include "monster-floor/place-monster-types.h" #include "monster-race/monster-race.h" @@ -236,7 +237,7 @@ bool shock_power(player_type *caster_ptr) * @param spell 発動する特殊技能のID * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。 */ -bool cast_force_spell(player_type *caster_ptr, int spell) +bool cast_force_spell(player_type *caster_ptr, mind_force_trainer_type spell) { DIRECTION dir; PLAYER_LEVEL plev = caster_ptr->lev; @@ -245,29 +246,29 @@ bool cast_force_spell(player_type *caster_ptr, int spell) boost /= 2; switch (spell) { - case 0: + case SMALL_FORCE_BALL: if (!get_aim_dir(caster_ptr, &dir)) return FALSE; fire_ball(caster_ptr, GF_MISSILE, dir, damroll(3 + ((plev - 1) / 5) + boost / 12, 4), 0); break; - case 1: + case FLASH_LIGHT: (void)lite_area(caster_ptr, damroll(2, (plev / 2)), (plev / 10) + 1); break; - case 2: + case FLYING_TECHNIQUE: set_tim_levitation(caster_ptr, randint1(30) + 30 + boost / 5, FALSE); break; - case 3: + case KAMEHAMEHA: project_length = plev / 8 + 3; if (!get_aim_dir(caster_ptr, &dir)) return FALSE; fire_beam(caster_ptr, GF_MISSILE, dir, damroll(5 + ((plev - 1) / 5) + boost / 10, 5)); break; - case 4: + case MAGIC_RESISTANCE: set_resist_magic(caster_ptr, randint1(20) + 20 + boost / 5, FALSE); break; - case 5: + case IMPROVE_FORCE: msg_print(_("気を練った。", "You improved the Force.")); set_current_ki(caster_ptr, FALSE, 70 + plev); caster_ptr->update |= (PU_BONUS); @@ -279,19 +280,19 @@ bool cast_force_spell(player_type *caster_ptr, int spell) return TRUE; break; - case 6: + case AURA_OF_FORCE: set_tim_sh_force(caster_ptr, randint1(plev / 2) + 15 + boost / 7, FALSE); break; - case 7: + case SHOCK_POWER: return shock_power(caster_ptr); break; - case 8: + case LARGE_FORCE_BALL: if (!get_aim_dir(caster_ptr, &dir)) return FALSE; fire_ball(caster_ptr, GF_MISSILE, dir, damroll(10, 6) + plev * 3 / 2 + boost * 3 / 5, (plev < 30) ? 2 : 3); break; - case 9: { + case DISPEL_MAGIC: { if (!target_set(caster_ptr, TARGET_KILL)) return FALSE; @@ -303,7 +304,7 @@ bool cast_force_spell(player_type *caster_ptr, int spell) dispel_monster_status(caster_ptr, m_idx); break; } - case 10: { + case SUMMON_GHOST: { bool success = FALSE; for (int i = 0; i < 1 + boost / 100; i++) if (summon_specific(caster_ptr, -1, caster_ptr->y, caster_ptr->x, plev, SUMMON_PHANTOM, PM_FORCE_PET)) @@ -316,16 +317,16 @@ bool cast_force_spell(player_type *caster_ptr, int spell) break; } - case 11: + case EXPLODING_FLAME: fire_ball(caster_ptr, GF_FIRE, 0, 200 + (2 * plev) + boost * 2, 10); break; - case 12: + case SUPER_KAMEHAMEHA: if (!get_aim_dir(caster_ptr, &dir)) return FALSE; fire_beam(caster_ptr, GF_MANA, dir, damroll(10 + (plev / 2) + boost * 3 / 10, 15)); break; - case 13: + case LIGHT_SPEED: set_lightspeed(caster_ptr, randint1(16) + 16 + boost / 20, FALSE); break; default: diff --git a/src/mind/mind-force-trainer.h b/src/mind/mind-force-trainer.h index 58891a728..fec2a32f6 100644 --- a/src/mind/mind-force-trainer.h +++ b/src/mind/mind-force-trainer.h @@ -8,4 +8,6 @@ bool clear_mind(player_type *creature_ptr); void set_lightspeed(player_type *creature_ptr, TIME_EFFECT v, bool do_dec); bool set_tim_sh_force(player_type *creature_ptr, TIME_EFFECT v, bool do_dec); bool shock_power(player_type *caster_ptr); -bool cast_force_spell(player_type *caster_ptr, int spell); + +typedef enum mind_force_trainer_type mind_force_trainer_type; +bool cast_force_spell(player_type *caster_ptr, mind_force_trainer_type spell); diff --git a/src/mind/mind-mindcrafter.c b/src/mind/mind-mindcrafter.c index e151260ee..aa5a20ddf 100644 --- a/src/mind/mind-mindcrafter.c +++ b/src/mind/mind-mindcrafter.c @@ -10,6 +10,7 @@ #include "floor/floor-object.h" #include "game-option/auto-destruction-options.h" #include "mind/mind-mindcrafter.h" +#include "mind/mind-numbers.h" #include "object-enchant/item-feeling.h" #include "object-enchant/special-object-flags.h" #include "object/item-use-flags.h" @@ -123,15 +124,14 @@ bool psychometry(player_type *caster_ptr) * @param spell 発動する特殊技能のID * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。 */ -bool cast_mindcrafter_spell(player_type *caster_ptr, int spell) +bool cast_mindcrafter_spell(player_type *caster_ptr, mind_mindcrafter_type spell) { int b = 0; DIRECTION dir; TIME_EFFECT t; PLAYER_LEVEL plev = caster_ptr->lev; - // todo enum化する! switch (spell) { - case 0: /* Precog */ + case PRECOGNITION: if (plev > 44) { chg_virtue(caster_ptr, V_KNOWLEDGE, 1); chg_virtue(caster_ptr, V_ENLIGHTEN, 1); @@ -158,8 +158,7 @@ bool cast_mindcrafter_spell(player_type *caster_ptr, int spell) msg_print(_("安全な気がする。", "You feel safe.")); break; - case 1: - /* Mindblast */ + case NEURAL_BLAST: if (!get_aim_dir(caster_ptr, &dir)) return FALSE; @@ -168,16 +167,13 @@ bool cast_mindcrafter_spell(player_type *caster_ptr, int spell) else fire_ball(caster_ptr, GF_PSI, dir, damroll(3 + ((plev - 1) / 4), (3 + plev / 15)), 0); break; - case 2: - /* Minor displace */ + case MINOR_DISPLACEMENT: teleport_player(caster_ptr, 10, TELEPORT_SPONTANEOUS); break; - case 3: - /* Major displace */ + case MAJOR_DISPLACEMENT: teleport_player(caster_ptr, plev * 5, TELEPORT_SPONTANEOUS); break; - case 4: - /* Domination */ + case DOMINATION: if (plev < 30) { if (!get_aim_dir(caster_ptr, &dir)) return FALSE; @@ -186,16 +182,15 @@ bool cast_mindcrafter_spell(player_type *caster_ptr, int spell) } else { charm_monsters(caster_ptr, plev * 2); } + break; - case 5: - /* Fist of Force --- not 'true' TK */ + case PLUVERISE: if (!get_aim_dir(caster_ptr, &dir)) return FALSE; fire_ball(caster_ptr, GF_TELEKINESIS, dir, damroll(8 + ((plev - 5) / 4), 8), (plev > 20 ? (plev - 20) / 8 + 1 : 0)); break; - case 6: - /* Character Armour */ + case CHARACTER_ARMOR: set_shield(caster_ptr, (TIME_EFFECT)plev, FALSE); if (plev > 14) set_oppose_acid(caster_ptr, (TIME_EFFECT)plev, FALSE); @@ -207,24 +202,22 @@ bool cast_mindcrafter_spell(player_type *caster_ptr, int spell) set_oppose_elec(caster_ptr, (TIME_EFFECT)plev, FALSE); if (plev > 34) set_oppose_pois(caster_ptr, (TIME_EFFECT)plev, FALSE); + break; - case 7: - /* Psychometry */ + case PSYCHOMETRY: if (plev < 25) return psychometry(caster_ptr); else return ident_spell(caster_ptr, FALSE, 0); - case 8: - /* Mindwave */ + case MIND_WAVE: msg_print(_("精神を捻じ曲げる波動を発生させた!", "Mind-warping forces emanate from your brain!")); - if (plev < 25) project(caster_ptr, 0, 2 + plev / 10, caster_ptr->y, caster_ptr->x, (plev * 3), GF_PSI, PROJECT_KILL, -1); else (void)mindblast_monsters(caster_ptr, randint1(plev * ((plev - 5) / 10 + 1))); + break; - case 9: - /* Adrenaline */ + case ADRENALINE_CHANNELING: set_afraid(caster_ptr, 0); set_stun(caster_ptr, 0); if (!is_fast(caster_ptr) || !is_hero(caster_ptr)) @@ -234,15 +227,13 @@ bool cast_mindcrafter_spell(player_type *caster_ptr, int spell) set_hero(caster_ptr, t, FALSE); (void)set_fast(caster_ptr, t, FALSE); break; - case 10: - /* Telekinesis */ + case TELEKINESIS: if (!get_aim_dir(caster_ptr, &dir)) return FALSE; fetch_item(caster_ptr, dir, plev * 15, FALSE); break; - case 11: - /* Psychic Drain */ + case PSYCHIC_DRAIN: if (!get_aim_dir(caster_ptr, &dir)) return FALSE; @@ -251,17 +242,15 @@ bool cast_mindcrafter_spell(player_type *caster_ptr, int spell) caster_ptr->energy_need += randint1(150); break; - case 12: - /* psycho-spear */ + case PSYCHO_SPEAR: if (!get_aim_dir(caster_ptr, &dir)) return FALSE; fire_beam(caster_ptr, GF_PSY_SPEAR, dir, randint1(plev * 3) + plev * 3); break; - case 13: { + case THE_WORLD: time_walk(caster_ptr); break; - } default: msg_print(_("なに?", "Zap?")); } diff --git a/src/mind/mind-mindcrafter.h b/src/mind/mind-mindcrafter.h index e058412af..e3d07cfe4 100644 --- a/src/mind/mind-mindcrafter.h +++ b/src/mind/mind-mindcrafter.h @@ -3,4 +3,6 @@ #include "system/angband.h" bool psychometry(player_type *caster_ptr); -bool cast_mindcrafter_spell(player_type *caster_ptr, int spell); + +typedef enum mind_mindcrafter_type mind_mindcrafter_type; +bool cast_mindcrafter_spell(player_type *caster_ptr, mind_mindcrafter_type spell); diff --git a/src/mind/mind-mirror-master.c b/src/mind/mind-mirror-master.c index b4b69025c..f75efb780 100644 --- a/src/mind/mind-mirror-master.c +++ b/src/mind/mind-mirror-master.c @@ -17,6 +17,7 @@ #include "io/cursor.h" #include "io/screen-util.h" #include "mind/mind-magic-resistance.h" +#include "mind/mind-numbers.h" #include "spell-kind/spells-detection.h" #include "spell-kind/spells-floor.h" #include "spell-kind/spells-launcher.h" @@ -404,17 +405,15 @@ static int number_of_mirrors(floor_type *floor_ptr) * @param spell 発動する特殊技能のID * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。 */ -bool cast_mirror_spell(player_type *caster_ptr, int spell) +bool cast_mirror_spell(player_type *caster_ptr, mind_mirror_master_type spell) { DIRECTION dir; PLAYER_LEVEL plev = caster_ptr->lev; int tmp; TIME_EFFECT t; POSITION x, y; - // todo enum化する! switch (spell) { - /* mirror of seeing */ - case 0: + case MIRROR_SEEING: tmp = is_mirror_grid(&caster_ptr->current_floor_ptr->grid_array[caster_ptr->y][caster_ptr->x]) ? 4 : 0; if (plev + tmp > 4) detect_monsters_normal(caster_ptr, DETECT_RAD_DEFAULT); @@ -428,15 +427,14 @@ bool cast_mirror_spell(player_type *caster_ptr, int spell) msg_print(_("鏡がなくて集中できなかった!", "You need a mirror to concentrate!")); } break; - /* drip of light */ - case 1: + case MAKE_MIRROR: if (number_of_mirrors(caster_ptr->current_floor_ptr) < 4 + plev / 10) place_mirror(caster_ptr); else msg_format(_("これ以上鏡は制御できない!", "There are too many mirrors to control!")); break; - case 2: + case DRIP_LIGHT: if (!get_aim_dir(caster_ptr, &dir)) return FALSE; @@ -446,58 +444,48 @@ bool cast_mirror_spell(player_type *caster_ptr, int spell) fire_bolt(caster_ptr, GF_LITE, dir, damroll(3 + ((plev - 1) / 5), 4)); break; - /* warped mirror */ - case 3: + case WRAPPED_MIRROR: teleport_player(caster_ptr, 10, TELEPORT_SPONTANEOUS); break; - /* mirror of light */ - case 4: + case MIRROR_LIGHT: (void)lite_area(caster_ptr, damroll(2, (plev / 2)), (plev / 10) + 1); break; - /* mirror of wandering */ - case 5: + case WANDERING_MIRROR: teleport_player(caster_ptr, plev * 5, TELEPORT_SPONTANEOUS); break; - /* robe of dust */ - case 6: + case ROBE_DUST: set_dustrobe(caster_ptr, 20 + randint1(20), FALSE); break; - /* banishing mirror */ - case 7: + case BANISHING_MIRROR: if (!get_aim_dir(caster_ptr, &dir)) return FALSE; (void)fire_beam(caster_ptr, GF_AWAY_ALL, dir, plev); break; - /* mirror clashing */ - case 8: + case MIRROR_CRASHING: if (!get_aim_dir(caster_ptr, &dir)) return FALSE; fire_ball(caster_ptr, GF_SHARDS, dir, damroll(8 + ((plev - 5) / 4), 8), (plev > 20 ? (plev - 20) / 8 + 1 : 0)); break; - /* mirror sleeping */ - case 9: + case SLEEPING_MIRROR: for (x = 0; x < caster_ptr->current_floor_ptr->width; x++) for (y = 0; y < caster_ptr->current_floor_ptr->height; y++) if (is_mirror_grid(&caster_ptr->current_floor_ptr->grid_array[y][x])) project(caster_ptr, 0, 2, y, x, (HIT_POINT)plev, GF_OLD_SLEEP, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1); - break; - /* seeker ray */ - case 10: + break; + case SEEKER_RAY: if (!get_aim_dir(caster_ptr, &dir)) return FALSE; fire_beam(caster_ptr, GF_SEEKER, dir, damroll(11 + (plev - 5) / 4, 8)); break; - /* seal of mirror */ - case 11: + case SEALING_MIRROR: seal_of_mirror(caster_ptr, plev * 4 + 100); break; - /* shield of water */ - case 12: + case WATER_SHIELD: t = 20 + randint1(20); set_shield(caster_ptr, t, FALSE); if (plev > 31) @@ -507,15 +495,13 @@ bool cast_mirror_spell(player_type *caster_ptr, int spell) set_resist_magic(caster_ptr, t, FALSE); break; - /* super ray */ - case 13: + case SUPER_RAY: if (!get_aim_dir(caster_ptr, &dir)) return FALSE; fire_beam(caster_ptr, GF_SUPER_RAY, dir, 150 + randint1(2 * plev)); break; - /* illusion light */ - case 14: + case ILLUSION_LIGHT: tmp = is_mirror_grid(&caster_ptr->current_floor_ptr->grid_array[caster_ptr->y][caster_ptr->x]) ? 4 : 3; slow_monsters(caster_ptr, plev); stun_monsters(caster_ptr, plev * tmp); @@ -524,8 +510,7 @@ bool cast_mirror_spell(player_type *caster_ptr, int spell) stun_monsters(caster_ptr, plev * tmp); stasis_monsters(caster_ptr, plev * tmp); break; - /* mirror shift */ - case 15: + case MIRROR_SHIFT: if (!is_mirror_grid(&caster_ptr->current_floor_ptr->grid_array[caster_ptr->y][caster_ptr->x])) { msg_print(_("鏡の国の場所がわからない!", "You cannot find out where the mirror is!")); break; @@ -533,30 +518,25 @@ bool cast_mirror_spell(player_type *caster_ptr, int spell) reserve_alter_reality(caster_ptr); break; - /* mirror tunnel */ - case 16: + case MIRROR_TUNNEL: msg_print(_("鏡の世界を通り抜け… ", "You try to enter the mirror...")); return mirror_tunnel(caster_ptr); - - /* mirror of recall */ - case 17: + case RECALL_MIRROR: return recall_player(caster_ptr, randint0(21) + 15); - /* multi-shadow */ - case 18: + case MULTI_SHADOW: set_multishadow(caster_ptr, 6 + randint1(6), FALSE); break; - /* binding field */ - case 19: + case BINDING_FIELD: if (!binding_field(caster_ptr, plev * 11 + 5)) msg_print(_("適当な鏡を選べなかった!", "You were not able to choose suitable mirrors!")); break; - /* mirror of Ruffnor */ - case 20: + case RUFFNOR_MIRROR: (void)set_invuln(caster_ptr, randint1(4) + 4, FALSE); break; default: msg_print(_("なに?", "Zap?")); + break; } caster_ptr->magic_num1[0] = 0; diff --git a/src/mind/mind-mirror-master.h b/src/mind/mind-mirror-master.h index 56521d5b9..6f5398eef 100644 --- a/src/mind/mind-mirror-master.h +++ b/src/mind/mind-mirror-master.h @@ -12,4 +12,6 @@ bool place_mirror(player_type *caster_ptr); bool mirror_tunnel(player_type *caster_ptr); bool set_multishadow(player_type *creature_ptr, TIME_EFFECT v, bool do_dec); bool set_dustrobe(player_type *creature_ptr, TIME_EFFECT v, bool do_dec); -bool cast_mirror_spell(player_type *caster_ptr, int spell); + +typedef enum mind_mirror_master_type mind_mirror_master_type; +bool cast_mirror_spell(player_type *caster_ptr, mind_mirror_master_type spell); diff --git a/src/mind/mind-ninja.c b/src/mind/mind-ninja.c index 3dec950e9..936aa8c59 100644 --- a/src/mind/mind-ninja.c +++ b/src/mind/mind-ninja.c @@ -13,6 +13,7 @@ #include "grid/feature.h" #include "inventory/inventory-slot-types.h" #include "mind/mind-mirror-master.h" +#include "mind/mind-numbers.h" #include "mind/mind-warrior.h" #include "monster-race/monster-race.h" #include "monster-race/race-flags-resistance.h" @@ -319,17 +320,16 @@ bool set_superstealth(player_type *creature_ptr, bool set) * @param spell 発動する特殊技能のID * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。 */ -bool cast_ninja_spell(player_type *caster_ptr, int spell) +bool cast_ninja_spell(player_type *caster_ptr, mind_ninja_type spell) { POSITION x = 0, y = 0; DIRECTION dir; PLAYER_LEVEL plev = caster_ptr->lev; - // todo enum化する! switch (spell) { - case 0: + case DARKNESS_CREATION: (void)unlite_area(caster_ptr, 0, 3); break; - case 1: + case DETECT_NEAR: if (plev > 44) wiz_lite(caster_ptr, TRUE); @@ -344,10 +344,10 @@ bool cast_ninja_spell(player_type *caster_ptr, int spell) detect_objects_normal(caster_ptr, DETECT_RAD_DEFAULT); break; - case 2: + case HIDE_LEAVES: teleport_player(caster_ptr, 10, TELEPORT_SPONTANEOUS); break; - case 3: + case KAWARIMI: if (!(caster_ptr->special_defense & NINJA_KAWARIMI)) { msg_print(_("敵の攻撃に対して敏感になった。", "You are now prepared to evade any attacks.")); caster_ptr->special_defense |= NINJA_KAWARIMI; @@ -355,33 +355,33 @@ bool cast_ninja_spell(player_type *caster_ptr, int spell) } break; - case 4: + case ABSCONDING: teleport_player(caster_ptr, caster_ptr->lev * 5, TELEPORT_SPONTANEOUS); break; - case 5: + case HIT_AND_AWAY: if (!hit_and_away(caster_ptr)) return FALSE; break; - case 6: + case BIND_MONSTER: if (!get_aim_dir(caster_ptr, &dir)) return FALSE; (void)stasis_monster(caster_ptr, dir); break; - case 7: + case ANCIENT_KNOWLEDGE: return ident_spell(caster_ptr, FALSE, 0); - case 8: + case FLOATING: set_tim_levitation(caster_ptr, randint1(20) + 20, FALSE); break; - case 9: + case HIDE_FLAMES: fire_ball(caster_ptr, GF_FIRE, 0, 50 + plev, plev / 10 + 2); teleport_player(caster_ptr, 30, TELEPORT_SPONTANEOUS); set_oppose_fire(caster_ptr, (TIME_EFFECT)plev, FALSE); break; - case 10: + case NYUSIN: return rush_attack(caster_ptr, NULL); - case 11: { + case SYURIKEN_SPREADING: { for (int i = 0; i < 8; i++) { OBJECT_IDX slot; @@ -405,16 +405,16 @@ bool cast_ninja_spell(player_type *caster_ptr, int spell) break; } - case 12: + case CHAIN_HOOK: (void)fetch_monster(caster_ptr); break; - case 13: + case SMOKE_BALL: if (!get_aim_dir(caster_ptr, &dir)) return FALSE; fire_ball(caster_ptr, GF_OLD_CONF, dir, plev * 3, 3); break; - case 14: + case SWAP_POSITION: project_length = -1; if (!get_aim_dir(caster_ptr, &dir)) { project_length = 0; @@ -424,20 +424,20 @@ bool cast_ninja_spell(player_type *caster_ptr, int spell) project_length = 0; (void)teleport_swap(caster_ptr, dir); break; - case 15: + case EXPLOSION_GLYPH: explosive_rune(caster_ptr, caster_ptr->y, caster_ptr->x); break; - case 16: + case HIDE_MUD: (void)set_pass_wall(caster_ptr, randint1(plev / 2) + plev / 2, FALSE); set_oppose_acid(caster_ptr, (TIME_EFFECT)plev, FALSE); break; - case 17: + case HIDE_MIST: fire_ball(caster_ptr, GF_POIS, 0, 75 + plev * 2 / 3, plev / 5 + 2); fire_ball(caster_ptr, GF_HYPODYNAMIA, 0, 75 + plev * 2 / 3, plev / 5 + 2); fire_ball(caster_ptr, GF_CONFUSION, 0, 75 + plev * 2 / 3, plev / 5 + 2); teleport_player(caster_ptr, 30, TELEPORT_SPONTANEOUS); break; - case 18: { + case PURGATORY_FLAME: { int num = damroll(3, 9); for (int k = 0; k < num; k++) { EFFECT_ID typ = one_in_(2) ? GF_FIRE : one_in_(3) ? GF_NETHER : GF_PLASMA; @@ -453,7 +453,7 @@ bool cast_ninja_spell(player_type *caster_ptr, int spell) break; } - case 19: + case ALTER_EGO: set_multishadow(caster_ptr, 6 + randint1(6), FALSE); break; default: diff --git a/src/mind/mind-ninja.h b/src/mind/mind-ninja.h index 36e0c035c..0300ae5f5 100644 --- a/src/mind/mind-ninja.h +++ b/src/mind/mind-ninja.h @@ -10,4 +10,6 @@ void print_surprise_attack(player_attack_type *pa_ptr); void calc_surprise_attack_damage(player_type *attacker_ptr, player_attack_type *pa_ptr); void hayagake(player_type *creature_ptr); bool set_superstealth(player_type *creature_ptr, bool set); -bool cast_ninja_spell(player_type *caster_ptr, int spell); + +typedef enum mind_ninja_type mind_ninja_type; +bool cast_ninja_spell(player_type *caster_ptr, mind_ninja_type spell); diff --git a/src/mind/mind-numbers.h b/src/mind/mind-numbers.h new file mode 100644 index 000000000..104393bf8 --- /dev/null +++ b/src/mind/mind-numbers.h @@ -0,0 +1,90 @@ +#pragma once + +typedef enum mind_berserker_type { + DETECT_MANACE = 0, + CHARGE = 1, + SMASH_TRAP = 2, + QUAKE = 3, + MASSACRE = 4, +} mind_berserker_type; + +typedef enum mind_force_trainer_type { + SMALL_FORCE_BALL = 0, + FLASH_LIGHT = 1, + FLYING_TECHNIQUE = 2, + KAMEHAMEHA = 3, + MAGIC_RESISTANCE = 4, + IMPROVE_FORCE = 5, + AURA_OF_FORCE = 6, + SHOCK_POWER = 7, + LARGE_FORCE_BALL = 8, + DISPEL_MAGIC = 9, + SUMMON_GHOST = 10, + EXPLODING_FLAME = 11, + SUPER_KAMEHAMEHA = 12, + LIGHT_SPEED = 13, +} mind_force_trainer_type; + +typedef enum mind_mindcrafter_type { + PRECOGNITION = 0, + NEURAL_BLAST = 1, + MINOR_DISPLACEMENT = 2, + MAJOR_DISPLACEMENT = 3, + DOMINATION = 4, + PLUVERISE = 5, + CHARACTER_ARMOR = 6, + PSYCHOMETRY = 7, + MIND_WAVE = 8, + ADRENALINE_CHANNELING = 9, + TELEKINESIS = 10, + PSYCHIC_DRAIN = 11, + PSYCHO_SPEAR = 12, + THE_WORLD = 13, +} mind_mindcrafter_type; + +typedef enum mind_mirror_master_type { + MIRROR_SEEING = 0, + MAKE_MIRROR = 1, + DRIP_LIGHT = 2, + WRAPPED_MIRROR = 3, + MIRROR_LIGHT = 4, + WANDERING_MIRROR = 5, + ROBE_DUST = 6, + BANISHING_MIRROR = 7, + MIRROR_CRASHING = 8, + SLEEPING_MIRROR = 9, + SEEKER_RAY = 10, + SEALING_MIRROR = 11, + WATER_SHIELD = 12, + SUPER_RAY = 13, + ILLUSION_LIGHT = 14, + MIRROR_SHIFT = 15, + MIRROR_TUNNEL = 16, + RECALL_MIRROR = 17, + MULTI_SHADOW = 18, + BINDING_FIELD = 19, + RUFFNOR_MIRROR = 20, +} mind_mirror_master_type; + +typedef enum mind_ninja_type { + DARKNESS_CREATION = 0, + DETECT_NEAR = 1, + HIDE_LEAVES = 2, + KAWARIMI = 3, + ABSCONDING = 4, + HIT_AND_AWAY = 5, + BIND_MONSTER = 6, + ANCIENT_KNOWLEDGE = 7, + FLOATING = 8, + HIDE_FLAMES = 9, + NYUSIN = 10, + SYURIKEN_SPREADING = 11, + CHAIN_HOOK = 12, + SMOKE_BALL = 13, + SWAP_POSITION = 14, + EXPLOSION_GLYPH = 15, + HIDE_MUD = 16, + HIDE_MIST =17, + PURGATORY_FLAME = 18, + ALTER_EGO = 19, +} mind_ninja_type;