diff --git a/SeasonsOfLoneliness.cpp b/SeasonsOfLoneliness.cpp index 392883c..475e6e9 100644 --- a/SeasonsOfLoneliness.cpp +++ b/SeasonsOfLoneliness.cpp @@ -3,7 +3,7 @@ #include "data.h" #define OLC_PGEX_SPLASHSCREEN #include "splash.h" -#include +#include using namespace olc; @@ -278,7 +278,7 @@ public: std::vector ENCOUNTERS; Encounter ENCOUNTER_SPIDEY_1; Encounter CURRENT_ENCOUNTER; - std::stack turnOrder; + std::queue turnOrder; bool OnUserCreate() override { @@ -445,19 +445,21 @@ public: } switch (BATTLE_STATE) { case battle::PLAYER_SELECTION:{ - if (WEATHER_POWERS[BATTLE_CARD_SELECTION_IND]->playerOwnCount>0) { + if (BATTLE_CARD_SELECTION->playerOwnCount>0) { BATTLE_STATE=battle::PLAYER_TARGET_SELECTION; - if (WEATHER_POWERS[BATTLE_CARD_SELECTION_IND]->name.compare("MEAL")==0||WEATHER_POWERS[BATTLE_CARD_SELECTION_IND]->name.compare("SNACK")==0) { - setupBattleTurns(); - } else - if (PLAYER_SELECTED_TARGET==-1||CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET]->hp<=0) { - for (int i=0;ially&&ent->hp>0) { - PLAYER_SELECTED_TARGET=i; - break; + if (!(BATTLE_CARD_SELECTION->name.compare("Meal")==0||BATTLE_CARD_SELECTION->name.compare("Snack")==0)) { + if (PLAYER_SELECTED_TARGET==-1||CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET]->hp<=0) { + for (int i=0;ially&&ent->hp>0) { + PLAYER_SELECTED_TARGET=i; + break; + } } } + } else { + PLAYER_SELECTED_TARGET=-2; + setupBattleTurns(); } } }break; @@ -733,7 +735,6 @@ public: for (int i=0;iplayerOwnCount>0) { availablePowers.push_back(WEATHER_POWERS[i]); - //cout<<"There are x"<playerOwnCount<<" of "<name<<"\n"; } } BATTLE_CARD_SELECTION_IND=0; @@ -853,7 +854,7 @@ public: PLAYER_SELECTED_TARGET=-1; } } else { - BATTLE_CURRENT_TURN_ENTITY=turnOrder.top(); + BATTLE_CURRENT_TURN_ENTITY=turnOrder.front(); turnOrder.pop(); if (BATTLE_CURRENT_TURN_ENTITY==-1) { if (PLAYER_HP<=0) { @@ -1381,13 +1382,13 @@ public: if (power->damage==-1002) { //Instead heal for their max health. PLAYER_MAXHP+=5; - int finalDamage=-PLAYER_MAXHP; + finalDamage=-PLAYER_MAXHP; foodCount--; } else if (power->damage==-1001) { //Instead heal for their max health. FOOD_REGEN_TURNS=4; - int finalDamage=-PLAYER_MAXHP*0.33; + finalDamage=-PLAYER_MAXHP*0.33; foodCount--; } PLAYER_HP=std::clamp(PLAYER_HP-finalDamage,0,PLAYER_MAXHP); @@ -1448,6 +1449,9 @@ public: if (CURRENT_ENCOUNTER.entities[i]->hp>0) { CURRENT_ENCOUNTER.entities[i]->selectedMove=CURRENT_ENCOUNTER.entities[i]->moveSet[rand()%CURRENT_ENCOUNTER.entities[i]->moveSet.size()]; CURRENT_ENCOUNTER.entities[i]->turnComplete=false; + if (CURRENT_ENCOUNTER.entities[i]->selectedMove->name.compare("Seed Storm")==0) { + std::cout<<" Entity "<selectedMove->name.compare("Seed Storm")==0) { turnOrder.push(i); CURRENT_ENCOUNTER.entities[i]->turnComplete=true; + std::cout<<" Entity "<name.compare("Meal")==0||BATTLE_CARD_SELECTION->name.compare("Snack")==0)) { + turnOrder.push(-1); + PLAYER_TURN_COMPLETE=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;iname.compare("Meal")==0||BATTLE_CARD_SELECTION->name.compare("Snack")==0)) { + turnOrder.push(-1); + PLAYER_TURN_COMPLETE=true; + } if (ent->hp>0&&!ent->turnComplete&& !ent->slowed&&rand()%2==0) { turnOrder.push(i); @@ -1486,7 +1500,7 @@ public: } } BATTLE_STATE=battle::PERFORM_TURN; - BATTLE_CURRENT_TURN_ENTITY=turnOrder.top(); + BATTLE_CURRENT_TURN_ENTITY=turnOrder.front(); turnOrder.pop(); BATTLE_STATE=battle::WAIT_TURN_ANIMATION; EFFECT_TIMER=0; diff --git a/Seasons_of_Loneliness b/Seasons_of_Loneliness index 27da788..d27df48 100755 Binary files a/Seasons_of_Loneliness and b/Seasons_of_Loneliness differ