diff --git a/C++ProjectTemplate b/C++ProjectTemplate index 5f1e13e..50519ea 100755 Binary files a/C++ProjectTemplate and b/C++ProjectTemplate differ diff --git a/main.cpp b/main.cpp index 18da8ac..275456c 100644 --- a/main.cpp +++ b/main.cpp @@ -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::arraycomposition,bool pctDamage=false,std::vector> 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::arraycomposition,bool pctDamage=false,std::vector> 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) { for (int i=0;i<4;i++) { - if (PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->atb>=1000) { - printf("%s ready.\n",PARTY_MEMBER_OBJ[i]->name.c_str()); - CURRENT_TURN=-i-1; - BATTLE_STATE=BattleState::SELECT_ACTION; - BATTLE_SELECTION_CURSOR=0; - POWER_GRADE_CURSOR[-CURRENT_TURN-1]=0; - done=true; - break; - } else { - PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->atb+=PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->speed; + if (PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->selectedMove==nullptr) { + if (PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->atb>=1000) { + printf("%s ready.\n",PARTY_MEMBER_OBJ[i]->name.c_str()); + CURRENT_TURN=-i-1; + BATTLE_STATE=BattleState::SELECT_ACTION; + BATTLE_SELECTION_CURSOR=0; + POWER_GRADE_CURSOR[-CURRENT_TURN-1]=0; + done=true; + break; + } else { + PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->atb+=PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->speed; + } } } } if (!done) { for (int i=0;iobjs.size();i++) { - if (BATTLE_ENCOUNTER->objs[i]->atb>=1000) { - printf("%s (%d) ready.\n",BATTLE_ENCOUNTER->objs[i]->obj->name.c_str(),i); - CURRENT_TURN=i; - //Enemy picks a random move from the movelist. And a random target. - BATTLE_ENCOUNTER->objs[i]->selectedMove=BATTLE_ENCOUNTER->objs[i]->moveSet[rand()%BATTLE_ENCOUNTER->objs[i]->moveSet.size()]; - BATTLE_ENCOUNTER->objs[i]->channelTimeRemaining=BATTLE_ENCOUNTER->objs[i]->selectedMove->channelTime; - printf(" %s chose move %s.\n",BATTLE_ENCOUNTER->objs[i]->obj->name.c_str(),BATTLE_ENCOUNTER->objs[i]->selectedMove->name.c_str()); - BATTLE_STATE=BattleState::WAIT; - BATTLE_SELECTION_CURSOR=0; - done=true; - break; - } else { - BATTLE_ENCOUNTER->objs[i]->atb+=BATTLE_ENCOUNTER->objs[i]->speed; + if (BATTLE_ENCOUNTER->objs[i]->selectedMove==nullptr) { + if (BATTLE_ENCOUNTER->objs[i]->atb>=1000) { + printf("%s (%d) ready.\n",BATTLE_ENCOUNTER->objs[i]->obj->name.c_str(),i); + CURRENT_TURN=i; + //Enemy picks a random move from the movelist. And a random target. + BATTLE_ENCOUNTER->objs[i]->selectedMove=BATTLE_ENCOUNTER->objs[i]->moveSet[rand()%BATTLE_ENCOUNTER->objs[i]->moveSet.size()]; + BATTLE_ENCOUNTER->objs[i]->channelTimeRemaining=BATTLE_ENCOUNTER->objs[i]->selectedMove->channelTime; + printf(" %s chose move %s.\n",BATTLE_ENCOUNTER->objs[i]->obj->name.c_str(),BATTLE_ENCOUNTER->objs[i]->selectedMove->name.c_str()); + BATTLE_STATE=BattleState::WAIT; + BATTLE_SELECTION_CURSOR=0; + done=true; + break; + } 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); 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;iobjs.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() { - std::vector list = {"Item1","Item2"}; SeasonI demo; - if (demo.Construct(WIDTH, HEIGHT, 4, 4,false,false,true)) + if (demo.Construct(WIDTH, HEIGHT, 4, 4)) demo.Start(); return 0;