@ -54,6 +54,7 @@ void Monster::STRATEGY::STONE_GOLEM(Monster&m,float fElapsedTime,std::string str
SPAWN_PILLAR_CAST ,
SPAWN_PILLAR_CAST ,
STANDARD ,
STANDARD ,
STONE_THROW_CAST ,
STONE_THROW_CAST ,
STONE_THROW_FINISH_ANIMATION ,
} ;
} ;
switch ( m . phase ) {
switch ( m . phase ) {
@ -91,8 +92,10 @@ void Monster::STRATEGY::STONE_GOLEM(Monster&m,float fElapsedTime,std::string str
BEAR ( m , fElapsedTime , " Bear " ) ;
BEAR ( m , fElapsedTime , " Bear " ) ;
//Extending the bear script's variables to read the state of it...
//Extending the bear script's variables to read the state of it...
const bool SlamHasFinished = m . I ( A : : ATTACK_COUNT ) ! = m . I ( A : : BEAR_STOMP_COUNT ) ;
const bool SlamHasFinished = m . I ( A : : ATTACK_COUNT ) ! = m . I ( A : : BEAR_STOMP_COUNT ) ;
if ( SlamHasFinished ) {
const bool StoneThrowRollSucceeds = util : : random ( 100.f ) < = ConfigFloat ( " Standard Attack.Stone Throw Chance " ) ;
const bool StoneThrowRollSucceeds = util : : random ( 100.f ) < = ConfigFloat ( " Standard Attack.Stone Throw Chance " ) ;
if ( SlamHasFinished & & StoneThrowRollSucceeds ) {
m . I ( A : : ATTACK_COUNT ) = m . I ( A : : BEAR_STOMP_COUNT ) ; //Make sure the slams are now reset if necessary.
if ( StoneThrowRollSucceeds ) { //The intent is one or the other attack is supposed to happen. We can't do the slam and a throw, rerolling repeatedly each tick is unncessary.
m . phase = STONE_THROW_CAST ;
m . phase = STONE_THROW_CAST ;
m . V ( A : : LOCKON_POS ) = game - > GetPlayer ( ) - > GetPos ( ) ;
m . V ( A : : LOCKON_POS ) = game - > GetPlayer ( ) - > GetPos ( ) ;
m . PerformAnimation ( " TOSS ROCK CAST " ) ;
m . PerformAnimation ( " TOSS ROCK CAST " ) ;
@ -104,11 +107,23 @@ void Monster::STRATEGY::STONE_GOLEM(Monster&m,float fElapsedTime,std::string str
//Physics!! Kinematic equation from https://openstax.org/books/physics/pages/3-2-representing-acceleration-with-equations-and-graphs a=(2d)/(t^2)
//Physics!! Kinematic equation from https://openstax.org/books/physics/pages/3-2-representing-acceleration-with-equations-and-graphs a=(2d)/(t^2)
const float acc { ( 2 * - ConfigFloat ( " Standard Attack.Stone Throw Height Offset " ) ) / std : : pow ( stoneTossTime , 2.f ) } ;
const float acc { ( 2 * - ConfigFloat ( " Standard Attack.Stone Throw Height Offset " ) ) / std : : pow ( stoneTossTime , 2.f ) } ;
CreateBullet ( LargeStone ) ( m . GetPos ( ) + ConfigFloat ( " Standard Attack.Stone Throw Height Offset " ) / 2.f , ConfigFloat ( " Standard Attack.Stone Throw Time " ) , m . V ( A : : LOCKON_POS ) , m . F ( A : : CASTING_TIMER ) , ConfigPixels ( " Standard Attack.Stone Radius " ) , ConfigFloat ( " Standard Attack.Stone Throw Height Offset " ) , acc , ConfigInt ( " Standard Attack.Stone Damage " ) , ConfigFloat ( " Standard Attack.Stone Throw Knockback Factor " ) , m . OnUpperLevel ( ) , false , INFINITY , false , WHITE , vf2d { 1 , 1 } * m . GetSizeMult ( ) , util : : random ( 2 * PI ) ) EndBullet ;
CreateBullet ( LargeStone ) ( m . GetPos ( ) + vf2d { 0 , ConfigFloat ( " Standard Attack.Stone Throw Height Offset " ) / 2.f } , ConfigFloat ( " Standard Attack.Stone Throw Time " ) , m . V ( A : : LOCKON_POS ) , m . F ( A : : CASTING_TIMER ) , ConfigPixels ( " Standard Attack.Stone Radius " ) , ConfigFloat ( " Standard Attack.Stone Throw Height Offset " ) , acc , ConfigInt ( " Standard Attack.Stone Damage " ) , ConfigFloat ( " Standard Attack.Stone Throw Knockback Factor " ) , m . OnUpperLevel ( ) , false , INFINITY , false , WHITE , vf2d { 1 , 1 } * m . GetSizeMult ( ) , util : : random ( 2 * PI ) ) EndBullet ;
}
}
}
} break ;
} break ;
case STONE_THROW_CAST : {
case STONE_THROW_CAST : {
m . F ( A : : CASTING_TIMER ) - = fElapsedTime ;
if ( m . F ( A : : CASTING_TIMER ) < = 0.f ) {
m . PerformAnimation ( " TOSS ROCK " ) ;
m . F ( A : : RECOVERY_TIME ) = m . GetCurrentAnimation ( ) . GetTotalAnimationDuration ( ) ;
m . phase = STONE_THROW_FINISH_ANIMATION ;
}
} break ;
case STONE_THROW_FINISH_ANIMATION : {
m . F ( A : : RECOVERY_TIME ) - = fElapsedTime ;
if ( m . F ( A : : RECOVERY_TIME ) < = 0.f ) {
m . phase = STANDARD ;
}
} break ;
} break ;
}
}
}
}