@ -116,20 +116,22 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,std::string strat
}
}
} ;
} ;
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 . F ( A : : JUMP_ORIGINAL_LANDING_TIMER ) = m . F ( A : : JUMP_LANDING_TIMER ) = jumpDuration ;
m . B ( A : : JUMP_TOWARDS_PLAYER ) = true ;
m . B ( A : : JUMP_TOWARDS_PLAYER ) = true ;
m . F ( A : : RECOVERY_TIME ) = recoveryTime ;
m . F ( A : : RECOVERY_TIME ) = recoveryTime ;
m . F ( A : : JUMP_MOVE_SPD ) = jumpMoveSpd ;
m . F ( A : : JUMP_MOVE_SPD ) = jumpMoveSpd ;
m . F ( A : : JUMP_MOVE_TO_TARGET_TIMER ) = moveTowardsTargetLockinTime ;
m . SetState ( State : : JUMP ) ;
m . SetState ( State : : JUMP ) ;
} ;
} ;
const auto StartJump = [ & ] ( float jumpDuration , vf2d targetPos , float recoveryTime , float jumpMoveSpd ) {
const auto StartJump = [ & ] ( float jumpDuration , vf2d targetPos , float recoveryTime , float jumpMoveSpd , float moveTowardsTargetLockinTime ) {
m . F ( A : : JUMP_ORIGINAL_LANDING_TIMER ) = m . F ( A : : JUMP_LANDING_TIMER ) = jumpDuration ;
m . F ( A : : JUMP_ORIGINAL_LANDING_TIMER ) = m . F ( A : : JUMP_LANDING_TIMER ) = jumpDuration ;
m . V ( A : : JUMP_TARGET_POS ) = targetPos ;
m . V ( A : : JUMP_TARGET_POS ) = targetPos ;
m . B ( A : : JUMP_TOWARDS_PLAYER ) = false ;
m . B ( A : : JUMP_TOWARDS_PLAYER ) = false ;
m . F ( A : : RECOVERY_TIME ) = recoveryTime ;
m . F ( A : : RECOVERY_TIME ) = recoveryTime ;
m . F ( A : : JUMP_MOVE_SPD ) = jumpMoveSpd ;
m . F ( A : : JUMP_MOVE_SPD ) = jumpMoveSpd ;
m . F ( A : : JUMP_MOVE_TO_TARGET_TIMER ) = moveTowardsTargetLockinTime ;
m . SetState ( State : : JUMP ) ;
m . SetState ( State : : JUMP ) ;
} ;
} ;
@ -142,7 +144,8 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,std::string strat
m . I ( A : : JUMP_COUNT ) + + ;
m . I ( A : : JUMP_COUNT ) + + ;
float jumpTime = ConfigFloatArr ( " Phase2.Jump[ " + std : : to_string ( m . I ( A : : JUMP_COUNT ) ) + " ] " , 0 ) ;
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 ) ;
float jumpSpd = ConfigFloatArr ( " Phase2.Jump[ " + std : : to_string ( m . I ( A : : JUMP_COUNT ) ) + " ] " , 1 ) ;
StartJumpTowardsPlayer ( jumpTime , 0.2f , jumpSpd ) ;
float lockedInTargetTime = ConfigFloatArr ( " Phase2.Jump[ " + std : : to_string ( m . I ( A : : JUMP_COUNT ) ) + " ] " , 2 ) ;
StartJumpTowardsPlayer ( jumpTime , 0.2f , jumpSpd , lockedInTargetTime ) ;
} break ;
} break ;
default : {
default : {
m . PerformIdleAnimation ( ) ;
m . PerformIdleAnimation ( ) ;
@ -173,17 +176,19 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,std::string strat
if ( m . B ( A : : JUMP_TOWARDS_PLAYER ) ) {
if ( m . B ( A : : JUMP_TOWARDS_PLAYER ) ) {
jumpTargetPos = game - > GetPlayer ( ) - > GetPos ( ) ;
jumpTargetPos = game - > GetPlayer ( ) - > GetPos ( ) ;
}
}
if ( m . GetPos ( ) . x > jumpTargetPos . x ) {
if ( m . F ( A : : JUMP_LANDING_TIMER ) > m . F ( A : : JUMP_MOVE_TO_TARGET_TIMER ) ) {
m . SetX ( std : : max ( jumpTargetPos . x , m . GetPos ( ) . x - m . F ( A : : JUMP_MOVE_SPD ) * game - > GetElapsedTime ( ) ) ) ;
if ( m . GetPos ( ) . x > jumpTargetPos . x ) {
} else
m . SetX ( std : : max ( jumpTargetPos . x , m . GetPos ( ) . x - m . F ( A : : JUMP_MOVE_SPD ) * game - > GetElapsedTime ( ) ) ) ;
if ( m . GetPos ( ) . x < jumpTargetPos . x ) {
} else
m . SetX ( std : : min ( jumpTargetPos . 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 > jumpTargetPos . y ) {
}
m . SetY ( std : : max ( jumpTargetPos . y , m . GetPos ( ) . y - m . F ( A : : JUMP_MOVE_SPD ) * game - > GetElapsedTime ( ) ) ) ;
if ( m . GetPos ( ) . y > jumpTargetPos . y ) {
} else
m . SetY ( std : : max ( jumpTargetPos . y , m . GetPos ( ) . y - m . F ( A : : JUMP_MOVE_SPD ) * game - > GetElapsedTime ( ) ) ) ;
if ( m . GetPos ( ) . y < jumpTargetPos . y ) {
} else
m . SetY ( std : : min ( jumpTargetPos . y , m . GetPos ( ) . y + m . F ( A : : JUMP_MOVE_SPD ) * game - > GetElapsedTime ( ) ) ) ;
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 ) {
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 ) ) ;
m . SetZ ( util : : lerp ( 0 , float ( ConfigInt ( " JumpHeight " ) ) , 1 - jumpLandingTimerRatio ) ) ;
@ -230,7 +235,8 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,std::string strat
m . I ( A : : JUMP_COUNT ) + + ;
m . I ( A : : JUMP_COUNT ) + + ;
float jumpTime = ConfigFloatArr ( " Phase2.Jump[ " + std : : to_string ( m . I ( A : : JUMP_COUNT ) ) + " ] " , 0 ) ;
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 ) ;
float jumpSpd = ConfigFloatArr ( " Phase2.Jump[ " + std : : to_string ( m . I ( A : : JUMP_COUNT ) ) + " ] " , 1 ) ;
StartJumpTowardsPlayer ( jumpTime , 0.2f , jumpSpd ) ;
float lockedInTargetTime = ConfigFloatArr ( " Phase2.Jump[ " + std : : to_string ( m . I ( A : : JUMP_COUNT ) ) + " ] " , 2 ) ;
StartJumpTowardsPlayer ( jumpTime , 0.2f , jumpSpd , lockedInTargetTime ) ;
}
}
return ;
return ;
}
}
@ -252,7 +258,7 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,std::string strat
}
}
if ( m . F ( A : : SHOOT_RING_TIMER ) = = 0 ) {
if ( m . F ( A : : SHOOT_RING_TIMER ) = = 0 ) {
if ( m . I ( A : : PATTERN_REPEAT_COUNT ) > = ConfigInt ( " Phase1.JumpAfter " ) ) {
if ( m . I ( A : : PATTERN_REPEAT_COUNT ) > = ConfigInt ( " Phase1.JumpAfter " ) ) {
StartJumpTowardsPlayer ( ConfigFloat ( " Phase1.AirborneTime " ) , ConfigFloat ( " Phase1.LandingRecoveryTime " ) , ConfigFloat ( " JumpMoveSpd " ) ) ;
StartJumpTowardsPlayer ( ConfigFloat ( " Phase1.AirborneTime " ) , ConfigFloat ( " Phase1.LandingRecoveryTime " ) , ConfigFloat ( " JumpMoveSpd " ) , ConfigFloat ( " Phase1.JumpLockinTargetTime " ) ) ;
m . I ( A : : PATTERN_REPEAT_COUNT ) = 0 ;
m . I ( A : : PATTERN_REPEAT_COUNT ) = 0 ;
return ;
return ;
}
}
@ -313,7 +319,7 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,std::string strat
return ;
return ;
}
}
if ( m . I ( A : : PATTERN_REPEAT_COUNT ) = = 0 ) {
if ( m . I ( A : : PATTERN_REPEAT_COUNT ) = = 0 ) {
StartJumpTowardsPlayer ( ConfigFloat ( " Phase3.JumpDelayTime " ) , ConfigFloat ( " Phase3.JumpRecoveryTime " ) , ConfigFloat ( " Phase3.JumpMoveSpd " ) ) ;
StartJumpTowardsPlayer ( ConfigFloat ( " Phase3.JumpDelayTime " ) , ConfigFloat ( " Phase3.JumpRecoveryTime " ) , ConfigFloat ( " Phase3.JumpMoveSpd " ) , ConfigFloat ( " Phase3.JumpLockinTargetTime " ) ) ;
m . I ( A : : PATTERN_REPEAT_COUNT ) + + ;
m . I ( A : : PATTERN_REPEAT_COUNT ) + + ;
} else
} else
if ( m . I ( A : : PATTERN_REPEAT_COUNT ) < 4 & & m . F ( A : : SHOOT_TIMER ) = = 0 ) {
if ( m . I ( A : : PATTERN_REPEAT_COUNT ) < 4 & & m . F ( A : : SHOOT_TIMER ) = = 0 ) {
@ -346,7 +352,8 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,std::string strat
float jumpAngle = util : : angleTo ( m . GetPos ( ) , game - > GetCurrentMapData ( ) . MapSize * game - > GetCurrentMapData ( ) . tilewidth / 2 ) ; //We jump towards the center to keep the player from constantly dealing with a stuck boss.
float jumpAngle = util : : angleTo ( m . GetPos ( ) , game - > GetCurrentMapData ( ) . MapSize * game - > GetCurrentMapData ( ) . tilewidth / 2 ) ; //We jump towards the center to keep the player from constantly dealing with a stuck boss.
float jumpDistance = ConfigFloat ( " Phase4.JumpDistance " ) / 100 * game - > GetCurrentMapData ( ) . tilewidth ;
float jumpDistance = ConfigFloat ( " Phase4.JumpDistance " ) / 100 * game - > GetCurrentMapData ( ) . tilewidth ;
float jumpSpd = jumpDistance / ConfigFloat ( " Phase4.JumpDuration " ) ;
float jumpSpd = jumpDistance / ConfigFloat ( " Phase4.JumpDuration " ) ;
StartJump ( ConfigFloat ( " Phase4.JumpDuration " ) , m . GetPos ( ) + vf2d { cos ( jumpAngle ) * jumpDistance , sin ( jumpAngle ) * jumpDistance } , 0 , jumpSpd ) ;
float lockedInTargetTime = jumpDistance / ConfigFloat ( " Phase4.JumpLockinTargetTime " ) ;
StartJump ( ConfigFloat ( " Phase4.JumpDuration " ) , m . GetPos ( ) + vf2d { cos ( jumpAngle ) * jumpDistance , sin ( jumpAngle ) * jumpDistance } , 0 , jumpSpd , lockedInTargetTime ) ;
} else
} else
if ( m . I ( A : : PATTERN_REPEAT_COUNT ) < 5 & & m . F ( A : : SHOOT_TIMER ) = = 0 ) {
if ( m . I ( A : : PATTERN_REPEAT_COUNT ) < 5 & & m . F ( A : : SHOOT_TIMER ) = = 0 ) {
m . I ( A : : PATTERN_REPEAT_COUNT ) + + ;
m . I ( A : : PATTERN_REPEAT_COUNT ) + + ;