generated from sigonasr2/CPlusPlusProjectTemplate
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
962 B
44 lines
962 B
#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 |