@ -79,7 +79,7 @@ struct MonsterData{
float moveSpd ; //1.0=100%
float size ;
std : : vector < std : : string > animations ;
int strategy ;
std : : string strategy ;
int collisionDmg ;
std : : string jumpAnimation = " WARRIOR_IDLE_S " ;
std : : string shootAnimation = " WARRIOR_IDLE_S " ;
@ -87,12 +87,12 @@ struct MonsterData{
std : : vector < MonsterDropData > dropData ;
public :
MonsterData ( ) ;
MonsterData ( int id , std : : string name , int hp , int atk , std : : vector < std : : string > animations , std : : vector < MonsterDropData > drops , float moveSpd = 1.0f , float size = 1.0f , int strategy = 0 , int collisionDmg = 0 ) ;
MonsterData ( int id , std : : string name , int hp , int atk , std : : vector < std : : string > animations , std : : vector < MonsterDropData > drops , float moveSpd = 1.0f , float size = 1.0f , std : : string strategy = " Run Towards " , int collisionDmg = 0 ) ;
int GetHealth ( ) ;
int GetAttack ( ) ;
float GetMoveSpdMult ( ) ;
float GetSizeMult ( ) ;
int GetAIStrategy ( ) ;
std : : string GetAIStrategy ( ) ;
int GetCollisionDmg ( ) ;
int GetID ( ) ;
std : : string GetIdleAnimation ( ) ;
@ -127,7 +127,7 @@ private:
float z = 0 ;
float iframe_timer = 0 ;
Key facingDirection = DOWN ;
int strategy ;
std : : string strategy ;
State : : State state = State : : NORMAL ;
Animate2D : : Animation < std : : string > animation ;
Animate2D : : AnimationState internal_animState ;
@ -193,21 +193,21 @@ public:
bool HasIframes ( ) ;
float GetZ ( ) ;
void SetZ ( float z ) ;
std : : string GetStrategy ( ) ;
const std : : function < void ( Monster & , float , std : : string ) > & GetStrategy ( ) const ;
void SetSize ( float newSize , bool immediate = true ) ;
void SetStrategyDrawFunction ( std : : function < void ( Crawler * ) > func ) ;
std : : function < void ( Crawler * ) > strategyDraw = [ ] ( Crawler * pge ) { } ;
private :
struct STRATEGY {
static int _GetInt ( Monster & m , std : : string param , int strategyNumber , int index = 0 ) ;
static float _GetFloat ( Monster & m , std : : string param , int strategyNumber , int index = 0 ) ;
static std : : string _GetString ( Monster & m , std : : string param , int strategyNumber , int index = 0 ) ;
static int _GetInt ( Monster & m , std : : string param , std : : string strategy , int index = 0 ) ;
static float _GetFloat ( Monster & m , std : : string param , std : : string strategy , int index = 0 ) ;
static std : : string _GetString ( Monster & m , std : : string param , std : : string strategy , int index = 0 ) ;
static void RUN_STRATEGY ( Monster & m , float fElapsedTime ) ;
static void RUN_TOWARDS ( Monster & m , float fElapsedTime , int strategyNumber ) ;
static void SHOOT_AFAR ( Monster & m , float fElapsedTime , int strategyNumber ) ;
static void TURRET ( Monster & m , float fElapsedTime , int strategyNumber ) ;
static void SLIMEKING ( Monster & m , float fElapsedTime , int strategyNumber ) ;
static void RUN_AWAY ( Monster & m , float fElapsedTime , int strategyNumber ) ;
static void RUN_TOWARDS ( Monster & m , float fElapsedTime , std : : string strategy ) ;
static void SHOOT_AFAR ( Monster & m , float fElapsedTime , std : : string strategy ) ;
static void TURRET ( Monster & m , float fElapsedTime , std : : string strategy ) ;
static void SLIMEKING ( Monster & m , float fElapsedTime , std : : string strategy ) ;
static void RUN_AWAY ( Monster & m , float fElapsedTime , std : : string strategy ) ;
} ;
} ;