#pragma once
#include <Utils/Random.h>
#include <iostream>

static const int TILE_SIZE=32;

enum Direction
{
	North=0,
	West,
	South,
	East,
};

enum ObjectType {
	BaseModel,
	Monster,
	Armor,
	Weapon,
	Shield,
	Hat,
	Hair,
	Projectile,
	Obstacle,
	TownBuilding,
	MilitaryBuilding,
	Den,
	System,
	end
};

enum EventType
{
	Timer,
	Revealed,
	Destroyed,
	NthCitizen,
	NthSoldier,
	NthKill,
	NthRaid,
	NthTownBuilding,
	NthCrafting
};

union Stat
{
	Stat();
	Stat(float given_str, float given_dex, float given_acc, float given_spe, float given_intl, float given_vit);

	struct {
		float str;
		float dex;
		float acc;
		float spe;
		float intl;
		float vit;
	};

	float stats[6];
};

static std::ostream &operator <<(std::ostream &out, const Stat &s) {
	out<<"str: "<<int(s.str+0.5)<<", dex: "<<int(s.dex+0.5)<<", acc: "<<int(s.acc+0.5)<<", spe: "<<int(s.spe+0.5)<<", int: "<<int(s.intl+0.5)<<", vit: "<<int(s.vit+0.5)<<std::endl;

	return out;
}

namespace Gender {
	enum Type {
		male,
		female,
		unidentifyable
	};
}


class Range
{
public:
	Range();
	Range(float given_value, float given_range);

	float range;
	float value;

	float random() {
		return value + gge::utils::Random(-range, range);
	}
};

class LevelInfo
{
public:
	LevelInfo();
	LevelInfo(float given_base, float given_increment, float given_multiplier = 0.0f, float given_modifier = 0.0f);
	float calculate(int level) const;

	float base;
	float increment;
	float multiplier;
	float modifier;
};

extern unsigned int currentGameTime;
extern unsigned int inGameTime;

static const int MINUTE=60000;//TODO: will be 60000

static int inGameHour() {
	return (inGameTime / 3600) % 24;
}
static int inGameMinute() {
	return (inGameTime / 60) % 60;
}
static bool isNight() {
	return inGameHour()<7 || inGameHour()>19;
}
