diff options
Diffstat (limited to 'plugins/sword')
-rw-r--r-- | plugins/sword/Makefile | 2 | ||||
-rw-r--r-- | plugins/sword/dependencies.txt | 1 | ||||
-rw-r--r-- | plugins/sword/sword.c | 6 |
3 files changed, 8 insertions, 1 deletions
diff --git a/plugins/sword/Makefile b/plugins/sword/Makefile index ee28952..034ba74 100644 --- a/plugins/sword/Makefile +++ b/plugins/sword/Makefile @@ -1,4 +1,4 @@ -plugins/sword/sword.so: plugins/sword/sword.c plugins/game/game.h plugins/movement/movement.h plugins/inventory/inventory.h +plugins/sword/sword.so: plugins/sword/sword.c plugins/game/game.h plugins/movement/movement.h plugins/inventory/inventory.h plugins/recharge/recharge.h cc -g -shared -fpic -o plugins/sword/sword.so plugins/sword/sword.c PLUGINS := ${PLUGINS} plugins/sword/sword.so diff --git a/plugins/sword/dependencies.txt b/plugins/sword/dependencies.txt index b19003b..ad140f4 100644 --- a/plugins/sword/dependencies.txt +++ b/plugins/sword/dependencies.txt @@ -1,3 +1,4 @@ game movement inventory +recharge diff --git a/plugins/sword/sword.c b/plugins/sword/sword.c index f399150..653692f 100644 --- a/plugins/sword/sword.c +++ b/plugins/sword/sword.c @@ -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; |