Build 1418. Slime King fight is fully implemented.

pull/28/head
sigonasr2 1 year ago
parent caddaefb02
commit 3f60180b68
  1. 3
      Crawler/Monster.cpp
  2. 4
      Crawler/MonsterAttribute.h
  3. 19
      Crawler/SlimeKing.cpp
  4. 2
      Crawler/Version.h
  5. 2
      Crawler/assets/config/MonsterStrategies.txt
  6. 8242
      Crawler/pge.data
  7. 2
      Crawler/pge.js
  8. BIN
      Crawler/pge.wasm
  9. BIN
      x64/Release/Crawler.exe

@ -259,7 +259,10 @@ bool Monster::Hurt(int damage,bool onUpperLevel,float z){
lastHitTimer=0.05;
if(!IsAlive()){
animation.ChangeState(internal_animState,GetDeathAnimationName());
}else{
hp=std::max(1,hp); //Make sure it stays alive if it's supposed to be alive...
}
GetInt(Attribute::HITS_UNTIL_DEATH)=std::max(0,GetInt(Attribute::HITS_UNTIL_DEATH)-1);
iframe_timer=GetFloat(Attribute::IFRAME_TIME_UPON_HIT);
return true;
}

@ -7,7 +7,7 @@
#define V(attr) GetVf2d(attr)
enum class Attribute{
IFRAME_TIME_UPON_HIT,
IFRAME_TIME_UPON_HIT, //When this is set, the monster gains iframes if they take damage based on the value this is set to.
SHOOT_RING_TIMER,
SHOOT_RING_DELAY,
SHOOT_RING_COUNTER,
@ -17,7 +17,6 @@ enum class Attribute{
JUMP_ORIGINAL_LANDING_TIMER,
JUMP_LANDING_TIMER,
JUMP_TARGET_POS,
JUMP_ORIGINAL_POS,
RECOVERY_TIME,
SHOOT_ANIMATION_TIME,
SHOOT_TIMER,
@ -27,4 +26,5 @@ enum class Attribute{
RUN_AWAY_TIMER,
PHASE_REPEAT_COUNT,
JUMP_TOWARDS_PLAYER,
HITS_UNTIL_DEATH, //When this is set, it is reduced by 1 each time the monster is hit.
};

@ -76,7 +76,6 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe
};
const auto StartJumpTowardsPlayer=[&](float jumpDuration,float recoveryTime,float jumpMoveSpd){
m.V(A::JUMP_ORIGINAL_POS)=m.GetPos();
m.F(A::JUMP_ORIGINAL_LANDING_TIMER)=m.F(A::JUMP_LANDING_TIMER)=jumpDuration;
m.B(A::JUMP_TOWARDS_PLAYER)=true;
m.F(A::RECOVERY_TIME)=recoveryTime;
@ -85,7 +84,6 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe
};
const auto StartJump=[&](float jumpDuration,vf2d targetPos,float recoveryTime,float jumpMoveSpd){
m.V(A::JUMP_ORIGINAL_POS)=m.GetPos();
m.F(A::JUMP_ORIGINAL_LANDING_TIMER)=m.F(A::JUMP_LANDING_TIMER)=jumpDuration;
m.V(A::JUMP_TARGET_POS)=targetPos;
m.B(A::JUMP_TOWARDS_PLAYER)=false;
@ -141,10 +139,10 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe
if(m.GetPos().x<jumpTargetPos.x){
m.SetX(std::min(jumpTargetPos.x,m.GetPos().x+m.F(A::JUMP_MOVE_SPD)*game->GetElapsedTime()));
}
if(m.GetPos().y>m.V(A::JUMP_TARGET_POS).y){
if(m.GetPos().y>jumpTargetPos.y){
m.SetY(std::max(jumpTargetPos.y,m.GetPos().y-m.F(A::JUMP_MOVE_SPD)*game->GetElapsedTime()));
} else
if(m.GetPos().y<m.V(A::JUMP_TARGET_POS).y){
if(m.GetPos().y<jumpTargetPos.y){
m.SetY(std::min(jumpTargetPos.y,m.GetPos().y+m.F(A::JUMP_MOVE_SPD)*game->GetElapsedTime()));
}
if(m.F(A::JUMP_LANDING_TIMER)>=m.F(A::JUMP_ORIGINAL_LANDING_TIMER)/2){
@ -172,6 +170,7 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe
game->GetPlayer()->SetIframes(1);
}
}
m.SetZ(0);
Landed(m.phase);
m.SetStrategyDrawFunction([](Crawler*game){});
} else
@ -290,9 +289,10 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe
}
}break;
case 4:{
if(m.hp<=0){
if(m.hp<=1){ //HP can't reach 0 when the dies normally flag is on.
m.phase=5;
m.F(A::IFRAME_TIME_UPON_HIT)=1;
m.I(A::HITS_UNTIL_DEATH)=int(m.GetSizeMult()*100/ConfigFloat("Phase5.SizeLossPerHit"))-1;
TransitionPhase(m.phase);
return;
}
@ -322,5 +322,14 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe
m.I(A::PHASE_REPEAT_COUNT)++;
}
}break;
case 5:{
float targetSize=ConfigFloat("Phase5.SizeLossPerHit")/100*m.I(A::HITS_UNTIL_DEATH);
Monster::STRATEGY::RUN_AWAY(m,fElapsedTime,4);
if(targetSize>0){
m.SetSize(targetSize,false);
}else{
m.diesNormally=true;
}
}break;
}
}

@ -2,7 +2,7 @@
#define VERSION_MAJOR 0
#define VERSION_MINOR 2
#define VERSION_PATCH 0
#define VERSION_BUILD 1407
#define VERSION_BUILD 1418
#define stringify(a) stringify_(a)
#define stringify_(a) #a

@ -134,7 +134,7 @@ MonsterStrategy
ShootRate = 0.5
ShootProjectileCount = 3
ShootAngleSpread = 45
JumpMoveSpd = 170
JumpMoveSpd = 140
JumpDelayTime = 0.5
JumpRecoveryTime = 2.0
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save