3 #include "../game/game.h"
4 #include "../movement/movement.h"
5 #include "../inventory/inventory.h"
7 static bool use_broken_sword(struct itemstack *stack)
14 static struct item broken_sword = {
15 .name = "Broken Sword",
18 .on_use = &use_broken_sword,
23 static bool use_sword(struct itemstack *stack)
29 dir_to_xy(last_player_move, &x, &y);
31 struct entity *entity = entity_collision_map[x][y];
34 add_health(entity, -1);
36 if (rand() % 100 == 0)
37 stack->item = &broken_sword;
43 static struct item sword = {
52 __attribute__((constructor)) static void init()
54 inventory_add(&player_inventory, (struct itemstack) {