@ -79,11 +79,12 @@ void Monster::STRATEGY::RUN_TOWARDS(Monster&m,float fElapsedTime,std::string str
m . UpdateFacingDirection ( m . target ) ;
}
const auto StartJumpTowardsPlayer = [ & ] ( float jumpDuration , float recoveryTime , float jumpMoveSpd ) {
const auto StartJumpTowardsPlayer = [ & ] ( float jumpDuration , float recoveryTime , float jumpMoveSpd , float moveTowardsTargetLockinTime ) {
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 . F ( A : : JUMP_MOVE_TO_TARGET_TIMER ) = moveTowardsTargetLockinTime ;
m . SetState ( State : : JUMP ) ;
} ;
const auto Landed = [ & ] ( ) {
@ -114,7 +115,7 @@ void Monster::STRATEGY::RUN_TOWARDS(Monster&m,float fElapsedTime,std::string str
m . F ( A : : LAST_JUMP_TIMER ) = std : : max ( 0.f , m . F ( A : : LAST_JUMP_TIMER ) - fElapsedTime ) ;
if ( m . F ( A : : LAST_JUMP_TIMER ) = = 0.f ) {
if ( geom2d : : line ( m . pos , m . target ) . length ( ) < = ConfigInt ( " MaxPlayerJumpEngageDistance " ) / 100.f * 24 ) {
StartJumpTowardsPlayer ( ConfigFloat ( " JumpDelayTime " ) , ConfigFloat ( " JumpRecoveryTime " ) , ConfigFloat ( " JumpMoveSpd " ) ) ;
StartJumpTowardsPlayer ( ConfigFloat ( " JumpDelayTime " ) , ConfigFloat ( " JumpRecoveryTime " ) , ConfigFloat ( " JumpMoveSpd " ) , ConfigFloat ( " JumpLockinTargetTime " ) ) ;
}
m . F ( A : : LAST_JUMP_TIMER ) = ConfigFloat ( " JumpTimer " ) ;
}
@ -129,6 +130,7 @@ void Monster::STRATEGY::RUN_TOWARDS(Monster&m,float fElapsedTime,std::string str
if ( m . B ( A : : JUMP_TOWARDS_PLAYER ) ) {
jumpTargetPos = game - > GetPlayer ( ) - > GetPos ( ) ;
}
if ( m . F ( A : : JUMP_LANDING_TIMER ) > m . F ( A : : JUMP_MOVE_TO_TARGET_TIMER ) ) {
if ( m . GetPos ( ) . x > jumpTargetPos . x ) {
m . SetX ( std : : max ( jumpTargetPos . x , m . GetPos ( ) . x - m . F ( A : : JUMP_MOVE_SPD ) * game - > GetElapsedTime ( ) ) ) ;
} else
@ -141,6 +143,7 @@ void Monster::STRATEGY::RUN_TOWARDS(Monster&m,float fElapsedTime,std::string str
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 ) {
m . SetZ ( util : : lerp ( 0 , float ( ConfigInt ( " JumpHeight " ) ) , 1 - jumpLandingTimerRatio ) ) ;
} else {