Size reduction on slime king per phase. Add in size transition amounts based on time.

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
pull/28/head
Nic0Nic0Nii 1 year ago
parent 46ead6262b
commit a69be08a1a
  1. 2
      Crawler/Crawler.cpp
  2. 1
      Crawler/Crawler.h
  3. 18
      Crawler/Monster.cpp
  4. 2
      Crawler/Monster.h
  5. 3
      Crawler/SlimeKing.cpp

@ -35,6 +35,8 @@ Key Crawler::KEY_ABILITY2=E;
Key Crawler::KEY_ABILITY3=R;
Key Crawler::KEY_ABILITY4=F;
float Crawler::SIZE_CHANGE_SPEED=1;
Crawler::Crawler()
{
sAppName = "Crawler Concept";

@ -37,6 +37,7 @@ public:
static Key KEY_ABILITY2;
static Key KEY_ABILITY3;
static Key KEY_ABILITY4;
static float SIZE_CHANGE_SPEED;
private:
std::vector<std::unique_ptr<Effect>>foregroundEffects,backgroundEffects,foregroundEffectsToBeInserted,backgroundEffectsToBeInserted;
std::map<MapName,Map>MAP_DATA;

@ -20,7 +20,7 @@ safemap<int,std::string>STRATEGY_ID_DATA;
std::map<int,Renderable*>MonsterData::imgs;
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;
for(std::string&anim:data.GetAnimations()){
animation.AddState(anim,ANIMATION_DATA[anim]);
@ -110,6 +110,13 @@ bool Monster::SetY(float y){
bool Monster::Update(float fElapsedTime){
lastHitTimer=std::max(0.f,lastHitTimer-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()){
for(std::vector<Buff>::iterator it=buffList.begin();it!=buffList.end();++it){
Buff&b=*it;
@ -273,6 +280,7 @@ vf2d MonsterSpawner::GetRange(){
vf2d MonsterSpawner::GetPos(){
return pos;
}
void MonsterSpawner::SetTriggered(bool trigger,bool spawnMonsters){
triggered=trigger;
if(spawnMonsters){
@ -366,3 +374,11 @@ float Monster::GetZ(){
std::string Monster::GetStrategy(){
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;
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 targetSize=0;
protected:
public:
Monster()=delete;
@ -132,6 +133,7 @@ public:
bool HasIframes();
float GetZ();
std::string GetStrategy();
void SetSize(float newSize,bool immediate=true);
private:
struct STRATEGY{
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:{
if(m.hp<=m.maxhp*ConfigFloat("Phase2.Change")/100){
m.phase=2;
m.SetSize(ConfigFloat("Phase2.Size")/100,false);
}
}break;
case 2:{
if(m.hp<=m.maxhp*ConfigFloat("Phase3.Change")/100){
m.phase=3;
m.SetSize(ConfigFloat("Phase3.Size")/100,false);
}
}break;
case 3:{
if(m.hp<=m.maxhp*ConfigFloat("Phase4.Change")/100){
m.phase=4;
m.SetSize(ConfigFloat("Phase4.Size")/100,false);
}
}break;
case 4:{

Loading…
Cancel
Save