Turn order resolution

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent 4bedc95bcb
commit 6087b074b8
  1. 24
      SeasonsOfLoneliness.cpp
  2. BIN
      Seasons_of_Loneliness

@ -133,7 +133,7 @@ class Entity{
this->y=y;
this->hp=hp;
this->maxhp=maxhp;
this->moveSet=moveSet;
this->moveSet=moveset;
}
};
@ -424,18 +424,18 @@ public:
}
for (int i=0;i<CURRENT_ENCOUNTER.entities.size();i++) {
if (CURRENT_ENCOUNTER.entities[i].hp>0&&!CURRENT_ENCOUNTER.entities[i].turnComplete&&
CURRENT_ENCOUNTER.entities[i].selectedMove->name.compare("Seed Storm")) {
CURRENT_ENCOUNTER.entities[i].selectedMove->name.compare("Seed Storm")==0) {
turnOrder.push_back(i);
CURRENT_ENCOUNTER.entities[i].turnComplete=true;
}
}
//Otherwise, every enemy has a chance to go before the player unless they are slowed, then they always go after.
for (int i=0;i<CURRENT_ENCOUNTER.entities.size();i++) {
Entity ent = CURRENT_ENCOUNTER.entities[i];
if (ent.hp>0&&!ent.turnComplete&&
!ent.slowed&&rand()%2==0) {
Entity*ent = &CURRENT_ENCOUNTER.entities[i];
if (ent->hp>0&&!ent->turnComplete&&
!ent->slowed&&rand()%2==0) {
turnOrder.push_back(i);
ent.turnComplete=true;
ent->turnComplete=true;
}
}
if (BATTLE_CARD_SELECTION_IND!=-1) {
@ -444,12 +444,16 @@ public:
}
//Finally, any enemies that haven't gone will now go.
for (int i=0;i<CURRENT_ENCOUNTER.entities.size();i++) {
Entity ent = CURRENT_ENCOUNTER.entities[i];
if (ent.hp>0&&!ent.turnComplete) {
Entity*ent = &CURRENT_ENCOUNTER.entities[i];
if (ent->hp>0&&!ent->turnComplete) {
turnOrder.push_back(i);
ent.turnComplete=true;
ent->turnComplete=true;
}
}
std::cout<<"Turn order:";
for (auto&order:turnOrder) {
std::cout<<order<<",";
}
BATTLE_STATE=battle::PERFORM_TURN;
}break;
}
@ -1003,7 +1007,7 @@ public:
for (auto&enc:ENCOUNTERS) {
int targetX=-1,targetY=-1;
for (auto&ent:enc.entities) {
if (PLAYER_SELECTED_TARGET>=0&&CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET].hp>0&&CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET].x==ent.x&&CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET].y==ent.y) {
if (BATTLE_STATE==battle::PLAYER_TARGET_SELECTION&&PLAYER_SELECTED_TARGET>=0&&CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET].hp>0&&CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET].x==ent.x&&CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET].y==ent.y) {
DrawDecal({(enc.x+ent.x-PLAYER_COORDS[0])*32+WIDTH/2,(enc.y+ent.y-PLAYER_COORDS[1])*32+HEIGHT/2},TARGETING_CIRCLE,{ent.spr->sprite->width/32,ent.spr->sprite->height/32},{255,210,0,255});
DrawDecal({(enc.x+ent.x-PLAYER_COORDS[0])*32+WIDTH/2,(enc.y+ent.y-PLAYER_COORDS[1])*32+HEIGHT/2},ent.spr,{1,1},{(0.5*(float)sin(frameCount*4/60.0)+0.5)*80+175,(0.5*(float)sin(frameCount*4/60.0)+0.5)*80+175,(0.5*(float)sin(frameCount*4/60.0)+0.5)*80+175,255});
targetX=ent.x;targetY=ent.y;

Binary file not shown.
Loading…
Cancel
Save