3 #include "spells-status.h"
4 #include "projection.h"
8 * @brief
\83\82\83\93\83X
\83^
\81[
\89ñ
\95\9c\8f\88\97\9d
9 * @param dir
\95û
\8cü(5
\82È
\82ç
\82Î
\83O
\83\8d\81[
\83o
\83\8b\95Ï
\90\94 target_col/target_row
\82Ì
\8dÀ
\95W
\82ð
\96Ú
\95W
\82É
\82·
\82é)
11 * @return
\8dì
\97p
\82ª
\8eÀ
\8dÛ
\82É
\82 \82Á
\82½
\8fê
\8d\87TRUE
\82ð
\95Ô
\82·
13 bool heal_monster(DIRECTION dir, HIT_POINT dam)
15 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
16 return (project_hook(GF_OLD_HEAL, dir, dam, flg));
20 * @brief
\83\82\83\93\83X
\83^
\81[
\89Á
\91¬
\8f\88\97\9d
21 * @param dir
\95û
\8cü(5
\82È
\82ç
\82Î
\83O
\83\8d\81[
\83o
\83\8b\95Ï
\90\94 target_col/target_row
\82Ì
\8dÀ
\95W
\82ð
\96Ú
\95W
\82É
\82·
\82é)
22 * @param power
\8cø
\97Í
23 * @return
\8dì
\97p
\82ª
\8eÀ
\8dÛ
\82É
\82 \82Á
\82½
\8fê
\8d\87TRUE
\82ð
\95Ô
\82·
25 bool speed_monster(DIRECTION dir, int power)
27 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
28 return (project_hook(GF_OLD_SPEED, dir, power, flg));
32 * @brief
\83\82\83\93\83X
\83^
\81[
\8c¸
\91¬
\8f\88\97\9d
33 * @param dir
\95û
\8cü(5
\82È
\82ç
\82Î
\83O
\83\8d\81[
\83o
\83\8b\95Ï
\90\94 target_col/target_row
\82Ì
\8dÀ
\95W
\82ð
\96Ú
\95W
\82É
\82·
\82é)
34 * @param power
\8cø
\97Í
35 * @return
\8dì
\97p
\82ª
\8eÀ
\8dÛ
\82É
\82 \82Á
\82½
\8fê
\8d\87TRUE
\82ð
\95Ô
\82·
37 bool slow_monster(DIRECTION dir, int power)
39 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
40 return (project_hook(GF_OLD_SLOW, dir, power, flg));
44 * @brief
\83\82\83\93\83X
\83^
\81[
\8dÃ
\96°
\8f\88\97\9d
45 * @param dir
\95û
\8cü(5
\82È
\82ç
\82Î
\83O
\83\8d\81[
\83o
\83\8b\95Ï
\90\94 target_col/target_row
\82Ì
\8dÀ
\95W
\82ð
\96Ú
\95W
\82É
\82·
\82é)
46 * @param power
\8cø
\97Í
47 * @return
\8dì
\97p
\82ª
\8eÀ
\8dÛ
\82É
\82 \82Á
\82½
\8fê
\8d\87TRUE
\82ð
\95Ô
\82·
49 bool sleep_monster(DIRECTION dir, int power)
51 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
52 return (project_hook(GF_OLD_SLEEP, dir, power, flg));
56 * @brief
\83\82\83\93\83X
\83^
\81[
\8dS
\91©(STASIS)
\8f\88\97\9d
57 * @param dir
\95û
\8cü(5
\82È
\82ç
\82Î
\83O
\83\8d\81[
\83o
\83\8b\95Ï
\90\94 target_col/target_row
\82Ì
\8dÀ
\95W
\82ð
\96Ú
\95W
\82É
\82·
\82é)
58 * @return
\8dì
\97p
\82ª
\8eÀ
\8dÛ
\82É
\82 \82Á
\82½
\8fê
\8d\87TRUE
\82ð
\95Ô
\82·
59 * @details
\88Ð
\97Í
\82Í
\83v
\83\8c\83C
\83\84\81[
\83\8c\83x
\83\8b*2
\82É
\8cÅ
\92è
61 bool stasis_monster(DIRECTION dir)
63 return (fire_ball_hide(GF_STASIS, dir, p_ptr->lev * 2, 0));
67 * @brief
\8e×
\88«
\82È
\83\82\83\93\83X
\83^
\81[
\8dS
\91©(STASIS)
\8f\88\97\9d
68 * @param dir
\95û
\8cü(5
\82È
\82ç
\82Î
\83O
\83\8d\81[
\83o
\83\8b\95Ï
\90\94 target_col/target_row
\82Ì
\8dÀ
\95W
\82ð
\96Ú
\95W
\82É
\82·
\82é)
69 * @return
\8dì
\97p
\82ª
\8eÀ
\8dÛ
\82É
\82 \82Á
\82½
\8fê
\8d\87TRUE
\82ð
\95Ô
\82·
70 * @details
\88Ð
\97Í
\82Í
\83v
\83\8c\83C
\83\84\81[
\83\8c\83x
\83\8b*2
\82É
\8cÅ
\92è
72 bool stasis_evil(DIRECTION dir)
74 return (fire_ball_hide(GF_STASIS_EVIL, dir, p_ptr->lev * 2, 0));
78 * @brief
\83\82\83\93\83X
\83^
\81[
\8d¬
\97\90\8f\88\97\9d
79 * @param dir
\95û
\8cü(5
\82È
\82ç
\82Î
\83O
\83\8d\81[
\83o
\83\8b\95Ï
\90\94 target_col/target_row
\82Ì
\8dÀ
\95W
\82ð
\96Ú
\95W
\82É
\82·
\82é)
80 * @param plev
\83v
\83\8c\83C
\83\84\81[
\83\8c\83x
\83\8b(=
\8cø
\97Í)
81 * @return
\8dì
\97p
\82ª
\8eÀ
\8dÛ
\82É
\82 \82Á
\82½
\8fê
\8d\87TRUE
\82ð
\95Ô
\82·
83 bool confuse_monster(DIRECTION dir, PLAYER_LEVEL plev)
85 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
86 return (project_hook(GF_OLD_CONF, dir, plev, flg));
90 * @brief
\83\82\83\93\83X
\83^
\81[
\9eN
\9eO
\8f\88\97\9d
91 * @param dir
\95û
\8cü(5
\82È
\82ç
\82Î
\83O
\83\8d\81[
\83o
\83\8b\95Ï
\90\94 target_col/target_row
\82Ì
\8dÀ
\95W
\82ð
\96Ú
\95W
\82É
\82·
\82é)
92 * @param plev
\83v
\83\8c\83C
\83\84\81[
\83\8c\83x
\83\8b(=
\8cø
\97Í)
93 * @return
\8dì
\97p
\82ª
\8eÀ
\8dÛ
\82É
\82 \82Á
\82½
\8fê
\8d\87TRUE
\82ð
\95Ô
\82·
95 bool stun_monster(DIRECTION dir, PLAYER_LEVEL plev)
97 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
98 return (project_hook(GF_STUN, dir, plev, flg));
102 * @brief
\83`
\83F
\83\93\83W
\83\82\83\93\83X
\83^
\81[
\8f\88\97\9d
103 * @param dir
\95û
\8cü(5
\82È
\82ç
\82Î
\83O
\83\8d\81[
\83o
\83\8b\95Ï
\90\94 target_col/target_row
\82Ì
\8dÀ
\95W
\82ð
\96Ú
\95W
\82É
\82·
\82é)
104 * @param power
\8cø
\97Í
105 * @return
\8dì
\97p
\82ª
\8eÀ
\8dÛ
\82É
\82 \82Á
\82½
\8fê
\8d\87TRUE
\82ð
\95Ô
\82·
107 bool poly_monster(DIRECTION dir, int power)
109 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
110 bool tester = (project_hook(GF_OLD_POLY, dir, power, flg));
112 chg_virtue(V_CHANCE, 1);
117 * @brief
\83N
\83\8d\81[
\83\93\83\82\83\93\83X
\83^
\81[
\8f\88\97\9d
118 * @param dir
\95û
\8cü(5
\82È
\82ç
\82Î
\83O
\83\8d\81[
\83o
\83\8b\95Ï
\90\94 target_col/target_row
\82Ì
\8dÀ
\95W
\82ð
\96Ú
\95W
\82É
\82·
\82é)
119 * @return
\8dì
\97p
\82ª
\8eÀ
\8dÛ
\82É
\82 \82Á
\82½
\8fê
\8d\87TRUE
\82ð
\95Ô
\82·
121 bool clone_monster(DIRECTION dir)
123 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
124 return (project_hook(GF_OLD_CLONE, dir, 0, flg));
128 * @brief
\83\82\83\93\83X
\83^
\81[
\8b°
\8dQ
\8f\88\97\9d
129 * @param dir
\95û
\8cü(5
\82È
\82ç
\82Î
\83O
\83\8d\81[
\83o
\83\8b\95Ï
\90\94 target_col/target_row
\82Ì
\8dÀ
\95W
\82ð
\96Ú
\95W
\82É
\82·
\82é)
130 * @param plev
\83v
\83\8c\83C
\83\84\81[
\83\8c\83x
\83\8b(=
\8cø
\97Í)
131 * @return
\8dì
\97p
\82ª
\8eÀ
\8dÛ
\82É
\82 \82Á
\82½
\8fê
\8d\87TRUE
\82ð
\95Ô
\82·
133 bool fear_monster(DIRECTION dir, PLAYER_LEVEL plev)
135 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
136 return (project_hook(GF_TURN_ALL, dir, plev, flg));
140 * @brief
\89Ì
\82Ì
\92â
\8e~
\82ð
\8f\88\97\9d\82·
\82é / Stop singing if the player is a Bard
143 void stop_singing(void)
145 if (p_ptr->pclass != CLASS_BARD) return;
147 /* Are there interupted song? */
148 if (INTERUPTING_SONG_EFFECT(p_ptr))
150 /* Forget interupted song */
151 INTERUPTING_SONG_EFFECT(p_ptr) = MUSIC_NONE;
155 /* The player is singing? */
156 if (!SINGING_SONG_EFFECT(p_ptr)) return;
158 /* Hack -- if called from set_action(), avoid recursive loop */
159 if (p_ptr->action == ACTION_SING) set_action(ACTION_NONE);
161 /* Message text of each song or etc. */
162 do_spell(REALM_MUSIC, SINGING_SONG_ID(p_ptr), SPELL_STOP);
164 SINGING_SONG_EFFECT(p_ptr) = MUSIC_NONE;
165 SINGING_SONG_ID(p_ptr) = 0;
166 p_ptr->update |= (PU_BONUS);
167 p_ptr->redraw |= (PR_STATUS);
170 bool time_walk(player_type *creature_ptr)
172 if (creature_ptr->timewalk)
174 msg_print(_("
\8aù
\82É
\8e\9e\82Í
\8e~
\82Ü
\82Á
\82Ä
\82¢
\82é
\81B", "Time is already stopped."));
177 creature_ptr->timewalk = TRUE;
178 msg_print(_("
\81u
\8e\9e\82æ
\81I
\81v", "You yell 'Time!'"));
182 creature_ptr->energy_need -= 1000 + (100 + p_ptr->csp - 50)*TURNS_PER_TICK / 10;
183 creature_ptr->redraw |= (PR_MAP);
184 creature_ptr->update |= (PU_MONSTERS);
185 creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
191 * @brief
\83v
\83\8c\83C
\83\84\81[
\82Ì
\83q
\83b
\83g
\83_
\83C
\83X
\82ð
\90U
\82é / Role Hitpoints
192 * @param options
\83X
\83y
\83\8b\8b¤
\92Ê
\83I
\83v
\83V
\83\87\83\93
195 void roll_hitdice(SPOP_FLAGS options)
199 /* Minimum hitpoints at highest level */
200 HIT_POINT min_value = p_ptr->hitdie + ((PY_MAX_LEVEL + 2) * (p_ptr->hitdie + 1)) * 3 / 8;
202 /* Maximum hitpoints at highest level */
203 HIT_POINT max_value = p_ptr->hitdie + ((PY_MAX_LEVEL + 2) * (p_ptr->hitdie + 1)) * 5 / 8;
210 /* Pre-calculate level 1 hitdice */
211 p_ptr->player_hp[0] = (HIT_POINT)p_ptr->hitdie;
213 for (i = 1; i < 4; i++)
215 p_ptr->player_hp[0] += randint1(p_ptr->hitdie);
218 /* Roll the hitpoint values */
219 for (i = 1; i < PY_MAX_LEVEL; i++)
221 p_ptr->player_hp[i] = p_ptr->player_hp[i - 1] + randint1(p_ptr->hitdie);
224 /* Require "valid" hitpoints at highest level */
225 if ((p_ptr->player_hp[PY_MAX_LEVEL - 1] >= min_value) &&
226 (p_ptr->player_hp[PY_MAX_LEVEL - 1] <= max_value)) break;
229 percent = (int)(((long)p_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) /
230 (2 * p_ptr->hitdie + ((PY_MAX_LEVEL - 1 + 3) * (p_ptr->hitdie + 1))));
232 /* Update and redraw hitpoints */
233 p_ptr->update |= (PU_HP);
234 p_ptr->redraw |= (PR_HP);
235 p_ptr->window |= (PW_PLAYER);
237 if (!(options & SPOP_NO_UPDATE)) handle_stuff();
239 if (options & SPOP_DISPLAY_MES)
241 if (options & SPOP_DEBUG)
243 msg_format(_("
\8c»
\8dÝ
\82Ì
\91Ì
\97Í
\83\89\83\93\83N
\82Í %d/100
\82Å
\82·
\81B", "Your life rate is %d/100 now."), percent);
244 p_ptr->knowledge |= KNOW_HPRATE;
248 msg_print(_("
\91Ì
\97Í
\83\89\83\93\83N
\82ª
\95Ï
\82í
\82Á
\82½
\81B", "Life rate is changed."));
249 p_ptr->knowledge &= ~(KNOW_HPRATE);
254 bool_hack life_stream(bool_hack message, bool_hack virtue_change)
258 chg_virtue(V_VITALITY, 1);
259 chg_virtue(V_UNLIFE, -5);
263 msg_print(_("
\91Ì
\92\86\82É
\90¶
\96½
\97Í
\82ª
\96\9e\82¿
\82 \82Ó
\82ê
\82Ä
\82«
\82½
\81I", "You feel life flow through your body!"));
266 (void)set_poisoned(0);
268 (void)set_confused(0);
272 (void)restore_all_status();
273 (void)set_shero(0, TRUE);
280 bool_hack heroism(int base)
282 bool_hack ident = FALSE;
283 if (set_afraid(0)) ident = TRUE;
284 if (set_hero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
285 if (hp_player(10)) ident = TRUE;
289 bool_hack berserk(int base)
291 bool_hack ident = FALSE;
292 if (set_afraid(0)) ident = TRUE;
293 if (set_shero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
294 if (hp_player(30)) ident = TRUE;
298 bool_hack cure_light_wounds(DICE_NUMBER dice, DICE_SID sides)
300 bool_hack ident = FALSE;
301 if (hp_player(damroll(dice, sides))) ident = TRUE;
302 if (set_blind(0)) ident = TRUE;
303 if (set_cut(p_ptr->cut - 10)) ident = TRUE;
304 if (set_shero(0, TRUE)) ident = TRUE;
308 bool_hack cure_serious_wounds(DICE_NUMBER dice, DICE_SID sides)
310 bool_hack ident = FALSE;
311 if (hp_player(damroll(dice, sides))) ident = TRUE;
312 if (set_blind(0)) ident = TRUE;
313 if (set_confused(0)) ident = TRUE;
314 if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE;
315 if (set_shero(0, TRUE)) ident = TRUE;
319 bool_hack cure_critical_wounds(HIT_POINT pow)
321 bool_hack ident = FALSE;
322 if (hp_player(pow)) ident = TRUE;
323 if (set_blind(0)) ident = TRUE;
324 if (set_confused(0)) ident = TRUE;
325 if (set_poisoned(0)) ident = TRUE;
326 if (set_stun(0)) ident = TRUE;
327 if (set_cut(0)) ident = TRUE;
328 if (set_shero(0, TRUE)) ident = TRUE;
332 bool_hack true_healing(HIT_POINT pow)
334 bool_hack ident = FALSE;
335 if (hp_player(pow)) ident = TRUE;
336 if (set_blind(0)) ident = TRUE;
337 if (set_confused(0)) ident = TRUE;
338 if (set_poisoned(0)) ident = TRUE;
339 if (set_stun(0)) ident = TRUE;
340 if (set_cut(0)) ident = TRUE;
341 if (set_image(0)) ident = TRUE;
345 bool_hack restore_mana(bool_hack magic_eater)
347 bool_hack ident = FALSE;
349 if (p_ptr->pclass == CLASS_MAGIC_EATER && magic_eater)
352 for (i = 0; i < EATER_EXT * 2; i++)
354 p_ptr->magic_num1[i] += (p_ptr->magic_num2[i] < 10) ? EATER_CHARGE * 3 : p_ptr->magic_num2[i] * EATER_CHARGE / 3;
355 if (p_ptr->magic_num1[i] > p_ptr->magic_num2[i] * EATER_CHARGE) p_ptr->magic_num1[i] = p_ptr->magic_num2[i] * EATER_CHARGE;
357 for (; i < EATER_EXT * 3; i++)
359 KIND_OBJECT_IDX k_idx = lookup_kind(TV_ROD, i - EATER_EXT * 2);
360 p_ptr->magic_num1[i] -= ((p_ptr->magic_num2[i] < 10) ? EATER_ROD_CHARGE * 3 : p_ptr->magic_num2[i] * EATER_ROD_CHARGE / 3)*k_info[k_idx].pval;
361 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
363 msg_print(_("
\93ª
\82ª
\83n
\83b
\83L
\83\8a\82Æ
\82µ
\82½
\81B", "You feel your head clear."));
364 p_ptr->window |= (PW_PLAYER);
367 else if (p_ptr->csp < p_ptr->msp)
369 p_ptr->csp = p_ptr->msp;
371 msg_print(_("
\93ª
\82ª
\83n
\83b
\83L
\83\8a\82Æ
\82µ
\82½
\81B", "You feel your head clear."));
372 p_ptr->redraw |= (PR_MANA);
373 p_ptr->window |= (PW_PLAYER);
374 p_ptr->window |= (PW_SPELL);
381 bool restore_all_status(void)
384 if (do_res_stat(A_STR)) ident = TRUE;
385 if (do_res_stat(A_INT)) ident = TRUE;
386 if (do_res_stat(A_WIS)) ident = TRUE;
387 if (do_res_stat(A_DEX)) ident = TRUE;
388 if (do_res_stat(A_CON)) ident = TRUE;
389 if (do_res_stat(A_CHR)) ident = TRUE;