OSDN Git Service

[Feature] #1644 新仕様における「ひどく朦朧」以上の朦朧状態に陥った際に魔法棒を振れる確率へ失率を追加した
authorHourier <66951241+Hourier@users.noreply.github.com>
Sat, 25 Sep 2021 13:51:16 +0000 (22:51 +0900)
committerHourier <66951241+Hourier@users.noreply.github.com>
Wed, 29 Sep 2021 13:39:15 +0000 (22:39 +0900)
src/object-use/zapwand-execution.cpp
src/object-use/zapwand-execution.h

index 78a5c04..2ab01dc 100644 (file)
@@ -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!"));
+}
index 6743e50..9494858 100644 (file)
@@ -12,4 +12,6 @@ public:
 
 private:
     player_type *player_ptr;
+
+    bool check_can_zap() const;
 };