6 0: Flag bits of spelling spells
7 1: Flag bits of despelled spells
10 0: Number of spelling spells
12 2: Turn count for revenge
17 bool stop_hex_spell_all(void)
21 for (i = 0; i < 32; i++)
24 if (hex_spelling(spell)) do_spell(REALM_HEX, spell, SPELL_STOP);
27 p_ptr->magic_num1[0] = 0;
28 p_ptr->magic_num2[0] = 0;
31 if (p_ptr->action == ACTION_SPELL) set_action(ACTION_NONE);
34 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
35 p_ptr->redraw |= (PR_EXTRA | PR_HP | PR_MANA);
41 bool stop_hex_spell(void)
51 if (!hex_spelling_any())
54 msg_print("¼öʸ¤ò±Ó¾§¤·¤Æ¤¤¤Þ¤»¤ó¡£");
56 msg_print("You are casting no spell.");
62 else if ((p_ptr->magic_num2[0] == 1) || (p_ptr->lev < 35))
64 return stop_hex_spell_all();
69 strnfmt(out_val, 78, "¤É¤Î¼öʸ¤Î±Ó¾§¤òÃæÃǤ·¤Þ¤¹¤«¡©(¼öʸ %c-%c, 'l'Á´¤Æ, ESC)",
70 I2A(0), I2A(p_ptr->magic_num2[0] - 1));
72 strnfmt(out_val, 78, "Which spell do you stop casting? (Spell %c-%c, 'l' to all, ESC)",
73 I2A(0), I2A(p_ptr->magic_num2[0] - 1));
81 Term_erase(x, y, 255);
82 prt(" ̾Á°", y, x + 5);
83 for (spell = 0; spell < 32; spell++)
85 if (hex_spelling(spell))
87 Term_erase(x, y + n + 1, 255);
88 put_str(format("%c) %s", I2A(n), do_spell(REALM_HEX, spell, SPELL_NAME)), y + n + 1, x + 2);
93 if (!get_com(out_val, &choice, TRUE)) break;
94 if (isupper(choice)) choice = tolower(choice);
96 if (choice == 'l') /* All */
99 return stop_hex_spell_all();
101 if ((choice < I2A(0)) || (choice > I2A(p_ptr->magic_num2[0] - 1))) continue;
110 int n = sp[A2I(choice)];
112 do_spell(REALM_HEX, n, SPELL_STOP);
113 p_ptr->magic_num1[0] &= ~(1L << n);
114 p_ptr->magic_num2[0]--;
118 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
119 p_ptr->redraw |= (PR_EXTRA | PR_HP | PR_MANA);
125 /* Upkeeping hex spells
126 Called from dungeon.c */
135 /* Spells spelled by player */
136 if (p_ptr->realm1 != REALM_HEX) return;
137 if (!p_ptr->magic_num1[0] && !p_ptr->magic_num1[1]) return;
139 if (p_ptr->magic_num1[1])
141 p_ptr->magic_num1[0] = p_ptr->magic_num1[1];
142 p_ptr->magic_num1[1] = 0;
146 /* Stop all spells when anti-magic ability is given */
147 if (p_ptr->anti_magic)
149 stop_hex_spell_all();
154 for (spell = 0; spell < 32; spell++)
156 if (hex_spelling(spell))
158 s_ptr = &technic_info[REALM_HEX - MIN_TECHNIC][spell];
159 need_mana += mod_need_mana(s_ptr->smana, spell, REALM_HEX);
164 /* Culcurates final mana cost */
166 s64b_div(&need_mana, &need_mana_frac, 0, 3); /* Divide by 3 */
167 need_mana += (p_ptr->magic_num2[0] - 1);
170 /* Not enough mana */
171 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, need_mana, need_mana_frac) < 0)
173 stop_hex_spell_all();
180 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), need_mana, need_mana_frac);
182 p_ptr->redraw |= PR_MANA;
186 msg_print("±Ó¾§¤òºÆ³«¤·¤¿¡£");
188 msg_print("You restart spelling.");
190 p_ptr->action = ACTION_SPELL;
192 /* Recalculate bonuses */
193 p_ptr->update |= (PU_BONUS | PU_HP);
195 /* Redraw map and status bar */
196 p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
198 /* Update monsters */
199 p_ptr->update |= (PU_MONSTERS);
202 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
206 /* Gain experiences of spelling spells */
207 for (spell = 0; spell < 32; spell++)
209 if (!hex_spelling(spell)) continue;
211 if (p_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
212 p_ptr->spell_exp[spell] += 5;
213 else if(p_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
214 { if (one_in_(2) && (dun_level > 4) && ((dun_level + 10) > p_ptr->lev)) p_ptr->spell_exp[spell] += 1; }
215 else if(p_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
216 { if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && ((dun_level + 5) > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
217 else if(p_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
218 { if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && (dun_level > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
221 /* Do any effects of continual spells */
222 for (spell = 0; spell < 32; spell++)
224 if (hex_spelling(spell))
226 do_spell(REALM_HEX, spell, SPELL_CONT);
232 bool hex_spell_fully(void)
236 k_max = (p_ptr->lev / 15) + 1;
239 k_max = MIN(k_max, MAX_KEEP);
241 if (p_ptr->magic_num2[0] < k_max) return FALSE;
248 if (p_ptr->realm1 != REALM_HEX) return;
249 if (p_ptr->magic_num2[2] <= 0) return;
251 switch(p_ptr->magic_num2[1])
253 case 1: do_spell(REALM_HEX, HEX_PATIENCE, SPELL_CONT); break;
254 case 2: do_spell(REALM_HEX, HEX_REVENGE, SPELL_CONT); break;
258 void revenge_store(int dam)
260 if (p_ptr->realm1 != REALM_HEX) return;
261 if (p_ptr->magic_num2[2] <= 0) return;
263 p_ptr->magic_num1[2] += dam;
267 bool teleport_barrier(int m_idx)
269 monster_type *m_ptr = &m_list[m_idx];
270 monster_race *r_ptr = &r_info[m_ptr->r_idx];
272 if (!hex_spelling(HEX_ANTI_TELE)) return FALSE;
273 if ((p_ptr->lev * 3 / 2) < randint1(r_ptr->level)) return FALSE;
279 bool magic_barrier(int m_idx)
281 monster_type *m_ptr = &m_list[m_idx];
282 monster_race *r_ptr = &r_info[m_ptr->r_idx];
284 if (!hex_spelling(HEX_ANTI_MAGIC)) return FALSE;
285 if ((p_ptr->lev * 3 / 2) < randint1(r_ptr->level)) return FALSE;
291 bool multiply_barrier(int m_idx)
293 monster_type *m_ptr = &m_list[m_idx];
294 monster_race *r_ptr = &r_info[m_ptr->r_idx];
296 if (!hex_spelling(HEX_ANTI_MULTI)) return FALSE;
297 if ((p_ptr->lev * 3 / 2) < randint1(r_ptr->level)) return FALSE;