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);
279 p_ptr->update |= (PU_MONSTERS);
281 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
283 p_ptr->energy_need += ENERGY_NEED();
289 * @brief 変身効果の継続時間と変身先をセットする / Set "p_ptr->tim_mimic", and "p_ptr->mimic_form", notice observable changes
292 * @param do_dec 現在の継続時間より長い値のみ上書きする
293 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
295 bool set_mimic(TIME_EFFECT v, IDX p, bool do_dec)
299 /* Hack -- Force good values */
300 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
302 if (p_ptr->is_dead) return FALSE;
307 if (p_ptr->tim_mimic && (p_ptr->mimic_form == p) && !do_dec)
309 if (p_ptr->tim_mimic > v) return FALSE;
311 else if ((!p_ptr->tim_mimic) || (p_ptr->mimic_form != p))
313 msg_print(_("自分の体が変わってゆくのを感じた。", "You feel that your body changes."));
314 p_ptr->mimic_form = p;
322 if (p_ptr->tim_mimic)
324 msg_print(_("変身が解けた。", "You are no longer transformed."));
325 if (p_ptr->mimic_form == MIMIC_DEMON) set_oppose_fire(0, TRUE);
333 p_ptr->tim_mimic = v;
335 /* Nothing to notice */
339 if (disturb_state) disturb(FALSE, TRUE);
342 p_ptr->redraw |= (PR_BASIC | PR_STATUS);
344 /* Recalculate bonuses */
345 p_ptr->update |= (PU_BONUS | PU_HP);
352 * @brief 盲目の継続時間をセットする / Set "p_ptr->blind", notice observable changes
354 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
356 * Note the use of "PU_UN_LITE" and "PU_UN_VIEW", which is needed to\n
357 * memorize any terrain features which suddenly become "visible".\n
358 * Note that blindness is currently the only thing which can affect\n
359 * "player_can_see_bold()".\n
361 bool set_blind(TIME_EFFECT v)
365 /* Hack -- Force good values */
366 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
368 if (p_ptr->is_dead) return FALSE;
375 if (p_ptr->prace == RACE_ANDROID)
377 msg_print(_("センサーをやられた!", "You are blind!"));
381 msg_print(_("目が見えなくなってしまった!", "You are blind!"));
385 chg_virtue(V_ENLIGHTEN, -1);
394 if (p_ptr->prace == RACE_ANDROID)
396 msg_print(_("センサーが復旧した。", "You can see again."));
400 msg_print(_("やっと目が見えるようになった。", "You can see again."));
410 /* Redraw status bar */
411 p_ptr->redraw |= (PR_STATUS);
413 /* Nothing to notice */
414 if (!notice) return (FALSE);
416 if (disturb_state) disturb(FALSE, FALSE);
418 /* Fully update the visuals */
419 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
421 p_ptr->redraw |= (PR_MAP);
423 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
430 * @brief 混乱の継続時間をセットする / Set "p_ptr->confused", notice observable changes
432 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
434 bool set_confused(TIME_EFFECT v)
438 /* Hack -- Force good values */
439 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
441 if (p_ptr->is_dead) return FALSE;
446 if (!p_ptr->confused)
448 msg_print(_("あなたは混乱した!", "You are confused!"));
450 if (p_ptr->action == ACTION_LEARN)
452 msg_print(_("学習が続けられない!", "You cannot continue Learning!"));
455 p_ptr->redraw |= (PR_STATE);
456 p_ptr->action = ACTION_NONE;
458 if (p_ptr->action == ACTION_KAMAE)
460 msg_print(_("構えがとけた。", "Your posture gets loose."));
461 p_ptr->special_defense &= ~(KAMAE_MASK);
462 p_ptr->update |= (PU_BONUS);
463 p_ptr->redraw |= (PR_STATE);
464 p_ptr->action = ACTION_NONE;
466 else if (p_ptr->action == ACTION_KATA)
468 msg_print(_("型が崩れた。", "Your posture gets loose."));
469 p_ptr->special_defense &= ~(KATA_MASK);
470 p_ptr->update |= (PU_BONUS);
471 p_ptr->update |= (PU_MONSTERS);
472 p_ptr->redraw |= (PR_STATE);
473 p_ptr->redraw |= (PR_STATUS);
474 p_ptr->action = ACTION_NONE;
478 if (p_ptr->concent) reset_concentration(TRUE);
481 if (hex_spelling_any()) stop_hex_spell_all();
484 p_ptr->counter = FALSE;
485 chg_virtue(V_HARMONY, -1);
494 msg_print(_("やっと混乱がおさまった。", "You feel less confused now."));
495 p_ptr->special_attack &= ~(ATTACK_SUIKEN);
503 /* Redraw status bar */
504 p_ptr->redraw |= (PR_STATUS);
506 /* Nothing to notice */
507 if (!notice) return (FALSE);
509 if (disturb_state) disturb(FALSE, FALSE);
516 * @brief 毒の継続時間をセットする / Set "p_ptr->poisoned", notice observable changes
518 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
520 bool set_poisoned(TIME_EFFECT v)
524 /* Hack -- Force good values */
525 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
527 if (p_ptr->is_dead) return FALSE;
532 if (!p_ptr->poisoned)
534 msg_print(_("毒に侵されてしまった!", "You are poisoned!"));
544 msg_print(_("やっと毒の痛みがなくなった。", "You are no longer poisoned."));
552 /* Redraw status bar */
553 p_ptr->redraw |= (PR_STATUS);
555 /* Nothing to notice */
556 if (!notice) return (FALSE);
558 if (disturb_state) disturb(FALSE, FALSE);
565 * @brief 恐怖の継続時間をセットする / Set "p_ptr->afraid", notice observable changes
567 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
569 bool set_afraid(TIME_EFFECT v)
573 /* Hack -- Force good values */
574 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
576 if (p_ptr->is_dead) return FALSE;
583 msg_print(_("何もかも恐くなってきた!", "You are terrified!"));
585 if (p_ptr->special_defense & KATA_MASK)
587 msg_print(_("型が崩れた。", "Your posture gets loose."));
588 p_ptr->special_defense &= ~(KATA_MASK);
589 p_ptr->update |= (PU_BONUS);
590 p_ptr->update |= (PU_MONSTERS);
591 p_ptr->redraw |= (PR_STATE);
592 p_ptr->redraw |= (PR_STATUS);
593 p_ptr->action = ACTION_NONE;
597 p_ptr->counter = FALSE;
598 chg_virtue(V_VALOUR, -1);
607 msg_print(_("やっと恐怖を振り払った。", "You feel bolder now."));
615 /* Redraw status bar */
616 p_ptr->redraw |= (PR_STATUS);
618 /* Nothing to notice */
619 if (!notice) return (FALSE);
621 if (disturb_state) disturb(FALSE, FALSE);
627 * @brief 麻痺の継続時間をセットする / Set "p_ptr->paralyzed", notice observable changes
629 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
631 bool set_paralyzed(TIME_EFFECT v)
635 /* Hack -- Force good values */
636 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
638 if (p_ptr->is_dead) return FALSE;
643 if (!p_ptr->paralyzed)
645 msg_print(_("体が麻痺してしまった!", "You are paralyzed!"));
647 if (p_ptr->concent) reset_concentration(TRUE);
650 if (hex_spelling_any()) stop_hex_spell_all();
652 p_ptr->counter = FALSE;
660 if (p_ptr->paralyzed)
662 msg_print(_("やっと動けるようになった。", "You can move again."));
668 p_ptr->paralyzed = v;
670 /* Redraw status bar */
671 p_ptr->redraw |= (PR_STATUS);
673 /* Nothing to notice */
674 if (!notice) return (FALSE);
676 if (disturb_state) disturb(FALSE, FALSE);
678 /* Redraw the state */
679 p_ptr->redraw |= (PR_STATE);
685 * @brief 幻覚の継続時間をセットする / Set "p_ptr->image", notice observable changes
687 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
688 * @details Note that we must redraw the map when hallucination changes.
690 bool set_image(TIME_EFFECT v)
694 /* Hack -- Force good values */
695 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
697 if (p_ptr->is_dead) return FALSE;
703 set_tsuyoshi(0, TRUE);
706 msg_print(_("ワーオ!何もかも虹色に見える!", "Oh, wow! Everything looks so cosmic now!"));
709 if (p_ptr->concent) reset_concentration(TRUE);
711 p_ptr->counter = FALSE;
721 msg_print(_("やっとはっきりと物が見えるようになった。", "You can see clearly again."));
729 /* Redraw status bar */
730 p_ptr->redraw |= (PR_STATUS);
732 /* Nothing to notice */
733 if (!notice) return (FALSE);
735 if (disturb_state) disturb(FALSE, TRUE);
737 p_ptr->redraw |= (PR_MAP);
739 /* Update the health bar */
740 p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH);
741 p_ptr->update |= (PU_MONSTERS);
743 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
749 * @brief 加速の継続時間をセットする / Set "p_ptr->fast", notice observable changes
751 * @param do_dec 現在の継続時間より長い値のみ上書きする
752 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
754 bool set_fast(TIME_EFFECT v, bool do_dec)
758 /* Hack -- Force good values */
759 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
761 if (p_ptr->is_dead) return FALSE;
766 if (p_ptr->fast && !do_dec)
768 if (p_ptr->fast > v) return FALSE;
770 else if (!IS_FAST() && !p_ptr->lightspeed)
772 msg_print(_("素早く動けるようになった!", "You feel yourself moving much faster!"));
774 chg_virtue(V_PATIENCE, -1);
775 chg_virtue(V_DILIGENCE, 1);
782 if (p_ptr->fast && !p_ptr->lightspeed && !music_singing(MUSIC_SPEED) && !music_singing(MUSIC_SHERO))
784 msg_print(_("動きの素早さがなくなったようだ。", "You feel yourself slow down."));
792 /* Nothing to notice */
793 if (!notice) return (FALSE);
795 if (disturb_state) disturb(FALSE, FALSE);
797 /* Recalculate bonuses */
798 p_ptr->update |= (PU_BONUS);
804 * @brief 光速移動の継続時間をセットする / Set "p_ptr->lightspeed", notice observable changes
806 * @param do_dec 現在の継続時間より長い値のみ上書きする
807 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
809 bool set_lightspeed(TIME_EFFECT v, bool do_dec)
813 /* Hack -- Force good values */
814 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
816 if (p_ptr->is_dead) return FALSE;
818 if (p_ptr->wild_mode) v = 0;
823 if (p_ptr->lightspeed && !do_dec)
825 if (p_ptr->lightspeed > v) return FALSE;
827 else if (!p_ptr->lightspeed)
829 msg_print(_("非常に素早く動けるようになった!", "You feel yourself moving extremely faster!"));
831 chg_virtue(V_PATIENCE, -1);
832 chg_virtue(V_DILIGENCE, 1);
839 if (p_ptr->lightspeed)
841 msg_print(_("動きの素早さがなくなったようだ。", "You feel yourself slow down."));
847 p_ptr->lightspeed = v;
849 /* Nothing to notice */
850 if (!notice) return (FALSE);
852 if (disturb_state) disturb(FALSE, FALSE);
854 /* Recalculate bonuses */
855 p_ptr->update |= (PU_BONUS);
861 * @brief 減速の継続時間をセットする / Set "p_ptr->slow", notice observable changes
863 * @param do_dec 現在の継続時間より長い値のみ上書きする
864 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
866 bool set_slow(TIME_EFFECT v, bool do_dec)
870 /* Hack -- Force good values */
871 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
873 if (p_ptr->is_dead) return FALSE;
878 if (p_ptr->slow && !do_dec)
880 if (p_ptr->slow > v) return FALSE;
882 else if (!p_ptr->slow)
884 msg_print(_("体の動きが遅くなってしまった!", "You feel yourself moving slower!"));
894 msg_print(_("動きの遅さがなくなったようだ。", "You feel yourself speed up."));
902 /* Nothing to notice */
903 if (!notice) return (FALSE);
905 if (disturb_state) disturb(FALSE, FALSE);
907 /* Recalculate bonuses */
908 p_ptr->update |= (PU_BONUS);
915 * @brief 肌石化の継続時間をセットする / Set "p_ptr->shield", notice observable changes
917 * @param do_dec 現在の継続時間より長い値のみ上書きする
918 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
920 bool set_shield(TIME_EFFECT v, bool do_dec)
924 /* Hack -- Force good values */
925 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
927 if (p_ptr->is_dead) return FALSE;
932 if (p_ptr->shield && !do_dec)
934 if (p_ptr->shield > v) return FALSE;
936 else if (!p_ptr->shield)
938 msg_print(_("肌が石になった。", "Your skin turns to stone."));
948 msg_print(_("肌が元に戻った。", "Your skin returns to normal."));
956 /* Redraw status bar */
957 p_ptr->redraw |= (PR_STATUS);
959 /* Nothing to notice */
960 if (!notice) return (FALSE);
962 if (disturb_state) disturb(FALSE, FALSE);
964 /* Recalculate bonuses */
965 p_ptr->update |= (PU_BONUS);
972 * @brief つぶれるの継続時間をセットする / Set "p_ptr->tsubureru", notice observable changes
974 * @param do_dec 現在の継続時間より長い値のみ上書きする
975 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
977 bool set_tsubureru(TIME_EFFECT v, bool do_dec)
981 /* Hack -- Force good values */
982 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
984 if (p_ptr->is_dead) return FALSE;
989 if (p_ptr->tsubureru && !do_dec)
991 if (p_ptr->tsubureru > v) return FALSE;
993 else if (!p_ptr->tsubureru)
995 msg_print(_("横に伸びた。", "Your body expands horizontally."));
1003 if (p_ptr->tsubureru)
1005 msg_print(_("もう横に伸びていない。", "Your body returns to normal."));
1011 p_ptr->tsubureru = v;
1013 /* Redraw status bar */
1014 p_ptr->redraw |= (PR_STATUS);
1016 /* Nothing to notice */
1017 if (!notice) return (FALSE);
1019 if (disturb_state) disturb(FALSE, FALSE);
1021 /* Recalculate bonuses */
1022 p_ptr->update |= (PU_BONUS);
1029 * @brief 魔法の鎧の継続時間をセットする / Set "p_ptr->magicdef", notice observable changes
1031 * @param do_dec 現在の継続時間より長い値のみ上書きする
1032 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1034 bool set_magicdef(TIME_EFFECT v, bool do_dec)
1036 bool notice = FALSE;
1038 /* Hack -- Force good values */
1039 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1041 if (p_ptr->is_dead) return FALSE;
1046 if (p_ptr->magicdef && !do_dec)
1048 if (p_ptr->magicdef > v) return FALSE;
1050 else if (!p_ptr->magicdef)
1052 msg_print(_("魔法の防御力が増したような気がする。", "You feel more resistant to magic."));
1060 if (p_ptr->magicdef)
1062 msg_print(_("魔法の防御力が元に戻った。", "You feel less resistant to magic."));
1068 p_ptr->magicdef = v;
1070 /* Redraw status bar */
1071 p_ptr->redraw |= (PR_STATUS);
1073 /* Nothing to notice */
1074 if (!notice) return (FALSE);
1076 if (disturb_state) disturb(FALSE, FALSE);
1078 /* Recalculate bonuses */
1079 p_ptr->update |= (PU_BONUS);
1085 * @brief 祝福の継続時間をセットする / Set "p_ptr->blessed", notice observable changes
1087 * @param do_dec 現在の継続時間より長い値のみ上書きする
1088 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1090 bool set_blessed(TIME_EFFECT v, bool do_dec)
1092 bool notice = FALSE;
1094 /* Hack -- Force good values */
1095 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1097 if (p_ptr->is_dead) return FALSE;
1102 if (p_ptr->blessed && !do_dec)
1104 if (p_ptr->blessed > v) return FALSE;
1106 else if (!IS_BLESSED())
1108 msg_print(_("高潔な気分になった!", "You feel righteous!"));
1116 if (p_ptr->blessed && !music_singing(MUSIC_BLESS))
1118 msg_print(_("高潔な気分が消え失せた。", "The prayer has expired."));
1126 /* Redraw status bar */
1127 p_ptr->redraw |= (PR_STATUS);
1129 /* Nothing to notice */
1130 if (!notice) return (FALSE);
1132 if (disturb_state) disturb(FALSE, FALSE);
1134 /* Recalculate bonuses */
1135 p_ptr->update |= (PU_BONUS);
1142 * @brief 士気高揚の継続時間をセットする / Set "p_ptr->hero", notice observable changes
1144 * @param do_dec 現在の継続時間より長い値のみ上書きする
1145 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1147 bool set_hero(TIME_EFFECT v, bool do_dec)
1149 bool notice = FALSE;
1151 /* Hack -- Force good values */
1152 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1154 if (p_ptr->is_dead) return FALSE;
1159 if (p_ptr->hero && !do_dec)
1161 if (p_ptr->hero > v) return FALSE;
1163 else if (!IS_HERO())
1165 msg_print(_("ヒーローになった気がする!", "You feel like a hero!"));
1173 if (p_ptr->hero && !music_singing(MUSIC_HERO) && !music_singing(MUSIC_SHERO))
1175 msg_print(_("ヒーローの気分が消え失せた。", "The heroism wears off."));
1183 /* Redraw status bar */
1184 p_ptr->redraw |= (PR_STATUS);
1186 /* Nothing to notice */
1187 if (!notice) return (FALSE);
1189 if (disturb_state) disturb(FALSE, FALSE);
1191 /* Recalculate bonuses */
1192 p_ptr->update |= (PU_BONUS);
1194 /* Recalculate hitpoints */
1195 p_ptr->update |= (PU_HP);
1201 * @brief 狂戦士化の継続時間をセットする / Set "p_ptr->shero", notice observable changes
1202 * @param v 継続時間/ 0ならば無条件にリセット
1203 * @param do_dec FALSEの場合現在の継続時間より長い値のみ上書きする
1204 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1206 bool set_shero(TIME_EFFECT v, bool do_dec)
1208 bool notice = FALSE;
1210 /* Hack -- Force good values */
1211 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1213 if (p_ptr->is_dead) return FALSE;
1215 if (p_ptr->pclass == CLASS_BERSERKER) v = 1;
1219 if (p_ptr->shero && !do_dec)
1221 if (p_ptr->shero > v) return FALSE;
1223 else if (!p_ptr->shero)
1225 msg_print(_("殺戮マシーンになった気がする!", "You feel like a killing machine!"));
1235 msg_print(_("野蛮な気持ちが消え失せた。", "You feel less Berserk."));
1243 /* Redraw status bar */
1244 p_ptr->redraw |= (PR_STATUS);
1246 /* Nothing to notice */
1247 if (!notice) return (FALSE);
1249 if (disturb_state) disturb(FALSE, FALSE);
1251 /* Recalculate bonuses */
1252 p_ptr->update |= (PU_BONUS);
1254 /* Recalculate hitpoints */
1255 p_ptr->update |= (PU_HP);
1261 * @brief 対邪悪結界の継続時間をセットする / Set "p_ptr->protevil", notice observable changes
1263 * @param do_dec 現在の継続時間より長い値のみ上書きする
1264 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1266 bool set_protevil(TIME_EFFECT v, bool do_dec)
1268 bool notice = FALSE;
1270 /* Hack -- Force good values */
1271 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1273 if (p_ptr->is_dead) return FALSE;
1278 if (p_ptr->protevil && !do_dec)
1280 if (p_ptr->protevil > v) return FALSE;
1282 else if (!p_ptr->protevil)
1284 msg_print(_("邪悪なる存在から守られているような感じがする!", "You feel safe from evil!"));
1292 if (p_ptr->protevil)
1294 msg_print(_("邪悪なる存在から守られている感じがなくなった。", "You no longer feel safe from evil."));
1300 p_ptr->protevil = v;
1302 /* Redraw status bar */
1303 p_ptr->redraw |= (PR_STATUS);
1305 /* Nothing to notice */
1306 if (!notice) return (FALSE);
1308 if (disturb_state) disturb(FALSE, FALSE);
1314 * @brief 幽体化の継続時間をセットする / Set "p_ptr->wraith_form", notice observable changes
1316 * @param do_dec 現在の継続時間より長い値のみ上書きする
1317 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1319 bool set_wraith_form(TIME_EFFECT v, bool do_dec)
1321 bool notice = FALSE;
1323 /* Hack -- Force good values */
1324 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1326 if (p_ptr->is_dead) return FALSE;
1331 if (p_ptr->wraith_form && !do_dec)
1333 if (p_ptr->wraith_form > v) return FALSE;
1335 else if (!p_ptr->wraith_form)
1337 msg_print(_("物質界を離れて幽鬼のような存在になった!", "You leave the physical world and turn into a wraith-being!"));
1339 chg_virtue(V_UNLIFE, 3);
1340 chg_virtue(V_HONOUR, -2);
1341 chg_virtue(V_SACRIFICE, -2);
1342 chg_virtue(V_VALOUR, -5);
1344 p_ptr->redraw |= (PR_MAP);
1345 p_ptr->update |= (PU_MONSTERS);
1347 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1354 if (p_ptr->wraith_form)
1356 msg_print(_("不透明になった感じがする。", "You feel opaque."));
1359 p_ptr->redraw |= (PR_MAP);
1360 p_ptr->update |= (PU_MONSTERS);
1362 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1367 p_ptr->wraith_form = v;
1369 /* Redraw status bar */
1370 p_ptr->redraw |= (PR_STATUS);
1372 /* Nothing to notice */
1373 if (!notice) return (FALSE);
1375 if (disturb_state) disturb(FALSE, FALSE);
1377 /* Recalculate bonuses */
1378 p_ptr->update |= (PU_BONUS);
1385 * @brief 無傷球の継続時間をセットする / Set "p_ptr->invuln", notice observable changes
1387 * @param do_dec 現在の継続時間より長い値のみ上書きする
1388 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1390 bool set_invuln(TIME_EFFECT v, bool do_dec)
1392 bool notice = FALSE;
1394 /* Hack -- Force good values */
1395 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1397 if (p_ptr->is_dead) return FALSE;
1402 if (p_ptr->invuln && !do_dec)
1404 if (p_ptr->invuln > v) return FALSE;
1406 else if (!IS_INVULN())
1408 msg_print(_("無敵だ!", "Invulnerability!"));
1411 chg_virtue(V_UNLIFE, -2);
1412 chg_virtue(V_HONOUR, -2);
1413 chg_virtue(V_SACRIFICE, -3);
1414 chg_virtue(V_VALOUR, -5);
1416 p_ptr->redraw |= (PR_MAP);
1417 p_ptr->update |= (PU_MONSTERS);
1419 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1426 if (p_ptr->invuln && !music_singing(MUSIC_INVULN))
1428 msg_print(_("無敵ではなくなった。", "The invulnerability wears off."));
1431 p_ptr->redraw |= (PR_MAP);
1432 p_ptr->update |= (PU_MONSTERS);
1434 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1436 p_ptr->energy_need += ENERGY_NEED();
1443 /* Redraw status bar */
1444 p_ptr->redraw |= (PR_STATUS);
1446 /* Nothing to notice */
1447 if (!notice) return (FALSE);
1449 if (disturb_state) disturb(FALSE, FALSE);
1451 /* Recalculate bonuses */
1452 p_ptr->update |= (PU_BONUS);
1458 * @brief 時限ESPの継続時間をセットする / Set "p_ptr->tim_esp", notice observable changes
1460 * @param do_dec 現在の継続時間より長い値のみ上書きする
1461 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1463 bool set_tim_esp(TIME_EFFECT v, bool do_dec)
1465 bool notice = FALSE;
1467 /* Hack -- Force good values */
1468 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1470 if (p_ptr->is_dead) return FALSE;
1475 if (p_ptr->tim_esp && !do_dec)
1477 if (p_ptr->tim_esp > v) return FALSE;
1479 else if (!IS_TIM_ESP())
1481 msg_print(_("意識が広がった気がする!", "You feel your consciousness expand!"));
1489 if (p_ptr->tim_esp && !music_singing(MUSIC_MIND))
1491 msg_print(_("意識は元に戻った。", "Your consciousness contracts again."));
1499 /* Redraw status bar */
1500 p_ptr->redraw |= (PR_STATUS);
1502 /* Nothing to notice */
1503 if (!notice) return (FALSE);
1505 if (disturb_state) disturb(FALSE, FALSE);
1507 /* Recalculate bonuses */
1508 p_ptr->update |= (PU_BONUS);
1509 p_ptr->update |= (PU_MONSTERS);
1515 * @brief 時限透明視の継続時間をセットする / Set "p_ptr->tim_invis", notice observable changes
1517 * @param do_dec 現在の継続時間より長い値のみ上書きする
1518 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1520 bool set_tim_invis(TIME_EFFECT v, bool do_dec)
1522 bool notice = FALSE;
1524 /* Hack -- Force good values */
1525 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1527 if (p_ptr->is_dead) return FALSE;
1532 if (p_ptr->tim_invis && !do_dec)
1534 if (p_ptr->tim_invis > v) return FALSE;
1536 else if (!p_ptr->tim_invis)
1538 msg_print(_("目が非常に敏感になった気がする!", "Your eyes feel very sensitive!"));
1546 if (p_ptr->tim_invis)
1548 msg_print(_("目の敏感さがなくなったようだ。", "Your eyes feel less sensitive."));
1554 p_ptr->tim_invis = v;
1556 /* Redraw status bar */
1557 p_ptr->redraw |= (PR_STATUS);
1559 /* Nothing to notice */
1560 if (!notice) return (FALSE);
1562 if (disturb_state) disturb(FALSE, FALSE);
1564 /* Recalculate bonuses */
1565 p_ptr->update |= (PU_BONUS);
1567 /* Update the monsters */
1568 p_ptr->update |= (PU_MONSTERS);
1574 * @brief 時限赤外線視力の継続時間をセットする / Set "p_ptr->tim_infra", notice observable changes
1576 * @param do_dec 現在の継続時間より長い値のみ上書きする
1577 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1579 bool set_tim_infra(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_infra && !do_dec)
1593 if (p_ptr->tim_infra > v) return FALSE;
1595 else if (!p_ptr->tim_infra)
1597 msg_print(_("目がランランと輝き始めた!", "Your eyes begin to tingle!"));
1605 if (p_ptr->tim_infra)
1607 msg_print(_("目の輝きがなくなった。", "Your eyes stop tingling."));
1613 p_ptr->tim_infra = 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);
1633 * @brief 時限急回復の継続時間をセットする / Set "p_ptr->tim_regen", notice observable changes
1635 * @param do_dec 現在の継続時間より長い値のみ上書きする
1636 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1638 bool set_tim_regen(TIME_EFFECT v, bool do_dec)
1640 bool notice = FALSE;
1642 /* Hack -- Force good values */
1643 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1645 if (p_ptr->is_dead) return FALSE;
1650 if (p_ptr->tim_regen && !do_dec)
1652 if (p_ptr->tim_regen > v) return FALSE;
1654 else if (!p_ptr->tim_regen)
1656 msg_print(_("回復力が上がった!", "You feel yourself regenerating quickly!"));
1664 if (p_ptr->tim_regen)
1666 msg_print(_("素早く回復する感じがなくなった。", "You feel yourself regenerating slowly."));
1672 p_ptr->tim_regen = v;
1674 /* Redraw status bar */
1675 p_ptr->redraw |= (PR_STATUS);
1677 /* Nothing to notice */
1678 if (!notice) return (FALSE);
1680 if (disturb_state) disturb(FALSE, FALSE);
1682 /* Recalculate bonuses */
1683 p_ptr->update |= (PU_BONUS);
1689 * @brief 隠密の歌の継続時間をセットする / Set "p_ptr->tim_stealth", notice observable changes
1691 * @param do_dec 現在の継続時間より長い値のみ上書きする
1692 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1694 bool set_tim_stealth(TIME_EFFECT v, bool do_dec)
1696 bool notice = FALSE;
1698 /* Hack -- Force good values */
1699 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1701 if (p_ptr->is_dead) return FALSE;
1706 if (p_ptr->tim_stealth && !do_dec)
1708 if (p_ptr->tim_stealth > v) return FALSE;
1710 else if (!IS_TIM_STEALTH())
1712 msg_print(_("足音が小さくなった!", "You begin to walk silently!"));
1720 if (p_ptr->tim_stealth && !music_singing(MUSIC_STEALTH))
1722 msg_print(_("足音が大きくなった。", "You no longer walk silently."));
1728 p_ptr->tim_stealth = v;
1730 /* Redraw status bar */
1731 p_ptr->redraw |= (PR_STATUS);
1733 /* Nothing to notice */
1734 if (!notice) return (FALSE);
1736 if (disturb_state) disturb(FALSE, FALSE);
1738 /* Recalculate bonuses */
1739 p_ptr->update |= (PU_BONUS);
1745 * @brief 超隠密状態をセットする
1746 * @param set TRUEならば超隠密状態になる。
1747 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1749 bool set_superstealth(bool set)
1751 bool notice = FALSE;
1753 if (p_ptr->is_dead) return FALSE;
1758 if (!(p_ptr->special_defense & NINJA_S_STEALTH))
1760 if (cave[p_ptr->y][p_ptr->x].info & CAVE_MNLT)
1762 msg_print(_("敵の目から薄い影の中に覆い隠された。", "You are mantled in weak shadow from ordinary eyes."));
1763 p_ptr->monlite = p_ptr->old_monlite = TRUE;
1767 msg_print(_("敵の目から影の中に覆い隠された!", "You are mantled in shadow from ordinary eyes!"));
1768 p_ptr->monlite = p_ptr->old_monlite = FALSE;
1774 p_ptr->special_defense |= NINJA_S_STEALTH;
1781 if (p_ptr->special_defense & NINJA_S_STEALTH)
1783 msg_print(_("再び敵の目にさらされるようになった。", "You are exposed to common sight once more."));
1787 p_ptr->special_defense &= ~(NINJA_S_STEALTH);
1791 /* Nothing to notice */
1792 if (!notice) return (FALSE);
1794 /* Redraw status bar */
1795 p_ptr->redraw |= (PR_STATUS);
1797 if (disturb_state) disturb(FALSE, FALSE);
1802 * @brief 一時的浮遊の継続時間をセットする / Set "p_ptr->tim_levitation", notice observable changes
1804 * @param do_dec 現在の継続時間より長い値のみ上書きする
1805 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1807 bool set_tim_levitation(TIME_EFFECT v, bool do_dec)
1809 bool notice = FALSE;
1811 /* Hack -- Force good values */
1812 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1814 if (p_ptr->is_dead) return FALSE;
1819 if (p_ptr->tim_levitation && !do_dec)
1821 if (p_ptr->tim_levitation > v) return FALSE;
1823 else if (!p_ptr->tim_levitation)
1825 msg_print(_("体が宙に浮き始めた。", "You begin to fly!"));
1833 if (p_ptr->tim_levitation)
1835 msg_print(_("もう宙に浮かべなくなった。", "You stop flying."));
1841 p_ptr->tim_levitation = v;
1843 /* Redraw status bar */
1844 p_ptr->redraw |= (PR_STATUS);
1846 /* Nothing to notice */
1847 if (!notice) return (FALSE);
1849 if (disturb_state) disturb(FALSE, FALSE);
1851 /* Recalculate bonuses */
1852 p_ptr->update |= (PU_BONUS);
1858 * @brief 一時的闘気のオーラの継続時間をセットする / Set "p_ptr->tim_sh_touki", notice observable changes
1860 * @param do_dec 現在の継続時間より長い値のみ上書きする
1861 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1863 bool set_tim_sh_touki(TIME_EFFECT v, bool do_dec)
1865 bool notice = FALSE;
1867 /* Hack -- Force good values */
1868 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1870 if (p_ptr->is_dead) return FALSE;
1875 if (p_ptr->tim_sh_touki && !do_dec)
1877 if (p_ptr->tim_sh_touki > v) return FALSE;
1879 else if (!p_ptr->tim_sh_touki)
1881 msg_print(_("体が闘気のオーラで覆われた。", "You have enveloped by the aura of the Force!"));
1889 if (p_ptr->tim_sh_touki)
1891 msg_print(_("闘気が消えた。", "Aura of the Force disappeared."));
1897 p_ptr->tim_sh_touki = v;
1899 /* Redraw status bar */
1900 p_ptr->redraw |= (PR_STATUS);
1902 /* Nothing to notice */
1903 if (!notice) return (FALSE);
1905 if (disturb_state) disturb(FALSE, FALSE);
1911 * @brief 一時的火炎のオーラの継続時間をセットする / Set "p_ptr->tim_sh_fire", notice observable changes
1913 * @param do_dec 現在の継続時間より長い値のみ上書きする
1914 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1916 bool set_tim_sh_fire(TIME_EFFECT v, bool do_dec)
1918 bool notice = FALSE;
1920 /* Hack -- Force good values */
1921 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1923 if (p_ptr->is_dead) return FALSE;
1928 if (p_ptr->tim_sh_fire && !do_dec)
1930 if (p_ptr->tim_sh_fire > v) return FALSE;
1932 else if (!p_ptr->tim_sh_fire)
1934 msg_print(_("体が炎のオーラで覆われた。", "You have enveloped by fiery aura!"));
1942 if (p_ptr->tim_sh_fire)
1944 msg_print(_("炎のオーラが消えた。", "Fiery aura disappeared."));
1950 p_ptr->tim_sh_fire = v;
1952 /* Redraw status bar */
1953 p_ptr->redraw |= (PR_STATUS);
1955 /* Nothing to notice */
1956 if (!notice) return (FALSE);
1958 if (disturb_state) disturb(FALSE, FALSE);
1960 /* Recalculate bonuses */
1961 p_ptr->update |= (PU_BONUS);
1967 * @brief 一時的聖なるのオーラの継続時間をセットする / Set "p_ptr->tim_sh_holy", notice observable changes
1969 * @param do_dec 現在の継続時間より長い値のみ上書きする
1970 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1972 bool set_tim_sh_holy(TIME_EFFECT v, bool do_dec)
1974 bool notice = FALSE;
1976 /* Hack -- Force good values */
1977 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1979 if (p_ptr->is_dead) return FALSE;
1984 if (p_ptr->tim_sh_holy && !do_dec)
1986 if (p_ptr->tim_sh_holy > v) return FALSE;
1988 else if (!p_ptr->tim_sh_holy)
1990 msg_print(_("体が聖なるオーラで覆われた。", "You have enveloped by holy aura!"));
1998 if (p_ptr->tim_sh_holy)
2000 msg_print(_("聖なるオーラが消えた。", "Holy aura disappeared."));
2006 p_ptr->tim_sh_holy = v;
2008 /* Redraw status bar */
2009 p_ptr->redraw |= (PR_STATUS);
2011 /* Nothing to notice */
2012 if (!notice) return (FALSE);
2014 if (disturb_state) disturb(FALSE, FALSE);
2016 /* Recalculate bonuses */
2017 p_ptr->update |= (PU_BONUS);
2023 * @brief 目には目をの残り時間をセットする / Set "p_ptr->tim_eyeeye", notice observable changes
2025 * @param do_dec 現在の継続時間より長い値のみ上書きする
2026 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2028 bool set_tim_eyeeye(TIME_EFFECT v, bool do_dec)
2030 bool notice = FALSE;
2032 /* Hack -- Force good values */
2033 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2035 if (p_ptr->is_dead) return FALSE;
2040 if (p_ptr->tim_eyeeye && !do_dec)
2042 if (p_ptr->tim_eyeeye > v) return FALSE;
2044 else if (!p_ptr->tim_eyeeye)
2046 msg_print(_("法の守り手になった気がした!", "You feel like a keeper of commandments!"));
2054 if (p_ptr->tim_eyeeye)
2056 msg_print(_("懲罰を執行することができなくなった。", "You no longer feel like a keeper."));
2062 p_ptr->tim_eyeeye = v;
2064 /* Redraw status bar */
2065 p_ptr->redraw |= (PR_STATUS);
2067 /* Nothing to notice */
2068 if (!notice) return (FALSE);
2070 if (disturb_state) disturb(FALSE, FALSE);
2072 /* Recalculate bonuses */
2073 p_ptr->update |= (PU_BONUS);
2080 * @brief 一時的魔法防御の継続時間をセットする / Set "p_ptr->resist_magic", notice observable changes
2082 * @param do_dec 現在の継続時間より長い値のみ上書きする
2083 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2085 bool set_resist_magic(TIME_EFFECT v, bool do_dec)
2087 bool notice = FALSE;
2089 /* Hack -- Force good values */
2090 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2092 if (p_ptr->is_dead) return FALSE;
2097 if (p_ptr->resist_magic && !do_dec)
2099 if (p_ptr->resist_magic > v) return FALSE;
2101 else if (!p_ptr->resist_magic)
2103 msg_print(_("魔法への耐性がついた。", "You have been protected from magic!"));
2111 if (p_ptr->resist_magic)
2113 msg_print(_("魔法に弱くなった。", "You are no longer protected from magic."));
2119 p_ptr->resist_magic = v;
2121 /* Redraw status bar */
2122 p_ptr->redraw |= (PR_STATUS);
2124 /* Nothing to notice */
2125 if (!notice) return (FALSE);
2127 if (disturb_state) disturb(FALSE, FALSE);
2129 /* Recalculate bonuses */
2130 p_ptr->update |= (PU_BONUS);
2136 * @brief 一時的反射の継続時間をセットする / Set "p_ptr->tim_reflect", notice observable changes
2138 * @param do_dec 現在の継続時間より長い値のみ上書きする
2139 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2141 bool set_tim_reflect(TIME_EFFECT v, bool do_dec)
2143 bool notice = FALSE;
2145 /* Hack -- Force good values */
2146 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2148 if (p_ptr->is_dead) return FALSE;
2153 if (p_ptr->tim_reflect && !do_dec)
2155 if (p_ptr->tim_reflect > v) return FALSE;
2157 else if (!p_ptr->tim_reflect)
2159 msg_print(_("体の表面が滑かになった気がする。", "Your body becames smooth."));
2167 if (p_ptr->tim_reflect)
2169 msg_print(_("体の表面が滑かでなくなった。", "Your body is no longer smooth."));
2175 p_ptr->tim_reflect = v;
2177 /* Redraw status bar */
2178 p_ptr->redraw |= (PR_STATUS);
2180 /* Nothing to notice */
2181 if (!notice) return (FALSE);
2183 if (disturb_state) disturb(FALSE, FALSE);
2185 /* Recalculate bonuses */
2186 p_ptr->update |= (PU_BONUS);
2193 * Set "p_ptr->multishadow", notice observable changes
2195 bool set_multishadow(TIME_EFFECT v, bool do_dec)
2197 bool notice = FALSE;
2199 /* Hack -- Force good values */
2200 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2202 if (p_ptr->is_dead) return FALSE;
2207 if (p_ptr->multishadow && !do_dec)
2209 if (p_ptr->multishadow > v) return FALSE;
2211 else if (!p_ptr->multishadow)
2213 msg_print(_("あなたの周りに幻影が生まれた。", "Your Shadow enveloped you."));
2221 if (p_ptr->multishadow)
2223 msg_print(_("幻影が消えた。", "Your Shadow disappears."));
2229 p_ptr->multishadow = v;
2231 /* Redraw status bar */
2232 p_ptr->redraw |= (PR_STATUS);
2234 /* Nothing to notice */
2235 if (!notice) return (FALSE);
2237 if (disturb_state) disturb(FALSE, FALSE);
2239 /* Recalculate bonuses */
2240 p_ptr->update |= (PU_BONUS);
2246 * @brief 一時的破片のオーラの継続時間をセットする / Set "p_ptr->dustrobe", notice observable changes
2248 * @param do_dec 現在の継続時間より長い値のみ上書きする
2249 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2251 bool set_dustrobe(TIME_EFFECT v, bool do_dec)
2253 bool notice = FALSE;
2255 /* Hack -- Force good values */
2256 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2258 if (p_ptr->is_dead) return FALSE;
2263 if (p_ptr->dustrobe && !do_dec)
2265 if (p_ptr->dustrobe > v) return FALSE;
2267 else if (!p_ptr->dustrobe)
2269 msg_print(_("体が鏡のオーラで覆われた。", "You were enveloped by mirror shards."));
2277 if (p_ptr->dustrobe)
2279 msg_print(_("鏡のオーラが消えた。", "The mirror shards disappear."));
2285 p_ptr->dustrobe = v;
2287 /* Redraw status bar */
2288 p_ptr->redraw |= (PR_STATUS);
2290 /* Nothing to notice */
2291 if (!notice) return (FALSE);
2293 if (disturb_state) disturb(FALSE, FALSE);
2295 /* Recalculate bonuses */
2296 p_ptr->update |= (PU_BONUS);
2302 * @brief 一時的壁抜けの継続時間をセットする / Set "p_ptr->kabenuke", notice observable changes
2304 * @param do_dec 現在の継続時間より長い値のみ上書きする
2305 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2307 bool set_kabenuke(TIME_EFFECT v, bool do_dec)
2309 bool notice = FALSE;
2311 /* Hack -- Force good values */
2312 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2314 if (p_ptr->is_dead) return FALSE;
2319 if (p_ptr->kabenuke && !do_dec)
2321 if (p_ptr->kabenuke > v) return FALSE;
2323 else if (!p_ptr->kabenuke)
2325 msg_print(_("体が半物質の状態になった。", "You became ethereal form."));
2333 if (p_ptr->kabenuke)
2335 msg_print(_("体が物質化した。", "You are no longer in an ethereal form."));
2341 p_ptr->kabenuke = v;
2343 /* Redraw status bar */
2344 p_ptr->redraw |= (PR_STATUS);
2346 /* Nothing to notice */
2347 if (!notice) return (FALSE);
2349 if (disturb_state) disturb(FALSE, FALSE);
2351 /* Recalculate bonuses */
2352 p_ptr->update |= (PU_BONUS);
2358 * @brief オクレ兄さんの継続時間をセットする / Set "p_ptr->tsuyoshi", notice observable changes
2360 * @param do_dec 現在の継続時間より長い値のみ上書きする
2361 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2363 bool set_tsuyoshi(TIME_EFFECT v, bool do_dec)
2365 bool notice = FALSE;
2367 /* Hack -- Force good values */
2368 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2370 if (p_ptr->is_dead) return FALSE;
2375 if (p_ptr->tsuyoshi && !do_dec)
2377 if (p_ptr->tsuyoshi > v) return FALSE;
2379 else if (!p_ptr->tsuyoshi)
2381 msg_print(_("「オクレ兄さん!」", "Brother OKURE!"));
2383 chg_virtue(V_VITALITY, 2);
2390 if (p_ptr->tsuyoshi)
2392 msg_print(_("肉体が急速にしぼんでいった。", "Your body had quickly shriveled."));
2394 (void)dec_stat(A_CON, 20, TRUE);
2395 (void)dec_stat(A_STR, 20, TRUE);
2398 chg_virtue(V_VITALITY, -3);
2403 p_ptr->tsuyoshi = v;
2405 /* Redraw status bar */
2406 p_ptr->redraw |= (PR_STATUS);
2408 /* Nothing to notice */
2409 if (!notice) return (FALSE);
2411 if (disturb_state) disturb(FALSE, FALSE);
2413 /* Recalculate bonuses */
2414 p_ptr->update |= (PU_BONUS);
2416 /* Recalculate hitpoints */
2417 p_ptr->update |= (PU_HP);
2423 * @brief 一時的元素スレイの継続時間をセットする / Set a temporary elemental brand. Clear all other brands. Print status messages. -LM-
2424 * @param attack_type スレイのタイプID
2426 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2428 bool set_ele_attack(u32b attack_type, TIME_EFFECT v)
2430 /* Hack -- Force good values */
2431 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2433 /* Clear all elemental attacks (only one is allowed at a time). */
2434 if ((p_ptr->special_attack & (ATTACK_ACID)) && (attack_type != ATTACK_ACID))
2436 p_ptr->special_attack &= ~(ATTACK_ACID);
2437 msg_print(_("酸で攻撃できなくなった。", "Your temporary acidic brand fades away."));
2439 if ((p_ptr->special_attack & (ATTACK_ELEC)) && (attack_type != ATTACK_ELEC))
2441 p_ptr->special_attack &= ~(ATTACK_ELEC);
2442 msg_print(_("電撃で攻撃できなくなった。", "Your temporary electrical brand fades away."));
2444 if ((p_ptr->special_attack & (ATTACK_FIRE)) && (attack_type != ATTACK_FIRE))
2446 p_ptr->special_attack &= ~(ATTACK_FIRE);
2447 msg_print(_("火炎で攻撃できなくなった。", "Your temporary fiery brand fades away."));
2449 if ((p_ptr->special_attack & (ATTACK_COLD)) && (attack_type != ATTACK_COLD))
2451 p_ptr->special_attack &= ~(ATTACK_COLD);
2452 msg_print(_("冷気で攻撃できなくなった。", "Your temporary frost brand fades away."));
2454 if ((p_ptr->special_attack & (ATTACK_POIS)) && (attack_type != ATTACK_POIS))
2456 p_ptr->special_attack &= ~(ATTACK_POIS);
2457 msg_print(_("毒で攻撃できなくなった。", "Your temporary poison brand fades away."));
2460 if ((v) && (attack_type))
2462 /* Set attack type. */
2463 p_ptr->special_attack |= (attack_type);
2466 p_ptr->ele_attack = v;
2470 msg_format("%sで攻撃できるようになった!",
2471 ((attack_type == ATTACK_ACID) ? "酸" :
2472 ((attack_type == ATTACK_ELEC) ? "電撃" :
2473 ((attack_type == ATTACK_FIRE) ? "火炎" :
2474 ((attack_type == ATTACK_COLD) ? "冷気" :
2475 ((attack_type == ATTACK_POIS) ? "毒" :
2478 msg_format("For a while, the blows you deal will %s",
2479 ((attack_type == ATTACK_ACID) ? "melt with acid!" :
2480 ((attack_type == ATTACK_ELEC) ? "shock your foes!" :
2481 ((attack_type == ATTACK_FIRE) ? "burn with fire!" :
2482 ((attack_type == ATTACK_COLD) ? "chill to the bone!" :
2483 ((attack_type == ATTACK_POIS) ? "poison your enemies!" :
2484 "do nothing special."))))));
2488 if (disturb_state) disturb(FALSE, FALSE);
2490 /* Redraw status bar */
2491 p_ptr->redraw |= (PR_STATUS);
2493 p_ptr->update |= (PU_BONUS);
2500 * @brief 一時的元素免疫の継続時間をセットする / Set a temporary elemental brand. Clear all other brands. Print status messages. -LM-
2501 * @param immune_type 免疫のタイプID
2503 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2505 bool set_ele_immune(u32b immune_type, TIME_EFFECT v)
2507 /* Hack -- Force good values */
2508 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2510 /* Clear all elemental attacks (only one is allowed at a time). */
2511 if ((p_ptr->special_defense & (DEFENSE_ACID)) && (immune_type != DEFENSE_ACID))
2513 p_ptr->special_defense &= ~(DEFENSE_ACID);
2514 msg_print(_("酸の攻撃で傷つけられるようになった。。", "You are no longer immune to acid."));
2516 if ((p_ptr->special_defense & (DEFENSE_ELEC)) && (immune_type != DEFENSE_ELEC))
2518 p_ptr->special_defense &= ~(DEFENSE_ELEC);
2519 msg_print(_("電撃の攻撃で傷つけられるようになった。。", "You are no longer immune to electricity."));
2521 if ((p_ptr->special_defense & (DEFENSE_FIRE)) && (immune_type != DEFENSE_FIRE))
2523 p_ptr->special_defense &= ~(DEFENSE_FIRE);
2524 msg_print(_("火炎の攻撃で傷つけられるようになった。。", "You are no longer immune to fire."));
2526 if ((p_ptr->special_defense & (DEFENSE_COLD)) && (immune_type != DEFENSE_COLD))
2528 p_ptr->special_defense &= ~(DEFENSE_COLD);
2529 msg_print(_("冷気の攻撃で傷つけられるようになった。。", "You are no longer immune to cold."));
2531 if ((p_ptr->special_defense & (DEFENSE_POIS)) && (immune_type != DEFENSE_POIS))
2533 p_ptr->special_defense &= ~(DEFENSE_POIS);
2534 msg_print(_("毒の攻撃で傷つけられるようになった。。", "You are no longer immune to poison."));
2537 if ((v) && (immune_type))
2539 /* Set attack type. */
2540 p_ptr->special_defense |= (immune_type);
2543 p_ptr->ele_immune = v;
2547 msg_format("%sの攻撃を受けつけなくなった!",
2548 ((immune_type == DEFENSE_ACID) ? "酸" :
2549 ((immune_type == DEFENSE_ELEC) ? "電撃" :
2550 ((immune_type == DEFENSE_FIRE) ? "火炎" :
2551 ((immune_type == DEFENSE_COLD) ? "冷気" :
2552 ((immune_type == DEFENSE_POIS) ? "毒" :
2555 msg_format("For a while, You are immune to %s",
2556 ((immune_type == DEFENSE_ACID) ? "acid!" :
2557 ((immune_type == DEFENSE_ELEC) ? "electricity!" :
2558 ((immune_type == DEFENSE_FIRE) ? "fire!" :
2559 ((immune_type == DEFENSE_COLD) ? "cold!" :
2560 ((immune_type == DEFENSE_POIS) ? "poison!" :
2561 "do nothing special."))))));
2565 if (disturb_state) disturb(FALSE, FALSE);
2567 /* Redraw status bar */
2568 p_ptr->redraw |= (PR_STATUS);
2570 p_ptr->update |= (PU_BONUS);
2577 * @brief 一時的酸耐性の継続時間をセットする / Set "p_ptr->oppose_acid", notice observable changes
2579 * @param do_dec 現在の継続時間より長い値のみ上書きする
2580 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2582 bool set_oppose_acid(TIME_EFFECT v, bool do_dec)
2584 bool notice = FALSE;
2586 /* Hack -- Force good values */
2587 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2589 if (p_ptr->is_dead) return FALSE;
2594 if (p_ptr->oppose_acid && !do_dec)
2596 if (p_ptr->oppose_acid > v) return FALSE;
2598 else if (!IS_OPPOSE_ACID())
2600 msg_print(_("酸への耐性がついた気がする!", "You feel resistant to acid!"));
2608 if (p_ptr->oppose_acid && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
2610 msg_print(_("酸への耐性が薄れた気がする。", "You feel less resistant to acid."));
2616 p_ptr->oppose_acid = v;
2618 /* Nothing to notice */
2619 if (!notice) return (FALSE);
2621 /* Redraw status bar */
2622 p_ptr->redraw |= (PR_STATUS);
2624 if (disturb_state) disturb(FALSE, FALSE);
2630 * @brief 一時的電撃耐性の継続時間をセットする / Set "p_ptr->oppose_elec", notice observable changes
2632 * @param do_dec 現在の継続時間より長い値のみ上書きする
2633 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2635 bool set_oppose_elec(TIME_EFFECT v, bool do_dec)
2637 bool notice = FALSE;
2639 /* Hack -- Force good values */
2640 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2642 if (p_ptr->is_dead) return FALSE;
2647 if (p_ptr->oppose_elec && !do_dec)
2649 if (p_ptr->oppose_elec > v) return FALSE;
2651 else if (!IS_OPPOSE_ELEC())
2653 msg_print(_("電撃への耐性がついた気がする!", "You feel resistant to electricity!"));
2661 if (p_ptr->oppose_elec && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
2663 msg_print(_("電撃への耐性が薄れた気がする。", "You feel less resistant to electricity."));
2669 p_ptr->oppose_elec = v;
2671 /* Nothing to notice */
2672 if (!notice) return (FALSE);
2674 /* Redraw status bar */
2675 p_ptr->redraw |= (PR_STATUS);
2677 if (disturb_state) disturb(FALSE, FALSE);
2683 * @brief 一時的火炎耐性の継続時間をセットする / Set "p_ptr->oppose_fire", notice observable changes
2685 * @param do_dec 現在の継続時間より長い値のみ上書きする
2686 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2688 bool set_oppose_fire(TIME_EFFECT v, bool do_dec)
2690 bool notice = FALSE;
2692 /* Hack -- Force good values */
2693 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2695 if (p_ptr->is_dead) return FALSE;
2697 if ((prace_is_(RACE_DEMON) && (p_ptr->lev > 44)) || (p_ptr->mimic_form == MIMIC_DEMON)) v = 1;
2701 if (p_ptr->oppose_fire && !do_dec)
2703 if (p_ptr->oppose_fire > v) return FALSE;
2705 else if (!IS_OPPOSE_FIRE())
2707 msg_print(_("火への耐性がついた気がする!", "You feel resistant to fire!"));
2715 if (p_ptr->oppose_fire && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
2717 msg_print(_("火への耐性が薄れた気がする。", "You feel less resistant to fire."));
2723 p_ptr->oppose_fire = v;
2725 /* Nothing to notice */
2726 if (!notice) return (FALSE);
2728 /* Redraw status bar */
2729 p_ptr->redraw |= (PR_STATUS);
2731 if (disturb_state) disturb(FALSE, FALSE);
2737 * @brief 一時的冷気耐性の継続時間をセットする / Set "p_ptr->oppose_cold", notice observable changes
2739 * @param do_dec 現在の継続時間より長い値のみ上書きする
2740 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2742 bool set_oppose_cold(TIME_EFFECT v, bool do_dec)
2744 bool notice = FALSE;
2746 /* Hack -- Force good values */
2747 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2749 if (p_ptr->is_dead) return FALSE;
2754 if (p_ptr->oppose_cold && !do_dec)
2756 if (p_ptr->oppose_cold > v) return FALSE;
2758 else if (!IS_OPPOSE_COLD())
2760 msg_print(_("冷気への耐性がついた気がする!", "You feel resistant to cold!"));
2768 if (p_ptr->oppose_cold && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
2770 msg_print(_("冷気への耐性が薄れた気がする。", "You feel less resistant to cold."));
2776 p_ptr->oppose_cold = v;
2778 /* Nothing to notice */
2779 if (!notice) return (FALSE);
2781 /* Redraw status bar */
2782 p_ptr->redraw |= (PR_STATUS);
2784 if (disturb_state) disturb(FALSE, FALSE);
2790 * @brief 一時的毒耐性の継続時間をセットする / Set "p_ptr->oppose_pois", notice observable changes
2792 * @param do_dec 現在の継続時間より長い値のみ上書きする
2793 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2795 bool set_oppose_pois(TIME_EFFECT v, bool do_dec)
2797 bool notice = FALSE;
2799 /* Hack -- Force good values */
2800 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2802 if ((p_ptr->pclass == CLASS_NINJA) && (p_ptr->lev > 44)) v = 1;
2803 if (p_ptr->is_dead) return FALSE;
2808 if (p_ptr->oppose_pois && !do_dec)
2810 if (p_ptr->oppose_pois > v) return FALSE;
2812 else if (!IS_OPPOSE_POIS())
2814 msg_print(_("毒への耐性がついた気がする!", "You feel resistant to poison!"));
2822 if (p_ptr->oppose_pois && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
2824 msg_print(_("毒への耐性が薄れた気がする。", "You feel less resistant to poison."));
2830 p_ptr->oppose_pois = v;
2832 /* Nothing to notice */
2833 if (!notice) return (FALSE);
2835 /* Redraw status bar */
2836 p_ptr->redraw |= (PR_STATUS);
2838 if (disturb_state) disturb(FALSE, FALSE);
2844 * @brief 朦朧の継続時間をセットする / Set "p_ptr->stun", notice observable changes
2846 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2848 * Note the special code to only notice "range" changes.
2850 bool set_stun(TIME_EFFECT v)
2852 int old_aux, new_aux;
2853 bool notice = FALSE;
2856 /* Hack -- Force good values */
2857 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2859 if (p_ptr->is_dead) return FALSE;
2861 if (prace_is_(RACE_GOLEM) || ((p_ptr->pclass == CLASS_BERSERKER) && (p_ptr->lev > 34))) v = 0;
2864 if (p_ptr->stun > 100)
2870 else if (p_ptr->stun > 50)
2876 else if (p_ptr->stun > 0)
2912 if (new_aux > old_aux)
2914 /* Describe the state */
2918 case 1: msg_print(_("意識がもうろうとしてきた。", "You have been stunned.")); break;
2921 case 2: msg_print(_("意識がひどくもうろうとしてきた。", "You have been heavily stunned.")); break;
2924 case 3: msg_print(_("頭がクラクラして意識が遠のいてきた。", "You have been knocked out.")); break;
2927 if (randint1(1000) < v || one_in_(16))
2929 msg_print(_("割れるような頭痛がする。", "A vicious blow hits your head."));
2933 if (!p_ptr->sustain_int) (void)do_dec_stat(A_INT);
2934 if (!p_ptr->sustain_wis) (void)do_dec_stat(A_WIS);
2936 else if (one_in_(2))
2938 if (!p_ptr->sustain_int) (void)do_dec_stat(A_INT);
2942 if (!p_ptr->sustain_wis) (void)do_dec_stat(A_WIS);
2945 if (p_ptr->special_defense & KATA_MASK)
2947 msg_print(_("型が崩れた。", "Your posture gets loose."));
2948 p_ptr->special_defense &= ~(KATA_MASK);
2949 p_ptr->update |= (PU_BONUS);
2950 p_ptr->update |= (PU_MONSTERS);
2951 p_ptr->redraw |= (PR_STATE);
2952 p_ptr->redraw |= (PR_STATUS);
2953 p_ptr->action = ACTION_NONE;
2957 if (p_ptr->concent) reset_concentration(TRUE);
2960 if (hex_spelling_any()) stop_hex_spell_all();
2966 else if (new_aux < old_aux)
2968 /* Describe the state */
2973 msg_print(_("やっと朦朧状態から回復した。", "You are no longer stunned."));
2975 if (disturb_state) disturb(FALSE, FALSE);
2986 if (!notice) return (FALSE);
2988 if (disturb_state) disturb(FALSE, FALSE);
2990 /* Recalculate bonuses */
2991 p_ptr->update |= (PU_BONUS);
2993 /* Redraw the "stun" */
2994 p_ptr->redraw |= (PR_STUN);
3001 * @brief 出血の継続時間をセットする / Set "p_ptr->cut", notice observable changes
3003 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
3005 * Note the special code to only notice "range" changes.
3007 bool set_cut(TIME_EFFECT v)
3009 int old_aux, new_aux;
3010 bool notice = FALSE;
3012 /* Hack -- Force good values */
3013 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
3015 if (p_ptr->is_dead) return FALSE;
3017 if ((p_ptr->prace == RACE_GOLEM ||
3018 p_ptr->prace == RACE_SKELETON ||
3019 p_ptr->prace == RACE_SPECTRE ||
3020 (p_ptr->prace == RACE_ZOMBIE && p_ptr->lev > 11)) &&
3025 if (p_ptr->cut > 1000)
3031 else if (p_ptr->cut > 200)
3037 else if (p_ptr->cut > 100)
3043 else if (p_ptr->cut > 50)
3049 else if (p_ptr->cut > 25)
3055 else if (p_ptr->cut > 10)
3061 else if (p_ptr->cut > 0)
3121 if (new_aux > old_aux)
3123 /* Describe the state */
3127 case 1: msg_print(_("かすり傷を負ってしまった。", "You have been given a graze.")); break;
3130 case 2: msg_print(_("軽い傷を負ってしまった。", "You have been given a light cut.")); break;
3133 case 3: msg_print(_("ひどい傷を負ってしまった。", "You have been given a bad cut.")); break;
3136 case 4: msg_print(_("大変な傷を負ってしまった。", "You have been given a nasty cut.")); break;
3139 case 5: msg_print(_("重大な傷を負ってしまった。", "You have been given a severe cut.")); break;
3142 case 6: msg_print(_("ひどい深手を負ってしまった。", "You have been given a deep gash.")); break;
3145 case 7: msg_print(_("致命的な傷を負ってしまった。", "You have been given a mortal wound.")); break;
3150 if (randint1(1000) < v || one_in_(16))
3152 if (!p_ptr->sustain_chr)
3154 msg_print(_("ひどい傷跡が残ってしまった。", "You have been horribly scarred."));
3161 else if (new_aux < old_aux)
3163 /* Describe the state */
3168 msg_format(_("やっと%s。", "You are no longer bleeding."), p_ptr->prace == RACE_ANDROID ? "怪我が直った" : "出血が止まった");
3170 if (disturb_state) disturb(FALSE, FALSE);
3181 if (!notice) return (FALSE);
3183 if (disturb_state) disturb(FALSE, FALSE);
3185 /* Recalculate bonuses */
3186 p_ptr->update |= (PU_BONUS);
3188 /* Redraw the "cut" */
3189 p_ptr->redraw |= (PR_CUT);
3195 * @brief 空腹状態をセットする / Set "p_ptr->food", notice observable changes
3197 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
3199 * Set "", notice observable changes\n
3201 * The "p_ptr->food" variable can get as large as 20000, allowing the
3202 * addition of the most "filling" item, Elvish Waybread, which adds
3203 * 7500 food units, without overflowing the 32767 maximum limit.\n
3205 * Perhaps we should disturb the player with various messages,
3206 * especially messages about hunger status changes. \n
3208 * Digestion of food is handled in "dungeon.c", in which, normally,
3209 * the player digests about 20 food units per 100 game turns, more
3210 * when "fast", more when "regenerating", less with "slow digestion",
3211 * but when the player is "gorged", he digests 100 food units per 10
3212 * game turns, or a full 1000 food units per 100 game turns.\n
3214 * Note that the player's speed is reduced by 10 units while gorged,
3215 * so if the player eats a single food ration (5000 food units) when
3216 * full (15000 food units), he will be gorged for (5000/100)*10 = 500
3217 * game turns, or 500/(100/5) = 25 player turns (if nothing else is
3218 * affecting the player speed).\n
3220 bool set_food(TIME_EFFECT v)
3222 int old_aux, new_aux;
3224 bool notice = FALSE;
3226 /* Hack -- Force good values */
3227 v = (v > 20000) ? 20000 : (v < 0) ? 0 : v;
3229 /* Fainting / Starving */
3230 if (p_ptr->food < PY_FOOD_FAINT)
3236 else if (p_ptr->food < PY_FOOD_WEAK)
3242 else if (p_ptr->food < PY_FOOD_ALERT)
3248 else if (p_ptr->food < PY_FOOD_FULL)
3254 else if (p_ptr->food < PY_FOOD_MAX)
3265 /* Fainting / Starving */
3266 if (v < PY_FOOD_FAINT)
3272 else if (v < PY_FOOD_WEAK)
3278 else if (v < PY_FOOD_ALERT)
3284 else if (v < PY_FOOD_FULL)
3290 else if (v < PY_FOOD_MAX)
3301 if (old_aux < 1 && new_aux > 0)
3302 chg_virtue(V_PATIENCE, 2);
3303 else if (old_aux < 3 && (old_aux != new_aux))
3304 chg_virtue(V_PATIENCE, 1);
3306 chg_virtue(V_TEMPERANCE, 1);
3308 chg_virtue(V_TEMPERANCE, -1);
3311 if (new_aux > old_aux)
3313 /* Describe the state */
3317 case 1: msg_print(_("まだ空腹で倒れそうだ。", "You are still weak.")); break;
3320 case 2: msg_print(_("まだ空腹だ。", "You are still hungry.")); break;
3323 case 3: msg_print(_("空腹感がおさまった。", "You are no longer hungry.")); break;
3326 case 4: msg_print(_("満腹だ!", "You are full!")); break;
3330 msg_print(_("食べ過ぎだ!", "You have gorged yourself!"));
3331 chg_virtue(V_HARMONY, -1);
3332 chg_virtue(V_PATIENCE, -1);
3333 chg_virtue(V_TEMPERANCE, -2);
3343 else if (new_aux < old_aux)
3345 /* Describe the state */
3348 /* Fainting / Starving */
3349 case 0: msg_print(_("あまりにも空腹で気を失ってしまった!", "You are getting faint from hunger!")); break;
3352 case 1: msg_print(_("お腹が空いて倒れそうだ。", "You are getting weak from hunger!")); break;
3355 case 2: msg_print(_("お腹が空いてきた。", "You are getting hungry.")); break;
3358 case 3: msg_print(_("満腹感がなくなった。", "You are no longer full.")); break;
3361 case 4: msg_print(_("やっとお腹がきつくなくなった。", "You are no longer gorged.")); break;
3364 if (p_ptr->wild_mode && (new_aux < 2))
3376 /* Nothing to notice */
3377 if (!notice) return (FALSE);
3379 if (disturb_state) disturb(FALSE, FALSE);
3381 /* Recalculate bonuses */
3382 p_ptr->update |= (PU_BONUS);
3385 p_ptr->redraw |= (PR_HUNGER);
3391 * @brief プレイヤーの基本能力値を増加させる / Increases a stat by one randomized level -RAK-
3392 * @param stat 上昇させるステータスID
3393 * @return 実際に上昇した場合TRUEを返す。
3395 * Note that this function (used by stat potions) now restores\n
3396 * the stat BEFORE increasing it.\n
3398 bool inc_stat(int stat)
3400 BASE_STATUS value, gain;
3402 /* Then augment the current/max stat */
3403 value = p_ptr->stat_cur[stat];
3405 /* Cannot go above 18/100 */
3406 if (value < p_ptr->stat_max_max[stat])
3408 /* Gain one (sometimes two) points */
3411 gain = ((randint0(100) < 75) ? 1 : 2);
3415 /* Gain 1/6 to 1/3 of distance to 18/100 */
3416 else if (value < (p_ptr->stat_max_max[stat]-2))
3418 /* Approximate gain value */
3419 gain = (((p_ptr->stat_max_max[stat]) - value) / 2 + 3) / 2;
3422 if (gain < 1) gain = 1;
3424 /* Apply the bonus */
3425 value += randint1(gain) + gain / 2;
3428 if (value > (p_ptr->stat_max_max[stat]-1)) value = p_ptr->stat_max_max[stat]-1;
3431 /* Gain one point at a time */
3437 /* Save the new value */
3438 p_ptr->stat_cur[stat] = value;
3440 /* Bring up the maximum too */
3441 if (value > p_ptr->stat_max[stat])
3443 p_ptr->stat_max[stat] = value;
3446 /* Recalculate bonuses */
3447 p_ptr->update |= (PU_BONUS);
3453 /* Nothing to gain */
3458 * @brief プレイヤーの基本能力値を減少させる / Decreases a stat by an amount indended to vary from 0 to 100 percent.
3459 * @param stat 減少させるステータスID
3460 * @param amount 減少させる基本量
3461 * @param permanent TRUEならば現在の最大値を減少させる
3462 * @return 実際に減少した場合TRUEを返す。
3465 * Amount could be a little higher in extreme cases to mangle very high\n
3466 * stats from massive assaults. -CWS\n
3468 * Note that "permanent" means that the *given* amount is permanent,\n
3469 * not that the new value becomes permanent. This may not work exactly\n
3470 * as expected, due to "weirdness" in the algorithm, but in general,\n
3471 * if your stat is already drained, the "max" value will not drop all\n
3472 * the way down to the "cur" value.\n
3474 bool dec_stat(int stat, int amount, int permanent)
3476 BASE_STATUS cur, max;
3481 /* Acquire current value */
3482 cur = p_ptr->stat_cur[stat];
3483 max = p_ptr->stat_max[stat];
3485 /* Note when the values are identical */
3486 same = (cur == max);
3488 /* Damage "current" value */
3491 /* Handle "low" values */
3494 if (amount > 90) cur--;
3495 if (amount > 50) cur--;
3496 if (amount > 20) cur--;
3500 /* Handle "high" values */
3503 /* Hack -- Decrement by a random amount between one-quarter */
3504 /* and one-half of the stat bonus times the percentage, with a */
3505 /* minimum damage of half the percentage. -CWS */
3506 loss = (((cur-18) / 2 + 1) / 2 + 1);
3509 if (loss < 1) loss = 1;
3511 /* Randomize the loss */
3512 loss = ((randint1(loss) + loss) * amount) / 100;
3515 if (loss < amount/2) loss = amount/2;
3517 /* Lose some points */
3520 /* Hack -- Only reduce stat to 17 sometimes */
3521 if (cur < 18) cur = (amount <= 20) ? 18 : 17;
3524 /* Prevent illegal values */
3525 if (cur < 3) cur = 3;
3527 /* Something happened */
3528 if (cur != p_ptr->stat_cur[stat]) res = TRUE;
3531 /* Damage "max" value */
3532 if (permanent && (max > 3))
3534 chg_virtue(V_SACRIFICE, 1);
3535 if (stat == A_WIS || stat == A_INT)
3536 chg_virtue(V_ENLIGHTEN, -2);
3538 /* Handle "low" values */
3541 if (amount > 90) max--;
3542 if (amount > 50) max--;
3543 if (amount > 20) max--;
3547 /* Handle "high" values */
3550 /* Hack -- Decrement by a random amount between one-quarter */
3551 /* and one-half of the stat bonus times the percentage, with a */
3552 /* minimum damage of half the percentage. -CWS */
3553 loss = (((max-18) / 2 + 1) / 2 + 1);
3554 loss = ((randint1(loss) + loss) * amount) / 100;
3555 if (loss < amount/2) loss = amount/2;
3557 /* Lose some points */
3560 /* Hack -- Only reduce stat to 17 sometimes */
3561 if (max < 18) max = (amount <= 20) ? 18 : 17;
3564 /* Hack -- keep it clean */
3565 if (same || (max < cur)) max = cur;
3567 /* Something happened */
3568 if (max != p_ptr->stat_max[stat]) res = TRUE;
3574 /* Actually set the stat to its new value. */
3575 p_ptr->stat_cur[stat] = cur;
3576 p_ptr->stat_max[stat] = max;
3578 /* Redisplay the stats later */
3579 p_ptr->redraw |= (PR_STATS);
3581 /* Recalculate bonuses */
3582 p_ptr->update |= (PU_BONUS);
3590 * @brief プレイヤーの基本能力値を回復させる / Restore a stat. Return TRUE only if this actually makes a difference.
3591 * @param stat 回復ステータスID
3592 * @return 実際に回復した場合TRUEを返す。
3594 bool res_stat(int stat)
3596 /* Restore if needed */
3597 if (p_ptr->stat_cur[stat] != p_ptr->stat_max[stat])
3600 p_ptr->stat_cur[stat] = p_ptr->stat_max[stat];
3602 /* Recalculate bonuses */
3603 p_ptr->update |= (PU_BONUS);
3605 /* Redisplay the stats later */
3606 p_ptr->redraw |= (PR_STATS);
3612 /* Nothing to restore */
3618 * Increase players hit points, notice effects
3620 bool hp_player(int num)
3623 vir = virtue_number(V_VITALITY);
3625 if(num <= 0) return (FALSE);
3629 num = num * (p_ptr->virtues[vir - 1] + 1250) / 1250;
3631 /* Healing needed */
3632 if (p_ptr->chp < p_ptr->mhp)
3634 if ((num > 0) && (p_ptr->chp < (p_ptr->mhp/3)))
3635 chg_virtue(V_TEMPERANCE, 1);
3636 /* Gain hitpoints */
3639 /* Enforce maximum */
3640 if (p_ptr->chp >= p_ptr->mhp)
3642 p_ptr->chp = p_ptr->mhp;
3643 p_ptr->chp_frac = 0;
3646 p_ptr->redraw |= (PR_HP);
3648 p_ptr->window |= (PW_PLAYER);
3653 msg_print(_("少し気分が良くなった。", "You feel a little better."));
3659 msg_print(_("気分が良くなった。", "You feel better."));
3665 msg_print(_("とても気分が良くなった。", "You feel much better."));
3671 msg_print(_("ひじょうに気分が良くなった。", "You feel very good."));
3683 * Array of stat "descriptions"
3685 static cptr desc_stat_pos[] =
3690 _("器用に", "dextrous"),
3691 _("健康に", "healthy"),
3697 * Array of stat "descriptions"
3699 static cptr desc_stat_neg[] =
3704 _("不器用に", "clumsy"),
3705 _("不健康に", "sickly"),
3713 bool do_dec_stat(int stat)
3717 /* Access the "sustain" */
3720 case A_STR: if (p_ptr->sustain_str) sust = TRUE; break;
3721 case A_INT: if (p_ptr->sustain_int) sust = TRUE; break;
3722 case A_WIS: if (p_ptr->sustain_wis) sust = TRUE; break;
3723 case A_DEX: if (p_ptr->sustain_dex) sust = TRUE; break;
3724 case A_CON: if (p_ptr->sustain_con) sust = TRUE; break;
3725 case A_CHR: if (p_ptr->sustain_chr) sust = TRUE; break;
3729 if (sust && (!ironman_nightmare || randint0(13)))
3731 msg_format(_("%sなった気がしたが、すぐに元に戻った。", "You feel %s for a moment, but the feeling passes."),
3732 desc_stat_neg[stat]);
3738 /* Attempt to reduce the stat */
3739 if (dec_stat(stat, 10, (ironman_nightmare && !randint0(13))))
3741 msg_format(_("ひどく%sなった気がする。", "You feel very %s."), desc_stat_neg[stat]);
3747 /* Nothing obvious */
3753 * Restore lost "points" in a stat
3755 bool do_res_stat(int stat)
3757 /* Attempt to increase */
3760 msg_format(_("元通りに%sなった気がする。", "You feel less %s."), desc_stat_pos[stat]);
3765 /* Nothing obvious */
3771 * Gain a "point" in a stat
3773 bool do_inc_stat(int stat)
3777 /* Restore strength */
3778 res = res_stat(stat);
3780 /* Attempt to increase */
3785 chg_virtue(V_ENLIGHTEN, 1);
3786 chg_virtue(V_FAITH, 1);
3788 else if (stat == A_INT)
3790 chg_virtue(V_KNOWLEDGE, 1);
3791 chg_virtue(V_ENLIGHTEN, 1);
3793 else if (stat == A_CON)
3794 chg_virtue(V_VITALITY, 1);
3796 msg_format(_("ワーオ!とても%sなった!", "Wow! You feel very %s!"), desc_stat_pos[stat]);
3801 /* Restoration worked */
3804 msg_format(_("元通りに%sなった気がする。", "You feel less %s."), desc_stat_pos[stat]);
3809 /* Nothing obvious */
3815 * Restores any drained experience
3817 bool restore_level(void)
3819 /* Restore experience */
3820 if (p_ptr->exp < p_ptr->max_exp)
3822 msg_print(_("経験値が戻ってきた気がする。", "You feel your experience returning."));
3824 /* Restore the experience */
3825 p_ptr->exp = p_ptr->max_exp;
3827 /* Check the experience */
3841 bool lose_all_info(void)
3845 chg_virtue(V_KNOWLEDGE, -5);
3846 chg_virtue(V_ENLIGHTEN, -5);
3848 /* Forget info about objects */
3849 for (i = 0; i < INVEN_TOTAL; i++)
3851 object_type *o_ptr = &inventory[i];
3853 /* Skip non-objects */
3854 if (!o_ptr->k_idx) continue;
3856 /* Allow "protection" by the MENTAL flag */
3857 if (o_ptr->ident & (IDENT_MENTAL)) continue;
3859 /* Remove "default inscriptions" */
3860 o_ptr->feeling = FEEL_NONE;
3862 /* Hack -- Clear the "empty" flag */
3863 o_ptr->ident &= ~(IDENT_EMPTY);
3865 /* Hack -- Clear the "known" flag */
3866 o_ptr->ident &= ~(IDENT_KNOWN);
3868 /* Hack -- Clear the "felt" flag */
3869 o_ptr->ident &= ~(IDENT_SENSE);
3872 /* Recalculate bonuses */
3873 p_ptr->update |= (PU_BONUS);
3875 /* Combine / Reorder the pack (later) */
3876 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
3878 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
3880 /* Mega-Hack -- Forget the map */
3888 void do_poly_wounds(void)
3890 /* Changed to always provide at least _some_ healing */
3891 s16b wounds = p_ptr->cut;
3892 s16b hit_p = (p_ptr->mhp - p_ptr->chp);
3893 s16b change = damroll(p_ptr->lev, 5);
3894 bool Nasty_effect = one_in_(5);
3896 if (!(wounds || hit_p || Nasty_effect)) return;
3898 msg_print(_("傷がより軽いものに変化した。", "Your wounds are polymorphed into less serious ones."));
3902 msg_print(_("新たな傷ができた!", "A new wound was created!"));
3903 take_hit(DAMAGE_LOSELIFE, change / 2, _("変化した傷", "a polymorphed wound"), -1);
3908 set_cut(p_ptr->cut - (change / 2));
3914 * Change player race
3916 void change_race(CHARACTER_IDX new_race, cptr effect_msg)
3918 cptr title = race_info[new_race].title;
3919 int old_race = p_ptr->prace;
3922 msg_format("あなたは%s%sに変化した!", effect_msg, title);
3924 msg_format("You turn into %s %s%s!", (!effect_msg[0] && is_a_vowel(title[0]) ? "an" : "a"), effect_msg, title);
3927 chg_virtue(V_CHANCE, 2);
3929 if (p_ptr->prace < 32)
3931 p_ptr->old_race1 |= 1L << p_ptr->prace;
3935 p_ptr->old_race2 |= 1L << (p_ptr->prace - 32);
3937 p_ptr->prace = new_race;
3938 rp_ptr = &race_info[p_ptr->prace];
3940 /* Experience factor */
3941 p_ptr->expfact = rp_ptr->r_exp + cp_ptr->c_exp;
3944 * The speed bonus of Klackons and Sprites are disabled
3945 * and the experience penalty is decreased.
3947 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)))
3948 p_ptr->expfact -= 15;
3950 /* Get character's height and weight */
3951 get_height_weight();
3954 if (p_ptr->pclass == CLASS_SORCERER)
3955 p_ptr->hitdie = rp_ptr->r_mhp/2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
3957 p_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
3959 do_cmd_rerate(FALSE);
3961 /* The experience level may be modified */
3964 p_ptr->redraw |= (PR_BASIC);
3966 p_ptr->update |= (PU_BONUS);
3970 /* Load an autopick preference file */
3971 if (old_race != p_ptr->prace) autopick_load_pref(FALSE);
3973 /* Player's graphic tile may change */
3974 lite_spot(p_ptr->y, p_ptr->x);
3978 void do_poly_self(void)
3980 int power = p_ptr->lev;
3982 msg_print(_("あなたは変化の訪れを感じた...", "You feel a change coming over you..."));
3983 chg_virtue(V_CHANCE, 1);
3985 if ((power > randint0(20)) && one_in_(3) && (p_ptr->prace != RACE_ANDROID))
3987 char effect_msg[80] = "";
3988 CHARACTER_IDX new_race;
3990 /* Some form of racial polymorph... */
3993 if ((power > randint0(5)) && one_in_(4))
3998 if (p_ptr->psex == SEX_MALE)
4000 p_ptr->psex = SEX_FEMALE;
4001 sp_ptr = &sex_info[p_ptr->psex];
4002 sprintf(effect_msg, _("女性の", "female "));
4006 p_ptr->psex = SEX_MALE;
4007 sp_ptr = &sex_info[p_ptr->psex];
4008 sprintf(effect_msg, _("男性の", "male "));
4012 if ((power > randint0(30)) && one_in_(5))
4016 /* Harmful deformity */
4023 (void)dec_stat(tmp, randint1(6) + 6, one_in_(3));
4029 /* Deformities are discriminated against! */
4030 (void)dec_stat(A_CHR, randint1(6), TRUE);
4035 sprintf(tmp_msg,_("%s", "%s "),effect_msg);
4036 sprintf(effect_msg,_("奇形の%s", "deformed %s "),tmp_msg);
4040 sprintf(effect_msg,_("奇形の", "deformed "));
4044 while ((power > randint0(20)) && one_in_(10))
4046 /* Polymorph into a less mutated form */
4049 if (!lose_mutation(0))
4050 msg_print(_("奇妙なくらい普通になった気がする。", "You feel oddly normal."));
4055 new_race = (CHARACTER_IDX)randint0(MAX_RACES);
4057 while ((new_race == p_ptr->prace) || (new_race == RACE_ANDROID));
4059 change_race(new_race, effect_msg);
4062 if ((power > randint0(30)) && one_in_(6))
4068 msg_format(_("%sの構成が変化した!", "Your internal organs are rearranged!"), p_ptr->prace == RACE_ANDROID ? "機械" : "内臓");
4072 (void)dec_stat(tmp, randint1(6) + 6, one_in_(3));
4077 msg_print(_("現在の姿で生きていくのは困難なようだ!", "You find living difficult in your present form!"));
4078 take_hit(DAMAGE_LOSELIFE, damroll(randint1(10), p_ptr->lev), _("致命的な突然変異", "a lethal mutation"), -1);
4084 if ((power > randint0(20)) && one_in_(4))
4089 do_cmd_rerate(FALSE);
4092 while ((power > randint0(15)) && one_in_(3))
4095 (void)gain_random_mutation(0);
4098 if (power > randint0(5))
4104 /* Note: earlier deductions may have left power < 0 already. */
4114 * Decreases players hit points and sets death flag if necessary
4116 * Invulnerability needs to be changed into a "shield"
4118 * Hack -- this function allows the user to save (or quit)
4119 * the game when he dies, since the "You die." message is shown before
4120 * setting the player to "dead".
4123 int take_hit(int damage_type, HIT_POINT damage, cptr hit_from, int monspell)
4125 int old_chp = p_ptr->chp;
4127 char death_message[1024];
4130 int warning = (p_ptr->mhp * hitpoint_warn / 10);
4133 if (p_ptr->is_dead) return 0;
4135 if (p_ptr->sutemi) damage *= 2;
4136 if (p_ptr->special_defense & KATA_IAI) damage += (damage + 4) / 5;
4138 if (easy_band) damage = (damage+1)/2;
4140 if (damage_type != DAMAGE_USELIFE)
4142 disturb(TRUE, TRUE);
4149 if (monspell >= 0) learn_spell(monspell);
4151 /* Mega-Hack -- Apply "invulnerability" */
4152 if ((damage_type != DAMAGE_USELIFE) && (damage_type != DAMAGE_LOSELIFE))
4154 if (IS_INVULN() && (damage < 9000))
4156 if (damage_type == DAMAGE_FORCE)
4158 msg_print(_("バリアが切り裂かれた!", "The attack cuts your shield of invulnerability open!"));
4160 else if (one_in_(PENETRATE_INVULNERABILITY))
4162 msg_print(_("無敵のバリアを破って攻撃された!", "The attack penetrates your shield of invulnerability!"));
4170 if (CHECK_MULTISHADOW())
4172 if (damage_type == DAMAGE_FORCE)
4174 msg_print(_("幻影もろとも体が切り裂かれた!", "The attack hits Shadow together with you!"));
4176 else if (damage_type == DAMAGE_ATTACK)
4178 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
4183 if (p_ptr->wraith_form)
4185 if (damage_type == DAMAGE_FORCE)
4187 msg_print(_("半物質の体が切り裂かれた!", "The attack cuts through your ethereal body!"));
4192 if ((damage == 0) && one_in_(2)) damage = 1;
4196 if (p_ptr->special_defense & KATA_MUSOU)
4199 if ((damage == 0) && one_in_(2)) damage = 1;
4201 } /* not if LOSELIFE USELIFE */
4203 /* Hurt the player */
4204 p_ptr->chp -= damage;
4205 if(damage_type == DAMAGE_GENO && p_ptr->chp < 0)
4207 damage += p_ptr->chp;
4211 /* Display the hitpoints */
4212 p_ptr->redraw |= (PR_HP);
4214 p_ptr->window |= (PW_PLAYER);
4216 if (damage_type != DAMAGE_GENO && p_ptr->chp == 0)
4218 chg_virtue(V_SACRIFICE, 1);
4219 chg_virtue(V_CHANCE, 2);
4225 bool android = (p_ptr->prace == RACE_ANDROID ? TRUE : FALSE);
4227 #ifdef JP /* 死んだ時に強制終了して死を回避できなくしてみた by Habu */
4229 if(!save_player()) msg_print("セーブ失敗!");
4234 chg_virtue(V_SACRIFICE, 10);
4239 p_ptr->leaving = TRUE;
4242 p_ptr->is_dead = TRUE;
4244 if (p_ptr->inside_arena)
4246 cptr m_name = r_name+r_info[arena_info[p_ptr->arena_number].r_idx].name;
4247 msg_format(_("あなたは%sの前に敗れ去った。", "You are beaten by %s."), m_name);
4249 if (record_arena) do_cmd_write_nikki(NIKKI_ARENA, -1 - p_ptr->arena_number, m_name);
4253 QUEST_IDX q_idx = quest_number(dun_level);
4254 bool seppuku = streq(hit_from, "Seppuku");
4255 bool winning_seppuku = p_ptr->total_winner && seppuku;
4257 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_GAMEOVER);
4260 /* Make screen dump */
4261 screen_dump = make_screen_dump();
4264 /* Note cause of death */
4267 strcpy(p_ptr->died_from, hit_from);
4269 if (!winning_seppuku) strcpy(p_ptr->died_from, "切腹");
4276 sprintf(dummy, "%s%s%s", !p_ptr->paralyzed ? "" : p_ptr->free_act ? "彫像状態で" : "麻痺状態で", p_ptr->image ? "幻覚に歪んだ" : "", hit_from);
4278 sprintf(dummy, "%s%s", hit_from, !p_ptr->paralyzed ? "" : " while helpless");
4280 my_strcpy(p_ptr->died_from, dummy, sizeof p_ptr->died_from);
4283 /* No longer a winner */
4284 p_ptr->total_winner = FALSE;
4286 if (winning_seppuku)
4288 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("勝利の後切腹した。", "did Seppuku after the winning."));
4294 if (p_ptr->inside_arena)
4295 strcpy(buf,_("アリーナ", "in the Arena"));
4296 else if (!dun_level)
4297 strcpy(buf,_("地上", "on the surface"));
4298 else if (q_idx && (is_fixed_quest_idx(q_idx) &&
4299 !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
4300 strcpy(buf,_("クエスト", "in a quest"));
4302 sprintf(buf,_("%d階", "level %d"), (int)dun_level);
4304 sprintf(tmp, _("%sで%sに殺された。", "killed by %s %s."), buf, p_ptr->died_from);
4305 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, tmp);
4308 do_cmd_write_nikki(NIKKI_GAMESTART, 1, _("-------- ゲームオーバー --------", "-------- Game Over --------"));
4309 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, "\n\n\n\n");
4313 if (get_check_strict(_("画面を保存しますか?", "Dump the screen? "), CHECK_NO_HISTORY))
4315 do_cmd_save_screen();
4320 /* Initialize "last message" buffer */
4321 if (p_ptr->last_message) string_free(p_ptr->last_message);
4322 p_ptr->last_message = NULL;
4324 /* Hack -- Note death */
4328 msg_format("あなたは%sました。", android ? "壊れ" : "死に");
4330 msg_print(android ? "You are broken." : "You die.");
4337 if (winning_seppuku)
4339 get_rnd_line(_("seppuku_j.txt", "seppuku.txt"), 0, death_message);
4343 get_rnd_line(_("death_j.txt", "death.txt"), 0, death_message);
4349 while (!get_string(winning_seppuku ? "辞世の句: " : "断末魔の叫び: ", death_message, 1024)) ;
4351 while (!get_string("Last word: ", death_message, 1024)) ;
4354 while (winning_seppuku && !get_check_strict(_("よろしいですか?", "Are you sure? "), CHECK_NO_HISTORY));
4356 if (death_message[0] == '\0')
4359 strcpy(death_message, format("あなたは%sました。", android ? "壊れ" : "死に"));
4361 strcpy(death_message, android ? "You are broken." : "You die.");
4364 else p_ptr->last_message = string_make(death_message);
4367 if (winning_seppuku)
4372 int msg_pos_x[9] = { 5, 7, 9, 12, 14, 17, 19, 21, 23};
4373 int msg_pos_y[9] = { 3, 4, 5, 4, 5, 4, 5, 6, 4};
4380 for (i = 0; i < 40; i++)
4381 Term_putstr(randint0(w / 2) * 2, randint0(h), 2, TERM_VIOLET, "υ");
4383 str = death_message;
4384 if (strncmp(str, "「", 2) == 0) str += 2;
4386 str2 = my_strstr(str, "」");
4387 if (str2 != NULL) *str2 = '\0';
4392 str2 = my_strstr(str, " ");
4393 if (str2 == NULL) len = strlen(str);
4394 else len = str2 - str;
4398 Term_putstr_v(w * 3 / 4 - 2 - msg_pos_x[i] * 2, msg_pos_y[i], len,
4400 if (str2 == NULL) break;
4404 if (*str == 0) break;
4408 Term_putstr(w-1, h-1, 1, TERM_WHITE, " ");
4412 /* Make screen dump */
4413 screen_dump = make_screen_dump();
4416 /* Wait a key press */
4421 msg_print(death_message);
4431 /* Hitpoint warning */
4432 if (p_ptr->chp < warning)
4434 /* Hack -- bell on first notice */
4435 if (old_chp > warning) bell();
4439 if (record_danger && (old_chp > warning))
4441 if (p_ptr->image && damage_type == DAMAGE_ATTACK)
4442 hit_from = _("何か", "something");
4444 sprintf(tmp,_("%sによってピンチに陥った。", "A critical situation because of %s."),hit_from);
4445 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, tmp);
4450 /* stop auto_more even if DAMAGE_USELIFE */
4454 msg_print(_("*** 警告:低ヒット・ポイント! ***", "*** LOW HITPOINT WARNING! ***"));
4458 if (p_ptr->wild_mode && !p_ptr->leaving && (p_ptr->chp < MAX(warning, p_ptr->mhp/5)))
4469 void gain_exp_64(s32b amount, u32b amount_frac)
4471 if (p_ptr->is_dead) return;
4473 if (p_ptr->prace == RACE_ANDROID) return;
4475 /* Gain some experience */
4476 s64b_add(&(p_ptr->exp), &(p_ptr->exp_frac), amount, amount_frac);
4478 /* Slowly recover from experience drainage */
4479 if (p_ptr->exp < p_ptr->max_exp)
4481 /* Gain max experience (20%) (was 10%) */
4482 p_ptr->max_exp += amount / 5;
4485 /* Check Experience */
4493 void gain_exp(s32b amount)
4495 gain_exp_64(amount, 0L);
4499 void calc_android_exp(void)
4503 if (p_ptr->is_dead) return;
4505 if (p_ptr->prace != RACE_ANDROID) return;
4507 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
4509 object_type *o_ptr = &inventory[i];
4511 object_type *q_ptr = &forge;
4513 DEPTH level = MAX(k_info[o_ptr->k_idx].level - 8, 1);
4515 if ((i == INVEN_RIGHT) || (i == INVEN_LEFT) || (i == INVEN_NECK) || (i == INVEN_LITE)) continue;
4516 if (!o_ptr->k_idx) continue;
4519 object_copy(q_ptr, o_ptr);
4520 q_ptr->discount = 0;
4521 q_ptr->curse_flags = 0L;
4523 if (object_is_fixed_artifact(o_ptr))
4525 level = (level + MAX(a_info[o_ptr->name1].level - 8, 5)) / 2;
4526 level += MIN(20, a_info[o_ptr->name1].rarity/(a_info[o_ptr->name1].gen_flags & TRG_INSTA_ART ? 10 : 3));
4528 else if (object_is_ego(o_ptr))
4530 level += MAX(3, (e_info[o_ptr->name2].rating - 5)/2);
4532 else if (o_ptr->art_name)
4534 s32b total_flags = flag_cost(o_ptr, o_ptr->pval);
4537 if (!object_is_weapon_ammo(o_ptr))
4540 if (total_flags < 15000) fake_level = 10;
4541 else if (total_flags < 35000) fake_level = 25;
4542 else fake_level = 40;
4547 if (total_flags < 20000) fake_level = 10;
4548 else if (total_flags < 45000) fake_level = 25;
4549 else fake_level = 40;
4552 level = MAX(level, (level + MAX(fake_level - 8, 5)) / 2 + 3);
4555 value = object_value_real(q_ptr);
4557 if (value <= 0) continue;
4558 if ((o_ptr->tval == TV_SOFT_ARMOR) && (o_ptr->sval == SV_ABUNAI_MIZUGI) && (p_ptr->pseikaku != SEIKAKU_SEXY)) value /= 32;
4559 if (value > 5000000L) value = 5000000L;
4560 if ((o_ptr->tval == TV_DRAG_ARMOR) || (o_ptr->tval == TV_CARD)) level /= 2;
4562 if (object_is_artifact(o_ptr) || object_is_ego(o_ptr) ||
4563 (o_ptr->tval == TV_DRAG_ARMOR) ||
4564 ((o_ptr->tval == TV_HELM) && (o_ptr->sval == SV_DRAGON_HELM)) ||
4565 ((o_ptr->tval == TV_SHIELD) && (o_ptr->sval == SV_DRAGON_SHIELD)) ||
4566 ((o_ptr->tval == TV_GLOVES) && (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES)) ||
4567 ((o_ptr->tval == TV_BOOTS) && (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE)) ||
4568 ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DIAMOND_EDGE)))
4570 if (level > 65) level = 35 + (level - 65) / 5;
4571 else if (level > 35) level = 25 + (level - 35) / 3;
4572 else if (level > 15) level = 15 + (level - 15) / 2;
4573 exp = MIN(100000L, value) / 2 * level * level;
4574 if (value > 100000L)
4575 exp += (value - 100000L) / 8 * level * level;
4579 exp = MIN(100000L, value) * level;
4580 if (value > 100000L)
4581 exp += (value - 100000L) / 4 * level;
4583 if ((((i == INVEN_RARM) || (i == INVEN_LARM)) && (buki_motteruka(i))) || (i == INVEN_BOW)) total_exp += exp / 48;
4584 else total_exp += exp / 16;
4585 if (i == INVEN_BODY) total_exp += exp / 32;
4587 p_ptr->exp = p_ptr->max_exp = total_exp;
4589 /* Check Experience */
4597 void lose_exp(s32b amount)
4599 if (p_ptr->prace == RACE_ANDROID) return;
4601 /* Never drop below zero experience */
4602 if (amount > p_ptr->exp) amount = p_ptr->exp;
4604 /* Lose some experience */
4605 p_ptr->exp -= amount;
4607 /* Check Experience */
4614 * If resisted to draining, return FALSE
4616 bool drain_exp(s32b drain, s32b slip, int hold_exp_prob)
4618 /* Androids and their mimics are never drained */
4619 if (p_ptr->prace == RACE_ANDROID) return FALSE;
4621 if (p_ptr->hold_exp && (randint0(100) < hold_exp_prob))
4623 /* Hold experience */
4624 msg_print(_("しかし自己の経験値を守りきった!", "You keep hold of your experience!"));
4628 /* Hold experience failed */
4629 if (p_ptr->hold_exp)
4631 msg_print(_("経験値を少し吸い取られた気がする!", "You feel your experience slipping away!"));
4636 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away!"));
4644 bool set_ultimate_res(TIME_EFFECT v, bool do_dec)
4646 bool notice = FALSE;
4648 /* Hack -- Force good values */
4649 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
4651 if (p_ptr->is_dead) return FALSE;
4656 if (p_ptr->ult_res && !do_dec)
4658 if (p_ptr->ult_res > v) return FALSE;
4660 else if (!p_ptr->ult_res)
4662 msg_print(_("あらゆることに対して耐性がついた気がする!", "You feel resistant!"));
4672 msg_print(_("あらゆることに対する耐性が薄れた気がする。", "You feel less resistant"));
4680 /* Redraw status bar */
4681 p_ptr->redraw |= (PR_STATUS);
4683 /* Nothing to notice */
4684 if (!notice) return (FALSE);
4686 if (disturb_state) disturb(FALSE, FALSE);
4688 /* Recalculate bonuses */
4689 p_ptr->update |= (PU_BONUS);
4694 bool set_tim_res_nether(TIME_EFFECT v, bool do_dec)
4696 bool notice = FALSE;
4698 /* Hack -- Force good values */
4699 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
4701 if (p_ptr->is_dead) return FALSE;
4706 if (p_ptr->tim_res_nether && !do_dec)
4708 if (p_ptr->tim_res_nether > v) return FALSE;
4710 else if (!p_ptr->tim_res_nether)
4712 msg_print(_("地獄の力に対して耐性がついた気がする!", "You feel nether resistant!"));
4720 if (p_ptr->tim_res_nether)
4722 msg_print(_("地獄の力に対する耐性が薄れた気がする。", "You feel less nether resistant"));
4728 p_ptr->tim_res_nether = v;
4730 /* Redraw status bar */
4731 p_ptr->redraw |= (PR_STATUS);
4733 /* Nothing to notice */
4734 if (!notice) return (FALSE);
4736 if (disturb_state) disturb(FALSE, FALSE);
4738 /* Recalculate bonuses */
4739 p_ptr->update |= (PU_BONUS);
4744 bool set_tim_res_time(TIME_EFFECT v, bool do_dec)
4746 bool notice = FALSE;
4748 /* Hack -- Force good values */
4749 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
4751 if (p_ptr->is_dead) return FALSE;
4756 if (p_ptr->tim_res_time && !do_dec)
4758 if (p_ptr->tim_res_time > v) return FALSE;
4760 else if (!p_ptr->tim_res_time)
4762 msg_print(_("時間逆転の力に対して耐性がついた気がする!", "You feel time resistant!"));
4770 if (p_ptr->tim_res_time)
4772 msg_print(_("時間逆転の力に対する耐性が薄れた気がする。", "You feel less time resistant"));
4778 p_ptr->tim_res_time = v;
4780 /* Redraw status bar */
4781 p_ptr->redraw |= (PR_STATUS);
4783 /* Nothing to notice */
4784 if (!notice) return (FALSE);
4786 if (disturb_state) disturb(FALSE, FALSE);
4788 /* Recalculate bonuses */
4789 p_ptr->update |= (PU_BONUS);
4796 * Choose a warrior-mage elemental attack. -LM-
4798 bool choose_ele_attack(void)
4804 if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM))
4806 msg_format(_("武器を持たないと魔法剣は使えない。", "You cannot use temporary branding with no weapon."));
4811 num = (p_ptr->lev - 20) / 5;
4812 c_prt(TERM_RED, _(" a) 焼棄", " a) Fire Brand"), 2, 14);
4815 c_prt(TERM_L_WHITE,_(" b) 凍結", " b) Cold Brand"), 3, 14);
4820 c_prt(TERM_GREEN, _(" c) 毒殺", " c) Poison Brand"), 4, 14);
4825 c_prt(TERM_L_DARK, _(" d) 溶解", " d) Acid Brand"), 5, 14);
4830 c_prt(TERM_BLUE, _(" e) 電撃", " e) Elec Brand"), 6, 14);
4839 prt(_(" どの元素攻撃をしますか?", " Choose a temporary elemental brand "), 1, 14);
4843 if ((choice == 'a') || (choice == 'A'))
4844 set_ele_attack(ATTACK_FIRE, p_ptr->lev/2 + randint1(p_ptr->lev/2));
4845 else if (((choice == 'b') || (choice == 'B')) && (num >= 2))
4846 set_ele_attack(ATTACK_COLD, p_ptr->lev/2 + randint1(p_ptr->lev/2));
4847 else if (((choice == 'c') || (choice == 'C')) && (num >= 3))
4848 set_ele_attack(ATTACK_POIS, p_ptr->lev/2 + randint1(p_ptr->lev/2));
4849 else if (((choice == 'd') || (choice == 'D')) && (num >= 4))
4850 set_ele_attack(ATTACK_ACID, p_ptr->lev/2 + randint1(p_ptr->lev/2));
4851 else if (((choice == 'e') || (choice == 'E')) && (num >= 5))
4852 set_ele_attack(ATTACK_ELEC, p_ptr->lev/2 + randint1(p_ptr->lev/2));
4855 msg_print(_("魔法剣を使うのをやめた。", "You cancel the temporary branding."));
4865 * Choose a elemental immune. -LM-
4867 bool choose_ele_immune(TIME_EFFECT immune_turn)
4872 c_prt(TERM_RED, _(" a) 火炎", " a) Immune Fire"), 2, 14);
4873 c_prt(TERM_L_WHITE,_(" b) 冷気", " b) Immune Cold"), 3, 14);
4874 c_prt(TERM_L_DARK, _(" c) 酸", " c) Immune Acid"), 4, 14);
4875 c_prt(TERM_BLUE, _(" d) 電撃", " d) Immune Elec"), 5, 14);
4883 prt(_(" どの元素の免疫をつけますか?", " Choose a temporary elemental immune "), 1, 14);
4887 if ((choice == 'a') || (choice == 'A'))
4888 set_ele_immune(DEFENSE_FIRE, immune_turn);
4889 else if ((choice == 'b') || (choice == 'B'))
4890 set_ele_immune(DEFENSE_COLD, immune_turn);
4891 else if ((choice == 'c') || (choice == 'C'))
4892 set_ele_immune(DEFENSE_ACID, immune_turn);
4893 else if ((choice == 'd') || (choice == 'D'))
4894 set_ele_immune(DEFENSE_ELEC, immune_turn);
4897 msg_print(_("免疫を付けるのをやめた。", "You cancel the temporary immune."));