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. 44
      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,6 +801,7 @@ 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]]->selectedMove==nullptr) {
if (PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->atb>=1000) { if (PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->atb>=1000) {
printf("%s ready.\n",PARTY_MEMBER_OBJ[i]->name.c_str()); printf("%s ready.\n",PARTY_MEMBER_OBJ[i]->name.c_str());
CURRENT_TURN=-i-1; CURRENT_TURN=-i-1;
@ -812,8 +815,10 @@ 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<BATTLE_ENCOUNTER->objs.size();i++) { for (int i=0;i<BATTLE_ENCOUNTER->objs.size();i++) {
if (BATTLE_ENCOUNTER->objs[i]->selectedMove==nullptr) {
if (BATTLE_ENCOUNTER->objs[i]->atb>=1000) { if (BATTLE_ENCOUNTER->objs[i]->atb>=1000) {
printf("%s (%d) ready.\n",BATTLE_ENCOUNTER->objs[i]->obj->name.c_str(),i); printf("%s (%d) ready.\n",BATTLE_ENCOUNTER->objs[i]->obj->name.c_str(),i);
CURRENT_TURN=i; CURRENT_TURN=i;
@ -830,6 +835,7 @@ goes on a very long time, I hope you can understand this is only for testing pur
} }
} }
} }
}
}break; }break;
case BattleState::WAIT_ANIMATION:{ case BattleState::WAIT_ANIMATION:{
BATTLE_ANIMATION_TIMER++; BATTLE_ANIMATION_TIMER++;
@ -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