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
31 #include "spells-status.h"
32 #include "realm-song.h"
33 #include "realm-hex.h"
34 #include "object-ego.h"
35 #include "object-hook.h"
37 #include "spells-floor.h"
38 #include "player-status.h"
39 #include "player-class.h"
40 #include "player-move.h"
41 #include "player-effects.h"
42 #include "player-race.h"
43 #include "player-class.h"
44 #include "player-personality.h"
45 #include "player-sex.h"
46 #include "player-damage.h"
47 #include "monster-status.h"
50 #include "monster-spell.h"
52 #include "objectkind.h"
57 #include "view-mainwindow.h"
62 const kamae kamae_shurui[MAX_KAMAE] =
70 {"Genbu", 25, "(Black Tortoise) "},
71 {"Byakko", 30, "(White Tiger) "},
72 {"Seiryuu", 35, "(Blue Dragon) "},
73 {"Suzaku", 40, "(Red Phoenix) "},
80 const kamae kata_shurui[MAX_KATA] =
97 * @brief プレイヤーの継続行動を設定する。
98 * @param typ 継続行動のID\n
99 * #ACTION_NONE / #ACTION_SEARCH / #ACTION_REST / #ACTION_LEARN / #ACTION_FISH / #ACTION_KAMAE / #ACTION_KATA / #ACTION_SING / #ACTION_HAYAGAKE / #ACTION_SPELL から選択。
102 void set_action(ACTION_IDX typ)
104 int prev_typ = p_ptr->action;
116 msg_print(_("探索をやめた。", "You no longer walk carefully."));
117 p_ptr->redraw |= (PR_SPEED);
127 msg_print(_("学習をやめた。", "You stop Learning"));
128 p_ptr->new_mane = FALSE;
133 msg_print(_("構えをといた。", "You stop assuming the posture."));
134 p_ptr->special_defense &= ~(KAMAE_MASK);
139 msg_print(_("型を崩した。", "You stop assuming the posture."));
140 p_ptr->special_defense &= ~(KATA_MASK);
141 p_ptr->update |= (PU_MONSTERS);
142 p_ptr->redraw |= (PR_STATUS);
147 msg_print(_("歌うのをやめた。", "You stop singing."));
150 case ACTION_HAYAGAKE:
152 msg_print(_("足が重くなった。", "You are no longer walking extremely fast."));
153 take_turn(p_ptr, 100);
158 msg_print(_("呪文の詠唱を中断した。", "You stopped spelling all spells."));
166 /* If we are requested other action, stop singing */
167 if (prev_typ == ACTION_SING) stop_singing(p_ptr);
168 if (prev_typ == ACTION_SPELL) stop_hex_spell();
170 switch (p_ptr->action)
174 msg_print(_("注意深く歩き始めた。", "You begin to walk carefully."));
175 p_ptr->redraw |= (PR_SPEED);
180 msg_print(_("学習を始めた。", "You begin Learning"));
185 msg_print(_("水面に糸を垂らした...", "You begin fishing..."));
188 case ACTION_HAYAGAKE:
190 msg_print(_("足が羽のように軽くなった。", "You begin to walk extremely fast."));
198 p_ptr->update |= (PU_BONUS);
199 p_ptr->redraw |= (PR_STATE);
203 * @brief プレイヤーの全ての時限効果をリセットする。 / reset timed flags
206 void reset_tim_flags(void)
208 p_ptr->fast = 0; /* Timed -- Fast */
209 p_ptr->lightspeed = 0;
210 p_ptr->slow = 0; /* Timed -- Slow */
211 p_ptr->blind = 0; /* Timed -- Blindness */
212 p_ptr->paralyzed = 0; /* Timed -- Paralysis */
213 p_ptr->confused = 0; /* Timed -- Confusion */
214 p_ptr->afraid = 0; /* Timed -- Fear */
215 p_ptr->image = 0; /* Timed -- Hallucination */
216 p_ptr->poisoned = 0; /* Timed -- Poisoned */
217 p_ptr->cut = 0; /* Timed -- Cut */
218 p_ptr->stun = 0; /* Timed -- Stun */
220 p_ptr->protevil = 0; /* Timed -- Protection */
221 p_ptr->invuln = 0; /* Timed -- Invulnerable */
223 p_ptr->hero = 0; /* Timed -- Heroism */
224 p_ptr->shero = 0; /* Timed -- Super Heroism */
225 p_ptr->shield = 0; /* Timed -- Shield Spell */
226 p_ptr->blessed = 0; /* Timed -- Blessed */
227 p_ptr->tim_invis = 0; /* Timed -- Invisibility */
228 p_ptr->tim_infra = 0; /* Timed -- Infra Vision */
229 p_ptr->tim_regen = 0; /* Timed -- Regeneration */
230 p_ptr->tim_stealth = 0; /* Timed -- Stealth */
232 p_ptr->wraith_form = 0; /* Timed -- Wraith Form */
233 p_ptr->tim_levitation = 0;
234 p_ptr->tim_sh_touki = 0;
235 p_ptr->tim_sh_fire = 0;
236 p_ptr->tim_sh_holy = 0;
237 p_ptr->tim_eyeeye = 0;
239 p_ptr->resist_magic = 0;
242 p_ptr->tim_res_nether = 0;
243 p_ptr->tim_res_time = 0;
244 p_ptr->tim_mimic = 0;
245 p_ptr->mimic_form = 0;
246 p_ptr->tim_reflect = 0;
247 p_ptr->multishadow = 0;
249 p_ptr->action = ACTION_NONE;
251 p_ptr->oppose_acid = 0; /* Timed -- oppose acid */
252 p_ptr->oppose_elec = 0; /* Timed -- oppose lightning */
253 p_ptr->oppose_fire = 0; /* Timed -- oppose heat */
254 p_ptr->oppose_cold = 0; /* Timed -- oppose cold */
255 p_ptr->oppose_pois = 0; /* Timed -- oppose poison */
257 p_ptr->word_recall = 0;
258 p_ptr->alter_reality = 0;
259 p_ptr->sutemi = FALSE;
260 p_ptr->counter = FALSE;
261 p_ptr->ele_attack = 0;
262 p_ptr->ele_immune = 0;
263 p_ptr->special_attack = 0L;
264 p_ptr->special_defense = 0L;
266 while(p_ptr->energy_need < 0) p_ptr->energy_need += ENERGY_NEED();
267 p_ptr->timewalk = FALSE;
269 if (PRACE_IS_(p_ptr, RACE_DEMON) && (p_ptr->lev > 44)) p_ptr->oppose_fire = 1;
270 if ((p_ptr->pclass == CLASS_NINJA) && (p_ptr->lev > 44)) p_ptr->oppose_pois = 1;
271 if (p_ptr->pclass == CLASS_BERSERKER) p_ptr->shero = 1;
275 (void)set_monster_fast(p_ptr->riding, 0);
276 (void)set_monster_slow(p_ptr->riding, 0);
277 (void)set_monster_invulner(p_ptr->riding, 0, FALSE);
280 if (p_ptr->pclass == CLASS_BARD)
282 SINGING_SONG_EFFECT(p_ptr) = 0;
283 SINGING_SONG_ID(p_ptr) = 0;
288 * @brief プレイヤーに魔力消去効果を与える。
291 void dispel_player(void)
293 (void)set_fast(p_ptr, 0, TRUE);
294 (void)set_lightspeed(p_ptr, 0, TRUE);
295 (void)set_slow(p_ptr, 0, TRUE);
296 (void)set_shield(p_ptr, 0, TRUE);
297 (void)set_blessed(p_ptr, 0, TRUE);
298 (void)set_tsuyoshi(0, TRUE);
299 (void)set_hero(p_ptr, 0, TRUE);
300 (void)set_shero(p_ptr, 0, TRUE);
301 (void)set_protevil(p_ptr, 0, TRUE);
302 (void)set_invuln(p_ptr, 0, TRUE);
303 (void)set_wraith_form(0, TRUE);
304 (void)set_kabenuke(0, TRUE);
305 (void)set_tim_res_nether(0, TRUE);
306 (void)set_tim_res_time(0, TRUE);
308 (void)set_tim_reflect(0,TRUE);
309 (void)set_multishadow(0,TRUE);
310 (void)set_dustrobe(0,TRUE);
312 (void)set_tim_invis(p_ptr, 0, TRUE);
313 (void)set_tim_infra(p_ptr, 0, TRUE);
314 (void)set_tim_esp(0, TRUE);
315 (void)set_tim_regen(p_ptr, 0, TRUE);
316 (void)set_tim_stealth(p_ptr, 0, TRUE);
317 (void)set_tim_levitation(p_ptr, 0, TRUE);
318 (void)set_tim_sh_touki(p_ptr, 0, TRUE);
319 (void)set_tim_sh_fire(p_ptr, 0, TRUE);
320 (void)set_tim_sh_holy(p_ptr, 0, TRUE);
321 (void)set_tim_eyeeye(p_ptr, 0, TRUE);
322 (void)set_magicdef(p_ptr, 0, TRUE);
323 (void)set_resist_magic(0, TRUE);
324 (void)set_oppose_acid(0, TRUE);
325 (void)set_oppose_elec(0, TRUE);
326 (void)set_oppose_fire(0, TRUE);
327 (void)set_oppose_cold(0, TRUE);
328 (void)set_oppose_pois(0, TRUE);
329 (void)set_ultimate_res(0, TRUE);
330 (void)set_mimic(p_ptr, 0, 0, TRUE);
331 (void)set_ele_attack(0, 0);
332 (void)set_ele_immune(0, 0);
334 /* Cancel glowing hands */
335 if (p_ptr->special_attack & ATTACK_CONFUSE)
337 p_ptr->special_attack &= ~(ATTACK_CONFUSE);
338 msg_print(_("手の輝きがなくなった。", "Your hands stop glowing."));
341 if (music_singing_any() || hex_spelling_any())
343 concptr str = (music_singing_any()) ? _("歌", "singing") : _("呪文", "spelling");
344 INTERUPTING_SONG_EFFECT(p_ptr) = SINGING_SONG_EFFECT(p_ptr);
345 SINGING_SONG_EFFECT(p_ptr) = MUSIC_NONE;
346 msg_format(_("%sが途切れた。", "Your %s is interrupted."), str);
348 p_ptr->action = ACTION_NONE;
349 p_ptr->update |= (PU_BONUS | PU_HP | PU_MONSTERS);
350 p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
351 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
352 p_ptr->energy_need += ENERGY_NEED();
358 * @brief 変身効果の継続時間と変身先をセットする / Set "p_ptr->tim_mimic", and "p_ptr->mimic_form", notice observable changes
361 * @param do_dec 現在の継続時間より長い値のみ上書きする
362 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
364 bool set_mimic(player_type *creature_ptr, TIME_EFFECT v, IDX p, bool do_dec)
367 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
369 if (creature_ptr->is_dead) return FALSE;
374 if (creature_ptr->tim_mimic && (creature_ptr->mimic_form == p) && !do_dec)
376 if (creature_ptr->tim_mimic > v) return FALSE;
378 else if ((!creature_ptr->tim_mimic) || (creature_ptr->mimic_form != p))
380 msg_print(_("自分の体が変わってゆくのを感じた。", "You feel that your body changes."));
381 creature_ptr->mimic_form = p;
389 if (creature_ptr->tim_mimic)
391 msg_print(_("変身が解けた。", "You are no longer transformed."));
392 if (creature_ptr->mimic_form == MIMIC_DEMON) set_oppose_fire(0, TRUE);
393 creature_ptr->mimic_form=0;
400 creature_ptr->tim_mimic = v;
402 /* Nothing to notice */
403 if (!notice) return (FALSE);
405 if (disturb_state) disturb(FALSE, TRUE);
407 creature_ptr->redraw |= (PR_BASIC | PR_STATUS);
408 creature_ptr->update |= (PU_BONUS | PU_HP);
415 * @brief 盲目の継続時間をセットする / Set "p_ptr->blind", notice observable changes
417 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
419 * Note the use of "PU_UN_LITE" and "PU_UN_VIEW", which is needed to\n
420 * memorize any terrain features which suddenly become "visible".\n
421 * Note that blindness is currently the only thing which can affect\n
422 * "player_can_see_bold()".\n
424 bool set_blind(player_type *creature_ptr, TIME_EFFECT v)
427 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
429 if (creature_ptr->is_dead) return FALSE;
434 if (!creature_ptr->blind)
436 if (creature_ptr->prace == RACE_ANDROID)
438 msg_print(_("センサーをやられた!", "You are blind!"));
442 msg_print(_("目が見えなくなってしまった!", "You are blind!"));
446 chg_virtue(V_ENLIGHTEN, -1);
453 if (creature_ptr->blind)
455 if (creature_ptr->prace == RACE_ANDROID)
457 msg_print(_("センサーが復旧した。", "You can see again."));
461 msg_print(_("やっと目が見えるようになった。", "You can see again."));
469 creature_ptr->blind = v;
470 creature_ptr->redraw |= (PR_STATUS);
472 /* Nothing to notice */
473 if (!notice) return (FALSE);
474 if (disturb_state) disturb(FALSE, FALSE);
476 /* Fully update the visuals */
477 creature_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
478 creature_ptr->redraw |= (PR_MAP);
479 creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
486 * @brief 混乱の継続時間をセットする / Set "p_ptr->confused", notice observable changes
488 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
490 bool set_confused(player_type *creature_ptr, TIME_EFFECT v)
493 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
495 if (creature_ptr->is_dead) return FALSE;
500 if (!creature_ptr->confused)
502 msg_print(_("あなたは混乱した!", "You are confused!"));
504 if (creature_ptr->action == ACTION_LEARN)
506 msg_print(_("学習が続けられない!", "You cannot continue Learning!"));
507 creature_ptr->new_mane = FALSE;
509 creature_ptr->redraw |= (PR_STATE);
510 creature_ptr->action = ACTION_NONE;
512 if (creature_ptr->action == ACTION_KAMAE)
514 msg_print(_("構えがとけた。", "Your posture gets loose."));
515 creature_ptr->special_defense &= ~(KAMAE_MASK);
516 creature_ptr->update |= (PU_BONUS);
517 creature_ptr->redraw |= (PR_STATE);
518 creature_ptr->action = ACTION_NONE;
520 else if (creature_ptr->action == ACTION_KATA)
522 msg_print(_("型が崩れた。", "Your posture gets loose."));
523 creature_ptr->special_defense &= ~(KATA_MASK);
524 creature_ptr->update |= (PU_BONUS);
525 creature_ptr->update |= (PU_MONSTERS);
526 creature_ptr->redraw |= (PR_STATE);
527 creature_ptr->redraw |= (PR_STATUS);
528 creature_ptr->action = ACTION_NONE;
532 if (creature_ptr->concent) reset_concentration(TRUE);
535 if (hex_spelling_any()) stop_hex_spell_all();
538 creature_ptr->counter = FALSE;
539 chg_virtue(V_HARMONY, -1);
546 if (creature_ptr->confused)
548 msg_print(_("やっと混乱がおさまった。", "You feel less confused now."));
549 creature_ptr->special_attack &= ~(ATTACK_SUIKEN);
555 creature_ptr->confused = v;
556 creature_ptr->redraw |= (PR_STATUS);
558 /* Nothing to notice */
559 if (!notice) return (FALSE);
561 if (disturb_state) disturb(FALSE, FALSE);
568 * @brief 毒の継続時間をセットする / Set "p_ptr->poisoned", notice observable changes
570 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
572 bool set_poisoned(player_type *creature_ptr, TIME_EFFECT v)
575 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
577 if (creature_ptr->is_dead) return FALSE;
582 if (!creature_ptr->poisoned)
584 msg_print(_("毒に侵されてしまった!", "You are poisoned!"));
592 if (creature_ptr->poisoned)
594 msg_print(_("やっと毒の痛みがなくなった。", "You are no longer poisoned."));
600 creature_ptr->poisoned = v;
601 creature_ptr->redraw |= (PR_STATUS);
603 /* Nothing to notice */
604 if (!notice) return (FALSE);
606 if (disturb_state) disturb(FALSE, FALSE);
613 * @brief 恐怖の継続時間をセットする / Set "p_ptr->afraid", notice observable changes
615 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
617 bool set_afraid(player_type *creature_ptr, TIME_EFFECT v)
620 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
622 if (creature_ptr->is_dead) return FALSE;
627 if (!creature_ptr->afraid)
629 msg_print(_("何もかも恐くなってきた!", "You are terrified!"));
631 if (creature_ptr->special_defense & KATA_MASK)
633 msg_print(_("型が崩れた。", "Your posture gets loose."));
634 creature_ptr->special_defense &= ~(KATA_MASK);
635 creature_ptr->update |= (PU_BONUS);
636 creature_ptr->update |= (PU_MONSTERS);
637 creature_ptr->redraw |= (PR_STATE);
638 creature_ptr->redraw |= (PR_STATUS);
639 creature_ptr->action = ACTION_NONE;
643 creature_ptr->counter = FALSE;
644 chg_virtue(V_VALOUR, -1);
651 if (creature_ptr->afraid)
653 msg_print(_("やっと恐怖を振り払った。", "You feel bolder now."));
659 creature_ptr->afraid = v;
660 creature_ptr->redraw |= (PR_STATUS);
662 /* Nothing to notice */
663 if (!notice) return (FALSE);
665 if (disturb_state) disturb(FALSE, FALSE);
671 * @brief 麻痺の継続時間をセットする / Set "paralyzed", notice observable changes
673 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
675 bool set_paralyzed(player_type *creature_ptr, TIME_EFFECT v)
678 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
680 if (creature_ptr->is_dead) return FALSE;
685 if (!creature_ptr->paralyzed)
687 msg_print(_("体が麻痺してしまった!", "You are paralyzed!"));
689 if (creature_ptr->concent) reset_concentration(TRUE);
692 if (hex_spelling_any()) stop_hex_spell_all();
694 creature_ptr->counter = FALSE;
702 if (creature_ptr->paralyzed)
704 msg_print(_("やっと動けるようになった。", "You can move again."));
710 creature_ptr->paralyzed = v;
711 creature_ptr->redraw |= (PR_STATUS);
713 /* Nothing to notice */
714 if (!notice) return (FALSE);
716 if (disturb_state) disturb(FALSE, FALSE);
717 creature_ptr->redraw |= (PR_STATE);
723 * @brief 幻覚の継続時間をセットする / Set "p_ptr->image", notice observable changes
725 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
726 * @details Note that we must redraw the map when hallucination changes.
728 bool set_image(player_type *creature_ptr, TIME_EFFECT v)
731 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
733 if (creature_ptr->is_dead) return FALSE;
734 if (creature_ptr->pseikaku == SEIKAKU_CHARGEMAN) v = 0;
739 set_tsuyoshi(0, TRUE);
740 if (!creature_ptr->image)
742 msg_print(_("ワーオ!何もかも虹色に見える!", "Oh, wow! Everything looks so cosmic now!"));
745 if (creature_ptr->concent) reset_concentration(TRUE);
747 creature_ptr->counter = FALSE;
755 if (creature_ptr->image)
757 msg_print(_("やっとはっきりと物が見えるようになった。", "You can see clearly again."));
763 creature_ptr->image = v;
764 creature_ptr->redraw |= (PR_STATUS);
766 /* Nothing to notice */
767 if (!notice) return (FALSE);
769 if (disturb_state) disturb(FALSE, TRUE);
771 creature_ptr->redraw |= (PR_MAP | PR_HEALTH | PR_UHEALTH);
772 creature_ptr->update |= (PU_MONSTERS);
773 creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
779 * @brief 加速の継続時間をセットする / Set "p_ptr->fast", notice observable changes
781 * @param do_dec 現在の継続時間より長い値のみ上書きする
782 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
784 bool set_fast(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
787 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
789 if (creature_ptr->is_dead) return FALSE;
794 if (creature_ptr->fast && !do_dec)
796 if (creature_ptr->fast > v) return FALSE;
798 else if (!IS_FAST() && !creature_ptr->lightspeed)
800 msg_print(_("素早く動けるようになった!", "You feel yourself moving much faster!"));
802 chg_virtue(V_PATIENCE, -1);
803 chg_virtue(V_DILIGENCE, 1);
810 if (creature_ptr->fast && !creature_ptr->lightspeed && !music_singing(MUSIC_SPEED) && !music_singing(MUSIC_SHERO))
812 msg_print(_("動きの素早さがなくなったようだ。", "You feel yourself slow down."));
818 creature_ptr->fast = v;
820 /* Nothing to notice */
821 if (!notice) return (FALSE);
823 if (disturb_state) disturb(FALSE, FALSE);
824 creature_ptr->update |= (PU_BONUS);
830 * @brief 光速移動の継続時間をセットする / Set "p_ptr->lightspeed", notice observable changes
832 * @param do_dec 現在の継続時間より長い値のみ上書きする
833 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
835 bool set_lightspeed(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
838 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
840 if (creature_ptr->is_dead) return FALSE;
842 if (creature_ptr->wild_mode) v = 0;
847 if (creature_ptr->lightspeed && !do_dec)
849 if (creature_ptr->lightspeed > v) return FALSE;
851 else if (!creature_ptr->lightspeed)
853 msg_print(_("非常に素早く動けるようになった!", "You feel yourself moving extremely faster!"));
855 chg_virtue(V_PATIENCE, -1);
856 chg_virtue(V_DILIGENCE, 1);
863 if (creature_ptr->lightspeed)
865 msg_print(_("動きの素早さがなくなったようだ。", "You feel yourself slow down."));
871 creature_ptr->lightspeed = v;
873 /* Nothing to notice */
874 if (!notice) return (FALSE);
876 if (disturb_state) disturb(FALSE, FALSE);
877 creature_ptr->update |= (PU_BONUS);
883 * @brief 減速の継続時間をセットする / Set "p_ptr->slow", notice observable changes
885 * @param do_dec 現在の継続時間より長い値のみ上書きする
886 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
888 bool set_slow(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
891 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
893 if (creature_ptr->is_dead) return FALSE;
898 if (creature_ptr->slow && !do_dec)
900 if (creature_ptr->slow > v) return FALSE;
902 else if (!creature_ptr->slow)
904 msg_print(_("体の動きが遅くなってしまった!", "You feel yourself moving slower!"));
912 if (creature_ptr->slow)
914 msg_print(_("動きの遅さがなくなったようだ。", "You feel yourself speed up."));
920 creature_ptr->slow = v;
922 /* Nothing to notice */
923 if (!notice) return (FALSE);
925 if (disturb_state) disturb(FALSE, FALSE);
926 creature_ptr->update |= (PU_BONUS);
933 * @brief 肌石化の継続時間をセットする / Set "p_ptr->shield", notice observable changes
935 * @param do_dec 現在の継続時間より長い値のみ上書きする
936 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
938 bool set_shield(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
941 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
943 if (creature_ptr->is_dead) return FALSE;
948 if (creature_ptr->shield && !do_dec)
950 if (creature_ptr->shield > v) return FALSE;
952 else if (!creature_ptr->shield)
954 msg_print(_("肌が石になった。", "Your skin turns to stone."));
962 if (creature_ptr->shield)
964 msg_print(_("肌が元に戻った。", "Your skin returns to normal."));
970 creature_ptr->shield = v;
971 creature_ptr->redraw |= (PR_STATUS);
973 /* Nothing to notice */
974 if (!notice) return (FALSE);
976 if (disturb_state) disturb(FALSE, FALSE);
977 creature_ptr->update |= (PU_BONUS);
984 * @brief つぶれるの継続時間をセットする / Set "p_ptr->tsubureru", notice observable changes
986 * @param do_dec 現在の継続時間より長い値のみ上書きする
987 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
989 bool set_tsubureru(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
992 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
994 if (creature_ptr->is_dead) return FALSE;
999 if (creature_ptr->tsubureru && !do_dec)
1001 if (creature_ptr->tsubureru > v) return FALSE;
1003 else if (!creature_ptr->tsubureru)
1005 msg_print(_("横に伸びた。", "Your body expands horizontally."));
1013 if (creature_ptr->tsubureru)
1015 msg_print(_("もう横に伸びていない。", "Your body returns to normal."));
1021 creature_ptr->tsubureru = v;
1022 creature_ptr->redraw |= (PR_STATUS);
1024 /* Nothing to notice */
1025 if (!notice) return (FALSE);
1027 if (disturb_state) disturb(FALSE, FALSE);
1028 creature_ptr->update |= (PU_BONUS);
1035 * @brief 魔法の鎧の継続時間をセットする / Set "p_ptr->magicdef", notice observable changes
1037 * @param do_dec 現在の継続時間より長い値のみ上書きする
1038 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1040 bool set_magicdef(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
1042 bool notice = FALSE;
1043 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1045 if (creature_ptr->is_dead) return FALSE;
1050 if (creature_ptr->magicdef && !do_dec)
1052 if (creature_ptr->magicdef > v) return FALSE;
1054 else if (!creature_ptr->magicdef)
1056 msg_print(_("魔法の防御力が増したような気がする。", "You feel more resistant to magic."));
1064 if (creature_ptr->magicdef)
1066 msg_print(_("魔法の防御力が元に戻った。", "You feel less resistant to magic."));
1072 creature_ptr->magicdef = v;
1073 creature_ptr->redraw |= (PR_STATUS);
1075 /* Nothing to notice */
1076 if (!notice) return (FALSE);
1078 if (disturb_state) disturb(FALSE, FALSE);
1079 creature_ptr->update |= (PU_BONUS);
1085 * @brief 祝福の継続時間をセットする / Set "p_ptr->blessed", notice observable changes
1087 * @param do_dec 現在の継続時間より長い値のみ上書きする
1088 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1090 bool set_blessed(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
1092 bool notice = FALSE;
1093 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1095 if (creature_ptr->is_dead) return FALSE;
1100 if (creature_ptr->blessed && !do_dec)
1102 if (creature_ptr->blessed > v) return FALSE;
1104 else if (!IS_BLESSED())
1106 msg_print(_("高潔な気分になった!", "You feel righteous!"));
1114 if (creature_ptr->blessed && !music_singing(MUSIC_BLESS))
1116 msg_print(_("高潔な気分が消え失せた。", "The prayer has expired."));
1122 creature_ptr->blessed = v;
1123 creature_ptr->redraw |= (PR_STATUS);
1125 /* Nothing to notice */
1126 if (!notice) return (FALSE);
1128 if (disturb_state) disturb(FALSE, FALSE);
1129 creature_ptr->update |= (PU_BONUS);
1136 * @brief 士気高揚の継続時間をセットする / Set "p_ptr->hero", notice observable changes
1138 * @param do_dec 現在の継続時間より長い値のみ上書きする
1139 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1141 bool set_hero(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
1143 bool notice = FALSE;
1144 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1146 if (creature_ptr->is_dead) return FALSE;
1151 if (creature_ptr->hero && !do_dec)
1153 if (creature_ptr->hero > v) return FALSE;
1155 else if (!IS_HERO())
1157 msg_print(_("ヒーローになった気がする!", "You feel like a hero!"));
1165 if (creature_ptr->hero && !music_singing(MUSIC_HERO) && !music_singing(MUSIC_SHERO))
1167 msg_print(_("ヒーローの気分が消え失せた。", "The heroism wears off."));
1173 creature_ptr->hero = v;
1174 creature_ptr->redraw |= (PR_STATUS);
1176 /* Nothing to notice */
1177 if (!notice) return (FALSE);
1179 if (disturb_state) disturb(FALSE, FALSE);
1180 creature_ptr->update |= (PU_BONUS);
1182 /* Recalculate hitpoints */
1183 creature_ptr->update |= (PU_HP);
1189 * @brief 狂戦士化の継続時間をセットする / Set "p_ptr->shero", notice observable changes
1190 * @param v 継続時間/ 0ならば無条件にリセット
1191 * @param do_dec FALSEの場合現在の継続時間より長い値のみ上書きする
1192 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1194 bool set_shero(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
1196 bool notice = FALSE;
1197 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1199 if (creature_ptr->is_dead) return FALSE;
1201 if (creature_ptr->pclass == CLASS_BERSERKER) v = 1;
1205 if (creature_ptr->shero && !do_dec)
1207 if (creature_ptr->shero > v) return FALSE;
1209 else if (!creature_ptr->shero)
1211 msg_print(_("殺戮マシーンになった気がする!", "You feel like a killing machine!"));
1219 if (creature_ptr->shero)
1221 msg_print(_("野蛮な気持ちが消え失せた。", "You feel less Berserk."));
1227 creature_ptr->shero = v;
1228 creature_ptr->redraw |= (PR_STATUS);
1230 /* Nothing to notice */
1231 if (!notice) return (FALSE);
1233 if (disturb_state) disturb(FALSE, FALSE);
1234 creature_ptr->update |= (PU_BONUS);
1236 /* Recalculate hitpoints */
1237 creature_ptr->update |= (PU_HP);
1243 * @brief 対邪悪結界の継続時間をセットする / Set "p_ptr->protevil", notice observable changes
1245 * @param do_dec 現在の継続時間より長い値のみ上書きする
1246 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1248 bool set_protevil(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
1250 bool notice = FALSE;
1251 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1253 if (creature_ptr->is_dead) return FALSE;
1258 if (creature_ptr->protevil && !do_dec)
1260 if (creature_ptr->protevil > v) return FALSE;
1262 else if (!creature_ptr->protevil)
1264 msg_print(_("邪悪なる存在から守られているような感じがする!", "You feel safe from evil!"));
1272 if (creature_ptr->protevil)
1274 msg_print(_("邪悪なる存在から守られている感じがなくなった。", "You no longer feel safe from evil."));
1280 creature_ptr->protevil = v;
1281 creature_ptr->redraw |= (PR_STATUS);
1283 /* Nothing to notice */
1284 if (!notice) return (FALSE);
1286 if (disturb_state) disturb(FALSE, FALSE);
1292 * @brief 幽体化の継続時間をセットする / Set "p_ptr->wraith_form", notice observable changes
1294 * @param do_dec 現在の継続時間より長い値のみ上書きする
1295 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1297 bool set_wraith_form(TIME_EFFECT v, bool do_dec)
1299 bool notice = FALSE;
1300 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1302 if (p_ptr->is_dead) return FALSE;
1307 if (p_ptr->wraith_form && !do_dec)
1309 if (p_ptr->wraith_form > v) return FALSE;
1311 else if (!p_ptr->wraith_form)
1313 msg_print(_("物質界を離れて幽鬼のような存在になった!", "You leave the physical world and current_world_ptr->game_turn into a wraith-being!"));
1315 chg_virtue(V_UNLIFE, 3);
1316 chg_virtue(V_HONOUR, -2);
1317 chg_virtue(V_SACRIFICE, -2);
1318 chg_virtue(V_VALOUR, -5);
1320 p_ptr->redraw |= (PR_MAP);
1321 p_ptr->update |= (PU_MONSTERS);
1323 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1330 if (p_ptr->wraith_form)
1332 msg_print(_("不透明になった感じがする。", "You feel opaque."));
1335 p_ptr->redraw |= (PR_MAP);
1336 p_ptr->update |= (PU_MONSTERS);
1338 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1343 p_ptr->wraith_form = v;
1344 p_ptr->redraw |= (PR_STATUS);
1346 /* Nothing to notice */
1347 if (!notice) return (FALSE);
1349 if (disturb_state) disturb(FALSE, FALSE);
1350 p_ptr->update |= (PU_BONUS);
1357 * @brief 無傷球の継続時間をセットする / Set "p_ptr->invuln", notice observable changes
1359 * @param do_dec 現在の継続時間より長い値のみ上書きする
1360 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1362 bool set_invuln(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
1364 bool notice = FALSE;
1365 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1367 if (creature_ptr->is_dead) return FALSE;
1372 if (creature_ptr->invuln && !do_dec)
1374 if (creature_ptr->invuln > v) return FALSE;
1376 else if (!IS_INVULN())
1378 msg_print(_("無敵だ!", "Invulnerability!"));
1381 chg_virtue(V_UNLIFE, -2);
1382 chg_virtue(V_HONOUR, -2);
1383 chg_virtue(V_SACRIFICE, -3);
1384 chg_virtue(V_VALOUR, -5);
1386 creature_ptr->redraw |= (PR_MAP);
1387 creature_ptr->update |= (PU_MONSTERS);
1389 creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1396 if (creature_ptr->invuln && !music_singing(MUSIC_INVULN))
1398 msg_print(_("無敵ではなくなった。", "The invulnerability wears off."));
1401 creature_ptr->redraw |= (PR_MAP);
1402 creature_ptr->update |= (PU_MONSTERS);
1404 creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1406 creature_ptr->energy_need += ENERGY_NEED();
1411 creature_ptr->invuln = v;
1412 creature_ptr->redraw |= (PR_STATUS);
1414 /* Nothing to notice */
1415 if (!notice) return (FALSE);
1417 if (disturb_state) disturb(FALSE, FALSE);
1418 creature_ptr->update |= (PU_BONUS);
1424 * @brief 時限ESPの継続時間をセットする / Set "p_ptr->tim_esp", notice observable changes
1426 * @param do_dec 現在の継続時間より長い値のみ上書きする
1427 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1429 bool set_tim_esp(TIME_EFFECT v, bool do_dec)
1431 bool notice = FALSE;
1432 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1434 if (p_ptr->is_dead) return FALSE;
1439 if (p_ptr->tim_esp && !do_dec)
1441 if (p_ptr->tim_esp > v) return FALSE;
1443 else if (!IS_TIM_ESP())
1445 msg_print(_("意識が広がった気がする!", "You feel your consciousness expand!"));
1453 if (p_ptr->tim_esp && !music_singing(MUSIC_MIND))
1455 msg_print(_("意識は元に戻った。", "Your consciousness contracts again."));
1462 p_ptr->redraw |= (PR_STATUS);
1464 /* Nothing to notice */
1465 if (!notice) return (FALSE);
1467 if (disturb_state) disturb(FALSE, FALSE);
1468 p_ptr->update |= (PU_BONUS);
1469 p_ptr->update |= (PU_MONSTERS);
1475 * @brief 時限透明視の継続時間をセットする / Set "p_ptr->tim_invis", notice observable changes
1477 * @param do_dec 現在の継続時間より長い値のみ上書きする
1478 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1480 bool set_tim_invis(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
1482 bool notice = FALSE;
1483 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1485 if (creature_ptr->is_dead) return FALSE;
1490 if (creature_ptr->tim_invis && !do_dec)
1492 if (creature_ptr->tim_invis > v) return FALSE;
1494 else if (!creature_ptr->tim_invis)
1496 msg_print(_("目が非常に敏感になった気がする!", "Your eyes feel very sensitive!"));
1504 if (creature_ptr->tim_invis)
1506 msg_print(_("目の敏感さがなくなったようだ。", "Your eyes feel less sensitive."));
1512 creature_ptr->tim_invis = v;
1513 creature_ptr->redraw |= (PR_STATUS);
1515 /* Nothing to notice */
1516 if (!notice) return (FALSE);
1518 if (disturb_state) disturb(FALSE, FALSE);
1519 creature_ptr->update |= (PU_BONUS);
1521 /* Update the monsters */
1522 creature_ptr->update |= (PU_MONSTERS);
1528 * @brief 時限赤外線視力の継続時間をセットする / Set "p_ptr->tim_infra", notice observable changes
1530 * @param do_dec 現在の継続時間より長い値のみ上書きする
1531 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1533 bool set_tim_infra(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
1535 bool notice = FALSE;
1536 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1538 if (creature_ptr->is_dead) return FALSE;
1543 if (creature_ptr->tim_infra && !do_dec)
1545 if (creature_ptr->tim_infra > v) return FALSE;
1547 else if (!creature_ptr->tim_infra)
1549 msg_print(_("目がランランと輝き始めた!", "Your eyes begin to tingle!"));
1557 if (creature_ptr->tim_infra)
1559 msg_print(_("目の輝きがなくなった。", "Your eyes stop tingling."));
1565 creature_ptr->tim_infra = v;
1566 creature_ptr->redraw |= (PR_STATUS);
1568 /* Nothing to notice */
1569 if (!notice) return (FALSE);
1571 if (disturb_state) disturb(FALSE, FALSE);
1572 creature_ptr->update |= (PU_BONUS);
1574 /* Update the monsters */
1575 creature_ptr->update |= (PU_MONSTERS);
1581 * @brief 時限急回復の継続時間をセットする / Set "p_ptr->tim_regen", notice observable changes
1583 * @param do_dec 現在の継続時間より長い値のみ上書きする
1584 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1586 bool set_tim_regen(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
1588 bool notice = FALSE;
1589 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1591 if (creature_ptr->is_dead) return FALSE;
1596 if (creature_ptr->tim_regen && !do_dec)
1598 if (creature_ptr->tim_regen > v) return FALSE;
1600 else if (!creature_ptr->tim_regen)
1602 msg_print(_("回復力が上がった!", "You feel yourself regenerating quickly!"));
1610 if (creature_ptr->tim_regen)
1612 msg_print(_("素早く回復する感じがなくなった。", "You feel yourself regenerating slowly."));
1618 creature_ptr->tim_regen = v;
1619 creature_ptr->redraw |= (PR_STATUS);
1621 /* Nothing to notice */
1622 if (!notice) return (FALSE);
1624 if (disturb_state) disturb(FALSE, FALSE);
1625 creature_ptr->update |= (PU_BONUS);
1631 * @brief 隠密の歌の継続時間をセットする / Set "p_ptr->tim_stealth", notice observable changes
1633 * @param do_dec 現在の継続時間より長い値のみ上書きする
1634 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1636 bool set_tim_stealth(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
1638 bool notice = FALSE;
1639 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1641 if (creature_ptr->is_dead) return FALSE;
1646 if (creature_ptr->tim_stealth && !do_dec)
1648 if (creature_ptr->tim_stealth > v) return FALSE;
1650 else if (!IS_TIM_STEALTH())
1652 msg_print(_("足音が小さくなった!", "You begin to walk silently!"));
1660 if (creature_ptr->tim_stealth && !music_singing(MUSIC_STEALTH))
1662 msg_print(_("足音が大きくなった。", "You no longer walk silently."));
1668 creature_ptr->tim_stealth = v;
1669 creature_ptr->redraw |= (PR_STATUS);
1671 /* Nothing to notice */
1672 if (!notice) return (FALSE);
1674 if (disturb_state) disturb(FALSE, FALSE);
1675 creature_ptr->update |= (PU_BONUS);
1681 * @brief 超隠密状態をセットする
1682 * @param set TRUEならば超隠密状態になる。
1683 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1685 bool set_superstealth(bool set)
1687 bool notice = FALSE;
1689 if (p_ptr->is_dead) return FALSE;
1694 if (!(p_ptr->special_defense & NINJA_S_STEALTH))
1696 if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_MNLT)
1698 msg_print(_("敵の目から薄い影の中に覆い隠された。", "You are mantled in weak shadow from ordinary eyes."));
1699 p_ptr->monlite = p_ptr->old_monlite = TRUE;
1703 msg_print(_("敵の目から影の中に覆い隠された!", "You are mantled in shadow from ordinary eyes!"));
1704 p_ptr->monlite = p_ptr->old_monlite = FALSE;
1710 p_ptr->special_defense |= NINJA_S_STEALTH;
1717 if (p_ptr->special_defense & NINJA_S_STEALTH)
1719 msg_print(_("再び敵の目にさらされるようになった。", "You are exposed to common sight once more."));
1723 p_ptr->special_defense &= ~(NINJA_S_STEALTH);
1727 /* Nothing to notice */
1728 if (!notice) return (FALSE);
1729 p_ptr->redraw |= (PR_STATUS);
1731 if (disturb_state) disturb(FALSE, FALSE);
1736 * @brief 一時的浮遊の継続時間をセットする / Set "p_ptr->tim_levitation", notice observable changes
1738 * @param do_dec 現在の継続時間より長い値のみ上書きする
1739 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1741 bool set_tim_levitation(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
1743 bool notice = FALSE;
1744 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1746 if (creature_ptr->is_dead) return FALSE;
1751 if (creature_ptr->tim_levitation && !do_dec)
1753 if (creature_ptr->tim_levitation > v) return FALSE;
1755 else if (!creature_ptr->tim_levitation)
1757 msg_print(_("体が宙に浮き始めた。", "You begin to fly!"));
1765 if (creature_ptr->tim_levitation)
1767 msg_print(_("もう宙に浮かべなくなった。", "You stop flying."));
1773 creature_ptr->tim_levitation = v;
1774 creature_ptr->redraw |= (PR_STATUS);
1776 /* Nothing to notice */
1777 if (!notice) return (FALSE);
1779 if (disturb_state) disturb(FALSE, FALSE);
1780 creature_ptr->update |= (PU_BONUS);
1786 * @brief 一時的闘気のオーラの継続時間をセットする / Set "p_ptr->tim_sh_touki", notice observable changes
1788 * @param do_dec 現在の継続時間より長い値のみ上書きする
1789 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1791 bool set_tim_sh_touki(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
1793 bool notice = FALSE;
1794 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1796 if (creature_ptr->is_dead) return FALSE;
1801 if (creature_ptr->tim_sh_touki && !do_dec)
1803 if (creature_ptr->tim_sh_touki > v) return FALSE;
1805 else if (!creature_ptr->tim_sh_touki)
1807 msg_print(_("体が闘気のオーラで覆われた。", "You have enveloped by the aura of the Force!"));
1815 if (creature_ptr->tim_sh_touki)
1817 msg_print(_("闘気が消えた。", "Aura of the Force disappeared."));
1823 creature_ptr->tim_sh_touki = v;
1824 creature_ptr->redraw |= (PR_STATUS);
1826 /* Nothing to notice */
1827 if (!notice) return (FALSE);
1829 if (disturb_state) disturb(FALSE, FALSE);
1835 * @brief 一時的火炎のオーラの継続時間をセットする / Set "p_ptr->tim_sh_fire", notice observable changes
1837 * @param do_dec 現在の継続時間より長い値のみ上書きする
1838 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1840 bool set_tim_sh_fire(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
1842 bool notice = FALSE;
1843 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1845 if (creature_ptr->is_dead) return FALSE;
1850 if (creature_ptr->tim_sh_fire && !do_dec)
1852 if (creature_ptr->tim_sh_fire > v) return FALSE;
1854 else if (!creature_ptr->tim_sh_fire)
1856 msg_print(_("体が炎のオーラで覆われた。", "You have enveloped by fiery aura!"));
1864 if (creature_ptr->tim_sh_fire)
1866 msg_print(_("炎のオーラが消えた。", "Fiery aura disappeared."));
1872 creature_ptr->tim_sh_fire = v;
1873 creature_ptr->redraw |= (PR_STATUS);
1875 /* Nothing to notice */
1876 if (!notice) return (FALSE);
1878 if (disturb_state) disturb(FALSE, FALSE);
1879 creature_ptr->update |= (PU_BONUS);
1885 * @brief 一時的聖なるのオーラの継続時間をセットする / Set "p_ptr->tim_sh_holy", notice observable changes
1887 * @param do_dec 現在の継続時間より長い値のみ上書きする
1888 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1890 bool set_tim_sh_holy(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
1892 bool notice = FALSE;
1893 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1895 if (creature_ptr->is_dead) return FALSE;
1900 if (creature_ptr->tim_sh_holy && !do_dec)
1902 if (creature_ptr->tim_sh_holy > v) return FALSE;
1904 else if (!creature_ptr->tim_sh_holy)
1906 msg_print(_("体が聖なるオーラで覆われた。", "You have enveloped by holy aura!"));
1914 if (creature_ptr->tim_sh_holy)
1916 msg_print(_("聖なるオーラが消えた。", "Holy aura disappeared."));
1922 creature_ptr->tim_sh_holy = v;
1923 creature_ptr->redraw |= (PR_STATUS);
1925 /* Nothing to notice */
1926 if (!notice) return (FALSE);
1928 if (disturb_state) disturb(FALSE, FALSE);
1929 creature_ptr->update |= (PU_BONUS);
1935 * @brief 目には目をの残り時間をセットする / Set "p_ptr->tim_eyeeye", notice observable changes
1937 * @param do_dec 現在の継続時間より長い値のみ上書きする
1938 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1940 bool set_tim_eyeeye(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
1942 bool notice = FALSE;
1943 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1945 if (creature_ptr->is_dead) return FALSE;
1950 if (creature_ptr->tim_eyeeye && !do_dec)
1952 if (creature_ptr->tim_eyeeye > v) return FALSE;
1954 else if (!creature_ptr->tim_eyeeye)
1956 msg_print(_("法の守り手になった気がした!", "You feel like a keeper of commandments!"));
1964 if (creature_ptr->tim_eyeeye)
1966 msg_print(_("懲罰を執行することができなくなった。", "You no longer feel like a keeper."));
1972 creature_ptr->tim_eyeeye = v;
1973 creature_ptr->redraw |= (PR_STATUS);
1975 /* Nothing to notice */
1976 if (!notice) return (FALSE);
1978 if (disturb_state) disturb(FALSE, FALSE);
1979 creature_ptr->update |= (PU_BONUS);
1986 * @brief 一時的魔法防御の継続時間をセットする / Set "p_ptr->resist_magic", notice observable changes
1988 * @param do_dec 現在の継続時間より長い値のみ上書きする
1989 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1991 bool set_resist_magic(TIME_EFFECT v, bool do_dec)
1993 bool notice = FALSE;
1994 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1996 if (p_ptr->is_dead) return FALSE;
2001 if (p_ptr->resist_magic && !do_dec)
2003 if (p_ptr->resist_magic > v) return FALSE;
2005 else if (!p_ptr->resist_magic)
2007 msg_print(_("魔法への耐性がついた。", "You have been protected from magic!"));
2015 if (p_ptr->resist_magic)
2017 msg_print(_("魔法に弱くなった。", "You are no longer protected from magic."));
2023 p_ptr->resist_magic = v;
2024 p_ptr->redraw |= (PR_STATUS);
2026 /* Nothing to notice */
2027 if (!notice) return (FALSE);
2029 if (disturb_state) disturb(FALSE, FALSE);
2030 p_ptr->update |= (PU_BONUS);
2036 * @brief 一時的反射の継続時間をセットする / Set "p_ptr->tim_reflect", notice observable changes
2038 * @param do_dec 現在の継続時間より長い値のみ上書きする
2039 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2041 bool set_tim_reflect(TIME_EFFECT v, bool do_dec)
2043 bool notice = FALSE;
2044 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2046 if (p_ptr->is_dead) return FALSE;
2051 if (p_ptr->tim_reflect && !do_dec)
2053 if (p_ptr->tim_reflect > v) return FALSE;
2055 else if (!p_ptr->tim_reflect)
2057 msg_print(_("体の表面が滑かになった気がする。", "Your body becames smooth."));
2065 if (p_ptr->tim_reflect)
2067 msg_print(_("体の表面が滑かでなくなった。", "Your body is no longer smooth."));
2073 p_ptr->tim_reflect = v;
2074 p_ptr->redraw |= (PR_STATUS);
2076 /* Nothing to notice */
2077 if (!notice) return (FALSE);
2079 if (disturb_state) disturb(FALSE, FALSE);
2080 p_ptr->update |= (PU_BONUS);
2087 * Set "p_ptr->multishadow", notice observable changes
2089 bool set_multishadow(TIME_EFFECT v, bool do_dec)
2091 bool notice = FALSE;
2092 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2094 if (p_ptr->is_dead) return FALSE;
2099 if (p_ptr->multishadow && !do_dec)
2101 if (p_ptr->multishadow > v) return FALSE;
2103 else if (!p_ptr->multishadow)
2105 msg_print(_("あなたの周りに幻影が生まれた。", "Your Shadow enveloped you."));
2113 if (p_ptr->multishadow)
2115 msg_print(_("幻影が消えた。", "Your Shadow disappears."));
2121 p_ptr->multishadow = v;
2122 p_ptr->redraw |= (PR_STATUS);
2124 /* Nothing to notice */
2125 if (!notice) return (FALSE);
2127 if (disturb_state) disturb(FALSE, FALSE);
2128 p_ptr->update |= (PU_BONUS);
2134 * @brief 一時的破片のオーラの継続時間をセットする / Set "p_ptr->dustrobe", notice observable changes
2136 * @param do_dec 現在の継続時間より長い値のみ上書きする
2137 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2139 bool set_dustrobe(TIME_EFFECT v, bool do_dec)
2141 bool notice = FALSE;
2142 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2144 if (p_ptr->is_dead) return FALSE;
2149 if (p_ptr->dustrobe && !do_dec)
2151 if (p_ptr->dustrobe > v) return FALSE;
2153 else if (!p_ptr->dustrobe)
2155 msg_print(_("体が鏡のオーラで覆われた。", "You were enveloped by mirror shards."));
2163 if (p_ptr->dustrobe)
2165 msg_print(_("鏡のオーラが消えた。", "The mirror shards disappear."));
2171 p_ptr->dustrobe = v;
2172 p_ptr->redraw |= (PR_STATUS);
2174 /* Nothing to notice */
2175 if (!notice) return (FALSE);
2177 if (disturb_state) disturb(FALSE, FALSE);
2178 p_ptr->update |= (PU_BONUS);
2184 * @brief 一時的壁抜けの継続時間をセットする / Set "p_ptr->kabenuke", notice observable changes
2186 * @param do_dec 現在の継続時間より長い値のみ上書きする
2187 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2189 bool set_kabenuke(TIME_EFFECT v, bool do_dec)
2191 bool notice = FALSE;
2192 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2194 if (p_ptr->is_dead) return FALSE;
2199 if (p_ptr->kabenuke && !do_dec)
2201 if (p_ptr->kabenuke > v) return FALSE;
2203 else if (!p_ptr->kabenuke)
2205 msg_print(_("体が半物質の状態になった。", "You became ethereal form."));
2213 if (p_ptr->kabenuke)
2215 msg_print(_("体が物質化した。", "You are no longer in an ethereal form."));
2221 p_ptr->kabenuke = v;
2222 p_ptr->redraw |= (PR_STATUS);
2224 /* Nothing to notice */
2225 if (!notice) return (FALSE);
2227 if (disturb_state) disturb(FALSE, FALSE);
2228 p_ptr->update |= (PU_BONUS);
2234 * @brief オクレ兄さんの継続時間をセットする / Set "p_ptr->tsuyoshi", notice observable changes
2236 * @param do_dec 現在の継続時間より長い値のみ上書きする
2237 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2239 bool set_tsuyoshi(TIME_EFFECT v, bool do_dec)
2241 bool notice = FALSE;
2242 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2244 if (p_ptr->is_dead) return FALSE;
2249 if (p_ptr->tsuyoshi && !do_dec)
2251 if (p_ptr->tsuyoshi > v) return FALSE;
2253 else if (!p_ptr->tsuyoshi)
2255 msg_print(_("「オクレ兄さん!」", "Brother OKURE!"));
2257 chg_virtue(V_VITALITY, 2);
2264 if (p_ptr->tsuyoshi)
2266 msg_print(_("肉体が急速にしぼんでいった。", "Your body had quickly shriveled."));
2268 (void)dec_stat(p_ptr, A_CON, 20, TRUE);
2269 (void)dec_stat(p_ptr, A_STR, 20, TRUE);
2272 chg_virtue(V_VITALITY, -3);
2277 p_ptr->tsuyoshi = v;
2278 p_ptr->redraw |= (PR_STATUS);
2280 /* Nothing to notice */
2281 if (!notice) return (FALSE);
2283 if (disturb_state) disturb(FALSE, FALSE);
2284 p_ptr->update |= (PU_BONUS);
2286 /* Recalculate hitpoints */
2287 p_ptr->update |= (PU_HP);
2293 * @brief 一時的元素スレイの継続時間をセットする / Set a temporary elemental brand. Clear all other brands. Print status messages. -LM-
2294 * @param attack_type スレイのタイプID
2296 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2298 bool set_ele_attack(u32b attack_type, TIME_EFFECT v)
2300 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2302 /* Clear all elemental attacks (only one is allowed at a time). */
2303 if ((p_ptr->special_attack & (ATTACK_ACID)) && (attack_type != ATTACK_ACID))
2305 p_ptr->special_attack &= ~(ATTACK_ACID);
2306 msg_print(_("酸で攻撃できなくなった。", "Your temporary acidic brand fades away."));
2308 if ((p_ptr->special_attack & (ATTACK_ELEC)) && (attack_type != ATTACK_ELEC))
2310 p_ptr->special_attack &= ~(ATTACK_ELEC);
2311 msg_print(_("電撃で攻撃できなくなった。", "Your temporary electrical brand fades away."));
2313 if ((p_ptr->special_attack & (ATTACK_FIRE)) && (attack_type != ATTACK_FIRE))
2315 p_ptr->special_attack &= ~(ATTACK_FIRE);
2316 msg_print(_("火炎で攻撃できなくなった。", "Your temporary fiery brand fades away."));
2318 if ((p_ptr->special_attack & (ATTACK_COLD)) && (attack_type != ATTACK_COLD))
2320 p_ptr->special_attack &= ~(ATTACK_COLD);
2321 msg_print(_("冷気で攻撃できなくなった。", "Your temporary frost brand fades away."));
2323 if ((p_ptr->special_attack & (ATTACK_POIS)) && (attack_type != ATTACK_POIS))
2325 p_ptr->special_attack &= ~(ATTACK_POIS);
2326 msg_print(_("毒で攻撃できなくなった。", "Your temporary poison brand fades away."));
2329 if ((v) && (attack_type))
2331 /* Set attack type. */
2332 p_ptr->special_attack |= (attack_type);
2335 p_ptr->ele_attack = v;
2338 msg_format("%sで攻撃できるようになった!",
2339 ((attack_type == ATTACK_ACID) ? "酸" :
2340 ((attack_type == ATTACK_ELEC) ? "電撃" :
2341 ((attack_type == ATTACK_FIRE) ? "火炎" :
2342 ((attack_type == ATTACK_COLD) ? "冷気" :
2343 ((attack_type == ATTACK_POIS) ? "毒" :
2346 msg_format("For a while, the blows you deal will %s",
2347 ((attack_type == ATTACK_ACID) ? "melt with acid!" :
2348 ((attack_type == ATTACK_ELEC) ? "shock your foes!" :
2349 ((attack_type == ATTACK_FIRE) ? "burn with fire!" :
2350 ((attack_type == ATTACK_COLD) ? "chill to the bone!" :
2351 ((attack_type == ATTACK_POIS) ? "poison your enemies!" :
2352 "do nothing special."))))));
2356 if (disturb_state) disturb(FALSE, FALSE);
2357 p_ptr->redraw |= (PR_STATUS);
2359 p_ptr->update |= (PU_BONUS);
2366 * @brief 一時的元素免疫の継続時間をセットする / Set a temporary elemental brand. Clear all other brands. Print status messages. -LM-
2367 * @param immune_type 免疫のタイプID
2369 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2371 bool set_ele_immune(u32b immune_type, TIME_EFFECT v)
2373 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2375 /* Clear all elemental attacks (only one is allowed at a time). */
2376 if ((p_ptr->special_defense & (DEFENSE_ACID)) && (immune_type != DEFENSE_ACID))
2378 p_ptr->special_defense &= ~(DEFENSE_ACID);
2379 msg_print(_("酸の攻撃で傷つけられるようになった。。", "You are no longer immune to acid."));
2381 if ((p_ptr->special_defense & (DEFENSE_ELEC)) && (immune_type != DEFENSE_ELEC))
2383 p_ptr->special_defense &= ~(DEFENSE_ELEC);
2384 msg_print(_("電撃の攻撃で傷つけられるようになった。。", "You are no longer immune to electricity."));
2386 if ((p_ptr->special_defense & (DEFENSE_FIRE)) && (immune_type != DEFENSE_FIRE))
2388 p_ptr->special_defense &= ~(DEFENSE_FIRE);
2389 msg_print(_("火炎の攻撃で傷つけられるようになった。。", "You are no longer immune to fire."));
2391 if ((p_ptr->special_defense & (DEFENSE_COLD)) && (immune_type != DEFENSE_COLD))
2393 p_ptr->special_defense &= ~(DEFENSE_COLD);
2394 msg_print(_("冷気の攻撃で傷つけられるようになった。。", "You are no longer immune to cold."));
2396 if ((p_ptr->special_defense & (DEFENSE_POIS)) && (immune_type != DEFENSE_POIS))
2398 p_ptr->special_defense &= ~(DEFENSE_POIS);
2399 msg_print(_("毒の攻撃で傷つけられるようになった。。", "You are no longer immune to poison."));
2402 if ((v) && (immune_type))
2404 /* Set attack type. */
2405 p_ptr->special_defense |= (immune_type);
2408 p_ptr->ele_immune = v;
2410 msg_format(_("%sの攻撃を受けつけなくなった!", "For a while, You are immune to %s"),
2411 ((immune_type == DEFENSE_ACID) ? _("酸", "acid!") :
2412 ((immune_type == DEFENSE_ELEC) ? _("電撃", "electricity!") :
2413 ((immune_type == DEFENSE_FIRE) ? _("火炎", "fire!") :
2414 ((immune_type == DEFENSE_COLD) ? _("冷気", "cold!") :
2415 ((immune_type == DEFENSE_POIS) ? _("毒", "poison!") :
2416 _("(なし)", "do nothing special.")))))));
2419 if (disturb_state) disturb(FALSE, FALSE);
2420 p_ptr->redraw |= (PR_STATUS);
2421 p_ptr->update |= (PU_BONUS);
2428 * @brief 一時的酸耐性の継続時間をセットする / Set "p_ptr->oppose_acid", notice observable changes
2430 * @param do_dec 現在の継続時間より長い値のみ上書きする
2431 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2433 bool set_oppose_acid(TIME_EFFECT v, bool do_dec)
2435 bool notice = FALSE;
2436 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2438 if (p_ptr->is_dead) return FALSE;
2443 if (p_ptr->oppose_acid && !do_dec)
2445 if (p_ptr->oppose_acid > v) return FALSE;
2447 else if (!IS_OPPOSE_ACID())
2449 msg_print(_("酸への耐性がついた気がする!", "You feel resistant to acid!"));
2457 if (p_ptr->oppose_acid && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
2459 msg_print(_("酸への耐性が薄れた気がする。", "You feel less resistant to acid."));
2465 p_ptr->oppose_acid = v;
2467 /* Nothing to notice */
2468 if (!notice) return (FALSE);
2469 p_ptr->redraw |= (PR_STATUS);
2471 if (disturb_state) disturb(FALSE, FALSE);
2477 * @brief 一時的電撃耐性の継続時間をセットする / Set "p_ptr->oppose_elec", notice observable changes
2479 * @param do_dec 現在の継続時間より長い値のみ上書きする
2480 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2482 bool set_oppose_elec(TIME_EFFECT v, bool do_dec)
2484 bool notice = FALSE;
2485 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2487 if (p_ptr->is_dead) return FALSE;
2492 if (p_ptr->oppose_elec && !do_dec)
2494 if (p_ptr->oppose_elec > v) return FALSE;
2496 else if (!IS_OPPOSE_ELEC())
2498 msg_print(_("電撃への耐性がついた気がする!", "You feel resistant to electricity!"));
2506 if (p_ptr->oppose_elec && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
2508 msg_print(_("電撃への耐性が薄れた気がする。", "You feel less resistant to electricity."));
2514 p_ptr->oppose_elec = v;
2516 /* Nothing to notice */
2517 if (!notice) return (FALSE);
2518 p_ptr->redraw |= (PR_STATUS);
2520 if (disturb_state) disturb(FALSE, FALSE);
2526 * @brief 一時的火炎耐性の継続時間をセットする / Set "p_ptr->oppose_fire", notice observable changes
2528 * @param do_dec 現在の継続時間より長い値のみ上書きする
2529 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2531 bool set_oppose_fire(TIME_EFFECT v, bool do_dec)
2533 bool notice = FALSE;
2534 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2536 if (p_ptr->is_dead) return FALSE;
2538 if ((PRACE_IS_(p_ptr, RACE_DEMON) && (p_ptr->lev > 44)) || (p_ptr->mimic_form == MIMIC_DEMON)) v = 1;
2542 if (p_ptr->oppose_fire && !do_dec)
2544 if (p_ptr->oppose_fire > v) return FALSE;
2546 else if (!IS_OPPOSE_FIRE())
2548 msg_print(_("火への耐性がついた気がする!", "You feel resistant to fire!"));
2556 if (p_ptr->oppose_fire && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
2558 msg_print(_("火への耐性が薄れた気がする。", "You feel less resistant to fire."));
2564 p_ptr->oppose_fire = v;
2566 /* Nothing to notice */
2567 if (!notice) return (FALSE);
2568 p_ptr->redraw |= (PR_STATUS);
2570 if (disturb_state) disturb(FALSE, FALSE);
2576 * @brief 一時的冷気耐性の継続時間をセットする / Set "p_ptr->oppose_cold", notice observable changes
2578 * @param do_dec 現在の継続時間より長い値のみ上書きする
2579 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2581 bool set_oppose_cold(TIME_EFFECT v, bool do_dec)
2583 bool notice = FALSE;
2584 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2586 if (p_ptr->is_dead) return FALSE;
2591 if (p_ptr->oppose_cold && !do_dec)
2593 if (p_ptr->oppose_cold > v) return FALSE;
2595 else if (!IS_OPPOSE_COLD())
2597 msg_print(_("冷気への耐性がついた気がする!", "You feel resistant to cold!"));
2605 if (p_ptr->oppose_cold && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
2607 msg_print(_("冷気への耐性が薄れた気がする。", "You feel less resistant to cold."));
2613 p_ptr->oppose_cold = v;
2615 /* Nothing to notice */
2616 if (!notice) return (FALSE);
2617 p_ptr->redraw |= (PR_STATUS);
2619 if (disturb_state) disturb(FALSE, FALSE);
2625 * @brief 一時的毒耐性の継続時間をセットする / Set "p_ptr->oppose_pois", notice observable changes
2627 * @param do_dec 現在の継続時間より長い値のみ上書きする
2628 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2630 bool set_oppose_pois(TIME_EFFECT v, bool do_dec)
2632 bool notice = FALSE;
2633 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2635 if ((p_ptr->pclass == CLASS_NINJA) && (p_ptr->lev > 44)) v = 1;
2636 if (p_ptr->is_dead) return FALSE;
2641 if (p_ptr->oppose_pois && !do_dec)
2643 if (p_ptr->oppose_pois > v) return FALSE;
2645 else if (!IS_OPPOSE_POIS())
2647 msg_print(_("毒への耐性がついた気がする!", "You feel resistant to poison!"));
2655 if (p_ptr->oppose_pois && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
2657 msg_print(_("毒への耐性が薄れた気がする。", "You feel less resistant to poison."));
2663 p_ptr->oppose_pois = v;
2665 /* Nothing to notice */
2666 if (!notice) return (FALSE);
2667 p_ptr->redraw |= (PR_STATUS);
2669 if (disturb_state) disturb(FALSE, FALSE);
2675 * @brief 朦朧の継続時間をセットする / Set "p_ptr->stun", notice observable changes
2677 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2679 * Note the special code to only notice "range" changes.
2681 bool set_stun(TIME_EFFECT v)
2683 int old_aux, new_aux;
2684 bool notice = FALSE;
2685 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2687 if (p_ptr->is_dead) return FALSE;
2688 if (PRACE_IS_(p_ptr, RACE_GOLEM) || ((p_ptr->pclass == CLASS_BERSERKER) && (p_ptr->lev > 34))) v = 0;
2691 if (p_ptr->stun > 100)
2697 else if (p_ptr->stun > 50)
2703 else if (p_ptr->stun > 0)
2739 if (new_aux > old_aux)
2741 /* Describe the state */
2745 case 1: msg_print(_("意識がもうろうとしてきた。", "You have been stunned.")); break;
2748 case 2: msg_print(_("意識がひどくもうろうとしてきた。", "You have been heavily stunned.")); break;
2751 case 3: msg_print(_("頭がクラクラして意識が遠のいてきた。", "You have been knocked out.")); break;
2754 if (randint1(1000) < v || one_in_(16))
2756 msg_print(_("割れるような頭痛がする。", "A vicious blow hits your head."));
2760 if (!p_ptr->sustain_int) (void)do_dec_stat(p_ptr, A_INT);
2761 if (!p_ptr->sustain_wis) (void)do_dec_stat(p_ptr, A_WIS);
2763 else if (one_in_(2))
2765 if (!p_ptr->sustain_int) (void)do_dec_stat(p_ptr, A_INT);
2769 if (!p_ptr->sustain_wis) (void)do_dec_stat(p_ptr, A_WIS);
2772 if (p_ptr->special_defense & KATA_MASK)
2774 msg_print(_("型が崩れた。", "Your posture gets loose."));
2775 p_ptr->special_defense &= ~(KATA_MASK);
2776 p_ptr->update |= (PU_BONUS);
2777 p_ptr->update |= (PU_MONSTERS);
2778 p_ptr->redraw |= (PR_STATE);
2779 p_ptr->redraw |= (PR_STATUS);
2780 p_ptr->action = ACTION_NONE;
2784 if (p_ptr->concent) reset_concentration(TRUE);
2787 if (hex_spelling_any()) stop_hex_spell_all();
2793 else if (new_aux < old_aux)
2795 /* Describe the state */
2800 msg_print(_("やっと朦朧状態から回復した。", "You are no longer stunned."));
2802 if (disturb_state) disturb(FALSE, FALSE);
2813 if (!notice) return (FALSE);
2815 if (disturb_state) disturb(FALSE, FALSE);
2816 p_ptr->update |= (PU_BONUS);
2818 /* Redraw the "stun" */
2819 p_ptr->redraw |= (PR_STUN);
2826 * @brief 出血の継続時間をセットする / Set "p_ptr->cut", notice observable changes
2828 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
2830 * Note the special code to only notice "range" changes.
2832 bool set_cut(TIME_EFFECT v)
2834 int old_aux, new_aux;
2835 bool notice = FALSE;
2836 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2838 if (p_ptr->is_dead) return FALSE;
2840 if ((p_ptr->prace == RACE_GOLEM ||
2841 p_ptr->prace == RACE_SKELETON ||
2842 p_ptr->prace == RACE_SPECTRE ||
2843 (p_ptr->prace == RACE_ZOMBIE && p_ptr->lev > 11)) &&
2848 if (p_ptr->cut > 1000)
2854 else if (p_ptr->cut > 200)
2860 else if (p_ptr->cut > 100)
2866 else if (p_ptr->cut > 50)
2872 else if (p_ptr->cut > 25)
2878 else if (p_ptr->cut > 10)
2884 else if (p_ptr->cut > 0)
2944 if (new_aux > old_aux)
2946 /* Describe the state */
2950 case 1: msg_print(_("かすり傷を負ってしまった。", "You have been given a graze.")); break;
2953 case 2: msg_print(_("軽い傷を負ってしまった。", "You have been given a light cut.")); break;
2956 case 3: msg_print(_("ひどい傷を負ってしまった。", "You have been given a bad cut.")); break;
2959 case 4: msg_print(_("大変な傷を負ってしまった。", "You have been given a nasty cut.")); break;
2962 case 5: msg_print(_("重大な傷を負ってしまった。", "You have been given a severe cut.")); break;
2965 case 6: msg_print(_("ひどい深手を負ってしまった。", "You have been given a deep gash.")); break;
2968 case 7: msg_print(_("致命的な傷を負ってしまった。", "You have been given a mortal wound.")); break;
2973 if (randint1(1000) < v || one_in_(16))
2975 if (!p_ptr->sustain_chr)
2977 msg_print(_("ひどい傷跡が残ってしまった。", "You have been horribly scarred."));
2978 do_dec_stat(p_ptr, A_CHR);
2984 else if (new_aux < old_aux)
2986 /* Describe the state */
2991 msg_format(_("やっと%s。", "You are no longer bleeding."), p_ptr->prace == RACE_ANDROID ? "怪我が直った" : "出血が止まった");
2993 if (disturb_state) disturb(FALSE, FALSE);
3004 if (!notice) return (FALSE);
3006 if (disturb_state) disturb(FALSE, FALSE);
3007 p_ptr->update |= (PU_BONUS);
3009 /* Redraw the "cut" */
3010 p_ptr->redraw |= (PR_CUT);
3016 * @brief 空腹状態をセットする / Set "p_ptr->food", notice observable changes
3018 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
3020 * Set "", notice observable changes\n
3022 * The "p_ptr->food" variable can get as large as 20000, allowing the
3023 * addition of the most "filling" item, Elvish Waybread, which adds
3024 * 7500 food units, without overflowing the 32767 maximum limit.\n
3026 * Perhaps we should disturb the player with various messages,
3027 * especially messages about hunger status changes. \n
3029 * Digestion of food is handled in "dungeon.c", in which, normally,
3030 * the player digests about 20 food units per 100 game turns, more
3031 * when "fast", more when "regenerating", less with "slow digestion",
3032 * but when the player is "gorged", he digests 100 food units per 10
3033 * game turns, or a full 1000 food units per 100 game turns.\n
3035 * Note that the player's speed is reduced by 10 units while gorged,
3036 * so if the player eats a single food ration (5000 food units) when
3037 * full (15000 food units), he will be gorged for (5000/100)*10 = 500
3038 * game turns, or 500/(100/5) = 25 player turns (if nothing else is
3039 * affecting the player speed).\n
3041 bool set_food(TIME_EFFECT v)
3043 int old_aux, new_aux;
3045 bool notice = FALSE;
3046 v = (v > 20000) ? 20000 : (v < 0) ? 0 : v;
3048 /* Fainting / Starving */
3049 if (p_ptr->food < PY_FOOD_FAINT)
3055 else if (p_ptr->food < PY_FOOD_WEAK)
3061 else if (p_ptr->food < PY_FOOD_ALERT)
3067 else if (p_ptr->food < PY_FOOD_FULL)
3073 else if (p_ptr->food < PY_FOOD_MAX)
3084 /* Fainting / Starving */
3085 if (v < PY_FOOD_FAINT)
3091 else if (v < PY_FOOD_WEAK)
3097 else if (v < PY_FOOD_ALERT)
3103 else if (v < PY_FOOD_FULL)
3109 else if (v < PY_FOOD_MAX)
3120 if (old_aux < 1 && new_aux > 0)
3121 chg_virtue(V_PATIENCE, 2);
3122 else if (old_aux < 3 && (old_aux != new_aux))
3123 chg_virtue(V_PATIENCE, 1);
3125 chg_virtue(V_TEMPERANCE, 1);
3127 chg_virtue(V_TEMPERANCE, -1);
3130 if (new_aux > old_aux)
3132 /* Describe the state */
3136 case 1: msg_print(_("まだ空腹で倒れそうだ。", "You are still weak.")); break;
3139 case 2: msg_print(_("まだ空腹だ。", "You are still hungry.")); break;
3142 case 3: msg_print(_("空腹感がおさまった。", "You are no longer hungry.")); break;
3145 case 4: msg_print(_("満腹だ!", "You are full!")); break;
3149 msg_print(_("食べ過ぎだ!", "You have gorged yourself!"));
3150 chg_virtue(V_HARMONY, -1);
3151 chg_virtue(V_PATIENCE, -1);
3152 chg_virtue(V_TEMPERANCE, -2);
3162 else if (new_aux < old_aux)
3164 /* Describe the state */
3167 /* Fainting / Starving */
3168 case 0: msg_print(_("あまりにも空腹で気を失ってしまった!", "You are getting faint from hunger!")); break;
3171 case 1: msg_print(_("お腹が空いて倒れそうだ。", "You are getting weak from hunger!")); break;
3174 case 2: msg_print(_("お腹が空いてきた。", "You are getting hungry.")); break;
3177 case 3: msg_print(_("満腹感がなくなった。", "You are no longer full.")); break;
3180 case 4: msg_print(_("やっとお腹がきつくなくなった。", "You are no longer gorged.")); break;
3183 if (p_ptr->wild_mode && (new_aux < 2))
3185 change_wild_mode(FALSE);
3195 /* Nothing to notice */
3196 if (!notice) return (FALSE);
3198 if (disturb_state) disturb(FALSE, FALSE);
3199 p_ptr->update |= (PU_BONUS);
3202 p_ptr->redraw |= (PR_HUNGER);
3208 * @brief プレイヤーの基本能力値を増加させる / Increases a stat by one randomized level -RAK-
3209 * @param stat 上昇させるステータスID
3210 * @return 実際に上昇した場合TRUEを返す。
3212 * Note that this function (used by stat potions) now restores\n
3213 * the stat BEFORE increasing it.\n
3215 bool inc_stat(player_type *creature_ptr, int stat)
3217 BASE_STATUS value, gain;
3219 /* Then augment the current/max stat */
3220 value = creature_ptr->stat_cur[stat];
3222 /* Cannot go above 18/100 */
3223 if (value < creature_ptr->stat_max_max[stat])
3225 /* Gain one (sometimes two) points */
3228 gain = ((randint0(100) < 75) ? 1 : 2);
3232 /* Gain 1/6 to 1/3 of distance to 18/100 */
3233 else if (value < (creature_ptr->stat_max_max[stat]-2))
3235 /* Approximate gain value */
3236 gain = (((creature_ptr->stat_max_max[stat]) - value) / 2 + 3) / 2;
3237 if (gain < 1) gain = 1;
3239 /* Apply the bonus */
3240 value += randint1(gain) + gain / 2;
3243 if (value > (creature_ptr->stat_max_max[stat]-1)) value = creature_ptr->stat_max_max[stat]-1;
3246 /* Gain one point at a time */
3252 /* Save the new value */
3253 creature_ptr->stat_cur[stat] = value;
3255 /* Bring up the maximum too */
3256 if (value > creature_ptr->stat_max[stat])
3258 creature_ptr->stat_max[stat] = value;
3260 creature_ptr->update |= (PU_BONUS);
3266 /* Nothing to gain */
3271 * @brief プレイヤーの基本能力値を減少させる / Decreases a stat by an amount indended to vary from 0 to 100 percent.
3272 * @param stat 減少させるステータスID
3273 * @param amount 減少させる基本量
3274 * @param permanent TRUEならば現在の最大値を減少させる
3275 * @return 実際に減少した場合TRUEを返す。
3278 * Amount could be a little higher in extreme cases to mangle very high\n
3279 * stats from massive assaults. -CWS\n
3281 * Note that "permanent" means that the *given* amount is permanent,\n
3282 * not that the new value becomes permanent. This may not work exactly\n
3283 * as expected, due to "weirdness" in the algorithm, but in general,\n
3284 * if your stat is already drained, the "max" value will not drop all\n
3285 * the way down to the "cur" value.\n
3287 bool dec_stat(player_type *creature_ptr, int stat, int amount, int permanent)
3289 BASE_STATUS cur, max;
3293 /* Acquire current value */
3294 cur = creature_ptr->stat_cur[stat];
3295 max = creature_ptr->stat_max[stat];
3297 /* Note when the values are identical */
3298 same = (cur == max);
3300 /* Damage "current" value */
3303 /* Handle "low" values */
3306 if (amount > 90) cur--;
3307 if (amount > 50) cur--;
3308 if (amount > 20) cur--;
3312 /* Handle "high" values */
3315 /* Hack -- Decrement by a random amount between one-quarter */
3316 /* and one-half of the stat bonus times the percentage, with a */
3317 /* minimum damage of half the percentage. -CWS */
3318 loss = (((cur-18) / 2 + 1) / 2 + 1);
3319 if (loss < 1) loss = 1;
3321 /* Randomize the loss */
3322 loss = ((randint1(loss) + loss) * amount) / 100;
3325 if (loss < amount/2) loss = amount/2;
3327 /* Lose some points */
3330 /* Hack -- Only reduce stat to 17 sometimes */
3331 if (cur < 18) cur = (amount <= 20) ? 18 : 17;
3334 /* Prevent illegal values */
3335 if (cur < 3) cur = 3;
3337 /* Something happened */
3338 if (cur != creature_ptr->stat_cur[stat]) res = TRUE;
3341 /* Damage "max" value */
3342 if (permanent && (max > 3))
3344 chg_virtue(V_SACRIFICE, 1);
3345 if (stat == A_WIS || stat == A_INT)
3346 chg_virtue(V_ENLIGHTEN, -2);
3348 /* Handle "low" values */
3351 if (amount > 90) max--;
3352 if (amount > 50) max--;
3353 if (amount > 20) max--;
3357 /* Handle "high" values */
3360 /* Hack -- Decrement by a random amount between one-quarter */
3361 /* and one-half of the stat bonus times the percentage, with a */
3362 /* minimum damage of half the percentage. -CWS */
3363 loss = (((max-18) / 2 + 1) / 2 + 1);
3364 loss = ((randint1(loss) + loss) * amount) / 100;
3365 if (loss < amount/2) loss = amount/2;
3367 /* Lose some points */
3370 /* Hack -- Only reduce stat to 17 sometimes */
3371 if (max < 18) max = (amount <= 20) ? 18 : 17;
3374 /* Hack -- keep it clean */
3375 if (same || (max < cur)) max = cur;
3377 /* Something happened */
3378 if (max != creature_ptr->stat_max[stat]) res = TRUE;
3383 /* Actually set the stat to its new value. */
3384 creature_ptr->stat_cur[stat] = cur;
3385 creature_ptr->stat_max[stat] = max;
3387 creature_ptr->redraw |= (PR_STATS);
3388 creature_ptr->update |= (PU_BONUS);
3396 * @brief プレイヤーの基本能力値を回復させる / Restore a stat. Return TRUE only if this actually makes a difference.
3397 * @param stat 回復ステータスID
3398 * @return 実際に回復した場合TRUEを返す。
3400 bool res_stat(player_type *creature_ptr, int stat)
3402 /* Restore if needed */
3403 if (creature_ptr->stat_cur[stat] != creature_ptr->stat_max[stat])
3405 creature_ptr->stat_cur[stat] = creature_ptr->stat_max[stat];
3406 creature_ptr->update |= (PU_BONUS);
3407 creature_ptr->redraw |= (PR_STATS);
3413 /* Nothing to restore */
3419 * Increase players hit points, notice effects
3421 bool hp_player(player_type *creature_ptr, int num)
3424 vir = virtue_number(V_VITALITY);
3426 if(num <= 0) return (FALSE);
3430 num = num * (creature_ptr->virtues[vir - 1] + 1250) / 1250;
3432 /* Healing needed */
3433 if (creature_ptr->chp < creature_ptr->mhp)
3435 if ((num > 0) && (creature_ptr->chp < (creature_ptr->mhp/3)))
3436 chg_virtue(V_TEMPERANCE, 1);
3437 /* Gain hitpoints */
3438 creature_ptr->chp += num;
3440 /* Enforce maximum */
3441 if (creature_ptr->chp >= creature_ptr->mhp)
3443 creature_ptr->chp = creature_ptr->mhp;
3444 creature_ptr->chp_frac = 0;
3447 creature_ptr->redraw |= (PR_HP);
3449 creature_ptr->window |= (PW_PLAYER);
3454 msg_print(_("少し気分が良くなった。", "You feel a little better."));
3460 msg_print(_("気分が良くなった。", "You feel better."));
3466 msg_print(_("とても気分が良くなった。", "You feel much better."));
3472 msg_print(_("ひじょうに気分が良くなった。", "You feel very good."));
3484 * Array of stat "descriptions"
3486 static concptr desc_stat_pos[] =
3491 _("器用に", "dextrous"),
3492 _("健康に", "healthy"),
3498 * Array of stat "descriptions"
3500 static concptr desc_stat_neg[] =
3505 _("不器用に", "clumsy"),
3506 _("不健康に", "sickly"),
3514 bool do_dec_stat(player_type *creature_ptr, int stat)
3518 /* Access the "sustain" */
3521 case A_STR: if (creature_ptr->sustain_str) sust = TRUE; break;
3522 case A_INT: if (creature_ptr->sustain_int) sust = TRUE; break;
3523 case A_WIS: if (creature_ptr->sustain_wis) sust = TRUE; break;
3524 case A_DEX: if (creature_ptr->sustain_dex) sust = TRUE; break;
3525 case A_CON: if (creature_ptr->sustain_con) sust = TRUE; break;
3526 case A_CHR: if (creature_ptr->sustain_chr) sust = TRUE; break;
3530 if (sust && (!ironman_nightmare || randint0(13)))
3532 msg_format(_("%sなった気がしたが、すぐに元に戻った。", "You feel %s for a moment, but the feeling passes."),
3533 desc_stat_neg[stat]);
3539 /* Attempt to reduce the stat */
3540 if (dec_stat(p_ptr, stat, 10, (ironman_nightmare && !randint0(13))))
3542 msg_format(_("ひどく%sなった気がする。", "You feel very %s."), desc_stat_neg[stat]);
3548 /* Nothing obvious */
3554 * Restore lost "points" in a stat
3556 bool do_res_stat(player_type *creature_ptr, int stat)
3558 /* Attempt to increase */
3559 if (res_stat(creature_ptr, stat))
3561 msg_format(_("元通りに%sなった気がする。", "You feel less %s."), desc_stat_pos[stat]);
3565 /* Nothing obvious */
3571 * Gain a "point" in a stat
3573 bool do_inc_stat(int stat)
3577 /* Restore strength */
3578 res = res_stat(p_ptr, stat);
3580 /* Attempt to increase */
3581 if (inc_stat(p_ptr, stat))
3585 chg_virtue(V_ENLIGHTEN, 1);
3586 chg_virtue(V_FAITH, 1);
3588 else if (stat == A_INT)
3590 chg_virtue(V_KNOWLEDGE, 1);
3591 chg_virtue(V_ENLIGHTEN, 1);
3593 else if (stat == A_CON)
3594 chg_virtue(V_VITALITY, 1);
3596 msg_format(_("ワーオ!とても%sなった!", "Wow! You feel very %s!"), desc_stat_pos[stat]);
3601 /* Restoration worked */
3604 msg_format(_("元通りに%sなった気がする。", "You feel less %s."), desc_stat_pos[stat]);
3609 /* Nothing obvious */
3615 * Restores any drained experience
3617 bool restore_level(void)
3619 /* Restore experience */
3620 if (p_ptr->exp < p_ptr->max_exp)
3622 msg_print(_("経験値が戻ってきた気がする。", "You feel your experience returning."));
3624 /* Restore the experience */
3625 p_ptr->exp = p_ptr->max_exp;
3627 /* Check the experience */
3641 bool lose_all_info(void)
3645 chg_virtue(V_KNOWLEDGE, -5);
3646 chg_virtue(V_ENLIGHTEN, -5);
3648 /* Forget info about objects */
3649 for (i = 0; i < INVEN_TOTAL; i++)
3651 object_type *o_ptr = &p_ptr->inventory_list[i];
3652 if (!o_ptr->k_idx) continue;
3654 /* Allow "protection" by the MENTAL flag */
3655 if (o_ptr->ident & (IDENT_MENTAL)) continue;
3657 /* Remove "default inscriptions" */
3658 o_ptr->feeling = FEEL_NONE;
3660 /* Hack -- Clear the "empty" flag */
3661 o_ptr->ident &= ~(IDENT_EMPTY);
3663 /* Hack -- Clear the "known" flag */
3664 o_ptr->ident &= ~(IDENT_KNOWN);
3666 /* Hack -- Clear the "felt" flag */
3667 o_ptr->ident &= ~(IDENT_SENSE);
3669 p_ptr->update |= (PU_BONUS);
3670 p_ptr->update |= (PU_COMBINE | PU_REORDER);
3672 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
3674 /* Mega-Hack -- Forget the map */
3682 void do_poly_wounds(void)
3684 /* Changed to always provide at least _some_ healing */
3685 s16b wounds = p_ptr->cut;
3686 s16b hit_p = (p_ptr->mhp - p_ptr->chp);
3687 s16b change = damroll(p_ptr->lev, 5);
3688 bool Nasty_effect = one_in_(5);
3690 if (!(wounds || hit_p || Nasty_effect)) return;
3692 msg_print(_("傷がより軽いものに変化した。", "Your wounds are polymorphed into less serious ones."));
3693 hp_player(p_ptr, change);
3696 msg_print(_("新たな傷ができた!", "A new wound was created!"));
3697 take_hit(DAMAGE_LOSELIFE, change / 2, _("変化した傷", "a polymorphed wound"), -1);
3702 set_cut(p_ptr->cut - (change / 2));
3708 * Change player race
3710 void change_race(CHARACTER_IDX new_race, concptr effect_msg)
3712 concptr title = race_info[new_race].title;
3713 int old_race = p_ptr->prace;
3716 msg_format("あなたは%s%sに変化した!", effect_msg, title);
3718 msg_format("You current_world_ptr->game_turn into %s %s%s!", (!effect_msg[0] && is_a_vowel(title[0]) ? "an" : "a"), effect_msg, title);
3721 chg_virtue(V_CHANCE, 2);
3723 if (p_ptr->prace < 32)
3725 p_ptr->old_race1 |= 1L << p_ptr->prace;
3729 p_ptr->old_race2 |= 1L << (p_ptr->prace - 32);
3731 p_ptr->prace = new_race;
3732 rp_ptr = &race_info[p_ptr->prace];
3734 /* Experience factor */
3735 p_ptr->expfact = rp_ptr->r_exp + cp_ptr->c_exp;
3738 * The speed bonus of Klackons and Sprites are disabled
3739 * and the experience penalty is decreased.
3741 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)))
3742 p_ptr->expfact -= 15;
3744 /* Get character's height and weight */
3745 get_height_weight();
3748 if (p_ptr->pclass == CLASS_SORCERER)
3749 p_ptr->hitdie = rp_ptr->r_mhp/2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
3751 p_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
3753 roll_hitdice(p_ptr, 0L);
3755 /* The experience level may be modified */
3758 p_ptr->redraw |= (PR_BASIC);
3760 p_ptr->update |= (PU_BONUS);
3764 /* Load an autopick preference file */
3765 if (old_race != p_ptr->prace) autopick_load_pref(FALSE);
3767 /* Player's graphic tile may change */
3768 lite_spot(p_ptr->y, p_ptr->x);
3772 void do_poly_self(void)
3774 int power = p_ptr->lev;
3776 msg_print(_("あなたは変化の訪れを感じた...", "You feel a change coming over you..."));
3777 chg_virtue(V_CHANCE, 1);
3779 if ((power > randint0(20)) && one_in_(3) && (p_ptr->prace != RACE_ANDROID))
3781 char effect_msg[80] = "";
3782 CHARACTER_IDX new_race;
3784 /* Some form of racial polymorph... */
3787 if ((power > randint0(5)) && one_in_(4))
3792 if (p_ptr->psex == SEX_MALE)
3794 p_ptr->psex = SEX_FEMALE;
3795 sp_ptr = &sex_info[p_ptr->psex];
3796 sprintf(effect_msg, _("女性の", "female "));
3800 p_ptr->psex = SEX_MALE;
3801 sp_ptr = &sex_info[p_ptr->psex];
3802 sprintf(effect_msg, _("男性の", "male "));
3806 if ((power > randint0(30)) && one_in_(5))
3810 /* Harmful deformity */
3817 (void)dec_stat(p_ptr, tmp, randint1(6) + 6, one_in_(3));
3823 /* Deformities are discriminated against! */
3824 (void)dec_stat(p_ptr, A_CHR, randint1(6), TRUE);
3829 sprintf(tmp_msg,_("%s", "%s "),effect_msg);
3830 sprintf(effect_msg,_("奇形の%s", "deformed %s "),tmp_msg);
3834 sprintf(effect_msg,_("奇形の", "deformed "));
3838 while ((power > randint0(20)) && one_in_(10))
3840 /* Polymorph into a less mutated form */
3843 if (!lose_mutation(0))
3844 msg_print(_("奇妙なくらい普通になった気がする。", "You feel oddly normal."));
3849 new_race = (CHARACTER_IDX)randint0(MAX_RACES);
3851 while ((new_race == p_ptr->prace) || (new_race == RACE_ANDROID));
3853 change_race(new_race, effect_msg);
3856 if ((power > randint0(30)) && one_in_(6))
3862 msg_format(_("%sの構成が変化した!", "Your internal organs are rearranged!"), p_ptr->prace == RACE_ANDROID ? "機械" : "内臓");
3866 (void)dec_stat(p_ptr, tmp, randint1(6) + 6, one_in_(3));
3871 msg_print(_("現在の姿で生きていくのは困難なようだ!", "You find living difficult in your present form!"));
3872 take_hit(DAMAGE_LOSELIFE, damroll(randint1(10), p_ptr->lev), _("致命的な突然変異", "a lethal mutation"), -1);
3878 if ((power > randint0(20)) && one_in_(4))
3883 roll_hitdice(p_ptr, 0L);
3886 while ((power > randint0(15)) && one_in_(3))
3889 (void)gain_mutation(p_ptr, 0);
3892 if (power > randint0(5))
3898 /* Note: earlier deductions may have left power < 0 already. */
3909 void gain_exp_64(s32b amount, u32b amount_frac)
3911 if (p_ptr->is_dead) return;
3913 if (p_ptr->prace == RACE_ANDROID) return;
3915 /* Gain some experience */
3916 s64b_add(&(p_ptr->exp), &(p_ptr->exp_frac), amount, amount_frac);
3918 /* Slowly recover from experience drainage */
3919 if (p_ptr->exp < p_ptr->max_exp)
3921 /* Gain max experience (20%) (was 10%) */
3922 p_ptr->max_exp += amount / 5;
3925 /* Check Experience */
3933 void gain_exp(s32b amount)
3935 gain_exp_64(amount, 0L);
3939 void calc_android_exp(void)
3943 if (p_ptr->is_dead) return;
3945 if (p_ptr->prace != RACE_ANDROID) return;
3947 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
3949 object_type *o_ptr = &p_ptr->inventory_list[i];
3951 object_type *q_ptr = &forge;
3953 DEPTH level = MAX(k_info[o_ptr->k_idx].level - 8, 1);
3955 if ((i == INVEN_RIGHT) || (i == INVEN_LEFT) || (i == INVEN_NECK) || (i == INVEN_LITE)) continue;
3956 if (!o_ptr->k_idx) continue;
3959 object_copy(q_ptr, o_ptr);
3960 q_ptr->discount = 0;
3961 q_ptr->curse_flags = 0L;
3963 if (object_is_fixed_artifact(o_ptr))
3965 level = (level + MAX(a_info[o_ptr->name1].level - 8, 5)) / 2;
3966 level += MIN(20, a_info[o_ptr->name1].rarity/(a_info[o_ptr->name1].gen_flags & TRG_INSTA_ART ? 10 : 3));
3968 else if (object_is_ego(o_ptr))
3970 level += MAX(3, (e_info[o_ptr->name2].rating - 5)/2);
3972 else if (o_ptr->art_name)
3974 s32b total_flags = flag_cost(o_ptr, o_ptr->pval);
3977 if (!object_is_weapon_ammo(o_ptr))
3980 if (total_flags < 15000) fake_level = 10;
3981 else if (total_flags < 35000) fake_level = 25;
3982 else fake_level = 40;
3987 if (total_flags < 20000) fake_level = 10;
3988 else if (total_flags < 45000) fake_level = 25;
3989 else fake_level = 40;
3992 level = MAX(level, (level + MAX(fake_level - 8, 5)) / 2 + 3);
3995 value = object_value_real(q_ptr);
3997 if (value <= 0) continue;
3998 if ((o_ptr->tval == TV_SOFT_ARMOR) && (o_ptr->sval == SV_ABUNAI_MIZUGI) && (p_ptr->pseikaku != SEIKAKU_SEXY)) value /= 32;
3999 if (value > 5000000L) value = 5000000L;
4000 if ((o_ptr->tval == TV_DRAG_ARMOR) || (o_ptr->tval == TV_CARD)) level /= 2;
4002 if (object_is_artifact(o_ptr) || object_is_ego(o_ptr) ||
4003 (o_ptr->tval == TV_DRAG_ARMOR) ||
4004 ((o_ptr->tval == TV_HELM) && (o_ptr->sval == SV_DRAGON_HELM)) ||
4005 ((o_ptr->tval == TV_SHIELD) && (o_ptr->sval == SV_DRAGON_SHIELD)) ||
4006 ((o_ptr->tval == TV_GLOVES) && (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES)) ||
4007 ((o_ptr->tval == TV_BOOTS) && (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE)) ||
4008 ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DIAMOND_EDGE)))
4010 if (level > 65) level = 35 + (level - 65) / 5;
4011 else if (level > 35) level = 25 + (level - 35) / 3;
4012 else if (level > 15) level = 15 + (level - 15) / 2;
4013 exp = MIN(100000L, value) / 2 * level * level;
4014 if (value > 100000L)
4015 exp += (value - 100000L) / 8 * level * level;
4019 exp = MIN(100000L, value) * level;
4020 if (value > 100000L)
4021 exp += (value - 100000L) / 4 * level;
4023 if ((((i == INVEN_RARM) || (i == INVEN_LARM)) && (has_melee_weapon(i))) || (i == INVEN_BOW)) total_exp += exp / 48;
4024 else total_exp += exp / 16;
4025 if (i == INVEN_BODY) total_exp += exp / 32;
4027 p_ptr->exp = p_ptr->max_exp = total_exp;
4029 /* Check Experience */
4037 void lose_exp(s32b amount)
4039 if (p_ptr->prace == RACE_ANDROID) return;
4041 /* Never drop below zero experience */
4042 if (amount > p_ptr->exp) amount = p_ptr->exp;
4044 /* Lose some experience */
4045 p_ptr->exp -= amount;
4047 /* Check Experience */
4054 * If resisted to draining, return FALSE
4056 bool drain_exp(s32b drain, s32b slip, int hold_exp_prob)
4058 /* Androids and their mimics are never drained */
4059 if (p_ptr->prace == RACE_ANDROID) return FALSE;
4061 if (p_ptr->hold_exp && (randint0(100) < hold_exp_prob))
4063 /* Hold experience */
4064 msg_print(_("しかし自己の経験値を守りきった!", "You keep hold of your experience!"));
4068 /* Hold experience failed */
4069 if (p_ptr->hold_exp)
4071 msg_print(_("経験値を少し吸い取られた気がする!", "You feel your experience slipping away!"));
4076 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away!"));
4084 bool set_ultimate_res(TIME_EFFECT v, bool do_dec)
4086 bool notice = FALSE;
4087 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
4089 if (p_ptr->is_dead) return FALSE;
4094 if (p_ptr->ult_res && !do_dec)
4096 if (p_ptr->ult_res > v) return FALSE;
4098 else if (!p_ptr->ult_res)
4100 msg_print(_("あらゆることに対して耐性がついた気がする!", "You feel resistant!"));
4110 msg_print(_("あらゆることに対する耐性が薄れた気がする。", "You feel less resistant"));
4117 p_ptr->redraw |= (PR_STATUS);
4119 /* Nothing to notice */
4120 if (!notice) return (FALSE);
4122 if (disturb_state) disturb(FALSE, FALSE);
4123 p_ptr->update |= (PU_BONUS);
4128 bool set_tim_res_nether(TIME_EFFECT v, bool do_dec)
4130 bool notice = FALSE;
4131 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
4133 if (p_ptr->is_dead) return FALSE;
4138 if (p_ptr->tim_res_nether && !do_dec)
4140 if (p_ptr->tim_res_nether > v) return FALSE;
4142 else if (!p_ptr->tim_res_nether)
4144 msg_print(_("地獄の力に対して耐性がついた気がする!", "You feel nether resistant!"));
4152 if (p_ptr->tim_res_nether)
4154 msg_print(_("地獄の力に対する耐性が薄れた気がする。", "You feel less nether resistant"));
4160 p_ptr->tim_res_nether = v;
4161 p_ptr->redraw |= (PR_STATUS);
4163 /* Nothing to notice */
4164 if (!notice) return (FALSE);
4166 if (disturb_state) disturb(FALSE, FALSE);
4167 p_ptr->update |= (PU_BONUS);
4172 bool set_tim_res_time(TIME_EFFECT v, bool do_dec)
4174 bool notice = FALSE;
4175 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
4177 if (p_ptr->is_dead) return FALSE;
4182 if (p_ptr->tim_res_time && !do_dec)
4184 if (p_ptr->tim_res_time > v) return FALSE;
4186 else if (!p_ptr->tim_res_time)
4188 msg_print(_("時間逆転の力に対して耐性がついた気がする!", "You feel time resistant!"));
4196 if (p_ptr->tim_res_time)
4198 msg_print(_("時間逆転の力に対する耐性が薄れた気がする。", "You feel less time resistant"));
4204 p_ptr->tim_res_time = v;
4205 p_ptr->redraw |= (PR_STATUS);
4207 /* Nothing to notice */
4208 if (!notice) return (FALSE);
4210 if (disturb_state) disturb(FALSE, FALSE);
4211 p_ptr->update |= (PU_BONUS);
4218 * Choose a warrior-mage elemental attack. -LM-
4220 bool choose_ele_attack(void)
4226 if (!has_melee_weapon(INVEN_RARM) && !has_melee_weapon(INVEN_LARM))
4228 msg_format(_("武器を持たないと魔法剣は使えない。", "You cannot use temporary branding with no weapon."));
4233 num = (p_ptr->lev - 20) / 5;
4234 c_prt(TERM_RED, _(" a) 焼棄", " a) Fire Brand"), 2, 14);
4237 c_prt(TERM_L_WHITE,_(" b) 凍結", " b) Cold Brand"), 3, 14);
4242 c_prt(TERM_GREEN, _(" c) 毒殺", " c) Poison Brand"), 4, 14);
4247 c_prt(TERM_L_DARK, _(" d) 溶解", " d) Acid Brand"), 5, 14);
4252 c_prt(TERM_BLUE, _(" e) 電撃", " e) Elec Brand"), 6, 14);
4261 prt(_(" どの元素攻撃をしますか?", " Choose a temporary elemental brand "), 1, 14);
4265 if ((choice == 'a') || (choice == 'A'))
4266 set_ele_attack(ATTACK_FIRE, p_ptr->lev/2 + randint1(p_ptr->lev/2));
4267 else if (((choice == 'b') || (choice == 'B')) && (num >= 2))
4268 set_ele_attack(ATTACK_COLD, p_ptr->lev/2 + randint1(p_ptr->lev/2));
4269 else if (((choice == 'c') || (choice == 'C')) && (num >= 3))
4270 set_ele_attack(ATTACK_POIS, p_ptr->lev/2 + randint1(p_ptr->lev/2));
4271 else if (((choice == 'd') || (choice == 'D')) && (num >= 4))
4272 set_ele_attack(ATTACK_ACID, p_ptr->lev/2 + randint1(p_ptr->lev/2));
4273 else if (((choice == 'e') || (choice == 'E')) && (num >= 5))
4274 set_ele_attack(ATTACK_ELEC, p_ptr->lev/2 + randint1(p_ptr->lev/2));
4277 msg_print(_("魔法剣を使うのをやめた。", "You cancel the temporary branding."));
4287 * Choose a elemental immune. -LM-
4289 bool choose_ele_immune(TIME_EFFECT immune_turn)
4294 c_prt(TERM_RED, _(" a) 火炎", " a) Immune Fire"), 2, 14);
4295 c_prt(TERM_L_WHITE,_(" b) 冷気", " b) Immune Cold"), 3, 14);
4296 c_prt(TERM_L_DARK, _(" c) 酸", " c) Immune Acid"), 4, 14);
4297 c_prt(TERM_BLUE, _(" d) 電撃", " d) Immune Elec"), 5, 14);
4305 prt(_(" どの元素の免疫をつけますか?", " Choose a temporary elemental immune "), 1, 14);
4309 if ((choice == 'a') || (choice == 'A'))
4310 set_ele_immune(DEFENSE_FIRE, immune_turn);
4311 else if ((choice == 'b') || (choice == 'B'))
4312 set_ele_immune(DEFENSE_COLD, immune_turn);
4313 else if ((choice == 'c') || (choice == 'C'))
4314 set_ele_immune(DEFENSE_ACID, immune_turn);
4315 else if ((choice == 'd') || (choice == 'D'))
4316 set_ele_immune(DEFENSE_ELEC, immune_turn);
4319 msg_print(_("免疫を付けるのをやめた。", "You cancel the temporary immune."));