|
|
|
@ -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; |
|
|
|
|
} |
|
|
|
|
} |