Size reduction on slime king per phase. Add in size transition amounts based on time.
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
bd78299c58
commit
fc65c8bcdf
@ -35,6 +35,8 @@ Key Crawler::KEY_ABILITY2=E;
|
|||||||
Key Crawler::KEY_ABILITY3=R;
|
Key Crawler::KEY_ABILITY3=R;
|
||||||
Key Crawler::KEY_ABILITY4=F;
|
Key Crawler::KEY_ABILITY4=F;
|
||||||
|
|
||||||
|
float Crawler::SIZE_CHANGE_SPEED=1;
|
||||||
|
|
||||||
Crawler::Crawler()
|
Crawler::Crawler()
|
||||||
{
|
{
|
||||||
sAppName = "Crawler Concept";
|
sAppName = "Crawler Concept";
|
||||||
|
@ -37,6 +37,7 @@ public:
|
|||||||
static Key KEY_ABILITY2;
|
static Key KEY_ABILITY2;
|
||||||
static Key KEY_ABILITY3;
|
static Key KEY_ABILITY3;
|
||||||
static Key KEY_ABILITY4;
|
static Key KEY_ABILITY4;
|
||||||
|
static float SIZE_CHANGE_SPEED;
|
||||||
private:
|
private:
|
||||||
std::vector<std::unique_ptr<Effect>>foregroundEffects,backgroundEffects,foregroundEffectsToBeInserted,backgroundEffectsToBeInserted;
|
std::vector<std::unique_ptr<Effect>>foregroundEffects,backgroundEffects,foregroundEffectsToBeInserted,backgroundEffectsToBeInserted;
|
||||||
std::map<MapName,Map>MAP_DATA;
|
std::map<MapName,Map>MAP_DATA;
|
||||||
|
@ -20,7 +20,7 @@ safemap<int,std::string>STRATEGY_ID_DATA;
|
|||||||
std::map<int,Renderable*>MonsterData::imgs;
|
std::map<int,Renderable*>MonsterData::imgs;
|
||||||
|
|
||||||
Monster::Monster(vf2d pos,MonsterData data,bool upperLevel):
|
Monster::Monster(vf2d pos,MonsterData data,bool upperLevel):
|
||||||
pos(pos),hp(data.GetHealth()),maxhp(data.GetHealth()),atk(data.GetAttack()),moveSpd(data.GetMoveSpdMult()),size(data.GetSizeMult()),strategy(data.GetAIStrategy()),id(data.GetID()),upperLevel(upperLevel){
|
pos(pos),hp(data.GetHealth()),maxhp(data.GetHealth()),atk(data.GetAttack()),moveSpd(data.GetMoveSpdMult()),size(data.GetSizeMult()),targetSize(data.GetSizeMult()),strategy(data.GetAIStrategy()),id(data.GetID()),upperLevel(upperLevel){
|
||||||
bool firstAnimation=true;
|
bool firstAnimation=true;
|
||||||
for(std::string&anim:data.GetAnimations()){
|
for(std::string&anim:data.GetAnimations()){
|
||||||
animation.AddState(anim,ANIMATION_DATA[anim]);
|
animation.AddState(anim,ANIMATION_DATA[anim]);
|
||||||
@ -110,6 +110,13 @@ bool Monster::SetY(float y){
|
|||||||
bool Monster::Update(float fElapsedTime){
|
bool Monster::Update(float fElapsedTime){
|
||||||
lastHitTimer=std::max(0.f,lastHitTimer-fElapsedTime);
|
lastHitTimer=std::max(0.f,lastHitTimer-fElapsedTime);
|
||||||
iframe_timer=std::max(0.f,iframe_timer-fElapsedTime);
|
iframe_timer=std::max(0.f,iframe_timer-fElapsedTime);
|
||||||
|
if(size!=targetSize){
|
||||||
|
if(size>targetSize){
|
||||||
|
size=std::max(targetSize,size-Crawler::SIZE_CHANGE_SPEED*fElapsedTime);
|
||||||
|
}else{
|
||||||
|
size=std::min(targetSize,size+Crawler::SIZE_CHANGE_SPEED*fElapsedTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
if(IsAlive()){
|
if(IsAlive()){
|
||||||
for(std::vector<Buff>::iterator it=buffList.begin();it!=buffList.end();++it){
|
for(std::vector<Buff>::iterator it=buffList.begin();it!=buffList.end();++it){
|
||||||
Buff&b=*it;
|
Buff&b=*it;
|
||||||
@ -273,6 +280,7 @@ vf2d MonsterSpawner::GetRange(){
|
|||||||
vf2d MonsterSpawner::GetPos(){
|
vf2d MonsterSpawner::GetPos(){
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MonsterSpawner::SetTriggered(bool trigger,bool spawnMonsters){
|
void MonsterSpawner::SetTriggered(bool trigger,bool spawnMonsters){
|
||||||
triggered=trigger;
|
triggered=trigger;
|
||||||
if(spawnMonsters){
|
if(spawnMonsters){
|
||||||
@ -366,3 +374,11 @@ float Monster::GetZ(){
|
|||||||
std::string Monster::GetStrategy(){
|
std::string Monster::GetStrategy(){
|
||||||
return STRATEGY_ID_DATA[strategy];
|
return STRATEGY_ID_DATA[strategy];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Monster::SetSize(float newSize,bool immediate){
|
||||||
|
if(immediate){
|
||||||
|
size=targetSize=newSize;
|
||||||
|
}else{
|
||||||
|
targetSize=newSize;
|
||||||
|
}
|
||||||
|
}
|
@ -88,6 +88,7 @@ private:
|
|||||||
int phase=0;
|
int phase=0;
|
||||||
bool diesNormally=true; //If set to false, the monster death is handled in a special way. Set it to true when it's time to die.
|
bool diesNormally=true; //If set to false, the monster death is handled in a special way. Set it to true when it's time to die.
|
||||||
float iframeTimeUponHit=0;
|
float iframeTimeUponHit=0;
|
||||||
|
float targetSize=0;
|
||||||
protected:
|
protected:
|
||||||
public:
|
public:
|
||||||
Monster()=delete;
|
Monster()=delete;
|
||||||
@ -132,6 +133,7 @@ public:
|
|||||||
bool HasIframes();
|
bool HasIframes();
|
||||||
float GetZ();
|
float GetZ();
|
||||||
std::string GetStrategy();
|
std::string GetStrategy();
|
||||||
|
void SetSize(float newSize,bool immediate=true);
|
||||||
private:
|
private:
|
||||||
struct STRATEGY{
|
struct STRATEGY{
|
||||||
static int _GetInt(Monster&m,std::string param,int strategyNumber,int index=0);
|
static int _GetInt(Monster&m,std::string param,int strategyNumber,int index=0);
|
||||||
|
@ -18,16 +18,19 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe
|
|||||||
case 1:{
|
case 1:{
|
||||||
if(m.hp<=m.maxhp*ConfigFloat("Phase2.Change")/100){
|
if(m.hp<=m.maxhp*ConfigFloat("Phase2.Change")/100){
|
||||||
m.phase=2;
|
m.phase=2;
|
||||||
|
m.SetSize(ConfigFloat("Phase2.Size")/100,false);
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
case 2:{
|
case 2:{
|
||||||
if(m.hp<=m.maxhp*ConfigFloat("Phase3.Change")/100){
|
if(m.hp<=m.maxhp*ConfigFloat("Phase3.Change")/100){
|
||||||
m.phase=3;
|
m.phase=3;
|
||||||
|
m.SetSize(ConfigFloat("Phase3.Size")/100,false);
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
case 3:{
|
case 3:{
|
||||||
if(m.hp<=m.maxhp*ConfigFloat("Phase4.Change")/100){
|
if(m.hp<=m.maxhp*ConfigFloat("Phase4.Change")/100){
|
||||||
m.phase=4;
|
m.phase=4;
|
||||||
|
m.SetSize(ConfigFloat("Phase4.Size")/100,false);
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
case 4:{
|
case 4:{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user