#ifndef ENCOUNTERS_H
#define ENCOUNTERS_H
#include "pixelGameEngine.h"
using namespace olc;
#include "defines.h"
#include "object.h"
#include "battle.h"
#include "item.h"
#include "entity.h"

extern std::vector<Item*> PARTY_INVENTORY;

namespace encounter{
    enum{
        ENCOUNTER_1,
        ENCOUNTER_2,
        ENCOUNTER_3,
        ENCOUNTER_4,
    };
}

class Encounter{
	public:
		vd2d pos;
		int chance; //Chance of the encounter existing.
		std::vector<Entity*>objs;
		std::array<vd2d,4> playerPos;
		int id;
		Encounter(int id,vd2d pos,std::array<vd2d,4> playerPos,std::vector<Entity*>objs,int chance=25)
		:id(id),pos(pos),objs(objs),chance(chance),playerPos(playerPos){}
		bool IsEncounterAlive() {
			for (int i=0;i<objs.size();i++) {
				if (objs[i]->GetHP()>0) {
					return true;
				}
			}
			return false;
		}
		bool IsInRange(vd2d pos) {
			vd2d diff=pos-this->pos;
			return diff.x>=0&&diff.x<=WIDTH&&diff.y>=0&&diff.y<=HEIGHT;
		}
};
#endif