diff --git a/C++ProjectTemplate b/C++ProjectTemplate index b7d95b8..d5a197b 100755 Binary files a/C++ProjectTemplate and b/C++ProjectTemplate differ diff --git a/assets/atbbar_back.png b/assets/atbbar_back.png new file mode 100644 index 0000000..9a555c2 Binary files /dev/null and b/assets/atbbar_back.png differ diff --git a/assets/atbbar_front.png b/assets/atbbar_front.png new file mode 100644 index 0000000..2662df5 Binary files /dev/null and b/assets/atbbar_front.png differ diff --git a/assets/maps/map0 b/assets/maps/map0 index f6b4053..61e42c4 100644 --- a/assets/maps/map0 +++ b/assets/maps/map0 @@ -81,7 +81,6 @@ OBJECT224.000000;256.000000;8 OBJECT192.000000;256.000000;8 OBJECT160.000000;256.000000;8 ENCOUNTER64.000000;512.000000;90;2 -ENCOUNTER64.000000;64.000000;35;1 -ENCOUNTER64.000000;256.000000;100;1 +ENCOUNTER64.000000;256.000000;50;1 ENCOUNTER192.000000;352.000000;25;1 -ENCOUNTER320.000000;288.000000;25;2 \ No newline at end of file +ENCOUNTER128.000000;0.000000;25;2 \ No newline at end of file diff --git a/main.cpp b/main.cpp index 3bcb2d8..4df827e 100644 --- a/main.cpp +++ b/main.cpp @@ -393,6 +393,9 @@ public: int player_rollhp_display[4][3] = {{0,0,0},{0,0,0},{0,0,0},{0,0,0}}; int player_rollpp_display[4][3] = {{0,0,0},{0,0,0},{0,0,0},{0,0,0}}; int SELECTED_TEST_TARGET=0; + int BATTLE_TARGET=-99; //Negative numbers for players and positive numbers for enemy targets. + int CURRENT_TURN=-99; //Who's turn we are enacting. + bool MOUSE_PRESSED_DOWN=false,MOUSE_DOWN=false,MOUSE_RELEASED=false; //TODO Implement Mouse things. @@ -570,7 +573,7 @@ goes on a very long time, I hope you can understand this is only for testing pur case BattleState::WAIT:{ for (int i=0;iHP>member->targetHP) { + if (member->HP>std::clamp(member->targetHP,0,member->targetHP)) { if (player_rollhp_counter[i][0]<=0) { player_rollhp_display[i][0]--; player_rollhp_counter[i][0]=13; @@ -589,7 +592,14 @@ goes on a very long time, I hope you can understand this is only for testing pur } } if (player_rollhp_counter[i][0]>0) { - player_rollhp_counter[i][0]-=HEALTH_ROLLING_SPEED; + if (member->targetHP<-member->maxHP) { + player_rollhp_counter[i][0]-=HEALTH_ROLLING_SPEED+(member->maxHP-member->targetHP)/10; + } else + if (member->targetHP<0) { + player_rollhp_counter[i][0]-=HEALTH_ROLLING_SPEED+(member->maxHP-member->targetHP)/20; + } else { + player_rollhp_counter[i][0]-=HEALTH_ROLLING_SPEED; + } } if (player_rollhp_counter[i][1]>0) { player_rollhp_counter[i][1]--; @@ -646,6 +656,34 @@ goes on a very long time, I hope you can understand this is only for testing pur } } } + bool done=false; + for (int i=0;i<4;i++) { + if (PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->atb>=1000) { + printf("%s ready.\n",PARTY_MEMBER_OBJ[i]->name.c_str()); + CURRENT_TURN=-i; + GAME_STATE=BattleState::SELECT_ACTION; + done=true; + break; + } else { + PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->atb+=PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->speed; + } + } + if (!done) { + for (int i=0;iobjs.size();i++) { + if (BATTLE_ENCOUNTER->objs[i]->atb>=1000) { + printf("%s (%d) ready.\n",BATTLE_ENCOUNTER->objs[i]->obj->name.c_str(),i); + CURRENT_TURN=i; + GAME_STATE=BattleState::SELECT_ACTION; + done=true; + break; + } else { + BATTLE_ENCOUNTER->objs[i]->atb+=BATTLE_ENCOUNTER->objs[i]->speed; + } + } + } + }break; + case BattleState::SELECT_ACTION:{ + }break; } } @@ -1012,6 +1050,12 @@ goes on a very long time, I hope you can understand this is only for testing pur if (GetKey(PGDN).bPressed) { PARTY_MEMBER_STATS[PARTY_MEMBER_ID[SELECTED_TEST_TARGET]]->targetHP=std::clamp(PARTY_MEMBER_STATS[PARTY_MEMBER_ID[SELECTED_TEST_TARGET]]->targetHP-10,0,PARTY_MEMBER_STATS[PARTY_MEMBER_ID[SELECTED_TEST_TARGET]]->maxHP); } + if (GetKey(DEL).bPressed) { + PARTY_MEMBER_STATS[PARTY_MEMBER_ID[SELECTED_TEST_TARGET]]->targetHP=-50; + } + if (GetKey(END).bPressed) { + PARTY_MEMBER_STATS[PARTY_MEMBER_ID[SELECTED_TEST_TARGET]]->targetHP=-350; + } } switch (GAME_STATE) { @@ -1257,6 +1301,8 @@ goes on a very long time, I hope you can understand this is only for testing pur const olc::vi2d box = {(128-32*PARTY_MEMBER_COUNT)+i*64,160}; drawCheckerboardBox(box,{59,59},olc::Pixel(180,159,194),olc::Pixel(200,179,214),{6,6}); DrawStringDecal({(float)(box.x+6),(float)(box.y+6)},obj->name,olc::BLACK); + DrawPartialDecal({(float)(box.x+4),(float)(box.y+5+8+2)},SPRITES["atbbar_back.png"],{0,0},{member->atb/1000.0*SPRITES["atbbar_back.png"]->sprite->width,SPRITES["atbbar_back.png"]->sprite->height}); + DrawDecal({(float)(box.x+4),(float)(box.y+5+8+2)},SPRITES["atbbar_front.png"]); const olc::vi2d hpTextPos = {box.x+5,box.y+25}; for (int x=-1;x<=1;x++) { for (int y=-1;y<=1;y++) { @@ -1613,6 +1659,8 @@ goes on a very long time, I hope you can understand this is only for testing pur CreateSprite("terrainmap.png"); CreateSprite("additionalFont.png"); CreateSprite("rollingcounter.png"); + CreateSprite("atbbar_back.png"); + CreateSprite("atbbar_front.png"); } void SetupObjectInfo() {