From: Hourier <66951241+Hourier@users.noreply.github.com> Date: Sat, 25 Sep 2021 13:51:16 +0000 (+0900) Subject: [Feature] #1644 新仕様における「ひどく朦朧」以上の朦朧状態に陥った際に魔法棒を振れる確率へ失率を追加した X-Git-Tag: vmacos3.0.0-alpha52~70^2^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=f0f4bfabab3212a0e2acb3a980cf166fa977a01f;p=hengbandforosx%2Fhengbandosx.git [Feature] #1644 新仕様における「ひどく朦朧」以上の朦朧状態に陥った際に魔法棒を振れる確率へ失率を追加した --- 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; };