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-info/class-info.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 "system/player-type-definition.h"
14 #include "term/gameterm.h"
15 #include "term/screen-processor.h"
16 #include "term/term-color-types.h"
17 #include "util/int-char-converter.h"
18 #include "view/display-messages.h"
21 * @brief クリーチャー全既知呪文を表示する /
22 * Hack -- Display all known spells in a window
23 * @param caster_ptr 術者の参照ポインタ
26 * Need to analyze size of the window.
27 * Need more color coding.
29 static void display_spell_list(player_type *caster_ptr)
33 const magic_type *s_ptr;
34 GAME_TEXT name[MAX_NLEN];
39 if (caster_ptr->pclass == CLASS_SORCERER)
41 if (caster_ptr->pclass == CLASS_RED_MAGE)
43 if (caster_ptr->pclass == CLASS_SNIPER) {
44 display_snipe_list(caster_ptr);
48 if ((caster_ptr->pclass == CLASS_MINDCRAFTER) || (caster_ptr->pclass == CLASS_BERSERKER) || (caster_ptr->pclass == CLASS_NINJA)
49 || (caster_ptr->pclass == CLASS_MIRROR_MASTER) || (caster_ptr->pclass == CLASS_FORCETRAINER) || caster_ptr->pclass == CLASS_ELEMENTALIST) {
50 PERCENTAGE minfail = 0;
51 PLAYER_LEVEL plev = caster_ptr->lev;
52 PERCENTAGE chance = 0;
56 mind_kind_type use_mind;
63 put_str(_("名前", "Name"), y, x + 5);
64 put_str(_("Lv MP 失率 効果", "Lv Mana Fail Info"), y, x + 35);
66 switch (caster_ptr->pclass) {
67 case CLASS_MINDCRAFTER:
68 use_mind = mind_kind_type::MINDCRAFTER;
70 case CLASS_FORCETRAINER:
71 use_mind = mind_kind_type::KI;
74 use_mind = mind_kind_type::BERSERKER;
77 case CLASS_MIRROR_MASTER:
78 use_mind = mind_kind_type::MIRROR_MASTER;
81 use_mind = mind_kind_type::NINJUTSU;
84 case CLASS_ELEMENTALIST:
85 use_mind = mind_kind_type::ELEMENTAL;
88 use_mind = mind_kind_type::MINDCRAFTER;
92 for (int i = 0; i < MAX_MIND_POWERS; i++) {
94 spell = mind_powers[static_cast<int>(use_mind)].info[i];
95 if (spell.min_lev > plev)
99 chance -= 3 * (caster_ptr->lev - spell.min_lev);
100 chance -= 3 * (adj_mag_stat[caster_ptr->stat_index[mp_ptr->spell_stat]] - 1);
102 if (spell.mana_cost > caster_ptr->csp) {
103 chance += 5 * (spell.mana_cost - caster_ptr->csp);
107 if (spell.mana_cost > caster_ptr->chp) {
113 minfail = adj_mag_fail[caster_ptr->stat_index[mp_ptr->spell_stat]];
114 if (chance < minfail)
117 if (caster_ptr->stun > 50)
119 else if (caster_ptr->stun)
125 mindcraft_info(caster_ptr, comment, use_mind, i);
126 sprintf(psi_desc, " %c) %-30s%2d %4d %3d%%%s", I2A(i), spell.name, spell.min_lev, spell.mana_cost, chance, comment);
128 term_putstr(x, y + i + 1, -1, a, psi_desc);
134 if (REALM_NONE == caster_ptr->realm1)
137 for (int j = 0; j < ((caster_ptr->realm2 > REALM_NONE) ? 2 : 1); j++) {
139 y = (j < 3) ? 0 : (m[j - 3] + 2);
142 for (int i = 0; i < 32; i++) {
145 if (!is_magic((j < 1) ? caster_ptr->realm1 : caster_ptr->realm2)) {
146 s_ptr = &technic_info[((j < 1) ? caster_ptr->realm1 : caster_ptr->realm2) - MIN_TECHNIC][i % 32];
148 s_ptr = &mp_ptr->info[((j < 1) ? caster_ptr->realm1 : caster_ptr->realm2) - 1][i % 32];
151 strcpy(name, exe_spell(caster_ptr, (j < 1) ? caster_ptr->realm1 : caster_ptr->realm2, i % 32, SPELL_NAME));
153 if (s_ptr->slevel >= 99) {
154 strcpy(name, _("(判読不能)", "(illegible)"));
156 } else if ((j < 1) ? ((caster_ptr->spell_forgotten1 & (1UL << i))) : ((caster_ptr->spell_forgotten2 & (1UL << (i % 32))))) {
158 } else if (!((j < 1) ? (caster_ptr->spell_learned1 & (1UL << i)) : (caster_ptr->spell_learned2 & (1UL << (i % 32))))) {
160 } else if (!((j < 1) ? (caster_ptr->spell_worked1 & (1UL << i)) : (caster_ptr->spell_worked2 & (1UL << (i % 32))))) {
164 sprintf(out_val, "%c/%c) %-20.20s", I2A(n / 8), I2A(n % 8), name);
167 term_putstr(x, m[j], -1, a, out_val);
174 * @brief 現在の習得済魔法をサブウィンドウに表示する /
175 * @param player_ptr プレーヤーへの参照ポインタ
176 * Hack -- display spells in sub-windows
178 void fix_spell(player_type *player_ptr)
180 for (int j = 0; j < 8; j++) {
181 term_type *old = Term;
182 if (!angband_term[j])
185 if (!(window_flag[j] & (PW_SPELL)))
188 term_activate(angband_term[j]);
189 display_spell_list(player_ptr);
191 player_ptr->window_flags &= ~(PW_SPELL);