#include "../game/game.h"
#include "../score/score.h"
#include "../inventory/inventory.h"
+#include "../loot/loot.h"
static bool use_cherry(struct itemstack *stack)
{
- (void) stack;
-
add_health(&player, 2);
return true;
}
.on_damage = NULL,
};
-static void spawn_cherry(int x, int y)
+static void spawn_cherry(int x, int y, enum mg_context ctx)
{
spawn(cherry_entity, x, y, NULL);
}
__attribute__((constructor)) static void init()
{
register_air_function((struct generator_function) {
- .chance = 100,
+ .corridor_chance = 100,
+ .room_chance = 100,
.callback = &spawn_cherry,
});
+
+ register_loot((struct loot) {
+ .item = &cherry_item,
+ .chance = 2,
+ .min = 3,
+ .max = 10,
+ });
}