|
|
|
@ -263,12 +263,14 @@ enum class Property{ |
|
|
|
|
POISON, |
|
|
|
|
REGEN, |
|
|
|
|
DEFENSE_UP, |
|
|
|
|
REVIVE, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
enum class BattleMoveName{ |
|
|
|
|
TESTMOVE1, |
|
|
|
|
TESTMOVE2, |
|
|
|
|
TESTMOVE3, |
|
|
|
|
BASH, |
|
|
|
|
HAILSTORM_A, |
|
|
|
|
HAILSTORM_B, |
|
|
|
|
HAILSTORM_G, |
|
|
|
@ -346,6 +348,7 @@ class Entity{ |
|
|
|
|
int atb=0; //When this value reaches 1000, it's this entity's turn.
|
|
|
|
|
Object* obj; |
|
|
|
|
std::vector<Battle::Move*> moveSet; |
|
|
|
|
int selectedTarget = 0; |
|
|
|
|
//Used for initializing players.
|
|
|
|
|
Entity(int HP,int maxHP,int PP,int maxPP,int baseAtk,std::array<int,4>resistances,int speed,std::vector<Battle::Move*>moveSet,int damageReduction=0,bool smart=false,bool dumb=false) |
|
|
|
|
:Entity(nullptr,HP,maxHP,PP,maxPP,baseAtk,resistances,speed,moveSet,damageReduction,smart,dumb){} |
|
|
|
@ -459,7 +462,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 SELECTED_TEST_TARGET=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.
|
|
|
|
|
int BATTLE_SELECTION_CURSOR=0; |
|
|
|
@ -474,6 +477,7 @@ public: |
|
|
|
|
}; |
|
|
|
|
int POWER_SELECTION_OFFSET[4]={0,0,0,0}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool MOUSE_PRESSED_DOWN=false,MOUSE_DOWN=false,MOUSE_RELEASED=false; //TODO Implement Mouse things.
|
|
|
|
@ -771,9 +775,6 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
case BattleState::SELECT_ACTION:{ |
|
|
|
|
|
|
|
|
|
}break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1271,6 +1272,65 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
if (LeftPressed()) { |
|
|
|
|
POWER_GRADE_CURSOR[-CURRENT_TURN-1]=std::clamp(POWER_GRADE_CURSOR[-CURRENT_TURN-1]-1,0,(int)(BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[-CURRENT_TURN-1]].size())-1); |
|
|
|
|
} |
|
|
|
|
if (ACTIONKEYPRESSED) { |
|
|
|
|
BATTLE_STATE=BattleState::TARGET_SELECT; |
|
|
|
|
//Set Default Target.
|
|
|
|
|
if (BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[-CURRENT_TURN-1]][POWER_GRADE_CURSOR[-CURRENT_TURN-1]]->friendly) { |
|
|
|
|
for (int i=0;i<PARTY_MEMBER_COUNT;i++) { |
|
|
|
|
if (PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->HP>0||getProperty(Property::REVIVE,BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[-CURRENT_TURN-1]][POWER_GRADE_CURSOR[-CURRENT_TURN-1]])) { |
|
|
|
|
SELECTED_TARGET=-i-1; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
for (int i=0;i<BATTLE_ENCOUNTER->objs.size();i++) { |
|
|
|
|
if (BATTLE_ENCOUNTER->objs[i]->HP>0) { |
|
|
|
|
SELECTED_TARGET=i; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
case BattleState::TARGET_SELECT:{ |
|
|
|
|
if (LeftPressed()) { |
|
|
|
|
if (BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[-CURRENT_TURN-1]][POWER_GRADE_CURSOR[-CURRENT_TURN-1]]->friendly) { |
|
|
|
|
do { |
|
|
|
|
SELECTED_TARGET++; |
|
|
|
|
if (SELECTED_TARGET==0) { |
|
|
|
|
SELECTED_TARGET=-4; |
|
|
|
|
} |
|
|
|
|
} while (PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-SELECTED_TARGET-1]]->HP<=0&&!getProperty(Property::REVIVE,BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[-CURRENT_TURN-1]][POWER_GRADE_CURSOR[-CURRENT_TURN-1]])); |
|
|
|
|
} else { |
|
|
|
|
do { |
|
|
|
|
SELECTED_TARGET--; |
|
|
|
|
if (SELECTED_TARGET<0) { |
|
|
|
|
SELECTED_TARGET=BATTLE_ENCOUNTER->objs.size()-1; |
|
|
|
|
} |
|
|
|
|
} while (BATTLE_ENCOUNTER->objs[SELECTED_TARGET]->HP<=0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (RightPressed()) { |
|
|
|
|
if (BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[-CURRENT_TURN-1]][POWER_GRADE_CURSOR[-CURRENT_TURN-1]]->friendly) { |
|
|
|
|
do { |
|
|
|
|
SELECTED_TARGET-=1; |
|
|
|
|
if (SELECTED_TARGET<-PARTY_MEMBER_COUNT) { |
|
|
|
|
SELECTED_TARGET=-1; |
|
|
|
|
} |
|
|
|
|
} while (PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-SELECTED_TARGET-1]]->HP<=0&&!getProperty(Property::REVIVE,BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[-CURRENT_TURN-1]][POWER_GRADE_CURSOR[-CURRENT_TURN-1]])); |
|
|
|
|
} else { |
|
|
|
|
do { |
|
|
|
|
SELECTED_TARGET=(SELECTED_TARGET+1)%BATTLE_ENCOUNTER->objs.size(); |
|
|
|
|
} while (BATTLE_ENCOUNTER->objs[SELECTED_TARGET]->HP<=0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (UpPressed()) { |
|
|
|
|
if (BATTLE_SELECTION_CURSOR==0) { //Power was selected, so go back to the powers menu.
|
|
|
|
|
BATTLE_STATE = BattleState::GRADE_SELECT; |
|
|
|
|
} else { //This was a standard attack, go back to main menu.
|
|
|
|
|
BATTLE_STATE=BattleState::SELECT_ACTION; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
} |
|
|
|
@ -1584,7 +1644,18 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (BATTLE_STATE==BattleState::TARGET_SELECT) { |
|
|
|
|
SetDrawTarget(layer::GROUND); |
|
|
|
|
if (SELECTED_TARGET<0) { |
|
|
|
|
DrawDecal(PARTY_MEMBER_OBJ[-SELECTED_TARGET-1]->GetPos()-cameraPos,SPRITES["targetCircle.png"],{PARTY_MEMBER_OBJ[-SELECTED_TARGET-1]->spr->width/(double)SPRITES["targetCircle.png"]->sprite->width,PARTY_MEMBER_OBJ[-SELECTED_TARGET-1]->spr->spr->sprite->height/(double)SPRITES["targetCircle.png"]->sprite->height},GREEN); |
|
|
|
|
} else { |
|
|
|
|
vd2d scale = {BATTLE_ENCOUNTER->objs[SELECTED_TARGET]->obj->spr->width/(double)SPRITES["targetCircle.png"]->sprite->width,BATTLE_ENCOUNTER->objs[SELECTED_TARGET]->obj->spr->spr->sprite->height/(double)SPRITES["targetCircle.png"]->sprite->height}; |
|
|
|
|
vi2d size = {SPRITES["targetCircle.png"]->sprite->width,SPRITES["targetCircle.png"]->sprite->height}; |
|
|
|
|
DrawDecal(BATTLE_ENCOUNTER->objs[SELECTED_TARGET]->obj->GetPos()+BATTLE_ENCOUNTER->objs[SELECTED_TARGET]->obj->originPoint-cameraPos-size/2*scale,SPRITES["targetCircle.png"],scale,YELLOW); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (BATTLE_STATE!=BattleState::MOVE_CAMERA) { |
|
|
|
|
SetDrawTarget(layer::INTERFACE); |
|
|
|
|
for (int i=0;i<PARTY_MEMBER_COUNT;i++) { |
|
|
|
|
Entity*member=PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]; |
|
|
|
|
Object*obj=PARTY_MEMBER_OBJ[i]; |
|
|
|
@ -1975,6 +2046,7 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
MOVELIST[BattleMoveName::TESTMOVE1]=new Battle::Move("Test Move 1","An attack",30,5,ㅍ 0,1,0,false,{0,0,0,0}); |
|
|
|
|
MOVELIST[BattleMoveName::TESTMOVE2]=new Battle::Move("Test Move 2","An attack",40,10,ㅍ 0,1,0,false,{0,0,0,0}); |
|
|
|
|
MOVELIST[BattleMoveName::TESTMOVE3]=new Battle::Move("Test Move 3","An attack",25,5,ㅍ 0,1,0,false,{0,0,20,0}); |
|
|
|
|
MOVELIST[BattleMoveName::BASH]=new Battle::Move("Bash","Regular attack.",5,5,ㅍ 0,1,0,false,{0,0,0,0}); |
|
|
|
|
MOVELIST[BattleMoveName::HAILSTORM_A]=new Battle::Move("Hailstorm","Causes heavy ice rocks to crash",ALPHA,40,20,ㅍ 4,10,0,false,{0,0,20,0}); |
|
|
|
|
MOVELIST[BattleMoveName::HAILSTORM_B]=new Battle::Move("Hailstorm","Causes heavy ice rocks to crash",BETA,80,20,ㅍ 12,10,0,false,{0,0,20,0}); |
|
|
|
|
MOVELIST[BattleMoveName::HAILSTORM_G]=new Battle::Move("Hailstorm","Causes heavy ice rocks to crash",GAMMA,120,20,ㅍ 28,10,0,false,{0,0,20,0}); |
|
|
|
@ -2016,6 +2088,8 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
CreateSprite("atbbar_back.png"); |
|
|
|
|
CreateSprite("atbbar_front.png"); |
|
|
|
|
CreateSprite("cursor.png"); |
|
|
|
|
CreateSprite("targetCircle.png"); |
|
|
|
|
CreateSprite("targetRange.png"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void SetupObjectInfo() { |
|
|
|
@ -2575,6 +2649,17 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
} |
|
|
|
|
return newStr; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//Returns -1 if not found.
|
|
|
|
|
int getProperty(Property prop,Battle::Move*move) { |
|
|
|
|
for (int i=0;i<move->properties.size();i++) { |
|
|
|
|
std::pair<Property,int> p = move->properties[i]; |
|
|
|
|
if (p.first==prop) { |
|
|
|
|
return p.second; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return -1; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|