X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Feffects.c;h=8f7a04d85c0ae707c3c7ac93cd59eead76972f6a;hb=e70ba712cf4b753e7d3876f60980c87cfeec09e3;hp=34a174fbb3664c52453b1694201cb2f7e1e0e824;hpb=0d04cbe43ee9723aa0e02ed50f60ff03e67e200c;p=hengband%2Fhengband.git diff --git a/src/effects.c b/src/effects.c index 34a174fbb..8f7a04d85 100644 --- a/src/effects.c +++ b/src/effects.c @@ -12,7 +12,6 @@ * 2013 Deskull rearranged comment for Doxygen.\n */ - #include "angband.h" /*! @@ -21,7 +20,7 @@ * #ACTION_NONE / #ACTION_SEARCH / #ACTION_REST / #ACTION_LEARN / #ACTION_FISH / #ACTION_KAMAE / #ACTION_KATA / #ACTION_SING / #ACTION_HAYAGAKE / #ACTION_SPELL から選択。 * @return なし */ -void set_action(int typ) +void set_action(ACTION_IDX typ) { int prev_typ = p_ptr->action; @@ -117,11 +116,7 @@ void set_action(int typ) break; } } - - /* Recalculate bonuses */ p_ptr->update |= (PU_BONUS); - - /* Redraw the state */ p_ptr->redraw |= (PR_STATE); } @@ -174,7 +169,6 @@ void reset_tim_flags(void) p_ptr->dustrobe = 0; p_ptr->action = ACTION_NONE; - p_ptr->oppose_acid = 0; /* Timed -- oppose acid */ p_ptr->oppose_elec = 0; /* Timed -- oppose lightning */ p_ptr->oppose_fire = 0; /* Timed -- oppose heat */ @@ -206,8 +200,8 @@ void reset_tim_flags(void) if (p_ptr->pclass == CLASS_BARD) { - p_ptr->magic_num1[0] = 0; - p_ptr->magic_num2[0] = 0; + SINGING_SONG_EFFECT(p_ptr) = 0; + SINGING_SONG_ID(p_ptr) = 0; } } @@ -268,23 +262,14 @@ void dispel_player(void) if (music_singing_any() || hex_spelling_any()) { cptr str = (music_singing_any()) ? _("歌", "singing") : _("呪文", "spelling"); - p_ptr->magic_num1[1] = p_ptr->magic_num1[0]; - p_ptr->magic_num1[0] = 0; + INTERUPTING_SONG_EFFECT(p_ptr) = SINGING_SONG_EFFECT(p_ptr); + SINGING_SONG_EFFECT(p_ptr) = MUSIC_NONE; msg_format(_("%sが途切れた。", "Your %s is interrupted."), str); - p_ptr->action = ACTION_NONE; - - /* Recalculate bonuses */ - p_ptr->update |= (PU_BONUS | PU_HP); - /* Redraw map */ + p_ptr->action = ACTION_NONE; + p_ptr->update |= (PU_BONUS | PU_HP | PU_MONSTERS); p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE); - - /* Update monsters */ - p_ptr->update |= (PU_MONSTERS); - - /* Window stuff */ p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON); - p_ptr->energy_need += ENERGY_NEED(); } } @@ -297,7 +282,7 @@ void dispel_player(void) * @param do_dec 現在の継続時間より長い値のみ上書きする * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。 */ -bool set_mimic(TIME_EFFECT v, int p, bool do_dec) +bool set_mimic(TIME_EFFECT v, IDX p, bool do_dec) { bool notice = FALSE; @@ -316,7 +301,7 @@ bool set_mimic(TIME_EFFECT v, int p, bool do_dec) else if ((!p_ptr->tim_mimic) || (p_ptr->mimic_form != p)) { msg_print(_("自分の体が変わってゆくのを感じた。", "You feel that your body changes.")); - p_ptr->mimic_form=p; + p_ptr->mimic_form = p; notice = TRUE; } } @@ -341,18 +326,13 @@ bool set_mimic(TIME_EFFECT v, int p, bool do_dec) if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 1); + if (disturb_state) disturb(FALSE, TRUE); /* Redraw title */ p_ptr->redraw |= (PR_BASIC | PR_STATUS); - - /* Recalculate bonuses */ p_ptr->update |= (PU_BONUS | PU_HP); handle_stuff(); - - /* Result */ return (TRUE); } @@ -421,22 +401,15 @@ bool set_blind(TIME_EFFECT v) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); + if (disturb_state) disturb(FALSE, FALSE); /* Fully update the visuals */ p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE); - /* Redraw map */ p_ptr->redraw |= (PR_MAP); - /* Window stuff */ p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -521,13 +494,8 @@ bool set_confused(TIME_EFFECT v) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Handle stuff */ + if (disturb_state) disturb(FALSE, FALSE); handle_stuff(); - - /* Result */ return (TRUE); } @@ -575,13 +543,8 @@ bool set_poisoned(TIME_EFFECT v) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Handle stuff */ + if (disturb_state) disturb(FALSE, FALSE); handle_stuff(); - - /* Result */ return (TRUE); } @@ -643,13 +606,8 @@ bool set_afraid(TIME_EFFECT v) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Handle stuff */ + if (disturb_state) disturb(FALSE, FALSE); handle_stuff(); - - /* Result */ return (TRUE); } @@ -703,16 +661,9 @@ bool set_paralyzed(TIME_EFFECT v) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Redraw the state */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->redraw |= (PR_STATE); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -767,25 +718,16 @@ bool set_image(TIME_EFFECT v) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 1); + if (disturb_state) disturb(FALSE, TRUE); - /* Redraw map */ p_ptr->redraw |= (PR_MAP); /* Update the health bar */ p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH); - - /* Update monsters */ p_ptr->update |= (PU_MONSTERS); - /* Window stuff */ p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -836,16 +778,9 @@ bool set_fast(TIME_EFFECT v, bool do_dec) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Recalculate bonuses */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->update |= (PU_BONUS); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -898,16 +833,9 @@ bool set_lightspeed(TIME_EFFECT v, bool do_dec) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Recalculate bonuses */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->update |= (PU_BONUS); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -956,16 +884,9 @@ bool set_slow(TIME_EFFECT v, bool do_dec) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Recalculate bonuses */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->update |= (PU_BONUS); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -1018,16 +939,9 @@ bool set_shield(TIME_EFFECT v, bool do_dec) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Recalculate bonuses */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->update |= (PU_BONUS); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -1080,16 +994,9 @@ bool set_tsubureru(TIME_EFFECT v, bool do_dec) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Recalculate bonuses */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->update |= (PU_BONUS); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -1142,16 +1049,9 @@ bool set_magicdef(TIME_EFFECT v, bool do_dec) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Recalculate bonuses */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->update |= (PU_BONUS); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -1203,16 +1103,9 @@ bool set_blessed(TIME_EFFECT v, bool do_dec) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Recalculate bonuses */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->update |= (PU_BONUS); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -1265,26 +1158,19 @@ bool set_hero(TIME_EFFECT v, bool do_dec) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Recalculate bonuses */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->update |= (PU_BONUS); /* Recalculate hitpoints */ p_ptr->update |= (PU_HP); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } /*! * @brief 狂戦士化の継続時間をセットする / Set "p_ptr->shero", notice observable changes - * @param v 継続時間 - * @param do_dec 現在の継続時間より長い値のみ上書きする + * @param v 継続時間/ 0ならば無条件にリセット + * @param do_dec FALSEの場合現在の継続時間より長い値のみ上書きする * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。 */ bool set_shero(TIME_EFFECT v, bool do_dec) @@ -1330,19 +1216,12 @@ bool set_shero(TIME_EFFECT v, bool do_dec) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Recalculate bonuses */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->update |= (PU_BONUS); /* Recalculate hitpoints */ p_ptr->update |= (PU_HP); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -1394,13 +1273,8 @@ bool set_protevil(TIME_EFFECT v, bool do_dec) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Handle stuff */ + if (disturb_state) disturb(FALSE, FALSE); handle_stuff(); - - /* Result */ return (TRUE); } @@ -1435,13 +1309,9 @@ bool set_wraith_form(TIME_EFFECT v, bool do_dec) chg_virtue(V_SACRIFICE, -2); chg_virtue(V_VALOUR, -5); - /* Redraw map */ p_ptr->redraw |= (PR_MAP); - - /* Update monsters */ p_ptr->update |= (PU_MONSTERS); - /* Window stuff */ p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON); } } @@ -1454,13 +1324,9 @@ bool set_wraith_form(TIME_EFFECT v, bool do_dec) msg_print(_("不透明になった感じがする。", "You feel opaque.")); notice = TRUE; - /* Redraw map */ p_ptr->redraw |= (PR_MAP); - - /* Update monsters */ p_ptr->update |= (PU_MONSTERS); - /* Window stuff */ p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON); } } @@ -1474,16 +1340,9 @@ bool set_wraith_form(TIME_EFFECT v, bool do_dec) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Recalculate bonuses */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->update |= (PU_BONUS); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -1520,13 +1379,9 @@ bool set_invuln(TIME_EFFECT v, bool do_dec) chg_virtue(V_SACRIFICE, -3); chg_virtue(V_VALOUR, -5); - /* Redraw map */ p_ptr->redraw |= (PR_MAP); - - /* Update monsters */ p_ptr->update |= (PU_MONSTERS); - /* Window stuff */ p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON); } } @@ -1539,13 +1394,9 @@ bool set_invuln(TIME_EFFECT v, bool do_dec) msg_print(_("無敵ではなくなった。", "The invulnerability wears off.")); notice = TRUE; - /* Redraw map */ p_ptr->redraw |= (PR_MAP); - - /* Update monsters */ p_ptr->update |= (PU_MONSTERS); - /* Window stuff */ p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON); p_ptr->energy_need += ENERGY_NEED(); @@ -1561,16 +1412,9 @@ bool set_invuln(TIME_EFFECT v, bool do_dec) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Recalculate bonuses */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->update |= (PU_BONUS); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -1622,19 +1466,10 @@ bool set_tim_esp(TIME_EFFECT v, bool do_dec) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Recalculate bonuses */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->update |= (PU_BONUS); - - /* Update the monsters */ p_ptr->update |= (PU_MONSTERS); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -1686,19 +1521,12 @@ bool set_tim_invis(TIME_EFFECT v, bool do_dec) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Recalculate bonuses */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->update |= (PU_BONUS); /* Update the monsters */ p_ptr->update |= (PU_MONSTERS); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -1750,19 +1578,12 @@ bool set_tim_infra(TIME_EFFECT v, bool do_dec) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Recalculate bonuses */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->update |= (PU_BONUS); /* Update the monsters */ p_ptr->update |= (PU_MONSTERS); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -1814,16 +1635,9 @@ bool set_tim_regen(TIME_EFFECT v, bool do_dec) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Recalculate bonuses */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->update |= (PU_BONUS); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -1875,16 +1689,9 @@ bool set_tim_stealth(TIME_EFFECT v, bool do_dec) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Recalculate bonuses */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->update |= (PU_BONUS); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -1941,10 +1748,7 @@ bool set_superstealth(bool set) /* Redraw status bar */ p_ptr->redraw |= (PR_STATUS); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Result */ + if (disturb_state) disturb(FALSE, FALSE); return (TRUE); } @@ -1996,16 +1800,9 @@ bool set_tim_levitation(TIME_EFFECT v, bool do_dec) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Recalculate bonuses */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->update |= (PU_BONUS); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -2057,13 +1854,8 @@ bool set_tim_sh_touki(TIME_EFFECT v, bool do_dec) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Handle stuff */ + if (disturb_state) disturb(FALSE, FALSE); handle_stuff(); - - /* Result */ return (TRUE); } @@ -2115,16 +1907,9 @@ bool set_tim_sh_fire(TIME_EFFECT v, bool do_dec) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Recalculate bonuses */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->update |= (PU_BONUS); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -2176,16 +1961,9 @@ bool set_tim_sh_holy(TIME_EFFECT v, bool do_dec) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Recalculate bonuses */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->update |= (PU_BONUS); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -2237,16 +2015,9 @@ bool set_tim_eyeeye(TIME_EFFECT v, bool do_dec) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Recalculate bonuses */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->update |= (PU_BONUS); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -2299,16 +2070,9 @@ bool set_resist_magic(TIME_EFFECT v, bool do_dec) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Recalculate bonuses */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->update |= (PU_BONUS); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -2360,16 +2124,9 @@ bool set_tim_reflect(TIME_EFFECT v, bool do_dec) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Recalculate bonuses */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->update |= (PU_BONUS); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -2419,16 +2176,9 @@ bool set_multishadow(TIME_EFFECT v, bool do_dec) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Recalculate bonuses */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->update |= (PU_BONUS); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -2480,16 +2230,9 @@ bool set_dustrobe(TIME_EFFECT v, bool do_dec) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Recalculate bonuses */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->update |= (PU_BONUS); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -2541,16 +2284,9 @@ bool set_kabenuke(TIME_EFFECT v, bool do_dec) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Recalculate bonuses */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->update |= (PU_BONUS); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -2608,19 +2344,12 @@ bool set_tsuyoshi(TIME_EFFECT v, bool do_dec) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Recalculate bonuses */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->update |= (PU_BONUS); /* Recalculate hitpoints */ p_ptr->update |= (PU_HP); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -2690,15 +2419,12 @@ bool set_ele_attack(u32b attack_type, TIME_EFFECT v) #endif } - /* Disturb */ - if (disturb_state) disturb(0, 0); + if (disturb_state) disturb(FALSE, FALSE); /* Redraw status bar */ p_ptr->redraw |= (PR_STATUS); p_ptr->update |= (PU_BONUS); - - /* Handle stuff */ handle_stuff(); return (TRUE); @@ -2770,15 +2496,12 @@ bool set_ele_immune(u32b immune_type, TIME_EFFECT v) #endif } - /* Disturb */ - if (disturb_state) disturb(0, 0); + if (disturb_state) disturb(FALSE, FALSE); /* Redraw status bar */ p_ptr->redraw |= (PR_STATUS); p_ptr->update |= (PU_BONUS); - - /* Handle stuff */ handle_stuff(); return (TRUE); @@ -2832,13 +2555,8 @@ bool set_oppose_acid(TIME_EFFECT v, bool do_dec) /* Redraw status bar */ p_ptr->redraw |= (PR_STATUS); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Handle stuff */ + if (disturb_state) disturb(FALSE, FALSE); handle_stuff(); - - /* Result */ return (TRUE); } @@ -2890,13 +2608,8 @@ bool set_oppose_elec(TIME_EFFECT v, bool do_dec) /* Redraw status bar */ p_ptr->redraw |= (PR_STATUS); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Handle stuff */ + if (disturb_state) disturb(FALSE, FALSE); handle_stuff(); - - /* Result */ return (TRUE); } @@ -2949,13 +2662,8 @@ bool set_oppose_fire(TIME_EFFECT v, bool do_dec) /* Redraw status bar */ p_ptr->redraw |= (PR_STATUS); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Handle stuff */ + if (disturb_state) disturb(FALSE, FALSE); handle_stuff(); - - /* Result */ return (TRUE); } @@ -3007,13 +2715,8 @@ bool set_oppose_cold(TIME_EFFECT v, bool do_dec) /* Redraw status bar */ p_ptr->redraw |= (PR_STATUS); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Handle stuff */ + if (disturb_state) disturb(FALSE, FALSE); handle_stuff(); - - /* Result */ return (TRUE); } @@ -3066,13 +2769,8 @@ bool set_oppose_pois(TIME_EFFECT v, bool do_dec) /* Redraw status bar */ p_ptr->redraw |= (PR_STATUS); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Handle stuff */ + if (disturb_state) disturb(FALSE, FALSE); handle_stuff(); - - /* Result */ return (TRUE); } @@ -3195,7 +2893,6 @@ bool set_stun(TIME_EFFECT v) /* Hex */ if (hex_spelling_any()) stop_hex_spell_all(); - /* Notice */ notice = TRUE; } @@ -3206,14 +2903,13 @@ bool set_stun(TIME_EFFECT v) switch (new_aux) { /* None */ - case 0: + case 0: msg_print(_("やっと朦朧状態から回復した。", "You are no longer stunned.")); - if (disturb_state) disturb(0, 0); + if (disturb_state) disturb(FALSE, FALSE); break; } - /* Notice */ notice = TRUE; } @@ -3223,19 +2919,12 @@ bool set_stun(TIME_EFFECT v) /* No change */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Recalculate bonuses */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->update |= (PU_BONUS); /* Redraw the "stun" */ p_ptr->redraw |= (PR_STUN); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -3388,7 +3077,6 @@ bool set_cut(TIME_EFFECT v) case 7: msg_print(_("致命的な傷を負ってしまった。", "You have been given a mortal wound.")); break; } - /* Notice */ notice = TRUE; if (randint1(1000) < v || one_in_(16)) @@ -3411,11 +3099,10 @@ bool set_cut(TIME_EFFECT v) case 0: msg_format(_("やっと%s。", "You are no longer bleeding."), p_ptr->prace == RACE_ANDROID ? "怪我が直った" : "出血が止まった"); - if (disturb_state) disturb(0, 0); + if (disturb_state) disturb(FALSE, FALSE); break; } - /* Notice */ notice = TRUE; } @@ -3425,19 +3112,12 @@ bool set_cut(TIME_EFFECT v) /* No change */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Recalculate bonuses */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->update |= (PU_BONUS); /* Redraw the "cut" */ p_ptr->redraw |= (PR_CUT); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -3453,7 +3133,7 @@ bool set_cut(TIME_EFFECT v) * 7500 food units, without overflowing the 32767 maximum limit.\n *\n * Perhaps we should disturb the player with various messages, - * especially messages about hunger status changes. XXX XXX XXX\n + * especially messages about hunger status changes. \n *\n * Digestion of food is handled in "dungeon.c", in which, normally, * the player digests about 20 food units per 100 game turns, more @@ -3626,19 +3306,12 @@ bool set_food(TIME_EFFECT v) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Recalculate bonuses */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->update |= (PU_BONUS); /* Redraw hunger */ p_ptr->redraw |= (PR_HUNGER); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -3697,8 +3370,6 @@ bool inc_stat(int stat) { p_ptr->stat_max[stat] = value; } - - /* Recalculate bonuses */ p_ptr->update |= (PU_BONUS); /* Success */ @@ -3728,7 +3399,9 @@ bool inc_stat(int stat) */ bool dec_stat(int stat, int amount, int permanent) { - int cur, max, loss, same, res = FALSE; + BASE_STATUS cur, max; + int loss, same; + bool res = FALSE; /* Acquire current value */ @@ -3830,12 +3503,9 @@ bool dec_stat(int stat, int amount, int permanent) /* Redisplay the stats later */ p_ptr->redraw |= (PR_STATS); - - /* Recalculate bonuses */ p_ptr->update |= (PU_BONUS); } - /* Done */ return (res); } @@ -3852,8 +3522,6 @@ bool res_stat(int stat) { /* Restore */ p_ptr->stat_cur[stat] = p_ptr->stat_max[stat]; - - /* Recalculate bonuses */ p_ptr->update |= (PU_BONUS); /* Redisplay the stats later */ @@ -3875,7 +3543,10 @@ bool hp_player(int num) { int vir; vir = virtue_number(V_VITALITY); - if (vir) + + if(num <= 0) return (FALSE); + + if(vir) { num = num * (p_ptr->virtues[vir - 1] + 1250) / 1250; } @@ -3894,10 +3565,8 @@ bool hp_player(int num) p_ptr->chp_frac = 0; } - /* Redraw */ p_ptr->redraw |= (PR_HP); - /* Window stuff */ p_ptr->window |= (PW_PLAYER); /* Heal 0-4 */ @@ -3924,7 +3593,6 @@ bool hp_player(int num) msg_print(_("ひじょうに気分が良くなった。", "You feel very good.")); } - /* Notice */ return (TRUE); } @@ -3938,12 +3606,12 @@ bool hp_player(int num) */ static cptr desc_stat_pos[] = { -_("強く", "strong"), -_("知的に", "smart"), -_("賢く", "wise"), -_("器用に", "dextrous"), -_("健康に", "healthy"), -_("美しく", "cute") + _("強く", "strong"), + _("知的に", "smart"), + _("賢く", "wise"), + _("器用に", "dextrous"), + _("健康に", "healthy"), + _("美しく", "cute") }; @@ -3952,22 +3620,12 @@ _("美しく", "cute") */ static cptr desc_stat_neg[] = { -#ifdef JP -"弱く", -"無知に", -"愚かに", -"不器用に", -"不健康に", -"醜く" -#else - "weak", - "stupid", - "naive", - "clumsy", - "sickly", - "ugly" -#endif - + _("弱く", "weak"), + _("無知に", "stupid"), + _("愚かに", "naive"), + _("不器用に", "clumsy"), + _("不健康に", "sickly"), + _("醜く", "ugly") }; @@ -3992,7 +3650,6 @@ bool do_dec_stat(int stat) /* Sustain */ if (sust && (!ironman_nightmare || randint0(13))) { - /* Message */ msg_format(_("%sなった気がしたが、すぐに元に戻った。", "You feel %s for a moment, but the feeling passes."), desc_stat_neg[stat]); @@ -4003,7 +3660,6 @@ bool do_dec_stat(int stat) /* Attempt to reduce the stat */ if (dec_stat(stat, 10, (ironman_nightmare && !randint0(13)))) { - /* Message */ msg_format(_("ひどく%sなった気がする。", "You feel very %s."), desc_stat_neg[stat]); /* Notice effect */ @@ -4023,10 +3679,8 @@ bool do_res_stat(int stat) /* Attempt to increase */ if (res_stat(stat)) { - /* Message */ msg_format(_("元通りに%sなった気がする。", "You feel less %s."), desc_stat_pos[stat]); - /* Notice */ return (TRUE); } @@ -4061,20 +3715,16 @@ bool do_inc_stat(int stat) else if (stat == A_CON) chg_virtue(V_VITALITY, 1); - /* Message */ msg_format(_("ワーオ!とても%sなった!", "Wow! You feel very %s!"), desc_stat_pos[stat]); - /* Notice */ return (TRUE); } /* Restoration worked */ if (res) { - /* Message */ msg_format(_("元通りに%sなった気がする。", "You feel less %s."), desc_stat_pos[stat]); - /* Notice */ return (TRUE); } @@ -4091,7 +3741,6 @@ bool restore_level(void) /* Restore experience */ if (p_ptr->exp < p_ptr->max_exp) { - /* Message */ msg_print(_("経験値が戻ってきた気がする。", "You feel your experience returning.")); /* Restore the experience */ @@ -4108,7 +3757,6 @@ bool restore_level(void) return (FALSE); } - /* * Forget everything */ @@ -4142,14 +3790,11 @@ bool lose_all_info(void) /* Hack -- Clear the "felt" flag */ o_ptr->ident &= ~(IDENT_SENSE); } - - /* Recalculate bonuses */ p_ptr->update |= (PU_BONUS); /* Combine / Reorder the pack (later) */ - p_ptr->notice |= (PN_COMBINE | PN_REORDER); + p_ptr->update |= (PU_COMBINE | PU_REORDER); - /* Window stuff */ p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER); /* Mega-Hack -- Forget the map */ @@ -4188,7 +3833,7 @@ void do_poly_wounds(void) /* * Change player race */ -void change_race(int new_race, cptr effect_msg) +void change_race(CHARACTER_IDX new_race, cptr effect_msg) { cptr title = race_info[new_race].title; int old_race = p_ptr->prace; @@ -4207,7 +3852,7 @@ void change_race(int new_race, cptr effect_msg) } else { - p_ptr->old_race2 |= 1L << (p_ptr->prace-32); + p_ptr->old_race2 |= 1L << (p_ptr->prace - 32); } p_ptr->prace = new_race; rp_ptr = &race_info[p_ptr->prace]; @@ -4260,7 +3905,7 @@ void do_poly_self(void) if ((power > randint0(20)) && one_in_(3) && (p_ptr->prace != RACE_ANDROID)) { char effect_msg[80] = ""; - int new_race; + CHARACTER_IDX new_race; /* Some form of racial polymorph... */ power -= 10; @@ -4291,7 +3936,7 @@ void do_poly_self(void) /* Harmful deformity */ power -= 15; - while (tmp < 6) + while (tmp < A_MAX) { if (one_in_(2)) { @@ -4327,7 +3972,7 @@ void do_poly_self(void) do { - new_race = randint0(MAX_RACES); + new_race = (CHARACTER_IDX)randint0(MAX_RACES); } while ((new_race == p_ptr->prace) || (new_race == RACE_ANDROID)); @@ -4342,7 +3987,7 @@ void do_poly_self(void) power -= 20; msg_format(_("%sの構成が変化した!", "Your internal organs are rearranged!"), p_ptr->prace == RACE_ANDROID ? "機械" : "内臓"); - while (tmp < 6) + while (tmp < A_MAX) { (void)dec_stat(tmp, randint1(6) + 6, one_in_(3)); tmp++; @@ -4388,9 +4033,9 @@ void do_poly_self(void) /* * Decreases players hit points and sets death flag if necessary * - * XXX XXX XXX Invulnerability needs to be changed into a "shield" + * Invulnerability needs to be changed into a "shield" * - * XXX XXX XXX Hack -- this function allows the user to save (or quit) + * Hack -- this function allows the user to save (or quit) * the game when he dies, since the "You die." message is shown before * setting the player to "dead". */ @@ -4400,7 +4045,7 @@ int take_hit(int damage_type, HIT_POINT damage, cptr hit_from, int monspell) int old_chp = p_ptr->chp; char death_message[1024]; - char tmp[80]; + char tmp[1024]; int warning = (p_ptr->mhp * hitpoint_warn / 10); @@ -4414,8 +4059,7 @@ int take_hit(int damage_type, HIT_POINT damage, cptr hit_from, int monspell) if (damage_type != DAMAGE_USELIFE) { - /* Disturb */ - disturb(1, 1); + disturb(TRUE, TRUE); if (auto_more) { now_damaged = TRUE; @@ -4487,7 +4131,6 @@ int take_hit(int damage_type, HIT_POINT damage, cptr hit_from, int monspell) /* Display the hitpoints */ p_ptr->redraw |= (PR_HP); - /* Window stuff */ p_ptr->window |= (PW_PLAYER); if (damage_type != DAMAGE_GENO && p_ptr->chp == 0) @@ -4506,7 +4149,6 @@ int take_hit(int damage_type, HIT_POINT damage, cptr hit_from, int monspell) if(!save_player()) msg_print("セーブ失敗!"); #endif - /* Sound */ sound(SOUND_DEATH); chg_virtue(V_SACRIFICE, 10); @@ -4528,7 +4170,7 @@ int take_hit(int damage_type, HIT_POINT damage, cptr hit_from, int monspell) } else { - int q_idx = quest_number(dun_level); + QUEST_IDX q_idx = quest_number(dun_level); bool seppuku = streq(hit_from, "Seppuku"); bool winning_seppuku = p_ptr->total_winner && seppuku; @@ -4729,7 +4371,6 @@ int take_hit(int damage_type, HIT_POINT damage, cptr hit_from, int monspell) now_damaged = TRUE; } - /* Message */ msg_print(_("*** 警告:低ヒット・ポイント! ***", "*** LOW HITPOINT WARNING! ***")); msg_print(NULL); flush(); @@ -4789,12 +4430,10 @@ void calc_android_exp(void) object_type forge; object_type *q_ptr = &forge; u32b value, exp; - int level = MAX(k_info[o_ptr->k_idx].level - 8, 1); + DEPTH level = MAX(k_info[o_ptr->k_idx].level - 8, 1); if ((i == INVEN_RIGHT) || (i == INVEN_LEFT) || (i == INVEN_NECK) || (i == INVEN_LITE)) continue; if (!o_ptr->k_idx) continue; - - /* Wipe the object */ object_wipe(q_ptr); object_copy(q_ptr, o_ptr); @@ -4964,16 +4603,9 @@ bool set_ultimate_res(TIME_EFFECT v, bool do_dec) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Recalculate bonuses */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->update |= (PU_BONUS); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -5019,16 +4651,9 @@ bool set_tim_res_nether(TIME_EFFECT v, bool do_dec) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Recalculate bonuses */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->update |= (PU_BONUS); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -5074,16 +4699,9 @@ bool set_tim_res_time(TIME_EFFECT v, bool do_dec) /* Nothing to notice */ if (!notice) return (FALSE); - /* Disturb */ - if (disturb_state) disturb(0, 0); - - /* Recalculate bonuses */ + if (disturb_state) disturb(FALSE, FALSE); p_ptr->update |= (PU_BONUS); - - /* Handle stuff */ handle_stuff(); - - /* Result */ return (TRUE); } @@ -5102,8 +4720,6 @@ bool choose_ele_attack(void) msg_format(_("武器を持たないと魔法剣は使えない。", "You cannot use temporary branding with no weapon.")); return FALSE; } - - /* Save screen */ screen_save(); num = (p_ptr->lev - 20) / 5; @@ -5154,7 +4770,6 @@ bool choose_ele_attack(void) screen_load(); return FALSE; } - /* Load screen */ screen_load(); return TRUE; } @@ -5166,8 +4781,6 @@ bool choose_ele_attack(void) bool choose_ele_immune(TIME_EFFECT immune_turn) { char choice; - - /* Save screen */ screen_save(); c_prt(TERM_RED, _(" a) 火炎", " a) Immune Fire"), 2, 14); @@ -5199,7 +4812,7 @@ bool choose_ele_immune(TIME_EFFECT immune_turn) screen_load(); return FALSE; } - /* Load screen */ screen_load(); return TRUE; } +