generated from sigonasr2/CPlusPlusProjectTemplate
Fix wstring conversion on battle power display text, added shadow to battle action display text
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
0aac9f825f
commit
7caf140c1b
Binary file not shown.
1
battle.h
1
battle.h
@ -12,6 +12,7 @@ enum class BattleMoveName{
|
||||
BASH,
|
||||
BASH_CHANGE,
|
||||
DEFEND,
|
||||
EQUIP_ARMOR,
|
||||
HAILSTORM_A,
|
||||
HAILSTORM_B,
|
||||
HAILSTORM_G,
|
||||
|
@ -13,6 +13,7 @@ using namespace olc;
|
||||
#define PARTY_TRAIL_LENGTH 48
|
||||
#define CAMERA_WAIT_TIME 60
|
||||
#define HEALTH_ROLLING_SPEED 2
|
||||
#define NO_TARGET -99
|
||||
|
||||
#define ㅎ
|
||||
#define ㅍ
|
||||
|
@ -36,7 +36,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;
|
||||
int selectedTarget = NO_TARGET;
|
||||
Battle::Move*selectedMove = nullptr; //The index of the selected move.
|
||||
int channelTimeRemaining = 0; //The amount of channel time left until move can be performed.
|
||||
vd2d channelPos = {0,0}; //Where our channel is happening.
|
||||
|
17
main.cpp
17
main.cpp
@ -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));
|
||||
}
|
||||
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) {
|
||||
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) {
|
||||
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_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::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_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});
|
||||
@ -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_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_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)) {
|
||||
@ -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";
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedTarget!=-NO_TARGET) {
|
||||
if (BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove->friendly) {
|
||||
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)) {
|
||||
@ -2787,11 +2794,13 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
if (CURRENT_EFFECT==nullptr&&BATTLE_ANIMATION_TIMER>120||CURRENT_EFFECT!=nullptr&&BATTLE_ANIMATION_TIMER>CURRENT_EFFECT->maxLifeTime+30) {
|
||||
//Turn's done!
|
||||
if (CURRENT_TURN<0) {
|
||||
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;
|
||||
BATTLE_STATE=BattleState::WAIT;
|
||||
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());
|
||||
previousEquip[-CURRENT_TURN-1]=-1;
|
||||
}
|
||||
CURRENT_TURN=-99;
|
||||
} else {
|
||||
BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove=nullptr;
|
||||
BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedTarget=NO_TARGET;
|
||||
BATTLE_ENCOUNTER->objs[CURRENT_TURN]->atb=0;
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
CURRENT_TURN=-99;
|
||||
}
|
||||
}break;
|
||||
case BattleState::SELECT_ACTION:
|
||||
|
Loading…
x
Reference in New Issue
Block a user