generated from sigonasr2/CPlusPlusProjectTemplate
Effects can be tied to attacks in battle, and animation lifetimes are respected.
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
1d45800bfd
commit
06418582fb
Binary file not shown.
6
effect.h
6
effect.h
@ -1,6 +1,7 @@
|
|||||||
class Effect{
|
class Effect{
|
||||||
public:
|
public:
|
||||||
std::vector<Particle*> particles;
|
std::vector<Particle*> particles;
|
||||||
|
int maxLifeTime=0;
|
||||||
virtual void create(std::vector<Particle*>&PARTICLES)=0;
|
virtual void create(std::vector<Particle*>&PARTICLES)=0;
|
||||||
virtual bool update()=0;
|
virtual bool update()=0;
|
||||||
Effect(){}
|
Effect(){}
|
||||||
@ -13,11 +14,12 @@ class Effect{
|
|||||||
|
|
||||||
class FountainEffect:public Effect{
|
class FountainEffect:public Effect{
|
||||||
int fountainDensity=0;
|
int fountainDensity=0;
|
||||||
int maxLifeTime=0;
|
|
||||||
int lifetime=0;
|
int lifetime=0;
|
||||||
public:
|
public:
|
||||||
FountainEffect(int fountainDensity,int lifetime)
|
FountainEffect(int fountainDensity,int lifetime)
|
||||||
:fountainDensity(fountainDensity),lifetime(lifetime),maxLifeTime(lifetime){}
|
:fountainDensity(fountainDensity),lifetime(lifetime){
|
||||||
|
this->maxLifeTime=lifetime;
|
||||||
|
}
|
||||||
void create(std::vector<Particle*>&PARTICLES){
|
void create(std::vector<Particle*>&PARTICLES){
|
||||||
lifetime=maxLifeTime;
|
lifetime=maxLifeTime;
|
||||||
for (int i=0;i<fountainDensity;i++) {
|
for (int i=0;i<fountainDensity;i++) {
|
||||||
|
|||||||
33
main.cpp
33
main.cpp
@ -335,13 +335,14 @@ namespace Battle{
|
|||||||
int range=1; //The range of this ability in tiles.
|
int range=1; //The range of this ability in tiles.
|
||||||
int channelTime=0; //The amount of frames to channel the spell.
|
int channelTime=0; //The amount of frames to channel the spell.
|
||||||
bool friendly=false; //Target allies instead.
|
bool friendly=false; //Target allies instead.
|
||||||
|
Effect*eff=nullptr;
|
||||||
//Assumes friendly is false.
|
//Assumes friendly is false.
|
||||||
Move(std::string name,std::string desc,int baseDmg,int randomDmg,int PPCost,int range,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,std::array<int,4>composition,Effect*eff=nullptr,bool pctDamage=false,std::vector<std::pair<Property,int>> properties={})
|
||||||
:Move(name,desc,0,baseDmg,randomDmg,PPCost,range,0,false,composition,pctDamage,properties){};
|
:Move(name,desc,0,baseDmg,randomDmg,PPCost,range,0,false,composition,eff,pctDamage,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(std::string name,std::string desc,int baseDmg,int randomDmg,int PPCost,int range,int channelTime,bool friendly,std::array<int,4>composition,Effect*eff=nullptr,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,eff,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,Effect*eff=nullptr,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),eff(eff),channelTime(channelTime),composition(composition),pctDamage(pctDamage),properties(properties){}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -549,7 +550,7 @@ public:
|
|||||||
ConsoleCaptureStdOut(true);
|
ConsoleCaptureStdOut(true);
|
||||||
// Called once at the start, so create things here
|
// Called once at the start, so create things here
|
||||||
|
|
||||||
FOUNTAIN_EFFECT = new FountainEffect(250,2000);
|
FOUNTAIN_EFFECT = new FountainEffect(250,200);
|
||||||
|
|
||||||
EnableLayer(layer::COLLISION,false);
|
EnableLayer(layer::COLLISION,false);
|
||||||
|
|
||||||
@ -2009,10 +2010,10 @@ goes on a very long time, I hope you can understand this is only for testing pur
|
|||||||
MOVELIST[BattleMoveName::PKLIFEUP_B]=new Battle::Move("PK Lifeup","Restores a moderate amount of health.",BETA,240,60,ㅍ 9,1,0,true,{0,0,20,0});
|
MOVELIST[BattleMoveName::PKLIFEUP_B]=new Battle::Move("PK Lifeup","Restores a moderate amount of health.",BETA,240,60,ㅍ 9,1,0,true,{0,0,20,0});
|
||||||
MOVELIST[BattleMoveName::PKLIFEUP_G]=new Battle::Move("PK Lifeup","Restores a large amount of health.",GAMMA,400,50,ㅍ 21,3,0,true,{0,0,20,0});
|
MOVELIST[BattleMoveName::PKLIFEUP_G]=new Battle::Move("PK Lifeup","Restores a large amount of health.",GAMMA,400,50,ㅍ 21,3,0,true,{0,0,20,0});
|
||||||
MOVELIST[BattleMoveName::PKLIFEUP_O]=new Battle::Move("PK Lifeup","Restores a great amount of health to all allies.",OMEGA,800,100,ㅍ 64,6,0,true,{0,0,20,0});
|
MOVELIST[BattleMoveName::PKLIFEUP_O]=new Battle::Move("PK Lifeup","Restores a great amount of health to all allies.",OMEGA,800,100,ㅍ 64,6,0,true,{0,0,20,0});
|
||||||
MOVELIST[BattleMoveName::PKFUN_A]=new Battle::Move("PK Fun","A very fun barrage. Hits for large damage.",ALPHA,100,10,ㅍ 15,6,0,false,{0,0,20,0});
|
MOVELIST[BattleMoveName::PKFUN_A]=new Battle::Move("PK Fun","A very fun barrage. Hits for large damage.",ALPHA,100,10,ㅍ 15,6,0,false,{0,0,20,0},FOUNTAIN_EFFECT);
|
||||||
MOVELIST[BattleMoveName::PKFUN_B]=new Battle::Move("PK Fun","A very fun barrage. Hits for large damage.",BETA,240,40,ㅍ 30,6,0,false,{0,0,20,0});
|
MOVELIST[BattleMoveName::PKFUN_B]=new Battle::Move("PK Fun","A very fun barrage. Hits for large damage.",BETA,240,40,ㅍ 30,6,0,false,{0,0,20,0},FOUNTAIN_EFFECT);
|
||||||
MOVELIST[BattleMoveName::PKFUN_G]=new Battle::Move("PK Fun","A very fun barrage. Hits for large damage.",GAMMA,360,80,ㅍ 45,7,0,false,{0,0,20,0});
|
MOVELIST[BattleMoveName::PKFUN_G]=new Battle::Move("PK Fun","A very fun barrage. Hits for large damage.",GAMMA,360,80,ㅍ 45,7,0,false,{0,0,20,0},FOUNTAIN_EFFECT);
|
||||||
MOVELIST[BattleMoveName::PKFUN_O]=new Battle::Move("PK Fun","A very fun barrage. Hits for large damage.",OMEGA,590,100,ㅍ 90,8,0,false,{0,0,20,0});
|
MOVELIST[BattleMoveName::PKFUN_O]=new Battle::Move("PK Fun","A very fun barrage. Hits for large damage.",OMEGA,590,100,ㅍ 90,8,0,false,{0,0,20,0},FOUNTAIN_EFFECT);
|
||||||
MOVELIST[BattleMoveName::PKFIRE_A]=new Battle::Move("PK Fire","Causes extreme heat to burn foes and scorch trees",ALPHA,60,20,ㅍ 6,3,0,false,{0,0,20,0});
|
MOVELIST[BattleMoveName::PKFIRE_A]=new Battle::Move("PK Fire","Causes extreme heat to burn foes and scorch trees",ALPHA,60,20,ㅍ 6,3,0,false,{0,0,20,0});
|
||||||
MOVELIST[BattleMoveName::PKFIRE_B]=new Battle::Move("PK Fire","Causes extreme heat to burn foes and scorch trees",BETA,120,40,ㅍ 12,4,0,false,{0,0,20,0});
|
MOVELIST[BattleMoveName::PKFIRE_B]=new Battle::Move("PK Fire","Causes extreme heat to burn foes and scorch trees",BETA,120,40,ㅍ 12,4,0,false,{0,0,20,0});
|
||||||
MOVELIST[BattleMoveName::PKFIRE_G]=new Battle::Move("PK Fire","Causes extreme heat to burn foes and scorch trees",GAMMA,190,50,ㅍ 20,5,0,false,{0,0,20,0});
|
MOVELIST[BattleMoveName::PKFIRE_G]=new Battle::Move("PK Fire","Causes extreme heat to burn foes and scorch trees",GAMMA,190,50,ㅍ 20,5,0,false,{0,0,20,0});
|
||||||
@ -2890,7 +2891,13 @@ goes on a very long time, I hope you can understand this is only for testing pur
|
|||||||
case BattleState::WAIT_ANIMATION:{
|
case BattleState::WAIT_ANIMATION:{
|
||||||
BATTLE_ROLLING_COUNTER_WAITTIME=5;
|
BATTLE_ROLLING_COUNTER_WAITTIME=5;
|
||||||
BATTLE_ANIMATION_TIMER++;
|
BATTLE_ANIMATION_TIMER++;
|
||||||
if (BATTLE_ANIMATION_TIMER==90) {
|
if (BATTLE_ANIMATION_TIMER==30) {
|
||||||
|
Effect*eff=(CURRENT_TURN<0)?PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove->eff:BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove->eff;
|
||||||
|
if (eff!=nullptr) {
|
||||||
|
StartEffect(eff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CURRENT_EFFECT==nullptr&&BATTLE_ANIMATION_TIMER==90||CURRENT_EFFECT!=nullptr&&BATTLE_ANIMATION_TIMER>CURRENT_EFFECT->maxLifeTime-30) {
|
||||||
if (CURRENT_TURN<0) {
|
if (CURRENT_TURN<0) {
|
||||||
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) {
|
||||||
@ -2955,7 +2962,7 @@ goes on a very long time, I hope you can understand this is only for testing pur
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (BATTLE_ANIMATION_TIMER>120) {
|
if (CURRENT_EFFECT==nullptr&&BATTLE_ANIMATION_TIMER>120||CURRENT_EFFECT!=nullptr&&BATTLE_ANIMATION_TIMER>CURRENT_EFFECT->maxLifeTime) {
|
||||||
//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;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user