1 #include "mind/mind-blue-mage.h"
2 #include "action/action-limited.h"
3 #include "blue-magic/blue-magic-caster.h"
4 #include "blue-magic/learnt-power-getter.h"
5 #include "core/asking-player.h"
6 #include "core/player-redraw-types.h"
7 #include "core/window-redrawer.h"
8 #include "game-option/disturbance-options.h"
9 #include "game-option/input-options.h"
10 #include "main/sound-definitions-table.h"
11 #include "main/sound-of-music.h"
12 #include "mspell/monster-power-table.h"
13 #include "mspell/mspell-type.h"
14 #include "player/player-status-table.h"
15 #include "player-info/avatar.h"
16 #include "realm/realm-types.h"
17 #include "spell/spell-info.h"
18 #include "status/bad-status-setter.h"
19 #include "status/base-status.h"
20 #include "term/screen-processor.h"
21 #include "view/display-messages.h"
24 * @brief 青魔法コマンドのメインルーチン /
25 * do_cmd_cast calls this function if the player's class is 'Blue-Mage'.
26 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
28 bool do_cmd_cast_learned(player_type *caster_ptr)
32 PERCENTAGE minfail = 0;
33 PLAYER_LEVEL plev = caster_ptr->lev;
38 if (cmd_limit_confused(caster_ptr))
41 if (!get_learned_power(caster_ptr, &n))
44 spell = monster_powers[n];
45 need_mana = mod_need_mana(caster_ptr, spell.smana, 0, REALM_NONE);
46 if (need_mana > caster_ptr->csp) {
47 msg_print(_("MPが足りません。", "You do not have enough mana to use this power."));
51 if (!get_check(_("それでも挑戦しますか? ", "Attempt it anyway? ")))
56 if (plev > spell.level)
57 chance -= 3 * (plev - spell.level);
59 chance += (spell.level - plev);
61 chance -= 3 * (adj_mag_stat[caster_ptr->stat_ind[A_INT]] - 1);
62 chance = mod_spell_chance_1(caster_ptr, chance);
63 if (need_mana > caster_ptr->csp) {
64 chance += 5 * (need_mana - caster_ptr->csp);
67 minfail = adj_mag_fail[caster_ptr->stat_ind[A_INT]];
71 if (caster_ptr->stun > 50)
73 else if (caster_ptr->stun)
79 chance = mod_spell_chance_2(caster_ptr, chance);
80 if (randint0(100) < chance) {
84 msg_print(_("魔法をうまく唱えられなかった。", "You failed to concentrate hard enough!"));
87 cast = cast_learned_spell(caster_ptr, n, FALSE);
90 cast = cast_learned_spell(caster_ptr, n, TRUE);
95 if (need_mana <= caster_ptr->csp) {
96 caster_ptr->csp -= need_mana;
100 caster_ptr->csp_frac = 0;
101 msg_print(_("精神を集中しすぎて気を失ってしまった!", "You faint from the effort!"));
102 (void)set_paralyzed(caster_ptr, caster_ptr->paralyzed + randint1(5 * oops + 1));
103 chg_virtue(caster_ptr, V_KNOWLEDGE, -10);
104 if (randint0(100) < 50) {
105 bool perm = (randint0(100) < 25);
106 msg_print(_("体を悪くしてしまった!", "You have damaged your health!"));
107 (void)dec_stat(caster_ptr, A_CON, 15 + randint1(10), perm);
111 take_turn(caster_ptr, 100);
112 caster_ptr->redraw |= PR_MANA;
113 caster_ptr->window |= PW_PLAYER | PW_SPELL;