Fix wstring conversion on battle power display text, added shadow to battle action display text

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent 0aac9f825f
commit 7caf140c1b
  1. BIN
      C++ProjectTemplate
  2. 1
      battle.h
  3. 1
      defines.h
  4. 2
      encounters.h
  5. 17
      main.cpp

Binary file not shown.

@ -12,6 +12,7 @@ enum class BattleMoveName{
BASH, BASH,
BASH_CHANGE, BASH_CHANGE,
DEFEND, DEFEND,
EQUIP_ARMOR,
HAILSTORM_A, HAILSTORM_A,
HAILSTORM_B, HAILSTORM_B,
HAILSTORM_G, HAILSTORM_G,

@ -13,6 +13,7 @@ using namespace olc;
#define PARTY_TRAIL_LENGTH 48 #define PARTY_TRAIL_LENGTH 48
#define CAMERA_WAIT_TIME 60 #define CAMERA_WAIT_TIME 60
#define HEALTH_ROLLING_SPEED 2 #define HEALTH_ROLLING_SPEED 2
#define NO_TARGET -99
#define ㅎ #define ㅎ
#define ㅍ #define ㅍ

@ -36,7 +36,7 @@ class Entity{
int atb=0; //When this value reaches 1000, it's this entity's turn. int atb=0; //When this value reaches 1000, it's this entity's turn.
Object* obj; Object* obj;
std::vector<Battle::Move*> moveSet; std::vector<Battle::Move*> moveSet;
int selectedTarget = 0; int selectedTarget = NO_TARGET;
Battle::Move*selectedMove = nullptr; //The index of the selected move. Battle::Move*selectedMove = nullptr; //The index of the selected move.
int channelTimeRemaining = 0; //The amount of channel time left until move can be performed. int channelTimeRemaining = 0; //The amount of channel time left until move can be performed.
vd2d channelPos = {0,0}; //Where our channel is happening. vd2d channelPos = {0,0}; //Where our channel is happening.

@ -1329,13 +1329,16 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
label=label.replace(label.find(L"$USER"),5,transform_to<std::wstring>(BATTLE_ENCOUNTER->objs[CURRENT_TURN]->obj->name)); label=label.replace(label.find(L"$USER"),5,transform_to<std::wstring>(BATTLE_ENCOUNTER->objs[CURRENT_TURN]->obj->name));
} }
if (label.find(L"$POWER")!=std::string::npos) { if (label.find(L"$POWER")!=std::string::npos) {
label=label.replace(label.find(L"$POWER"),6,transform_to<std::wstring>((BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove->grade!=0)?std::wstring(1,BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove->grade):L"")); label=label.replace(label.find(L"$POWER"),6,transform_to<std::wstring>(BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove->name)+L" "+((BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove->grade!=0)?std::wstring(1,BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove->grade):L""));
} }
if (label.find(L"$ITEM")!=std::string::npos) { if (label.find(L"$ITEM")!=std::string::npos) {
label=label.replace(label.find(L"$ITEM"),5,transform_to<std::wstring>(BATTLE_ENCOUNTER->objs[CURRENT_TURN]->equipment[EquipSlot::WEAPON]->name)); label=label.replace(label.find(L"$ITEM"),5,transform_to<std::wstring>(BATTLE_ENCOUNTER->objs[CURRENT_TURN]->equipment[EquipSlot::WEAPON]->name));
} }
} }
DrawFancyStringDecal({2,2},Wrap(label,ScreenWidth()-2,false,{1,2}),WHITE,{1,2}); vd2d text={2,2};
vd2d shadowOffset={1,1};
DrawFancyStringDecal(text+shadowOffset,Wrap(label,ScreenWidth()-2,false,{1,2}),BLACK,{1,2});
DrawFancyStringDecal(text,Wrap(label,ScreenWidth()-2,false,{1,2}),WHITE,{1,2});
} }
if (BATTLE_STATE!=BattleState::MOVE_CAMERA) { if (BATTLE_STATE!=BattleState::MOVE_CAMERA) {
SetDrawTarget(layer::INTERFACE); SetDrawTarget(layer::INTERFACE);
@ -1874,6 +1877,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
MOVELIST[BattleMoveName::BASH]=new Battle::Move("Bash","Regular attack.",5,5, 0,1,0,false,{0,0,0,0}); MOVELIST[BattleMoveName::BASH]=new Battle::Move("Bash","Regular attack.",5,5, 0,1,0,false,{0,0,0,0});
MOVELIST[BattleMoveName::BASH_CHANGE]=new Battle::Move(MOVELIST[BattleMoveName::BASH]->name,"Regular attack.",MOVELIST[BattleMoveName::BASH]->baseDmg,MOVELIST[BattleMoveName::BASH]->randomDmg, MOVELIST[BattleMoveName::BASH]->PPCost,MOVELIST[BattleMoveName::BASH]->range,MOVELIST[BattleMoveName::BASH]->composition,L"$USER equipped the $ITEM instead and attacks.",MOVELIST[BattleMoveName::BASH]->eff,MOVELIST[BattleMoveName::BASH]->pctDamage,MOVELIST[BattleMoveName::BASH]->properties); MOVELIST[BattleMoveName::BASH_CHANGE]=new Battle::Move(MOVELIST[BattleMoveName::BASH]->name,"Regular attack.",MOVELIST[BattleMoveName::BASH]->baseDmg,MOVELIST[BattleMoveName::BASH]->randomDmg, MOVELIST[BattleMoveName::BASH]->PPCost,MOVELIST[BattleMoveName::BASH]->range,MOVELIST[BattleMoveName::BASH]->composition,L"$USER equipped the $ITEM instead and attacks.",MOVELIST[BattleMoveName::BASH]->eff,MOVELIST[BattleMoveName::BASH]->pctDamage,MOVELIST[BattleMoveName::BASH]->properties);
MOVELIST[BattleMoveName::DEFEND]=new Battle::Move("Defend","Defend.",0,0, 0,1,5*60,true,{0,0,0,0}); MOVELIST[BattleMoveName::DEFEND]=new Battle::Move("Defend","Defend.",0,0, 0,1,5*60,true,{0,0,0,0});
MOVELIST[BattleMoveName::EQUIP_ARMOR]=new Battle::Move("Defend","Defend.",0,0, 0,1,5*60,true,{0,0,0,0});
MOVELIST[BattleMoveName::HAILSTORM_A]=new Battle::Move("Hailstorm","Causes heavy ice rocks to crash",ALPHA,40,20, 4,4,0,false,{0,0,20,0}); MOVELIST[BattleMoveName::HAILSTORM_A]=new Battle::Move("Hailstorm","Causes heavy ice rocks to crash",ALPHA,40,20, 4,4,0,false,{0,0,20,0});
MOVELIST[BattleMoveName::HAILSTORM_B]=new Battle::Move("Hailstorm","Causes heavy ice rocks to crash",BETA,80,20, 12,4,0,false,{0,0,20,0}); MOVELIST[BattleMoveName::HAILSTORM_B]=new Battle::Move("Hailstorm","Causes heavy ice rocks to crash",BETA,80,20, 12,4,0,false,{0,0,20,0});
MOVELIST[BattleMoveName::HAILSTORM_G]=new Battle::Move("Hailstorm","Causes heavy ice rocks to crash",GAMMA,120,20, 28,4,0,false,{0,0,20,0}); MOVELIST[BattleMoveName::HAILSTORM_G]=new Battle::Move("Hailstorm","Causes heavy ice rocks to crash",GAMMA,120,20, 28,4,0,false,{0,0,20,0});
@ -2713,6 +2717,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
} }
if (CURRENT_EFFECT==nullptr&&BATTLE_ANIMATION_TIMER==90||CURRENT_EFFECT!=nullptr&&BATTLE_ANIMATION_TIMER>CURRENT_EFFECT->maxLifeTime) { if (CURRENT_EFFECT==nullptr&&BATTLE_ANIMATION_TIMER==90||CURRENT_EFFECT!=nullptr&&BATTLE_ANIMATION_TIMER>CURRENT_EFFECT->maxLifeTime) {
if (CURRENT_TURN<0) { if (CURRENT_TURN<0) {
if (PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedTarget!=NO_TARGET) {
if (PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove->friendly) { 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) { 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)) { 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)) {
@ -2749,7 +2754,9 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
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 " << BATTLE_ENCOUNTER->objs[PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedTarget]->obj->name << " but it failed.\n"; 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 " << BATTLE_ENCOUNTER->objs[PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedTarget]->obj->name << " but it failed.\n";
} }
} }
}
} else { } else {
if (BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedTarget!=-NO_TARGET) {
if (BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove->friendly) { if (BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove->friendly) {
if (BATTLE_ENCOUNTER->objs[BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedTarget]->GetHP()>0) { 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)) { for (auto&ent:GetEntitiesInRange(BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedTarget,BATTLE_ENCOUNTER->objs[CURRENT_TURN]->channelPos,BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove)) {
@ -2787,11 +2794,13 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
} }
} }
} }
}
} else } else
if (CURRENT_EFFECT==nullptr&&BATTLE_ANIMATION_TIMER>120||CURRENT_EFFECT!=nullptr&&BATTLE_ANIMATION_TIMER>CURRENT_EFFECT->maxLifeTime+30) { if (CURRENT_EFFECT==nullptr&&BATTLE_ANIMATION_TIMER>120||CURRENT_EFFECT!=nullptr&&BATTLE_ANIMATION_TIMER>CURRENT_EFFECT->maxLifeTime+30) {
//Turn's done! //Turn's done!
if (CURRENT_TURN<0) { if (CURRENT_TURN<0) {
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove=nullptr; PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove=nullptr;
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedTarget=NO_TARGET;
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->atb=0; PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->atb=0;
BATTLE_STATE=BattleState::WAIT; BATTLE_STATE=BattleState::WAIT;
if (previousEquip[-CURRENT_TURN-1]!=-1) { if (previousEquip[-CURRENT_TURN-1]!=-1) {
@ -2800,9 +2809,9 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
printf("Equipped item: %s\n",PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->equipment[PrevEquip->stats.equip]->name.c_str()); printf("Equipped item: %s\n",PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->equipment[PrevEquip->stats.equip]->name.c_str());
previousEquip[-CURRENT_TURN-1]=-1; previousEquip[-CURRENT_TURN-1]=-1;
} }
CURRENT_TURN=-99;
} else { } else {
BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove=nullptr; BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove=nullptr;
BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedTarget=NO_TARGET;
BATTLE_ENCOUNTER->objs[CURRENT_TURN]->atb=0; BATTLE_ENCOUNTER->objs[CURRENT_TURN]->atb=0;
BATTLE_STATE=BattleState::WAIT; BATTLE_STATE=BattleState::WAIT;
} }
@ -2830,6 +2839,8 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->_SetDirectPP(PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->GetTargetPP()); PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->_SetDirectPP(PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->GetTargetPP());
} }
} }
CURRENT_TURN=-99;
} }
}break; }break;
case BattleState::SELECT_ACTION: case BattleState::SELECT_ACTION:

Loading…
Cancel
Save