Add in channel display bars

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent 270eba27c9
commit 4708a6b857
  1. BIN
      C++ProjectTemplate
  2. 90
      main.cpp

Binary file not shown.

@ -340,7 +340,9 @@ namespace Battle{
Move(std::string name,std::string desc,int baseDmg,int randomDmg,int PPCost,int range,int channelTime,bool friendly,std::array<int,4>composition,bool pctDamage=false,std::vector<std::pair<Property,int>> properties={}) Move(std::string name,std::string desc,int baseDmg,int randomDmg,int PPCost,int range,int channelTime,bool friendly,std::array<int,4>composition,bool pctDamage=false,std::vector<std::pair<Property,int>> properties={})
:Move(name,desc,0,baseDmg,randomDmg,PPCost,range,channelTime,friendly,composition,pctDamage,properties){}; :Move(name,desc,0,baseDmg,randomDmg,PPCost,range,channelTime,friendly,composition,pctDamage,properties){};
Move(std::string name,std::string desc,int grade,int baseDmg,int randomDmg,int PPCost,int range,int channelTime,bool friendly,std::array<int,4>composition,bool pctDamage=false,std::vector<std::pair<Property,int>> properties={}) Move(std::string name,std::string desc,int grade,int baseDmg,int randomDmg,int PPCost,int range,int channelTime,bool friendly,std::array<int,4>composition,bool pctDamage=false,std::vector<std::pair<Property,int>> properties={})
:name(name),grade(grade),PPCost(PPCost),desc(desc),randomDmg(randomDmg),baseDmg(baseDmg),range(range),friendly(friendly),channelTime(channelTime),composition(composition),pctDamage(pctDamage),properties(properties){} :name(name),grade(grade),PPCost(PPCost),desc(desc),randomDmg(randomDmg),baseDmg(baseDmg),range(range),friendly(friendly),channelTime(channelTime),composition(composition),pctDamage(pctDamage),properties(properties){
this->channelTime=300;
}
}; };
} }
@ -799,34 +801,38 @@ goes on a very long time, I hope you can understand this is only for testing pur
} }
if (!done) { if (!done) {
for (int i=0;i<4;i++) { for (int i=0;i<4;i++) {
if (PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->atb>=1000) { if (PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->selectedMove==nullptr) {
printf("%s ready.\n",PARTY_MEMBER_OBJ[i]->name.c_str()); if (PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->atb>=1000) {
CURRENT_TURN=-i-1; printf("%s ready.\n",PARTY_MEMBER_OBJ[i]->name.c_str());
BATTLE_STATE=BattleState::SELECT_ACTION; CURRENT_TURN=-i-1;
BATTLE_SELECTION_CURSOR=0; BATTLE_STATE=BattleState::SELECT_ACTION;
POWER_GRADE_CURSOR[-CURRENT_TURN-1]=0; BATTLE_SELECTION_CURSOR=0;
done=true; POWER_GRADE_CURSOR[-CURRENT_TURN-1]=0;
break; done=true;
} else { break;
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->atb+=PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->speed; } else {
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->atb+=PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->speed;
}
} }
} }
} }
if (!done) { if (!done) {
for (int i=0;i<BATTLE_ENCOUNTER->objs.size();i++) { for (int i=0;i<BATTLE_ENCOUNTER->objs.size();i++) {
if (BATTLE_ENCOUNTER->objs[i]->atb>=1000) { if (BATTLE_ENCOUNTER->objs[i]->selectedMove==nullptr) {
printf("%s (%d) ready.\n",BATTLE_ENCOUNTER->objs[i]->obj->name.c_str(),i); if (BATTLE_ENCOUNTER->objs[i]->atb>=1000) {
CURRENT_TURN=i; printf("%s (%d) ready.\n",BATTLE_ENCOUNTER->objs[i]->obj->name.c_str(),i);
//Enemy picks a random move from the movelist. And a random target. CURRENT_TURN=i;
BATTLE_ENCOUNTER->objs[i]->selectedMove=BATTLE_ENCOUNTER->objs[i]->moveSet[rand()%BATTLE_ENCOUNTER->objs[i]->moveSet.size()]; //Enemy picks a random move from the movelist. And a random target.
BATTLE_ENCOUNTER->objs[i]->channelTimeRemaining=BATTLE_ENCOUNTER->objs[i]->selectedMove->channelTime; BATTLE_ENCOUNTER->objs[i]->selectedMove=BATTLE_ENCOUNTER->objs[i]->moveSet[rand()%BATTLE_ENCOUNTER->objs[i]->moveSet.size()];
printf(" %s chose move %s.\n",BATTLE_ENCOUNTER->objs[i]->obj->name.c_str(),BATTLE_ENCOUNTER->objs[i]->selectedMove->name.c_str()); BATTLE_ENCOUNTER->objs[i]->channelTimeRemaining=BATTLE_ENCOUNTER->objs[i]->selectedMove->channelTime;
BATTLE_STATE=BattleState::WAIT; printf(" %s chose move %s.\n",BATTLE_ENCOUNTER->objs[i]->obj->name.c_str(),BATTLE_ENCOUNTER->objs[i]->selectedMove->name.c_str());
BATTLE_SELECTION_CURSOR=0; BATTLE_STATE=BattleState::WAIT;
done=true; BATTLE_SELECTION_CURSOR=0;
break; done=true;
} else { break;
BATTLE_ENCOUNTER->objs[i]->atb+=BATTLE_ENCOUNTER->objs[i]->speed; } else {
BATTLE_ENCOUNTER->objs[i]->atb+=BATTLE_ENCOUNTER->objs[i]->speed;
}
} }
} }
} }
@ -1781,6 +1787,39 @@ goes on a very long time, I hope you can understand this is only for testing pur
} }
DrawStringDecal(mpTextPos,"PP",olc::BLACK); DrawStringDecal(mpTextPos,"PP",olc::BLACK);
DrawRollingCounter(mpTextPos,member->PP,player_rollpp_display[i],player_rollpp_counter[i]); DrawRollingCounter(mpTextPos,member->PP,player_rollpp_display[i],player_rollpp_counter[i]);
if (member->selectedMove!=nullptr) {
vi2d barOffset={-SPRITES["atbbar_front.png"]->sprite->width/2,8};
DrawPartialDecal(obj->GetPos()+obj->originPoint-cameraPos+barOffset,SPRITES["atbbar_back.png"],{0,0},{(1-((float)member->channelTimeRemaining/member->selectedMove->channelTime))*SPRITES["atbbar_back.png"]->sprite->width,SPRITES["atbbar_back.png"]->sprite->height},{1,1},YELLOW);
DrawDecal(obj->GetPos()+obj->originPoint-cameraPos+barOffset,SPRITES["atbbar_front.png"]);
std::wstring label=to_wstring(member->selectedMove->name);
if (member->selectedMove->grade!=0) {
label+=L" ";
label+=member->selectedMove->grade;
}
vd2d textOffset=GetTextSize(to_string(label))*0.6;
textOffset.y-=6;
vi2d shadowOffset = {1,1};
DrawFancyStringDecal(obj->GetPos()+obj->originPoint-cameraPos+barOffset-textOffset/2+shadowOffset,label,BLACK,{0.6,0.6});
DrawFancyStringDecal(obj->GetPos()+obj->originPoint-cameraPos+barOffset-textOffset/2,label,WHITE,{0.6,0.6});
}
}
for (int i=0;i<BATTLE_ENCOUNTER->objs.size();i++) {
Entity*obj = BATTLE_ENCOUNTER->objs[i];
if (obj->selectedMove!=nullptr) {
vi2d barOffset={-SPRITES["atbbar_front.png"]->sprite->width/2,8};
DrawPartialDecal(obj->obj->GetPos()+obj->obj->originPoint-cameraPos+barOffset,SPRITES["atbbar_back.png"],{0,0},{(1-((float)obj->channelTimeRemaining/obj->selectedMove->channelTime))*SPRITES["atbbar_back.png"]->sprite->width,SPRITES["atbbar_back.png"]->sprite->height},{1,1},YELLOW);
DrawDecal(obj->obj->GetPos()+obj->obj->originPoint-cameraPos+barOffset,SPRITES["atbbar_front.png"]);
std::wstring label=to_wstring(obj->selectedMove->name);
if (obj->selectedMove->grade!=0) {
label+=L" ";
label+=obj->selectedMove->grade;
}
vd2d textOffset=GetTextSize(to_string(label))*0.6;
textOffset.y-=6;
vi2d shadowOffset = {1,1};
DrawFancyStringDecal(obj->obj->GetPos()+obj->obj->originPoint-cameraPos+barOffset-textOffset/2+shadowOffset,label,BLACK,{0.6,0.6});
DrawFancyStringDecal(obj->obj->GetPos()+obj->obj->originPoint-cameraPos+barOffset-textOffset/2,label,WHITE,{0.6,0.6});
}
} }
} }
} }
@ -2770,9 +2809,8 @@ goes on a very long time, I hope you can understand this is only for testing pur
int main() int main()
{ {
std::vector<std::string> list = {"Item1","Item2"};
SeasonI demo; SeasonI demo;
if (demo.Construct(WIDTH, HEIGHT, 4, 4,false,false,true)) if (demo.Construct(WIDTH, HEIGHT, 4, 4))
demo.Start(); demo.Start();
return 0; return 0;

Loading…
Cancel
Save