From f0f4bfabab3212a0e2acb3a980cf166fa977a01f Mon Sep 17 00:00:00 2001 From: Hourier <66951241+Hourier@users.noreply.github.com> Date: Sat, 25 Sep 2021 22:51:16 +0900 Subject: [PATCH] =?utf8?q?[Feature]=20#1644=20=E6=96=B0=E4=BB=95=E6=A7=98?= =?utf8?q?=E3=81=AB=E3=81=8A=E3=81=91=E3=82=8B=E3=80=8C=E3=81=B2=E3=81=A9?= =?utf8?q?=E3=81=8F=E6=9C=A6=E6=9C=A7=E3=80=8D=E4=BB=A5=E4=B8=8A=E3=81=AE?= =?utf8?q?=E6=9C=A6=E6=9C=A7=E7=8A=B6=E6=85=8B=E3=81=AB=E9=99=A5=E3=81=A3?= =?utf8?q?=E3=81=9F=E9=9A=9B=E3=81=AB=E9=AD=94=E6=B3=95=E6=A3=92=E3=82=92?= =?utf8?q?=E6=8C=AF=E3=82=8C=E3=82=8B=E7=A2=BA=E7=8E=87=E3=81=B8=E5=A4=B1?= =?utf8?q?=E7=8E=87=E3=82=92=E8=BF=BD=E5=8A=A0=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/object-use/zapwand-execution.cpp | 17 +++++++++++++---- src/object-use/zapwand-execution.h | 2 ++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/object-use/zapwand-execution.cpp b/src/object-use/zapwand-execution.cpp index 78a5c04e0..2ab01dcaf 100644 --- a/src/object-use/zapwand-execution.cpp +++ b/src/object-use/zapwand-execution.cpp @@ -10,6 +10,7 @@ #include "main/sound-definitions-table.h" #include "main/sound-of-music.h" #include "object-enchant/special-object-flags.h" +#include "object-use/item-use-checker.h" #include "object/object-info.h" #include "object/object-kind.h" #include "perception/object-perception.h" @@ -54,6 +55,9 @@ void ObjectZapWandEntity::execute(INVENTORY_IDX item) target_pet = old_target_pet; PlayerEnergy(this->player_ptr).set_player_turn_energy(100); + if (!this->check_can_zap()) { + return; + } auto lev = k_info[o_ptr->k_idx].level; if (lev > 50) { @@ -70,10 +74,6 @@ void ObjectZapWandEntity::execute(INVENTORY_IDX item) chance = USE_DEVICE; } - if (cmd_limit_time_walk(this->player_ptr)) { - return; - } - if ((chance < USE_DEVICE) || (randint1(chance) < USE_DEVICE) || (this->player_ptr->pclass == CLASS_BERSERKER)) { if (flush_failure) { flush(); @@ -128,3 +128,12 @@ void ObjectZapWandEntity::execute(INVENTORY_IDX item) floor_item_charges(this->player_ptr->current_floor_ptr, 0 - item); } + +bool ObjectZapWandEntity::check_can_zap() const +{ + if (cmd_limit_time_walk(this->player_ptr)) { + return false; + } + + return ItemUseChecker(this->player_ptr).check_stun(_("朦朧としていて魔法棒を振れなかった!", "You were not able to zap it by the stun!")); +} diff --git a/src/object-use/zapwand-execution.h b/src/object-use/zapwand-execution.h index 6743e5003..9494858ee 100644 --- a/src/object-use/zapwand-execution.h +++ b/src/object-use/zapwand-execution.h @@ -12,4 +12,6 @@ public: private: player_type *player_ptr; + + bool check_can_zap() const; }; -- 2.11.0