|
|
|
@ -6,6 +6,7 @@ |
|
|
|
|
#include "safemap.h" |
|
|
|
|
#include "Effect.h" |
|
|
|
|
#include "FallingDebris.h" |
|
|
|
|
#include "MonsterAttribute.h" |
|
|
|
|
|
|
|
|
|
INCLUDE_game |
|
|
|
|
INCLUDE_BULLET_LIST |
|
|
|
@ -15,8 +16,6 @@ INCLUDE_MONSTER_NAME_DATA |
|
|
|
|
typedef Attribute A; |
|
|
|
|
|
|
|
|
|
void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumber){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float bulletSpd=ConfigFloat("BulletSpd")/100*24; |
|
|
|
|
|
|
|
|
|
m.F(A::SHOOT_TIMER)=std::max(0.f,m.F(A::SHOOT_TIMER)-fElapsedTime); |
|
|
|
@ -76,13 +75,22 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const auto StartJump=[&](float jumpDuration,vf2d targetPos,float recoveryTime,float jumpMoveSpd,bool teleportToPlayer=false){ |
|
|
|
|
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; |
|
|
|
|
m.F(A::JUMP_MOVE_SPD)=jumpMoveSpd; |
|
|
|
|
m.SetState(State::JUMP); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
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; |
|
|
|
|
m.F(A::RECOVERY_TIME)=recoveryTime; |
|
|
|
|
m.F(A::JUMP_MOVE_SPD)=jumpMoveSpd; |
|
|
|
|
m.B(A::TELEPORT_TO_PLAYER)=teleportToPlayer; |
|
|
|
|
m.SetState(State::JUMP); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -95,8 +103,7 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe |
|
|
|
|
m.I(A::JUMP_COUNT)++; |
|
|
|
|
float jumpTime=ConfigFloatArr("Phase2.Jump["+std::to_string(m.I(A::JUMP_COUNT))+"]",0); |
|
|
|
|
float jumpSpd=ConfigFloatArr("Phase2.Jump["+std::to_string(m.I(A::JUMP_COUNT))+"]",1); |
|
|
|
|
bool jumpTeleport=bool(ConfigIntArr("Phase2.Jump["+std::to_string(m.I(A::JUMP_COUNT))+"]",2)); |
|
|
|
|
StartJump(jumpTime,game->GetPlayer()->GetPos(),0.2,jumpSpd,jumpTeleport); |
|
|
|
|
StartJumpTowardsPlayer(jumpTime,0.2,jumpSpd); |
|
|
|
|
}break; |
|
|
|
|
default:{ |
|
|
|
|
m.PerformIdleAnimation(); |
|
|
|
@ -124,17 +131,21 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe |
|
|
|
|
|
|
|
|
|
if(m.GetState()==State::JUMP){ |
|
|
|
|
float jumpLandingTimerRatio=m.F(A::JUMP_LANDING_TIMER)/m.F(A::JUMP_ORIGINAL_LANDING_TIMER); |
|
|
|
|
if(m.GetPos().x>m.V(A::JUMP_TARGET_POS).x){ |
|
|
|
|
m.SetX(std::max(m.V(A::JUMP_TARGET_POS).x,m.GetPos().x-m.F(A::JUMP_MOVE_SPD)*game->GetElapsedTime())); |
|
|
|
|
vf2d jumpTargetPos=m.V(A::JUMP_TARGET_POS); |
|
|
|
|
if(m.B(A::JUMP_TOWARDS_PLAYER)){ |
|
|
|
|
jumpTargetPos=game->GetPlayer()->GetPos(); |
|
|
|
|
} |
|
|
|
|
if(m.GetPos().x>jumpTargetPos.x){ |
|
|
|
|
m.SetX(std::max(jumpTargetPos.x,m.GetPos().x-m.F(A::JUMP_MOVE_SPD)*game->GetElapsedTime())); |
|
|
|
|
} else |
|
|
|
|
if(m.GetPos().x<m.V(A::JUMP_TARGET_POS).x){ |
|
|
|
|
m.SetX(std::min(m.V(A::JUMP_TARGET_POS).x,m.GetPos().x+m.F(A::JUMP_MOVE_SPD)*game->GetElapsedTime())); |
|
|
|
|
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){ |
|
|
|
|
m.SetY(std::max(m.V(A::JUMP_TARGET_POS).y,m.GetPos().y-m.F(A::JUMP_MOVE_SPD)*game->GetElapsedTime())); |
|
|
|
|
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){ |
|
|
|
|
m.SetY(std::min(m.V(A::JUMP_TARGET_POS).y,m.GetPos().y+m.F(A::JUMP_MOVE_SPD)*game->GetElapsedTime())); |
|
|
|
|
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){ |
|
|
|
|
m.SetZ(util::lerp(0,ConfigInt("JumpHeight"),1-jumpLandingTimerRatio)); |
|
|
|
@ -165,10 +176,6 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe |
|
|
|
|
m.SetStrategyDrawFunction([](Crawler*game){}); |
|
|
|
|
} else |
|
|
|
|
if(m.F(A::JUMP_LANDING_TIMER)<=ConfigFloat("JumpWarningIndicatorTime")){ |
|
|
|
|
if(m.B(A::TELEPORT_TO_PLAYER)){ |
|
|
|
|
m.B(A::TELEPORT_TO_PLAYER)=false; |
|
|
|
|
m.SetPos(game->GetPlayer()->GetPos()); |
|
|
|
|
} |
|
|
|
|
m.SetStrategyDrawFunction([&](Crawler*game){ |
|
|
|
|
Decal*dec=ANIMATION_DATA["range_indicator.png"].GetFrame(game->GetElapsedTime()).GetSourceImage()->Decal(); |
|
|
|
|
game->view.DrawRotatedDecal(m.GetPos(),dec,0,dec->sprite->Size()/2,vf2d{m.GetSizeMult(),m.GetSizeMult()},RED); |
|
|
|
@ -184,7 +191,7 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe |
|
|
|
|
m.I(A::JUMP_COUNT)++; |
|
|
|
|
float jumpTime=ConfigFloatArr("Phase2.Jump["+std::to_string(m.I(A::JUMP_COUNT))+"]",0); |
|
|
|
|
float jumpSpd=ConfigFloatArr("Phase2.Jump["+std::to_string(m.I(A::JUMP_COUNT))+"]",1); |
|
|
|
|
StartJump(jumpTime,game->GetPlayer()->GetPos(),0.2,jumpSpd); |
|
|
|
|
StartJumpTowardsPlayer(jumpTime,0.2,jumpSpd); |
|
|
|
|
} |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
@ -206,7 +213,7 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe |
|
|
|
|
} |
|
|
|
|
if(m.F(A::SHOOT_RING_TIMER)==0){ |
|
|
|
|
if(m.I(A::PATTERN_REPEAT_COUNT)>=ConfigInt("Phase1.JumpAfter")){ |
|
|
|
|
StartJump(ConfigFloat("Phase1.AirborneTime"),game->GetPlayer()->GetPos(),ConfigFloat("Phase1.LandingRecoveryTime"),ConfigFloat("JumpMoveSpd")); |
|
|
|
|
StartJumpTowardsPlayer(ConfigFloat("Phase1.AirborneTime"),ConfigFloat("Phase1.LandingRecoveryTime"),ConfigFloat("JumpMoveSpd")); |
|
|
|
|
m.I(A::PATTERN_REPEAT_COUNT)=0; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
@ -258,12 +265,12 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe |
|
|
|
|
if(m.hp<=m.maxhp*ConfigFloat("Phase4.Change")/100){ |
|
|
|
|
m.phase=4; |
|
|
|
|
m.SetSize(ConfigFloat("Phase4.Size")/100,false); |
|
|
|
|
m.AddBuff(BuffType::SLOWDOWN,9999999,ConfigFloat("Phase4.MoveSpdModifier")/100); |
|
|
|
|
m.AddBuff(BuffType::SLOWDOWN,99999,ConfigFloat("Phase4.MoveSpdModifier")/100); |
|
|
|
|
TransitionPhase(m.phase); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if(m.I(A::PATTERN_REPEAT_COUNT)==0){ |
|
|
|
|
StartJump(ConfigFloat("Phase3.JumpDelayTime"),game->GetPlayer()->GetPos(),ConfigFloat("Phase3.JumpRecoveryTime"),ConfigFloat("Phase3.JumpMoveSpd")); |
|
|
|
|
StartJumpTowardsPlayer(ConfigFloat("Phase3.JumpDelayTime"),ConfigFloat("Phase3.JumpRecoveryTime"),ConfigFloat("Phase3.JumpMoveSpd")); |
|
|
|
|
m.I(A::PATTERN_REPEAT_COUNT)++; |
|
|
|
|
}else |
|
|
|
|
if(m.I(A::PATTERN_REPEAT_COUNT)<4&&m.F(A::SHOOT_TIMER)==0){ |
|
|
|
|