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-sniper.h"
5 #include "mind/mind-explanations-table.h"
6 #include "mind/mind-info.h"
7 #include "mind/mind-types.h"
8 #include "player/player-class.h"
9 #include "realm/realm-names-table.h"
10 #include "spell/spells-execution.h"
11 #include "spell/technic-info-table.h"
12 #include "term/gameterm.h"
13 #include "term/screen-processor.h"
14 #include "term/term-color-types.h"
15 #include "util/int-char-converter.h"
16 #include "view/display-messages.h"
19 * @brief クリーチャー全既知呪文を表示する /
20 * Hack -- Display all known spells in a window
21 * @param caster_ptr 術者の参照ポインタ
24 * Need to analyze size of the window.
25 * Need more color coding.
27 static void display_spell_list(player_type *caster_ptr)
31 const magic_type *s_ptr;
32 GAME_TEXT name[MAX_NLEN];
37 if (caster_ptr->pclass == CLASS_SORCERER)
39 if (caster_ptr->pclass == CLASS_RED_MAGE)
41 if (caster_ptr->pclass == CLASS_SNIPER) {
42 display_snipe_list(caster_ptr);
46 if ((caster_ptr->pclass == CLASS_MINDCRAFTER) || (caster_ptr->pclass == CLASS_BERSERKER) || (caster_ptr->pclass == CLASS_NINJA)
47 || (caster_ptr->pclass == CLASS_MIRROR_MASTER) || (caster_ptr->pclass == CLASS_FORCETRAINER)) {
48 PERCENTAGE minfail = 0;
49 PLAYER_LEVEL plev = caster_ptr->lev;
50 PERCENTAGE chance = 0;
61 put_str(_("名前", "Name"), y, x + 5);
62 put_str(_("Lv MP 失率 効果", "Lv Mana Fail Info"), y, x + 35);
64 switch (caster_ptr->pclass) {
65 case CLASS_MINDCRAFTER:
66 use_mind = MIND_MINDCRAFTER;
68 case CLASS_FORCETRAINER:
72 use_mind = MIND_BERSERKER;
75 case CLASS_MIRROR_MASTER:
76 use_mind = MIND_MIRROR_MASTER;
79 use_mind = MIND_NINJUTSU;
87 for (int i = 0; i < MAX_MIND_POWERS; i++) {
89 spell = mind_powers[use_mind].info[i];
90 if (spell.min_lev > plev)
94 chance -= 3 * (caster_ptr->lev - spell.min_lev);
95 chance -= 3 * (adj_mag_stat[caster_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
97 if (spell.mana_cost > caster_ptr->csp) {
98 chance += 5 * (spell.mana_cost - caster_ptr->csp);
102 if (spell.mana_cost > caster_ptr->chp) {
108 minfail = adj_mag_fail[caster_ptr->stat_ind[mp_ptr->spell_stat]];
109 if (chance < minfail)
112 if (caster_ptr->stun > 50)
114 else if (caster_ptr->stun)
120 mindcraft_info(caster_ptr, comment, use_mind, i);
121 sprintf(psi_desc, " %c) %-30s%2d %4d %3d%%%s", I2A(i), spell.name, spell.min_lev, spell.mana_cost, chance, comment);
123 term_putstr(x, y + i + 1, -1, a, psi_desc);
129 if (REALM_NONE == caster_ptr->realm1)
132 for (int j = 0; j < ((caster_ptr->realm2 > REALM_NONE) ? 2 : 1); j++) {
134 y = (j < 3) ? 0 : (m[j - 3] + 2);
137 for (int i = 0; i < 32; i++) {
140 if (!is_magic((j < 1) ? caster_ptr->realm1 : caster_ptr->realm2)) {
141 s_ptr = &technic_info[((j < 1) ? caster_ptr->realm1 : caster_ptr->realm2) - MIN_TECHNIC][i % 32];
143 s_ptr = &mp_ptr->info[((j < 1) ? caster_ptr->realm1 : caster_ptr->realm2) - 1][i % 32];
146 strcpy(name, exe_spell(caster_ptr, (j < 1) ? caster_ptr->realm1 : caster_ptr->realm2, i % 32, SPELL_NAME));
148 if (s_ptr->slevel >= 99) {
149 strcpy(name, _("(判読不能)", "(illegible)"));
151 } else if ((j < 1) ? ((caster_ptr->spell_forgotten1 & (1L << i))) : ((caster_ptr->spell_forgotten2 & (1L << (i % 32))))) {
153 } else if (!((j < 1) ? (caster_ptr->spell_learned1 & (1L << i)) : (caster_ptr->spell_learned2 & (1L << (i % 32))))) {
155 } else if (!((j < 1) ? (caster_ptr->spell_worked1 & (1L << i)) : (caster_ptr->spell_worked2 & (1L << (i % 32))))) {
159 sprintf(out_val, "%c/%c) %-20.20s", I2A(n / 8), I2A(n % 8), name);
162 term_putstr(x, m[j], -1, a, out_val);
169 * @brief 現在の習得済魔法をサブウィンドウに表示する /
170 * @param player_ptr プレーヤーへの参照ポインタ
171 * Hack -- display spells in sub-windows
174 void fix_spell(player_type *player_ptr)
176 for (int j = 0; j < 8; j++) {
177 term_type *old = Term;
178 if (!angband_term[j])
181 if (!(window_flag[j] & (PW_SPELL)))
184 term_activate(angband_term[j]);
185 display_spell_list(player_ptr);