3 * @brief プレイヤーのステータス管理 / effects of various "objects"
6 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
8 * This software may be copied and distributed for educational, research,\n
9 * and not for profit purposes provided that this copyright and statement\n
10 * are included in all such copies. Other copyrights may also apply.\n
12 * 2013 Deskull rearranged comment for Doxygen.\n
18 * @brief プレイヤーの継続行動を設定する。
19 * @param typ 継続行動のID\n
20 * #ACTION_NONE / #ACTION_SEARCH / #ACTION_REST / #ACTION_LEARN / #ACTION_FISH / #ACTION_KAMAE / #ACTION_KATA / #ACTION_SING / #ACTION_HAYAGAKE / #ACTION_SPELL から選択。
23 void set_action(ACTION_IDX typ)
25 int prev_typ = p_ptr->action;
37 msg_print(_("探索をやめた。", "You no longer walk carefully."));
38 p_ptr->redraw |= (PR_SPEED);
48 msg_print(_("学習をやめた。", "You stop Learning"));
54 msg_print(_("構えをといた。", "You stop assuming the posture."));
55 p_ptr->special_defense &= ~(KAMAE_MASK);
60 msg_print(_("型を崩した。", "You stop assuming the posture."));
61 p_ptr->special_defense &= ~(KATA_MASK);
62 p_ptr->update |= (PU_MONSTERS);
63 p_ptr->redraw |= (PR_STATUS);
68 msg_print(_("歌うのをやめた。", "You stop singing."));
73 msg_print(_("足が重くなった。", "You are no longer walking extremely fast."));
74 p_ptr->energy_use = 100;
79 msg_print(_("呪文の詠唱を中断した。", "You stopped spelling all spells."));
87 /* If we are requested other action, stop singing */
88 if (prev_typ == ACTION_SING) stop_singing();
89 if (prev_typ == ACTION_SPELL) stop_hex_spell();
91 switch (p_ptr->action)
95 msg_print(_("注意深く歩き始めた。", "You begin to walk carefully."));
96 p_ptr->redraw |= (PR_SPEED);
101 msg_print(_("学習を始めた。", "You begin Learning"));
106 msg_print(_("水面に糸を垂らした...", "You begin fishing..."));
109 case ACTION_HAYAGAKE:
111 msg_print(_("足が羽のように軽くなった。", "You begin to walk extremely fast."));
120 /* Recalculate bonuses */
121 p_ptr->update |= (PU_BONUS);
123 /* Redraw the state */
124 p_ptr->redraw |= (PR_STATE);
128 * @brief プレイヤーの全ての時限効果をリセットする。 / reset timed flags
131 void reset_tim_flags(void)
133 p_ptr->fast = 0; /* Timed -- Fast */
134 p_ptr->lightspeed = 0;
135 p_ptr->slow = 0; /* Timed -- Slow */
136 p_ptr->blind = 0; /* Timed -- Blindness */
137 p_ptr->paralyzed = 0; /* Timed -- Paralysis */
138 p_ptr->confused = 0; /* Timed -- Confusion */
139 p_ptr->afraid = 0; /* Timed -- Fear */
140 p_ptr->image = 0; /* Timed -- Hallucination */
141 p_ptr->poisoned = 0; /* Timed -- Poisoned */
142 p_ptr->cut = 0; /* Timed -- Cut */
143 p_ptr->stun = 0; /* Timed -- Stun */
145 p_ptr->protevil = 0; /* Timed -- Protection */
146 p_ptr->invuln = 0; /* Timed -- Invulnerable */
148 p_ptr->hero = 0; /* Timed -- Heroism */
149 p_ptr->shero = 0; /* Timed -- Super Heroism */
150 p_ptr->shield = 0; /* Timed -- Shield Spell */
151 p_ptr->blessed = 0; /* Timed -- Blessed */
152 p_ptr->tim_invis = 0; /* Timed -- Invisibility */
153 p_ptr->tim_infra = 0; /* Timed -- Infra Vision */
154 p_ptr->tim_regen = 0; /* Timed -- Regeneration */
155 p_ptr->tim_stealth = 0; /* Timed -- Stealth */
157 p_ptr->wraith_form = 0; /* Timed -- Wraith Form */
158 p_ptr->tim_levitation = 0;
159 p_ptr->tim_sh_touki = 0;
160 p_ptr->tim_sh_fire = 0;
161 p_ptr->tim_sh_holy = 0;
162 p_ptr->tim_eyeeye = 0;
164 p_ptr->resist_magic = 0;
167 p_ptr->tim_res_nether = 0;
168 p_ptr->tim_res_time = 0;
169 p_ptr->tim_mimic = 0;
170 p_ptr->mimic_form = 0;
171 p_ptr->tim_reflect = 0;
172 p_ptr->multishadow = 0;
174 p_ptr->action = ACTION_NONE;
177 p_ptr->oppose_acid = 0; /* Timed -- oppose acid */
178 p_ptr->oppose_elec = 0; /* Timed -- oppose lightning */
179 p_ptr->oppose_fire = 0; /* Timed -- oppose heat */
180 p_ptr->oppose_cold = 0; /* Timed -- oppose cold */
181 p_ptr->oppose_pois = 0; /* Timed -- oppose poison */
183 p_ptr->word_recall = 0;
184 p_ptr->alter_reality = 0;
185 p_ptr->sutemi = FALSE;
186 p_ptr->counter = FALSE;
187 p_ptr->ele_attack = 0;
188 p_ptr->ele_immune = 0;
189 p_ptr->special_attack = 0L;
190 p_ptr->special_defense = 0L;
192 while(p_ptr->energy_need < 0) p_ptr->energy_need += ENERGY_NEED();
193 world_player = FALSE;
195 if (prace_is_(RACE_DEMON) && (p_ptr->lev > 44)) p_ptr->oppose_fire = 1;
196 if ((p_ptr->pclass == CLASS_NINJA) && (p_ptr->lev > 44)) p_ptr->oppose_pois = 1;
197 if (p_ptr->pclass == CLASS_BERSERKER) p_ptr->shero = 1;
201 (void)set_monster_fast(p_ptr->riding, 0);
202 (void)set_monster_slow(p_ptr->riding, 0);
203 (void)set_monster_invulner(p_ptr->riding, 0, FALSE);
206 if (p_ptr->pclass == CLASS_BARD)
208 SINGING_SONG_EFFECT(p_ptr) = 0;
209 SINGING_SONG_ID(p_ptr) = 0;
214 * @brief プレイヤーに魔力消去効果を与える。
217 void dispel_player(void)
219 (void)set_fast(0, TRUE);
220 (void)set_lightspeed(0, TRUE);
221 (void)set_slow(0, TRUE);
222 (void)set_shield(0, TRUE);
223 (void)set_blessed(0, TRUE);
224 (void)set_tsuyoshi(0, TRUE);
225 (void)set_hero(0, TRUE);
226 (void)set_shero(0, TRUE);
227 (void)set_protevil(0, TRUE);
228 (void)set_invuln(0, TRUE);
229 (void)set_wraith_form(0, TRUE);
230 (void)set_kabenuke(0, TRUE);
231 (void)set_tim_res_nether(0, TRUE);
232 (void)set_tim_res_time(0, TRUE);
234 (void)set_tim_reflect(0,TRUE);
235 (void)set_multishadow(0,TRUE);
236 (void)set_dustrobe(0,TRUE);
238 (void)set_tim_invis(0, TRUE);
239 (void)set_tim_infra(0, TRUE);
240 (void)set_tim_esp(0, TRUE);
241 (void)set_tim_regen(0, TRUE);
242 (void)set_tim_stealth(0, TRUE);
243 (void)set_tim_levitation(0, TRUE);
244 (void)set_tim_sh_touki(0, TRUE);
245 (void)set_tim_sh_fire(0, TRUE);
246 (void)set_tim_sh_holy(0, TRUE);
247 (void)set_tim_eyeeye(0, TRUE);
248 (void)set_magicdef(0, TRUE);
249 (void)set_resist_magic(0, TRUE);
250 (void)set_oppose_acid(0, TRUE);
251 (void)set_oppose_elec(0, TRUE);
252 (void)set_oppose_fire(0, TRUE);
253 (void)set_oppose_cold(0, TRUE);
254 (void)set_oppose_pois(0, TRUE);
255 (void)set_ultimate_res(0, TRUE);
256 (void)set_mimic(0, 0, TRUE);
257 (void)set_ele_attack(0, 0);
258 (void)set_ele_immune(0, 0);
260 /* Cancel glowing hands */
261 if (p_ptr->special_attack & ATTACK_CONFUSE)
263 p_ptr->special_attack &= ~(ATTACK_CONFUSE);
264 msg_print(_("手の輝きがなくなった。", "Your hands stop glowing."));
267 if (music_singing_any() || hex_spelling_any())
269 cptr str = (music_singing_any()) ? _("歌", "singing") : _("呪文", "spelling");
270 INTERUPTING_SONG_EFFECT(p_ptr) = SINGING_SONG_EFFECT(p_ptr);
271 SINGING_SONG_EFFECT(p_ptr) = MUSIC_NONE;
272 msg_format(_("%sが途切れた。", "Your %s is interrupted."), str);
273 p_ptr->action = ACTION_NONE;
275 /* Recalculate bonuses */
276 p_ptr->update |= (PU_BONUS | PU_HP);
279 p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
281 /* Update monsters */
282 p_ptr->update |= (PU_MONSTERS);
284 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
286 p_ptr->energy_need += ENERGY_NEED();
292 * @brief 変身効果の継続時間と変身先をセットする / Set "p_ptr->tim_mimic", and "p_ptr->mimic_form", notice observable changes
295 * @param do_dec 現在の継続時間より長い値のみ上書きする
296 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
298 bool set_mimic(TIME_EFFECT v, IDX p, bool do_dec)
302 /* Hack -- Force good values */
303 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
305 if (p_ptr->is_dead) return FALSE;
310 if (p_ptr->tim_mimic && (p_ptr->mimic_form == p) && !do_dec)
312 if (p_ptr->tim_mimic > v) return FALSE;
314 else if ((!p_ptr->tim_mimic) || (p_ptr->mimic_form != p))
316 msg_print(_("自分の体が変わってゆくのを感じた。", "You feel that your body changes."));
317 p_ptr->mimic_form = p;
325 if (p_ptr->tim_mimic)
327 msg_print(_("変身が解けた。", "You are no longer transformed."));
328 if (p_ptr->mimic_form == MIMIC_DEMON) set_oppose_fire(0, TRUE);
336 p_ptr->tim_mimic = v;
338 /* Nothing to notice */
342 if (disturb_state) disturb(FALSE, TRUE);
345 p_ptr->redraw |= (PR_BASIC | PR_STATUS);
347 /* Recalculate bonuses */
348 p_ptr->update |= (PU_BONUS | PU_HP);
355 * @brief 盲目の継続時間をセットする / Set "p_ptr->blind", notice observable changes
357 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
359 * Note the use of "PU_UN_LITE" and "PU_UN_VIEW", which is needed to\n
360 * memorize any terrain features which suddenly become "visible".\n
361 * Note that blindness is currently the only thing which can affect\n
362 * "player_can_see_bold()".\n
364 bool set_blind(TIME_EFFECT v)
368 /* Hack -- Force good values */
369 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
371 if (p_ptr->is_dead) return FALSE;
378 if (p_ptr->prace == RACE_ANDROID)
380 msg_print(_("センサーをやられた!", "You are blind!"));
384 msg_print(_("目が見えなくなってしまった!", "You are blind!"));
388 chg_virtue(V_ENLIGHTEN, -1);
397 if (p_ptr->prace == RACE_ANDROID)
399 msg_print(_("センサーが復旧した。", "You can see again."));
403 msg_print(_("やっと目が見えるようになった。", "You can see again."));
413 /* Redraw status bar */
414 p_ptr->redraw |= (PR_STATUS);
416 /* Nothing to notice */
417 if (!notice) return (FALSE);
419 if (disturb_state) disturb(FALSE, FALSE);
421 /* Fully update the visuals */
422 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
425 p_ptr->redraw |= (PR_MAP);
427 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
436 * @brief 混乱の継続時間をセットする / Set "p_ptr->confused", notice observable changes
438 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
440 bool set_confused(TIME_EFFECT v)
444 /* Hack -- Force good values */
445 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
447 if (p_ptr->is_dead) return FALSE;
452 if (!p_ptr->confused)
454 msg_print(_("あなたは混乱した!", "You are confused!"));
456 if (p_ptr->action == ACTION_LEARN)
458 msg_print(_("学習が続けられない!", "You cannot continue Learning!"));
461 p_ptr->redraw |= (PR_STATE);
462 p_ptr->action = ACTION_NONE;
464 if (p_ptr->action == ACTION_KAMAE)
466 msg_print(_("構えがとけた。", "Your posture gets loose."));
467 p_ptr->special_defense &= ~(KAMAE_MASK);
468 p_ptr->update |= (PU_BONUS);
469 p_ptr->redraw |= (PR_STATE);
470 p_ptr->action = ACTION_NONE;
472 else if (p_ptr->action == ACTION_KATA)
474 msg_print(_("型が崩れた。", "Your posture gets loose."));
475 p_ptr->special_defense &= ~(KATA_MASK);
476 p_ptr->update |= (PU_BONUS);
477 p_ptr->update |= (PU_MONSTERS);
478 p_ptr->redraw |= (PR_STATE);
479 p_ptr->redraw |= (PR_STATUS);
480 p_ptr->action = ACTION_NONE;
484 if (p_ptr->concent) reset_concentration(TRUE);
487 if (hex_spelling_any()) stop_hex_spell_all();
490 p_ptr->counter = FALSE;
491 chg_virtue(V_HARMONY, -1);
500 msg_print(_("やっと混乱がおさまった。", "You feel less confused now."));
501 p_ptr->special_attack &= ~(ATTACK_SUIKEN);
509 /* Redraw status bar */
510 p_ptr->redraw |= (PR_STATUS);
512 /* Nothing to notice */
513 if (!notice) return (FALSE);
515 if (disturb_state) disturb(FALSE, FALSE);
524 * @brief 毒の継続時間をセットする / Set "p_ptr->poisoned", notice observable changes
526 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
528 bool set_poisoned(TIME_EFFECT v)
532 /* Hack -- Force good values */
533 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
535 if (p_ptr->is_dead) return FALSE;
540 if (!p_ptr->poisoned)
542 msg_print(_("毒に侵されてしまった!", "You are poisoned!"));
552 msg_print(_("やっと毒の痛みがなくなった。", "You are no longer poisoned."));
560 /* Redraw status bar */
561 p_ptr->redraw |= (PR_STATUS);
563 /* Nothing to notice */
564 if (!notice) return (FALSE);
566 if (disturb_state) disturb(FALSE, FALSE);
575 * @brief 恐怖の継続時間をセットする / Set "p_ptr->afraid", notice observable changes
577 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
579 bool set_afraid(TIME_EFFECT v)
583 /* Hack -- Force good values */
584 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
586 if (p_ptr->is_dead) return FALSE;
593 msg_print(_("何もかも恐くなってきた!", "You are terrified!"));
595 if (p_ptr->special_defense & KATA_MASK)
597 msg_print(_("型が崩れた。", "Your posture gets loose."));
598 p_ptr->special_defense &= ~(KATA_MASK);
599 p_ptr->update |= (PU_BONUS);
600 p_ptr->update |= (PU_MONSTERS);
601 p_ptr->redraw |= (PR_STATE);
602 p_ptr->redraw |= (PR_STATUS);
603 p_ptr->action = ACTION_NONE;
607 p_ptr->counter = FALSE;
608 chg_virtue(V_VALOUR, -1);
617 msg_print(_("やっと恐怖を振り払った。", "You feel bolder now."));
625 /* Redraw status bar */
626 p_ptr->redraw |= (PR_STATUS);
628 /* Nothing to notice */
629 if (!notice) return (FALSE);
631 if (disturb_state) disturb(FALSE, FALSE);
639 * @brief 麻痺の継続時間をセットする / Set "p_ptr->paralyzed", notice observable changes
641 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
643 bool set_paralyzed(TIME_EFFECT v)
647 /* Hack -- Force good values */
648 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
650 if (p_ptr->is_dead) return FALSE;
655 if (!p_ptr->paralyzed)
657 msg_print(_("体が麻痺してしまった!", "You are paralyzed!"));
659 if (p_ptr->concent) reset_concentration(TRUE);
662 if (hex_spelling_any()) stop_hex_spell_all();
664 p_ptr->counter = FALSE;
672 if (p_ptr->paralyzed)
674 msg_print(_("やっと動けるようになった。", "You can move again."));
680 p_ptr->paralyzed = v;
682 /* Redraw status bar */
683 p_ptr->redraw |= (PR_STATUS);
685 /* Nothing to notice */
686 if (!notice) return (FALSE);
688 if (disturb_state) disturb(FALSE, FALSE);
690 /* Redraw the state */
691 p_ptr->redraw |= (PR_STATE);
699 * @brief 幻覚の継続時間をセットする / Set "p_ptr->image", notice observable changes
701 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
702 * @details Note that we must redraw the map when hallucination changes.
704 bool set_image(TIME_EFFECT v)
708 /* Hack -- Force good values */
709 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
711 if (p_ptr->is_dead) return FALSE;
717 set_tsuyoshi(0, TRUE);
720 msg_print(_("ワーオ!何もかも虹色に見える!", "Oh, wow! Everything looks so cosmic now!"));
723 if (p_ptr->concent) reset_concentration(TRUE);
725 p_ptr->counter = FALSE;
735 msg_print(_("やっとはっきりと物が見えるようになった。", "You can see clearly again."));
743 /* Redraw status bar */
744 p_ptr->redraw |= (PR_STATUS);
746 /* Nothing to notice */
747 if (!notice) return (FALSE);
749 if (disturb_state) disturb(FALSE, TRUE);
752 p_ptr->redraw |= (PR_MAP);
754 /* Update the health bar */
755 p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH);
757 /* Update monsters */
758 p_ptr->update |= (PU_MONSTERS);
760 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
768 * @brief 加速の継続時間をセットする / Set "p_ptr->fast", notice observable changes
770 * @param do_dec 現在の継続時間より長い値のみ上書きする
771 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
773 bool set_fast(TIME_EFFECT v, bool do_dec)
777 /* Hack -- Force good values */
778 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
780 if (p_ptr->is_dead) return FALSE;
785 if (p_ptr->fast && !do_dec)
787 if (p_ptr->fast > v) return FALSE;
789 else if (!IS_FAST() && !p_ptr->lightspeed)
791 msg_print(_("素早く動けるようになった!", "You feel yourself moving much faster!"));
793 chg_virtue(V_PATIENCE, -1);
794 chg_virtue(V_DILIGENCE, 1);
801 if (p_ptr->fast && !p_ptr->lightspeed && !music_singing(MUSIC_SPEED) && !music_singing(MUSIC_SHERO))
803 msg_print(_("動きの素早さがなくなったようだ。", "You feel yourself slow down."));
811 /* Nothing to notice */
812 if (!notice) return (FALSE);
814 if (disturb_state) disturb(FALSE, FALSE);
816 /* Recalculate bonuses */
817 p_ptr->update |= (PU_BONUS);
825 * @brief 光速移動の継続時間をセットする / Set "p_ptr->lightspeed", notice observable changes
827 * @param do_dec 現在の継続時間より長い値のみ上書きする
828 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
830 bool set_lightspeed(TIME_EFFECT v, bool do_dec)
834 /* Hack -- Force good values */
835 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
837 if (p_ptr->is_dead) return FALSE;
839 if (p_ptr->wild_mode) v = 0;
844 if (p_ptr->lightspeed && !do_dec)
846 if (p_ptr->lightspeed > v) return FALSE;
848 else if (!p_ptr->lightspeed)
850 msg_print(_("非常に素早く動けるようになった!", "You feel yourself moving extremely faster!"));
852 chg_virtue(V_PATIENCE, -1);
853 chg_virtue(V_DILIGENCE, 1);
860 if (p_ptr->lightspeed)
862 msg_print(_("動きの素早さがなくなったようだ。", "You feel yourself slow down."));
868 p_ptr->lightspeed = v;
870 /* Nothing to notice */
871 if (!notice) return (FALSE);
873 if (disturb_state) disturb(FALSE, FALSE);
875 /* Recalculate bonuses */
876 p_ptr->update |= (PU_BONUS);
884 * @brief 減速の継続時間をセットする / Set "p_ptr->slow", notice observable changes
886 * @param do_dec 現在の継続時間より長い値のみ上書きする
887 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
889 bool set_slow(TIME_EFFECT v, bool do_dec)
893 /* Hack -- Force good values */
894 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
896 if (p_ptr->is_dead) return FALSE;
901 if (p_ptr->slow && !do_dec)
903 if (p_ptr->slow > v) return FALSE;
905 else if (!p_ptr->slow)
907 msg_print(_("体の動きが遅くなってしまった!", "You feel yourself moving slower!"));
917 msg_print(_("動きの遅さがなくなったようだ。", "You feel yourself speed up."));
925 /* Nothing to notice */
926 if (!notice) return (FALSE);
928 if (disturb_state) disturb(FALSE, FALSE);
930 /* Recalculate bonuses */
931 p_ptr->update |= (PU_BONUS);
940 * @brief 肌石化の継続時間をセットする / Set "p_ptr->shield", notice observable changes
942 * @param do_dec 現在の継続時間より長い値のみ上書きする
943 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
945 bool set_shield(TIME_EFFECT v, bool do_dec)
949 /* Hack -- Force good values */
950 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
952 if (p_ptr->is_dead) return FALSE;
957 if (p_ptr->shield && !do_dec)
959 if (p_ptr->shield > v) return FALSE;
961 else if (!p_ptr->shield)
963 msg_print(_("肌が石になった。", "Your skin turns to stone."));
973 msg_print(_("肌が元に戻った。", "Your skin returns to normal."));
981 /* Redraw status bar */
982 p_ptr->redraw |= (PR_STATUS);
984 /* Nothing to notice */
985 if (!notice) return (FALSE);
987 if (disturb_state) disturb(FALSE, FALSE);
989 /* Recalculate bonuses */
990 p_ptr->update |= (PU_BONUS);
999 * @brief つぶれるの継続時間をセットする / Set "p_ptr->tsubureru", notice observable changes
1001 * @param do_dec 現在の継続時間より長い値のみ上書きする
1002 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1004 bool set_tsubureru(TIME_EFFECT v, bool do_dec)
1006 bool notice = FALSE;
1008 /* Hack -- Force good values */
1009 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1011 if (p_ptr->is_dead) return FALSE;
1016 if (p_ptr->tsubureru && !do_dec)
1018 if (p_ptr->tsubureru > v) return FALSE;
1020 else if (!p_ptr->tsubureru)
1022 msg_print(_("横に伸びた。", "Your body expands horizontally."));
1030 if (p_ptr->tsubureru)
1032 msg_print(_("もう横に伸びていない。", "Your body returns to normal."));
1038 p_ptr->tsubureru = v;
1040 /* Redraw status bar */
1041 p_ptr->redraw |= (PR_STATUS);
1043 /* Nothing to notice */
1044 if (!notice) return (FALSE);
1046 if (disturb_state) disturb(FALSE, FALSE);
1048 /* Recalculate bonuses */
1049 p_ptr->update |= (PU_BONUS);
1058 * @brief 魔法の鎧の継続時間をセットする / Set "p_ptr->magicdef", notice observable changes
1060 * @param do_dec 現在の継続時間より長い値のみ上書きする
1061 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1063 bool set_magicdef(TIME_EFFECT v, bool do_dec)
1065 bool notice = FALSE;
1067 /* Hack -- Force good values */
1068 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1070 if (p_ptr->is_dead) return FALSE;
1075 if (p_ptr->magicdef && !do_dec)
1077 if (p_ptr->magicdef > v) return FALSE;
1079 else if (!p_ptr->magicdef)
1081 msg_print(_("魔法の防御力が増したような気がする。", "You feel more resistant to magic."));
1089 if (p_ptr->magicdef)
1091 msg_print(_("魔法の防御力が元に戻った。", "You feel less resistant to magic."));
1097 p_ptr->magicdef = v;
1099 /* Redraw status bar */
1100 p_ptr->redraw |= (PR_STATUS);
1102 /* Nothing to notice */
1103 if (!notice) return (FALSE);
1105 if (disturb_state) disturb(FALSE, FALSE);
1107 /* Recalculate bonuses */
1108 p_ptr->update |= (PU_BONUS);
1116 * @brief 祝福の継続時間をセットする / Set "p_ptr->blessed", notice observable changes
1118 * @param do_dec 現在の継続時間より長い値のみ上書きする
1119 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1121 bool set_blessed(TIME_EFFECT v, bool do_dec)
1123 bool notice = FALSE;
1125 /* Hack -- Force good values */
1126 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1128 if (p_ptr->is_dead) return FALSE;
1133 if (p_ptr->blessed && !do_dec)
1135 if (p_ptr->blessed > v) return FALSE;
1137 else if (!IS_BLESSED())
1139 msg_print(_("高潔な気分になった!", "You feel righteous!"));
1147 if (p_ptr->blessed && !music_singing(MUSIC_BLESS))
1149 msg_print(_("高潔な気分が消え失せた。", "The prayer has expired."));
1157 /* Redraw status bar */
1158 p_ptr->redraw |= (PR_STATUS);
1160 /* Nothing to notice */
1161 if (!notice) return (FALSE);
1163 if (disturb_state) disturb(FALSE, FALSE);
1165 /* Recalculate bonuses */
1166 p_ptr->update |= (PU_BONUS);
1175 * @brief 士気高揚の継続時間をセットする / Set "p_ptr->hero", notice observable changes
1177 * @param do_dec 現在の継続時間より長い値のみ上書きする
1178 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1180 bool set_hero(TIME_EFFECT v, bool do_dec)
1182 bool notice = FALSE;
1184 /* Hack -- Force good values */
1185 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1187 if (p_ptr->is_dead) return FALSE;
1192 if (p_ptr->hero && !do_dec)
1194 if (p_ptr->hero > v) return FALSE;
1196 else if (!IS_HERO())
1198 msg_print(_("ヒーローになった気がする!", "You feel like a hero!"));
1206 if (p_ptr->hero && !music_singing(MUSIC_HERO) && !music_singing(MUSIC_SHERO))
1208 msg_print(_("ヒーローの気分が消え失せた。", "The heroism wears off."));
1216 /* Redraw status bar */
1217 p_ptr->redraw |= (PR_STATUS);
1219 /* Nothing to notice */
1220 if (!notice) return (FALSE);
1222 if (disturb_state) disturb(FALSE, FALSE);
1224 /* Recalculate bonuses */
1225 p_ptr->update |= (PU_BONUS);
1227 /* Recalculate hitpoints */
1228 p_ptr->update |= (PU_HP);
1236 * @brief 狂戦士化の継続時間をセットする / Set "p_ptr->shero", notice observable changes
1237 * @param v 継続時間/ 0ならば無条件にリセット
1238 * @param do_dec FALSEの場合現在の継続時間より長い値のみ上書きする
1239 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1241 bool set_shero(TIME_EFFECT v, bool do_dec)
1243 bool notice = FALSE;
1245 /* Hack -- Force good values */
1246 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1248 if (p_ptr->is_dead) return FALSE;
1250 if (p_ptr->pclass == CLASS_BERSERKER) v = 1;
1254 if (p_ptr->shero && !do_dec)
1256 if (p_ptr->shero > v) return FALSE;
1258 else if (!p_ptr->shero)
1260 msg_print(_("殺戮マシーンになった気がする!", "You feel like a killing machine!"));
1270 msg_print(_("野蛮な気持ちが消え失せた。", "You feel less Berserk."));
1278 /* Redraw status bar */
1279 p_ptr->redraw |= (PR_STATUS);
1281 /* Nothing to notice */
1282 if (!notice) return (FALSE);
1284 if (disturb_state) disturb(FALSE, FALSE);
1286 /* Recalculate bonuses */
1287 p_ptr->update |= (PU_BONUS);
1289 /* Recalculate hitpoints */
1290 p_ptr->update |= (PU_HP);
1298 * @brief 対邪悪結界の継続時間をセットする / Set "p_ptr->protevil", notice observable changes
1300 * @param do_dec 現在の継続時間より長い値のみ上書きする
1301 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1303 bool set_protevil(TIME_EFFECT v, bool do_dec)
1305 bool notice = FALSE;
1307 /* Hack -- Force good values */
1308 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1310 if (p_ptr->is_dead) return FALSE;
1315 if (p_ptr->protevil && !do_dec)
1317 if (p_ptr->protevil > v) return FALSE;
1319 else if (!p_ptr->protevil)
1321 msg_print(_("邪悪なる存在から守られているような感じがする!", "You feel safe from evil!"));
1329 if (p_ptr->protevil)
1331 msg_print(_("邪悪なる存在から守られている感じがなくなった。", "You no longer feel safe from evil."));
1337 p_ptr->protevil = v;
1339 /* Redraw status bar */
1340 p_ptr->redraw |= (PR_STATUS);
1342 /* Nothing to notice */
1343 if (!notice) return (FALSE);
1345 if (disturb_state) disturb(FALSE, FALSE);
1353 * @brief 幽体化の継続時間をセットする / Set "p_ptr->wraith_form", notice observable changes
1355 * @param do_dec 現在の継続時間より長い値のみ上書きする
1356 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1358 bool set_wraith_form(TIME_EFFECT v, bool do_dec)
1360 bool notice = FALSE;
1362 /* Hack -- Force good values */
1363 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1365 if (p_ptr->is_dead) return FALSE;
1370 if (p_ptr->wraith_form && !do_dec)
1372 if (p_ptr->wraith_form > v) return FALSE;
1374 else if (!p_ptr->wraith_form)
1376 msg_print(_("物質界を離れて幽鬼のような存在になった!", "You leave the physical world and turn into a wraith-being!"));
1378 chg_virtue(V_UNLIFE, 3);
1379 chg_virtue(V_HONOUR, -2);
1380 chg_virtue(V_SACRIFICE, -2);
1381 chg_virtue(V_VALOUR, -5);
1384 p_ptr->redraw |= (PR_MAP);
1386 /* Update monsters */
1387 p_ptr->update |= (PU_MONSTERS);
1389 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1396 if (p_ptr->wraith_form)
1398 msg_print(_("不透明になった感じがする。", "You feel opaque."));
1402 p_ptr->redraw |= (PR_MAP);
1404 /* Update monsters */
1405 p_ptr->update |= (PU_MONSTERS);
1407 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1412 p_ptr->wraith_form = v;
1414 /* Redraw status bar */
1415 p_ptr->redraw |= (PR_STATUS);
1417 /* Nothing to notice */
1418 if (!notice) return (FALSE);
1420 if (disturb_state) disturb(FALSE, FALSE);
1422 /* Recalculate bonuses */
1423 p_ptr->update |= (PU_BONUS);
1432 * @brief 無傷球の継続時間をセットする / Set "p_ptr->invuln", notice observable changes
1434 * @param do_dec 現在の継続時間より長い値のみ上書きする
1435 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1437 bool set_invuln(TIME_EFFECT v, bool do_dec)
1439 bool notice = FALSE;
1441 /* Hack -- Force good values */
1442 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1444 if (p_ptr->is_dead) return FALSE;
1449 if (p_ptr->invuln && !do_dec)
1451 if (p_ptr->invuln > v) return FALSE;
1453 else if (!IS_INVULN())
1455 msg_print(_("無敵だ!", "Invulnerability!"));
1458 chg_virtue(V_UNLIFE, -2);
1459 chg_virtue(V_HONOUR, -2);
1460 chg_virtue(V_SACRIFICE, -3);
1461 chg_virtue(V_VALOUR, -5);
1464 p_ptr->redraw |= (PR_MAP);
1466 /* Update monsters */
1467 p_ptr->update |= (PU_MONSTERS);
1469 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1476 if (p_ptr->invuln && !music_singing(MUSIC_INVULN))
1478 msg_print(_("無敵ではなくなった。", "The invulnerability wears off."));
1482 p_ptr->redraw |= (PR_MAP);
1484 /* Update monsters */
1485 p_ptr->update |= (PU_MONSTERS);
1487 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1489 p_ptr->energy_need += ENERGY_NEED();
1496 /* Redraw status bar */
1497 p_ptr->redraw |= (PR_STATUS);
1499 /* Nothing to notice */
1500 if (!notice) return (FALSE);
1502 if (disturb_state) disturb(FALSE, FALSE);
1504 /* Recalculate bonuses */
1505 p_ptr->update |= (PU_BONUS);
1513 * @brief 時限ESPの継続時間をセットする / Set "p_ptr->tim_esp", notice observable changes
1515 * @param do_dec 現在の継続時間より長い値のみ上書きする
1516 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1518 bool set_tim_esp(TIME_EFFECT v, bool do_dec)
1520 bool notice = FALSE;
1522 /* Hack -- Force good values */
1523 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1525 if (p_ptr->is_dead) return FALSE;
1530 if (p_ptr->tim_esp && !do_dec)
1532 if (p_ptr->tim_esp > v) return FALSE;
1534 else if (!IS_TIM_ESP())
1536 msg_print(_("意識が広がった気がする!", "You feel your consciousness expand!"));
1544 if (p_ptr->tim_esp && !music_singing(MUSIC_MIND))
1546 msg_print(_("意識は元に戻った。", "Your consciousness contracts again."));
1554 /* Redraw status bar */
1555 p_ptr->redraw |= (PR_STATUS);
1557 /* Nothing to notice */
1558 if (!notice) return (FALSE);
1560 if (disturb_state) disturb(FALSE, FALSE);
1562 /* Recalculate bonuses */
1563 p_ptr->update |= (PU_BONUS);
1565 /* Update the monsters */
1566 p_ptr->update |= (PU_MONSTERS);
1574 * @brief 時限透明視の継続時間をセットする / Set "p_ptr->tim_invis", notice observable changes
1576 * @param do_dec 現在の継続時間より長い値のみ上書きする
1577 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1579 bool set_tim_invis(TIME_EFFECT v, bool do_dec)
1581 bool notice = FALSE;
1583 /* Hack -- Force good values */
1584 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1586 if (p_ptr->is_dead) return FALSE;
1591 if (p_ptr->tim_invis && !do_dec)
1593 if (p_ptr->tim_invis > v) return FALSE;
1595 else if (!p_ptr->tim_invis)
1597 msg_print(_("目が非常に敏感になった気がする!", "Your eyes feel very sensitive!"));
1605 if (p_ptr->tim_invis)
1607 msg_print(_("目の敏感さがなくなったようだ。", "Your eyes feel less sensitive."));
1613 p_ptr->tim_invis = v;
1615 /* Redraw status bar */
1616 p_ptr->redraw |= (PR_STATUS);
1618 /* Nothing to notice */
1619 if (!notice) return (FALSE);
1621 if (disturb_state) disturb(FALSE, FALSE);
1623 /* Recalculate bonuses */
1624 p_ptr->update |= (PU_BONUS);
1626 /* Update the monsters */
1627 p_ptr->update |= (PU_MONSTERS);
1635 * @brief 時限赤外線視力の継続時間をセットする / Set "p_ptr->tim_infra", notice observable changes
1637 * @param do_dec 現在の継続時間より長い値のみ上書きする
1638 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1640 bool set_tim_infra(TIME_EFFECT v, bool do_dec)
1642 bool notice = FALSE;
1644 /* Hack -- Force good values */
1645 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1647 if (p_ptr->is_dead) return FALSE;
1652 if (p_ptr->tim_infra && !do_dec)
1654 if (p_ptr->tim_infra > v) return FALSE;
1656 else if (!p_ptr->tim_infra)
1658 msg_print(_("目がランランと輝き始めた!", "Your eyes begin to tingle!"));
1666 if (p_ptr->tim_infra)
1668 msg_print(_("目の輝きがなくなった。", "Your eyes stop tingling."));
1674 p_ptr->tim_infra = v;
1676 /* Redraw status bar */
1677 p_ptr->redraw |= (PR_STATUS);
1679 /* Nothing to notice */
1680 if (!notice) return (FALSE);
1682 if (disturb_state) disturb(FALSE, FALSE);
1684 /* Recalculate bonuses */
1685 p_ptr->update |= (PU_BONUS);
1687 /* Update the monsters */
1688 p_ptr->update |= (PU_MONSTERS);
1696 * @brief 時限急回復の継続時間をセットする / Set "p_ptr->tim_regen", notice observable changes
1698 * @param do_dec 現在の継続時間より長い値のみ上書きする
1699 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1701 bool set_tim_regen(TIME_EFFECT v, bool do_dec)
1703 bool notice = FALSE;
1705 /* Hack -- Force good values */
1706 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1708 if (p_ptr->is_dead) return FALSE;
1713 if (p_ptr->tim_regen && !do_dec)
1715 if (p_ptr->tim_regen > v) return FALSE;
1717 else if (!p_ptr->tim_regen)
1719 msg_print(_("回復力が上がった!", "You feel yourself regenerating quickly!"));
1727 if (p_ptr->tim_regen)
1729 msg_print(_("素早く回復する感じがなくなった。", "You feel yourself regenerating slowly."));
1735 p_ptr->tim_regen = v;
1737 /* Redraw status bar */
1738 p_ptr->redraw |= (PR_STATUS);
1740 /* Nothing to notice */
1741 if (!notice) return (FALSE);
1743 if (disturb_state) disturb(FALSE, FALSE);
1745 /* Recalculate bonuses */
1746 p_ptr->update |= (PU_BONUS);
1754 * @brief 隠密の歌の継続時間をセットする / Set "p_ptr->tim_stealth", notice observable changes
1756 * @param do_dec 現在の継続時間より長い値のみ上書きする
1757 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1759 bool set_tim_stealth(TIME_EFFECT v, bool do_dec)
1761 bool notice = FALSE;
1763 /* Hack -- Force good values */
1764 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1766 if (p_ptr->is_dead) return FALSE;
1771 if (p_ptr->tim_stealth && !do_dec)
1773 if (p_ptr->tim_stealth > v) return FALSE;
1775 else if (!IS_TIM_STEALTH())
1777 msg_print(_("足音が小さくなった!", "You begin to walk silently!"));
1785 if (p_ptr->tim_stealth && !music_singing(MUSIC_STEALTH))
1787 msg_print(_("足音が大きくなった。", "You no longer walk silently."));
1793 p_ptr->tim_stealth = v;
1795 /* Redraw status bar */
1796 p_ptr->redraw |= (PR_STATUS);
1798 /* Nothing to notice */
1799 if (!notice) return (FALSE);
1801 if (disturb_state) disturb(FALSE, FALSE);
1803 /* Recalculate bonuses */
1804 p_ptr->update |= (PU_BONUS);
1812 * @brief 超隠密状態をセットする
1813 * @param set TRUEならば超隠密状態になる。
1814 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1816 bool set_superstealth(bool set)
1818 bool notice = FALSE;
1820 if (p_ptr->is_dead) return FALSE;
1825 if (!(p_ptr->special_defense & NINJA_S_STEALTH))
1827 if (cave[p_ptr->y][p_ptr->x].info & CAVE_MNLT)
1829 msg_print(_("敵の目から薄い影の中に覆い隠された。", "You are mantled in weak shadow from ordinary eyes."));
1830 p_ptr->monlite = p_ptr->old_monlite = TRUE;
1834 msg_print(_("敵の目から影の中に覆い隠された!", "You are mantled in shadow from ordinary eyes!"));
1835 p_ptr->monlite = p_ptr->old_monlite = FALSE;
1841 p_ptr->special_defense |= NINJA_S_STEALTH;
1848 if (p_ptr->special_defense & NINJA_S_STEALTH)
1850 msg_print(_("再び敵の目にさらされるようになった。", "You are exposed to common sight once more."));
1854 p_ptr->special_defense &= ~(NINJA_S_STEALTH);
1858 /* Nothing to notice */
1859 if (!notice) return (FALSE);
1861 /* Redraw status bar */
1862 p_ptr->redraw |= (PR_STATUS);
1864 if (disturb_state) disturb(FALSE, FALSE);
1869 * @brief 一時的浮遊の継続時間をセットする / Set "p_ptr->tim_levitation", notice observable changes
1871 * @param do_dec 現在の継続時間より長い値のみ上書きする
1872 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1874 bool set_tim_levitation(TIME_EFFECT v, bool do_dec)
1876 bool notice = FALSE;
1878 /* Hack -- Force good values */
1879 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1881 if (p_ptr->is_dead) return FALSE;
1886 if (p_ptr->tim_levitation && !do_dec)
1888 if (p_ptr->tim_levitation > v) return FALSE;
1890 else if (!p_ptr->tim_levitation)
1892 msg_print(_("体が宙に浮き始めた。", "You begin to fly!"));
1900 if (p_ptr->tim_levitation)
1902 msg_print(_("もう宙に浮かべなくなった。", "You stop flying."));
1908 p_ptr->tim_levitation = v;
1910 /* Redraw status bar */
1911 p_ptr->redraw |= (PR_STATUS);
1913 /* Nothing to notice */
1914 if (!notice) return (FALSE);
1916 if (disturb_state) disturb(FALSE, FALSE);
1918 /* Recalculate bonuses */
1919 p_ptr->update |= (PU_BONUS);
1927 * @brief 一時的闘気のオーラの継続時間をセットする / Set "p_ptr->tim_sh_touki", notice observable changes
1929 * @param do_dec 現在の継続時間より長い値のみ上書きする
1930 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1932 bool set_tim_sh_touki(TIME_EFFECT v, bool do_dec)
1934 bool notice = FALSE;
1936 /* Hack -- Force good values */
1937 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1939 if (p_ptr->is_dead) return FALSE;
1944 if (p_ptr->tim_sh_touki && !do_dec)
1946 if (p_ptr->tim_sh_touki > v) return FALSE;
1948 else if (!p_ptr->tim_sh_touki)
1950 msg_print(_("体が闘気のオーラで覆われた。", "You have enveloped by the aura of the Force!"));
1958 if (p_ptr->tim_sh_touki)
1960 msg_print(_("闘気が消えた。", "Aura of the Force disappeared."));
1966 p_ptr->tim_sh_touki = v;
1968 /* Redraw status bar */
1969 p_ptr->redraw |= (PR_STATUS);
1971 /* Nothing to notice */
1972 if (!notice) return (FALSE);
1974 if (disturb_state) disturb(FALSE, FALSE);
1982 * @brief 一時的火炎のオーラの継続時間をセットする / Set "p_ptr->tim_sh_fire", notice observable changes
1984 * @param do_dec 現在の継続時間より長い値のみ上書きする
1985 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1987 bool set_tim_sh_fire(TIME_EFFECT v, bool do_dec)
1989 bool notice = FALSE;
1991 /* Hack -- Force good values */
1992 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1994 if (p_ptr->is_dead) return FALSE;
1999 if (p_ptr->tim_sh_fire && !do_dec)
2001 if (p_ptr->tim_sh_fire > v) return FALSE;
2003 else if (!p_ptr->tim_sh_fire)
2005 msg_print(_("体が炎のオーラで覆われた。", "You have enveloped by fiery aura!"));
2013 if (p_ptr->tim_sh_fire)
2015 msg_print(_("炎のオーラが消えた。", "Fiery aura disappeared."));
2021 p_ptr->tim_sh_fire = v;
2023 /* Redraw status bar */
2024 p_ptr->redraw |= (PR_STATUS);
2026 /* Nothing to notice */
2027 if (!notice) return (FALSE);
2029 if (disturb_state) disturb(FALSE, FALSE);
2031 /* Recalculate bonuses */
2032 p_ptr->update |= (PU_BONUS);
2040 * @brief 一時的聖なるのオーラの継続時間をセットする / Set "p_ptr->tim_sh_holy", notice observable changes
2042 * @param do_dec 現在の継続時間より長い値のみ上書きする
2043 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2045 bool set_tim_sh_holy(TIME_EFFECT v, bool do_dec)
2047 bool notice = FALSE;
2049 /* Hack -- Force good values */
2050 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2052 if (p_ptr->is_dead) return FALSE;
2057 if (p_ptr->tim_sh_holy && !do_dec)
2059 if (p_ptr->tim_sh_holy > v) return FALSE;
2061 else if (!p_ptr->tim_sh_holy)
2063 msg_print(_("体が聖なるオーラで覆われた。", "You have enveloped by holy aura!"));
2071 if (p_ptr->tim_sh_holy)
2073 msg_print(_("聖なるオーラが消えた。", "Holy aura disappeared."));
2079 p_ptr->tim_sh_holy = v;
2081 /* Redraw status bar */
2082 p_ptr->redraw |= (PR_STATUS);
2084 /* Nothing to notice */
2085 if (!notice) return (FALSE);
2087 if (disturb_state) disturb(FALSE, FALSE);
2089 /* Recalculate bonuses */
2090 p_ptr->update |= (PU_BONUS);
2098 * @brief 目には目をの残り時間をセットする / Set "p_ptr->tim_eyeeye", notice observable changes
2100 * @param do_dec 現在の継続時間より長い値のみ上書きする
2101 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2103 bool set_tim_eyeeye(TIME_EFFECT v, bool do_dec)
2105 bool notice = FALSE;
2107 /* Hack -- Force good values */
2108 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2110 if (p_ptr->is_dead) return FALSE;
2115 if (p_ptr->tim_eyeeye && !do_dec)
2117 if (p_ptr->tim_eyeeye > v) return FALSE;
2119 else if (!p_ptr->tim_eyeeye)
2121 msg_print(_("法の守り手になった気がした!", "You feel like a keeper of commandments!"));
2129 if (p_ptr->tim_eyeeye)
2131 msg_print(_("懲罰を執行することができなくなった。", "You no longer feel like a keeper."));
2137 p_ptr->tim_eyeeye = v;
2139 /* Redraw status bar */
2140 p_ptr->redraw |= (PR_STATUS);
2142 /* Nothing to notice */
2143 if (!notice) return (FALSE);
2145 if (disturb_state) disturb(FALSE, FALSE);
2147 /* Recalculate bonuses */
2148 p_ptr->update |= (PU_BONUS);
2157 * @brief 一時的魔法防御の継続時間をセットする / Set "p_ptr->resist_magic", notice observable changes
2159 * @param do_dec 現在の継続時間より長い値のみ上書きする
2160 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2162 bool set_resist_magic(TIME_EFFECT v, bool do_dec)
2164 bool notice = FALSE;
2166 /* Hack -- Force good values */
2167 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2169 if (p_ptr->is_dead) return FALSE;
2174 if (p_ptr->resist_magic && !do_dec)
2176 if (p_ptr->resist_magic > v) return FALSE;
2178 else if (!p_ptr->resist_magic)
2180 msg_print(_("魔法への耐性がついた。", "You have been protected from magic!"));
2188 if (p_ptr->resist_magic)
2190 msg_print(_("魔法に弱くなった。", "You are no longer protected from magic."));
2196 p_ptr->resist_magic = v;
2198 /* Redraw status bar */
2199 p_ptr->redraw |= (PR_STATUS);
2201 /* Nothing to notice */
2202 if (!notice) return (FALSE);
2204 if (disturb_state) disturb(FALSE, FALSE);
2206 /* Recalculate bonuses */
2207 p_ptr->update |= (PU_BONUS);
2215 * @brief 一時的反射の継続時間をセットする / Set "p_ptr->tim_reflect", notice observable changes
2217 * @param do_dec 現在の継続時間より長い値のみ上書きする
2218 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2220 bool set_tim_reflect(TIME_EFFECT v, bool do_dec)
2222 bool notice = FALSE;
2224 /* Hack -- Force good values */
2225 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2227 if (p_ptr->is_dead) return FALSE;
2232 if (p_ptr->tim_reflect && !do_dec)
2234 if (p_ptr->tim_reflect > v) return FALSE;
2236 else if (!p_ptr->tim_reflect)
2238 msg_print(_("体の表面が滑かになった気がする。", "Your body becames smooth."));
2246 if (p_ptr->tim_reflect)
2248 msg_print(_("体の表面が滑かでなくなった。", "Your body is no longer smooth."));
2254 p_ptr->tim_reflect = v;
2256 /* Redraw status bar */
2257 p_ptr->redraw |= (PR_STATUS);
2259 /* Nothing to notice */
2260 if (!notice) return (FALSE);
2262 if (disturb_state) disturb(FALSE, FALSE);
2264 /* Recalculate bonuses */
2265 p_ptr->update |= (PU_BONUS);
2274 * Set "p_ptr->multishadow", notice observable changes
2276 bool set_multishadow(TIME_EFFECT v, bool do_dec)
2278 bool notice = FALSE;
2280 /* Hack -- Force good values */
2281 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2283 if (p_ptr->is_dead) return FALSE;
2288 if (p_ptr->multishadow && !do_dec)
2290 if (p_ptr->multishadow > v) return FALSE;
2292 else if (!p_ptr->multishadow)
2294 msg_print(_("あなたの周りに幻影が生まれた。", "Your Shadow enveloped you."));
2302 if (p_ptr->multishadow)
2304 msg_print(_("幻影が消えた。", "Your Shadow disappears."));
2310 p_ptr->multishadow = v;
2312 /* Redraw status bar */
2313 p_ptr->redraw |= (PR_STATUS);
2315 /* Nothing to notice */
2316 if (!notice) return (FALSE);
2318 if (disturb_state) disturb(FALSE, FALSE);
2320 /* Recalculate bonuses */
2321 p_ptr->update |= (PU_BONUS);
2329 * @brief 一時的破片のオーラの継続時間をセットする / Set "p_ptr->dustrobe", notice observable changes
2331 * @param do_dec 現在の継続時間より長い値のみ上書きする
2332 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2334 bool set_dustrobe(TIME_EFFECT v, bool do_dec)
2336 bool notice = FALSE;
2338 /* Hack -- Force good values */
2339 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2341 if (p_ptr->is_dead) return FALSE;
2346 if (p_ptr->dustrobe && !do_dec)
2348 if (p_ptr->dustrobe > v) return FALSE;
2350 else if (!p_ptr->dustrobe)
2352 msg_print(_("体が鏡のオーラで覆われた。", "You were enveloped by mirror shards."));
2360 if (p_ptr->dustrobe)
2362 msg_print(_("鏡のオーラが消えた。", "The mirror shards disappear."));
2368 p_ptr->dustrobe = v;
2370 /* Redraw status bar */
2371 p_ptr->redraw |= (PR_STATUS);
2373 /* Nothing to notice */
2374 if (!notice) return (FALSE);
2376 if (disturb_state) disturb(FALSE, FALSE);
2378 /* Recalculate bonuses */
2379 p_ptr->update |= (PU_BONUS);
2387 * @brief 一時的壁抜けの継続時間をセットする / Set "p_ptr->kabenuke", notice observable changes
2389 * @param do_dec 現在の継続時間より長い値のみ上書きする
2390 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2392 bool set_kabenuke(TIME_EFFECT v, bool do_dec)
2394 bool notice = FALSE;
2396 /* Hack -- Force good values */
2397 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2399 if (p_ptr->is_dead) return FALSE;
2404 if (p_ptr->kabenuke && !do_dec)
2406 if (p_ptr->kabenuke > v) return FALSE;
2408 else if (!p_ptr->kabenuke)
2410 msg_print(_("体が半物質の状態になった。", "You became ethereal form."));
2418 if (p_ptr->kabenuke)
2420 msg_print(_("体が物質化した。", "You are no longer in an ethereal form."));
2426 p_ptr->kabenuke = v;
2428 /* Redraw status bar */
2429 p_ptr->redraw |= (PR_STATUS);
2431 /* Nothing to notice */
2432 if (!notice) return (FALSE);
2434 if (disturb_state) disturb(FALSE, FALSE);
2436 /* Recalculate bonuses */
2437 p_ptr->update |= (PU_BONUS);
2445 * @brief オクレ兄さんの継続時間をセットする / Set "p_ptr->tsuyoshi", notice observable changes
2447 * @param do_dec 現在の継続時間より長い値のみ上書きする
2448 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2450 bool set_tsuyoshi(TIME_EFFECT v, bool do_dec)
2452 bool notice = FALSE;
2454 /* Hack -- Force good values */
2455 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2457 if (p_ptr->is_dead) return FALSE;
2462 if (p_ptr->tsuyoshi && !do_dec)
2464 if (p_ptr->tsuyoshi > v) return FALSE;
2466 else if (!p_ptr->tsuyoshi)
2468 msg_print(_("「オクレ兄さん!」", "Brother OKURE!"));
2470 chg_virtue(V_VITALITY, 2);
2477 if (p_ptr->tsuyoshi)
2479 msg_print(_("肉体が急速にしぼんでいった。", "Your body had quickly shriveled."));
2481 (void)dec_stat(A_CON, 20, TRUE);
2482 (void)dec_stat(A_STR, 20, TRUE);
2485 chg_virtue(V_VITALITY, -3);
2490 p_ptr->tsuyoshi = v;
2492 /* Redraw status bar */
2493 p_ptr->redraw |= (PR_STATUS);
2495 /* Nothing to notice */
2496 if (!notice) return (FALSE);
2498 if (disturb_state) disturb(FALSE, FALSE);
2500 /* Recalculate bonuses */
2501 p_ptr->update |= (PU_BONUS);
2503 /* Recalculate hitpoints */
2504 p_ptr->update |= (PU_HP);
2512 * @brief 一時的元素スレイの継続時間をセットする / Set a temporary elemental brand. Clear all other brands. Print status messages. -LM-
2513 * @param attack_type スレイのタイプID
2515 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2517 bool set_ele_attack(u32b attack_type, TIME_EFFECT v)
2519 /* Hack -- Force good values */
2520 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2522 /* Clear all elemental attacks (only one is allowed at a time). */
2523 if ((p_ptr->special_attack & (ATTACK_ACID)) && (attack_type != ATTACK_ACID))
2525 p_ptr->special_attack &= ~(ATTACK_ACID);
2526 msg_print(_("酸で攻撃できなくなった。", "Your temporary acidic brand fades away."));
2528 if ((p_ptr->special_attack & (ATTACK_ELEC)) && (attack_type != ATTACK_ELEC))
2530 p_ptr->special_attack &= ~(ATTACK_ELEC);
2531 msg_print(_("電撃で攻撃できなくなった。", "Your temporary electrical brand fades away."));
2533 if ((p_ptr->special_attack & (ATTACK_FIRE)) && (attack_type != ATTACK_FIRE))
2535 p_ptr->special_attack &= ~(ATTACK_FIRE);
2536 msg_print(_("火炎で攻撃できなくなった。", "Your temporary fiery brand fades away."));
2538 if ((p_ptr->special_attack & (ATTACK_COLD)) && (attack_type != ATTACK_COLD))
2540 p_ptr->special_attack &= ~(ATTACK_COLD);
2541 msg_print(_("冷気で攻撃できなくなった。", "Your temporary frost brand fades away."));
2543 if ((p_ptr->special_attack & (ATTACK_POIS)) && (attack_type != ATTACK_POIS))
2545 p_ptr->special_attack &= ~(ATTACK_POIS);
2546 msg_print(_("毒で攻撃できなくなった。", "Your temporary poison brand fades away."));
2549 if ((v) && (attack_type))
2551 /* Set attack type. */
2552 p_ptr->special_attack |= (attack_type);
2555 p_ptr->ele_attack = v;
2559 msg_format("%sで攻撃できるようになった!",
2560 ((attack_type == ATTACK_ACID) ? "酸" :
2561 ((attack_type == ATTACK_ELEC) ? "電撃" :
2562 ((attack_type == ATTACK_FIRE) ? "火炎" :
2563 ((attack_type == ATTACK_COLD) ? "冷気" :
2564 ((attack_type == ATTACK_POIS) ? "毒" :
2567 msg_format("For a while, the blows you deal will %s",
2568 ((attack_type == ATTACK_ACID) ? "melt with acid!" :
2569 ((attack_type == ATTACK_ELEC) ? "shock your foes!" :
2570 ((attack_type == ATTACK_FIRE) ? "burn with fire!" :
2571 ((attack_type == ATTACK_COLD) ? "chill to the bone!" :
2572 ((attack_type == ATTACK_POIS) ? "poison your enemies!" :
2573 "do nothing special."))))));
2577 if (disturb_state) disturb(FALSE, FALSE);
2579 /* Redraw status bar */
2580 p_ptr->redraw |= (PR_STATUS);
2582 p_ptr->update |= (PU_BONUS);
2591 * @brief 一時的元素免疫の継続時間をセットする / Set a temporary elemental brand. Clear all other brands. Print status messages. -LM-
2592 * @param immune_type 免疫のタイプID
2594 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2596 bool set_ele_immune(u32b immune_type, TIME_EFFECT v)
2598 /* Hack -- Force good values */
2599 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2601 /* Clear all elemental attacks (only one is allowed at a time). */
2602 if ((p_ptr->special_defense & (DEFENSE_ACID)) && (immune_type != DEFENSE_ACID))
2604 p_ptr->special_defense &= ~(DEFENSE_ACID);
2605 msg_print(_("酸の攻撃で傷つけられるようになった。。", "You are no longer immune to acid."));
2607 if ((p_ptr->special_defense & (DEFENSE_ELEC)) && (immune_type != DEFENSE_ELEC))
2609 p_ptr->special_defense &= ~(DEFENSE_ELEC);
2610 msg_print(_("電撃の攻撃で傷つけられるようになった。。", "You are no longer immune to electricity."));
2612 if ((p_ptr->special_defense & (DEFENSE_FIRE)) && (immune_type != DEFENSE_FIRE))
2614 p_ptr->special_defense &= ~(DEFENSE_FIRE);
2615 msg_print(_("火炎の攻撃で傷つけられるようになった。。", "You are no longer immune to fire."));
2617 if ((p_ptr->special_defense & (DEFENSE_COLD)) && (immune_type != DEFENSE_COLD))
2619 p_ptr->special_defense &= ~(DEFENSE_COLD);
2620 msg_print(_("冷気の攻撃で傷つけられるようになった。。", "You are no longer immune to cold."));
2622 if ((p_ptr->special_defense & (DEFENSE_POIS)) && (immune_type != DEFENSE_POIS))
2624 p_ptr->special_defense &= ~(DEFENSE_POIS);
2625 msg_print(_("毒の攻撃で傷つけられるようになった。。", "You are no longer immune to poison."));
2628 if ((v) && (immune_type))
2630 /* Set attack type. */
2631 p_ptr->special_defense |= (immune_type);
2634 p_ptr->ele_immune = v;
2638 msg_format("%sの攻撃を受けつけなくなった!",
2639 ((immune_type == DEFENSE_ACID) ? "酸" :
2640 ((immune_type == DEFENSE_ELEC) ? "電撃" :
2641 ((immune_type == DEFENSE_FIRE) ? "火炎" :
2642 ((immune_type == DEFENSE_COLD) ? "冷気" :
2643 ((immune_type == DEFENSE_POIS) ? "毒" :
2646 msg_format("For a while, You are immune to %s",
2647 ((immune_type == DEFENSE_ACID) ? "acid!" :
2648 ((immune_type == DEFENSE_ELEC) ? "electricity!" :
2649 ((immune_type == DEFENSE_FIRE) ? "fire!" :
2650 ((immune_type == DEFENSE_COLD) ? "cold!" :
2651 ((immune_type == DEFENSE_POIS) ? "poison!" :
2652 "do nothing special."))))));
2656 if (disturb_state) disturb(FALSE, FALSE);
2658 /* Redraw status bar */
2659 p_ptr->redraw |= (PR_STATUS);
2661 p_ptr->update |= (PU_BONUS);
2670 * @brief 一時的酸耐性の継続時間をセットする / Set "p_ptr->oppose_acid", notice observable changes
2672 * @param do_dec 現在の継続時間より長い値のみ上書きする
2673 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2675 bool set_oppose_acid(TIME_EFFECT v, bool do_dec)
2677 bool notice = FALSE;
2679 /* Hack -- Force good values */
2680 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2682 if (p_ptr->is_dead) return FALSE;
2687 if (p_ptr->oppose_acid && !do_dec)
2689 if (p_ptr->oppose_acid > v) return FALSE;
2691 else if (!IS_OPPOSE_ACID())
2693 msg_print(_("酸への耐性がついた気がする!", "You feel resistant to acid!"));
2701 if (p_ptr->oppose_acid && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
2703 msg_print(_("酸への耐性が薄れた気がする。", "You feel less resistant to acid."));
2709 p_ptr->oppose_acid = v;
2711 /* Nothing to notice */
2712 if (!notice) return (FALSE);
2714 /* Redraw status bar */
2715 p_ptr->redraw |= (PR_STATUS);
2717 if (disturb_state) disturb(FALSE, FALSE);
2725 * @brief 一時的電撃耐性の継続時間をセットする / Set "p_ptr->oppose_elec", notice observable changes
2727 * @param do_dec 現在の継続時間より長い値のみ上書きする
2728 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2730 bool set_oppose_elec(TIME_EFFECT v, bool do_dec)
2732 bool notice = FALSE;
2734 /* Hack -- Force good values */
2735 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2737 if (p_ptr->is_dead) return FALSE;
2742 if (p_ptr->oppose_elec && !do_dec)
2744 if (p_ptr->oppose_elec > v) return FALSE;
2746 else if (!IS_OPPOSE_ELEC())
2748 msg_print(_("電撃への耐性がついた気がする!", "You feel resistant to electricity!"));
2756 if (p_ptr->oppose_elec && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
2758 msg_print(_("電撃への耐性が薄れた気がする。", "You feel less resistant to electricity."));
2764 p_ptr->oppose_elec = v;
2766 /* Nothing to notice */
2767 if (!notice) return (FALSE);
2769 /* Redraw status bar */
2770 p_ptr->redraw |= (PR_STATUS);
2772 if (disturb_state) disturb(FALSE, FALSE);
2780 * @brief 一時的火炎耐性の継続時間をセットする / Set "p_ptr->oppose_fire", notice observable changes
2782 * @param do_dec 現在の継続時間より長い値のみ上書きする
2783 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2785 bool set_oppose_fire(TIME_EFFECT v, bool do_dec)
2787 bool notice = FALSE;
2789 /* Hack -- Force good values */
2790 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2792 if (p_ptr->is_dead) return FALSE;
2794 if ((prace_is_(RACE_DEMON) && (p_ptr->lev > 44)) || (p_ptr->mimic_form == MIMIC_DEMON)) v = 1;
2798 if (p_ptr->oppose_fire && !do_dec)
2800 if (p_ptr->oppose_fire > v) return FALSE;
2802 else if (!IS_OPPOSE_FIRE())
2804 msg_print(_("火への耐性がついた気がする!", "You feel resistant to fire!"));
2812 if (p_ptr->oppose_fire && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
2814 msg_print(_("火への耐性が薄れた気がする。", "You feel less resistant to fire."));
2820 p_ptr->oppose_fire = v;
2822 /* Nothing to notice */
2823 if (!notice) return (FALSE);
2825 /* Redraw status bar */
2826 p_ptr->redraw |= (PR_STATUS);
2828 if (disturb_state) disturb(FALSE, FALSE);
2836 * @brief 一時的冷気耐性の継続時間をセットする / Set "p_ptr->oppose_cold", notice observable changes
2838 * @param do_dec 現在の継続時間より長い値のみ上書きする
2839 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2841 bool set_oppose_cold(TIME_EFFECT v, bool do_dec)
2843 bool notice = FALSE;
2845 /* Hack -- Force good values */
2846 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2848 if (p_ptr->is_dead) return FALSE;
2853 if (p_ptr->oppose_cold && !do_dec)
2855 if (p_ptr->oppose_cold > v) return FALSE;
2857 else if (!IS_OPPOSE_COLD())
2859 msg_print(_("冷気への耐性がついた気がする!", "You feel resistant to cold!"));
2867 if (p_ptr->oppose_cold && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
2869 msg_print(_("冷気への耐性が薄れた気がする。", "You feel less resistant to cold."));
2875 p_ptr->oppose_cold = v;
2877 /* Nothing to notice */
2878 if (!notice) return (FALSE);
2880 /* Redraw status bar */
2881 p_ptr->redraw |= (PR_STATUS);
2883 if (disturb_state) disturb(FALSE, FALSE);
2891 * @brief 一時的毒耐性の継続時間をセットする / Set "p_ptr->oppose_pois", notice observable changes
2893 * @param do_dec 現在の継続時間より長い値のみ上書きする
2894 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2896 bool set_oppose_pois(TIME_EFFECT v, bool do_dec)
2898 bool notice = FALSE;
2900 /* Hack -- Force good values */
2901 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2903 if ((p_ptr->pclass == CLASS_NINJA) && (p_ptr->lev > 44)) v = 1;
2904 if (p_ptr->is_dead) return FALSE;
2909 if (p_ptr->oppose_pois && !do_dec)
2911 if (p_ptr->oppose_pois > v) return FALSE;
2913 else if (!IS_OPPOSE_POIS())
2915 msg_print(_("毒への耐性がついた気がする!", "You feel resistant to poison!"));
2923 if (p_ptr->oppose_pois && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
2925 msg_print(_("毒への耐性が薄れた気がする。", "You feel less resistant to poison."));
2931 p_ptr->oppose_pois = v;
2933 /* Nothing to notice */
2934 if (!notice) return (FALSE);
2936 /* Redraw status bar */
2937 p_ptr->redraw |= (PR_STATUS);
2939 if (disturb_state) disturb(FALSE, FALSE);
2947 * @brief 朦朧の継続時間をセットする / Set "p_ptr->stun", notice observable changes
2949 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2951 * Note the special code to only notice "range" changes.
2953 bool set_stun(TIME_EFFECT v)
2955 int old_aux, new_aux;
2956 bool notice = FALSE;
2959 /* Hack -- Force good values */
2960 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2962 if (p_ptr->is_dead) return FALSE;
2964 if (prace_is_(RACE_GOLEM) || ((p_ptr->pclass == CLASS_BERSERKER) && (p_ptr->lev > 34))) v = 0;
2967 if (p_ptr->stun > 100)
2973 else if (p_ptr->stun > 50)
2979 else if (p_ptr->stun > 0)
3015 if (new_aux > old_aux)
3017 /* Describe the state */
3021 case 1: msg_print(_("意識がもうろうとしてきた。", "You have been stunned.")); break;
3024 case 2: msg_print(_("意識がひどくもうろうとしてきた。", "You have been heavily stunned.")); break;
3027 case 3: msg_print(_("頭がクラクラして意識が遠のいてきた。", "You have been knocked out.")); break;
3030 if (randint1(1000) < v || one_in_(16))
3032 msg_print(_("割れるような頭痛がする。", "A vicious blow hits your head."));
3036 if (!p_ptr->sustain_int) (void)do_dec_stat(A_INT);
3037 if (!p_ptr->sustain_wis) (void)do_dec_stat(A_WIS);
3039 else if (one_in_(2))
3041 if (!p_ptr->sustain_int) (void)do_dec_stat(A_INT);
3045 if (!p_ptr->sustain_wis) (void)do_dec_stat(A_WIS);
3048 if (p_ptr->special_defense & KATA_MASK)
3050 msg_print(_("型が崩れた。", "Your posture gets loose."));
3051 p_ptr->special_defense &= ~(KATA_MASK);
3052 p_ptr->update |= (PU_BONUS);
3053 p_ptr->update |= (PU_MONSTERS);
3054 p_ptr->redraw |= (PR_STATE);
3055 p_ptr->redraw |= (PR_STATUS);
3056 p_ptr->action = ACTION_NONE;
3060 if (p_ptr->concent) reset_concentration(TRUE);
3063 if (hex_spelling_any()) stop_hex_spell_all();
3069 else if (new_aux < old_aux)
3071 /* Describe the state */
3076 msg_print(_("やっと朦朧状態から回復した。", "You are no longer stunned."));
3078 if (disturb_state) disturb(FALSE, FALSE);
3089 if (!notice) return (FALSE);
3091 if (disturb_state) disturb(FALSE, FALSE);
3093 /* Recalculate bonuses */
3094 p_ptr->update |= (PU_BONUS);
3096 /* Redraw the "stun" */
3097 p_ptr->redraw |= (PR_STUN);
3106 * @brief 出血の継続時間をセットする / Set "p_ptr->cut", notice observable changes
3108 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
3110 * Note the special code to only notice "range" changes.
3112 bool set_cut(TIME_EFFECT v)
3114 int old_aux, new_aux;
3115 bool notice = FALSE;
3117 /* Hack -- Force good values */
3118 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
3120 if (p_ptr->is_dead) return FALSE;
3122 if ((p_ptr->prace == RACE_GOLEM ||
3123 p_ptr->prace == RACE_SKELETON ||
3124 p_ptr->prace == RACE_SPECTRE ||
3125 (p_ptr->prace == RACE_ZOMBIE && p_ptr->lev > 11)) &&
3130 if (p_ptr->cut > 1000)
3136 else if (p_ptr->cut > 200)
3142 else if (p_ptr->cut > 100)
3148 else if (p_ptr->cut > 50)
3154 else if (p_ptr->cut > 25)
3160 else if (p_ptr->cut > 10)
3166 else if (p_ptr->cut > 0)
3226 if (new_aux > old_aux)
3228 /* Describe the state */
3232 case 1: msg_print(_("かすり傷を負ってしまった。", "You have been given a graze.")); break;
3235 case 2: msg_print(_("軽い傷を負ってしまった。", "You have been given a light cut.")); break;
3238 case 3: msg_print(_("ひどい傷を負ってしまった。", "You have been given a bad cut.")); break;
3241 case 4: msg_print(_("大変な傷を負ってしまった。", "You have been given a nasty cut.")); break;
3244 case 5: msg_print(_("重大な傷を負ってしまった。", "You have been given a severe cut.")); break;
3247 case 6: msg_print(_("ひどい深手を負ってしまった。", "You have been given a deep gash.")); break;
3250 case 7: msg_print(_("致命的な傷を負ってしまった。", "You have been given a mortal wound.")); break;
3255 if (randint1(1000) < v || one_in_(16))
3257 if (!p_ptr->sustain_chr)
3259 msg_print(_("ひどい傷跡が残ってしまった。", "You have been horribly scarred."));
3266 else if (new_aux < old_aux)
3268 /* Describe the state */
3273 msg_format(_("やっと%s。", "You are no longer bleeding."), p_ptr->prace == RACE_ANDROID ? "怪我が直った" : "出血が止まった");
3275 if (disturb_state) disturb(FALSE, FALSE);
3286 if (!notice) return (FALSE);
3288 if (disturb_state) disturb(FALSE, FALSE);
3290 /* Recalculate bonuses */
3291 p_ptr->update |= (PU_BONUS);
3293 /* Redraw the "cut" */
3294 p_ptr->redraw |= (PR_CUT);
3302 * @brief 空腹状態をセットする / Set "p_ptr->food", notice observable changes
3304 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
3306 * Set "", notice observable changes\n
3308 * The "p_ptr->food" variable can get as large as 20000, allowing the
3309 * addition of the most "filling" item, Elvish Waybread, which adds
3310 * 7500 food units, without overflowing the 32767 maximum limit.\n
3312 * Perhaps we should disturb the player with various messages,
3313 * especially messages about hunger status changes. \n
3315 * Digestion of food is handled in "dungeon.c", in which, normally,
3316 * the player digests about 20 food units per 100 game turns, more
3317 * when "fast", more when "regenerating", less with "slow digestion",
3318 * but when the player is "gorged", he digests 100 food units per 10
3319 * game turns, or a full 1000 food units per 100 game turns.\n
3321 * Note that the player's speed is reduced by 10 units while gorged,
3322 * so if the player eats a single food ration (5000 food units) when
3323 * full (15000 food units), he will be gorged for (5000/100)*10 = 500
3324 * game turns, or 500/(100/5) = 25 player turns (if nothing else is
3325 * affecting the player speed).\n
3327 bool set_food(TIME_EFFECT v)
3329 int old_aux, new_aux;
3331 bool notice = FALSE;
3333 /* Hack -- Force good values */
3334 v = (v > 20000) ? 20000 : (v < 0) ? 0 : v;
3336 /* Fainting / Starving */
3337 if (p_ptr->food < PY_FOOD_FAINT)
3343 else if (p_ptr->food < PY_FOOD_WEAK)
3349 else if (p_ptr->food < PY_FOOD_ALERT)
3355 else if (p_ptr->food < PY_FOOD_FULL)
3361 else if (p_ptr->food < PY_FOOD_MAX)
3372 /* Fainting / Starving */
3373 if (v < PY_FOOD_FAINT)
3379 else if (v < PY_FOOD_WEAK)
3385 else if (v < PY_FOOD_ALERT)
3391 else if (v < PY_FOOD_FULL)
3397 else if (v < PY_FOOD_MAX)
3408 if (old_aux < 1 && new_aux > 0)
3409 chg_virtue(V_PATIENCE, 2);
3410 else if (old_aux < 3 && (old_aux != new_aux))
3411 chg_virtue(V_PATIENCE, 1);
3413 chg_virtue(V_TEMPERANCE, 1);
3415 chg_virtue(V_TEMPERANCE, -1);
3418 if (new_aux > old_aux)
3420 /* Describe the state */
3424 case 1: msg_print(_("まだ空腹で倒れそうだ。", "You are still weak.")); break;
3427 case 2: msg_print(_("まだ空腹だ。", "You are still hungry.")); break;
3430 case 3: msg_print(_("空腹感がおさまった。", "You are no longer hungry.")); break;
3433 case 4: msg_print(_("満腹だ!", "You are full!")); break;
3437 msg_print(_("食べ過ぎだ!", "You have gorged yourself!"));
3438 chg_virtue(V_HARMONY, -1);
3439 chg_virtue(V_PATIENCE, -1);
3440 chg_virtue(V_TEMPERANCE, -2);
3450 else if (new_aux < old_aux)
3452 /* Describe the state */
3455 /* Fainting / Starving */
3456 case 0: msg_print(_("あまりにも空腹で気を失ってしまった!", "You are getting faint from hunger!")); break;
3459 case 1: msg_print(_("お腹が空いて倒れそうだ。", "You are getting weak from hunger!")); break;
3462 case 2: msg_print(_("お腹が空いてきた。", "You are getting hungry.")); break;
3465 case 3: msg_print(_("満腹感がなくなった。", "You are no longer full.")); break;
3468 case 4: msg_print(_("やっとお腹がきつくなくなった。", "You are no longer gorged.")); break;
3471 if (p_ptr->wild_mode && (new_aux < 2))
3483 /* Nothing to notice */
3484 if (!notice) return (FALSE);
3486 if (disturb_state) disturb(FALSE, FALSE);
3488 /* Recalculate bonuses */
3489 p_ptr->update |= (PU_BONUS);
3492 p_ptr->redraw |= (PR_HUNGER);
3500 * @brief プレイヤーの基本能力値を増加させる / Increases a stat by one randomized level -RAK-
3501 * @param stat 上昇させるステータスID
3502 * @return 実際に上昇した場合TRUEを返す。
3504 * Note that this function (used by stat potions) now restores\n
3505 * the stat BEFORE increasing it.\n
3507 bool inc_stat(int stat)
3509 BASE_STATUS value, gain;
3511 /* Then augment the current/max stat */
3512 value = p_ptr->stat_cur[stat];
3514 /* Cannot go above 18/100 */
3515 if (value < p_ptr->stat_max_max[stat])
3517 /* Gain one (sometimes two) points */
3520 gain = ((randint0(100) < 75) ? 1 : 2);
3524 /* Gain 1/6 to 1/3 of distance to 18/100 */
3525 else if (value < (p_ptr->stat_max_max[stat]-2))
3527 /* Approximate gain value */
3528 gain = (((p_ptr->stat_max_max[stat]) - value) / 2 + 3) / 2;
3531 if (gain < 1) gain = 1;
3533 /* Apply the bonus */
3534 value += randint1(gain) + gain / 2;
3537 if (value > (p_ptr->stat_max_max[stat]-1)) value = p_ptr->stat_max_max[stat]-1;
3540 /* Gain one point at a time */
3546 /* Save the new value */
3547 p_ptr->stat_cur[stat] = value;
3549 /* Bring up the maximum too */
3550 if (value > p_ptr->stat_max[stat])
3552 p_ptr->stat_max[stat] = value;
3555 /* Recalculate bonuses */
3556 p_ptr->update |= (PU_BONUS);
3562 /* Nothing to gain */
3567 * @brief プレイヤーの基本能力値を減少させる / Decreases a stat by an amount indended to vary from 0 to 100 percent.
3568 * @param stat 減少させるステータスID
3569 * @param amount 減少させる基本量
3570 * @param permanent TRUEならば現在の最大値を減少させる
3571 * @return 実際に減少した場合TRUEを返す。
3574 * Amount could be a little higher in extreme cases to mangle very high\n
3575 * stats from massive assaults. -CWS\n
3577 * Note that "permanent" means that the *given* amount is permanent,\n
3578 * not that the new value becomes permanent. This may not work exactly\n
3579 * as expected, due to "weirdness" in the algorithm, but in general,\n
3580 * if your stat is already drained, the "max" value will not drop all\n
3581 * the way down to the "cur" value.\n
3583 bool dec_stat(int stat, int amount, int permanent)
3585 BASE_STATUS cur, max;
3590 /* Acquire current value */
3591 cur = p_ptr->stat_cur[stat];
3592 max = p_ptr->stat_max[stat];
3594 /* Note when the values are identical */
3595 same = (cur == max);
3597 /* Damage "current" value */
3600 /* Handle "low" values */
3603 if (amount > 90) cur--;
3604 if (amount > 50) cur--;
3605 if (amount > 20) cur--;
3609 /* Handle "high" values */
3612 /* Hack -- Decrement by a random amount between one-quarter */
3613 /* and one-half of the stat bonus times the percentage, with a */
3614 /* minimum damage of half the percentage. -CWS */
3615 loss = (((cur-18) / 2 + 1) / 2 + 1);
3618 if (loss < 1) loss = 1;
3620 /* Randomize the loss */
3621 loss = ((randint1(loss) + loss) * amount) / 100;
3624 if (loss < amount/2) loss = amount/2;
3626 /* Lose some points */
3629 /* Hack -- Only reduce stat to 17 sometimes */
3630 if (cur < 18) cur = (amount <= 20) ? 18 : 17;
3633 /* Prevent illegal values */
3634 if (cur < 3) cur = 3;
3636 /* Something happened */
3637 if (cur != p_ptr->stat_cur[stat]) res = TRUE;
3640 /* Damage "max" value */
3641 if (permanent && (max > 3))
3643 chg_virtue(V_SACRIFICE, 1);
3644 if (stat == A_WIS || stat == A_INT)
3645 chg_virtue(V_ENLIGHTEN, -2);
3647 /* Handle "low" values */
3650 if (amount > 90) max--;
3651 if (amount > 50) max--;
3652 if (amount > 20) max--;
3656 /* Handle "high" values */
3659 /* Hack -- Decrement by a random amount between one-quarter */
3660 /* and one-half of the stat bonus times the percentage, with a */
3661 /* minimum damage of half the percentage. -CWS */
3662 loss = (((max-18) / 2 + 1) / 2 + 1);
3663 loss = ((randint1(loss) + loss) * amount) / 100;
3664 if (loss < amount/2) loss = amount/2;
3666 /* Lose some points */
3669 /* Hack -- Only reduce stat to 17 sometimes */
3670 if (max < 18) max = (amount <= 20) ? 18 : 17;
3673 /* Hack -- keep it clean */
3674 if (same || (max < cur)) max = cur;
3676 /* Something happened */
3677 if (max != p_ptr->stat_max[stat]) res = TRUE;
3683 /* Actually set the stat to its new value. */
3684 p_ptr->stat_cur[stat] = cur;
3685 p_ptr->stat_max[stat] = max;
3687 /* Redisplay the stats later */
3688 p_ptr->redraw |= (PR_STATS);
3690 /* Recalculate bonuses */
3691 p_ptr->update |= (PU_BONUS);
3699 * @brief プレイヤーの基本能力値を回復させる / Restore a stat. Return TRUE only if this actually makes a difference.
3700 * @param stat 回復ステータスID
3701 * @return 実際に回復した場合TRUEを返す。
3703 bool res_stat(int stat)
3705 /* Restore if needed */
3706 if (p_ptr->stat_cur[stat] != p_ptr->stat_max[stat])
3709 p_ptr->stat_cur[stat] = p_ptr->stat_max[stat];
3711 /* Recalculate bonuses */
3712 p_ptr->update |= (PU_BONUS);
3714 /* Redisplay the stats later */
3715 p_ptr->redraw |= (PR_STATS);
3721 /* Nothing to restore */
3727 * Increase players hit points, notice effects
3729 bool hp_player(int num)
3732 vir = virtue_number(V_VITALITY);
3734 if(num <= 0) return (FALSE);
3738 num = num * (p_ptr->virtues[vir - 1] + 1250) / 1250;
3740 /* Healing needed */
3741 if (p_ptr->chp < p_ptr->mhp)
3743 if ((num > 0) && (p_ptr->chp < (p_ptr->mhp/3)))
3744 chg_virtue(V_TEMPERANCE, 1);
3745 /* Gain hitpoints */
3748 /* Enforce maximum */
3749 if (p_ptr->chp >= p_ptr->mhp)
3751 p_ptr->chp = p_ptr->mhp;
3752 p_ptr->chp_frac = 0;
3756 p_ptr->redraw |= (PR_HP);
3758 p_ptr->window |= (PW_PLAYER);
3763 msg_print(_("少し気分が良くなった。", "You feel a little better."));
3769 msg_print(_("気分が良くなった。", "You feel better."));
3775 msg_print(_("とても気分が良くなった。", "You feel much better."));
3781 msg_print(_("ひじょうに気分が良くなった。", "You feel very good."));
3793 * Array of stat "descriptions"
3795 static cptr desc_stat_pos[] =
3800 _("器用に", "dextrous"),
3801 _("健康に", "healthy"),
3807 * Array of stat "descriptions"
3809 static cptr desc_stat_neg[] =
3814 _("不器用に", "clumsy"),
3815 _("不健康に", "sickly"),
3823 bool do_dec_stat(int stat)
3827 /* Access the "sustain" */
3830 case A_STR: if (p_ptr->sustain_str) sust = TRUE; break;
3831 case A_INT: if (p_ptr->sustain_int) sust = TRUE; break;
3832 case A_WIS: if (p_ptr->sustain_wis) sust = TRUE; break;
3833 case A_DEX: if (p_ptr->sustain_dex) sust = TRUE; break;
3834 case A_CON: if (p_ptr->sustain_con) sust = TRUE; break;
3835 case A_CHR: if (p_ptr->sustain_chr) sust = TRUE; break;
3839 if (sust && (!ironman_nightmare || randint0(13)))
3841 msg_format(_("%sなった気がしたが、すぐに元に戻った。", "You feel %s for a moment, but the feeling passes."),
3842 desc_stat_neg[stat]);
3848 /* Attempt to reduce the stat */
3849 if (dec_stat(stat, 10, (ironman_nightmare && !randint0(13))))
3851 msg_format(_("ひどく%sなった気がする。", "You feel very %s."), desc_stat_neg[stat]);
3857 /* Nothing obvious */
3863 * Restore lost "points" in a stat
3865 bool do_res_stat(int stat)
3867 /* Attempt to increase */
3870 msg_format(_("元通りに%sなった気がする。", "You feel less %s."), desc_stat_pos[stat]);
3875 /* Nothing obvious */
3881 * Gain a "point" in a stat
3883 bool do_inc_stat(int stat)
3887 /* Restore strength */
3888 res = res_stat(stat);
3890 /* Attempt to increase */
3895 chg_virtue(V_ENLIGHTEN, 1);
3896 chg_virtue(V_FAITH, 1);
3898 else if (stat == A_INT)
3900 chg_virtue(V_KNOWLEDGE, 1);
3901 chg_virtue(V_ENLIGHTEN, 1);
3903 else if (stat == A_CON)
3904 chg_virtue(V_VITALITY, 1);
3906 msg_format(_("ワーオ!とても%sなった!", "Wow! You feel very %s!"), desc_stat_pos[stat]);
3911 /* Restoration worked */
3914 msg_format(_("元通りに%sなった気がする。", "You feel less %s."), desc_stat_pos[stat]);
3919 /* Nothing obvious */
3925 * Restores any drained experience
3927 bool restore_level(void)
3929 /* Restore experience */
3930 if (p_ptr->exp < p_ptr->max_exp)
3932 msg_print(_("経験値が戻ってきた気がする。", "You feel your experience returning."));
3934 /* Restore the experience */
3935 p_ptr->exp = p_ptr->max_exp;
3937 /* Check the experience */
3951 bool lose_all_info(void)
3955 chg_virtue(V_KNOWLEDGE, -5);
3956 chg_virtue(V_ENLIGHTEN, -5);
3958 /* Forget info about objects */
3959 for (i = 0; i < INVEN_TOTAL; i++)
3961 object_type *o_ptr = &inventory[i];
3963 /* Skip non-objects */
3964 if (!o_ptr->k_idx) continue;
3966 /* Allow "protection" by the MENTAL flag */
3967 if (o_ptr->ident & (IDENT_MENTAL)) continue;
3969 /* Remove "default inscriptions" */
3970 o_ptr->feeling = FEEL_NONE;
3972 /* Hack -- Clear the "empty" flag */
3973 o_ptr->ident &= ~(IDENT_EMPTY);
3975 /* Hack -- Clear the "known" flag */
3976 o_ptr->ident &= ~(IDENT_KNOWN);
3978 /* Hack -- Clear the "felt" flag */
3979 o_ptr->ident &= ~(IDENT_SENSE);
3982 /* Recalculate bonuses */
3983 p_ptr->update |= (PU_BONUS);
3985 /* Combine / Reorder the pack (later) */
3986 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
3988 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
3990 /* Mega-Hack -- Forget the map */
3998 void do_poly_wounds(void)
4000 /* Changed to always provide at least _some_ healing */
4001 s16b wounds = p_ptr->cut;
4002 s16b hit_p = (p_ptr->mhp - p_ptr->chp);
4003 s16b change = damroll(p_ptr->lev, 5);
4004 bool Nasty_effect = one_in_(5);
4006 if (!(wounds || hit_p || Nasty_effect)) return;
4008 msg_print(_("傷がより軽いものに変化した。", "Your wounds are polymorphed into less serious ones."));
4012 msg_print(_("新たな傷ができた!", "A new wound was created!"));
4013 take_hit(DAMAGE_LOSELIFE, change / 2, _("変化した傷", "a polymorphed wound"), -1);
4018 set_cut(p_ptr->cut - (change / 2));
4024 * Change player race
4026 void change_race(CHARACTER_IDX new_race, cptr effect_msg)
4028 cptr title = race_info[new_race].title;
4029 int old_race = p_ptr->prace;
4032 msg_format("あなたは%s%sに変化した!", effect_msg, title);
4034 msg_format("You turn into %s %s%s!", (!effect_msg[0] && is_a_vowel(title[0]) ? "an" : "a"), effect_msg, title);
4037 chg_virtue(V_CHANCE, 2);
4039 if (p_ptr->prace < 32)
4041 p_ptr->old_race1 |= 1L << p_ptr->prace;
4045 p_ptr->old_race2 |= 1L << (p_ptr->prace - 32);
4047 p_ptr->prace = new_race;
4048 rp_ptr = &race_info[p_ptr->prace];
4050 /* Experience factor */
4051 p_ptr->expfact = rp_ptr->r_exp + cp_ptr->c_exp;
4054 * The speed bonus of Klackons and Sprites are disabled
4055 * and the experience penalty is decreased.
4057 if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_NINJA)) && ((p_ptr->prace == RACE_KLACKON) || (p_ptr->prace == RACE_SPRITE)))
4058 p_ptr->expfact -= 15;
4060 /* Get character's height and weight */
4061 get_height_weight();
4064 if (p_ptr->pclass == CLASS_SORCERER)
4065 p_ptr->hitdie = rp_ptr->r_mhp/2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
4067 p_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
4069 do_cmd_rerate(FALSE);
4071 /* The experience level may be modified */
4074 p_ptr->redraw |= (PR_BASIC);
4076 p_ptr->update |= (PU_BONUS);
4080 /* Load an autopick preference file */
4081 if (old_race != p_ptr->prace) autopick_load_pref(FALSE);
4083 /* Player's graphic tile may change */
4084 lite_spot(p_ptr->y, p_ptr->x);
4088 void do_poly_self(void)
4090 int power = p_ptr->lev;
4092 msg_print(_("あなたは変化の訪れを感じた...", "You feel a change coming over you..."));
4093 chg_virtue(V_CHANCE, 1);
4095 if ((power > randint0(20)) && one_in_(3) && (p_ptr->prace != RACE_ANDROID))
4097 char effect_msg[80] = "";
4098 CHARACTER_IDX new_race;
4100 /* Some form of racial polymorph... */
4103 if ((power > randint0(5)) && one_in_(4))
4108 if (p_ptr->psex == SEX_MALE)
4110 p_ptr->psex = SEX_FEMALE;
4111 sp_ptr = &sex_info[p_ptr->psex];
4112 sprintf(effect_msg, _("女性の", "female "));
4116 p_ptr->psex = SEX_MALE;
4117 sp_ptr = &sex_info[p_ptr->psex];
4118 sprintf(effect_msg, _("男性の", "male "));
4122 if ((power > randint0(30)) && one_in_(5))
4126 /* Harmful deformity */
4133 (void)dec_stat(tmp, randint1(6) + 6, one_in_(3));
4139 /* Deformities are discriminated against! */
4140 (void)dec_stat(A_CHR, randint1(6), TRUE);
4145 sprintf(tmp_msg,_("%s", "%s "),effect_msg);
4146 sprintf(effect_msg,_("奇形の%s", "deformed %s "),tmp_msg);
4150 sprintf(effect_msg,_("奇形の", "deformed "));
4154 while ((power > randint0(20)) && one_in_(10))
4156 /* Polymorph into a less mutated form */
4159 if (!lose_mutation(0))
4160 msg_print(_("奇妙なくらい普通になった気がする。", "You feel oddly normal."));
4165 new_race = (CHARACTER_IDX)randint0(MAX_RACES);
4167 while ((new_race == p_ptr->prace) || (new_race == RACE_ANDROID));
4169 change_race(new_race, effect_msg);
4172 if ((power > randint0(30)) && one_in_(6))
4178 msg_format(_("%sの構成が変化した!", "Your internal organs are rearranged!"), p_ptr->prace == RACE_ANDROID ? "機械" : "内臓");
4182 (void)dec_stat(tmp, randint1(6) + 6, one_in_(3));
4187 msg_print(_("現在の姿で生きていくのは困難なようだ!", "You find living difficult in your present form!"));
4188 take_hit(DAMAGE_LOSELIFE, damroll(randint1(10), p_ptr->lev), _("致命的な突然変異", "a lethal mutation"), -1);
4194 if ((power > randint0(20)) && one_in_(4))
4199 do_cmd_rerate(FALSE);
4202 while ((power > randint0(15)) && one_in_(3))
4205 (void)gain_random_mutation(0);
4208 if (power > randint0(5))
4214 /* Note: earlier deductions may have left power < 0 already. */
4224 * Decreases players hit points and sets death flag if necessary
4226 * Invulnerability needs to be changed into a "shield"
4228 * Hack -- this function allows the user to save (or quit)
4229 * the game when he dies, since the "You die." message is shown before
4230 * setting the player to "dead".
4233 int take_hit(int damage_type, HIT_POINT damage, cptr hit_from, int monspell)
4235 int old_chp = p_ptr->chp;
4237 char death_message[1024];
4240 int warning = (p_ptr->mhp * hitpoint_warn / 10);
4243 if (p_ptr->is_dead) return 0;
4245 if (p_ptr->sutemi) damage *= 2;
4246 if (p_ptr->special_defense & KATA_IAI) damage += (damage + 4) / 5;
4248 if (easy_band) damage = (damage+1)/2;
4250 if (damage_type != DAMAGE_USELIFE)
4252 disturb(TRUE, TRUE);
4259 if (monspell >= 0) learn_spell(monspell);
4261 /* Mega-Hack -- Apply "invulnerability" */
4262 if ((damage_type != DAMAGE_USELIFE) && (damage_type != DAMAGE_LOSELIFE))
4264 if (IS_INVULN() && (damage < 9000))
4266 if (damage_type == DAMAGE_FORCE)
4268 msg_print(_("バリアが切り裂かれた!", "The attack cuts your shield of invulnerability open!"));
4270 else if (one_in_(PENETRATE_INVULNERABILITY))
4272 msg_print(_("無敵のバリアを破って攻撃された!", "The attack penetrates your shield of invulnerability!"));
4280 if (CHECK_MULTISHADOW())
4282 if (damage_type == DAMAGE_FORCE)
4284 msg_print(_("幻影もろとも体が切り裂かれた!", "The attack hits Shadow together with you!"));
4286 else if (damage_type == DAMAGE_ATTACK)
4288 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
4293 if (p_ptr->wraith_form)
4295 if (damage_type == DAMAGE_FORCE)
4297 msg_print(_("半物質の体が切り裂かれた!", "The attack cuts through your ethereal body!"));
4302 if ((damage == 0) && one_in_(2)) damage = 1;
4306 if (p_ptr->special_defense & KATA_MUSOU)
4309 if ((damage == 0) && one_in_(2)) damage = 1;
4311 } /* not if LOSELIFE USELIFE */
4313 /* Hurt the player */
4314 p_ptr->chp -= damage;
4315 if(damage_type == DAMAGE_GENO && p_ptr->chp < 0)
4317 damage += p_ptr->chp;
4321 /* Display the hitpoints */
4322 p_ptr->redraw |= (PR_HP);
4324 p_ptr->window |= (PW_PLAYER);
4326 if (damage_type != DAMAGE_GENO && p_ptr->chp == 0)
4328 chg_virtue(V_SACRIFICE, 1);
4329 chg_virtue(V_CHANCE, 2);
4335 bool android = (p_ptr->prace == RACE_ANDROID ? TRUE : FALSE);
4337 #ifdef JP /* 死んだ時に強制終了して死を回避できなくしてみた by Habu */
4339 if(!save_player()) msg_print("セーブ失敗!");
4344 chg_virtue(V_SACRIFICE, 10);
4349 p_ptr->leaving = TRUE;
4352 p_ptr->is_dead = TRUE;
4354 if (p_ptr->inside_arena)
4356 cptr m_name = r_name+r_info[arena_info[p_ptr->arena_number].r_idx].name;
4357 msg_format(_("あなたは%sの前に敗れ去った。", "You are beaten by %s."), m_name);
4359 if (record_arena) do_cmd_write_nikki(NIKKI_ARENA, -1 - p_ptr->arena_number, m_name);
4363 QUEST_IDX q_idx = quest_number(dun_level);
4364 bool seppuku = streq(hit_from, "Seppuku");
4365 bool winning_seppuku = p_ptr->total_winner && seppuku;
4367 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_GAMEOVER);
4370 /* Make screen dump */
4371 screen_dump = make_screen_dump();
4374 /* Note cause of death */
4377 strcpy(p_ptr->died_from, hit_from);
4379 if (!winning_seppuku) strcpy(p_ptr->died_from, "切腹");
4386 sprintf(dummy, "%s%s%s", !p_ptr->paralyzed ? "" : p_ptr->free_act ? "彫像状態で" : "麻痺状態で", p_ptr->image ? "幻覚に歪んだ" : "", hit_from);
4388 sprintf(dummy, "%s%s", hit_from, !p_ptr->paralyzed ? "" : " while helpless");
4390 my_strcpy(p_ptr->died_from, dummy, sizeof p_ptr->died_from);
4393 /* No longer a winner */
4394 p_ptr->total_winner = FALSE;
4396 if (winning_seppuku)
4398 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("勝利の後切腹した。", "did Seppuku after the winning."));
4404 if (p_ptr->inside_arena)
4405 strcpy(buf,_("アリーナ", "in the Arena"));
4406 else if (!dun_level)
4407 strcpy(buf,_("地上", "on the surface"));
4408 else if (q_idx && (is_fixed_quest_idx(q_idx) &&
4409 !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
4410 strcpy(buf,_("クエスト", "in a quest"));
4412 sprintf(buf,_("%d階", "level %d"), (int)dun_level);
4414 sprintf(tmp, _("%sで%sに殺された。", "killed by %s %s."), buf, p_ptr->died_from);
4415 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, tmp);
4418 do_cmd_write_nikki(NIKKI_GAMESTART, 1, _("-------- ゲームオーバー --------", "-------- Game Over --------"));
4419 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, "\n\n\n\n");
4423 if (get_check_strict(_("画面を保存しますか?", "Dump the screen? "), CHECK_NO_HISTORY))
4425 do_cmd_save_screen();
4430 /* Initialize "last message" buffer */
4431 if (p_ptr->last_message) string_free(p_ptr->last_message);
4432 p_ptr->last_message = NULL;
4434 /* Hack -- Note death */
4438 msg_format("あなたは%sました。", android ? "壊れ" : "死に");
4440 msg_print(android ? "You are broken." : "You die.");
4447 if (winning_seppuku)
4449 get_rnd_line(_("seppuku_j.txt", "seppuku.txt"), 0, death_message);
4453 get_rnd_line(_("death_j.txt", "death.txt"), 0, death_message);
4459 while (!get_string(winning_seppuku ? "辞世の句: " : "断末魔の叫び: ", death_message, 1024)) ;
4461 while (!get_string("Last word: ", death_message, 1024)) ;
4464 while (winning_seppuku && !get_check_strict(_("よろしいですか?", "Are you sure? "), CHECK_NO_HISTORY));
4466 if (death_message[0] == '\0')
4469 strcpy(death_message, format("あなたは%sました。", android ? "壊れ" : "死に"));
4471 strcpy(death_message, android ? "You are broken." : "You die.");
4474 else p_ptr->last_message = string_make(death_message);
4477 if (winning_seppuku)
4482 int msg_pos_x[9] = { 5, 7, 9, 12, 14, 17, 19, 21, 23};
4483 int msg_pos_y[9] = { 3, 4, 5, 4, 5, 4, 5, 6, 4};
4490 for (i = 0; i < 40; i++)
4491 Term_putstr(randint0(w / 2) * 2, randint0(h), 2, TERM_VIOLET, "υ");
4493 str = death_message;
4494 if (strncmp(str, "「", 2) == 0) str += 2;
4496 str2 = my_strstr(str, "」");
4497 if (str2 != NULL) *str2 = '\0';
4502 str2 = my_strstr(str, " ");
4503 if (str2 == NULL) len = strlen(str);
4504 else len = str2 - str;
4508 Term_putstr_v(w * 3 / 4 - 2 - msg_pos_x[i] * 2, msg_pos_y[i], len,
4510 if (str2 == NULL) break;
4514 if (*str == 0) break;
4518 Term_putstr(w-1, h-1, 1, TERM_WHITE, " ");
4522 /* Make screen dump */
4523 screen_dump = make_screen_dump();
4526 /* Wait a key press */
4531 msg_print(death_message);
4541 /* Hitpoint warning */
4542 if (p_ptr->chp < warning)
4544 /* Hack -- bell on first notice */
4545 if (old_chp > warning) bell();
4549 if (record_danger && (old_chp > warning))
4551 if (p_ptr->image && damage_type == DAMAGE_ATTACK)
4552 hit_from = _("何か", "something");
4554 sprintf(tmp,_("%sによってピンチに陥った。", "A critical situation because of %s."),hit_from);
4555 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, tmp);
4560 /* stop auto_more even if DAMAGE_USELIFE */
4564 msg_print(_("*** 警告:低ヒット・ポイント! ***", "*** LOW HITPOINT WARNING! ***"));
4568 if (p_ptr->wild_mode && !p_ptr->leaving && (p_ptr->chp < MAX(warning, p_ptr->mhp/5)))
4579 void gain_exp_64(s32b amount, u32b amount_frac)
4581 if (p_ptr->is_dead) return;
4583 if (p_ptr->prace == RACE_ANDROID) return;
4585 /* Gain some experience */
4586 s64b_add(&(p_ptr->exp), &(p_ptr->exp_frac), amount, amount_frac);
4588 /* Slowly recover from experience drainage */
4589 if (p_ptr->exp < p_ptr->max_exp)
4591 /* Gain max experience (20%) (was 10%) */
4592 p_ptr->max_exp += amount / 5;
4595 /* Check Experience */
4603 void gain_exp(s32b amount)
4605 gain_exp_64(amount, 0L);
4609 void calc_android_exp(void)
4613 if (p_ptr->is_dead) return;
4615 if (p_ptr->prace != RACE_ANDROID) return;
4617 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
4619 object_type *o_ptr = &inventory[i];
4621 object_type *q_ptr = &forge;
4623 DEPTH level = MAX(k_info[o_ptr->k_idx].level - 8, 1);
4625 if ((i == INVEN_RIGHT) || (i == INVEN_LEFT) || (i == INVEN_NECK) || (i == INVEN_LITE)) continue;
4626 if (!o_ptr->k_idx) continue;
4628 /* Wipe the object */
4631 object_copy(q_ptr, o_ptr);
4632 q_ptr->discount = 0;
4633 q_ptr->curse_flags = 0L;
4635 if (object_is_fixed_artifact(o_ptr))
4637 level = (level + MAX(a_info[o_ptr->name1].level - 8, 5)) / 2;
4638 level += MIN(20, a_info[o_ptr->name1].rarity/(a_info[o_ptr->name1].gen_flags & TRG_INSTA_ART ? 10 : 3));
4640 else if (object_is_ego(o_ptr))
4642 level += MAX(3, (e_info[o_ptr->name2].rating - 5)/2);
4644 else if (o_ptr->art_name)
4646 s32b total_flags = flag_cost(o_ptr, o_ptr->pval);
4649 if (!object_is_weapon_ammo(o_ptr))
4652 if (total_flags < 15000) fake_level = 10;
4653 else if (total_flags < 35000) fake_level = 25;
4654 else fake_level = 40;
4659 if (total_flags < 20000) fake_level = 10;
4660 else if (total_flags < 45000) fake_level = 25;
4661 else fake_level = 40;
4664 level = MAX(level, (level + MAX(fake_level - 8, 5)) / 2 + 3);
4667 value = object_value_real(q_ptr);
4669 if (value <= 0) continue;
4670 if ((o_ptr->tval == TV_SOFT_ARMOR) && (o_ptr->sval == SV_ABUNAI_MIZUGI) && (p_ptr->pseikaku != SEIKAKU_SEXY)) value /= 32;
4671 if (value > 5000000L) value = 5000000L;
4672 if ((o_ptr->tval == TV_DRAG_ARMOR) || (o_ptr->tval == TV_CARD)) level /= 2;
4674 if (object_is_artifact(o_ptr) || object_is_ego(o_ptr) ||
4675 (o_ptr->tval == TV_DRAG_ARMOR) ||
4676 ((o_ptr->tval == TV_HELM) && (o_ptr->sval == SV_DRAGON_HELM)) ||
4677 ((o_ptr->tval == TV_SHIELD) && (o_ptr->sval == SV_DRAGON_SHIELD)) ||
4678 ((o_ptr->tval == TV_GLOVES) && (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES)) ||
4679 ((o_ptr->tval == TV_BOOTS) && (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE)) ||
4680 ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DIAMOND_EDGE)))
4682 if (level > 65) level = 35 + (level - 65) / 5;
4683 else if (level > 35) level = 25 + (level - 35) / 3;
4684 else if (level > 15) level = 15 + (level - 15) / 2;
4685 exp = MIN(100000L, value) / 2 * level * level;
4686 if (value > 100000L)
4687 exp += (value - 100000L) / 8 * level * level;
4691 exp = MIN(100000L, value) * level;
4692 if (value > 100000L)
4693 exp += (value - 100000L) / 4 * level;
4695 if ((((i == INVEN_RARM) || (i == INVEN_LARM)) && (buki_motteruka(i))) || (i == INVEN_BOW)) total_exp += exp / 48;
4696 else total_exp += exp / 16;
4697 if (i == INVEN_BODY) total_exp += exp / 32;
4699 p_ptr->exp = p_ptr->max_exp = total_exp;
4701 /* Check Experience */
4709 void lose_exp(s32b amount)
4711 if (p_ptr->prace == RACE_ANDROID) return;
4713 /* Never drop below zero experience */
4714 if (amount > p_ptr->exp) amount = p_ptr->exp;
4716 /* Lose some experience */
4717 p_ptr->exp -= amount;
4719 /* Check Experience */
4726 * If resisted to draining, return FALSE
4728 bool drain_exp(s32b drain, s32b slip, int hold_exp_prob)
4730 /* Androids and their mimics are never drained */
4731 if (p_ptr->prace == RACE_ANDROID) return FALSE;
4733 if (p_ptr->hold_exp && (randint0(100) < hold_exp_prob))
4735 /* Hold experience */
4736 msg_print(_("しかし自己の経験値を守りきった!", "You keep hold of your experience!"));
4740 /* Hold experience failed */
4741 if (p_ptr->hold_exp)
4743 msg_print(_("経験値を少し吸い取られた気がする!", "You feel your experience slipping away!"));
4748 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away!"));
4756 bool set_ultimate_res(TIME_EFFECT v, bool do_dec)
4758 bool notice = FALSE;
4760 /* Hack -- Force good values */
4761 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
4763 if (p_ptr->is_dead) return FALSE;
4768 if (p_ptr->ult_res && !do_dec)
4770 if (p_ptr->ult_res > v) return FALSE;
4772 else if (!p_ptr->ult_res)
4774 msg_print(_("あらゆることに対して耐性がついた気がする!", "You feel resistant!"));
4784 msg_print(_("あらゆることに対する耐性が薄れた気がする。", "You feel less resistant"));
4792 /* Redraw status bar */
4793 p_ptr->redraw |= (PR_STATUS);
4795 /* Nothing to notice */
4796 if (!notice) return (FALSE);
4798 if (disturb_state) disturb(FALSE, FALSE);
4800 /* Recalculate bonuses */
4801 p_ptr->update |= (PU_BONUS);
4808 bool set_tim_res_nether(TIME_EFFECT v, bool do_dec)
4810 bool notice = FALSE;
4812 /* Hack -- Force good values */
4813 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
4815 if (p_ptr->is_dead) return FALSE;
4820 if (p_ptr->tim_res_nether && !do_dec)
4822 if (p_ptr->tim_res_nether > v) return FALSE;
4824 else if (!p_ptr->tim_res_nether)
4826 msg_print(_("地獄の力に対して耐性がついた気がする!", "You feel nether resistant!"));
4834 if (p_ptr->tim_res_nether)
4836 msg_print(_("地獄の力に対する耐性が薄れた気がする。", "You feel less nether resistant"));
4842 p_ptr->tim_res_nether = v;
4844 /* Redraw status bar */
4845 p_ptr->redraw |= (PR_STATUS);
4847 /* Nothing to notice */
4848 if (!notice) return (FALSE);
4850 if (disturb_state) disturb(FALSE, FALSE);
4852 /* Recalculate bonuses */
4853 p_ptr->update |= (PU_BONUS);
4860 bool set_tim_res_time(TIME_EFFECT v, bool do_dec)
4862 bool notice = FALSE;
4864 /* Hack -- Force good values */
4865 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
4867 if (p_ptr->is_dead) return FALSE;
4872 if (p_ptr->tim_res_time && !do_dec)
4874 if (p_ptr->tim_res_time > v) return FALSE;
4876 else if (!p_ptr->tim_res_time)
4878 msg_print(_("時間逆転の力に対して耐性がついた気がする!", "You feel time resistant!"));
4886 if (p_ptr->tim_res_time)
4888 msg_print(_("時間逆転の力に対する耐性が薄れた気がする。", "You feel less time resistant"));
4894 p_ptr->tim_res_time = v;
4896 /* Redraw status bar */
4897 p_ptr->redraw |= (PR_STATUS);
4899 /* Nothing to notice */
4900 if (!notice) return (FALSE);
4902 if (disturb_state) disturb(FALSE, FALSE);
4904 /* Recalculate bonuses */
4905 p_ptr->update |= (PU_BONUS);
4914 * Choose a warrior-mage elemental attack. -LM-
4916 bool choose_ele_attack(void)
4922 if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM))
4924 msg_format(_("武器を持たないと魔法剣は使えない。", "You cannot use temporary branding with no weapon."));
4931 num = (p_ptr->lev - 20) / 5;
4932 c_prt(TERM_RED, _(" a) 焼棄", " a) Fire Brand"), 2, 14);
4935 c_prt(TERM_L_WHITE,_(" b) 凍結", " b) Cold Brand"), 3, 14);
4940 c_prt(TERM_GREEN, _(" c) 毒殺", " c) Poison Brand"), 4, 14);
4945 c_prt(TERM_L_DARK, _(" d) 溶解", " d) Acid Brand"), 5, 14);
4950 c_prt(TERM_BLUE, _(" e) 電撃", " e) Elec Brand"), 6, 14);
4959 prt(_(" どの元素攻撃をしますか?", " Choose a temporary elemental brand "), 1, 14);
4963 if ((choice == 'a') || (choice == 'A'))
4964 set_ele_attack(ATTACK_FIRE, p_ptr->lev/2 + randint1(p_ptr->lev/2));
4965 else if (((choice == 'b') || (choice == 'B')) && (num >= 2))
4966 set_ele_attack(ATTACK_COLD, p_ptr->lev/2 + randint1(p_ptr->lev/2));
4967 else if (((choice == 'c') || (choice == 'C')) && (num >= 3))
4968 set_ele_attack(ATTACK_POIS, p_ptr->lev/2 + randint1(p_ptr->lev/2));
4969 else if (((choice == 'd') || (choice == 'D')) && (num >= 4))
4970 set_ele_attack(ATTACK_ACID, p_ptr->lev/2 + randint1(p_ptr->lev/2));
4971 else if (((choice == 'e') || (choice == 'E')) && (num >= 5))
4972 set_ele_attack(ATTACK_ELEC, p_ptr->lev/2 + randint1(p_ptr->lev/2));
4975 msg_print(_("魔法剣を使うのをやめた。", "You cancel the temporary branding."));
4986 * Choose a elemental immune. -LM-
4988 bool choose_ele_immune(TIME_EFFECT immune_turn)
4995 c_prt(TERM_RED, _(" a) 火炎", " a) Immune Fire"), 2, 14);
4996 c_prt(TERM_L_WHITE,_(" b) 冷気", " b) Immune Cold"), 3, 14);
4997 c_prt(TERM_L_DARK, _(" c) 酸", " c) Immune Acid"), 4, 14);
4998 c_prt(TERM_BLUE, _(" d) 電撃", " d) Immune Elec"), 5, 14);
5006 prt(_(" どの元素の免疫をつけますか?", " Choose a temporary elemental immune "), 1, 14);
5010 if ((choice == 'a') || (choice == 'A'))
5011 set_ele_immune(DEFENSE_FIRE, immune_turn);
5012 else if ((choice == 'b') || (choice == 'B'))
5013 set_ele_immune(DEFENSE_COLD, immune_turn);
5014 else if ((choice == 'c') || (choice == 'C'))
5015 set_ele_immune(DEFENSE_ACID, immune_turn);
5016 else if ((choice == 'd') || (choice == 'D'))
5017 set_ele_immune(DEFENSE_ELEC, immune_turn);
5020 msg_print(_("免疫を付けるのをやめた。", "You cancel the temporary immune."));