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);
278 p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
280 /* Update monsters */
281 p_ptr->update |= (PU_MONSTERS);
283 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
285 p_ptr->energy_need += ENERGY_NEED();
291 * @brief 変身効果の継続時間と変身先をセットする / Set "p_ptr->tim_mimic", and "p_ptr->mimic_form", notice observable changes
294 * @param do_dec 現在の継続時間より長い値のみ上書きする
295 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
297 bool set_mimic(TIME_EFFECT v, IDX p, bool do_dec)
301 /* Hack -- Force good values */
302 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
304 if (p_ptr->is_dead) return FALSE;
309 if (p_ptr->tim_mimic && (p_ptr->mimic_form == p) && !do_dec)
311 if (p_ptr->tim_mimic > v) return FALSE;
313 else if ((!p_ptr->tim_mimic) || (p_ptr->mimic_form != p))
315 msg_print(_("自分の体が変わってゆくのを感じた。", "You feel that your body changes."));
316 p_ptr->mimic_form = p;
324 if (p_ptr->tim_mimic)
326 msg_print(_("変身が解けた。", "You are no longer transformed."));
327 if (p_ptr->mimic_form == MIMIC_DEMON) set_oppose_fire(0, TRUE);
335 p_ptr->tim_mimic = v;
337 /* Nothing to notice */
341 if (disturb_state) disturb(FALSE, TRUE);
344 p_ptr->redraw |= (PR_BASIC | PR_STATUS);
346 /* Recalculate bonuses */
347 p_ptr->update |= (PU_BONUS | PU_HP);
354 * @brief 盲目の継続時間をセットする / Set "p_ptr->blind", notice observable changes
356 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
358 * Note the use of "PU_UN_LITE" and "PU_UN_VIEW", which is needed to\n
359 * memorize any terrain features which suddenly become "visible".\n
360 * Note that blindness is currently the only thing which can affect\n
361 * "player_can_see_bold()".\n
363 bool set_blind(TIME_EFFECT v)
367 /* Hack -- Force good values */
368 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
370 if (p_ptr->is_dead) return FALSE;
377 if (p_ptr->prace == RACE_ANDROID)
379 msg_print(_("センサーをやられた!", "You are blind!"));
383 msg_print(_("目が見えなくなってしまった!", "You are blind!"));
387 chg_virtue(V_ENLIGHTEN, -1);
396 if (p_ptr->prace == RACE_ANDROID)
398 msg_print(_("センサーが復旧した。", "You can see again."));
402 msg_print(_("やっと目が見えるようになった。", "You can see again."));
412 /* Redraw status bar */
413 p_ptr->redraw |= (PR_STATUS);
415 /* Nothing to notice */
416 if (!notice) return (FALSE);
418 if (disturb_state) disturb(FALSE, FALSE);
420 /* Fully update the visuals */
421 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
423 p_ptr->redraw |= (PR_MAP);
425 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
432 * @brief 混乱の継続時間をセットする / Set "p_ptr->confused", notice observable changes
434 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
436 bool set_confused(TIME_EFFECT v)
440 /* Hack -- Force good values */
441 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
443 if (p_ptr->is_dead) return FALSE;
448 if (!p_ptr->confused)
450 msg_print(_("あなたは混乱した!", "You are confused!"));
452 if (p_ptr->action == ACTION_LEARN)
454 msg_print(_("学習が続けられない!", "You cannot continue Learning!"));
457 p_ptr->redraw |= (PR_STATE);
458 p_ptr->action = ACTION_NONE;
460 if (p_ptr->action == ACTION_KAMAE)
462 msg_print(_("構えがとけた。", "Your posture gets loose."));
463 p_ptr->special_defense &= ~(KAMAE_MASK);
464 p_ptr->update |= (PU_BONUS);
465 p_ptr->redraw |= (PR_STATE);
466 p_ptr->action = ACTION_NONE;
468 else if (p_ptr->action == ACTION_KATA)
470 msg_print(_("型が崩れた。", "Your posture gets loose."));
471 p_ptr->special_defense &= ~(KATA_MASK);
472 p_ptr->update |= (PU_BONUS);
473 p_ptr->update |= (PU_MONSTERS);
474 p_ptr->redraw |= (PR_STATE);
475 p_ptr->redraw |= (PR_STATUS);
476 p_ptr->action = ACTION_NONE;
480 if (p_ptr->concent) reset_concentration(TRUE);
483 if (hex_spelling_any()) stop_hex_spell_all();
486 p_ptr->counter = FALSE;
487 chg_virtue(V_HARMONY, -1);
496 msg_print(_("やっと混乱がおさまった。", "You feel less confused now."));
497 p_ptr->special_attack &= ~(ATTACK_SUIKEN);
505 /* Redraw status bar */
506 p_ptr->redraw |= (PR_STATUS);
508 /* Nothing to notice */
509 if (!notice) return (FALSE);
511 if (disturb_state) disturb(FALSE, FALSE);
518 * @brief 毒の継続時間をセットする / Set "p_ptr->poisoned", notice observable changes
520 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
522 bool set_poisoned(TIME_EFFECT v)
526 /* Hack -- Force good values */
527 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
529 if (p_ptr->is_dead) return FALSE;
534 if (!p_ptr->poisoned)
536 msg_print(_("毒に侵されてしまった!", "You are poisoned!"));
546 msg_print(_("やっと毒の痛みがなくなった。", "You are no longer poisoned."));
554 /* Redraw status bar */
555 p_ptr->redraw |= (PR_STATUS);
557 /* Nothing to notice */
558 if (!notice) return (FALSE);
560 if (disturb_state) disturb(FALSE, FALSE);
567 * @brief 恐怖の継続時間をセットする / Set "p_ptr->afraid", notice observable changes
569 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
571 bool set_afraid(TIME_EFFECT v)
575 /* Hack -- Force good values */
576 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
578 if (p_ptr->is_dead) return FALSE;
585 msg_print(_("何もかも恐くなってきた!", "You are terrified!"));
587 if (p_ptr->special_defense & KATA_MASK)
589 msg_print(_("型が崩れた。", "Your posture gets loose."));
590 p_ptr->special_defense &= ~(KATA_MASK);
591 p_ptr->update |= (PU_BONUS);
592 p_ptr->update |= (PU_MONSTERS);
593 p_ptr->redraw |= (PR_STATE);
594 p_ptr->redraw |= (PR_STATUS);
595 p_ptr->action = ACTION_NONE;
599 p_ptr->counter = FALSE;
600 chg_virtue(V_VALOUR, -1);
609 msg_print(_("やっと恐怖を振り払った。", "You feel bolder now."));
617 /* Redraw status bar */
618 p_ptr->redraw |= (PR_STATUS);
620 /* Nothing to notice */
621 if (!notice) return (FALSE);
623 if (disturb_state) disturb(FALSE, FALSE);
629 * @brief 麻痺の継続時間をセットする / Set "p_ptr->paralyzed", notice observable changes
631 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
633 bool set_paralyzed(TIME_EFFECT v)
637 /* Hack -- Force good values */
638 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
640 if (p_ptr->is_dead) return FALSE;
645 if (!p_ptr->paralyzed)
647 msg_print(_("体が麻痺してしまった!", "You are paralyzed!"));
649 if (p_ptr->concent) reset_concentration(TRUE);
652 if (hex_spelling_any()) stop_hex_spell_all();
654 p_ptr->counter = FALSE;
662 if (p_ptr->paralyzed)
664 msg_print(_("やっと動けるようになった。", "You can move again."));
670 p_ptr->paralyzed = v;
672 /* Redraw status bar */
673 p_ptr->redraw |= (PR_STATUS);
675 /* Nothing to notice */
676 if (!notice) return (FALSE);
678 if (disturb_state) disturb(FALSE, FALSE);
680 /* Redraw the state */
681 p_ptr->redraw |= (PR_STATE);
687 * @brief 幻覚の継続時間をセットする / Set "p_ptr->image", notice observable changes
689 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
690 * @details Note that we must redraw the map when hallucination changes.
692 bool set_image(TIME_EFFECT v)
696 /* Hack -- Force good values */
697 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
699 if (p_ptr->is_dead) return FALSE;
700 if (p_ptr->pseikaku == SEIKAKU_CHARGEMAN) v = 0;
706 set_tsuyoshi(0, TRUE);
709 msg_print(_("ワーオ!何もかも虹色に見える!", "Oh, wow! Everything looks so cosmic now!"));
712 if (p_ptr->concent) reset_concentration(TRUE);
714 p_ptr->counter = FALSE;
724 msg_print(_("やっとはっきりと物が見えるようになった。", "You can see clearly again."));
732 /* Redraw status bar */
733 p_ptr->redraw |= (PR_STATUS);
735 /* Nothing to notice */
736 if (!notice) return (FALSE);
738 if (disturb_state) disturb(FALSE, TRUE);
740 p_ptr->redraw |= (PR_MAP);
742 /* Update the health bar */
743 p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH);
745 /* Update monsters */
746 p_ptr->update |= (PU_MONSTERS);
748 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
754 * @brief 加速の継続時間をセットする / Set "p_ptr->fast", notice observable changes
756 * @param do_dec 現在の継続時間より長い値のみ上書きする
757 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
759 bool set_fast(TIME_EFFECT v, bool do_dec)
763 /* Hack -- Force good values */
764 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
766 if (p_ptr->is_dead) return FALSE;
771 if (p_ptr->fast && !do_dec)
773 if (p_ptr->fast > v) return FALSE;
775 else if (!IS_FAST() && !p_ptr->lightspeed)
777 msg_print(_("素早く動けるようになった!", "You feel yourself moving much faster!"));
779 chg_virtue(V_PATIENCE, -1);
780 chg_virtue(V_DILIGENCE, 1);
787 if (p_ptr->fast && !p_ptr->lightspeed && !music_singing(MUSIC_SPEED) && !music_singing(MUSIC_SHERO))
789 msg_print(_("動きの素早さがなくなったようだ。", "You feel yourself slow down."));
797 /* Nothing to notice */
798 if (!notice) return (FALSE);
800 if (disturb_state) disturb(FALSE, FALSE);
802 /* Recalculate bonuses */
803 p_ptr->update |= (PU_BONUS);
809 * @brief 光速移動の継続時間をセットする / Set "p_ptr->lightspeed", notice observable changes
811 * @param do_dec 現在の継続時間より長い値のみ上書きする
812 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
814 bool set_lightspeed(TIME_EFFECT v, bool do_dec)
818 /* Hack -- Force good values */
819 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
821 if (p_ptr->is_dead) return FALSE;
823 if (p_ptr->wild_mode) v = 0;
828 if (p_ptr->lightspeed && !do_dec)
830 if (p_ptr->lightspeed > v) return FALSE;
832 else if (!p_ptr->lightspeed)
834 msg_print(_("非常に素早く動けるようになった!", "You feel yourself moving extremely faster!"));
836 chg_virtue(V_PATIENCE, -1);
837 chg_virtue(V_DILIGENCE, 1);
844 if (p_ptr->lightspeed)
846 msg_print(_("動きの素早さがなくなったようだ。", "You feel yourself slow down."));
852 p_ptr->lightspeed = v;
854 /* Nothing to notice */
855 if (!notice) return (FALSE);
857 if (disturb_state) disturb(FALSE, FALSE);
859 /* Recalculate bonuses */
860 p_ptr->update |= (PU_BONUS);
866 * @brief 減速の継続時間をセットする / Set "p_ptr->slow", notice observable changes
868 * @param do_dec 現在の継続時間より長い値のみ上書きする
869 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
871 bool set_slow(TIME_EFFECT v, bool do_dec)
875 /* Hack -- Force good values */
876 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
878 if (p_ptr->is_dead) return FALSE;
883 if (p_ptr->slow && !do_dec)
885 if (p_ptr->slow > v) return FALSE;
887 else if (!p_ptr->slow)
889 msg_print(_("体の動きが遅くなってしまった!", "You feel yourself moving slower!"));
899 msg_print(_("動きの遅さがなくなったようだ。", "You feel yourself speed up."));
907 /* Nothing to notice */
908 if (!notice) return (FALSE);
910 if (disturb_state) disturb(FALSE, FALSE);
912 /* Recalculate bonuses */
913 p_ptr->update |= (PU_BONUS);
920 * @brief 肌石化の継続時間をセットする / Set "p_ptr->shield", notice observable changes
922 * @param do_dec 現在の継続時間より長い値のみ上書きする
923 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
925 bool set_shield(TIME_EFFECT v, bool do_dec)
929 /* Hack -- Force good values */
930 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
932 if (p_ptr->is_dead) return FALSE;
937 if (p_ptr->shield && !do_dec)
939 if (p_ptr->shield > v) return FALSE;
941 else if (!p_ptr->shield)
943 msg_print(_("肌が石になった。", "Your skin turns to stone."));
953 msg_print(_("肌が元に戻った。", "Your skin returns to normal."));
961 /* Redraw status bar */
962 p_ptr->redraw |= (PR_STATUS);
964 /* Nothing to notice */
965 if (!notice) return (FALSE);
967 if (disturb_state) disturb(FALSE, FALSE);
969 /* Recalculate bonuses */
970 p_ptr->update |= (PU_BONUS);
977 * @brief つぶれるの継続時間をセットする / Set "p_ptr->tsubureru", notice observable changes
979 * @param do_dec 現在の継続時間より長い値のみ上書きする
980 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
982 bool set_tsubureru(TIME_EFFECT v, bool do_dec)
986 /* Hack -- Force good values */
987 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
989 if (p_ptr->is_dead) return FALSE;
994 if (p_ptr->tsubureru && !do_dec)
996 if (p_ptr->tsubureru > v) return FALSE;
998 else if (!p_ptr->tsubureru)
1000 msg_print(_("横に伸びた。", "Your body expands horizontally."));
1008 if (p_ptr->tsubureru)
1010 msg_print(_("もう横に伸びていない。", "Your body returns to normal."));
1016 p_ptr->tsubureru = v;
1018 /* Redraw status bar */
1019 p_ptr->redraw |= (PR_STATUS);
1021 /* Nothing to notice */
1022 if (!notice) return (FALSE);
1024 if (disturb_state) disturb(FALSE, FALSE);
1026 /* Recalculate bonuses */
1027 p_ptr->update |= (PU_BONUS);
1034 * @brief 魔法の鎧の継続時間をセットする / Set "p_ptr->magicdef", notice observable changes
1036 * @param do_dec 現在の継続時間より長い値のみ上書きする
1037 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1039 bool set_magicdef(TIME_EFFECT v, bool do_dec)
1041 bool notice = FALSE;
1043 /* Hack -- Force good values */
1044 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1046 if (p_ptr->is_dead) return FALSE;
1051 if (p_ptr->magicdef && !do_dec)
1053 if (p_ptr->magicdef > v) return FALSE;
1055 else if (!p_ptr->magicdef)
1057 msg_print(_("魔法の防御力が増したような気がする。", "You feel more resistant to magic."));
1065 if (p_ptr->magicdef)
1067 msg_print(_("魔法の防御力が元に戻った。", "You feel less resistant to magic."));
1073 p_ptr->magicdef = v;
1075 /* Redraw status bar */
1076 p_ptr->redraw |= (PR_STATUS);
1078 /* Nothing to notice */
1079 if (!notice) return (FALSE);
1081 if (disturb_state) disturb(FALSE, FALSE);
1083 /* Recalculate bonuses */
1084 p_ptr->update |= (PU_BONUS);
1090 * @brief 祝福の継続時間をセットする / Set "p_ptr->blessed", notice observable changes
1092 * @param do_dec 現在の継続時間より長い値のみ上書きする
1093 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1095 bool set_blessed(TIME_EFFECT v, bool do_dec)
1097 bool notice = FALSE;
1099 /* Hack -- Force good values */
1100 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1102 if (p_ptr->is_dead) return FALSE;
1107 if (p_ptr->blessed && !do_dec)
1109 if (p_ptr->blessed > v) return FALSE;
1111 else if (!IS_BLESSED())
1113 msg_print(_("高潔な気分になった!", "You feel righteous!"));
1121 if (p_ptr->blessed && !music_singing(MUSIC_BLESS))
1123 msg_print(_("高潔な気分が消え失せた。", "The prayer has expired."));
1131 /* Redraw status bar */
1132 p_ptr->redraw |= (PR_STATUS);
1134 /* Nothing to notice */
1135 if (!notice) return (FALSE);
1137 if (disturb_state) disturb(FALSE, FALSE);
1139 /* Recalculate bonuses */
1140 p_ptr->update |= (PU_BONUS);
1147 * @brief 士気高揚の継続時間をセットする / Set "p_ptr->hero", notice observable changes
1149 * @param do_dec 現在の継続時間より長い値のみ上書きする
1150 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1152 bool set_hero(TIME_EFFECT v, bool do_dec)
1154 bool notice = FALSE;
1156 /* Hack -- Force good values */
1157 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1159 if (p_ptr->is_dead) return FALSE;
1164 if (p_ptr->hero && !do_dec)
1166 if (p_ptr->hero > v) return FALSE;
1168 else if (!IS_HERO())
1170 msg_print(_("ヒーローになった気がする!", "You feel like a hero!"));
1178 if (p_ptr->hero && !music_singing(MUSIC_HERO) && !music_singing(MUSIC_SHERO))
1180 msg_print(_("ヒーローの気分が消え失せた。", "The heroism wears off."));
1188 /* Redraw status bar */
1189 p_ptr->redraw |= (PR_STATUS);
1191 /* Nothing to notice */
1192 if (!notice) return (FALSE);
1194 if (disturb_state) disturb(FALSE, FALSE);
1196 /* Recalculate bonuses */
1197 p_ptr->update |= (PU_BONUS);
1199 /* Recalculate hitpoints */
1200 p_ptr->update |= (PU_HP);
1206 * @brief 狂戦士化の継続時間をセットする / Set "p_ptr->shero", notice observable changes
1207 * @param v 継続時間/ 0ならば無条件にリセット
1208 * @param do_dec FALSEの場合現在の継続時間より長い値のみ上書きする
1209 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1211 bool set_shero(TIME_EFFECT v, bool do_dec)
1213 bool notice = FALSE;
1215 /* Hack -- Force good values */
1216 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1218 if (p_ptr->is_dead) return FALSE;
1220 if (p_ptr->pclass == CLASS_BERSERKER) v = 1;
1224 if (p_ptr->shero && !do_dec)
1226 if (p_ptr->shero > v) return FALSE;
1228 else if (!p_ptr->shero)
1230 msg_print(_("殺戮マシーンになった気がする!", "You feel like a killing machine!"));
1240 msg_print(_("野蛮な気持ちが消え失せた。", "You feel less Berserk."));
1248 /* Redraw status bar */
1249 p_ptr->redraw |= (PR_STATUS);
1251 /* Nothing to notice */
1252 if (!notice) return (FALSE);
1254 if (disturb_state) disturb(FALSE, FALSE);
1256 /* Recalculate bonuses */
1257 p_ptr->update |= (PU_BONUS);
1259 /* Recalculate hitpoints */
1260 p_ptr->update |= (PU_HP);
1266 * @brief 対邪悪結界の継続時間をセットする / Set "p_ptr->protevil", notice observable changes
1268 * @param do_dec 現在の継続時間より長い値のみ上書きする
1269 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1271 bool set_protevil(TIME_EFFECT v, bool do_dec)
1273 bool notice = FALSE;
1275 /* Hack -- Force good values */
1276 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1278 if (p_ptr->is_dead) return FALSE;
1283 if (p_ptr->protevil && !do_dec)
1285 if (p_ptr->protevil > v) return FALSE;
1287 else if (!p_ptr->protevil)
1289 msg_print(_("邪悪なる存在から守られているような感じがする!", "You feel safe from evil!"));
1297 if (p_ptr->protevil)
1299 msg_print(_("邪悪なる存在から守られている感じがなくなった。", "You no longer feel safe from evil."));
1305 p_ptr->protevil = v;
1307 /* Redraw status bar */
1308 p_ptr->redraw |= (PR_STATUS);
1310 /* Nothing to notice */
1311 if (!notice) return (FALSE);
1313 if (disturb_state) disturb(FALSE, FALSE);
1319 * @brief 幽体化の継続時間をセットする / Set "p_ptr->wraith_form", notice observable changes
1321 * @param do_dec 現在の継続時間より長い値のみ上書きする
1322 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1324 bool set_wraith_form(TIME_EFFECT v, bool do_dec)
1326 bool notice = FALSE;
1328 /* Hack -- Force good values */
1329 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1331 if (p_ptr->is_dead) return FALSE;
1336 if (p_ptr->wraith_form && !do_dec)
1338 if (p_ptr->wraith_form > v) return FALSE;
1340 else if (!p_ptr->wraith_form)
1342 msg_print(_("物質界を離れて幽鬼のような存在になった!", "You leave the physical world and turn into a wraith-being!"));
1344 chg_virtue(V_UNLIFE, 3);
1345 chg_virtue(V_HONOUR, -2);
1346 chg_virtue(V_SACRIFICE, -2);
1347 chg_virtue(V_VALOUR, -5);
1349 p_ptr->redraw |= (PR_MAP);
1351 /* Update monsters */
1352 p_ptr->update |= (PU_MONSTERS);
1354 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1361 if (p_ptr->wraith_form)
1363 msg_print(_("不透明になった感じがする。", "You feel opaque."));
1366 p_ptr->redraw |= (PR_MAP);
1368 /* Update monsters */
1369 p_ptr->update |= (PU_MONSTERS);
1371 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1376 p_ptr->wraith_form = v;
1378 /* Redraw status bar */
1379 p_ptr->redraw |= (PR_STATUS);
1381 /* Nothing to notice */
1382 if (!notice) return (FALSE);
1384 if (disturb_state) disturb(FALSE, FALSE);
1386 /* Recalculate bonuses */
1387 p_ptr->update |= (PU_BONUS);
1394 * @brief 無傷球の継続時間をセットする / Set "p_ptr->invuln", notice observable changes
1396 * @param do_dec 現在の継続時間より長い値のみ上書きする
1397 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1399 bool set_invuln(TIME_EFFECT v, bool do_dec)
1401 bool notice = FALSE;
1403 /* Hack -- Force good values */
1404 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1406 if (p_ptr->is_dead) return FALSE;
1411 if (p_ptr->invuln && !do_dec)
1413 if (p_ptr->invuln > v) return FALSE;
1415 else if (!IS_INVULN())
1417 msg_print(_("無敵だ!", "Invulnerability!"));
1420 chg_virtue(V_UNLIFE, -2);
1421 chg_virtue(V_HONOUR, -2);
1422 chg_virtue(V_SACRIFICE, -3);
1423 chg_virtue(V_VALOUR, -5);
1425 p_ptr->redraw |= (PR_MAP);
1427 /* Update monsters */
1428 p_ptr->update |= (PU_MONSTERS);
1430 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1437 if (p_ptr->invuln && !music_singing(MUSIC_INVULN))
1439 msg_print(_("無敵ではなくなった。", "The invulnerability wears off."));
1442 p_ptr->redraw |= (PR_MAP);
1444 /* Update monsters */
1445 p_ptr->update |= (PU_MONSTERS);
1447 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1449 p_ptr->energy_need += ENERGY_NEED();
1456 /* Redraw status bar */
1457 p_ptr->redraw |= (PR_STATUS);
1459 /* Nothing to notice */
1460 if (!notice) return (FALSE);
1462 if (disturb_state) disturb(FALSE, FALSE);
1464 /* Recalculate bonuses */
1465 p_ptr->update |= (PU_BONUS);
1471 * @brief 時限ESPの継続時間をセットする / Set "p_ptr->tim_esp", notice observable changes
1473 * @param do_dec 現在の継続時間より長い値のみ上書きする
1474 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1476 bool set_tim_esp(TIME_EFFECT v, bool do_dec)
1478 bool notice = FALSE;
1480 /* Hack -- Force good values */
1481 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1483 if (p_ptr->is_dead) return FALSE;
1488 if (p_ptr->tim_esp && !do_dec)
1490 if (p_ptr->tim_esp > v) return FALSE;
1492 else if (!IS_TIM_ESP())
1494 msg_print(_("意識が広がった気がする!", "You feel your consciousness expand!"));
1502 if (p_ptr->tim_esp && !music_singing(MUSIC_MIND))
1504 msg_print(_("意識は元に戻った。", "Your consciousness contracts again."));
1512 /* Redraw status bar */
1513 p_ptr->redraw |= (PR_STATUS);
1515 /* Nothing to notice */
1516 if (!notice) return (FALSE);
1518 if (disturb_state) disturb(FALSE, FALSE);
1520 /* Recalculate bonuses */
1521 p_ptr->update |= (PU_BONUS);
1522 p_ptr->update |= (PU_MONSTERS);
1528 * @brief 時限透明視の継続時間をセットする / Set "p_ptr->tim_invis", notice observable changes
1530 * @param do_dec 現在の継続時間より長い値のみ上書きする
1531 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1533 bool set_tim_invis(TIME_EFFECT v, bool do_dec)
1535 bool notice = FALSE;
1537 /* Hack -- Force good values */
1538 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1540 if (p_ptr->is_dead) return FALSE;
1545 if (p_ptr->tim_invis && !do_dec)
1547 if (p_ptr->tim_invis > v) return FALSE;
1549 else if (!p_ptr->tim_invis)
1551 msg_print(_("目が非常に敏感になった気がする!", "Your eyes feel very sensitive!"));
1559 if (p_ptr->tim_invis)
1561 msg_print(_("目の敏感さがなくなったようだ。", "Your eyes feel less sensitive."));
1567 p_ptr->tim_invis = v;
1569 /* Redraw status bar */
1570 p_ptr->redraw |= (PR_STATUS);
1572 /* Nothing to notice */
1573 if (!notice) return (FALSE);
1575 if (disturb_state) disturb(FALSE, FALSE);
1577 /* Recalculate bonuses */
1578 p_ptr->update |= (PU_BONUS);
1580 /* Update the monsters */
1581 p_ptr->update |= (PU_MONSTERS);
1587 * @brief 時限赤外線視力の継続時間をセットする / Set "p_ptr->tim_infra", notice observable changes
1589 * @param do_dec 現在の継続時間より長い値のみ上書きする
1590 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1592 bool set_tim_infra(TIME_EFFECT v, bool do_dec)
1594 bool notice = FALSE;
1596 /* Hack -- Force good values */
1597 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1599 if (p_ptr->is_dead) return FALSE;
1604 if (p_ptr->tim_infra && !do_dec)
1606 if (p_ptr->tim_infra > v) return FALSE;
1608 else if (!p_ptr->tim_infra)
1610 msg_print(_("目がランランと輝き始めた!", "Your eyes begin to tingle!"));
1618 if (p_ptr->tim_infra)
1620 msg_print(_("目の輝きがなくなった。", "Your eyes stop tingling."));
1626 p_ptr->tim_infra = v;
1628 /* Redraw status bar */
1629 p_ptr->redraw |= (PR_STATUS);
1631 /* Nothing to notice */
1632 if (!notice) return (FALSE);
1634 if (disturb_state) disturb(FALSE, FALSE);
1636 /* Recalculate bonuses */
1637 p_ptr->update |= (PU_BONUS);
1639 /* Update the monsters */
1640 p_ptr->update |= (PU_MONSTERS);
1646 * @brief 時限急回復の継続時間をセットする / Set "p_ptr->tim_regen", notice observable changes
1648 * @param do_dec 現在の継続時間より長い値のみ上書きする
1649 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1651 bool set_tim_regen(TIME_EFFECT v, bool do_dec)
1653 bool notice = FALSE;
1655 /* Hack -- Force good values */
1656 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1658 if (p_ptr->is_dead) return FALSE;
1663 if (p_ptr->tim_regen && !do_dec)
1665 if (p_ptr->tim_regen > v) return FALSE;
1667 else if (!p_ptr->tim_regen)
1669 msg_print(_("回復力が上がった!", "You feel yourself regenerating quickly!"));
1677 if (p_ptr->tim_regen)
1679 msg_print(_("素早く回復する感じがなくなった。", "You feel yourself regenerating slowly."));
1685 p_ptr->tim_regen = v;
1687 /* Redraw status bar */
1688 p_ptr->redraw |= (PR_STATUS);
1690 /* Nothing to notice */
1691 if (!notice) return (FALSE);
1693 if (disturb_state) disturb(FALSE, FALSE);
1695 /* Recalculate bonuses */
1696 p_ptr->update |= (PU_BONUS);
1702 * @brief 隠密の歌の継続時間をセットする / Set "p_ptr->tim_stealth", notice observable changes
1704 * @param do_dec 現在の継続時間より長い値のみ上書きする
1705 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1707 bool set_tim_stealth(TIME_EFFECT v, bool do_dec)
1709 bool notice = FALSE;
1711 /* Hack -- Force good values */
1712 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1714 if (p_ptr->is_dead) return FALSE;
1719 if (p_ptr->tim_stealth && !do_dec)
1721 if (p_ptr->tim_stealth > v) return FALSE;
1723 else if (!IS_TIM_STEALTH())
1725 msg_print(_("足音が小さくなった!", "You begin to walk silently!"));
1733 if (p_ptr->tim_stealth && !music_singing(MUSIC_STEALTH))
1735 msg_print(_("足音が大きくなった。", "You no longer walk silently."));
1741 p_ptr->tim_stealth = v;
1743 /* Redraw status bar */
1744 p_ptr->redraw |= (PR_STATUS);
1746 /* Nothing to notice */
1747 if (!notice) return (FALSE);
1749 if (disturb_state) disturb(FALSE, FALSE);
1751 /* Recalculate bonuses */
1752 p_ptr->update |= (PU_BONUS);
1758 * @brief 超隠密状態をセットする
1759 * @param set TRUEならば超隠密状態になる。
1760 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1762 bool set_superstealth(bool set)
1764 bool notice = FALSE;
1766 if (p_ptr->is_dead) return FALSE;
1771 if (!(p_ptr->special_defense & NINJA_S_STEALTH))
1773 if (cave[p_ptr->y][p_ptr->x].info & CAVE_MNLT)
1775 msg_print(_("敵の目から薄い影の中に覆い隠された。", "You are mantled in weak shadow from ordinary eyes."));
1776 p_ptr->monlite = p_ptr->old_monlite = TRUE;
1780 msg_print(_("敵の目から影の中に覆い隠された!", "You are mantled in shadow from ordinary eyes!"));
1781 p_ptr->monlite = p_ptr->old_monlite = FALSE;
1787 p_ptr->special_defense |= NINJA_S_STEALTH;
1794 if (p_ptr->special_defense & NINJA_S_STEALTH)
1796 msg_print(_("再び敵の目にさらされるようになった。", "You are exposed to common sight once more."));
1800 p_ptr->special_defense &= ~(NINJA_S_STEALTH);
1804 /* Nothing to notice */
1805 if (!notice) return (FALSE);
1807 /* Redraw status bar */
1808 p_ptr->redraw |= (PR_STATUS);
1810 if (disturb_state) disturb(FALSE, FALSE);
1815 * @brief 一時的浮遊の継続時間をセットする / Set "p_ptr->tim_levitation", notice observable changes
1817 * @param do_dec 現在の継続時間より長い値のみ上書きする
1818 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1820 bool set_tim_levitation(TIME_EFFECT v, bool do_dec)
1822 bool notice = FALSE;
1824 /* Hack -- Force good values */
1825 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1827 if (p_ptr->is_dead) return FALSE;
1832 if (p_ptr->tim_levitation && !do_dec)
1834 if (p_ptr->tim_levitation > v) return FALSE;
1836 else if (!p_ptr->tim_levitation)
1838 msg_print(_("体が宙に浮き始めた。", "You begin to fly!"));
1846 if (p_ptr->tim_levitation)
1848 msg_print(_("もう宙に浮かべなくなった。", "You stop flying."));
1854 p_ptr->tim_levitation = v;
1856 /* Redraw status bar */
1857 p_ptr->redraw |= (PR_STATUS);
1859 /* Nothing to notice */
1860 if (!notice) return (FALSE);
1862 if (disturb_state) disturb(FALSE, FALSE);
1864 /* Recalculate bonuses */
1865 p_ptr->update |= (PU_BONUS);
1871 * @brief 一時的闘気のオーラの継続時間をセットする / Set "p_ptr->tim_sh_touki", notice observable changes
1873 * @param do_dec 現在の継続時間より長い値のみ上書きする
1874 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1876 bool set_tim_sh_touki(TIME_EFFECT v, bool do_dec)
1878 bool notice = FALSE;
1880 /* Hack -- Force good values */
1881 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1883 if (p_ptr->is_dead) return FALSE;
1888 if (p_ptr->tim_sh_touki && !do_dec)
1890 if (p_ptr->tim_sh_touki > v) return FALSE;
1892 else if (!p_ptr->tim_sh_touki)
1894 msg_print(_("体が闘気のオーラで覆われた。", "You have enveloped by the aura of the Force!"));
1902 if (p_ptr->tim_sh_touki)
1904 msg_print(_("闘気が消えた。", "Aura of the Force disappeared."));
1910 p_ptr->tim_sh_touki = v;
1912 /* Redraw status bar */
1913 p_ptr->redraw |= (PR_STATUS);
1915 /* Nothing to notice */
1916 if (!notice) return (FALSE);
1918 if (disturb_state) disturb(FALSE, FALSE);
1924 * @brief 一時的火炎のオーラの継続時間をセットする / Set "p_ptr->tim_sh_fire", notice observable changes
1926 * @param do_dec 現在の継続時間より長い値のみ上書きする
1927 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1929 bool set_tim_sh_fire(TIME_EFFECT v, bool do_dec)
1931 bool notice = FALSE;
1933 /* Hack -- Force good values */
1934 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1936 if (p_ptr->is_dead) return FALSE;
1941 if (p_ptr->tim_sh_fire && !do_dec)
1943 if (p_ptr->tim_sh_fire > v) return FALSE;
1945 else if (!p_ptr->tim_sh_fire)
1947 msg_print(_("体が炎のオーラで覆われた。", "You have enveloped by fiery aura!"));
1955 if (p_ptr->tim_sh_fire)
1957 msg_print(_("炎のオーラが消えた。", "Fiery aura disappeared."));
1963 p_ptr->tim_sh_fire = v;
1965 /* Redraw status bar */
1966 p_ptr->redraw |= (PR_STATUS);
1968 /* Nothing to notice */
1969 if (!notice) return (FALSE);
1971 if (disturb_state) disturb(FALSE, FALSE);
1973 /* Recalculate bonuses */
1974 p_ptr->update |= (PU_BONUS);
1980 * @brief 一時的聖なるのオーラの継続時間をセットする / Set "p_ptr->tim_sh_holy", notice observable changes
1982 * @param do_dec 現在の継続時間より長い値のみ上書きする
1983 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1985 bool set_tim_sh_holy(TIME_EFFECT v, bool do_dec)
1987 bool notice = FALSE;
1989 /* Hack -- Force good values */
1990 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1992 if (p_ptr->is_dead) return FALSE;
1997 if (p_ptr->tim_sh_holy && !do_dec)
1999 if (p_ptr->tim_sh_holy > v) return FALSE;
2001 else if (!p_ptr->tim_sh_holy)
2003 msg_print(_("体が聖なるオーラで覆われた。", "You have enveloped by holy aura!"));
2011 if (p_ptr->tim_sh_holy)
2013 msg_print(_("聖なるオーラが消えた。", "Holy aura disappeared."));
2019 p_ptr->tim_sh_holy = v;
2021 /* Redraw status bar */
2022 p_ptr->redraw |= (PR_STATUS);
2024 /* Nothing to notice */
2025 if (!notice) return (FALSE);
2027 if (disturb_state) disturb(FALSE, FALSE);
2029 /* Recalculate bonuses */
2030 p_ptr->update |= (PU_BONUS);
2036 * @brief 目には目をの残り時間をセットする / Set "p_ptr->tim_eyeeye", notice observable changes
2038 * @param do_dec 現在の継続時間より長い値のみ上書きする
2039 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2041 bool set_tim_eyeeye(TIME_EFFECT v, bool do_dec)
2043 bool notice = FALSE;
2045 /* Hack -- Force good values */
2046 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2048 if (p_ptr->is_dead) return FALSE;
2053 if (p_ptr->tim_eyeeye && !do_dec)
2055 if (p_ptr->tim_eyeeye > v) return FALSE;
2057 else if (!p_ptr->tim_eyeeye)
2059 msg_print(_("法の守り手になった気がした!", "You feel like a keeper of commandments!"));
2067 if (p_ptr->tim_eyeeye)
2069 msg_print(_("懲罰を執行することができなくなった。", "You no longer feel like a keeper."));
2075 p_ptr->tim_eyeeye = v;
2077 /* Redraw status bar */
2078 p_ptr->redraw |= (PR_STATUS);
2080 /* Nothing to notice */
2081 if (!notice) return (FALSE);
2083 if (disturb_state) disturb(FALSE, FALSE);
2085 /* Recalculate bonuses */
2086 p_ptr->update |= (PU_BONUS);
2093 * @brief 一時的魔法防御の継続時間をセットする / Set "p_ptr->resist_magic", notice observable changes
2095 * @param do_dec 現在の継続時間より長い値のみ上書きする
2096 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2098 bool set_resist_magic(TIME_EFFECT v, bool do_dec)
2100 bool notice = FALSE;
2102 /* Hack -- Force good values */
2103 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2105 if (p_ptr->is_dead) return FALSE;
2110 if (p_ptr->resist_magic && !do_dec)
2112 if (p_ptr->resist_magic > v) return FALSE;
2114 else if (!p_ptr->resist_magic)
2116 msg_print(_("魔法への耐性がついた。", "You have been protected from magic!"));
2124 if (p_ptr->resist_magic)
2126 msg_print(_("魔法に弱くなった。", "You are no longer protected from magic."));
2132 p_ptr->resist_magic = v;
2134 /* Redraw status bar */
2135 p_ptr->redraw |= (PR_STATUS);
2137 /* Nothing to notice */
2138 if (!notice) return (FALSE);
2140 if (disturb_state) disturb(FALSE, FALSE);
2142 /* Recalculate bonuses */
2143 p_ptr->update |= (PU_BONUS);
2149 * @brief 一時的反射の継続時間をセットする / Set "p_ptr->tim_reflect", notice observable changes
2151 * @param do_dec 現在の継続時間より長い値のみ上書きする
2152 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2154 bool set_tim_reflect(TIME_EFFECT v, bool do_dec)
2156 bool notice = FALSE;
2158 /* Hack -- Force good values */
2159 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2161 if (p_ptr->is_dead) return FALSE;
2166 if (p_ptr->tim_reflect && !do_dec)
2168 if (p_ptr->tim_reflect > v) return FALSE;
2170 else if (!p_ptr->tim_reflect)
2172 msg_print(_("体の表面が滑かになった気がする。", "Your body becames smooth."));
2180 if (p_ptr->tim_reflect)
2182 msg_print(_("体の表面が滑かでなくなった。", "Your body is no longer smooth."));
2188 p_ptr->tim_reflect = v;
2190 /* Redraw status bar */
2191 p_ptr->redraw |= (PR_STATUS);
2193 /* Nothing to notice */
2194 if (!notice) return (FALSE);
2196 if (disturb_state) disturb(FALSE, FALSE);
2198 /* Recalculate bonuses */
2199 p_ptr->update |= (PU_BONUS);
2206 * Set "p_ptr->multishadow", notice observable changes
2208 bool set_multishadow(TIME_EFFECT v, bool do_dec)
2210 bool notice = FALSE;
2212 /* Hack -- Force good values */
2213 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2215 if (p_ptr->is_dead) return FALSE;
2220 if (p_ptr->multishadow && !do_dec)
2222 if (p_ptr->multishadow > v) return FALSE;
2224 else if (!p_ptr->multishadow)
2226 msg_print(_("あなたの周りに幻影が生まれた。", "Your Shadow enveloped you."));
2234 if (p_ptr->multishadow)
2236 msg_print(_("幻影が消えた。", "Your Shadow disappears."));
2242 p_ptr->multishadow = v;
2244 /* Redraw status bar */
2245 p_ptr->redraw |= (PR_STATUS);
2247 /* Nothing to notice */
2248 if (!notice) return (FALSE);
2250 if (disturb_state) disturb(FALSE, FALSE);
2252 /* Recalculate bonuses */
2253 p_ptr->update |= (PU_BONUS);
2259 * @brief 一時的破片のオーラの継続時間をセットする / Set "p_ptr->dustrobe", notice observable changes
2261 * @param do_dec 現在の継続時間より長い値のみ上書きする
2262 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2264 bool set_dustrobe(TIME_EFFECT v, bool do_dec)
2266 bool notice = FALSE;
2268 /* Hack -- Force good values */
2269 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2271 if (p_ptr->is_dead) return FALSE;
2276 if (p_ptr->dustrobe && !do_dec)
2278 if (p_ptr->dustrobe > v) return FALSE;
2280 else if (!p_ptr->dustrobe)
2282 msg_print(_("体が鏡のオーラで覆われた。", "You were enveloped by mirror shards."));
2290 if (p_ptr->dustrobe)
2292 msg_print(_("鏡のオーラが消えた。", "The mirror shards disappear."));
2298 p_ptr->dustrobe = v;
2300 /* Redraw status bar */
2301 p_ptr->redraw |= (PR_STATUS);
2303 /* Nothing to notice */
2304 if (!notice) return (FALSE);
2306 if (disturb_state) disturb(FALSE, FALSE);
2308 /* Recalculate bonuses */
2309 p_ptr->update |= (PU_BONUS);
2315 * @brief 一時的壁抜けの継続時間をセットする / Set "p_ptr->kabenuke", notice observable changes
2317 * @param do_dec 現在の継続時間より長い値のみ上書きする
2318 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2320 bool set_kabenuke(TIME_EFFECT v, bool do_dec)
2322 bool notice = FALSE;
2324 /* Hack -- Force good values */
2325 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2327 if (p_ptr->is_dead) return FALSE;
2332 if (p_ptr->kabenuke && !do_dec)
2334 if (p_ptr->kabenuke > v) return FALSE;
2336 else if (!p_ptr->kabenuke)
2338 msg_print(_("体が半物質の状態になった。", "You became ethereal form."));
2346 if (p_ptr->kabenuke)
2348 msg_print(_("体が物質化した。", "You are no longer in an ethereal form."));
2354 p_ptr->kabenuke = v;
2356 /* Redraw status bar */
2357 p_ptr->redraw |= (PR_STATUS);
2359 /* Nothing to notice */
2360 if (!notice) return (FALSE);
2362 if (disturb_state) disturb(FALSE, FALSE);
2364 /* Recalculate bonuses */
2365 p_ptr->update |= (PU_BONUS);
2371 * @brief オクレ兄さんの継続時間をセットする / Set "p_ptr->tsuyoshi", notice observable changes
2373 * @param do_dec 現在の継続時間より長い値のみ上書きする
2374 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2376 bool set_tsuyoshi(TIME_EFFECT v, bool do_dec)
2378 bool notice = FALSE;
2380 /* Hack -- Force good values */
2381 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2383 if (p_ptr->is_dead) return FALSE;
2388 if (p_ptr->tsuyoshi && !do_dec)
2390 if (p_ptr->tsuyoshi > v) return FALSE;
2392 else if (!p_ptr->tsuyoshi)
2394 msg_print(_("「オクレ兄さん!」", "Brother OKURE!"));
2396 chg_virtue(V_VITALITY, 2);
2403 if (p_ptr->tsuyoshi)
2405 msg_print(_("肉体が急速にしぼんでいった。", "Your body had quickly shriveled."));
2407 (void)dec_stat(A_CON, 20, TRUE);
2408 (void)dec_stat(A_STR, 20, TRUE);
2411 chg_virtue(V_VITALITY, -3);
2416 p_ptr->tsuyoshi = v;
2418 /* Redraw status bar */
2419 p_ptr->redraw |= (PR_STATUS);
2421 /* Nothing to notice */
2422 if (!notice) return (FALSE);
2424 if (disturb_state) disturb(FALSE, FALSE);
2426 /* Recalculate bonuses */
2427 p_ptr->update |= (PU_BONUS);
2429 /* Recalculate hitpoints */
2430 p_ptr->update |= (PU_HP);
2436 * @brief 一時的元素スレイの継続時間をセットする / Set a temporary elemental brand. Clear all other brands. Print status messages. -LM-
2437 * @param attack_type スレイのタイプID
2439 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2441 bool set_ele_attack(u32b attack_type, TIME_EFFECT v)
2443 /* Hack -- Force good values */
2444 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2446 /* Clear all elemental attacks (only one is allowed at a time). */
2447 if ((p_ptr->special_attack & (ATTACK_ACID)) && (attack_type != ATTACK_ACID))
2449 p_ptr->special_attack &= ~(ATTACK_ACID);
2450 msg_print(_("酸で攻撃できなくなった。", "Your temporary acidic brand fades away."));
2452 if ((p_ptr->special_attack & (ATTACK_ELEC)) && (attack_type != ATTACK_ELEC))
2454 p_ptr->special_attack &= ~(ATTACK_ELEC);
2455 msg_print(_("電撃で攻撃できなくなった。", "Your temporary electrical brand fades away."));
2457 if ((p_ptr->special_attack & (ATTACK_FIRE)) && (attack_type != ATTACK_FIRE))
2459 p_ptr->special_attack &= ~(ATTACK_FIRE);
2460 msg_print(_("火炎で攻撃できなくなった。", "Your temporary fiery brand fades away."));
2462 if ((p_ptr->special_attack & (ATTACK_COLD)) && (attack_type != ATTACK_COLD))
2464 p_ptr->special_attack &= ~(ATTACK_COLD);
2465 msg_print(_("冷気で攻撃できなくなった。", "Your temporary frost brand fades away."));
2467 if ((p_ptr->special_attack & (ATTACK_POIS)) && (attack_type != ATTACK_POIS))
2469 p_ptr->special_attack &= ~(ATTACK_POIS);
2470 msg_print(_("毒で攻撃できなくなった。", "Your temporary poison brand fades away."));
2473 if ((v) && (attack_type))
2475 /* Set attack type. */
2476 p_ptr->special_attack |= (attack_type);
2479 p_ptr->ele_attack = v;
2483 msg_format("%sで攻撃できるようになった!",
2484 ((attack_type == ATTACK_ACID) ? "酸" :
2485 ((attack_type == ATTACK_ELEC) ? "電撃" :
2486 ((attack_type == ATTACK_FIRE) ? "火炎" :
2487 ((attack_type == ATTACK_COLD) ? "冷気" :
2488 ((attack_type == ATTACK_POIS) ? "毒" :
2491 msg_format("For a while, the blows you deal will %s",
2492 ((attack_type == ATTACK_ACID) ? "melt with acid!" :
2493 ((attack_type == ATTACK_ELEC) ? "shock your foes!" :
2494 ((attack_type == ATTACK_FIRE) ? "burn with fire!" :
2495 ((attack_type == ATTACK_COLD) ? "chill to the bone!" :
2496 ((attack_type == ATTACK_POIS) ? "poison your enemies!" :
2497 "do nothing special."))))));
2501 if (disturb_state) disturb(FALSE, FALSE);
2503 /* Redraw status bar */
2504 p_ptr->redraw |= (PR_STATUS);
2506 p_ptr->update |= (PU_BONUS);
2513 * @brief 一時的元素免疫の継続時間をセットする / Set a temporary elemental brand. Clear all other brands. Print status messages. -LM-
2514 * @param immune_type 免疫のタイプID
2516 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2518 bool set_ele_immune(u32b immune_type, TIME_EFFECT v)
2520 /* Hack -- Force good values */
2521 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2523 /* Clear all elemental attacks (only one is allowed at a time). */
2524 if ((p_ptr->special_defense & (DEFENSE_ACID)) && (immune_type != DEFENSE_ACID))
2526 p_ptr->special_defense &= ~(DEFENSE_ACID);
2527 msg_print(_("酸の攻撃で傷つけられるようになった。。", "You are no longer immune to acid."));
2529 if ((p_ptr->special_defense & (DEFENSE_ELEC)) && (immune_type != DEFENSE_ELEC))
2531 p_ptr->special_defense &= ~(DEFENSE_ELEC);
2532 msg_print(_("電撃の攻撃で傷つけられるようになった。。", "You are no longer immune to electricity."));
2534 if ((p_ptr->special_defense & (DEFENSE_FIRE)) && (immune_type != DEFENSE_FIRE))
2536 p_ptr->special_defense &= ~(DEFENSE_FIRE);
2537 msg_print(_("火炎の攻撃で傷つけられるようになった。。", "You are no longer immune to fire."));
2539 if ((p_ptr->special_defense & (DEFENSE_COLD)) && (immune_type != DEFENSE_COLD))
2541 p_ptr->special_defense &= ~(DEFENSE_COLD);
2542 msg_print(_("冷気の攻撃で傷つけられるようになった。。", "You are no longer immune to cold."));
2544 if ((p_ptr->special_defense & (DEFENSE_POIS)) && (immune_type != DEFENSE_POIS))
2546 p_ptr->special_defense &= ~(DEFENSE_POIS);
2547 msg_print(_("毒の攻撃で傷つけられるようになった。。", "You are no longer immune to poison."));
2550 if ((v) && (immune_type))
2552 /* Set attack type. */
2553 p_ptr->special_defense |= (immune_type);
2556 p_ptr->ele_immune = v;
2560 msg_format("%sの攻撃を受けつけなくなった!",
2561 ((immune_type == DEFENSE_ACID) ? "酸" :
2562 ((immune_type == DEFENSE_ELEC) ? "電撃" :
2563 ((immune_type == DEFENSE_FIRE) ? "火炎" :
2564 ((immune_type == DEFENSE_COLD) ? "冷気" :
2565 ((immune_type == DEFENSE_POIS) ? "毒" :
2568 msg_format("For a while, You are immune to %s",
2569 ((immune_type == DEFENSE_ACID) ? "acid!" :
2570 ((immune_type == DEFENSE_ELEC) ? "electricity!" :
2571 ((immune_type == DEFENSE_FIRE) ? "fire!" :
2572 ((immune_type == DEFENSE_COLD) ? "cold!" :
2573 ((immune_type == DEFENSE_POIS) ? "poison!" :
2574 "do nothing special."))))));
2578 if (disturb_state) disturb(FALSE, FALSE);
2580 /* Redraw status bar */
2581 p_ptr->redraw |= (PR_STATUS);
2583 p_ptr->update |= (PU_BONUS);
2590 * @brief 一時的酸耐性の継続時間をセットする / Set "p_ptr->oppose_acid", notice observable changes
2592 * @param do_dec 現在の継続時間より長い値のみ上書きする
2593 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2595 bool set_oppose_acid(TIME_EFFECT v, bool do_dec)
2597 bool notice = FALSE;
2599 /* Hack -- Force good values */
2600 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2602 if (p_ptr->is_dead) return FALSE;
2607 if (p_ptr->oppose_acid && !do_dec)
2609 if (p_ptr->oppose_acid > v) return FALSE;
2611 else if (!IS_OPPOSE_ACID())
2613 msg_print(_("酸への耐性がついた気がする!", "You feel resistant to acid!"));
2621 if (p_ptr->oppose_acid && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
2623 msg_print(_("酸への耐性が薄れた気がする。", "You feel less resistant to acid."));
2629 p_ptr->oppose_acid = v;
2631 /* Nothing to notice */
2632 if (!notice) return (FALSE);
2634 /* Redraw status bar */
2635 p_ptr->redraw |= (PR_STATUS);
2637 if (disturb_state) disturb(FALSE, FALSE);
2643 * @brief 一時的電撃耐性の継続時間をセットする / Set "p_ptr->oppose_elec", notice observable changes
2645 * @param do_dec 現在の継続時間より長い値のみ上書きする
2646 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2648 bool set_oppose_elec(TIME_EFFECT v, bool do_dec)
2650 bool notice = FALSE;
2652 /* Hack -- Force good values */
2653 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2655 if (p_ptr->is_dead) return FALSE;
2660 if (p_ptr->oppose_elec && !do_dec)
2662 if (p_ptr->oppose_elec > v) return FALSE;
2664 else if (!IS_OPPOSE_ELEC())
2666 msg_print(_("電撃への耐性がついた気がする!", "You feel resistant to electricity!"));
2674 if (p_ptr->oppose_elec && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
2676 msg_print(_("電撃への耐性が薄れた気がする。", "You feel less resistant to electricity."));
2682 p_ptr->oppose_elec = v;
2684 /* Nothing to notice */
2685 if (!notice) return (FALSE);
2687 /* Redraw status bar */
2688 p_ptr->redraw |= (PR_STATUS);
2690 if (disturb_state) disturb(FALSE, FALSE);
2696 * @brief 一時的火炎耐性の継続時間をセットする / Set "p_ptr->oppose_fire", notice observable changes
2698 * @param do_dec 現在の継続時間より長い値のみ上書きする
2699 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2701 bool set_oppose_fire(TIME_EFFECT v, bool do_dec)
2703 bool notice = FALSE;
2705 /* Hack -- Force good values */
2706 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2708 if (p_ptr->is_dead) return FALSE;
2710 if ((prace_is_(RACE_DEMON) && (p_ptr->lev > 44)) || (p_ptr->mimic_form == MIMIC_DEMON)) v = 1;
2714 if (p_ptr->oppose_fire && !do_dec)
2716 if (p_ptr->oppose_fire > v) return FALSE;
2718 else if (!IS_OPPOSE_FIRE())
2720 msg_print(_("火への耐性がついた気がする!", "You feel resistant to fire!"));
2728 if (p_ptr->oppose_fire && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
2730 msg_print(_("火への耐性が薄れた気がする。", "You feel less resistant to fire."));
2736 p_ptr->oppose_fire = v;
2738 /* Nothing to notice */
2739 if (!notice) return (FALSE);
2741 /* Redraw status bar */
2742 p_ptr->redraw |= (PR_STATUS);
2744 if (disturb_state) disturb(FALSE, FALSE);
2750 * @brief 一時的冷気耐性の継続時間をセットする / Set "p_ptr->oppose_cold", notice observable changes
2752 * @param do_dec 現在の継続時間より長い値のみ上書きする
2753 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2755 bool set_oppose_cold(TIME_EFFECT v, bool do_dec)
2757 bool notice = FALSE;
2759 /* Hack -- Force good values */
2760 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2762 if (p_ptr->is_dead) return FALSE;
2767 if (p_ptr->oppose_cold && !do_dec)
2769 if (p_ptr->oppose_cold > v) return FALSE;
2771 else if (!IS_OPPOSE_COLD())
2773 msg_print(_("冷気への耐性がついた気がする!", "You feel resistant to cold!"));
2781 if (p_ptr->oppose_cold && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
2783 msg_print(_("冷気への耐性が薄れた気がする。", "You feel less resistant to cold."));
2789 p_ptr->oppose_cold = v;
2791 /* Nothing to notice */
2792 if (!notice) return (FALSE);
2794 /* Redraw status bar */
2795 p_ptr->redraw |= (PR_STATUS);
2797 if (disturb_state) disturb(FALSE, FALSE);
2803 * @brief 一時的毒耐性の継続時間をセットする / Set "p_ptr->oppose_pois", notice observable changes
2805 * @param do_dec 現在の継続時間より長い値のみ上書きする
2806 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2808 bool set_oppose_pois(TIME_EFFECT v, bool do_dec)
2810 bool notice = FALSE;
2812 /* Hack -- Force good values */
2813 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2815 if ((p_ptr->pclass == CLASS_NINJA) && (p_ptr->lev > 44)) v = 1;
2816 if (p_ptr->is_dead) return FALSE;
2821 if (p_ptr->oppose_pois && !do_dec)
2823 if (p_ptr->oppose_pois > v) return FALSE;
2825 else if (!IS_OPPOSE_POIS())
2827 msg_print(_("毒への耐性がついた気がする!", "You feel resistant to poison!"));
2835 if (p_ptr->oppose_pois && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
2837 msg_print(_("毒への耐性が薄れた気がする。", "You feel less resistant to poison."));
2843 p_ptr->oppose_pois = v;
2845 /* Nothing to notice */
2846 if (!notice) return (FALSE);
2848 /* Redraw status bar */
2849 p_ptr->redraw |= (PR_STATUS);
2851 if (disturb_state) disturb(FALSE, FALSE);
2857 * @brief 朦朧の継続時間をセットする / Set "p_ptr->stun", notice observable changes
2859 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2861 * Note the special code to only notice "range" changes.
2863 bool set_stun(TIME_EFFECT v)
2865 int old_aux, new_aux;
2866 bool notice = FALSE;
2869 /* Hack -- Force good values */
2870 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2872 if (p_ptr->is_dead) return FALSE;
2874 if (prace_is_(RACE_GOLEM) || ((p_ptr->pclass == CLASS_BERSERKER) && (p_ptr->lev > 34))) v = 0;
2877 if (p_ptr->stun > 100)
2883 else if (p_ptr->stun > 50)
2889 else if (p_ptr->stun > 0)
2925 if (new_aux > old_aux)
2927 /* Describe the state */
2931 case 1: msg_print(_("意識がもうろうとしてきた。", "You have been stunned.")); break;
2934 case 2: msg_print(_("意識がひどくもうろうとしてきた。", "You have been heavily stunned.")); break;
2937 case 3: msg_print(_("頭がクラクラして意識が遠のいてきた。", "You have been knocked out.")); break;
2940 if (randint1(1000) < v || one_in_(16))
2942 msg_print(_("割れるような頭痛がする。", "A vicious blow hits your head."));
2946 if (!p_ptr->sustain_int) (void)do_dec_stat(A_INT);
2947 if (!p_ptr->sustain_wis) (void)do_dec_stat(A_WIS);
2949 else if (one_in_(2))
2951 if (!p_ptr->sustain_int) (void)do_dec_stat(A_INT);
2955 if (!p_ptr->sustain_wis) (void)do_dec_stat(A_WIS);
2958 if (p_ptr->special_defense & KATA_MASK)
2960 msg_print(_("型が崩れた。", "Your posture gets loose."));
2961 p_ptr->special_defense &= ~(KATA_MASK);
2962 p_ptr->update |= (PU_BONUS);
2963 p_ptr->update |= (PU_MONSTERS);
2964 p_ptr->redraw |= (PR_STATE);
2965 p_ptr->redraw |= (PR_STATUS);
2966 p_ptr->action = ACTION_NONE;
2970 if (p_ptr->concent) reset_concentration(TRUE);
2973 if (hex_spelling_any()) stop_hex_spell_all();
2979 else if (new_aux < old_aux)
2981 /* Describe the state */
2986 msg_print(_("やっと朦朧状態から回復した。", "You are no longer stunned."));
2988 if (disturb_state) disturb(FALSE, FALSE);
2999 if (!notice) return (FALSE);
3001 if (disturb_state) disturb(FALSE, FALSE);
3003 /* Recalculate bonuses */
3004 p_ptr->update |= (PU_BONUS);
3006 /* Redraw the "stun" */
3007 p_ptr->redraw |= (PR_STUN);
3014 * @brief 出血の継続時間をセットする / Set "p_ptr->cut", notice observable changes
3016 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
3018 * Note the special code to only notice "range" changes.
3020 bool set_cut(TIME_EFFECT v)
3022 int old_aux, new_aux;
3023 bool notice = FALSE;
3025 /* Hack -- Force good values */
3026 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
3028 if (p_ptr->is_dead) return FALSE;
3030 if ((p_ptr->prace == RACE_GOLEM ||
3031 p_ptr->prace == RACE_SKELETON ||
3032 p_ptr->prace == RACE_SPECTRE ||
3033 (p_ptr->prace == RACE_ZOMBIE && p_ptr->lev > 11)) &&
3038 if (p_ptr->cut > 1000)
3044 else if (p_ptr->cut > 200)
3050 else if (p_ptr->cut > 100)
3056 else if (p_ptr->cut > 50)
3062 else if (p_ptr->cut > 25)
3068 else if (p_ptr->cut > 10)
3074 else if (p_ptr->cut > 0)
3134 if (new_aux > old_aux)
3136 /* Describe the state */
3140 case 1: msg_print(_("かすり傷を負ってしまった。", "You have been given a graze.")); break;
3143 case 2: msg_print(_("軽い傷を負ってしまった。", "You have been given a light cut.")); break;
3146 case 3: msg_print(_("ひどい傷を負ってしまった。", "You have been given a bad cut.")); break;
3149 case 4: msg_print(_("大変な傷を負ってしまった。", "You have been given a nasty cut.")); break;
3152 case 5: msg_print(_("重大な傷を負ってしまった。", "You have been given a severe cut.")); break;
3155 case 6: msg_print(_("ひどい深手を負ってしまった。", "You have been given a deep gash.")); break;
3158 case 7: msg_print(_("致命的な傷を負ってしまった。", "You have been given a mortal wound.")); break;
3163 if (randint1(1000) < v || one_in_(16))
3165 if (!p_ptr->sustain_chr)
3167 msg_print(_("ひどい傷跡が残ってしまった。", "You have been horribly scarred."));
3174 else if (new_aux < old_aux)
3176 /* Describe the state */
3181 msg_format(_("やっと%s。", "You are no longer bleeding."), p_ptr->prace == RACE_ANDROID ? "怪我が直った" : "出血が止まった");
3183 if (disturb_state) disturb(FALSE, FALSE);
3194 if (!notice) return (FALSE);
3196 if (disturb_state) disturb(FALSE, FALSE);
3198 /* Recalculate bonuses */
3199 p_ptr->update |= (PU_BONUS);
3201 /* Redraw the "cut" */
3202 p_ptr->redraw |= (PR_CUT);
3208 * @brief 空腹状態をセットする / Set "p_ptr->food", notice observable changes
3210 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
3212 * Set "", notice observable changes\n
3214 * The "p_ptr->food" variable can get as large as 20000, allowing the
3215 * addition of the most "filling" item, Elvish Waybread, which adds
3216 * 7500 food units, without overflowing the 32767 maximum limit.\n
3218 * Perhaps we should disturb the player with various messages,
3219 * especially messages about hunger status changes. \n
3221 * Digestion of food is handled in "dungeon.c", in which, normally,
3222 * the player digests about 20 food units per 100 game turns, more
3223 * when "fast", more when "regenerating", less with "slow digestion",
3224 * but when the player is "gorged", he digests 100 food units per 10
3225 * game turns, or a full 1000 food units per 100 game turns.\n
3227 * Note that the player's speed is reduced by 10 units while gorged,
3228 * so if the player eats a single food ration (5000 food units) when
3229 * full (15000 food units), he will be gorged for (5000/100)*10 = 500
3230 * game turns, or 500/(100/5) = 25 player turns (if nothing else is
3231 * affecting the player speed).\n
3233 bool set_food(TIME_EFFECT v)
3235 int old_aux, new_aux;
3237 bool notice = FALSE;
3239 /* Hack -- Force good values */
3240 v = (v > 20000) ? 20000 : (v < 0) ? 0 : v;
3242 /* Fainting / Starving */
3243 if (p_ptr->food < PY_FOOD_FAINT)
3249 else if (p_ptr->food < PY_FOOD_WEAK)
3255 else if (p_ptr->food < PY_FOOD_ALERT)
3261 else if (p_ptr->food < PY_FOOD_FULL)
3267 else if (p_ptr->food < PY_FOOD_MAX)
3278 /* Fainting / Starving */
3279 if (v < PY_FOOD_FAINT)
3285 else if (v < PY_FOOD_WEAK)
3291 else if (v < PY_FOOD_ALERT)
3297 else if (v < PY_FOOD_FULL)
3303 else if (v < PY_FOOD_MAX)
3314 if (old_aux < 1 && new_aux > 0)
3315 chg_virtue(V_PATIENCE, 2);
3316 else if (old_aux < 3 && (old_aux != new_aux))
3317 chg_virtue(V_PATIENCE, 1);
3319 chg_virtue(V_TEMPERANCE, 1);
3321 chg_virtue(V_TEMPERANCE, -1);
3324 if (new_aux > old_aux)
3326 /* Describe the state */
3330 case 1: msg_print(_("まだ空腹で倒れそうだ。", "You are still weak.")); break;
3333 case 2: msg_print(_("まだ空腹だ。", "You are still hungry.")); break;
3336 case 3: msg_print(_("空腹感がおさまった。", "You are no longer hungry.")); break;
3339 case 4: msg_print(_("満腹だ!", "You are full!")); break;
3343 msg_print(_("食べ過ぎだ!", "You have gorged yourself!"));
3344 chg_virtue(V_HARMONY, -1);
3345 chg_virtue(V_PATIENCE, -1);
3346 chg_virtue(V_TEMPERANCE, -2);
3356 else if (new_aux < old_aux)
3358 /* Describe the state */
3361 /* Fainting / Starving */
3362 case 0: msg_print(_("あまりにも空腹で気を失ってしまった!", "You are getting faint from hunger!")); break;
3365 case 1: msg_print(_("お腹が空いて倒れそうだ。", "You are getting weak from hunger!")); break;
3368 case 2: msg_print(_("お腹が空いてきた。", "You are getting hungry.")); break;
3371 case 3: msg_print(_("満腹感がなくなった。", "You are no longer full.")); break;
3374 case 4: msg_print(_("やっとお腹がきつくなくなった。", "You are no longer gorged.")); break;
3377 if (p_ptr->wild_mode && (new_aux < 2))
3389 /* Nothing to notice */
3390 if (!notice) return (FALSE);
3392 if (disturb_state) disturb(FALSE, FALSE);
3394 /* Recalculate bonuses */
3395 p_ptr->update |= (PU_BONUS);
3398 p_ptr->redraw |= (PR_HUNGER);
3404 * @brief プレイヤーの基本能力値を増加させる / Increases a stat by one randomized level -RAK-
3405 * @param stat 上昇させるステータスID
3406 * @return 実際に上昇した場合TRUEを返す。
3408 * Note that this function (used by stat potions) now restores\n
3409 * the stat BEFORE increasing it.\n
3411 bool inc_stat(int stat)
3413 BASE_STATUS value, gain;
3415 /* Then augment the current/max stat */
3416 value = p_ptr->stat_cur[stat];
3418 /* Cannot go above 18/100 */
3419 if (value < p_ptr->stat_max_max[stat])
3421 /* Gain one (sometimes two) points */
3424 gain = ((randint0(100) < 75) ? 1 : 2);
3428 /* Gain 1/6 to 1/3 of distance to 18/100 */
3429 else if (value < (p_ptr->stat_max_max[stat]-2))
3431 /* Approximate gain value */
3432 gain = (((p_ptr->stat_max_max[stat]) - value) / 2 + 3) / 2;
3435 if (gain < 1) gain = 1;
3437 /* Apply the bonus */
3438 value += randint1(gain) + gain / 2;
3441 if (value > (p_ptr->stat_max_max[stat]-1)) value = p_ptr->stat_max_max[stat]-1;
3444 /* Gain one point at a time */
3450 /* Save the new value */
3451 p_ptr->stat_cur[stat] = value;
3453 /* Bring up the maximum too */
3454 if (value > p_ptr->stat_max[stat])
3456 p_ptr->stat_max[stat] = value;
3459 /* Recalculate bonuses */
3460 p_ptr->update |= (PU_BONUS);
3466 /* Nothing to gain */
3471 * @brief プレイヤーの基本能力値を減少させる / Decreases a stat by an amount indended to vary from 0 to 100 percent.
3472 * @param stat 減少させるステータスID
3473 * @param amount 減少させる基本量
3474 * @param permanent TRUEならば現在の最大値を減少させる
3475 * @return 実際に減少した場合TRUEを返す。
3478 * Amount could be a little higher in extreme cases to mangle very high\n
3479 * stats from massive assaults. -CWS\n
3481 * Note that "permanent" means that the *given* amount is permanent,\n
3482 * not that the new value becomes permanent. This may not work exactly\n
3483 * as expected, due to "weirdness" in the algorithm, but in general,\n
3484 * if your stat is already drained, the "max" value will not drop all\n
3485 * the way down to the "cur" value.\n
3487 bool dec_stat(int stat, int amount, int permanent)
3489 BASE_STATUS cur, max;
3494 /* Acquire current value */
3495 cur = p_ptr->stat_cur[stat];
3496 max = p_ptr->stat_max[stat];
3498 /* Note when the values are identical */
3499 same = (cur == max);
3501 /* Damage "current" value */
3504 /* Handle "low" values */
3507 if (amount > 90) cur--;
3508 if (amount > 50) cur--;
3509 if (amount > 20) cur--;
3513 /* Handle "high" values */
3516 /* Hack -- Decrement by a random amount between one-quarter */
3517 /* and one-half of the stat bonus times the percentage, with a */
3518 /* minimum damage of half the percentage. -CWS */
3519 loss = (((cur-18) / 2 + 1) / 2 + 1);
3522 if (loss < 1) loss = 1;
3524 /* Randomize the loss */
3525 loss = ((randint1(loss) + loss) * amount) / 100;
3528 if (loss < amount/2) loss = amount/2;
3530 /* Lose some points */
3533 /* Hack -- Only reduce stat to 17 sometimes */
3534 if (cur < 18) cur = (amount <= 20) ? 18 : 17;
3537 /* Prevent illegal values */
3538 if (cur < 3) cur = 3;
3540 /* Something happened */
3541 if (cur != p_ptr->stat_cur[stat]) res = TRUE;
3544 /* Damage "max" value */
3545 if (permanent && (max > 3))
3547 chg_virtue(V_SACRIFICE, 1);
3548 if (stat == A_WIS || stat == A_INT)
3549 chg_virtue(V_ENLIGHTEN, -2);
3551 /* Handle "low" values */
3554 if (amount > 90) max--;
3555 if (amount > 50) max--;
3556 if (amount > 20) max--;
3560 /* Handle "high" values */
3563 /* Hack -- Decrement by a random amount between one-quarter */
3564 /* and one-half of the stat bonus times the percentage, with a */
3565 /* minimum damage of half the percentage. -CWS */
3566 loss = (((max-18) / 2 + 1) / 2 + 1);
3567 loss = ((randint1(loss) + loss) * amount) / 100;
3568 if (loss < amount/2) loss = amount/2;
3570 /* Lose some points */
3573 /* Hack -- Only reduce stat to 17 sometimes */
3574 if (max < 18) max = (amount <= 20) ? 18 : 17;
3577 /* Hack -- keep it clean */
3578 if (same || (max < cur)) max = cur;
3580 /* Something happened */
3581 if (max != p_ptr->stat_max[stat]) res = TRUE;
3587 /* Actually set the stat to its new value. */
3588 p_ptr->stat_cur[stat] = cur;
3589 p_ptr->stat_max[stat] = max;
3591 /* Redisplay the stats later */
3592 p_ptr->redraw |= (PR_STATS);
3594 /* Recalculate bonuses */
3595 p_ptr->update |= (PU_BONUS);
3603 * @brief プレイヤーの基本能力値を回復させる / Restore a stat. Return TRUE only if this actually makes a difference.
3604 * @param stat 回復ステータスID
3605 * @return 実際に回復した場合TRUEを返す。
3607 bool res_stat(int stat)
3609 /* Restore if needed */
3610 if (p_ptr->stat_cur[stat] != p_ptr->stat_max[stat])
3613 p_ptr->stat_cur[stat] = p_ptr->stat_max[stat];
3615 /* Recalculate bonuses */
3616 p_ptr->update |= (PU_BONUS);
3618 /* Redisplay the stats later */
3619 p_ptr->redraw |= (PR_STATS);
3625 /* Nothing to restore */
3631 * Increase players hit points, notice effects
3633 bool hp_player(int num)
3636 vir = virtue_number(V_VITALITY);
3638 if(num <= 0) return (FALSE);
3642 num = num * (p_ptr->virtues[vir - 1] + 1250) / 1250;
3644 /* Healing needed */
3645 if (p_ptr->chp < p_ptr->mhp)
3647 if ((num > 0) && (p_ptr->chp < (p_ptr->mhp/3)))
3648 chg_virtue(V_TEMPERANCE, 1);
3649 /* Gain hitpoints */
3652 /* Enforce maximum */
3653 if (p_ptr->chp >= p_ptr->mhp)
3655 p_ptr->chp = p_ptr->mhp;
3656 p_ptr->chp_frac = 0;
3659 p_ptr->redraw |= (PR_HP);
3661 p_ptr->window |= (PW_PLAYER);
3666 msg_print(_("少し気分が良くなった。", "You feel a little better."));
3672 msg_print(_("気分が良くなった。", "You feel better."));
3678 msg_print(_("とても気分が良くなった。", "You feel much better."));
3684 msg_print(_("ひじょうに気分が良くなった。", "You feel very good."));
3696 * Array of stat "descriptions"
3698 static cptr desc_stat_pos[] =
3703 _("器用に", "dextrous"),
3704 _("健康に", "healthy"),
3710 * Array of stat "descriptions"
3712 static cptr desc_stat_neg[] =
3717 _("不器用に", "clumsy"),
3718 _("不健康に", "sickly"),
3726 bool do_dec_stat(int stat)
3730 /* Access the "sustain" */
3733 case A_STR: if (p_ptr->sustain_str) sust = TRUE; break;
3734 case A_INT: if (p_ptr->sustain_int) sust = TRUE; break;
3735 case A_WIS: if (p_ptr->sustain_wis) sust = TRUE; break;
3736 case A_DEX: if (p_ptr->sustain_dex) sust = TRUE; break;
3737 case A_CON: if (p_ptr->sustain_con) sust = TRUE; break;
3738 case A_CHR: if (p_ptr->sustain_chr) sust = TRUE; break;
3742 if (sust && (!ironman_nightmare || randint0(13)))
3744 msg_format(_("%sなった気がしたが、すぐに元に戻った。", "You feel %s for a moment, but the feeling passes."),
3745 desc_stat_neg[stat]);
3751 /* Attempt to reduce the stat */
3752 if (dec_stat(stat, 10, (ironman_nightmare && !randint0(13))))
3754 msg_format(_("ひどく%sなった気がする。", "You feel very %s."), desc_stat_neg[stat]);
3760 /* Nothing obvious */
3766 * Restore lost "points" in a stat
3768 bool do_res_stat(int stat)
3770 /* Attempt to increase */
3773 msg_format(_("元通りに%sなった気がする。", "You feel less %s."), desc_stat_pos[stat]);
3778 /* Nothing obvious */
3784 * Gain a "point" in a stat
3786 bool do_inc_stat(int stat)
3790 /* Restore strength */
3791 res = res_stat(stat);
3793 /* Attempt to increase */
3798 chg_virtue(V_ENLIGHTEN, 1);
3799 chg_virtue(V_FAITH, 1);
3801 else if (stat == A_INT)
3803 chg_virtue(V_KNOWLEDGE, 1);
3804 chg_virtue(V_ENLIGHTEN, 1);
3806 else if (stat == A_CON)
3807 chg_virtue(V_VITALITY, 1);
3809 msg_format(_("ワーオ!とても%sなった!", "Wow! You feel very %s!"), desc_stat_pos[stat]);
3814 /* Restoration worked */
3817 msg_format(_("元通りに%sなった気がする。", "You feel less %s."), desc_stat_pos[stat]);
3822 /* Nothing obvious */
3828 * Restores any drained experience
3830 bool restore_level(void)
3832 /* Restore experience */
3833 if (p_ptr->exp < p_ptr->max_exp)
3835 msg_print(_("経験値が戻ってきた気がする。", "You feel your experience returning."));
3837 /* Restore the experience */
3838 p_ptr->exp = p_ptr->max_exp;
3840 /* Check the experience */
3854 bool lose_all_info(void)
3858 chg_virtue(V_KNOWLEDGE, -5);
3859 chg_virtue(V_ENLIGHTEN, -5);
3861 /* Forget info about objects */
3862 for (i = 0; i < INVEN_TOTAL; i++)
3864 object_type *o_ptr = &inventory[i];
3866 /* Skip non-objects */
3867 if (!o_ptr->k_idx) continue;
3869 /* Allow "protection" by the MENTAL flag */
3870 if (o_ptr->ident & (IDENT_MENTAL)) continue;
3872 /* Remove "default inscriptions" */
3873 o_ptr->feeling = FEEL_NONE;
3875 /* Hack -- Clear the "empty" flag */
3876 o_ptr->ident &= ~(IDENT_EMPTY);
3878 /* Hack -- Clear the "known" flag */
3879 o_ptr->ident &= ~(IDENT_KNOWN);
3881 /* Hack -- Clear the "felt" flag */
3882 o_ptr->ident &= ~(IDENT_SENSE);
3885 /* Recalculate bonuses */
3886 p_ptr->update |= (PU_BONUS);
3888 /* Combine / Reorder the pack (later) */
3889 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
3891 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
3893 /* Mega-Hack -- Forget the map */
3901 void do_poly_wounds(void)
3903 /* Changed to always provide at least _some_ healing */
3904 s16b wounds = p_ptr->cut;
3905 s16b hit_p = (p_ptr->mhp - p_ptr->chp);
3906 s16b change = damroll(p_ptr->lev, 5);
3907 bool Nasty_effect = one_in_(5);
3909 if (!(wounds || hit_p || Nasty_effect)) return;
3911 msg_print(_("傷がより軽いものに変化した。", "Your wounds are polymorphed into less serious ones."));
3915 msg_print(_("新たな傷ができた!", "A new wound was created!"));
3916 take_hit(DAMAGE_LOSELIFE, change / 2, _("変化した傷", "a polymorphed wound"), -1);
3921 set_cut(p_ptr->cut - (change / 2));
3927 * Change player race
3929 void change_race(CHARACTER_IDX new_race, cptr effect_msg)
3931 cptr title = race_info[new_race].title;
3932 int old_race = p_ptr->prace;
3935 msg_format("あなたは%s%sに変化した!", effect_msg, title);
3937 msg_format("You turn into %s %s%s!", (!effect_msg[0] && is_a_vowel(title[0]) ? "an" : "a"), effect_msg, title);
3940 chg_virtue(V_CHANCE, 2);
3942 if (p_ptr->prace < 32)
3944 p_ptr->old_race1 |= 1L << p_ptr->prace;
3948 p_ptr->old_race2 |= 1L << (p_ptr->prace - 32);
3950 p_ptr->prace = new_race;
3951 rp_ptr = &race_info[p_ptr->prace];
3953 /* Experience factor */
3954 p_ptr->expfact = rp_ptr->r_exp + cp_ptr->c_exp;
3957 * The speed bonus of Klackons and Sprites are disabled
3958 * and the experience penalty is decreased.
3960 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)))
3961 p_ptr->expfact -= 15;
3963 /* Get character's height and weight */
3964 get_height_weight();
3967 if (p_ptr->pclass == CLASS_SORCERER)
3968 p_ptr->hitdie = rp_ptr->r_mhp/2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
3970 p_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
3972 do_cmd_rerate(FALSE);
3974 /* The experience level may be modified */
3977 p_ptr->redraw |= (PR_BASIC);
3979 p_ptr->update |= (PU_BONUS);
3983 /* Load an autopick preference file */
3984 if (old_race != p_ptr->prace) autopick_load_pref(FALSE);
3986 /* Player's graphic tile may change */
3987 lite_spot(p_ptr->y, p_ptr->x);
3991 void do_poly_self(void)
3993 int power = p_ptr->lev;
3995 msg_print(_("あなたは変化の訪れを感じた...", "You feel a change coming over you..."));
3996 chg_virtue(V_CHANCE, 1);
3998 if ((power > randint0(20)) && one_in_(3) && (p_ptr->prace != RACE_ANDROID))
4000 char effect_msg[80] = "";
4001 CHARACTER_IDX new_race;
4003 /* Some form of racial polymorph... */
4006 if ((power > randint0(5)) && one_in_(4))
4011 if (p_ptr->psex == SEX_MALE)
4013 p_ptr->psex = SEX_FEMALE;
4014 sp_ptr = &sex_info[p_ptr->psex];
4015 sprintf(effect_msg, _("女性の", "female "));
4019 p_ptr->psex = SEX_MALE;
4020 sp_ptr = &sex_info[p_ptr->psex];
4021 sprintf(effect_msg, _("男性の", "male "));
4025 if ((power > randint0(30)) && one_in_(5))
4029 /* Harmful deformity */
4036 (void)dec_stat(tmp, randint1(6) + 6, one_in_(3));
4042 /* Deformities are discriminated against! */
4043 (void)dec_stat(A_CHR, randint1(6), TRUE);
4048 sprintf(tmp_msg,_("%s", "%s "),effect_msg);
4049 sprintf(effect_msg,_("奇形の%s", "deformed %s "),tmp_msg);
4053 sprintf(effect_msg,_("奇形の", "deformed "));
4057 while ((power > randint0(20)) && one_in_(10))
4059 /* Polymorph into a less mutated form */
4062 if (!lose_mutation(0))
4063 msg_print(_("奇妙なくらい普通になった気がする。", "You feel oddly normal."));
4068 new_race = (CHARACTER_IDX)randint0(MAX_RACES);
4070 while ((new_race == p_ptr->prace) || (new_race == RACE_ANDROID));
4072 change_race(new_race, effect_msg);
4075 if ((power > randint0(30)) && one_in_(6))
4081 msg_format(_("%sの構成が変化した!", "Your internal organs are rearranged!"), p_ptr->prace == RACE_ANDROID ? "機械" : "内臓");
4085 (void)dec_stat(tmp, randint1(6) + 6, one_in_(3));
4090 msg_print(_("現在の姿で生きていくのは困難なようだ!", "You find living difficult in your present form!"));
4091 take_hit(DAMAGE_LOSELIFE, damroll(randint1(10), p_ptr->lev), _("致命的な突然変異", "a lethal mutation"), -1);
4097 if ((power > randint0(20)) && one_in_(4))
4102 do_cmd_rerate(FALSE);
4105 while ((power > randint0(15)) && one_in_(3))
4108 (void)gain_random_mutation(0);
4111 if (power > randint0(5))
4117 /* Note: earlier deductions may have left power < 0 already. */
4127 * Decreases players hit points and sets death flag if necessary
4129 * Invulnerability needs to be changed into a "shield"
4131 * Hack -- this function allows the user to save (or quit)
4132 * the game when he dies, since the "You die." message is shown before
4133 * setting the player to "dead".
4136 int take_hit(int damage_type, HIT_POINT damage, cptr hit_from, int monspell)
4138 int old_chp = p_ptr->chp;
4140 char death_message[1024];
4143 int warning = (p_ptr->mhp * hitpoint_warn / 10);
4146 if (p_ptr->is_dead) return 0;
4148 if (p_ptr->sutemi) damage *= 2;
4149 if (p_ptr->special_defense & KATA_IAI) damage += (damage + 4) / 5;
4151 if (easy_band) damage = (damage+1)/2;
4153 if (damage_type != DAMAGE_USELIFE)
4155 disturb(TRUE, TRUE);
4162 if (monspell >= 0) learn_spell(monspell);
4164 /* Mega-Hack -- Apply "invulnerability" */
4165 if ((damage_type != DAMAGE_USELIFE) && (damage_type != DAMAGE_LOSELIFE))
4167 if (IS_INVULN() && (damage < 9000))
4169 if (damage_type == DAMAGE_FORCE)
4171 msg_print(_("バリアが切り裂かれた!", "The attack cuts your shield of invulnerability open!"));
4173 else if (one_in_(PENETRATE_INVULNERABILITY))
4175 msg_print(_("無敵のバリアを破って攻撃された!", "The attack penetrates your shield of invulnerability!"));
4183 if (CHECK_MULTISHADOW())
4185 if (damage_type == DAMAGE_FORCE)
4187 msg_print(_("幻影もろとも体が切り裂かれた!", "The attack hits Shadow together with you!"));
4189 else if (damage_type == DAMAGE_ATTACK)
4191 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
4196 if (p_ptr->wraith_form)
4198 if (damage_type == DAMAGE_FORCE)
4200 msg_print(_("半物質の体が切り裂かれた!", "The attack cuts through your ethereal body!"));
4205 if ((damage == 0) && one_in_(2)) damage = 1;
4209 if (p_ptr->special_defense & KATA_MUSOU)
4212 if ((damage == 0) && one_in_(2)) damage = 1;
4214 } /* not if LOSELIFE USELIFE */
4216 /* Hurt the player */
4217 p_ptr->chp -= damage;
4218 if(damage_type == DAMAGE_GENO && p_ptr->chp < 0)
4220 damage += p_ptr->chp;
4224 /* Display the hitpoints */
4225 p_ptr->redraw |= (PR_HP);
4227 p_ptr->window |= (PW_PLAYER);
4229 if (damage_type != DAMAGE_GENO && p_ptr->chp == 0)
4231 chg_virtue(V_SACRIFICE, 1);
4232 chg_virtue(V_CHANCE, 2);
4238 bool android = (p_ptr->prace == RACE_ANDROID ? TRUE : FALSE);
4240 #ifdef JP /* 死んだ時に強制終了して死を回避できなくしてみた by Habu */
4242 if(!save_player()) msg_print("セーブ失敗!");
4247 chg_virtue(V_SACRIFICE, 10);
4252 p_ptr->leaving = TRUE;
4255 p_ptr->is_dead = TRUE;
4257 if (p_ptr->inside_arena)
4259 cptr m_name = r_name+r_info[arena_info[p_ptr->arena_number].r_idx].name;
4260 msg_format(_("あなたは%sの前に敗れ去った。", "You are beaten by %s."), m_name);
4262 if (record_arena) do_cmd_write_nikki(NIKKI_ARENA, -1 - p_ptr->arena_number, m_name);
4266 QUEST_IDX q_idx = quest_number(dun_level);
4267 bool seppuku = streq(hit_from, "Seppuku");
4268 bool winning_seppuku = p_ptr->total_winner && seppuku;
4270 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_GAMEOVER);
4273 /* Make screen dump */
4274 screen_dump = make_screen_dump();
4277 /* Note cause of death */
4280 strcpy(p_ptr->died_from, hit_from);
4282 if (!winning_seppuku) strcpy(p_ptr->died_from, "切腹");
4289 sprintf(dummy, "%s%s%s", !p_ptr->paralyzed ? "" : p_ptr->free_act ? "彫像状態で" : "麻痺状態で", p_ptr->image ? "幻覚に歪んだ" : "", hit_from);
4291 sprintf(dummy, "%s%s", hit_from, !p_ptr->paralyzed ? "" : " while helpless");
4293 my_strcpy(p_ptr->died_from, dummy, sizeof p_ptr->died_from);
4296 /* No longer a winner */
4297 p_ptr->total_winner = FALSE;
4299 if (winning_seppuku)
4301 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("勝利の後切腹した。", "did Seppuku after the winning."));
4307 if (p_ptr->inside_arena)
4308 strcpy(buf,_("アリーナ", "in the Arena"));
4309 else if (!dun_level)
4310 strcpy(buf,_("地上", "on the surface"));
4311 else if (q_idx && (is_fixed_quest_idx(q_idx) &&
4312 !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
4313 strcpy(buf,_("クエスト", "in a quest"));
4315 sprintf(buf,_("%d階", "level %d"), (int)dun_level);
4317 sprintf(tmp, _("%sで%sに殺された。", "killed by %s %s."), buf, p_ptr->died_from);
4318 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, tmp);
4321 do_cmd_write_nikki(NIKKI_GAMESTART, 1, _("-------- ゲームオーバー --------", "-------- Game Over --------"));
4322 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, "\n\n\n\n");
4326 if (get_check_strict(_("画面を保存しますか?", "Dump the screen? "), CHECK_NO_HISTORY))
4328 do_cmd_save_screen();
4333 /* Initialize "last message" buffer */
4334 if (p_ptr->last_message) string_free(p_ptr->last_message);
4335 p_ptr->last_message = NULL;
4337 /* Hack -- Note death */
4341 msg_format("あなたは%sました。", android ? "壊れ" : "死に");
4343 msg_print(android ? "You are broken." : "You die.");
4350 if (winning_seppuku)
4352 get_rnd_line(_("seppuku_j.txt", "seppuku.txt"), 0, death_message);
4356 get_rnd_line(_("death_j.txt", "death.txt"), 0, death_message);
4362 while (!get_string(winning_seppuku ? "辞世の句: " : "断末魔の叫び: ", death_message, 1024)) ;
4364 while (!get_string("Last word: ", death_message, 1024)) ;
4367 while (winning_seppuku && !get_check_strict(_("よろしいですか?", "Are you sure? "), CHECK_NO_HISTORY));
4369 if (death_message[0] == '\0')
4372 strcpy(death_message, format("あなたは%sました。", android ? "壊れ" : "死に"));
4374 strcpy(death_message, android ? "You are broken." : "You die.");
4377 else p_ptr->last_message = string_make(death_message);
4380 if (winning_seppuku)
4385 int msg_pos_x[9] = { 5, 7, 9, 12, 14, 17, 19, 21, 23};
4386 int msg_pos_y[9] = { 3, 4, 5, 4, 5, 4, 5, 6, 4};
4393 for (i = 0; i < 40; i++)
4394 Term_putstr(randint0(w / 2) * 2, randint0(h), 2, TERM_VIOLET, "υ");
4396 str = death_message;
4397 if (strncmp(str, "「", 2) == 0) str += 2;
4399 str2 = my_strstr(str, "」");
4400 if (str2 != NULL) *str2 = '\0';
4405 str2 = my_strstr(str, " ");
4406 if (str2 == NULL) len = strlen(str);
4407 else len = str2 - str;
4411 Term_putstr_v(w * 3 / 4 - 2 - msg_pos_x[i] * 2, msg_pos_y[i], len,
4413 if (str2 == NULL) break;
4417 if (*str == 0) break;
4421 Term_putstr(w-1, h-1, 1, TERM_WHITE, " ");
4425 /* Make screen dump */
4426 screen_dump = make_screen_dump();
4429 /* Wait a key press */
4434 msg_print(death_message);
4444 /* Hitpoint warning */
4445 if (p_ptr->chp < warning)
4447 /* Hack -- bell on first notice */
4448 if (old_chp > warning) bell();
4452 if (record_danger && (old_chp > warning))
4454 if (p_ptr->image && damage_type == DAMAGE_ATTACK)
4455 hit_from = _("何か", "something");
4457 sprintf(tmp,_("%sによってピンチに陥った。", "A critical situation because of %s."),hit_from);
4458 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, tmp);
4463 /* stop auto_more even if DAMAGE_USELIFE */
4467 msg_print(_("*** 警告:低ヒット・ポイント! ***", "*** LOW HITPOINT WARNING! ***"));
4471 if (p_ptr->wild_mode && !p_ptr->leaving && (p_ptr->chp < MAX(warning, p_ptr->mhp/5)))
4482 void gain_exp_64(s32b amount, u32b amount_frac)
4484 if (p_ptr->is_dead) return;
4486 if (p_ptr->prace == RACE_ANDROID) return;
4488 /* Gain some experience */
4489 s64b_add(&(p_ptr->exp), &(p_ptr->exp_frac), amount, amount_frac);
4491 /* Slowly recover from experience drainage */
4492 if (p_ptr->exp < p_ptr->max_exp)
4494 /* Gain max experience (20%) (was 10%) */
4495 p_ptr->max_exp += amount / 5;
4498 /* Check Experience */
4506 void gain_exp(s32b amount)
4508 gain_exp_64(amount, 0L);
4512 void calc_android_exp(void)
4516 if (p_ptr->is_dead) return;
4518 if (p_ptr->prace != RACE_ANDROID) return;
4520 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
4522 object_type *o_ptr = &inventory[i];
4524 object_type *q_ptr = &forge;
4526 DEPTH level = MAX(k_info[o_ptr->k_idx].level - 8, 1);
4528 if ((i == INVEN_RIGHT) || (i == INVEN_LEFT) || (i == INVEN_NECK) || (i == INVEN_LITE)) continue;
4529 if (!o_ptr->k_idx) continue;
4532 object_copy(q_ptr, o_ptr);
4533 q_ptr->discount = 0;
4534 q_ptr->curse_flags = 0L;
4536 if (object_is_fixed_artifact(o_ptr))
4538 level = (level + MAX(a_info[o_ptr->name1].level - 8, 5)) / 2;
4539 level += MIN(20, a_info[o_ptr->name1].rarity/(a_info[o_ptr->name1].gen_flags & TRG_INSTA_ART ? 10 : 3));
4541 else if (object_is_ego(o_ptr))
4543 level += MAX(3, (e_info[o_ptr->name2].rating - 5)/2);
4545 else if (o_ptr->art_name)
4547 s32b total_flags = flag_cost(o_ptr, o_ptr->pval);
4550 if (!object_is_weapon_ammo(o_ptr))
4553 if (total_flags < 15000) fake_level = 10;
4554 else if (total_flags < 35000) fake_level = 25;
4555 else fake_level = 40;
4560 if (total_flags < 20000) fake_level = 10;
4561 else if (total_flags < 45000) fake_level = 25;
4562 else fake_level = 40;
4565 level = MAX(level, (level + MAX(fake_level - 8, 5)) / 2 + 3);
4568 value = object_value_real(q_ptr);
4570 if (value <= 0) continue;
4571 if ((o_ptr->tval == TV_SOFT_ARMOR) && (o_ptr->sval == SV_ABUNAI_MIZUGI) && (p_ptr->pseikaku != SEIKAKU_SEXY)) value /= 32;
4572 if (value > 5000000L) value = 5000000L;
4573 if ((o_ptr->tval == TV_DRAG_ARMOR) || (o_ptr->tval == TV_CARD)) level /= 2;
4575 if (object_is_artifact(o_ptr) || object_is_ego(o_ptr) ||
4576 (o_ptr->tval == TV_DRAG_ARMOR) ||
4577 ((o_ptr->tval == TV_HELM) && (o_ptr->sval == SV_DRAGON_HELM)) ||
4578 ((o_ptr->tval == TV_SHIELD) && (o_ptr->sval == SV_DRAGON_SHIELD)) ||
4579 ((o_ptr->tval == TV_GLOVES) && (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES)) ||
4580 ((o_ptr->tval == TV_BOOTS) && (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE)) ||
4581 ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DIAMOND_EDGE)))
4583 if (level > 65) level = 35 + (level - 65) / 5;
4584 else if (level > 35) level = 25 + (level - 35) / 3;
4585 else if (level > 15) level = 15 + (level - 15) / 2;
4586 exp = MIN(100000L, value) / 2 * level * level;
4587 if (value > 100000L)
4588 exp += (value - 100000L) / 8 * level * level;
4592 exp = MIN(100000L, value) * level;
4593 if (value > 100000L)
4594 exp += (value - 100000L) / 4 * level;
4596 if ((((i == INVEN_RARM) || (i == INVEN_LARM)) && (buki_motteruka(i))) || (i == INVEN_BOW)) total_exp += exp / 48;
4597 else total_exp += exp / 16;
4598 if (i == INVEN_BODY) total_exp += exp / 32;
4600 p_ptr->exp = p_ptr->max_exp = total_exp;
4602 /* Check Experience */
4610 void lose_exp(s32b amount)
4612 if (p_ptr->prace == RACE_ANDROID) return;
4614 /* Never drop below zero experience */
4615 if (amount > p_ptr->exp) amount = p_ptr->exp;
4617 /* Lose some experience */
4618 p_ptr->exp -= amount;
4620 /* Check Experience */
4627 * If resisted to draining, return FALSE
4629 bool drain_exp(s32b drain, s32b slip, int hold_exp_prob)
4631 /* Androids and their mimics are never drained */
4632 if (p_ptr->prace == RACE_ANDROID) return FALSE;
4634 if (p_ptr->hold_exp && (randint0(100) < hold_exp_prob))
4636 /* Hold experience */
4637 msg_print(_("しかし自己の経験値を守りきった!", "You keep hold of your experience!"));
4641 /* Hold experience failed */
4642 if (p_ptr->hold_exp)
4644 msg_print(_("経験値を少し吸い取られた気がする!", "You feel your experience slipping away!"));
4649 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away!"));
4657 bool set_ultimate_res(TIME_EFFECT v, bool do_dec)
4659 bool notice = FALSE;
4661 /* Hack -- Force good values */
4662 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
4664 if (p_ptr->is_dead) return FALSE;
4669 if (p_ptr->ult_res && !do_dec)
4671 if (p_ptr->ult_res > v) return FALSE;
4673 else if (!p_ptr->ult_res)
4675 msg_print(_("あらゆることに対して耐性がついた気がする!", "You feel resistant!"));
4685 msg_print(_("あらゆることに対する耐性が薄れた気がする。", "You feel less resistant"));
4693 /* Redraw status bar */
4694 p_ptr->redraw |= (PR_STATUS);
4696 /* Nothing to notice */
4697 if (!notice) return (FALSE);
4699 if (disturb_state) disturb(FALSE, FALSE);
4701 /* Recalculate bonuses */
4702 p_ptr->update |= (PU_BONUS);
4707 bool set_tim_res_nether(TIME_EFFECT v, bool do_dec)
4709 bool notice = FALSE;
4711 /* Hack -- Force good values */
4712 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
4714 if (p_ptr->is_dead) return FALSE;
4719 if (p_ptr->tim_res_nether && !do_dec)
4721 if (p_ptr->tim_res_nether > v) return FALSE;
4723 else if (!p_ptr->tim_res_nether)
4725 msg_print(_("地獄の力に対して耐性がついた気がする!", "You feel nether resistant!"));
4733 if (p_ptr->tim_res_nether)
4735 msg_print(_("地獄の力に対する耐性が薄れた気がする。", "You feel less nether resistant"));
4741 p_ptr->tim_res_nether = v;
4743 /* Redraw status bar */
4744 p_ptr->redraw |= (PR_STATUS);
4746 /* Nothing to notice */
4747 if (!notice) return (FALSE);
4749 if (disturb_state) disturb(FALSE, FALSE);
4751 /* Recalculate bonuses */
4752 p_ptr->update |= (PU_BONUS);
4757 bool set_tim_res_time(TIME_EFFECT v, bool do_dec)
4759 bool notice = FALSE;
4761 /* Hack -- Force good values */
4762 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
4764 if (p_ptr->is_dead) return FALSE;
4769 if (p_ptr->tim_res_time && !do_dec)
4771 if (p_ptr->tim_res_time > v) return FALSE;
4773 else if (!p_ptr->tim_res_time)
4775 msg_print(_("時間逆転の力に対して耐性がついた気がする!", "You feel time resistant!"));
4783 if (p_ptr->tim_res_time)
4785 msg_print(_("時間逆転の力に対する耐性が薄れた気がする。", "You feel less time resistant"));
4791 p_ptr->tim_res_time = v;
4793 /* Redraw status bar */
4794 p_ptr->redraw |= (PR_STATUS);
4796 /* Nothing to notice */
4797 if (!notice) return (FALSE);
4799 if (disturb_state) disturb(FALSE, FALSE);
4801 /* Recalculate bonuses */
4802 p_ptr->update |= (PU_BONUS);
4809 * Choose a warrior-mage elemental attack. -LM-
4811 bool choose_ele_attack(void)
4817 if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM))
4819 msg_format(_("武器を持たないと魔法剣は使えない。", "You cannot use temporary branding with no weapon."));
4824 num = (p_ptr->lev - 20) / 5;
4825 c_prt(TERM_RED, _(" a) 焼棄", " a) Fire Brand"), 2, 14);
4828 c_prt(TERM_L_WHITE,_(" b) 凍結", " b) Cold Brand"), 3, 14);
4833 c_prt(TERM_GREEN, _(" c) 毒殺", " c) Poison Brand"), 4, 14);
4838 c_prt(TERM_L_DARK, _(" d) 溶解", " d) Acid Brand"), 5, 14);
4843 c_prt(TERM_BLUE, _(" e) 電撃", " e) Elec Brand"), 6, 14);
4852 prt(_(" どの元素攻撃をしますか?", " Choose a temporary elemental brand "), 1, 14);
4856 if ((choice == 'a') || (choice == 'A'))
4857 set_ele_attack(ATTACK_FIRE, p_ptr->lev/2 + randint1(p_ptr->lev/2));
4858 else if (((choice == 'b') || (choice == 'B')) && (num >= 2))
4859 set_ele_attack(ATTACK_COLD, p_ptr->lev/2 + randint1(p_ptr->lev/2));
4860 else if (((choice == 'c') || (choice == 'C')) && (num >= 3))
4861 set_ele_attack(ATTACK_POIS, p_ptr->lev/2 + randint1(p_ptr->lev/2));
4862 else if (((choice == 'd') || (choice == 'D')) && (num >= 4))
4863 set_ele_attack(ATTACK_ACID, p_ptr->lev/2 + randint1(p_ptr->lev/2));
4864 else if (((choice == 'e') || (choice == 'E')) && (num >= 5))
4865 set_ele_attack(ATTACK_ELEC, p_ptr->lev/2 + randint1(p_ptr->lev/2));
4868 msg_print(_("魔法剣を使うのをやめた。", "You cancel the temporary branding."));
4878 * Choose a elemental immune. -LM-
4880 bool choose_ele_immune(TIME_EFFECT immune_turn)
4885 c_prt(TERM_RED, _(" a) 火炎", " a) Immune Fire"), 2, 14);
4886 c_prt(TERM_L_WHITE,_(" b) 冷気", " b) Immune Cold"), 3, 14);
4887 c_prt(TERM_L_DARK, _(" c) 酸", " c) Immune Acid"), 4, 14);
4888 c_prt(TERM_BLUE, _(" d) 電撃", " d) Immune Elec"), 5, 14);
4896 prt(_(" どの元素の免疫をつけますか?", " Choose a temporary elemental immune "), 1, 14);
4900 if ((choice == 'a') || (choice == 'A'))
4901 set_ele_immune(DEFENSE_FIRE, immune_turn);
4902 else if ((choice == 'b') || (choice == 'B'))
4903 set_ele_immune(DEFENSE_COLD, immune_turn);
4904 else if ((choice == 'c') || (choice == 'C'))
4905 set_ele_immune(DEFENSE_ACID, immune_turn);
4906 else if ((choice == 'd') || (choice == 'D'))
4907 set_ele_immune(DEFENSE_ELEC, immune_turn);
4910 msg_print(_("免疫を付けるのをやめた。", "You cancel the temporary immune."));