diff --git a/C++ProjectTemplate b/C++ProjectTemplate index b04d7c5..3e75fbc 100755 Binary files a/C++ProjectTemplate and b/C++ProjectTemplate differ diff --git a/main.cpp b/main.cpp index 05ade07..c9ec889 100644 --- a/main.cpp +++ b/main.cpp @@ -504,6 +504,7 @@ public: int player_rollpp_counter[4][3] = {{0,0,0},{0,0,0},{0,0,0},{0,0,0}}; 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 player_rollwait_counter[4] = {0,0,0,0}; int SELECTED_TARGET=0; //Battle target that is selected. int BATTLE_TARGET=-99; //Negative numbers for players and positive numbers for enemy targets. int CURRENT_TURN=-99; //Who's turn we are enacting. @@ -519,9 +520,7 @@ public: }; int POWER_SELECTION_OFFSET[4]={0,0,0,0}; int BATTLE_ANIMATION_TIMER=0; - - - + int BATTLE_ROLLING_COUNTER_WAITTIME = 0; //Number of frames to wait for each rolling counter. bool MOUSE_PRESSED_DOWN=false,MOUSE_DOWN=false,MOUSE_RELEASED=false; //TODO Implement Mouse things. @@ -667,6 +666,102 @@ goes on a very long time, I hope you can understand this is only for testing pur } if (BATTLE_ENCOUNTER!=nullptr) { + for (int i=0;i0) { + if (BATTLE_ROLLING_COUNTER_WAITTIME==0) { + player_rollwait_counter[i]=0; + } else { + player_rollwait_counter[i]--; + } + } + Entity*member=PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]; + if (member->GetHP()>std::clamp(member->GetTargetHP(),0,member->GetTargetHP())) { + if (player_rollhp_counter[i][0]<=0&&player_rollwait_counter[i]==0) { + player_rollhp_display[i][0]--; + player_rollhp_counter[i][0]=13; + member->_SetDirectHP(member->GetHP()-1); + if (player_rollhp_display[i][0]<0) { + player_rollhp_display[i][0]=9; + player_rollhp_counter[i][0]=13; + player_rollhp_display[i][1]--; + player_rollhp_counter[i][1]=13; + if (player_rollhp_display[i][1]<0) { + player_rollhp_display[i][1]=9; + player_rollhp_counter[i][1]=13; + player_rollhp_display[i][2]--; + player_rollhp_counter[i][2]=13; + } + } + } + if (player_rollhp_counter[i][0]>0) { + if (member->GetTargetHP()<-member->maxHP) { + player_rollhp_counter[i][0]-=HEALTH_ROLLING_SPEED+(member->maxHP-member->GetTargetHP())/10; + } else + if (member->GetTargetHP()<0) { + player_rollhp_counter[i][0]-=HEALTH_ROLLING_SPEED+(member->maxHP-member->GetTargetHP())/20; + } else { + player_rollhp_counter[i][0]-=HEALTH_ROLLING_SPEED; + } + } + if (player_rollhp_counter[i][1]>0) { + player_rollhp_counter[i][1]--; + } + if (player_rollhp_counter[i][2]>0) { + player_rollhp_counter[i][2]--; + } + } else + if (member->GetHP()GetTargetHP()) { + if (player_rollhp_counter[i][0]>=0&&player_rollwait_counter[i]==0) { + player_rollhp_display[i][0]++; + player_rollhp_counter[i][0]=-13; + member->_SetDirectHP(member->GetHP()+1); + if (player_rollhp_display[i][0]>9) { + player_rollhp_display[i][0]=0; + player_rollhp_counter[i][0]=-13; + player_rollhp_display[i][1]++; + player_rollhp_counter[i][1]=-13; + if (player_rollhp_display[i][1]>9) { + player_rollhp_display[i][1]=0; + player_rollhp_counter[i][1]=-13; + player_rollhp_display[i][2]++; + player_rollhp_counter[i][2]=-13; + } + } + } + if (player_rollhp_counter[i][0]<0) { + player_rollhp_counter[i][0]+=HEALTH_ROLLING_SPEED; + } + if (player_rollhp_counter[i][1]<0) { + player_rollhp_counter[i][1]++; + } + if (player_rollhp_counter[i][2]<0) { + player_rollhp_counter[i][2]++; + } + } else { + if (player_rollhp_counter[i][0]<0) { + player_rollhp_counter[i][0]++; + } + if (player_rollhp_counter[i][1]<0) { + player_rollhp_counter[i][1]++; + } + if (player_rollhp_counter[i][2]<0) { + player_rollhp_counter[i][2]++; + } + if (player_rollhp_counter[i][0]>0) { + player_rollhp_counter[i][0]--; + } + if (player_rollhp_counter[i][1]>0) { + player_rollhp_counter[i][1]--; + } + if (player_rollhp_counter[i][2]>0) { + player_rollhp_counter[i][2]--; + } + } + + if (player_rollwait_counter[i]==0) { + player_rollwait_counter[i]=BATTLE_ROLLING_COUNTER_WAITTIME*13; + } + } switch (BATTLE_STATE) { case BattleState::MOVE_CAMERA:{ bool allDone=true; @@ -705,91 +800,7 @@ goes on a very long time, I hope you can understand this is only for testing pur } }break; case BattleState::WAIT:{ - for (int i=0;iGetHP()>std::clamp(member->GetTargetHP(),0,member->GetTargetHP())) { - if (player_rollhp_counter[i][0]<=0) { - player_rollhp_display[i][0]--; - player_rollhp_counter[i][0]=13; - member->_SetDirectHP(member->GetHP()-1); - if (player_rollhp_display[i][0]<0) { - player_rollhp_display[i][0]=9; - player_rollhp_counter[i][0]=13; - player_rollhp_display[i][1]--; - player_rollhp_counter[i][1]=13; - if (player_rollhp_display[i][1]<0) { - player_rollhp_display[i][1]=9; - player_rollhp_counter[i][1]=13; - player_rollhp_display[i][2]--; - player_rollhp_counter[i][2]=13; - } - } - } - if (player_rollhp_counter[i][0]>0) { - if (member->GetTargetHP()<-member->maxHP) { - player_rollhp_counter[i][0]-=HEALTH_ROLLING_SPEED+(member->maxHP-member->GetTargetHP())/10; - } else - if (member->GetTargetHP()<0) { - player_rollhp_counter[i][0]-=HEALTH_ROLLING_SPEED+(member->maxHP-member->GetTargetHP())/20; - } else { - player_rollhp_counter[i][0]-=HEALTH_ROLLING_SPEED; - } - } - if (player_rollhp_counter[i][1]>0) { - player_rollhp_counter[i][1]--; - } - if (player_rollhp_counter[i][2]>0) { - player_rollhp_counter[i][2]--; - } - } else - if (member->GetHP()GetTargetHP()) { - if (player_rollhp_counter[i][0]>=0) { - player_rollhp_display[i][0]++; - player_rollhp_counter[i][0]=-13; - member->_SetDirectHP(member->GetHP()+1); - if (player_rollhp_display[i][0]>9) { - player_rollhp_display[i][0]=0; - player_rollhp_counter[i][0]=-13; - player_rollhp_display[i][1]++; - player_rollhp_counter[i][1]=-13; - if (player_rollhp_display[i][1]>9) { - player_rollhp_display[i][1]=0; - player_rollhp_counter[i][1]=-13; - player_rollhp_display[i][2]++; - player_rollhp_counter[i][2]=-13; - } - } - } - if (player_rollhp_counter[i][0]<0) { - player_rollhp_counter[i][0]+=HEALTH_ROLLING_SPEED; - } - if (player_rollhp_counter[i][1]<0) { - player_rollhp_counter[i][1]++; - } - if (player_rollhp_counter[i][2]<0) { - player_rollhp_counter[i][2]++; - } - } else { - if (player_rollhp_counter[i][0]<0) { - player_rollhp_counter[i][0]++; - } - if (player_rollhp_counter[i][1]<0) { - player_rollhp_counter[i][1]++; - } - if (player_rollhp_counter[i][2]<0) { - player_rollhp_counter[i][2]++; - } - if (player_rollhp_counter[i][0]>0) { - player_rollhp_counter[i][0]--; - } - if (player_rollhp_counter[i][1]>0) { - player_rollhp_counter[i][1]--; - } - if (player_rollhp_counter[i][2]>0) { - player_rollhp_counter[i][2]--; - } - } - } + BATTLE_ROLLING_COUNTER_WAITTIME=0; bool done=false; if (!done) { for (int i=0;i<4;i++) { @@ -882,6 +893,7 @@ goes on a very long time, I hope you can understand this is only for testing pur } }break; case BattleState::WAIT_ANIMATION:{ + BATTLE_ROLLING_COUNTER_WAITTIME=5; BATTLE_ANIMATION_TIMER++; if (BATTLE_ANIMATION_TIMER==90) { if (CURRENT_TURN<0) { @@ -927,7 +939,6 @@ goes on a very long time, I hope you can understand this is only for testing pur +BATTLE_ENCOUNTER->objs[CURRENT_TURN]->baseAtk; printf("Damage: %d\n",dmgAmt); std::cout << BATTLE_ENCOUNTER->objs[CURRENT_TURN]->obj->name << " uses " << BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove->name << " " << BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove->grade << " on " << PARTY_MEMBER_OBJ[-BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedTarget-1]->name << " dealing " << dmgAmt << " health.\n"; - printf("Now subtract.\n"); PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedTarget-1]]->SubtractHP(dmgAmt); } else { std::cout << BATTLE_ENCOUNTER->objs[CURRENT_TURN]->obj->name << " uses " << BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove->name << " " << BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove->grade << " on " << PARTY_MEMBER_OBJ[-BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedTarget-1]->name << " but it failed.\n"; @@ -949,6 +960,13 @@ goes on a very long time, I hope you can understand this is only for testing pur } } }break; + case BattleState::SELECT_ACTION: + case BattleState::ITEM_SELECT: + case BattleState::GRADE_SELECT: + case BattleState::TARGET_SELECT: + case BattleState::POWER_SELECT:{ + BATTLE_ROLLING_COUNTER_WAITTIME=5; + }break; } }