|
|
|
@ -158,6 +158,8 @@ public: |
|
|
|
|
int OVERWORLD_POWER_SELECTION_MEMBER=0; |
|
|
|
|
Battle::Move*OVERWORLD_SELECTED_POWER; |
|
|
|
|
int OVERWORLD_TARGET_SELECTION=0; |
|
|
|
|
bool HEALING_OVERWORLD_MEMBERS=false; //When set to true, members will be healed as dialog boxes are closed using the HEALING_OVERWORLD_MEMBER variable.
|
|
|
|
|
int HEALING_OVERWORLD_MEMBER=0; |
|
|
|
|
|
|
|
|
|
bool MOUSE_PRESSED_DOWN=false,MOUSE_DOWN=false,MOUSE_RELEASED=false; //TODO Implement Mouse things.
|
|
|
|
|
|
|
|
|
@ -312,6 +314,29 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), |
|
|
|
|
GAME_STATE=GameState::GAME_WORLD; |
|
|
|
|
} |
|
|
|
|
CLOSE_OVERWORLD_WINDOW=false; |
|
|
|
|
if (HEALING_OVERWORLD_MEMBERS) { |
|
|
|
|
if (HEALING_OVERWORLD_MEMBER==0||HEALING_OVERWORLD_MEMBER==2) { |
|
|
|
|
DisplayMessageBox(""); |
|
|
|
|
} |
|
|
|
|
Entity*castingMember=PARTY_MEMBER_STATS[PARTY_MEMBER_ID[OVERWORLD_POWER_SELECTION_MEMBER]]; |
|
|
|
|
castingMember->selectedMove=OVERWORLD_SELECTED_POWER; |
|
|
|
|
while (HEALING_OVERWORLD_MEMBER<PARTY_MEMBER_COUNT) { |
|
|
|
|
Entity*target=PARTY_MEMBER_STATS[PARTY_MEMBER_ID[HEALING_OVERWORLD_MEMBER]]; |
|
|
|
|
if (target->GetHP()>0) { |
|
|
|
|
int healAmt = CalculateHealing(castingMember); |
|
|
|
|
vi2d box = {(128-32*PARTY_MEMBER_COUNT)+HEALING_OVERWORLD_MEMBER*64+29,170}; |
|
|
|
|
DAMAGE_NUMBERS.push_back(new DamageNumber(-healAmt,box+cameraPos)); |
|
|
|
|
target->AddHP(healAmt); |
|
|
|
|
targetText+=target->obj->name+" recovered "+std::to_string(healAmt)+" hitpoints.\n"; |
|
|
|
|
messageBoxLoad=true; |
|
|
|
|
messageBoxVisible=true; |
|
|
|
|
HEALING_OVERWORLD_MEMBER++; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
HEALING_OVERWORLD_MEMBER++; |
|
|
|
|
} |
|
|
|
|
castingMember->selectedMove=nullptr; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
while (messageBoxMarker<messageBoxFinalText.length()) { |
|
|
|
@ -376,6 +401,8 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), |
|
|
|
|
CurrentCutscene->LockAction(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
HandleRollingCounters(); |
|
|
|
|
|
|
|
|
|
HandleBattle(); |
|
|
|
|
|
|
|
|
|
HandleCutscenes(); |
|
|
|
@ -429,25 +456,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), |
|
|
|
|
for (int i=0;i<CURRENT_MAP->encounters.size();i++) { |
|
|
|
|
if (CURRENT_MAP->encounters[i]->IsEncounterAlive()&&CURRENT_MAP->encounters[i]->IsInRange(PARTY_MEMBER_OBJ[0]->GetPos())) { |
|
|
|
|
BATTLE_STATE=BattleState::MOVE_CAMERA; |
|
|
|
|
for (int i=0;i<PARTY_MEMBER_COUNT;i++) { |
|
|
|
|
Entity*member=PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]; |
|
|
|
|
for (int j=0;j<3;j++) { |
|
|
|
|
switch (j) { |
|
|
|
|
case 0:{ |
|
|
|
|
player_rollhp_display[i][j]=member->GetHP()%10; |
|
|
|
|
player_rollpp_display[i][j]=member->GetPP()%10; |
|
|
|
|
}break; |
|
|
|
|
case 1:{ |
|
|
|
|
player_rollhp_display[i][j]=member->GetHP()/10%10; |
|
|
|
|
player_rollpp_display[i][j]=member->GetPP()/10%10; |
|
|
|
|
}break; |
|
|
|
|
case 2:{ |
|
|
|
|
player_rollhp_display[i][j]=member->GetHP()/100%10; |
|
|
|
|
player_rollpp_display[i][j]=member->GetPP()/100%10; |
|
|
|
|
}break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
SetupRollingHitpointCounters(); |
|
|
|
|
BATTLE_ENCOUNTER=CURRENT_MAP->encounters[i]; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
@ -1010,6 +1019,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), |
|
|
|
|
if (PlayerCanMove()&&ACTIONKEYPRESSED) { |
|
|
|
|
GAME_STATE=GameState::OVERWORLD_MENU; |
|
|
|
|
OVERWORLD_MENU_SELECTION=0; |
|
|
|
|
SetupRollingHitpointCounters(); |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
case GameState::OVERWORLD_MENU:{ |
|
|
|
@ -1452,54 +1462,12 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), |
|
|
|
|
DrawTargetRangeGrid(BATTLE_ENCOUNTER->objs[SELECTED_TARGET]->obj->GetPosWithOrigin(),PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove->range); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (BATTLE_ENCOUNTER!=nullptr) { |
|
|
|
|
SetDrawTarget(layer::HIGH); |
|
|
|
|
if (BATTLE_STATE==BattleState::SELECT_ACTION||BATTLE_STATE==BattleState::POWER_SELECT||BATTLE_STATE==BattleState::GRADE_SELECT||BATTLE_STATE==BattleState::ITEM_SELECT) { |
|
|
|
|
DrawDialogBox({1,1},{(int)(WIDTH*0.75),HEIGHT/6},Pixel(70, 33, 105,220),Pixel(62, 54, 69,220),Pixel(185, 148, 255,220)); |
|
|
|
|
const std::string labels[6]={"Power","Attack","Item","Defend","Move","Run"}; |
|
|
|
|
for (int i=0;i<6;i+=2) { |
|
|
|
|
DrawStringPropDecal({static_cast<float>(3+8+i/2*64),9},labels[i]); |
|
|
|
|
DrawStringPropDecal({static_cast<float>(3+8+i/2*64),23},labels[i+1]); |
|
|
|
|
} |
|
|
|
|
DrawDecal({static_cast<float>(BATTLE_SELECTION_CURSOR/2*64+3),static_cast<float>(9+((BATTLE_SELECTION_CURSOR%2==0)?0:14))},SPRITES["cursor.png"]); |
|
|
|
|
} |
|
|
|
|
if (BATTLE_STATE==BattleState::POWER_SELECT||BATTLE_STATE==BattleState::GRADE_SELECT) { |
|
|
|
|
DrawBattleMoveList(-CURRENT_TURN-1); |
|
|
|
|
} |
|
|
|
|
if (BATTLE_STATE==BattleState::WAIT_ANIMATION) { |
|
|
|
|
SetDrawTarget(layer::INTERFACE); |
|
|
|
|
vd2d text={2,2}; |
|
|
|
|
vd2d shadowOffset={1,1}; |
|
|
|
|
std::string label; |
|
|
|
|
if (BATTLE_CURRENT_CUSTOM_MSG.s.length()>0) { |
|
|
|
|
std::string baseStr = BATTLE_CURRENT_CUSTOM_MSG.s; |
|
|
|
|
if (CURRENT_TURN<0) { |
|
|
|
|
label=ParseBattleMessage(PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]],baseStr); |
|
|
|
|
} else { |
|
|
|
|
label=ParseBattleMessage(BATTLE_ENCOUNTER->objs[CURRENT_TURN],baseStr); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if (CURRENT_TURN<0) { |
|
|
|
|
std::string baseStr = PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove->attackMsg; |
|
|
|
|
label=ParseBattleMessage(PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]],baseStr); |
|
|
|
|
} else { |
|
|
|
|
std::string baseStr = BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove->attackMsg; |
|
|
|
|
label=ParseBattleMessage(BATTLE_ENCOUNTER->objs[CURRENT_TURN],baseStr); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
DrawStringDecal(text+shadowOffset,Wrap(label,ScreenWidth()-2,false,{1,2}),BLACK,{1,2}); |
|
|
|
|
DrawStringDecal(text,Wrap(label,ScreenWidth()-2,false,{1,2}),WHITE,{1,2}); |
|
|
|
|
} |
|
|
|
|
if (BATTLE_STATE==BattleState::ENEMY_SPOILS) { |
|
|
|
|
SetDrawTarget(layer::INTERFACE); |
|
|
|
|
vd2d text={2,2}; |
|
|
|
|
vd2d shadowOffset={1,1}; |
|
|
|
|
DrawStringDecal(text+shadowOffset,Wrap(BATTLE_SPOILS_MESSAGE,ScreenWidth()-2,false,{1,2}),BLACK,{1,2}); |
|
|
|
|
DrawStringDecal(text,Wrap(BATTLE_SPOILS_MESSAGE,ScreenWidth()-2,false,{1,2}),WHITE,{1,2}); |
|
|
|
|
} |
|
|
|
|
if (BATTLE_STATE!=BattleState::MOVE_CAMERA&&BATTLE_STATE!=BattleState::MOVE_CAMERA_BACK) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (BATTLE_ENCOUNTER!=nullptr&&BATTLE_STATE!=BattleState::MOVE_CAMERA&&BATTLE_STATE!=BattleState::MOVE_CAMERA_BACK||OverworldMenuOpen()) { |
|
|
|
|
SetDrawTarget(layer::INTERFACE); |
|
|
|
|
vi2d screenShakeOffset = {0,0}; |
|
|
|
|
if (BATTLE_ENCOUNTER!=nullptr) { |
|
|
|
|
cameraPos = BATTLE_ENCOUNTER->pos; |
|
|
|
|
if (BATTLE_HIT_SCREENSHAKE>0) { |
|
|
|
|
BATTLE_HIT_SCREENSHAKE--; |
|
|
|
@ -1510,13 +1478,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
cameraPos+=screenShakeOffset; |
|
|
|
|
|
|
|
|
|
std::vector<Entity*> attackedAllies; |
|
|
|
|
|
|
|
|
|
if (CURRENT_TURN>=0&&BATTLE_STATE==BattleState::WAIT_ANIMATION&&BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedTarget<0) { |
|
|
|
|
attackedAllies=GetEntitiesInRange(BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedTarget,BATTLE_ENCOUNTER->objs[CURRENT_TURN]->channelPos,BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (int i=0;i<PARTY_MEMBER_COUNT;i++) { |
|
|
|
|
Entity*member=PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]; |
|
|
|
|
Object*obj=PARTY_MEMBER_OBJ[i]; |
|
|
|
@ -1526,12 +1488,19 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), |
|
|
|
|
box.y-=20; |
|
|
|
|
} |
|
|
|
|
bool underAttack=false; |
|
|
|
|
if (BATTLE_ENCOUNTER!=nullptr) { |
|
|
|
|
std::vector<Entity*> attackedAllies; |
|
|
|
|
|
|
|
|
|
if (CURRENT_TURN>=0&&BATTLE_STATE==BattleState::WAIT_ANIMATION&&BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedTarget<0) { |
|
|
|
|
attackedAllies=GetEntitiesInRange(BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedTarget,BATTLE_ENCOUNTER->objs[CURRENT_TURN]->channelPos,BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove); |
|
|
|
|
} |
|
|
|
|
for (int j=0;j<attackedAllies.size();j++) { |
|
|
|
|
if (attackedAllies[j]->obj==PARTY_MEMBER_OBJ[i]) { |
|
|
|
|
underAttack=true; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (CURRENT_TURN>=0&&BATTLE_STATE==BattleState::WAIT_ANIMATION&&underAttack) { |
|
|
|
|
drawCheckerboardBox(box,{59,59},Pixel(180,159,194),Pixel(200,179,214),{6,6},RED,DARK_RED); |
|
|
|
|
} else { |
|
|
|
@ -1542,8 +1511,10 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), |
|
|
|
|
} else { |
|
|
|
|
DrawStringDecal({(float)(box.x+6),(float)(box.y+4)},obj->name,BLACK,{1,0.8}); |
|
|
|
|
} |
|
|
|
|
if (BATTLE_ENCOUNTER!=nullptr) { |
|
|
|
|
DrawPartialDecal({(float)(box.x+4),(float)(box.y+5+8+2)},SPRITES["atbbar_back.png"],{0,0},{static_cast<float>(member->atb/1000.0*SPRITES["atbbar_back.png"]->sprite->width),static_cast<float>(SPRITES["atbbar_back.png"]->sprite->height)}); |
|
|
|
|
DrawDecal({(float)(box.x+4),(float)(box.y+5+8+2)},SPRITES["atbbar_front.png"]); |
|
|
|
|
} |
|
|
|
|
if (member->selectedMove!=nullptr) { |
|
|
|
|
DrawPartialDecal({(float)(box.x+4),(float)(box.y+5+8+2)},SPRITES["atbbar_back.png"],{0,0},{(1-((float)member->channelTimeRemaining/member->selectedMove->channelTime))*SPRITES["atbbar_back.png"]->sprite->width,static_cast<float>(SPRITES["atbbar_back.png"]->sprite->height)},{1,1},GREEN*0.7); |
|
|
|
|
std::string label=member->selectedMove->name; |
|
|
|
@ -1577,6 +1548,57 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), |
|
|
|
|
DrawStringDecal(mpTextPos,"PP",BLACK); |
|
|
|
|
DrawRollingCounter(mpTextPos,member->GetPP(),player_rollpp_display[i],player_rollpp_counter[i]); |
|
|
|
|
} |
|
|
|
|
SetDrawTarget(layer::DYNAMIC); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (BATTLE_ENCOUNTER!=nullptr) { |
|
|
|
|
SetDrawTarget(layer::HIGH); |
|
|
|
|
if (BATTLE_STATE==BattleState::SELECT_ACTION||BATTLE_STATE==BattleState::POWER_SELECT||BATTLE_STATE==BattleState::GRADE_SELECT||BATTLE_STATE==BattleState::ITEM_SELECT) { |
|
|
|
|
DrawDialogBox({1,1},{(int)(WIDTH*0.75),HEIGHT/6},Pixel(70, 33, 105,220),Pixel(62, 54, 69,220),Pixel(185, 148, 255,220)); |
|
|
|
|
const std::string labels[6]={"Power","Attack","Item","Defend","Move","Run"}; |
|
|
|
|
for (int i=0;i<6;i+=2) { |
|
|
|
|
DrawStringPropDecal({static_cast<float>(3+8+i/2*64),9},labels[i]); |
|
|
|
|
DrawStringPropDecal({static_cast<float>(3+8+i/2*64),23},labels[i+1]); |
|
|
|
|
} |
|
|
|
|
DrawDecal({static_cast<float>(BATTLE_SELECTION_CURSOR/2*64+3),static_cast<float>(9+((BATTLE_SELECTION_CURSOR%2==0)?0:14))},SPRITES["cursor.png"]); |
|
|
|
|
} |
|
|
|
|
if (BATTLE_STATE==BattleState::POWER_SELECT||BATTLE_STATE==BattleState::GRADE_SELECT) { |
|
|
|
|
DrawBattleMoveList(-CURRENT_TURN-1); |
|
|
|
|
} |
|
|
|
|
if (BATTLE_STATE==BattleState::WAIT_ANIMATION) { |
|
|
|
|
SetDrawTarget(layer::INTERFACE); |
|
|
|
|
vd2d text={2,2}; |
|
|
|
|
vd2d shadowOffset={1,1}; |
|
|
|
|
std::string label; |
|
|
|
|
if (BATTLE_CURRENT_CUSTOM_MSG.s.length()>0) { |
|
|
|
|
std::string baseStr = BATTLE_CURRENT_CUSTOM_MSG.s; |
|
|
|
|
if (CURRENT_TURN<0) { |
|
|
|
|
label=ParseBattleMessage(PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]],baseStr); |
|
|
|
|
} else { |
|
|
|
|
label=ParseBattleMessage(BATTLE_ENCOUNTER->objs[CURRENT_TURN],baseStr); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if (CURRENT_TURN<0) { |
|
|
|
|
std::string baseStr = PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove->attackMsg; |
|
|
|
|
label=ParseBattleMessage(PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]],baseStr); |
|
|
|
|
} else { |
|
|
|
|
std::string baseStr = BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove->attackMsg; |
|
|
|
|
label=ParseBattleMessage(BATTLE_ENCOUNTER->objs[CURRENT_TURN],baseStr); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
DrawStringDecal(text+shadowOffset,Wrap(label,ScreenWidth()-2,false,{1,2}),BLACK,{1,2}); |
|
|
|
|
DrawStringDecal(text,Wrap(label,ScreenWidth()-2,false,{1,2}),WHITE,{1,2}); |
|
|
|
|
} |
|
|
|
|
if (BATTLE_STATE==BattleState::ENEMY_SPOILS) { |
|
|
|
|
SetDrawTarget(layer::INTERFACE); |
|
|
|
|
vd2d text={2,2}; |
|
|
|
|
vd2d shadowOffset={1,1}; |
|
|
|
|
DrawStringDecal(text+shadowOffset,Wrap(BATTLE_SPOILS_MESSAGE,ScreenWidth()-2,false,{1,2}),BLACK,{1,2}); |
|
|
|
|
DrawStringDecal(text,Wrap(BATTLE_SPOILS_MESSAGE,ScreenWidth()-2,false,{1,2}),WHITE,{1,2}); |
|
|
|
|
} |
|
|
|
|
if (BATTLE_STATE!=BattleState::MOVE_CAMERA&&BATTLE_STATE!=BattleState::MOVE_CAMERA_BACK) { |
|
|
|
|
SetDrawTarget(layer::INTERFACE); |
|
|
|
|
for (int i=0;i<BATTLE_ENCOUNTER->objs.size();i++) { |
|
|
|
|
Entity*obj = BATTLE_ENCOUNTER->objs[i]; |
|
|
|
|
if (obj->GetHP()>0&&obj->selectedMove!=nullptr) { |
|
|
|
@ -2705,23 +2727,6 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), |
|
|
|
|
|
|
|
|
|
void HandleBattle() { |
|
|
|
|
if (BATTLE_ENCOUNTER!=nullptr) { |
|
|
|
|
for (int i=0;i<PARTY_MEMBER_COUNT;i++) { |
|
|
|
|
if (player_rollwait_counter[i]>0) { |
|
|
|
|
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]]; |
|
|
|
|
|
|
|
|
|
HandleRollingCounters(i,player_rollhp_counter,player_rollhp_display,member,member->maxHP,member->GetHP(),member->GetTargetHP()); |
|
|
|
|
HandleRollingCounters(i,player_rollpp_counter,player_rollpp_display,member,member->maxPP,member->GetPP(),member->GetTargetPP(),true); |
|
|
|
|
|
|
|
|
|
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; |
|
|
|
@ -2923,9 +2928,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), |
|
|
|
|
if (PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove->friendly) { |
|
|
|
|
if (PARTY_MEMBER_STATS[-PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedTarget-1]->GetHP()>0) { |
|
|
|
|
for (auto&ent:GetEntitiesInRange(PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedTarget,PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->channelPos,PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove)) { |
|
|
|
|
int healAmt = PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove->baseDmg+ |
|
|
|
|
((PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove->randomDmg>0)?rand()%PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove->randomDmg:0) |
|
|
|
|
+PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->baseAtk; |
|
|
|
|
int healAmt = CalculateHealing(PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]); |
|
|
|
|
if (ent->GetHP()>0) { |
|
|
|
|
std::cout << PARTY_MEMBER_OBJ[-CURRENT_TURN-1]->name << " uses " << PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove->name << " " << PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove->grade << " on " << ent->obj->name << " recovering " << healAmt << " health.\n"; |
|
|
|
|
ent->AddHP(healAmt); |
|
|
|
@ -2962,9 +2965,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), |
|
|
|
|
if (BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove->friendly) { |
|
|
|
|
if (BATTLE_ENCOUNTER->objs[BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedTarget]->GetHP()>0) { |
|
|
|
|
for (auto&ent:GetEntitiesInRange(BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedTarget,BATTLE_ENCOUNTER->objs[CURRENT_TURN]->channelPos,BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove)) { |
|
|
|
|
int healAmt = BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove->baseDmg+ |
|
|
|
|
((rand()%BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove->randomDmg>0)?rand()%BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove->randomDmg:0) |
|
|
|
|
+BATTLE_ENCOUNTER->objs[CURRENT_TURN]->baseAtk; |
|
|
|
|
int healAmt = CalculateHealing(BATTLE_ENCOUNTER->objs[CURRENT_TURN]); |
|
|
|
|
if (ent->GetHP()>0) { |
|
|
|
|
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 " << ent->obj->name << " recovering " << healAmt << " health.\n"; |
|
|
|
|
ent->AddHP(healAmt); |
|
|
|
@ -3486,7 +3487,11 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), |
|
|
|
|
ITEM_SELECTION_CURSOR=std::clamp(ITEM_SELECTION_CURSOR,0,(int)PARTY_INVENTORY.size()-1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int CalculateDamage(Entity*attacker,Entity*defender) { |
|
|
|
|
int CalculateHealing(Entity*user) { |
|
|
|
|
return CalculateDamage(user,nullptr,false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int CalculateDamage(Entity*attacker,Entity*defender,bool includeDefenses=true) { |
|
|
|
|
int finalDamage = 0; |
|
|
|
|
int equipDamage = 0; |
|
|
|
|
for (int i=0;i<attacker->equipment.size();i++) { |
|
|
|
@ -3501,13 +3506,16 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), |
|
|
|
|
finalDamage += attackerDamage; |
|
|
|
|
|
|
|
|
|
int equipDefense = 0; |
|
|
|
|
if (includeDefenses) { |
|
|
|
|
for (int i=0;i<defender->equipment.size();i++) { |
|
|
|
|
if (defender->equipment[i]!=nullptr) { |
|
|
|
|
equipDefense+=defender->equipment[i]->stats.defense; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
finalDamage=std::max(1,finalDamage-equipDefense); |
|
|
|
|
if (defender->selectedMove==MOVELIST[BattleMoveName::DEFEND]) { |
|
|
|
|
if (includeDefenses&&defender->selectedMove==MOVELIST[BattleMoveName::DEFEND]) { |
|
|
|
|
finalDamage*=0.4; |
|
|
|
|
} |
|
|
|
|
return finalDamage; |
|
|
|
@ -3681,7 +3689,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), |
|
|
|
|
label=label.replace(label.find("$USER"),5,ent->obj->name); |
|
|
|
|
} |
|
|
|
|
if (label.find("$POWER")!=std::string::npos) { |
|
|
|
|
label=label.replace(label.find("$POWER"),6,ent->selectedMove->name+" "+((ent->selectedMove->grade!=0)?std::string(1,ent->selectedMove->grade):"")); |
|
|
|
|
label=label.replace(label.find("$POWER"),6,ent->selectedMove->GetPowerName()); |
|
|
|
|
} |
|
|
|
|
if (label.find("$ITEM")!=std::string::npos) { |
|
|
|
|
label=label.replace(label.find("$ITEM"),5,EQUIP_$ITEM_DISPLAY); |
|
|
|
@ -3857,13 +3865,72 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), |
|
|
|
|
OVERWORLD_SELECTED_POWER=move; |
|
|
|
|
OVERWORLD_TARGET_SELECTION=0; |
|
|
|
|
if (move->name=="PK Lifeup") { |
|
|
|
|
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[partyMemberSlot]]->SubtractPP(move->PPCost); |
|
|
|
|
if (move->range==1) { |
|
|
|
|
GAME_STATE=GameState::OVERWORLD_TARGET_MENU; |
|
|
|
|
} else { |
|
|
|
|
//DisplayMessageBox(PARTY_MEMBER_OBJ[partyMemberSlot]->name+" begins to cast "+move->name+" "+);
|
|
|
|
|
//DisplayMessageBox()
|
|
|
|
|
DisplayMessageBox(PARTY_MEMBER_OBJ[partyMemberSlot]->name+" begins to cast "+move->GetPowerName()+".\n"); |
|
|
|
|
HEALING_OVERWORLD_MEMBERS=true; |
|
|
|
|
HEALING_OVERWORLD_MEMBER=0; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void HandleRollingCounters() { |
|
|
|
|
if (BATTLE_ENCOUNTER!=nullptr||OverworldMenuOpen()) { |
|
|
|
|
for (int i=0;i<PARTY_MEMBER_COUNT;i++) { |
|
|
|
|
if (player_rollwait_counter[i]>0) { |
|
|
|
|
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]]; |
|
|
|
|
|
|
|
|
|
HandleRollingCounters(i,player_rollhp_counter,player_rollhp_display,member,member->maxHP,member->GetHP(),member->GetTargetHP()); |
|
|
|
|
HandleRollingCounters(i,player_rollpp_counter,player_rollpp_display,member,member->maxPP,member->GetPP(),member->GetTargetPP(),true); |
|
|
|
|
|
|
|
|
|
if (player_rollwait_counter[i]==0) { |
|
|
|
|
player_rollwait_counter[i]=BATTLE_ROLLING_COUNTER_WAITTIME*13; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool OverworldMenuOpen() { |
|
|
|
|
return GAME_STATE==GameState::OVERWORLD_MENU|| |
|
|
|
|
GAME_STATE==GameState::OVERWORLD_POWER_MENU|| |
|
|
|
|
GAME_STATE==GameState::OVERWORLD_GRADE_MENU|| |
|
|
|
|
GAME_STATE==GameState::OVERWORLD_POWER_PLAYER_MENU|| |
|
|
|
|
GAME_STATE==GameState::OVERWORLD_ITEMS_MENU|| |
|
|
|
|
GAME_STATE==GameState::OVERWORLD_EQUIP_ITEM_MENU|| |
|
|
|
|
GAME_STATE==GameState::OVERWORLD_EQUIP_MENU|| |
|
|
|
|
GAME_STATE==GameState::OVERWORLD_EQUIP_PLAYER_MENU|| |
|
|
|
|
GAME_STATE==GameState::OVERWORLD_STATUS_MENU|| |
|
|
|
|
GAME_STATE==GameState::OVERWORLD_TARGET_MENU; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void SetupRollingHitpointCounters() { |
|
|
|
|
for (int i=0;i<PARTY_MEMBER_COUNT;i++) { |
|
|
|
|
Entity*member=PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]; |
|
|
|
|
for (int j=0;j<3;j++) { |
|
|
|
|
switch (j) { |
|
|
|
|
case 0:{ |
|
|
|
|
player_rollhp_display[i][j]=member->GetHP()%10; |
|
|
|
|
player_rollpp_display[i][j]=member->GetPP()%10; |
|
|
|
|
}break; |
|
|
|
|
case 1:{ |
|
|
|
|
player_rollhp_display[i][j]=member->GetHP()/10%10; |
|
|
|
|
player_rollpp_display[i][j]=member->GetPP()/10%10; |
|
|
|
|
}break; |
|
|
|
|
case 2:{ |
|
|
|
|
player_rollhp_display[i][j]=member->GetHP()/100%10; |
|
|
|
|
player_rollpp_display[i][j]=member->GetPP()/100%10; |
|
|
|
|
}break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|