#ifndef ITEMS_H
#define ITEMS_H

#include <game.h>

#define DAGGER_OF_DARKNESS *game_at(&g, (struct point){8,3}) = (struct object)\
	{\
		.type = ITEM,\
		.symbol = 'T',\
		.u.i = {"Dagger of Darkness", EQUIP, {{0, 2, 0}}}\
	};

#define HP_POTION (struct item)\
	{\
		.o.type = ITEM,\
		.o.symbol = 'p',\
		.name = "HP Potion", .type = USE, .u = {.u.restorehp = 10}\
	};
	
static inline void spawn_item(struct game *g)
{
	while(true)
	{
		struct point p = {randrange(0, g->ys), randrange(0, g->xs)};
		if(in_bounds(g, p) && game_at(g, p)->u->ground.type == NOOBJ) {
			game_at(g, p)->u->it = HP_POTION;
			break;
		}
	}
}

#endif //ITEMS_H
