1 #include "mind/mind-magic-resistance.h"
2 #include "core/disturbance.h"
3 #include "core/player-redraw-types.h"
4 #include "core/player-update-types.h"
5 #include "core/stuff-handler.h"
6 #include "game-option/disturbance-options.h"
7 #include "system/player-type-definition.h"
8 #include "system/redrawing-flags-updater.h"
9 #include "view/display-messages.h"
12 * @brief 連奇術師の耐魔法防御 / 鏡使いの水鏡の盾 の継続時間をセットする / Set "resist_magic", notice observable changes
14 * @param do_dec 現在の継続時間より長い値のみ上書きする
15 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
17 bool set_resist_magic(PlayerType *player_ptr, TIME_EFFECT v, bool do_dec)
20 v = (v > 10000) ? 10000 : (v < 0) ? 0
23 if (player_ptr->is_dead) {
28 if (player_ptr->resist_magic && !do_dec) {
29 if (player_ptr->resist_magic > v) {
32 } else if (!player_ptr->resist_magic) {
33 msg_print(_("魔法への耐性がついた。", "You have been protected from magic!"));
37 if (player_ptr->resist_magic) {
38 msg_print(_("魔法に弱くなった。", "You are no longer protected from magic."));
43 player_ptr->resist_magic = v;
44 auto &rfu = RedrawingFlagsUpdater::get_instance();
45 player_ptr->redraw |= (PR_TIMED_EFFECT);
52 disturb(player_ptr, false, false);
55 rfu.set_flag(StatusRedrawingFlag::BONUS);
56 handle_stuff(player_ptr);