1 #include "window/display-sub-window-spells.h"
2 #include "core/window-redrawer.h"
3 #include "game-option/option-flags.h"
4 #include "mind/mind-explanations-table.h"
5 #include "mind/mind-info.h"
6 #include "mind/mind-sniper.h"
7 #include "mind/mind-types.h"
8 #include "player/player-class.h"
9 #include "player/player-status-table.h"
10 #include "realm/realm-names-table.h"
11 #include "spell/spells-execution.h"
12 #include "spell/technic-info-table.h"
13 #include "term/gameterm.h"
14 #include "term/screen-processor.h"
15 #include "term/term-color-types.h"
16 #include "util/int-char-converter.h"
17 #include "view/display-messages.h"
20 * @brief クリーチャー全既知呪文を表示する /
21 * Hack -- Display all known spells in a window
22 * @param caster_ptr 術者の参照ポインタ
25 * Need to analyze size of the window.
26 * Need more color coding.
28 static void display_spell_list(player_type *caster_ptr)
32 const magic_type *s_ptr;
33 GAME_TEXT name[MAX_NLEN];
38 if (caster_ptr->pclass == CLASS_SORCERER)
40 if (caster_ptr->pclass == CLASS_RED_MAGE)
42 if (caster_ptr->pclass == CLASS_SNIPER) {
43 display_snipe_list(caster_ptr);
47 if ((caster_ptr->pclass == CLASS_MINDCRAFTER) || (caster_ptr->pclass == CLASS_BERSERKER) || (caster_ptr->pclass == CLASS_NINJA)
48 || (caster_ptr->pclass == CLASS_MIRROR_MASTER) || (caster_ptr->pclass == CLASS_FORCETRAINER)) {
49 PERCENTAGE minfail = 0;
50 PLAYER_LEVEL plev = caster_ptr->lev;
51 PERCENTAGE chance = 0;
62 put_str(_("名前", "Name"), y, x + 5);
63 put_str(_("Lv MP 失率 効果", "Lv Mana Fail Info"), y, x + 35);
65 switch (caster_ptr->pclass) {
66 case CLASS_MINDCRAFTER:
67 use_mind = MIND_MINDCRAFTER;
69 case CLASS_FORCETRAINER:
73 use_mind = MIND_BERSERKER;
76 case CLASS_MIRROR_MASTER:
77 use_mind = MIND_MIRROR_MASTER;
80 use_mind = MIND_NINJUTSU;
88 for (int i = 0; i < MAX_MIND_POWERS; i++) {
90 spell = mind_powers[use_mind].info[i];
91 if (spell.min_lev > plev)
95 chance -= 3 * (caster_ptr->lev - spell.min_lev);
96 chance -= 3 * (adj_mag_stat[caster_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
98 if (spell.mana_cost > caster_ptr->csp) {
99 chance += 5 * (spell.mana_cost - caster_ptr->csp);
103 if (spell.mana_cost > caster_ptr->chp) {
109 minfail = adj_mag_fail[caster_ptr->stat_ind[mp_ptr->spell_stat]];
110 if (chance < minfail)
113 if (caster_ptr->stun > 50)
115 else if (caster_ptr->stun)
121 mindcraft_info(caster_ptr, comment, use_mind, i);
122 sprintf(psi_desc, " %c) %-30s%2d %4d %3d%%%s", I2A(i), spell.name, spell.min_lev, spell.mana_cost, chance, comment);
124 term_putstr(x, y + i + 1, -1, a, psi_desc);
130 if (REALM_NONE == caster_ptr->realm1)
133 for (int j = 0; j < ((caster_ptr->realm2 > REALM_NONE) ? 2 : 1); j++) {
135 y = (j < 3) ? 0 : (m[j - 3] + 2);
138 for (int i = 0; i < 32; i++) {
141 if (!is_magic((j < 1) ? caster_ptr->realm1 : caster_ptr->realm2)) {
142 s_ptr = &technic_info[((j < 1) ? caster_ptr->realm1 : caster_ptr->realm2) - MIN_TECHNIC][i % 32];
144 s_ptr = &mp_ptr->info[((j < 1) ? caster_ptr->realm1 : caster_ptr->realm2) - 1][i % 32];
147 strcpy(name, exe_spell(caster_ptr, (j < 1) ? caster_ptr->realm1 : caster_ptr->realm2, i % 32, SPELL_NAME));
149 if (s_ptr->slevel >= 99) {
150 strcpy(name, _("(判読不能)", "(illegible)"));
152 } else if ((j < 1) ? ((caster_ptr->spell_forgotten1 & (1L << i))) : ((caster_ptr->spell_forgotten2 & (1L << (i % 32))))) {
154 } else if (!((j < 1) ? (caster_ptr->spell_learned1 & (1L << i)) : (caster_ptr->spell_learned2 & (1L << (i % 32))))) {
156 } else if (!((j < 1) ? (caster_ptr->spell_worked1 & (1L << i)) : (caster_ptr->spell_worked2 & (1L << (i % 32))))) {
160 sprintf(out_val, "%c/%c) %-20.20s", I2A(n / 8), I2A(n % 8), name);
163 term_putstr(x, m[j], -1, a, out_val);
170 * @brief 現在の習得済魔法をサブウィンドウに表示する /
171 * @param player_ptr プレーヤーへの参照ポインタ
172 * Hack -- display spells in sub-windows
175 void fix_spell(player_type *player_ptr)
177 for (int j = 0; j < 8; j++) {
178 term_type *old = Term;
179 if (!angband_term[j])
182 if (!(window_flag[j] & (PW_SPELL)))
185 term_activate(angband_term[j]);
186 display_spell_list(player_ptr);
187 if (need_term_fresh(player_ptr)) {
189 player_ptr->window &= ~(PW_SPELL);