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);
434 * @brief 混乱の継続時間をセットする / Set "p_ptr->confused", notice observable changes
436 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
438 bool set_confused(TIME_EFFECT v)
442 /* Hack -- Force good values */
443 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
445 if (p_ptr->is_dead) return FALSE;
450 if (!p_ptr->confused)
452 msg_print(_("あなたは混乱した!", "You are confused!"));
454 if (p_ptr->action == ACTION_LEARN)
456 msg_print(_("学習が続けられない!", "You cannot continue Learning!"));
459 p_ptr->redraw |= (PR_STATE);
460 p_ptr->action = ACTION_NONE;
462 if (p_ptr->action == ACTION_KAMAE)
464 msg_print(_("構えがとけた。", "Your posture gets loose."));
465 p_ptr->special_defense &= ~(KAMAE_MASK);
466 p_ptr->update |= (PU_BONUS);
467 p_ptr->redraw |= (PR_STATE);
468 p_ptr->action = ACTION_NONE;
470 else if (p_ptr->action == ACTION_KATA)
472 msg_print(_("型が崩れた。", "Your posture gets loose."));
473 p_ptr->special_defense &= ~(KATA_MASK);
474 p_ptr->update |= (PU_BONUS);
475 p_ptr->update |= (PU_MONSTERS);
476 p_ptr->redraw |= (PR_STATE);
477 p_ptr->redraw |= (PR_STATUS);
478 p_ptr->action = ACTION_NONE;
482 if (p_ptr->concent) reset_concentration(TRUE);
485 if (hex_spelling_any()) stop_hex_spell_all();
488 p_ptr->counter = FALSE;
489 chg_virtue(V_HARMONY, -1);
498 msg_print(_("やっと混乱がおさまった。", "You feel less confused now."));
499 p_ptr->special_attack &= ~(ATTACK_SUIKEN);
507 /* Redraw status bar */
508 p_ptr->redraw |= (PR_STATUS);
510 /* Nothing to notice */
511 if (!notice) return (FALSE);
513 if (disturb_state) disturb(FALSE, FALSE);
522 * @brief 毒の継続時間をセットする / Set "p_ptr->poisoned", notice observable changes
524 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
526 bool set_poisoned(TIME_EFFECT v)
530 /* Hack -- Force good values */
531 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
533 if (p_ptr->is_dead) return FALSE;
538 if (!p_ptr->poisoned)
540 msg_print(_("毒に侵されてしまった!", "You are poisoned!"));
550 msg_print(_("やっと毒の痛みがなくなった。", "You are no longer poisoned."));
558 /* Redraw status bar */
559 p_ptr->redraw |= (PR_STATUS);
561 /* Nothing to notice */
562 if (!notice) return (FALSE);
564 if (disturb_state) disturb(FALSE, FALSE);
573 * @brief 恐怖の継続時間をセットする / Set "p_ptr->afraid", notice observable changes
575 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
577 bool set_afraid(TIME_EFFECT v)
581 /* Hack -- Force good values */
582 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
584 if (p_ptr->is_dead) return FALSE;
591 msg_print(_("何もかも恐くなってきた!", "You are terrified!"));
593 if (p_ptr->special_defense & KATA_MASK)
595 msg_print(_("型が崩れた。", "Your posture gets loose."));
596 p_ptr->special_defense &= ~(KATA_MASK);
597 p_ptr->update |= (PU_BONUS);
598 p_ptr->update |= (PU_MONSTERS);
599 p_ptr->redraw |= (PR_STATE);
600 p_ptr->redraw |= (PR_STATUS);
601 p_ptr->action = ACTION_NONE;
605 p_ptr->counter = FALSE;
606 chg_virtue(V_VALOUR, -1);
615 msg_print(_("やっと恐怖を振り払った。", "You feel bolder now."));
623 /* Redraw status bar */
624 p_ptr->redraw |= (PR_STATUS);
626 /* Nothing to notice */
627 if (!notice) return (FALSE);
629 if (disturb_state) disturb(FALSE, FALSE);
637 * @brief 麻痺の継続時間をセットする / Set "p_ptr->paralyzed", notice observable changes
639 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
641 bool set_paralyzed(TIME_EFFECT v)
645 /* Hack -- Force good values */
646 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
648 if (p_ptr->is_dead) return FALSE;
653 if (!p_ptr->paralyzed)
655 msg_print(_("体が麻痺してしまった!", "You are paralyzed!"));
657 if (p_ptr->concent) reset_concentration(TRUE);
660 if (hex_spelling_any()) stop_hex_spell_all();
662 p_ptr->counter = FALSE;
670 if (p_ptr->paralyzed)
672 msg_print(_("やっと動けるようになった。", "You can move again."));
678 p_ptr->paralyzed = v;
680 /* Redraw status bar */
681 p_ptr->redraw |= (PR_STATUS);
683 /* Nothing to notice */
684 if (!notice) return (FALSE);
686 if (disturb_state) disturb(FALSE, FALSE);
688 /* Redraw the state */
689 p_ptr->redraw |= (PR_STATE);
697 * @brief 幻覚の継続時間をセットする / Set "p_ptr->image", notice observable changes
699 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
700 * @details Note that we must redraw the map when hallucination changes.
702 bool set_image(TIME_EFFECT v)
706 /* Hack -- Force good values */
707 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
709 if (p_ptr->is_dead) return FALSE;
715 set_tsuyoshi(0, TRUE);
718 msg_print(_("ワーオ!何もかも虹色に見える!", "Oh, wow! Everything looks so cosmic now!"));
721 if (p_ptr->concent) reset_concentration(TRUE);
723 p_ptr->counter = FALSE;
733 msg_print(_("やっとはっきりと物が見えるようになった。", "You can see clearly again."));
741 /* Redraw status bar */
742 p_ptr->redraw |= (PR_STATUS);
744 /* Nothing to notice */
745 if (!notice) return (FALSE);
747 if (disturb_state) disturb(FALSE, TRUE);
749 p_ptr->redraw |= (PR_MAP);
751 /* Update the health bar */
752 p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH);
754 /* Update monsters */
755 p_ptr->update |= (PU_MONSTERS);
757 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
765 * @brief 加速の継続時間をセットする / Set "p_ptr->fast", notice observable changes
767 * @param do_dec 現在の継続時間より長い値のみ上書きする
768 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
770 bool set_fast(TIME_EFFECT v, bool do_dec)
774 /* Hack -- Force good values */
775 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
777 if (p_ptr->is_dead) return FALSE;
782 if (p_ptr->fast && !do_dec)
784 if (p_ptr->fast > v) return FALSE;
786 else if (!IS_FAST() && !p_ptr->lightspeed)
788 msg_print(_("素早く動けるようになった!", "You feel yourself moving much faster!"));
790 chg_virtue(V_PATIENCE, -1);
791 chg_virtue(V_DILIGENCE, 1);
798 if (p_ptr->fast && !p_ptr->lightspeed && !music_singing(MUSIC_SPEED) && !music_singing(MUSIC_SHERO))
800 msg_print(_("動きの素早さがなくなったようだ。", "You feel yourself slow down."));
808 /* Nothing to notice */
809 if (!notice) return (FALSE);
811 if (disturb_state) disturb(FALSE, FALSE);
813 /* Recalculate bonuses */
814 p_ptr->update |= (PU_BONUS);
822 * @brief 光速移動の継続時間をセットする / Set "p_ptr->lightspeed", notice observable changes
824 * @param do_dec 現在の継続時間より長い値のみ上書きする
825 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
827 bool set_lightspeed(TIME_EFFECT v, bool do_dec)
831 /* Hack -- Force good values */
832 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
834 if (p_ptr->is_dead) return FALSE;
836 if (p_ptr->wild_mode) v = 0;
841 if (p_ptr->lightspeed && !do_dec)
843 if (p_ptr->lightspeed > v) return FALSE;
845 else if (!p_ptr->lightspeed)
847 msg_print(_("非常に素早く動けるようになった!", "You feel yourself moving extremely faster!"));
849 chg_virtue(V_PATIENCE, -1);
850 chg_virtue(V_DILIGENCE, 1);
857 if (p_ptr->lightspeed)
859 msg_print(_("動きの素早さがなくなったようだ。", "You feel yourself slow down."));
865 p_ptr->lightspeed = v;
867 /* Nothing to notice */
868 if (!notice) return (FALSE);
870 if (disturb_state) disturb(FALSE, FALSE);
872 /* Recalculate bonuses */
873 p_ptr->update |= (PU_BONUS);
881 * @brief 減速の継続時間をセットする / Set "p_ptr->slow", notice observable changes
883 * @param do_dec 現在の継続時間より長い値のみ上書きする
884 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
886 bool set_slow(TIME_EFFECT v, bool do_dec)
890 /* Hack -- Force good values */
891 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
893 if (p_ptr->is_dead) return FALSE;
898 if (p_ptr->slow && !do_dec)
900 if (p_ptr->slow > v) return FALSE;
902 else if (!p_ptr->slow)
904 msg_print(_("体の動きが遅くなってしまった!", "You feel yourself moving slower!"));
914 msg_print(_("動きの遅さがなくなったようだ。", "You feel yourself speed up."));
922 /* Nothing to notice */
923 if (!notice) return (FALSE);
925 if (disturb_state) disturb(FALSE, FALSE);
927 /* Recalculate bonuses */
928 p_ptr->update |= (PU_BONUS);
937 * @brief 肌石化の継続時間をセットする / Set "p_ptr->shield", notice observable changes
939 * @param do_dec 現在の継続時間より長い値のみ上書きする
940 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
942 bool set_shield(TIME_EFFECT v, bool do_dec)
946 /* Hack -- Force good values */
947 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
949 if (p_ptr->is_dead) return FALSE;
954 if (p_ptr->shield && !do_dec)
956 if (p_ptr->shield > v) return FALSE;
958 else if (!p_ptr->shield)
960 msg_print(_("肌が石になった。", "Your skin turns to stone."));
970 msg_print(_("肌が元に戻った。", "Your skin returns to normal."));
978 /* Redraw status bar */
979 p_ptr->redraw |= (PR_STATUS);
981 /* Nothing to notice */
982 if (!notice) return (FALSE);
984 if (disturb_state) disturb(FALSE, FALSE);
986 /* Recalculate bonuses */
987 p_ptr->update |= (PU_BONUS);
996 * @brief つぶれるの継続時間をセットする / Set "p_ptr->tsubureru", notice observable changes
998 * @param do_dec 現在の継続時間より長い値のみ上書きする
999 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1001 bool set_tsubureru(TIME_EFFECT v, bool do_dec)
1003 bool notice = FALSE;
1005 /* Hack -- Force good values */
1006 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1008 if (p_ptr->is_dead) return FALSE;
1013 if (p_ptr->tsubureru && !do_dec)
1015 if (p_ptr->tsubureru > v) return FALSE;
1017 else if (!p_ptr->tsubureru)
1019 msg_print(_("横に伸びた。", "Your body expands horizontally."));
1027 if (p_ptr->tsubureru)
1029 msg_print(_("もう横に伸びていない。", "Your body returns to normal."));
1035 p_ptr->tsubureru = v;
1037 /* Redraw status bar */
1038 p_ptr->redraw |= (PR_STATUS);
1040 /* Nothing to notice */
1041 if (!notice) return (FALSE);
1043 if (disturb_state) disturb(FALSE, FALSE);
1045 /* Recalculate bonuses */
1046 p_ptr->update |= (PU_BONUS);
1055 * @brief 魔法の鎧の継続時間をセットする / Set "p_ptr->magicdef", notice observable changes
1057 * @param do_dec 現在の継続時間より長い値のみ上書きする
1058 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1060 bool set_magicdef(TIME_EFFECT v, bool do_dec)
1062 bool notice = FALSE;
1064 /* Hack -- Force good values */
1065 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1067 if (p_ptr->is_dead) return FALSE;
1072 if (p_ptr->magicdef && !do_dec)
1074 if (p_ptr->magicdef > v) return FALSE;
1076 else if (!p_ptr->magicdef)
1078 msg_print(_("魔法の防御力が増したような気がする。", "You feel more resistant to magic."));
1086 if (p_ptr->magicdef)
1088 msg_print(_("魔法の防御力が元に戻った。", "You feel less resistant to magic."));
1094 p_ptr->magicdef = v;
1096 /* Redraw status bar */
1097 p_ptr->redraw |= (PR_STATUS);
1099 /* Nothing to notice */
1100 if (!notice) return (FALSE);
1102 if (disturb_state) disturb(FALSE, FALSE);
1104 /* Recalculate bonuses */
1105 p_ptr->update |= (PU_BONUS);
1113 * @brief 祝福の継続時間をセットする / Set "p_ptr->blessed", notice observable changes
1115 * @param do_dec 現在の継続時間より長い値のみ上書きする
1116 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1118 bool set_blessed(TIME_EFFECT v, bool do_dec)
1120 bool notice = FALSE;
1122 /* Hack -- Force good values */
1123 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1125 if (p_ptr->is_dead) return FALSE;
1130 if (p_ptr->blessed && !do_dec)
1132 if (p_ptr->blessed > v) return FALSE;
1134 else if (!IS_BLESSED())
1136 msg_print(_("高潔な気分になった!", "You feel righteous!"));
1144 if (p_ptr->blessed && !music_singing(MUSIC_BLESS))
1146 msg_print(_("高潔な気分が消え失せた。", "The prayer has expired."));
1154 /* Redraw status bar */
1155 p_ptr->redraw |= (PR_STATUS);
1157 /* Nothing to notice */
1158 if (!notice) return (FALSE);
1160 if (disturb_state) disturb(FALSE, FALSE);
1162 /* Recalculate bonuses */
1163 p_ptr->update |= (PU_BONUS);
1172 * @brief 士気高揚の継続時間をセットする / Set "p_ptr->hero", notice observable changes
1174 * @param do_dec 現在の継続時間より長い値のみ上書きする
1175 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1177 bool set_hero(TIME_EFFECT v, bool do_dec)
1179 bool notice = FALSE;
1181 /* Hack -- Force good values */
1182 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1184 if (p_ptr->is_dead) return FALSE;
1189 if (p_ptr->hero && !do_dec)
1191 if (p_ptr->hero > v) return FALSE;
1193 else if (!IS_HERO())
1195 msg_print(_("ヒーローになった気がする!", "You feel like a hero!"));
1203 if (p_ptr->hero && !music_singing(MUSIC_HERO) && !music_singing(MUSIC_SHERO))
1205 msg_print(_("ヒーローの気分が消え失せた。", "The heroism wears off."));
1213 /* Redraw status bar */
1214 p_ptr->redraw |= (PR_STATUS);
1216 /* Nothing to notice */
1217 if (!notice) return (FALSE);
1219 if (disturb_state) disturb(FALSE, FALSE);
1221 /* Recalculate bonuses */
1222 p_ptr->update |= (PU_BONUS);
1224 /* Recalculate hitpoints */
1225 p_ptr->update |= (PU_HP);
1233 * @brief 狂戦士化の継続時間をセットする / Set "p_ptr->shero", notice observable changes
1234 * @param v 継続時間/ 0ならば無条件にリセット
1235 * @param do_dec FALSEの場合現在の継続時間より長い値のみ上書きする
1236 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1238 bool set_shero(TIME_EFFECT v, bool do_dec)
1240 bool notice = FALSE;
1242 /* Hack -- Force good values */
1243 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1245 if (p_ptr->is_dead) return FALSE;
1247 if (p_ptr->pclass == CLASS_BERSERKER) v = 1;
1251 if (p_ptr->shero && !do_dec)
1253 if (p_ptr->shero > v) return FALSE;
1255 else if (!p_ptr->shero)
1257 msg_print(_("殺戮マシーンになった気がする!", "You feel like a killing machine!"));
1267 msg_print(_("野蛮な気持ちが消え失せた。", "You feel less Berserk."));
1275 /* Redraw status bar */
1276 p_ptr->redraw |= (PR_STATUS);
1278 /* Nothing to notice */
1279 if (!notice) return (FALSE);
1281 if (disturb_state) disturb(FALSE, FALSE);
1283 /* Recalculate bonuses */
1284 p_ptr->update |= (PU_BONUS);
1286 /* Recalculate hitpoints */
1287 p_ptr->update |= (PU_HP);
1295 * @brief 対邪悪結界の継続時間をセットする / Set "p_ptr->protevil", notice observable changes
1297 * @param do_dec 現在の継続時間より長い値のみ上書きする
1298 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1300 bool set_protevil(TIME_EFFECT v, bool do_dec)
1302 bool notice = FALSE;
1304 /* Hack -- Force good values */
1305 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1307 if (p_ptr->is_dead) return FALSE;
1312 if (p_ptr->protevil && !do_dec)
1314 if (p_ptr->protevil > v) return FALSE;
1316 else if (!p_ptr->protevil)
1318 msg_print(_("邪悪なる存在から守られているような感じがする!", "You feel safe from evil!"));
1326 if (p_ptr->protevil)
1328 msg_print(_("邪悪なる存在から守られている感じがなくなった。", "You no longer feel safe from evil."));
1334 p_ptr->protevil = v;
1336 /* Redraw status bar */
1337 p_ptr->redraw |= (PR_STATUS);
1339 /* Nothing to notice */
1340 if (!notice) return (FALSE);
1342 if (disturb_state) disturb(FALSE, FALSE);
1350 * @brief 幽体化の継続時間をセットする / Set "p_ptr->wraith_form", notice observable changes
1352 * @param do_dec 現在の継続時間より長い値のみ上書きする
1353 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1355 bool set_wraith_form(TIME_EFFECT v, bool do_dec)
1357 bool notice = FALSE;
1359 /* Hack -- Force good values */
1360 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1362 if (p_ptr->is_dead) return FALSE;
1367 if (p_ptr->wraith_form && !do_dec)
1369 if (p_ptr->wraith_form > v) return FALSE;
1371 else if (!p_ptr->wraith_form)
1373 msg_print(_("物質界を離れて幽鬼のような存在になった!", "You leave the physical world and turn into a wraith-being!"));
1375 chg_virtue(V_UNLIFE, 3);
1376 chg_virtue(V_HONOUR, -2);
1377 chg_virtue(V_SACRIFICE, -2);
1378 chg_virtue(V_VALOUR, -5);
1380 p_ptr->redraw |= (PR_MAP);
1382 /* Update monsters */
1383 p_ptr->update |= (PU_MONSTERS);
1385 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1392 if (p_ptr->wraith_form)
1394 msg_print(_("不透明になった感じがする。", "You feel opaque."));
1397 p_ptr->redraw |= (PR_MAP);
1399 /* Update monsters */
1400 p_ptr->update |= (PU_MONSTERS);
1402 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1407 p_ptr->wraith_form = v;
1409 /* Redraw status bar */
1410 p_ptr->redraw |= (PR_STATUS);
1412 /* Nothing to notice */
1413 if (!notice) return (FALSE);
1415 if (disturb_state) disturb(FALSE, FALSE);
1417 /* Recalculate bonuses */
1418 p_ptr->update |= (PU_BONUS);
1427 * @brief 無傷球の継続時間をセットする / Set "p_ptr->invuln", notice observable changes
1429 * @param do_dec 現在の継続時間より長い値のみ上書きする
1430 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1432 bool set_invuln(TIME_EFFECT v, bool do_dec)
1434 bool notice = FALSE;
1436 /* Hack -- Force good values */
1437 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1439 if (p_ptr->is_dead) return FALSE;
1444 if (p_ptr->invuln && !do_dec)
1446 if (p_ptr->invuln > v) return FALSE;
1448 else if (!IS_INVULN())
1450 msg_print(_("無敵だ!", "Invulnerability!"));
1453 chg_virtue(V_UNLIFE, -2);
1454 chg_virtue(V_HONOUR, -2);
1455 chg_virtue(V_SACRIFICE, -3);
1456 chg_virtue(V_VALOUR, -5);
1458 p_ptr->redraw |= (PR_MAP);
1460 /* Update monsters */
1461 p_ptr->update |= (PU_MONSTERS);
1463 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1470 if (p_ptr->invuln && !music_singing(MUSIC_INVULN))
1472 msg_print(_("無敵ではなくなった。", "The invulnerability wears off."));
1475 p_ptr->redraw |= (PR_MAP);
1477 /* Update monsters */
1478 p_ptr->update |= (PU_MONSTERS);
1480 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1482 p_ptr->energy_need += ENERGY_NEED();
1489 /* Redraw status bar */
1490 p_ptr->redraw |= (PR_STATUS);
1492 /* Nothing to notice */
1493 if (!notice) return (FALSE);
1495 if (disturb_state) disturb(FALSE, FALSE);
1497 /* Recalculate bonuses */
1498 p_ptr->update |= (PU_BONUS);
1506 * @brief 時限ESPの継続時間をセットする / Set "p_ptr->tim_esp", notice observable changes
1508 * @param do_dec 現在の継続時間より長い値のみ上書きする
1509 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1511 bool set_tim_esp(TIME_EFFECT v, bool do_dec)
1513 bool notice = FALSE;
1515 /* Hack -- Force good values */
1516 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1518 if (p_ptr->is_dead) return FALSE;
1523 if (p_ptr->tim_esp && !do_dec)
1525 if (p_ptr->tim_esp > v) return FALSE;
1527 else if (!IS_TIM_ESP())
1529 msg_print(_("意識が広がった気がする!", "You feel your consciousness expand!"));
1537 if (p_ptr->tim_esp && !music_singing(MUSIC_MIND))
1539 msg_print(_("意識は元に戻った。", "Your consciousness contracts again."));
1547 /* Redraw status bar */
1548 p_ptr->redraw |= (PR_STATUS);
1550 /* Nothing to notice */
1551 if (!notice) return (FALSE);
1553 if (disturb_state) disturb(FALSE, FALSE);
1555 /* Recalculate bonuses */
1556 p_ptr->update |= (PU_BONUS);
1557 p_ptr->update |= (PU_MONSTERS);
1565 * @brief 時限透明視の継続時間をセットする / Set "p_ptr->tim_invis", notice observable changes
1567 * @param do_dec 現在の継続時間より長い値のみ上書きする
1568 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1570 bool set_tim_invis(TIME_EFFECT v, bool do_dec)
1572 bool notice = FALSE;
1574 /* Hack -- Force good values */
1575 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1577 if (p_ptr->is_dead) return FALSE;
1582 if (p_ptr->tim_invis && !do_dec)
1584 if (p_ptr->tim_invis > v) return FALSE;
1586 else if (!p_ptr->tim_invis)
1588 msg_print(_("目が非常に敏感になった気がする!", "Your eyes feel very sensitive!"));
1596 if (p_ptr->tim_invis)
1598 msg_print(_("目の敏感さがなくなったようだ。", "Your eyes feel less sensitive."));
1604 p_ptr->tim_invis = v;
1606 /* Redraw status bar */
1607 p_ptr->redraw |= (PR_STATUS);
1609 /* Nothing to notice */
1610 if (!notice) return (FALSE);
1612 if (disturb_state) disturb(FALSE, FALSE);
1614 /* Recalculate bonuses */
1615 p_ptr->update |= (PU_BONUS);
1617 /* Update the monsters */
1618 p_ptr->update |= (PU_MONSTERS);
1626 * @brief 時限赤外線視力の継続時間をセットする / Set "p_ptr->tim_infra", notice observable changes
1628 * @param do_dec 現在の継続時間より長い値のみ上書きする
1629 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1631 bool set_tim_infra(TIME_EFFECT v, bool do_dec)
1633 bool notice = FALSE;
1635 /* Hack -- Force good values */
1636 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1638 if (p_ptr->is_dead) return FALSE;
1643 if (p_ptr->tim_infra && !do_dec)
1645 if (p_ptr->tim_infra > v) return FALSE;
1647 else if (!p_ptr->tim_infra)
1649 msg_print(_("目がランランと輝き始めた!", "Your eyes begin to tingle!"));
1657 if (p_ptr->tim_infra)
1659 msg_print(_("目の輝きがなくなった。", "Your eyes stop tingling."));
1665 p_ptr->tim_infra = v;
1667 /* Redraw status bar */
1668 p_ptr->redraw |= (PR_STATUS);
1670 /* Nothing to notice */
1671 if (!notice) return (FALSE);
1673 if (disturb_state) disturb(FALSE, FALSE);
1675 /* Recalculate bonuses */
1676 p_ptr->update |= (PU_BONUS);
1678 /* Update the monsters */
1679 p_ptr->update |= (PU_MONSTERS);
1687 * @brief 時限急回復の継続時間をセットする / Set "p_ptr->tim_regen", notice observable changes
1689 * @param do_dec 現在の継続時間より長い値のみ上書きする
1690 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1692 bool set_tim_regen(TIME_EFFECT v, bool do_dec)
1694 bool notice = FALSE;
1696 /* Hack -- Force good values */
1697 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1699 if (p_ptr->is_dead) return FALSE;
1704 if (p_ptr->tim_regen && !do_dec)
1706 if (p_ptr->tim_regen > v) return FALSE;
1708 else if (!p_ptr->tim_regen)
1710 msg_print(_("回復力が上がった!", "You feel yourself regenerating quickly!"));
1718 if (p_ptr->tim_regen)
1720 msg_print(_("素早く回復する感じがなくなった。", "You feel yourself regenerating slowly."));
1726 p_ptr->tim_regen = v;
1728 /* Redraw status bar */
1729 p_ptr->redraw |= (PR_STATUS);
1731 /* Nothing to notice */
1732 if (!notice) return (FALSE);
1734 if (disturb_state) disturb(FALSE, FALSE);
1736 /* Recalculate bonuses */
1737 p_ptr->update |= (PU_BONUS);
1745 * @brief 隠密の歌の継続時間をセットする / Set "p_ptr->tim_stealth", notice observable changes
1747 * @param do_dec 現在の継続時間より長い値のみ上書きする
1748 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1750 bool set_tim_stealth(TIME_EFFECT v, bool do_dec)
1752 bool notice = FALSE;
1754 /* Hack -- Force good values */
1755 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1757 if (p_ptr->is_dead) return FALSE;
1762 if (p_ptr->tim_stealth && !do_dec)
1764 if (p_ptr->tim_stealth > v) return FALSE;
1766 else if (!IS_TIM_STEALTH())
1768 msg_print(_("足音が小さくなった!", "You begin to walk silently!"));
1776 if (p_ptr->tim_stealth && !music_singing(MUSIC_STEALTH))
1778 msg_print(_("足音が大きくなった。", "You no longer walk silently."));
1784 p_ptr->tim_stealth = v;
1786 /* Redraw status bar */
1787 p_ptr->redraw |= (PR_STATUS);
1789 /* Nothing to notice */
1790 if (!notice) return (FALSE);
1792 if (disturb_state) disturb(FALSE, FALSE);
1794 /* Recalculate bonuses */
1795 p_ptr->update |= (PU_BONUS);
1803 * @brief 超隠密状態をセットする
1804 * @param set TRUEならば超隠密状態になる。
1805 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1807 bool set_superstealth(bool set)
1809 bool notice = FALSE;
1811 if (p_ptr->is_dead) return FALSE;
1816 if (!(p_ptr->special_defense & NINJA_S_STEALTH))
1818 if (cave[p_ptr->y][p_ptr->x].info & CAVE_MNLT)
1820 msg_print(_("敵の目から薄い影の中に覆い隠された。", "You are mantled in weak shadow from ordinary eyes."));
1821 p_ptr->monlite = p_ptr->old_monlite = TRUE;
1825 msg_print(_("敵の目から影の中に覆い隠された!", "You are mantled in shadow from ordinary eyes!"));
1826 p_ptr->monlite = p_ptr->old_monlite = FALSE;
1832 p_ptr->special_defense |= NINJA_S_STEALTH;
1839 if (p_ptr->special_defense & NINJA_S_STEALTH)
1841 msg_print(_("再び敵の目にさらされるようになった。", "You are exposed to common sight once more."));
1845 p_ptr->special_defense &= ~(NINJA_S_STEALTH);
1849 /* Nothing to notice */
1850 if (!notice) return (FALSE);
1852 /* Redraw status bar */
1853 p_ptr->redraw |= (PR_STATUS);
1855 if (disturb_state) disturb(FALSE, FALSE);
1860 * @brief 一時的浮遊の継続時間をセットする / Set "p_ptr->tim_levitation", notice observable changes
1862 * @param do_dec 現在の継続時間より長い値のみ上書きする
1863 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1865 bool set_tim_levitation(TIME_EFFECT v, bool do_dec)
1867 bool notice = FALSE;
1869 /* Hack -- Force good values */
1870 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1872 if (p_ptr->is_dead) return FALSE;
1877 if (p_ptr->tim_levitation && !do_dec)
1879 if (p_ptr->tim_levitation > v) return FALSE;
1881 else if (!p_ptr->tim_levitation)
1883 msg_print(_("体が宙に浮き始めた。", "You begin to fly!"));
1891 if (p_ptr->tim_levitation)
1893 msg_print(_("もう宙に浮かべなくなった。", "You stop flying."));
1899 p_ptr->tim_levitation = v;
1901 /* Redraw status bar */
1902 p_ptr->redraw |= (PR_STATUS);
1904 /* Nothing to notice */
1905 if (!notice) return (FALSE);
1907 if (disturb_state) disturb(FALSE, FALSE);
1909 /* Recalculate bonuses */
1910 p_ptr->update |= (PU_BONUS);
1918 * @brief 一時的闘気のオーラの継続時間をセットする / Set "p_ptr->tim_sh_touki", notice observable changes
1920 * @param do_dec 現在の継続時間より長い値のみ上書きする
1921 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1923 bool set_tim_sh_touki(TIME_EFFECT v, bool do_dec)
1925 bool notice = FALSE;
1927 /* Hack -- Force good values */
1928 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1930 if (p_ptr->is_dead) return FALSE;
1935 if (p_ptr->tim_sh_touki && !do_dec)
1937 if (p_ptr->tim_sh_touki > v) return FALSE;
1939 else if (!p_ptr->tim_sh_touki)
1941 msg_print(_("体が闘気のオーラで覆われた。", "You have enveloped by the aura of the Force!"));
1949 if (p_ptr->tim_sh_touki)
1951 msg_print(_("闘気が消えた。", "Aura of the Force disappeared."));
1957 p_ptr->tim_sh_touki = v;
1959 /* Redraw status bar */
1960 p_ptr->redraw |= (PR_STATUS);
1962 /* Nothing to notice */
1963 if (!notice) return (FALSE);
1965 if (disturb_state) disturb(FALSE, FALSE);
1973 * @brief 一時的火炎のオーラの継続時間をセットする / Set "p_ptr->tim_sh_fire", notice observable changes
1975 * @param do_dec 現在の継続時間より長い値のみ上書きする
1976 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1978 bool set_tim_sh_fire(TIME_EFFECT v, bool do_dec)
1980 bool notice = FALSE;
1982 /* Hack -- Force good values */
1983 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1985 if (p_ptr->is_dead) return FALSE;
1990 if (p_ptr->tim_sh_fire && !do_dec)
1992 if (p_ptr->tim_sh_fire > v) return FALSE;
1994 else if (!p_ptr->tim_sh_fire)
1996 msg_print(_("体が炎のオーラで覆われた。", "You have enveloped by fiery aura!"));
2004 if (p_ptr->tim_sh_fire)
2006 msg_print(_("炎のオーラが消えた。", "Fiery aura disappeared."));
2012 p_ptr->tim_sh_fire = v;
2014 /* Redraw status bar */
2015 p_ptr->redraw |= (PR_STATUS);
2017 /* Nothing to notice */
2018 if (!notice) return (FALSE);
2020 if (disturb_state) disturb(FALSE, FALSE);
2022 /* Recalculate bonuses */
2023 p_ptr->update |= (PU_BONUS);
2031 * @brief 一時的聖なるのオーラの継続時間をセットする / Set "p_ptr->tim_sh_holy", notice observable changes
2033 * @param do_dec 現在の継続時間より長い値のみ上書きする
2034 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2036 bool set_tim_sh_holy(TIME_EFFECT v, bool do_dec)
2038 bool notice = FALSE;
2040 /* Hack -- Force good values */
2041 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2043 if (p_ptr->is_dead) return FALSE;
2048 if (p_ptr->tim_sh_holy && !do_dec)
2050 if (p_ptr->tim_sh_holy > v) return FALSE;
2052 else if (!p_ptr->tim_sh_holy)
2054 msg_print(_("体が聖なるオーラで覆われた。", "You have enveloped by holy aura!"));
2062 if (p_ptr->tim_sh_holy)
2064 msg_print(_("聖なるオーラが消えた。", "Holy aura disappeared."));
2070 p_ptr->tim_sh_holy = v;
2072 /* Redraw status bar */
2073 p_ptr->redraw |= (PR_STATUS);
2075 /* Nothing to notice */
2076 if (!notice) return (FALSE);
2078 if (disturb_state) disturb(FALSE, FALSE);
2080 /* Recalculate bonuses */
2081 p_ptr->update |= (PU_BONUS);
2089 * @brief 目には目をの残り時間をセットする / Set "p_ptr->tim_eyeeye", notice observable changes
2091 * @param do_dec 現在の継続時間より長い値のみ上書きする
2092 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2094 bool set_tim_eyeeye(TIME_EFFECT v, bool do_dec)
2096 bool notice = FALSE;
2098 /* Hack -- Force good values */
2099 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2101 if (p_ptr->is_dead) return FALSE;
2106 if (p_ptr->tim_eyeeye && !do_dec)
2108 if (p_ptr->tim_eyeeye > v) return FALSE;
2110 else if (!p_ptr->tim_eyeeye)
2112 msg_print(_("法の守り手になった気がした!", "You feel like a keeper of commandments!"));
2120 if (p_ptr->tim_eyeeye)
2122 msg_print(_("懲罰を執行することができなくなった。", "You no longer feel like a keeper."));
2128 p_ptr->tim_eyeeye = v;
2130 /* Redraw status bar */
2131 p_ptr->redraw |= (PR_STATUS);
2133 /* Nothing to notice */
2134 if (!notice) return (FALSE);
2136 if (disturb_state) disturb(FALSE, FALSE);
2138 /* Recalculate bonuses */
2139 p_ptr->update |= (PU_BONUS);
2148 * @brief 一時的魔法防御の継続時間をセットする / Set "p_ptr->resist_magic", notice observable changes
2150 * @param do_dec 現在の継続時間より長い値のみ上書きする
2151 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2153 bool set_resist_magic(TIME_EFFECT v, bool do_dec)
2155 bool notice = FALSE;
2157 /* Hack -- Force good values */
2158 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2160 if (p_ptr->is_dead) return FALSE;
2165 if (p_ptr->resist_magic && !do_dec)
2167 if (p_ptr->resist_magic > v) return FALSE;
2169 else if (!p_ptr->resist_magic)
2171 msg_print(_("魔法への耐性がついた。", "You have been protected from magic!"));
2179 if (p_ptr->resist_magic)
2181 msg_print(_("魔法に弱くなった。", "You are no longer protected from magic."));
2187 p_ptr->resist_magic = v;
2189 /* Redraw status bar */
2190 p_ptr->redraw |= (PR_STATUS);
2192 /* Nothing to notice */
2193 if (!notice) return (FALSE);
2195 if (disturb_state) disturb(FALSE, FALSE);
2197 /* Recalculate bonuses */
2198 p_ptr->update |= (PU_BONUS);
2206 * @brief 一時的反射の継続時間をセットする / Set "p_ptr->tim_reflect", notice observable changes
2208 * @param do_dec 現在の継続時間より長い値のみ上書きする
2209 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2211 bool set_tim_reflect(TIME_EFFECT v, bool do_dec)
2213 bool notice = FALSE;
2215 /* Hack -- Force good values */
2216 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2218 if (p_ptr->is_dead) return FALSE;
2223 if (p_ptr->tim_reflect && !do_dec)
2225 if (p_ptr->tim_reflect > v) return FALSE;
2227 else if (!p_ptr->tim_reflect)
2229 msg_print(_("体の表面が滑かになった気がする。", "Your body becames smooth."));
2237 if (p_ptr->tim_reflect)
2239 msg_print(_("体の表面が滑かでなくなった。", "Your body is no longer smooth."));
2245 p_ptr->tim_reflect = v;
2247 /* Redraw status bar */
2248 p_ptr->redraw |= (PR_STATUS);
2250 /* Nothing to notice */
2251 if (!notice) return (FALSE);
2253 if (disturb_state) disturb(FALSE, FALSE);
2255 /* Recalculate bonuses */
2256 p_ptr->update |= (PU_BONUS);
2265 * Set "p_ptr->multishadow", notice observable changes
2267 bool set_multishadow(TIME_EFFECT v, bool do_dec)
2269 bool notice = FALSE;
2271 /* Hack -- Force good values */
2272 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2274 if (p_ptr->is_dead) return FALSE;
2279 if (p_ptr->multishadow && !do_dec)
2281 if (p_ptr->multishadow > v) return FALSE;
2283 else if (!p_ptr->multishadow)
2285 msg_print(_("あなたの周りに幻影が生まれた。", "Your Shadow enveloped you."));
2293 if (p_ptr->multishadow)
2295 msg_print(_("幻影が消えた。", "Your Shadow disappears."));
2301 p_ptr->multishadow = v;
2303 /* Redraw status bar */
2304 p_ptr->redraw |= (PR_STATUS);
2306 /* Nothing to notice */
2307 if (!notice) return (FALSE);
2309 if (disturb_state) disturb(FALSE, FALSE);
2311 /* Recalculate bonuses */
2312 p_ptr->update |= (PU_BONUS);
2320 * @brief 一時的破片のオーラの継続時間をセットする / Set "p_ptr->dustrobe", notice observable changes
2322 * @param do_dec 現在の継続時間より長い値のみ上書きする
2323 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2325 bool set_dustrobe(TIME_EFFECT v, bool do_dec)
2327 bool notice = FALSE;
2329 /* Hack -- Force good values */
2330 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2332 if (p_ptr->is_dead) return FALSE;
2337 if (p_ptr->dustrobe && !do_dec)
2339 if (p_ptr->dustrobe > v) return FALSE;
2341 else if (!p_ptr->dustrobe)
2343 msg_print(_("体が鏡のオーラで覆われた。", "You were enveloped by mirror shards."));
2351 if (p_ptr->dustrobe)
2353 msg_print(_("鏡のオーラが消えた。", "The mirror shards disappear."));
2359 p_ptr->dustrobe = v;
2361 /* Redraw status bar */
2362 p_ptr->redraw |= (PR_STATUS);
2364 /* Nothing to notice */
2365 if (!notice) return (FALSE);
2367 if (disturb_state) disturb(FALSE, FALSE);
2369 /* Recalculate bonuses */
2370 p_ptr->update |= (PU_BONUS);
2378 * @brief 一時的壁抜けの継続時間をセットする / Set "p_ptr->kabenuke", notice observable changes
2380 * @param do_dec 現在の継続時間より長い値のみ上書きする
2381 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2383 bool set_kabenuke(TIME_EFFECT v, bool do_dec)
2385 bool notice = FALSE;
2387 /* Hack -- Force good values */
2388 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2390 if (p_ptr->is_dead) return FALSE;
2395 if (p_ptr->kabenuke && !do_dec)
2397 if (p_ptr->kabenuke > v) return FALSE;
2399 else if (!p_ptr->kabenuke)
2401 msg_print(_("体が半物質の状態になった。", "You became ethereal form."));
2409 if (p_ptr->kabenuke)
2411 msg_print(_("体が物質化した。", "You are no longer in an ethereal form."));
2417 p_ptr->kabenuke = v;
2419 /* Redraw status bar */
2420 p_ptr->redraw |= (PR_STATUS);
2422 /* Nothing to notice */
2423 if (!notice) return (FALSE);
2425 if (disturb_state) disturb(FALSE, FALSE);
2427 /* Recalculate bonuses */
2428 p_ptr->update |= (PU_BONUS);
2436 * @brief オクレ兄さんの継続時間をセットする / Set "p_ptr->tsuyoshi", notice observable changes
2438 * @param do_dec 現在の継続時間より長い値のみ上書きする
2439 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2441 bool set_tsuyoshi(TIME_EFFECT v, bool do_dec)
2443 bool notice = FALSE;
2445 /* Hack -- Force good values */
2446 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2448 if (p_ptr->is_dead) return FALSE;
2453 if (p_ptr->tsuyoshi && !do_dec)
2455 if (p_ptr->tsuyoshi > v) return FALSE;
2457 else if (!p_ptr->tsuyoshi)
2459 msg_print(_("「オクレ兄さん!」", "Brother OKURE!"));
2461 chg_virtue(V_VITALITY, 2);
2468 if (p_ptr->tsuyoshi)
2470 msg_print(_("肉体が急速にしぼんでいった。", "Your body had quickly shriveled."));
2472 (void)dec_stat(A_CON, 20, TRUE);
2473 (void)dec_stat(A_STR, 20, TRUE);
2476 chg_virtue(V_VITALITY, -3);
2481 p_ptr->tsuyoshi = v;
2483 /* Redraw status bar */
2484 p_ptr->redraw |= (PR_STATUS);
2486 /* Nothing to notice */
2487 if (!notice) return (FALSE);
2489 if (disturb_state) disturb(FALSE, FALSE);
2491 /* Recalculate bonuses */
2492 p_ptr->update |= (PU_BONUS);
2494 /* Recalculate hitpoints */
2495 p_ptr->update |= (PU_HP);
2503 * @brief 一時的元素スレイの継続時間をセットする / Set a temporary elemental brand. Clear all other brands. Print status messages. -LM-
2504 * @param attack_type スレイのタイプID
2506 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2508 bool set_ele_attack(u32b attack_type, TIME_EFFECT v)
2510 /* Hack -- Force good values */
2511 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2513 /* Clear all elemental attacks (only one is allowed at a time). */
2514 if ((p_ptr->special_attack & (ATTACK_ACID)) && (attack_type != ATTACK_ACID))
2516 p_ptr->special_attack &= ~(ATTACK_ACID);
2517 msg_print(_("酸で攻撃できなくなった。", "Your temporary acidic brand fades away."));
2519 if ((p_ptr->special_attack & (ATTACK_ELEC)) && (attack_type != ATTACK_ELEC))
2521 p_ptr->special_attack &= ~(ATTACK_ELEC);
2522 msg_print(_("電撃で攻撃できなくなった。", "Your temporary electrical brand fades away."));
2524 if ((p_ptr->special_attack & (ATTACK_FIRE)) && (attack_type != ATTACK_FIRE))
2526 p_ptr->special_attack &= ~(ATTACK_FIRE);
2527 msg_print(_("火炎で攻撃できなくなった。", "Your temporary fiery brand fades away."));
2529 if ((p_ptr->special_attack & (ATTACK_COLD)) && (attack_type != ATTACK_COLD))
2531 p_ptr->special_attack &= ~(ATTACK_COLD);
2532 msg_print(_("冷気で攻撃できなくなった。", "Your temporary frost brand fades away."));
2534 if ((p_ptr->special_attack & (ATTACK_POIS)) && (attack_type != ATTACK_POIS))
2536 p_ptr->special_attack &= ~(ATTACK_POIS);
2537 msg_print(_("毒で攻撃できなくなった。", "Your temporary poison brand fades away."));
2540 if ((v) && (attack_type))
2542 /* Set attack type. */
2543 p_ptr->special_attack |= (attack_type);
2546 p_ptr->ele_attack = v;
2550 msg_format("%sで攻撃できるようになった!",
2551 ((attack_type == ATTACK_ACID) ? "酸" :
2552 ((attack_type == ATTACK_ELEC) ? "電撃" :
2553 ((attack_type == ATTACK_FIRE) ? "火炎" :
2554 ((attack_type == ATTACK_COLD) ? "冷気" :
2555 ((attack_type == ATTACK_POIS) ? "毒" :
2558 msg_format("For a while, the blows you deal will %s",
2559 ((attack_type == ATTACK_ACID) ? "melt with acid!" :
2560 ((attack_type == ATTACK_ELEC) ? "shock your foes!" :
2561 ((attack_type == ATTACK_FIRE) ? "burn with fire!" :
2562 ((attack_type == ATTACK_COLD) ? "chill to the bone!" :
2563 ((attack_type == ATTACK_POIS) ? "poison your enemies!" :
2564 "do nothing special."))))));
2568 if (disturb_state) disturb(FALSE, FALSE);
2570 /* Redraw status bar */
2571 p_ptr->redraw |= (PR_STATUS);
2573 p_ptr->update |= (PU_BONUS);
2582 * @brief 一時的元素免疫の継続時間をセットする / Set a temporary elemental brand. Clear all other brands. Print status messages. -LM-
2583 * @param immune_type 免疫のタイプID
2585 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2587 bool set_ele_immune(u32b immune_type, TIME_EFFECT v)
2589 /* Hack -- Force good values */
2590 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2592 /* Clear all elemental attacks (only one is allowed at a time). */
2593 if ((p_ptr->special_defense & (DEFENSE_ACID)) && (immune_type != DEFENSE_ACID))
2595 p_ptr->special_defense &= ~(DEFENSE_ACID);
2596 msg_print(_("酸の攻撃で傷つけられるようになった。。", "You are no longer immune to acid."));
2598 if ((p_ptr->special_defense & (DEFENSE_ELEC)) && (immune_type != DEFENSE_ELEC))
2600 p_ptr->special_defense &= ~(DEFENSE_ELEC);
2601 msg_print(_("電撃の攻撃で傷つけられるようになった。。", "You are no longer immune to electricity."));
2603 if ((p_ptr->special_defense & (DEFENSE_FIRE)) && (immune_type != DEFENSE_FIRE))
2605 p_ptr->special_defense &= ~(DEFENSE_FIRE);
2606 msg_print(_("火炎の攻撃で傷つけられるようになった。。", "You are no longer immune to fire."));
2608 if ((p_ptr->special_defense & (DEFENSE_COLD)) && (immune_type != DEFENSE_COLD))
2610 p_ptr->special_defense &= ~(DEFENSE_COLD);
2611 msg_print(_("冷気の攻撃で傷つけられるようになった。。", "You are no longer immune to cold."));
2613 if ((p_ptr->special_defense & (DEFENSE_POIS)) && (immune_type != DEFENSE_POIS))
2615 p_ptr->special_defense &= ~(DEFENSE_POIS);
2616 msg_print(_("毒の攻撃で傷つけられるようになった。。", "You are no longer immune to poison."));
2619 if ((v) && (immune_type))
2621 /* Set attack type. */
2622 p_ptr->special_defense |= (immune_type);
2625 p_ptr->ele_immune = v;
2629 msg_format("%sの攻撃を受けつけなくなった!",
2630 ((immune_type == DEFENSE_ACID) ? "酸" :
2631 ((immune_type == DEFENSE_ELEC) ? "電撃" :
2632 ((immune_type == DEFENSE_FIRE) ? "火炎" :
2633 ((immune_type == DEFENSE_COLD) ? "冷気" :
2634 ((immune_type == DEFENSE_POIS) ? "毒" :
2637 msg_format("For a while, You are immune to %s",
2638 ((immune_type == DEFENSE_ACID) ? "acid!" :
2639 ((immune_type == DEFENSE_ELEC) ? "electricity!" :
2640 ((immune_type == DEFENSE_FIRE) ? "fire!" :
2641 ((immune_type == DEFENSE_COLD) ? "cold!" :
2642 ((immune_type == DEFENSE_POIS) ? "poison!" :
2643 "do nothing special."))))));
2647 if (disturb_state) disturb(FALSE, FALSE);
2649 /* Redraw status bar */
2650 p_ptr->redraw |= (PR_STATUS);
2652 p_ptr->update |= (PU_BONUS);
2661 * @brief 一時的酸耐性の継続時間をセットする / Set "p_ptr->oppose_acid", notice observable changes
2663 * @param do_dec 現在の継続時間より長い値のみ上書きする
2664 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2666 bool set_oppose_acid(TIME_EFFECT v, bool do_dec)
2668 bool notice = FALSE;
2670 /* Hack -- Force good values */
2671 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2673 if (p_ptr->is_dead) return FALSE;
2678 if (p_ptr->oppose_acid && !do_dec)
2680 if (p_ptr->oppose_acid > v) return FALSE;
2682 else if (!IS_OPPOSE_ACID())
2684 msg_print(_("酸への耐性がついた気がする!", "You feel resistant to acid!"));
2692 if (p_ptr->oppose_acid && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
2694 msg_print(_("酸への耐性が薄れた気がする。", "You feel less resistant to acid."));
2700 p_ptr->oppose_acid = v;
2702 /* Nothing to notice */
2703 if (!notice) return (FALSE);
2705 /* Redraw status bar */
2706 p_ptr->redraw |= (PR_STATUS);
2708 if (disturb_state) disturb(FALSE, FALSE);
2716 * @brief 一時的電撃耐性の継続時間をセットする / Set "p_ptr->oppose_elec", notice observable changes
2718 * @param do_dec 現在の継続時間より長い値のみ上書きする
2719 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2721 bool set_oppose_elec(TIME_EFFECT v, bool do_dec)
2723 bool notice = FALSE;
2725 /* Hack -- Force good values */
2726 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2728 if (p_ptr->is_dead) return FALSE;
2733 if (p_ptr->oppose_elec && !do_dec)
2735 if (p_ptr->oppose_elec > v) return FALSE;
2737 else if (!IS_OPPOSE_ELEC())
2739 msg_print(_("電撃への耐性がついた気がする!", "You feel resistant to electricity!"));
2747 if (p_ptr->oppose_elec && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
2749 msg_print(_("電撃への耐性が薄れた気がする。", "You feel less resistant to electricity."));
2755 p_ptr->oppose_elec = v;
2757 /* Nothing to notice */
2758 if (!notice) return (FALSE);
2760 /* Redraw status bar */
2761 p_ptr->redraw |= (PR_STATUS);
2763 if (disturb_state) disturb(FALSE, FALSE);
2771 * @brief 一時的火炎耐性の継続時間をセットする / Set "p_ptr->oppose_fire", notice observable changes
2773 * @param do_dec 現在の継続時間より長い値のみ上書きする
2774 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2776 bool set_oppose_fire(TIME_EFFECT v, bool do_dec)
2778 bool notice = FALSE;
2780 /* Hack -- Force good values */
2781 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2783 if (p_ptr->is_dead) return FALSE;
2785 if ((prace_is_(RACE_DEMON) && (p_ptr->lev > 44)) || (p_ptr->mimic_form == MIMIC_DEMON)) v = 1;
2789 if (p_ptr->oppose_fire && !do_dec)
2791 if (p_ptr->oppose_fire > v) return FALSE;
2793 else if (!IS_OPPOSE_FIRE())
2795 msg_print(_("火への耐性がついた気がする!", "You feel resistant to fire!"));
2803 if (p_ptr->oppose_fire && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
2805 msg_print(_("火への耐性が薄れた気がする。", "You feel less resistant to fire."));
2811 p_ptr->oppose_fire = v;
2813 /* Nothing to notice */
2814 if (!notice) return (FALSE);
2816 /* Redraw status bar */
2817 p_ptr->redraw |= (PR_STATUS);
2819 if (disturb_state) disturb(FALSE, FALSE);
2827 * @brief 一時的冷気耐性の継続時間をセットする / Set "p_ptr->oppose_cold", notice observable changes
2829 * @param do_dec 現在の継続時間より長い値のみ上書きする
2830 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2832 bool set_oppose_cold(TIME_EFFECT v, bool do_dec)
2834 bool notice = FALSE;
2836 /* Hack -- Force good values */
2837 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2839 if (p_ptr->is_dead) return FALSE;
2844 if (p_ptr->oppose_cold && !do_dec)
2846 if (p_ptr->oppose_cold > v) return FALSE;
2848 else if (!IS_OPPOSE_COLD())
2850 msg_print(_("冷気への耐性がついた気がする!", "You feel resistant to cold!"));
2858 if (p_ptr->oppose_cold && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
2860 msg_print(_("冷気への耐性が薄れた気がする。", "You feel less resistant to cold."));
2866 p_ptr->oppose_cold = v;
2868 /* Nothing to notice */
2869 if (!notice) return (FALSE);
2871 /* Redraw status bar */
2872 p_ptr->redraw |= (PR_STATUS);
2874 if (disturb_state) disturb(FALSE, FALSE);
2882 * @brief 一時的毒耐性の継続時間をセットする / Set "p_ptr->oppose_pois", notice observable changes
2884 * @param do_dec 現在の継続時間より長い値のみ上書きする
2885 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2887 bool set_oppose_pois(TIME_EFFECT v, bool do_dec)
2889 bool notice = FALSE;
2891 /* Hack -- Force good values */
2892 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2894 if ((p_ptr->pclass == CLASS_NINJA) && (p_ptr->lev > 44)) v = 1;
2895 if (p_ptr->is_dead) return FALSE;
2900 if (p_ptr->oppose_pois && !do_dec)
2902 if (p_ptr->oppose_pois > v) return FALSE;
2904 else if (!IS_OPPOSE_POIS())
2906 msg_print(_("毒への耐性がついた気がする!", "You feel resistant to poison!"));
2914 if (p_ptr->oppose_pois && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
2916 msg_print(_("毒への耐性が薄れた気がする。", "You feel less resistant to poison."));
2922 p_ptr->oppose_pois = v;
2924 /* Nothing to notice */
2925 if (!notice) return (FALSE);
2927 /* Redraw status bar */
2928 p_ptr->redraw |= (PR_STATUS);
2930 if (disturb_state) disturb(FALSE, FALSE);
2938 * @brief 朦朧の継続時間をセットする / Set "p_ptr->stun", notice observable changes
2940 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2942 * Note the special code to only notice "range" changes.
2944 bool set_stun(TIME_EFFECT v)
2946 int old_aux, new_aux;
2947 bool notice = FALSE;
2950 /* Hack -- Force good values */
2951 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2953 if (p_ptr->is_dead) return FALSE;
2955 if (prace_is_(RACE_GOLEM) || ((p_ptr->pclass == CLASS_BERSERKER) && (p_ptr->lev > 34))) v = 0;
2958 if (p_ptr->stun > 100)
2964 else if (p_ptr->stun > 50)
2970 else if (p_ptr->stun > 0)
3006 if (new_aux > old_aux)
3008 /* Describe the state */
3012 case 1: msg_print(_("意識がもうろうとしてきた。", "You have been stunned.")); break;
3015 case 2: msg_print(_("意識がひどくもうろうとしてきた。", "You have been heavily stunned.")); break;
3018 case 3: msg_print(_("頭がクラクラして意識が遠のいてきた。", "You have been knocked out.")); break;
3021 if (randint1(1000) < v || one_in_(16))
3023 msg_print(_("割れるような頭痛がする。", "A vicious blow hits your head."));
3027 if (!p_ptr->sustain_int) (void)do_dec_stat(A_INT);
3028 if (!p_ptr->sustain_wis) (void)do_dec_stat(A_WIS);
3030 else if (one_in_(2))
3032 if (!p_ptr->sustain_int) (void)do_dec_stat(A_INT);
3036 if (!p_ptr->sustain_wis) (void)do_dec_stat(A_WIS);
3039 if (p_ptr->special_defense & KATA_MASK)
3041 msg_print(_("型が崩れた。", "Your posture gets loose."));
3042 p_ptr->special_defense &= ~(KATA_MASK);
3043 p_ptr->update |= (PU_BONUS);
3044 p_ptr->update |= (PU_MONSTERS);
3045 p_ptr->redraw |= (PR_STATE);
3046 p_ptr->redraw |= (PR_STATUS);
3047 p_ptr->action = ACTION_NONE;
3051 if (p_ptr->concent) reset_concentration(TRUE);
3054 if (hex_spelling_any()) stop_hex_spell_all();
3060 else if (new_aux < old_aux)
3062 /* Describe the state */
3067 msg_print(_("やっと朦朧状態から回復した。", "You are no longer stunned."));
3069 if (disturb_state) disturb(FALSE, FALSE);
3080 if (!notice) return (FALSE);
3082 if (disturb_state) disturb(FALSE, FALSE);
3084 /* Recalculate bonuses */
3085 p_ptr->update |= (PU_BONUS);
3087 /* Redraw the "stun" */
3088 p_ptr->redraw |= (PR_STUN);
3097 * @brief 出血の継続時間をセットする / Set "p_ptr->cut", notice observable changes
3099 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
3101 * Note the special code to only notice "range" changes.
3103 bool set_cut(TIME_EFFECT v)
3105 int old_aux, new_aux;
3106 bool notice = FALSE;
3108 /* Hack -- Force good values */
3109 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
3111 if (p_ptr->is_dead) return FALSE;
3113 if ((p_ptr->prace == RACE_GOLEM ||
3114 p_ptr->prace == RACE_SKELETON ||
3115 p_ptr->prace == RACE_SPECTRE ||
3116 (p_ptr->prace == RACE_ZOMBIE && p_ptr->lev > 11)) &&
3121 if (p_ptr->cut > 1000)
3127 else if (p_ptr->cut > 200)
3133 else if (p_ptr->cut > 100)
3139 else if (p_ptr->cut > 50)
3145 else if (p_ptr->cut > 25)
3151 else if (p_ptr->cut > 10)
3157 else if (p_ptr->cut > 0)
3217 if (new_aux > old_aux)
3219 /* Describe the state */
3223 case 1: msg_print(_("かすり傷を負ってしまった。", "You have been given a graze.")); break;
3226 case 2: msg_print(_("軽い傷を負ってしまった。", "You have been given a light cut.")); break;
3229 case 3: msg_print(_("ひどい傷を負ってしまった。", "You have been given a bad cut.")); break;
3232 case 4: msg_print(_("大変な傷を負ってしまった。", "You have been given a nasty cut.")); break;
3235 case 5: msg_print(_("重大な傷を負ってしまった。", "You have been given a severe cut.")); break;
3238 case 6: msg_print(_("ひどい深手を負ってしまった。", "You have been given a deep gash.")); break;
3241 case 7: msg_print(_("致命的な傷を負ってしまった。", "You have been given a mortal wound.")); break;
3246 if (randint1(1000) < v || one_in_(16))
3248 if (!p_ptr->sustain_chr)
3250 msg_print(_("ひどい傷跡が残ってしまった。", "You have been horribly scarred."));
3257 else if (new_aux < old_aux)
3259 /* Describe the state */
3264 msg_format(_("やっと%s。", "You are no longer bleeding."), p_ptr->prace == RACE_ANDROID ? "怪我が直った" : "出血が止まった");
3266 if (disturb_state) disturb(FALSE, FALSE);
3277 if (!notice) return (FALSE);
3279 if (disturb_state) disturb(FALSE, FALSE);
3281 /* Recalculate bonuses */
3282 p_ptr->update |= (PU_BONUS);
3284 /* Redraw the "cut" */
3285 p_ptr->redraw |= (PR_CUT);
3293 * @brief 空腹状態をセットする / Set "p_ptr->food", notice observable changes
3295 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
3297 * Set "", notice observable changes\n
3299 * The "p_ptr->food" variable can get as large as 20000, allowing the
3300 * addition of the most "filling" item, Elvish Waybread, which adds
3301 * 7500 food units, without overflowing the 32767 maximum limit.\n
3303 * Perhaps we should disturb the player with various messages,
3304 * especially messages about hunger status changes. \n
3306 * Digestion of food is handled in "dungeon.c", in which, normally,
3307 * the player digests about 20 food units per 100 game turns, more
3308 * when "fast", more when "regenerating", less with "slow digestion",
3309 * but when the player is "gorged", he digests 100 food units per 10
3310 * game turns, or a full 1000 food units per 100 game turns.\n
3312 * Note that the player's speed is reduced by 10 units while gorged,
3313 * so if the player eats a single food ration (5000 food units) when
3314 * full (15000 food units), he will be gorged for (5000/100)*10 = 500
3315 * game turns, or 500/(100/5) = 25 player turns (if nothing else is
3316 * affecting the player speed).\n
3318 bool set_food(TIME_EFFECT v)
3320 int old_aux, new_aux;
3322 bool notice = FALSE;
3324 /* Hack -- Force good values */
3325 v = (v > 20000) ? 20000 : (v < 0) ? 0 : v;
3327 /* Fainting / Starving */
3328 if (p_ptr->food < PY_FOOD_FAINT)
3334 else if (p_ptr->food < PY_FOOD_WEAK)
3340 else if (p_ptr->food < PY_FOOD_ALERT)
3346 else if (p_ptr->food < PY_FOOD_FULL)
3352 else if (p_ptr->food < PY_FOOD_MAX)
3363 /* Fainting / Starving */
3364 if (v < PY_FOOD_FAINT)
3370 else if (v < PY_FOOD_WEAK)
3376 else if (v < PY_FOOD_ALERT)
3382 else if (v < PY_FOOD_FULL)
3388 else if (v < PY_FOOD_MAX)
3399 if (old_aux < 1 && new_aux > 0)
3400 chg_virtue(V_PATIENCE, 2);
3401 else if (old_aux < 3 && (old_aux != new_aux))
3402 chg_virtue(V_PATIENCE, 1);
3404 chg_virtue(V_TEMPERANCE, 1);
3406 chg_virtue(V_TEMPERANCE, -1);
3409 if (new_aux > old_aux)
3411 /* Describe the state */
3415 case 1: msg_print(_("まだ空腹で倒れそうだ。", "You are still weak.")); break;
3418 case 2: msg_print(_("まだ空腹だ。", "You are still hungry.")); break;
3421 case 3: msg_print(_("空腹感がおさまった。", "You are no longer hungry.")); break;
3424 case 4: msg_print(_("満腹だ!", "You are full!")); break;
3428 msg_print(_("食べ過ぎだ!", "You have gorged yourself!"));
3429 chg_virtue(V_HARMONY, -1);
3430 chg_virtue(V_PATIENCE, -1);
3431 chg_virtue(V_TEMPERANCE, -2);
3441 else if (new_aux < old_aux)
3443 /* Describe the state */
3446 /* Fainting / Starving */
3447 case 0: msg_print(_("あまりにも空腹で気を失ってしまった!", "You are getting faint from hunger!")); break;
3450 case 1: msg_print(_("お腹が空いて倒れそうだ。", "You are getting weak from hunger!")); break;
3453 case 2: msg_print(_("お腹が空いてきた。", "You are getting hungry.")); break;
3456 case 3: msg_print(_("満腹感がなくなった。", "You are no longer full.")); break;
3459 case 4: msg_print(_("やっとお腹がきつくなくなった。", "You are no longer gorged.")); break;
3462 if (p_ptr->wild_mode && (new_aux < 2))
3474 /* Nothing to notice */
3475 if (!notice) return (FALSE);
3477 if (disturb_state) disturb(FALSE, FALSE);
3479 /* Recalculate bonuses */
3480 p_ptr->update |= (PU_BONUS);
3483 p_ptr->redraw |= (PR_HUNGER);
3491 * @brief プレイヤーの基本能力値を増加させる / Increases a stat by one randomized level -RAK-
3492 * @param stat 上昇させるステータスID
3493 * @return 実際に上昇した場合TRUEを返す。
3495 * Note that this function (used by stat potions) now restores\n
3496 * the stat BEFORE increasing it.\n
3498 bool inc_stat(int stat)
3500 BASE_STATUS value, gain;
3502 /* Then augment the current/max stat */
3503 value = p_ptr->stat_cur[stat];
3505 /* Cannot go above 18/100 */
3506 if (value < p_ptr->stat_max_max[stat])
3508 /* Gain one (sometimes two) points */
3511 gain = ((randint0(100) < 75) ? 1 : 2);
3515 /* Gain 1/6 to 1/3 of distance to 18/100 */
3516 else if (value < (p_ptr->stat_max_max[stat]-2))
3518 /* Approximate gain value */
3519 gain = (((p_ptr->stat_max_max[stat]) - value) / 2 + 3) / 2;
3522 if (gain < 1) gain = 1;
3524 /* Apply the bonus */
3525 value += randint1(gain) + gain / 2;
3528 if (value > (p_ptr->stat_max_max[stat]-1)) value = p_ptr->stat_max_max[stat]-1;
3531 /* Gain one point at a time */
3537 /* Save the new value */
3538 p_ptr->stat_cur[stat] = value;
3540 /* Bring up the maximum too */
3541 if (value > p_ptr->stat_max[stat])
3543 p_ptr->stat_max[stat] = value;
3546 /* Recalculate bonuses */
3547 p_ptr->update |= (PU_BONUS);
3553 /* Nothing to gain */
3558 * @brief プレイヤーの基本能力値を減少させる / Decreases a stat by an amount indended to vary from 0 to 100 percent.
3559 * @param stat 減少させるステータスID
3560 * @param amount 減少させる基本量
3561 * @param permanent TRUEならば現在の最大値を減少させる
3562 * @return 実際に減少した場合TRUEを返す。
3565 * Amount could be a little higher in extreme cases to mangle very high\n
3566 * stats from massive assaults. -CWS\n
3568 * Note that "permanent" means that the *given* amount is permanent,\n
3569 * not that the new value becomes permanent. This may not work exactly\n
3570 * as expected, due to "weirdness" in the algorithm, but in general,\n
3571 * if your stat is already drained, the "max" value will not drop all\n
3572 * the way down to the "cur" value.\n
3574 bool dec_stat(int stat, int amount, int permanent)
3576 BASE_STATUS cur, max;
3581 /* Acquire current value */
3582 cur = p_ptr->stat_cur[stat];
3583 max = p_ptr->stat_max[stat];
3585 /* Note when the values are identical */
3586 same = (cur == max);
3588 /* Damage "current" value */
3591 /* Handle "low" values */
3594 if (amount > 90) cur--;
3595 if (amount > 50) cur--;
3596 if (amount > 20) cur--;
3600 /* Handle "high" values */
3603 /* Hack -- Decrement by a random amount between one-quarter */
3604 /* and one-half of the stat bonus times the percentage, with a */
3605 /* minimum damage of half the percentage. -CWS */
3606 loss = (((cur-18) / 2 + 1) / 2 + 1);
3609 if (loss < 1) loss = 1;
3611 /* Randomize the loss */
3612 loss = ((randint1(loss) + loss) * amount) / 100;
3615 if (loss < amount/2) loss = amount/2;
3617 /* Lose some points */
3620 /* Hack -- Only reduce stat to 17 sometimes */
3621 if (cur < 18) cur = (amount <= 20) ? 18 : 17;
3624 /* Prevent illegal values */
3625 if (cur < 3) cur = 3;
3627 /* Something happened */
3628 if (cur != p_ptr->stat_cur[stat]) res = TRUE;
3631 /* Damage "max" value */
3632 if (permanent && (max > 3))
3634 chg_virtue(V_SACRIFICE, 1);
3635 if (stat == A_WIS || stat == A_INT)
3636 chg_virtue(V_ENLIGHTEN, -2);
3638 /* Handle "low" values */
3641 if (amount > 90) max--;
3642 if (amount > 50) max--;
3643 if (amount > 20) max--;
3647 /* Handle "high" values */
3650 /* Hack -- Decrement by a random amount between one-quarter */
3651 /* and one-half of the stat bonus times the percentage, with a */
3652 /* minimum damage of half the percentage. -CWS */
3653 loss = (((max-18) / 2 + 1) / 2 + 1);
3654 loss = ((randint1(loss) + loss) * amount) / 100;
3655 if (loss < amount/2) loss = amount/2;
3657 /* Lose some points */
3660 /* Hack -- Only reduce stat to 17 sometimes */
3661 if (max < 18) max = (amount <= 20) ? 18 : 17;
3664 /* Hack -- keep it clean */
3665 if (same || (max < cur)) max = cur;
3667 /* Something happened */
3668 if (max != p_ptr->stat_max[stat]) res = TRUE;
3674 /* Actually set the stat to its new value. */
3675 p_ptr->stat_cur[stat] = cur;
3676 p_ptr->stat_max[stat] = max;
3678 /* Redisplay the stats later */
3679 p_ptr->redraw |= (PR_STATS);
3681 /* Recalculate bonuses */
3682 p_ptr->update |= (PU_BONUS);
3690 * @brief プレイヤーの基本能力値を回復させる / Restore a stat. Return TRUE only if this actually makes a difference.
3691 * @param stat 回復ステータスID
3692 * @return 実際に回復した場合TRUEを返す。
3694 bool res_stat(int stat)
3696 /* Restore if needed */
3697 if (p_ptr->stat_cur[stat] != p_ptr->stat_max[stat])
3700 p_ptr->stat_cur[stat] = p_ptr->stat_max[stat];
3702 /* Recalculate bonuses */
3703 p_ptr->update |= (PU_BONUS);
3705 /* Redisplay the stats later */
3706 p_ptr->redraw |= (PR_STATS);
3712 /* Nothing to restore */
3718 * Increase players hit points, notice effects
3720 bool hp_player(int num)
3723 vir = virtue_number(V_VITALITY);
3725 if(num <= 0) return (FALSE);
3729 num = num * (p_ptr->virtues[vir - 1] + 1250) / 1250;
3731 /* Healing needed */
3732 if (p_ptr->chp < p_ptr->mhp)
3734 if ((num > 0) && (p_ptr->chp < (p_ptr->mhp/3)))
3735 chg_virtue(V_TEMPERANCE, 1);
3736 /* Gain hitpoints */
3739 /* Enforce maximum */
3740 if (p_ptr->chp >= p_ptr->mhp)
3742 p_ptr->chp = p_ptr->mhp;
3743 p_ptr->chp_frac = 0;
3746 p_ptr->redraw |= (PR_HP);
3748 p_ptr->window |= (PW_PLAYER);
3753 msg_print(_("少し気分が良くなった。", "You feel a little better."));
3759 msg_print(_("気分が良くなった。", "You feel better."));
3765 msg_print(_("とても気分が良くなった。", "You feel much better."));
3771 msg_print(_("ひじょうに気分が良くなった。", "You feel very good."));
3783 * Array of stat "descriptions"
3785 static cptr desc_stat_pos[] =
3790 _("器用に", "dextrous"),
3791 _("健康に", "healthy"),
3797 * Array of stat "descriptions"
3799 static cptr desc_stat_neg[] =
3804 _("不器用に", "clumsy"),
3805 _("不健康に", "sickly"),
3813 bool do_dec_stat(int stat)
3817 /* Access the "sustain" */
3820 case A_STR: if (p_ptr->sustain_str) sust = TRUE; break;
3821 case A_INT: if (p_ptr->sustain_int) sust = TRUE; break;
3822 case A_WIS: if (p_ptr->sustain_wis) sust = TRUE; break;
3823 case A_DEX: if (p_ptr->sustain_dex) sust = TRUE; break;
3824 case A_CON: if (p_ptr->sustain_con) sust = TRUE; break;
3825 case A_CHR: if (p_ptr->sustain_chr) sust = TRUE; break;
3829 if (sust && (!ironman_nightmare || randint0(13)))
3831 msg_format(_("%sなった気がしたが、すぐに元に戻った。", "You feel %s for a moment, but the feeling passes."),
3832 desc_stat_neg[stat]);
3838 /* Attempt to reduce the stat */
3839 if (dec_stat(stat, 10, (ironman_nightmare && !randint0(13))))
3841 msg_format(_("ひどく%sなった気がする。", "You feel very %s."), desc_stat_neg[stat]);
3847 /* Nothing obvious */
3853 * Restore lost "points" in a stat
3855 bool do_res_stat(int stat)
3857 /* Attempt to increase */
3860 msg_format(_("元通りに%sなった気がする。", "You feel less %s."), desc_stat_pos[stat]);
3865 /* Nothing obvious */
3871 * Gain a "point" in a stat
3873 bool do_inc_stat(int stat)
3877 /* Restore strength */
3878 res = res_stat(stat);
3880 /* Attempt to increase */
3885 chg_virtue(V_ENLIGHTEN, 1);
3886 chg_virtue(V_FAITH, 1);
3888 else if (stat == A_INT)
3890 chg_virtue(V_KNOWLEDGE, 1);
3891 chg_virtue(V_ENLIGHTEN, 1);
3893 else if (stat == A_CON)
3894 chg_virtue(V_VITALITY, 1);
3896 msg_format(_("ワーオ!とても%sなった!", "Wow! You feel very %s!"), desc_stat_pos[stat]);
3901 /* Restoration worked */
3904 msg_format(_("元通りに%sなった気がする。", "You feel less %s."), desc_stat_pos[stat]);
3909 /* Nothing obvious */
3915 * Restores any drained experience
3917 bool restore_level(void)
3919 /* Restore experience */
3920 if (p_ptr->exp < p_ptr->max_exp)
3922 msg_print(_("経験値が戻ってきた気がする。", "You feel your experience returning."));
3924 /* Restore the experience */
3925 p_ptr->exp = p_ptr->max_exp;
3927 /* Check the experience */
3941 bool lose_all_info(void)
3945 chg_virtue(V_KNOWLEDGE, -5);
3946 chg_virtue(V_ENLIGHTEN, -5);
3948 /* Forget info about objects */
3949 for (i = 0; i < INVEN_TOTAL; i++)
3951 object_type *o_ptr = &inventory[i];
3953 /* Skip non-objects */
3954 if (!o_ptr->k_idx) continue;
3956 /* Allow "protection" by the MENTAL flag */
3957 if (o_ptr->ident & (IDENT_MENTAL)) continue;
3959 /* Remove "default inscriptions" */
3960 o_ptr->feeling = FEEL_NONE;
3962 /* Hack -- Clear the "empty" flag */
3963 o_ptr->ident &= ~(IDENT_EMPTY);
3965 /* Hack -- Clear the "known" flag */
3966 o_ptr->ident &= ~(IDENT_KNOWN);
3968 /* Hack -- Clear the "felt" flag */
3969 o_ptr->ident &= ~(IDENT_SENSE);
3972 /* Recalculate bonuses */
3973 p_ptr->update |= (PU_BONUS);
3975 /* Combine / Reorder the pack (later) */
3976 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
3978 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
3980 /* Mega-Hack -- Forget the map */
3988 void do_poly_wounds(void)
3990 /* Changed to always provide at least _some_ healing */
3991 s16b wounds = p_ptr->cut;
3992 s16b hit_p = (p_ptr->mhp - p_ptr->chp);
3993 s16b change = damroll(p_ptr->lev, 5);
3994 bool Nasty_effect = one_in_(5);
3996 if (!(wounds || hit_p || Nasty_effect)) return;
3998 msg_print(_("傷がより軽いものに変化した。", "Your wounds are polymorphed into less serious ones."));
4002 msg_print(_("新たな傷ができた!", "A new wound was created!"));
4003 take_hit(DAMAGE_LOSELIFE, change / 2, _("変化した傷", "a polymorphed wound"), -1);
4008 set_cut(p_ptr->cut - (change / 2));
4014 * Change player race
4016 void change_race(CHARACTER_IDX new_race, cptr effect_msg)
4018 cptr title = race_info[new_race].title;
4019 int old_race = p_ptr->prace;
4022 msg_format("あなたは%s%sに変化した!", effect_msg, title);
4024 msg_format("You turn into %s %s%s!", (!effect_msg[0] && is_a_vowel(title[0]) ? "an" : "a"), effect_msg, title);
4027 chg_virtue(V_CHANCE, 2);
4029 if (p_ptr->prace < 32)
4031 p_ptr->old_race1 |= 1L << p_ptr->prace;
4035 p_ptr->old_race2 |= 1L << (p_ptr->prace - 32);
4037 p_ptr->prace = new_race;
4038 rp_ptr = &race_info[p_ptr->prace];
4040 /* Experience factor */
4041 p_ptr->expfact = rp_ptr->r_exp + cp_ptr->c_exp;
4044 * The speed bonus of Klackons and Sprites are disabled
4045 * and the experience penalty is decreased.
4047 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)))
4048 p_ptr->expfact -= 15;
4050 /* Get character's height and weight */
4051 get_height_weight();
4054 if (p_ptr->pclass == CLASS_SORCERER)
4055 p_ptr->hitdie = rp_ptr->r_mhp/2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
4057 p_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
4059 do_cmd_rerate(FALSE);
4061 /* The experience level may be modified */
4064 p_ptr->redraw |= (PR_BASIC);
4066 p_ptr->update |= (PU_BONUS);
4070 /* Load an autopick preference file */
4071 if (old_race != p_ptr->prace) autopick_load_pref(FALSE);
4073 /* Player's graphic tile may change */
4074 lite_spot(p_ptr->y, p_ptr->x);
4078 void do_poly_self(void)
4080 int power = p_ptr->lev;
4082 msg_print(_("あなたは変化の訪れを感じた...", "You feel a change coming over you..."));
4083 chg_virtue(V_CHANCE, 1);
4085 if ((power > randint0(20)) && one_in_(3) && (p_ptr->prace != RACE_ANDROID))
4087 char effect_msg[80] = "";
4088 CHARACTER_IDX new_race;
4090 /* Some form of racial polymorph... */
4093 if ((power > randint0(5)) && one_in_(4))
4098 if (p_ptr->psex == SEX_MALE)
4100 p_ptr->psex = SEX_FEMALE;
4101 sp_ptr = &sex_info[p_ptr->psex];
4102 sprintf(effect_msg, _("女性の", "female "));
4106 p_ptr->psex = SEX_MALE;
4107 sp_ptr = &sex_info[p_ptr->psex];
4108 sprintf(effect_msg, _("男性の", "male "));
4112 if ((power > randint0(30)) && one_in_(5))
4116 /* Harmful deformity */
4123 (void)dec_stat(tmp, randint1(6) + 6, one_in_(3));
4129 /* Deformities are discriminated against! */
4130 (void)dec_stat(A_CHR, randint1(6), TRUE);
4135 sprintf(tmp_msg,_("%s", "%s "),effect_msg);
4136 sprintf(effect_msg,_("奇形の%s", "deformed %s "),tmp_msg);
4140 sprintf(effect_msg,_("奇形の", "deformed "));
4144 while ((power > randint0(20)) && one_in_(10))
4146 /* Polymorph into a less mutated form */
4149 if (!lose_mutation(0))
4150 msg_print(_("奇妙なくらい普通になった気がする。", "You feel oddly normal."));
4155 new_race = (CHARACTER_IDX)randint0(MAX_RACES);
4157 while ((new_race == p_ptr->prace) || (new_race == RACE_ANDROID));
4159 change_race(new_race, effect_msg);
4162 if ((power > randint0(30)) && one_in_(6))
4168 msg_format(_("%sの構成が変化した!", "Your internal organs are rearranged!"), p_ptr->prace == RACE_ANDROID ? "機械" : "内臓");
4172 (void)dec_stat(tmp, randint1(6) + 6, one_in_(3));
4177 msg_print(_("現在の姿で生きていくのは困難なようだ!", "You find living difficult in your present form!"));
4178 take_hit(DAMAGE_LOSELIFE, damroll(randint1(10), p_ptr->lev), _("致命的な突然変異", "a lethal mutation"), -1);
4184 if ((power > randint0(20)) && one_in_(4))
4189 do_cmd_rerate(FALSE);
4192 while ((power > randint0(15)) && one_in_(3))
4195 (void)gain_random_mutation(0);
4198 if (power > randint0(5))
4204 /* Note: earlier deductions may have left power < 0 already. */
4214 * Decreases players hit points and sets death flag if necessary
4216 * Invulnerability needs to be changed into a "shield"
4218 * Hack -- this function allows the user to save (or quit)
4219 * the game when he dies, since the "You die." message is shown before
4220 * setting the player to "dead".
4223 int take_hit(int damage_type, HIT_POINT damage, cptr hit_from, int monspell)
4225 int old_chp = p_ptr->chp;
4227 char death_message[1024];
4230 int warning = (p_ptr->mhp * hitpoint_warn / 10);
4233 if (p_ptr->is_dead) return 0;
4235 if (p_ptr->sutemi) damage *= 2;
4236 if (p_ptr->special_defense & KATA_IAI) damage += (damage + 4) / 5;
4238 if (easy_band) damage = (damage+1)/2;
4240 if (damage_type != DAMAGE_USELIFE)
4242 disturb(TRUE, TRUE);
4249 if (monspell >= 0) learn_spell(monspell);
4251 /* Mega-Hack -- Apply "invulnerability" */
4252 if ((damage_type != DAMAGE_USELIFE) && (damage_type != DAMAGE_LOSELIFE))
4254 if (IS_INVULN() && (damage < 9000))
4256 if (damage_type == DAMAGE_FORCE)
4258 msg_print(_("バリアが切り裂かれた!", "The attack cuts your shield of invulnerability open!"));
4260 else if (one_in_(PENETRATE_INVULNERABILITY))
4262 msg_print(_("無敵のバリアを破って攻撃された!", "The attack penetrates your shield of invulnerability!"));
4270 if (CHECK_MULTISHADOW())
4272 if (damage_type == DAMAGE_FORCE)
4274 msg_print(_("幻影もろとも体が切り裂かれた!", "The attack hits Shadow together with you!"));
4276 else if (damage_type == DAMAGE_ATTACK)
4278 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
4283 if (p_ptr->wraith_form)
4285 if (damage_type == DAMAGE_FORCE)
4287 msg_print(_("半物質の体が切り裂かれた!", "The attack cuts through your ethereal body!"));
4292 if ((damage == 0) && one_in_(2)) damage = 1;
4296 if (p_ptr->special_defense & KATA_MUSOU)
4299 if ((damage == 0) && one_in_(2)) damage = 1;
4301 } /* not if LOSELIFE USELIFE */
4303 /* Hurt the player */
4304 p_ptr->chp -= damage;
4305 if(damage_type == DAMAGE_GENO && p_ptr->chp < 0)
4307 damage += p_ptr->chp;
4311 /* Display the hitpoints */
4312 p_ptr->redraw |= (PR_HP);
4314 p_ptr->window |= (PW_PLAYER);
4316 if (damage_type != DAMAGE_GENO && p_ptr->chp == 0)
4318 chg_virtue(V_SACRIFICE, 1);
4319 chg_virtue(V_CHANCE, 2);
4325 bool android = (p_ptr->prace == RACE_ANDROID ? TRUE : FALSE);
4327 #ifdef JP /* 死んだ時に強制終了して死を回避できなくしてみた by Habu */
4329 if(!save_player()) msg_print("セーブ失敗!");
4334 chg_virtue(V_SACRIFICE, 10);
4339 p_ptr->leaving = TRUE;
4342 p_ptr->is_dead = TRUE;
4344 if (p_ptr->inside_arena)
4346 cptr m_name = r_name+r_info[arena_info[p_ptr->arena_number].r_idx].name;
4347 msg_format(_("あなたは%sの前に敗れ去った。", "You are beaten by %s."), m_name);
4349 if (record_arena) do_cmd_write_nikki(NIKKI_ARENA, -1 - p_ptr->arena_number, m_name);
4353 QUEST_IDX q_idx = quest_number(dun_level);
4354 bool seppuku = streq(hit_from, "Seppuku");
4355 bool winning_seppuku = p_ptr->total_winner && seppuku;
4357 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_GAMEOVER);
4360 /* Make screen dump */
4361 screen_dump = make_screen_dump();
4364 /* Note cause of death */
4367 strcpy(p_ptr->died_from, hit_from);
4369 if (!winning_seppuku) strcpy(p_ptr->died_from, "切腹");
4376 sprintf(dummy, "%s%s%s", !p_ptr->paralyzed ? "" : p_ptr->free_act ? "彫像状態で" : "麻痺状態で", p_ptr->image ? "幻覚に歪んだ" : "", hit_from);
4378 sprintf(dummy, "%s%s", hit_from, !p_ptr->paralyzed ? "" : " while helpless");
4380 my_strcpy(p_ptr->died_from, dummy, sizeof p_ptr->died_from);
4383 /* No longer a winner */
4384 p_ptr->total_winner = FALSE;
4386 if (winning_seppuku)
4388 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("勝利の後切腹した。", "did Seppuku after the winning."));
4394 if (p_ptr->inside_arena)
4395 strcpy(buf,_("アリーナ", "in the Arena"));
4396 else if (!dun_level)
4397 strcpy(buf,_("地上", "on the surface"));
4398 else if (q_idx && (is_fixed_quest_idx(q_idx) &&
4399 !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
4400 strcpy(buf,_("クエスト", "in a quest"));
4402 sprintf(buf,_("%d階", "level %d"), (int)dun_level);
4404 sprintf(tmp, _("%sで%sに殺された。", "killed by %s %s."), buf, p_ptr->died_from);
4405 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, tmp);
4408 do_cmd_write_nikki(NIKKI_GAMESTART, 1, _("-------- ゲームオーバー --------", "-------- Game Over --------"));
4409 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, "\n\n\n\n");
4413 if (get_check_strict(_("画面を保存しますか?", "Dump the screen? "), CHECK_NO_HISTORY))
4415 do_cmd_save_screen();
4420 /* Initialize "last message" buffer */
4421 if (p_ptr->last_message) string_free(p_ptr->last_message);
4422 p_ptr->last_message = NULL;
4424 /* Hack -- Note death */
4428 msg_format("あなたは%sました。", android ? "壊れ" : "死に");
4430 msg_print(android ? "You are broken." : "You die.");
4437 if (winning_seppuku)
4439 get_rnd_line(_("seppuku_j.txt", "seppuku.txt"), 0, death_message);
4443 get_rnd_line(_("death_j.txt", "death.txt"), 0, death_message);
4449 while (!get_string(winning_seppuku ? "辞世の句: " : "断末魔の叫び: ", death_message, 1024)) ;
4451 while (!get_string("Last word: ", death_message, 1024)) ;
4454 while (winning_seppuku && !get_check_strict(_("よろしいですか?", "Are you sure? "), CHECK_NO_HISTORY));
4456 if (death_message[0] == '\0')
4459 strcpy(death_message, format("あなたは%sました。", android ? "壊れ" : "死に"));
4461 strcpy(death_message, android ? "You are broken." : "You die.");
4464 else p_ptr->last_message = string_make(death_message);
4467 if (winning_seppuku)
4472 int msg_pos_x[9] = { 5, 7, 9, 12, 14, 17, 19, 21, 23};
4473 int msg_pos_y[9] = { 3, 4, 5, 4, 5, 4, 5, 6, 4};
4480 for (i = 0; i < 40; i++)
4481 Term_putstr(randint0(w / 2) * 2, randint0(h), 2, TERM_VIOLET, "υ");
4483 str = death_message;
4484 if (strncmp(str, "「", 2) == 0) str += 2;
4486 str2 = my_strstr(str, "」");
4487 if (str2 != NULL) *str2 = '\0';
4492 str2 = my_strstr(str, " ");
4493 if (str2 == NULL) len = strlen(str);
4494 else len = str2 - str;
4498 Term_putstr_v(w * 3 / 4 - 2 - msg_pos_x[i] * 2, msg_pos_y[i], len,
4500 if (str2 == NULL) break;
4504 if (*str == 0) break;
4508 Term_putstr(w-1, h-1, 1, TERM_WHITE, " ");
4512 /* Make screen dump */
4513 screen_dump = make_screen_dump();
4516 /* Wait a key press */
4521 msg_print(death_message);
4531 /* Hitpoint warning */
4532 if (p_ptr->chp < warning)
4534 /* Hack -- bell on first notice */
4535 if (old_chp > warning) bell();
4539 if (record_danger && (old_chp > warning))
4541 if (p_ptr->image && damage_type == DAMAGE_ATTACK)
4542 hit_from = _("何か", "something");
4544 sprintf(tmp,_("%sによってピンチに陥った。", "A critical situation because of %s."),hit_from);
4545 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, tmp);
4550 /* stop auto_more even if DAMAGE_USELIFE */
4554 msg_print(_("*** 警告:低ヒット・ポイント! ***", "*** LOW HITPOINT WARNING! ***"));
4558 if (p_ptr->wild_mode && !p_ptr->leaving && (p_ptr->chp < MAX(warning, p_ptr->mhp/5)))
4569 void gain_exp_64(s32b amount, u32b amount_frac)
4571 if (p_ptr->is_dead) return;
4573 if (p_ptr->prace == RACE_ANDROID) return;
4575 /* Gain some experience */
4576 s64b_add(&(p_ptr->exp), &(p_ptr->exp_frac), amount, amount_frac);
4578 /* Slowly recover from experience drainage */
4579 if (p_ptr->exp < p_ptr->max_exp)
4581 /* Gain max experience (20%) (was 10%) */
4582 p_ptr->max_exp += amount / 5;
4585 /* Check Experience */
4593 void gain_exp(s32b amount)
4595 gain_exp_64(amount, 0L);
4599 void calc_android_exp(void)
4603 if (p_ptr->is_dead) return;
4605 if (p_ptr->prace != RACE_ANDROID) return;
4607 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
4609 object_type *o_ptr = &inventory[i];
4611 object_type *q_ptr = &forge;
4613 DEPTH level = MAX(k_info[o_ptr->k_idx].level - 8, 1);
4615 if ((i == INVEN_RIGHT) || (i == INVEN_LEFT) || (i == INVEN_NECK) || (i == INVEN_LITE)) continue;
4616 if (!o_ptr->k_idx) continue;
4619 object_copy(q_ptr, o_ptr);
4620 q_ptr->discount = 0;
4621 q_ptr->curse_flags = 0L;
4623 if (object_is_fixed_artifact(o_ptr))
4625 level = (level + MAX(a_info[o_ptr->name1].level - 8, 5)) / 2;
4626 level += MIN(20, a_info[o_ptr->name1].rarity/(a_info[o_ptr->name1].gen_flags & TRG_INSTA_ART ? 10 : 3));
4628 else if (object_is_ego(o_ptr))
4630 level += MAX(3, (e_info[o_ptr->name2].rating - 5)/2);
4632 else if (o_ptr->art_name)
4634 s32b total_flags = flag_cost(o_ptr, o_ptr->pval);
4637 if (!object_is_weapon_ammo(o_ptr))
4640 if (total_flags < 15000) fake_level = 10;
4641 else if (total_flags < 35000) fake_level = 25;
4642 else fake_level = 40;
4647 if (total_flags < 20000) fake_level = 10;
4648 else if (total_flags < 45000) fake_level = 25;
4649 else fake_level = 40;
4652 level = MAX(level, (level + MAX(fake_level - 8, 5)) / 2 + 3);
4655 value = object_value_real(q_ptr);
4657 if (value <= 0) continue;
4658 if ((o_ptr->tval == TV_SOFT_ARMOR) && (o_ptr->sval == SV_ABUNAI_MIZUGI) && (p_ptr->pseikaku != SEIKAKU_SEXY)) value /= 32;
4659 if (value > 5000000L) value = 5000000L;
4660 if ((o_ptr->tval == TV_DRAG_ARMOR) || (o_ptr->tval == TV_CARD)) level /= 2;
4662 if (object_is_artifact(o_ptr) || object_is_ego(o_ptr) ||
4663 (o_ptr->tval == TV_DRAG_ARMOR) ||
4664 ((o_ptr->tval == TV_HELM) && (o_ptr->sval == SV_DRAGON_HELM)) ||
4665 ((o_ptr->tval == TV_SHIELD) && (o_ptr->sval == SV_DRAGON_SHIELD)) ||
4666 ((o_ptr->tval == TV_GLOVES) && (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES)) ||
4667 ((o_ptr->tval == TV_BOOTS) && (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE)) ||
4668 ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DIAMOND_EDGE)))
4670 if (level > 65) level = 35 + (level - 65) / 5;
4671 else if (level > 35) level = 25 + (level - 35) / 3;
4672 else if (level > 15) level = 15 + (level - 15) / 2;
4673 exp = MIN(100000L, value) / 2 * level * level;
4674 if (value > 100000L)
4675 exp += (value - 100000L) / 8 * level * level;
4679 exp = MIN(100000L, value) * level;
4680 if (value > 100000L)
4681 exp += (value - 100000L) / 4 * level;
4683 if ((((i == INVEN_RARM) || (i == INVEN_LARM)) && (buki_motteruka(i))) || (i == INVEN_BOW)) total_exp += exp / 48;
4684 else total_exp += exp / 16;
4685 if (i == INVEN_BODY) total_exp += exp / 32;
4687 p_ptr->exp = p_ptr->max_exp = total_exp;
4689 /* Check Experience */
4697 void lose_exp(s32b amount)
4699 if (p_ptr->prace == RACE_ANDROID) return;
4701 /* Never drop below zero experience */
4702 if (amount > p_ptr->exp) amount = p_ptr->exp;
4704 /* Lose some experience */
4705 p_ptr->exp -= amount;
4707 /* Check Experience */
4714 * If resisted to draining, return FALSE
4716 bool drain_exp(s32b drain, s32b slip, int hold_exp_prob)
4718 /* Androids and their mimics are never drained */
4719 if (p_ptr->prace == RACE_ANDROID) return FALSE;
4721 if (p_ptr->hold_exp && (randint0(100) < hold_exp_prob))
4723 /* Hold experience */
4724 msg_print(_("しかし自己の経験値を守りきった!", "You keep hold of your experience!"));
4728 /* Hold experience failed */
4729 if (p_ptr->hold_exp)
4731 msg_print(_("経験値を少し吸い取られた気がする!", "You feel your experience slipping away!"));
4736 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away!"));
4744 bool set_ultimate_res(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->ult_res && !do_dec)
4758 if (p_ptr->ult_res > v) return FALSE;
4760 else if (!p_ptr->ult_res)
4762 msg_print(_("あらゆることに対して耐性がついた気がする!", "You feel resistant!"));
4772 msg_print(_("あらゆることに対する耐性が薄れた気がする。", "You feel less resistant"));
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 bool set_tim_res_nether(TIME_EFFECT v, bool do_dec)
4798 bool notice = FALSE;
4800 /* Hack -- Force good values */
4801 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
4803 if (p_ptr->is_dead) return FALSE;
4808 if (p_ptr->tim_res_nether && !do_dec)
4810 if (p_ptr->tim_res_nether > v) return FALSE;
4812 else if (!p_ptr->tim_res_nether)
4814 msg_print(_("地獄の力に対して耐性がついた気がする!", "You feel nether resistant!"));
4822 if (p_ptr->tim_res_nether)
4824 msg_print(_("地獄の力に対する耐性が薄れた気がする。", "You feel less nether resistant"));
4830 p_ptr->tim_res_nether = v;
4832 /* Redraw status bar */
4833 p_ptr->redraw |= (PR_STATUS);
4835 /* Nothing to notice */
4836 if (!notice) return (FALSE);
4838 if (disturb_state) disturb(FALSE, FALSE);
4840 /* Recalculate bonuses */
4841 p_ptr->update |= (PU_BONUS);
4848 bool set_tim_res_time(TIME_EFFECT v, bool do_dec)
4850 bool notice = FALSE;
4852 /* Hack -- Force good values */
4853 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
4855 if (p_ptr->is_dead) return FALSE;
4860 if (p_ptr->tim_res_time && !do_dec)
4862 if (p_ptr->tim_res_time > v) return FALSE;
4864 else if (!p_ptr->tim_res_time)
4866 msg_print(_("時間逆転の力に対して耐性がついた気がする!", "You feel time resistant!"));
4874 if (p_ptr->tim_res_time)
4876 msg_print(_("時間逆転の力に対する耐性が薄れた気がする。", "You feel less time resistant"));
4882 p_ptr->tim_res_time = v;
4884 /* Redraw status bar */
4885 p_ptr->redraw |= (PR_STATUS);
4887 /* Nothing to notice */
4888 if (!notice) return (FALSE);
4890 if (disturb_state) disturb(FALSE, FALSE);
4892 /* Recalculate bonuses */
4893 p_ptr->update |= (PU_BONUS);
4902 * Choose a warrior-mage elemental attack. -LM-
4904 bool choose_ele_attack(void)
4910 if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM))
4912 msg_format(_("武器を持たないと魔法剣は使えない。", "You cannot use temporary branding with no weapon."));
4919 num = (p_ptr->lev - 20) / 5;
4920 c_prt(TERM_RED, _(" a) 焼棄", " a) Fire Brand"), 2, 14);
4923 c_prt(TERM_L_WHITE,_(" b) 凍結", " b) Cold Brand"), 3, 14);
4928 c_prt(TERM_GREEN, _(" c) 毒殺", " c) Poison Brand"), 4, 14);
4933 c_prt(TERM_L_DARK, _(" d) 溶解", " d) Acid Brand"), 5, 14);
4938 c_prt(TERM_BLUE, _(" e) 電撃", " e) Elec Brand"), 6, 14);
4947 prt(_(" どの元素攻撃をしますか?", " Choose a temporary elemental brand "), 1, 14);
4951 if ((choice == 'a') || (choice == 'A'))
4952 set_ele_attack(ATTACK_FIRE, p_ptr->lev/2 + randint1(p_ptr->lev/2));
4953 else if (((choice == 'b') || (choice == 'B')) && (num >= 2))
4954 set_ele_attack(ATTACK_COLD, p_ptr->lev/2 + randint1(p_ptr->lev/2));
4955 else if (((choice == 'c') || (choice == 'C')) && (num >= 3))
4956 set_ele_attack(ATTACK_POIS, p_ptr->lev/2 + randint1(p_ptr->lev/2));
4957 else if (((choice == 'd') || (choice == 'D')) && (num >= 4))
4958 set_ele_attack(ATTACK_ACID, p_ptr->lev/2 + randint1(p_ptr->lev/2));
4959 else if (((choice == 'e') || (choice == 'E')) && (num >= 5))
4960 set_ele_attack(ATTACK_ELEC, p_ptr->lev/2 + randint1(p_ptr->lev/2));
4963 msg_print(_("魔法剣を使うのをやめた。", "You cancel the temporary branding."));
4974 * Choose a elemental immune. -LM-
4976 bool choose_ele_immune(TIME_EFFECT immune_turn)
4983 c_prt(TERM_RED, _(" a) 火炎", " a) Immune Fire"), 2, 14);
4984 c_prt(TERM_L_WHITE,_(" b) 冷気", " b) Immune Cold"), 3, 14);
4985 c_prt(TERM_L_DARK, _(" c) 酸", " c) Immune Acid"), 4, 14);
4986 c_prt(TERM_BLUE, _(" d) 電撃", " d) Immune Elec"), 5, 14);
4994 prt(_(" どの元素の免疫をつけますか?", " Choose a temporary elemental immune "), 1, 14);
4998 if ((choice == 'a') || (choice == 'A'))
4999 set_ele_immune(DEFENSE_FIRE, immune_turn);
5000 else if ((choice == 'b') || (choice == 'B'))
5001 set_ele_immune(DEFENSE_COLD, immune_turn);
5002 else if ((choice == 'c') || (choice == 'C'))
5003 set_ele_immune(DEFENSE_ACID, immune_turn);
5004 else if ((choice == 'd') || (choice == 'D'))
5005 set_ele_immune(DEFENSE_ELEC, immune_turn);
5008 msg_print(_("免疫を付けるのをやめた。", "You cancel the temporary immune."));