3 #include "player-status.h"
4 #include "spells-status.h"
10 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
12 * @return 作用が実際にあった場合TRUEを返す
14 bool heal_monster(DIRECTION dir, HIT_POINT dam)
16 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
17 return (project_hook(GF_OLD_HEAL, dir, dam, flg));
22 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
24 * @return 作用が実際にあった場合TRUEを返す
26 bool speed_monster(DIRECTION dir, int power)
28 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
29 return (project_hook(GF_OLD_SPEED, dir, power, flg));
34 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
36 * @return 作用が実際にあった場合TRUEを返す
38 bool slow_monster(DIRECTION dir, int power)
40 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
41 return (project_hook(GF_OLD_SLOW, dir, power, flg));
46 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
48 * @return 作用が実際にあった場合TRUEを返す
50 bool sleep_monster(DIRECTION dir, int power)
52 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
53 return (project_hook(GF_OLD_SLEEP, dir, power, flg));
57 * @brief モンスター拘束(STASIS)処理
58 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
59 * @return 作用が実際にあった場合TRUEを返す
60 * @details 威力はプレイヤーレベル*2に固定
62 bool stasis_monster(DIRECTION dir)
64 return (fire_ball_hide(GF_STASIS, dir, p_ptr->lev * 2, 0));
68 * @brief 邪悪なモンスター拘束(STASIS)処理
69 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
70 * @return 作用が実際にあった場合TRUEを返す
71 * @details 威力はプレイヤーレベル*2に固定
73 bool stasis_evil(DIRECTION dir)
75 return (fire_ball_hide(GF_STASIS_EVIL, dir, p_ptr->lev * 2, 0));
80 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
81 * @param plev プレイヤーレベル(=効力)
82 * @return 作用が実際にあった場合TRUEを返す
84 bool confuse_monster(DIRECTION dir, PLAYER_LEVEL plev)
86 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
87 return (project_hook(GF_OLD_CONF, dir, plev, flg));
92 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
93 * @param plev プレイヤーレベル(=効力)
94 * @return 作用が実際にあった場合TRUEを返す
96 bool stun_monster(DIRECTION dir, PLAYER_LEVEL plev)
98 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
99 return (project_hook(GF_STUN, dir, plev, flg));
104 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
106 * @return 作用が実際にあった場合TRUEを返す
108 bool poly_monster(DIRECTION dir, int power)
110 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
111 bool tester = (project_hook(GF_OLD_POLY, dir, power, flg));
113 chg_virtue(V_CHANCE, 1);
119 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
120 * @return 作用が実際にあった場合TRUEを返す
122 bool clone_monster(DIRECTION dir)
124 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
125 return (project_hook(GF_OLD_CLONE, dir, 0, flg));
130 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
131 * @param plev プレイヤーレベル(=効力)
132 * @return 作用が実際にあった場合TRUEを返す
134 bool fear_monster(DIRECTION dir, PLAYER_LEVEL plev)
136 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
137 return (project_hook(GF_TURN_ALL, dir, plev, flg));
141 * @brief 歌の停止を処理する / Stop singing if the player is a Bard
144 void stop_singing(player_type *creature_ptr)
146 if (creature_ptr->pclass != CLASS_BARD) return;
148 /* Are there interupted song? */
149 if (INTERUPTING_SONG_EFFECT(creature_ptr))
151 /* Forget interupted song */
152 INTERUPTING_SONG_EFFECT(creature_ptr) = MUSIC_NONE;
156 /* The player is singing? */
157 if (!SINGING_SONG_EFFECT(creature_ptr)) return;
159 /* Hack -- if called from set_action(), avoid recursive loop */
160 if (creature_ptr->action == ACTION_SING) set_action(ACTION_NONE);
162 /* Message text of each song or etc. */
163 do_spell(REALM_MUSIC, SINGING_SONG_ID(creature_ptr), SPELL_STOP);
165 SINGING_SONG_EFFECT(creature_ptr) = MUSIC_NONE;
166 SINGING_SONG_ID(creature_ptr) = 0;
167 creature_ptr->update |= (PU_BONUS);
168 creature_ptr->redraw |= (PR_STATUS);
171 bool time_walk(player_type *creature_ptr)
173 if (creature_ptr->timewalk)
175 msg_print(_("既に時は止まっている。", "Time is already stopped."));
178 creature_ptr->timewalk = TRUE;
179 msg_print(_("「時よ!」", "You yell 'Time!'"));
180 // msg_print(_("「『ザ・ワールド』!時は止まった!」", "You yell 'The World! Time has stopped!'"));
184 creature_ptr->energy_need -= 1000 + (100 + p_ptr->csp - 50)*TURNS_PER_TICK / 10;
185 creature_ptr->redraw |= (PR_MAP);
186 creature_ptr->update |= (PU_MONSTERS);
187 creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
193 * @brief プレイヤーのヒットダイスを振る / Role Hitpoints
194 * @param options スペル共通オプション
197 void roll_hitdice(player_type *creature_ptr, SPOP_FLAGS options)
201 /* Minimum hitpoints at highest level */
202 HIT_POINT min_value = creature_ptr->hitdie + ((PY_MAX_LEVEL + 2) * (creature_ptr->hitdie + 1)) * 3 / 8;
204 /* Maximum hitpoints at highest level */
205 HIT_POINT max_value = creature_ptr->hitdie + ((PY_MAX_LEVEL + 2) * (creature_ptr->hitdie + 1)) * 5 / 8;
212 /* Pre-calculate level 1 hitdice */
213 creature_ptr->player_hp[0] = (HIT_POINT)creature_ptr->hitdie;
215 for (i = 1; i < 4; i++)
217 creature_ptr->player_hp[0] += randint1(creature_ptr->hitdie);
220 /* Roll the hitpoint values */
221 for (i = 1; i < PY_MAX_LEVEL; i++)
223 creature_ptr->player_hp[i] = creature_ptr->player_hp[i - 1] + randint1(creature_ptr->hitdie);
226 /* Require "valid" hitpoints at highest level */
227 if ((creature_ptr->player_hp[PY_MAX_LEVEL - 1] >= min_value) &&
228 (creature_ptr->player_hp[PY_MAX_LEVEL - 1] <= max_value)) break;
231 percent = (int)(((long)creature_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) /
232 (2 * creature_ptr->hitdie + ((PY_MAX_LEVEL - 1 + 3) * (creature_ptr->hitdie + 1))));
234 /* Update and redraw hitpoints */
235 creature_ptr->update |= (PU_HP);
236 creature_ptr->redraw |= (PR_HP);
237 creature_ptr->window |= (PW_PLAYER);
239 if (!(options & SPOP_NO_UPDATE)) handle_stuff();
241 if (options & SPOP_DISPLAY_MES)
243 if (options & SPOP_DEBUG)
245 msg_format(_("現在の体力ランクは %d/100 です。", "Your life rate is %d/100 now."), percent);
246 creature_ptr->knowledge |= KNOW_HPRATE;
250 msg_print(_("体力ランクが変わった。", "Life rate is changed."));
251 creature_ptr->knowledge &= ~(KNOW_HPRATE);
256 bool_hack life_stream(bool_hack message, bool_hack virtue_change)
260 chg_virtue(V_VITALITY, 1);
261 chg_virtue(V_UNLIFE, -5);
265 msg_print(_("体中に生命力が満ちあふれてきた!", "You feel life flow through your body!"));
268 (void)set_poisoned(0);
270 (void)set_confused(0);
274 (void)restore_all_status();
275 (void)set_shero(0, TRUE);
282 bool_hack heroism(int base)
284 bool_hack ident = FALSE;
285 if (set_afraid(0)) ident = TRUE;
286 if (set_hero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
287 if (hp_player(10)) ident = TRUE;
291 bool_hack berserk(int base)
293 bool_hack ident = FALSE;
294 if (set_afraid(0)) ident = TRUE;
295 if (set_shero(p_ptr->shero + randint1(base) + base, FALSE)) ident = TRUE;
296 if (hp_player(30)) ident = TRUE;
300 bool_hack cure_light_wounds(DICE_NUMBER dice, DICE_SID sides)
302 bool_hack ident = FALSE;
303 if (hp_player(damroll(dice, sides))) ident = TRUE;
304 if (set_blind(0)) ident = TRUE;
305 if (set_cut(p_ptr->cut - 10)) ident = TRUE;
306 if (set_shero(0, TRUE)) ident = TRUE;
310 bool_hack cure_serious_wounds(DICE_NUMBER dice, DICE_SID sides)
312 bool_hack ident = FALSE;
313 if (hp_player(damroll(dice, sides))) ident = TRUE;
314 if (set_blind(0)) ident = TRUE;
315 if (set_confused(0)) ident = TRUE;
316 if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE;
317 if (set_shero(0, TRUE)) ident = TRUE;
321 bool_hack cure_critical_wounds(HIT_POINT pow)
323 bool_hack ident = FALSE;
324 if (hp_player(pow)) ident = TRUE;
325 if (set_blind(0)) ident = TRUE;
326 if (set_confused(0)) ident = TRUE;
327 if (set_poisoned(0)) ident = TRUE;
328 if (set_stun(0)) ident = TRUE;
329 if (set_cut(0)) ident = TRUE;
330 if (set_shero(0, TRUE)) ident = TRUE;
334 bool_hack true_healing(HIT_POINT pow)
336 bool_hack ident = FALSE;
337 if (hp_player(pow)) ident = TRUE;
338 if (set_blind(0)) ident = TRUE;
339 if (set_confused(0)) ident = TRUE;
340 if (set_poisoned(0)) ident = TRUE;
341 if (set_stun(0)) ident = TRUE;
342 if (set_cut(0)) ident = TRUE;
343 if (set_image(0)) ident = TRUE;
347 bool_hack restore_mana(bool_hack magic_eater)
349 bool_hack ident = FALSE;
351 if (p_ptr->pclass == CLASS_MAGIC_EATER && magic_eater)
354 for (i = 0; i < EATER_EXT * 2; i++)
356 p_ptr->magic_num1[i] += (p_ptr->magic_num2[i] < 10) ? EATER_CHARGE * 3 : p_ptr->magic_num2[i] * EATER_CHARGE / 3;
357 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;
359 for (; i < EATER_EXT * 3; i++)
361 KIND_OBJECT_IDX k_idx = lookup_kind(TV_ROD, i - EATER_EXT * 2);
362 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;
363 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
365 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
366 p_ptr->window |= (PW_PLAYER);
369 else if (p_ptr->csp < p_ptr->msp)
371 p_ptr->csp = p_ptr->msp;
373 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
374 p_ptr->redraw |= (PR_MANA);
375 p_ptr->window |= (PW_PLAYER);
376 p_ptr->window |= (PW_SPELL);
383 bool restore_all_status(void)
386 if (do_res_stat(A_STR)) ident = TRUE;
387 if (do_res_stat(A_INT)) ident = TRUE;
388 if (do_res_stat(A_WIS)) ident = TRUE;
389 if (do_res_stat(A_DEX)) ident = TRUE;
390 if (do_res_stat(A_CON)) ident = TRUE;
391 if (do_res_stat(A_CHR)) ident = TRUE;
395 bool fishing(player_type *creature_ptr)
400 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
401 y = creature_ptr->y + ddy[dir];
402 x = creature_ptr->x + ddx[dir];
403 creature_ptr->fishing_dir = dir;
404 if (!cave_have_flag_bold(y, x, FF_WATER))
406 msg_print(_("そこは水辺ではない。", "There is no fishing place."));
409 else if (current_floor_ptr->grid_array[y][x].m_idx)
411 GAME_TEXT m_name[MAX_NLEN];
412 monster_desc(m_name, ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx], 0);
413 msg_format(_("%sが邪魔だ!", "%^s is stand in your way."), m_name);
414 free_turn(creature_ptr);
417 set_action(ACTION_FISH);
418 creature_ptr->redraw |= (PR_STATE);
423 bool cosmic_cast_off(player_type *creature_ptr, object_type *o_ptr)
428 GAME_TEXT o_name[MAX_NLEN];
431 /* Cast off activated item */
432 for (inv = INVEN_RARM; inv <= INVEN_FEET; inv++)
434 if (o_ptr == &inventory[inv]) break;
436 if (inv > INVEN_FEET) return FALSE;
438 object_copy(&forge, o_ptr);
439 inven_item_increase(inv, (0 - o_ptr->number));
440 inven_item_optimize(inv);
441 o_idx = drop_near(&forge, 0, creature_ptr->y, creature_ptr->x);
442 o_ptr = ¤t_floor_ptr->o_list[o_idx];
444 object_desc(o_name, o_ptr, OD_NAME_ONLY);
445 msg_format(_("%sを脱ぎ捨てた。", "You cast off %s."), o_name);
448 msg_print(_("「燃え上がれ俺の小宇宙!」", "You say, 'Burn up my cosmo!"));
449 t = 20 + randint1(20);
450 (void)set_blind(creature_ptr->blind + t);
452 (void)set_tim_esp(creature_ptr->tim_esp + t, FALSE);
453 (void)set_tim_regen(creature_ptr->tim_regen + t, FALSE);
454 (void)set_hero(creature_ptr->hero + t, FALSE);
455 (void)set_blessed(creature_ptr->blessed + t, FALSE);
456 (void)set_fast(creature_ptr->fast + t, FALSE);
457 (void)set_shero(creature_ptr->shero + t, FALSE);
458 if (creature_ptr->pclass == CLASS_FORCETRAINER)
460 P_PTR_KI = creature_ptr->lev * 5 + 190;
461 msg_print(_("気が爆発寸前になった。", "Your force are immediatly before explosion."));
469 * @brief プレイヤーの因果混乱処理 / Apply Nexus
470 * @param m_ptr 因果混乱をプレイヤーに与えたモンスターの情報参照ポインタ
473 void apply_nexus(monster_type *m_ptr)
477 case 1: case 2: case 3:
479 teleport_player(200, TELEPORT_PASSIVE);
485 teleport_player_to(m_ptr->fy, m_ptr->fx, TELEPORT_PASSIVE);
491 if (randint0(100) < p_ptr->skill_sav)
493 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
502 if (randint0(100) < p_ptr->skill_sav)
504 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
508 msg_print(_("体がねじれ始めた...", "Your body starts to scramble..."));
516 * @brief プレイヤーのステータスシャッフル処理
519 void status_shuffle(void)
521 BASE_STATUS max1, cur1, max2, cur2;
524 /* Pick a pair of stats */
525 ii = randint0(A_MAX);
526 for (jj = ii; jj == ii; jj = randint0(A_MAX)) /* loop */;
528 max1 = p_ptr->stat_max[ii];
529 cur1 = p_ptr->stat_cur[ii];
530 max2 = p_ptr->stat_max[jj];
531 cur2 = p_ptr->stat_cur[jj];
533 p_ptr->stat_max[ii] = max2;
534 p_ptr->stat_cur[ii] = cur2;
535 p_ptr->stat_max[jj] = max1;
536 p_ptr->stat_cur[jj] = cur1;
538 for (i = 0; i < A_MAX; i++)
540 if (p_ptr->stat_max[i] > p_ptr->stat_max_max[i]) p_ptr->stat_max[i] = p_ptr->stat_max_max[i];
541 if (p_ptr->stat_cur[i] > p_ptr->stat_max_max[i]) p_ptr->stat_cur[i] = p_ptr->stat_max_max[i];
544 p_ptr->update |= (PU_BONUS);