Converted all Monster Strategy IDs to using strings instead of magic numbers, removed magic numbering system from configs.
This commit is contained in:
		
							parent
							
								
									cb09825455
								
							
						
					
					
						commit
						455dd3a818
					
				| @ -203,10 +203,6 @@ bool Crawler::OnUserCreate(){ | ||||
| 
 | ||||
| 	ValidateGameStatus(); //Checks to make sure everything has been initialized properly.
 | ||||
| 	 | ||||
| 	Merchant::RandomizeTravelingMerchant(); | ||||
| 	Merchant&myMerchant=Merchant::GetCurrentTravelingMerchant(); | ||||
| 	const std::vector<Item>&itemsAvailable=myMerchant.GetShopItems(); | ||||
| 	 | ||||
| 	return true; | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -46,8 +46,7 @@ All rights reserved. | ||||
| #define INCLUDE_BULLET_LIST extern std::vector<std::unique_ptr<Bullet>>BULLET_LIST; | ||||
| #define INCLUDE_EMITTER_LIST extern std::vector<std::unique_ptr<Emitter>>EMITTER_LIST; | ||||
| #define INCLUDE_DATA extern utils::datafile DATA; | ||||
| #define INCLUDE_STRATEGY_DATA extern safemap<std::string,int>STRATEGY_DATA; | ||||
| #define INCLUDE_STRATEGY_ID_DATA extern safemap<std::string,int>STRATEGY_ID_DATA; | ||||
| #define INCLUDE_STRATEGY_DATA extern safemap<std::string,std::function<void(Monster&,float,std::string)>>STRATEGY_DATA; | ||||
| #define INCLUDE_TILE_ANIMATION_DATA extern std::map<int,std::vector<std::pair<int,float>>>TILE_ANIMATION_DATA; | ||||
| #define INCLUDE_GFX extern safemap<std::string,Renderable>GFX; | ||||
| #define INCLUDE_ITEM_DATA extern safemap<std::string,ItemInfo>ITEM_DATA; | ||||
|  | ||||
| @ -106,6 +106,7 @@ void Merchant::Initialize(){ | ||||
| 		} | ||||
| 		std::cout<<std::format("Added {} merchants to Chapter {}",merchantCount,chapter)<<std::endl; | ||||
| 	} | ||||
| 	Merchant::RandomizeTravelingMerchant(); | ||||
| } | ||||
| bool Merchant::CanPurchaseItem(IT item,uint32_t amt)const{ | ||||
| 	bool itemAvailable=false; | ||||
| @ -126,7 +127,7 @@ bool Merchant::CanPurchaseItem(IT item,uint32_t amt)const{ | ||||
| 		game->GetPlayer()->GetMoney()>=foundItem->BuyValue()*amt; | ||||
| }; | ||||
| bool Merchant::CanSellItem(IT item,uint32_t amt)const{ | ||||
| 	ItemInfo&it=ITEM_DATA[item]; | ||||
| 	const ItemInfo&it=ITEM_DATA[item]; | ||||
| 
 | ||||
| 	sellFunctionPrimed.amt=amt; | ||||
| 	sellFunctionPrimed.item=item; | ||||
| @ -168,7 +169,7 @@ void Merchant::SellItem(IT item,uint32_t amt){ | ||||
| 		} | ||||
| 	} | ||||
| 	if(!itemFound){ | ||||
| 		AddItem(item); | ||||
| 		AddItem(item); //This may not be a feature we include in future versions of the game. For now let's allow it.
 | ||||
| 	} | ||||
| 	totalCost=ITEM_DATA[item].GetSellValue()*amt; | ||||
| 
 | ||||
|  | ||||
| @ -54,11 +54,9 @@ INCLUDE_DAMAGENUMBER_LIST | ||||
| INCLUDE_game | ||||
| INCLUDE_BULLET_LIST | ||||
| INCLUDE_DATA | ||||
| INCLUDE_STRATEGY_DATA | ||||
| INCLUDE_GFX | ||||
| 
 | ||||
| safemap<std::string,int>STRATEGY_DATA; | ||||
| safemap<int,std::string>STRATEGY_ID_DATA; | ||||
| safemap<std::string,std::function<void(Monster&,float,std::string)>>STRATEGY_DATA; | ||||
| std::map<int,Renderable*>MonsterData::imgs; | ||||
| 
 | ||||
| Monster::Monster(vf2d pos,MonsterData data,bool upperLevel,bool bossMob): | ||||
| @ -248,7 +246,7 @@ void Monster::Collision(Monster&m){ | ||||
| 	Collision(); | ||||
| } | ||||
| void Monster::Collision(){ | ||||
| 	if(strategy==0&&GetState()==State::MOVE_TOWARDS&&util::random(float(Monster::STRATEGY::_GetInt(*this,"BumpStopChance",strategy)))<1){//The run towards strategy causes state to return to normal upon a collision.
 | ||||
| 	if(strategy=="Run Towards"&&GetState()==State::MOVE_TOWARDS&&util::random(float(Monster::STRATEGY::_GetInt(*this,"BumpStopChance",strategy)))<1){//The run towards strategy causes state to return to normal upon a collision.
 | ||||
| 		SetState(State::NORMAL); | ||||
| 	} | ||||
| } | ||||
| @ -406,15 +404,13 @@ void Monster::SetState(State::State newState){ | ||||
| } | ||||
| 
 | ||||
| void Monster::InitializeStrategies(){ | ||||
| 	int readCounter=0; | ||||
| 	while(DATA["MonsterStrategy"].HasProperty(std::to_string(readCounter))){ | ||||
| 		std::string strategyName=DATA["MonsterStrategy"][std::to_string(readCounter)]["Name"].GetString(); | ||||
| 		STRATEGY_DATA[strategyName]=readCounter; | ||||
| 		STRATEGY_ID_DATA[readCounter]=strategyName; | ||||
| 		readCounter++; | ||||
| 	} | ||||
| 	STRATEGY_DATA.insert("Run Towards",Monster::STRATEGY::RUN_TOWARDS); | ||||
| 	STRATEGY_DATA.insert("Shoot Afar",Monster::STRATEGY::SHOOT_AFAR); | ||||
| 	STRATEGY_DATA.insert("Turret",Monster::STRATEGY::TURRET); | ||||
| 	STRATEGY_DATA.insert("Slime King",Monster::STRATEGY::SLIMEKING); | ||||
| 	STRATEGY_DATA.insert("Run Away",Monster::STRATEGY::RUN_AWAY); | ||||
| 
 | ||||
| 	STRATEGY_DATA.SetInitialized(); | ||||
| 	STRATEGY_ID_DATA.SetInitialized(); | ||||
| } | ||||
| 
 | ||||
| bool Monster::HasIframes(){ | ||||
| @ -425,8 +421,8 @@ float Monster::GetZ(){ | ||||
| 	return z; | ||||
| } | ||||
| 
 | ||||
| std::string Monster::GetStrategy(){ | ||||
| 	return STRATEGY_ID_DATA[strategy]; | ||||
| const std::function<void(Monster&,float,std::string)>&Monster::GetStrategy()const{ | ||||
| 	return STRATEGY_DATA[strategy]; | ||||
| } | ||||
| 
 | ||||
| void Monster::SetSize(float newSize,bool immediate){ | ||||
|  | ||||
| @ -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); | ||||
| 	}; | ||||
| }; | ||||
| 
 | ||||
|  | ||||
| @ -52,8 +52,8 @@ std::map<int,MonsterData>MONSTER_DATA; | ||||
| safemap<std::string,MonsterData*>MONSTER_NAME_DATA; | ||||
| 
 | ||||
| MonsterData::MonsterData() | ||||
| :atk(0),collisionDmg(0),hp(0),id(0),moveSpd(0),size(0),strategy(0){} | ||||
| MonsterData::MonsterData(int id,std::string name,int hp,int atk,std::vector<std::string>animations,std::vector<MonsterDropData>drops,float moveSpd,float size,int strategy,int collisionDmg): | ||||
| :atk(0),collisionDmg(0),hp(0),id(0),moveSpd(0),size(0),strategy("Run Towards"){} | ||||
| MonsterData::MonsterData(int id,std::string name,int hp,int atk,std::vector<std::string>animations,std::vector<MonsterDropData>drops,float moveSpd,float size,std::string strategy,int collisionDmg): | ||||
| 	id(id),name(name),hp(hp),atk(atk),moveSpd(moveSpd),size(size),strategy(strategy),animations(animations),dropData(drops),collisionDmg(collisionDmg){} | ||||
| 
 | ||||
| void MonsterData::InitializeMonsterData(){ | ||||
| @ -138,6 +138,11 @@ void MonsterData::InitializeMonsterData(){ | ||||
| 			dropDataCounter++; | ||||
| 		} | ||||
| 
 | ||||
| 		const std::string&strategyName=DATA["Monsters"][std::to_string(id)]["Strategy"].GetString(); | ||||
| 		if(!STRATEGY_DATA.count(strategyName)){ | ||||
| 			ERR("WARNING! Strategy for "<<MonsterName<<" does not exist in strategy database!"); | ||||
| 		} | ||||
| 
 | ||||
| 		MonsterData monster( | ||||
| 			id, | ||||
| 			MonsterName, | ||||
| @ -147,7 +152,7 @@ void MonsterData::InitializeMonsterData(){ | ||||
| 			drops, | ||||
| 			float(DATA["Monsters"][std::to_string(id)]["MoveSpd"].GetReal())/100, | ||||
| 			float(DATA["Monsters"][std::to_string(id)]["Size"].GetReal())/100, | ||||
| 			STRATEGY_DATA[DATA["Monsters"][std::to_string(id)]["Strategy"].GetString()], | ||||
| 			strategyName, | ||||
| 			DATA["Monsters"][std::to_string(id)]["CollisionDmg"].GetInt() | ||||
| 		); | ||||
| 
 | ||||
| @ -177,7 +182,7 @@ int MonsterData::GetCollisionDmg(){ | ||||
| int MonsterData::GetID(){ | ||||
| 	return id; | ||||
| } | ||||
| int MonsterData::GetAIStrategy(){ | ||||
| std::string MonsterData::GetAIStrategy(){ | ||||
| 	return strategy; | ||||
| } | ||||
| std::string MonsterData::GetDisplayName(){ | ||||
|  | ||||
| @ -36,9 +36,9 @@ All rights reserved. | ||||
| */ | ||||
| #pragma endregion | ||||
| #pragma once | ||||
| #define ConfigInt(param) _GetInt(m,param,strategyNumber) | ||||
| #define ConfigFloat(param) _GetFloat(m,param,strategyNumber) | ||||
| #define ConfigString(param) _GetString(m,param,strategyNumber) | ||||
| #define ConfigIntArr(param,ind) _GetInt(m,param,strategyNumber,ind) | ||||
| #define ConfigFloatArr(param,ind) _GetFloat(m,param,strategyNumber,ind) | ||||
| #define ConfigStringArr(param,ind) _GetString(m,param,strategyNumber,ind) | ||||
| #define ConfigInt(param) _GetInt(m,param,strategy) | ||||
| #define ConfigFloat(param) _GetFloat(m,param,strategy) | ||||
| #define ConfigString(param) _GetString(m,param,strategy) | ||||
| #define ConfigIntArr(param,ind) _GetInt(m,param,strategy,ind) | ||||
| #define ConfigFloatArr(param,ind) _GetFloat(m,param,strategy,ind) | ||||
| #define ConfigStringArr(param,ind) _GetString(m,param,strategy,ind) | ||||
| @ -40,45 +40,30 @@ All rights reserved. | ||||
| #include "olcUTIL_DataFile.h" | ||||
| 
 | ||||
| INCLUDE_DATA | ||||
| INCLUDE_STRATEGY_DATA | ||||
| 
 | ||||
| int Monster::STRATEGY::_GetInt(Monster&m,std::string param,int strategyNumber,int index){ | ||||
| int Monster::STRATEGY::_GetInt(Monster&m,std::string param,std::string strategy,int index){ | ||||
| 	if(DATA["Monsters"][std::to_string(m.id)].HasProperty(param)){ | ||||
| 		return DATA["Monsters"][std::to_string(m.id)].GetProperty(param).GetInt(index); | ||||
| 	} else { | ||||
| 		return DATA["MonsterStrategy"][std::to_string(strategyNumber)].GetProperty(param).GetInt(index); | ||||
| 		return DATA["MonsterStrategy"][strategy].GetProperty(param).GetInt(index); | ||||
| 	} | ||||
| } | ||||
| float Monster::STRATEGY::_GetFloat(Monster&m,std::string param,int strategyNumber,int index){ | ||||
| float Monster::STRATEGY::_GetFloat(Monster&m,std::string param,std::string strategy,int index){ | ||||
| 	if(DATA["Monsters"][std::to_string(m.id)].HasProperty(param)){ | ||||
| 		return float(DATA["Monsters"][std::to_string(m.id)].GetProperty(param).GetReal(index)); | ||||
| 	} else { | ||||
| 		return float(DATA["MonsterStrategy"][std::to_string(strategyNumber)].GetProperty(param).GetReal(index)); | ||||
| 		return float(DATA["MonsterStrategy"][strategy].GetProperty(param).GetReal(index)); | ||||
| 	} | ||||
| } | ||||
| std::string Monster::STRATEGY::_GetString(Monster&m,std::string param,int strategyNumber,int index){ | ||||
| std::string Monster::STRATEGY::_GetString(Monster&m,std::string param,std::string strategy,int index){ | ||||
| 	if(DATA["Monsters"][std::to_string(m.id)].HasProperty(param)){ | ||||
| 		return DATA["Monsters"][std::to_string(m.id)].GetProperty(param).GetString(index); | ||||
| 	} else { | ||||
| 		return DATA["MonsterStrategy"][std::to_string(strategyNumber)].GetProperty(param).GetString(index); | ||||
| 		return DATA["MonsterStrategy"][strategy].GetProperty(param).GetString(index); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| void Monster::STRATEGY::RUN_STRATEGY(Monster&m,float fElapsedTime){ | ||||
| 	switch(m.strategy){ | ||||
| 		case 0:{//Run Towards
 | ||||
| 			Monster::STRATEGY::RUN_TOWARDS(m,fElapsedTime,m.strategy); | ||||
| 		}break; | ||||
| 		case 1:{//Shoot Afar
 | ||||
| 			Monster::STRATEGY::SHOOT_AFAR(m,fElapsedTime,m.strategy); | ||||
| 		}break; | ||||
| 		case 2:{//Turret
 | ||||
| 			Monster::STRATEGY::TURRET(m,fElapsedTime,m.strategy); | ||||
| 		}break; | ||||
| 		case 3:{//Slime King
 | ||||
| 			Monster::STRATEGY::SLIMEKING(m,fElapsedTime,m.strategy); | ||||
| 		}break; | ||||
| 		case 4:{//Run Away Strategy
 | ||||
| 			Monster::STRATEGY::RUN_AWAY(m,fElapsedTime,m.strategy); | ||||
| 		}break; | ||||
| 	} | ||||
| 	m.GetStrategy()(m,fElapsedTime,m.strategy); | ||||
| } | ||||
| @ -43,7 +43,7 @@ All rights reserved. | ||||
| INCLUDE_BULLET_LIST | ||||
| INCLUDE_game | ||||
| 
 | ||||
| void Monster::STRATEGY::RUN_AWAY(Monster&m,float fElapsedTime,int strategyNumber){ | ||||
| void Monster::STRATEGY::RUN_AWAY(Monster&m,float fElapsedTime,std::string strategy){ | ||||
| 	m.targetAcquireTimer=std::max(0.f,m.targetAcquireTimer-fElapsedTime); | ||||
| 	m.attackCooldownTimer=std::max(0.f,m.attackCooldownTimer-fElapsedTime); | ||||
| 	geom2d::line line(m.pos,game->GetPlayer()->GetPos()); | ||||
|  | ||||
| @ -43,7 +43,7 @@ All rights reserved. | ||||
| INCLUDE_game | ||||
| INCLUDE_MONSTER_DATA | ||||
| 
 | ||||
| void Monster::STRATEGY::RUN_TOWARDS(Monster&m,float fElapsedTime,int strategyNumber){ | ||||
| void Monster::STRATEGY::RUN_TOWARDS(Monster&m,float fElapsedTime,std::string strategy){ | ||||
| 	m.targetAcquireTimer=std::max(0.f,m.targetAcquireTimer-fElapsedTime); | ||||
| 	if(m.targetAcquireTimer==0){ | ||||
| 		m.targetAcquireTimer=ConfigFloat("WaitTime"); | ||||
|  | ||||
| @ -43,7 +43,7 @@ All rights reserved. | ||||
| INCLUDE_BULLET_LIST | ||||
| INCLUDE_game | ||||
| 
 | ||||
| void Monster::STRATEGY::SHOOT_AFAR(Monster&m,float fElapsedTime,int strategyNumber){ | ||||
| void Monster::STRATEGY::SHOOT_AFAR(Monster&m,float fElapsedTime,std::string strategy){ | ||||
| 	m.targetAcquireTimer=std::max(0.f,m.targetAcquireTimer-fElapsedTime); | ||||
| 	m.attackCooldownTimer=std::max(0.f,m.attackCooldownTimer-fElapsedTime); | ||||
| 	if(m.queueShotTimer>0){ | ||||
|  | ||||
| @ -52,7 +52,7 @@ INCLUDE_MONSTER_NAME_DATA | ||||
| 
 | ||||
| using A=Attribute; | ||||
| 
 | ||||
| void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumber){ | ||||
| void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,std::string strategy){ | ||||
| 	float bulletSpd=ConfigFloat("BulletSpd")/100*24; | ||||
| 
 | ||||
| 	m.F(A::SHOOT_TIMER)=std::max(0.f,m.F(A::SHOOT_TIMER)-fElapsedTime); | ||||
| @ -150,8 +150,7 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe | ||||
| 	}; | ||||
| 
 | ||||
| 	if(m.F(A::RUN_AWAY_TIMER)>0){ | ||||
| 		Monster::STRATEGY::RUN_AWAY(m,fElapsedTime,4); | ||||
| 		/*HACK ALERT!! This is kind of a hack. If the Run Away script changes the 4 would be inaccurate, but the run away script doesn't use this value so it's probably fine.*/ | ||||
| 		Monster::STRATEGY::RUN_AWAY(m,fElapsedTime,"Run Away"); | ||||
| 		return; | ||||
| 	} | ||||
| 
 | ||||
| @ -361,7 +360,7 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe | ||||
| 		}break; | ||||
| 		case 5:{ | ||||
| 			float targetSize=ConfigFloat("Phase5.SizeLossPerHit")/100*m.I(A::HITS_UNTIL_DEATH); | ||||
| 			Monster::STRATEGY::RUN_AWAY(m,fElapsedTime,4); | ||||
| 			Monster::STRATEGY::RUN_AWAY(m,fElapsedTime,"Run Away"); | ||||
| 			if(targetSize>0){ | ||||
| 				m.SetSize(targetSize,false); | ||||
| 			}else{ | ||||
|  | ||||
| @ -47,7 +47,7 @@ using A=Attribute; | ||||
| INCLUDE_game | ||||
| INCLUDE_BULLET_LIST | ||||
| 
 | ||||
| void Monster::STRATEGY::TURRET(Monster&m,float fElapsedTime,int strategyNumber){ | ||||
| void Monster::STRATEGY::TURRET(Monster&m,float fElapsedTime,std::string strategy){ | ||||
| 	m.attackCooldownTimer=std::max(0.f,m.attackCooldownTimer-fElapsedTime); | ||||
| 	if(m.F(A::SHOOT_ANIMATION_TIME)>0){ | ||||
| 		m.F(A::SHOOT_ANIMATION_TIME)=std::max(0.f,m.F(A::SHOOT_ANIMATION_TIME)-fElapsedTime); | ||||
|  | ||||
| @ -39,7 +39,7 @@ All rights reserved. | ||||
| #define VERSION_MAJOR 0 | ||||
| #define VERSION_MINOR 2 | ||||
| #define VERSION_PATCH 1 | ||||
| #define VERSION_BUILD 4140 | ||||
| #define VERSION_BUILD 4146 | ||||
| 
 | ||||
| #define stringify(a) stringify_(a) | ||||
| #define stringify_(a) #a | ||||
|  | ||||
| @ -36,9 +36,8 @@ | ||||
| # mob adopt a 5 second wait time. | ||||
| MonsterStrategy | ||||
| { | ||||
| 	0 | ||||
| 	Run Towards | ||||
| 	{ | ||||
| 		Name = Run Towards | ||||
| 		# How long to wait before attempting to path again. | ||||
| 		WaitTime = 3 | ||||
| 		# How far the monster will travel before reassessing for a new path. | ||||
| @ -46,9 +45,8 @@ MonsterStrategy | ||||
| 		# 1 of X chance to stop after bumping into something. | ||||
| 		BumpStopChance = 5 | ||||
| 	} | ||||
| 	1 | ||||
| 	Shoot Afar | ||||
| 	{ | ||||
| 		Name = Shoot Afar | ||||
| 		# How far away the monster attempts to distance itself from the player | ||||
| 		Range = 700 | ||||
| 		# If the player is farther than this distance, close in on them. | ||||
| @ -59,9 +57,8 @@ MonsterStrategy | ||||
| 		BulletSize = 20 | ||||
| 		BulletColor = 37, 131, 112, 255 | ||||
| 	} | ||||
| 	2 | ||||
| 	Turret | ||||
| 	{ | ||||
| 		Name = Turret | ||||
| 		# How far away the monster starts shooting from | ||||
| 		Range = 800 | ||||
| 		# How often the enemy shoots. | ||||
| @ -70,10 +67,9 @@ MonsterStrategy | ||||
| 		BulletSize = 30 | ||||
| 		BulletColor = 0, 255, 0, 255 | ||||
| 	} | ||||
| 	3 | ||||
| 	{ | ||||
| 	# The Slime King Boss script. | ||||
| 		Name = Slime King | ||||
| 	Slime King | ||||
| 	{ | ||||
| 		# Which phase to start on. Should be 1 most of the time. | ||||
| 		StartPhase = 1 | ||||
| 		# How much time a jump will be pre-telegraphed. | ||||
| @ -164,9 +160,8 @@ MonsterStrategy | ||||
| 			Change = 0% | ||||
| 		} | ||||
| 	} | ||||
| 	4 | ||||
| 	Run Away | ||||
| 	{ | ||||
| 		Name = Run Away | ||||
| 		# How far away the monster attempts to distance itself from the player | ||||
| 		Range = 700 | ||||
| 		# If the player is farther than this distance, close in on them. | ||||
|  | ||||
| @ -65,6 +65,9 @@ public: | ||||
| 	O&at(T key){ | ||||
| 		return map.at(key); | ||||
| 	} | ||||
| 	auto insert(T key,O obj){ | ||||
| 		return map.insert({key,obj}); | ||||
| 	} | ||||
| 	size_t count(T key){ | ||||
| 		return map.count(key); | ||||
| 	} | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user