]> git.lizzy.rs Git - dungeon_game.git/blobdiff - plugins/sword/sword.c
Add charged hits
[dungeon_game.git] / plugins / sword / sword.c
index f3991506b2a75aee55354f00d566107e0d221618..653692fcf58950a8d66f312f1a77d056d8fce8ea 100644 (file)
@@ -3,6 +3,7 @@
 #include "../game/game.h"
 #include "../movement/movement.h"
 #include "../inventory/inventory.h"
+#include "../recharge/recharge.h"
 
 static bool use_broken_sword(struct itemstack *stack)
 {
@@ -22,6 +23,9 @@ static struct item broken_sword = {
 
 static bool use_sword(struct itemstack *stack)
 {
+       if (! is_charged())
+               return false;
+
        int x, y;
        x = player.x;
        y = player.y;
@@ -35,6 +39,8 @@ static bool use_sword(struct itemstack *stack)
 
                if (rand() % 100 == 0)
                        stack->item = &broken_sword;
+
+               recharge(1.0, "⚔ ");
        }
 
        return false;