Converted all Monster Strategy IDs to using strings instead of magic numbers, removed magic numbering system from configs.

This commit is contained in:
sigonasr2 2023-12-18 15:40:36 -06:00
parent cb09825455
commit 455dd3a818
17 changed files with 69 additions and 90 deletions

View File

@ -203,10 +203,6 @@ bool Crawler::OnUserCreate(){
ValidateGameStatus(); //Checks to make sure everything has been initialized properly. 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; return true;
} }

View File

@ -46,8 +46,7 @@ All rights reserved.
#define INCLUDE_BULLET_LIST extern std::vector<std::unique_ptr<Bullet>>BULLET_LIST; #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_EMITTER_LIST extern std::vector<std::unique_ptr<Emitter>>EMITTER_LIST;
#define INCLUDE_DATA extern utils::datafile DATA; #define INCLUDE_DATA extern utils::datafile DATA;
#define INCLUDE_STRATEGY_DATA extern safemap<std::string,int>STRATEGY_DATA; #define INCLUDE_STRATEGY_DATA extern safemap<std::string,std::function<void(Monster&,float,std::string)>>STRATEGY_DATA;
#define INCLUDE_STRATEGY_ID_DATA extern safemap<std::string,int>STRATEGY_ID_DATA;
#define INCLUDE_TILE_ANIMATION_DATA extern std::map<int,std::vector<std::pair<int,float>>>TILE_ANIMATION_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_GFX extern safemap<std::string,Renderable>GFX;
#define INCLUDE_ITEM_DATA extern safemap<std::string,ItemInfo>ITEM_DATA; #define INCLUDE_ITEM_DATA extern safemap<std::string,ItemInfo>ITEM_DATA;

View File

@ -106,6 +106,7 @@ void Merchant::Initialize(){
} }
std::cout<<std::format("Added {} merchants to Chapter {}",merchantCount,chapter)<<std::endl; std::cout<<std::format("Added {} merchants to Chapter {}",merchantCount,chapter)<<std::endl;
} }
Merchant::RandomizeTravelingMerchant();
} }
bool Merchant::CanPurchaseItem(IT item,uint32_t amt)const{ bool Merchant::CanPurchaseItem(IT item,uint32_t amt)const{
bool itemAvailable=false; bool itemAvailable=false;
@ -126,7 +127,7 @@ bool Merchant::CanPurchaseItem(IT item,uint32_t amt)const{
game->GetPlayer()->GetMoney()>=foundItem->BuyValue()*amt; game->GetPlayer()->GetMoney()>=foundItem->BuyValue()*amt;
}; };
bool Merchant::CanSellItem(IT item,uint32_t amt)const{ bool Merchant::CanSellItem(IT item,uint32_t amt)const{
ItemInfo&it=ITEM_DATA[item]; const ItemInfo&it=ITEM_DATA[item];
sellFunctionPrimed.amt=amt; sellFunctionPrimed.amt=amt;
sellFunctionPrimed.item=item; sellFunctionPrimed.item=item;
@ -168,7 +169,7 @@ void Merchant::SellItem(IT item,uint32_t amt){
} }
} }
if(!itemFound){ 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; totalCost=ITEM_DATA[item].GetSellValue()*amt;

View File

@ -54,11 +54,9 @@ INCLUDE_DAMAGENUMBER_LIST
INCLUDE_game INCLUDE_game
INCLUDE_BULLET_LIST INCLUDE_BULLET_LIST
INCLUDE_DATA INCLUDE_DATA
INCLUDE_STRATEGY_DATA
INCLUDE_GFX INCLUDE_GFX
safemap<std::string,int>STRATEGY_DATA; safemap<std::string,std::function<void(Monster&,float,std::string)>>STRATEGY_DATA;
safemap<int,std::string>STRATEGY_ID_DATA;
std::map<int,Renderable*>MonsterData::imgs; std::map<int,Renderable*>MonsterData::imgs;
Monster::Monster(vf2d pos,MonsterData data,bool upperLevel,bool bossMob): Monster::Monster(vf2d pos,MonsterData data,bool upperLevel,bool bossMob):
@ -248,7 +246,7 @@ void Monster::Collision(Monster&m){
Collision(); Collision();
} }
void Monster::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); SetState(State::NORMAL);
} }
} }
@ -406,15 +404,13 @@ void Monster::SetState(State::State newState){
} }
void Monster::InitializeStrategies(){ void Monster::InitializeStrategies(){
int readCounter=0; STRATEGY_DATA.insert("Run Towards",Monster::STRATEGY::RUN_TOWARDS);
while(DATA["MonsterStrategy"].HasProperty(std::to_string(readCounter))){ STRATEGY_DATA.insert("Shoot Afar",Monster::STRATEGY::SHOOT_AFAR);
std::string strategyName=DATA["MonsterStrategy"][std::to_string(readCounter)]["Name"].GetString(); STRATEGY_DATA.insert("Turret",Monster::STRATEGY::TURRET);
STRATEGY_DATA[strategyName]=readCounter; STRATEGY_DATA.insert("Slime King",Monster::STRATEGY::SLIMEKING);
STRATEGY_ID_DATA[readCounter]=strategyName; STRATEGY_DATA.insert("Run Away",Monster::STRATEGY::RUN_AWAY);
readCounter++;
}
STRATEGY_DATA.SetInitialized(); STRATEGY_DATA.SetInitialized();
STRATEGY_ID_DATA.SetInitialized();
} }
bool Monster::HasIframes(){ bool Monster::HasIframes(){
@ -425,8 +421,8 @@ float Monster::GetZ(){
return z; return z;
} }
std::string Monster::GetStrategy(){ const std::function<void(Monster&,float,std::string)>&Monster::GetStrategy()const{
return STRATEGY_ID_DATA[strategy]; return STRATEGY_DATA[strategy];
} }
void Monster::SetSize(float newSize,bool immediate){ void Monster::SetSize(float newSize,bool immediate){

View File

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

View File

@ -52,8 +52,8 @@ std::map<int,MonsterData>MONSTER_DATA;
safemap<std::string,MonsterData*>MONSTER_NAME_DATA; safemap<std::string,MonsterData*>MONSTER_NAME_DATA;
MonsterData::MonsterData() MonsterData::MonsterData()
:atk(0),collisionDmg(0),hp(0),id(0),moveSpd(0),size(0),strategy(0){} :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,int strategy,int collisionDmg): 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){} id(id),name(name),hp(hp),atk(atk),moveSpd(moveSpd),size(size),strategy(strategy),animations(animations),dropData(drops),collisionDmg(collisionDmg){}
void MonsterData::InitializeMonsterData(){ void MonsterData::InitializeMonsterData(){
@ -138,6 +138,11 @@ void MonsterData::InitializeMonsterData(){
dropDataCounter++; 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( MonsterData monster(
id, id,
MonsterName, MonsterName,
@ -147,7 +152,7 @@ void MonsterData::InitializeMonsterData(){
drops, drops,
float(DATA["Monsters"][std::to_string(id)]["MoveSpd"].GetReal())/100, float(DATA["Monsters"][std::to_string(id)]["MoveSpd"].GetReal())/100,
float(DATA["Monsters"][std::to_string(id)]["Size"].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() DATA["Monsters"][std::to_string(id)]["CollisionDmg"].GetInt()
); );
@ -177,7 +182,7 @@ int MonsterData::GetCollisionDmg(){
int MonsterData::GetID(){ int MonsterData::GetID(){
return id; return id;
} }
int MonsterData::GetAIStrategy(){ std::string MonsterData::GetAIStrategy(){
return strategy; return strategy;
} }
std::string MonsterData::GetDisplayName(){ std::string MonsterData::GetDisplayName(){

View File

@ -36,9 +36,9 @@ All rights reserved.
*/ */
#pragma endregion #pragma endregion
#pragma once #pragma once
#define ConfigInt(param) _GetInt(m,param,strategyNumber) #define ConfigInt(param) _GetInt(m,param,strategy)
#define ConfigFloat(param) _GetFloat(m,param,strategyNumber) #define ConfigFloat(param) _GetFloat(m,param,strategy)
#define ConfigString(param) _GetString(m,param,strategyNumber) #define ConfigString(param) _GetString(m,param,strategy)
#define ConfigIntArr(param,ind) _GetInt(m,param,strategyNumber,ind) #define ConfigIntArr(param,ind) _GetInt(m,param,strategy,ind)
#define ConfigFloatArr(param,ind) _GetFloat(m,param,strategyNumber,ind) #define ConfigFloatArr(param,ind) _GetFloat(m,param,strategy,ind)
#define ConfigStringArr(param,ind) _GetString(m,param,strategyNumber,ind) #define ConfigStringArr(param,ind) _GetString(m,param,strategy,ind)

View File

@ -40,45 +40,30 @@ All rights reserved.
#include "olcUTIL_DataFile.h" #include "olcUTIL_DataFile.h"
INCLUDE_DATA 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)){ if(DATA["Monsters"][std::to_string(m.id)].HasProperty(param)){
return DATA["Monsters"][std::to_string(m.id)].GetProperty(param).GetInt(index); return DATA["Monsters"][std::to_string(m.id)].GetProperty(param).GetInt(index);
} else { } 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)){ if(DATA["Monsters"][std::to_string(m.id)].HasProperty(param)){
return float(DATA["Monsters"][std::to_string(m.id)].GetProperty(param).GetReal(index)); return float(DATA["Monsters"][std::to_string(m.id)].GetProperty(param).GetReal(index));
} else { } 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)){ if(DATA["Monsters"][std::to_string(m.id)].HasProperty(param)){
return DATA["Monsters"][std::to_string(m.id)].GetProperty(param).GetString(index); return DATA["Monsters"][std::to_string(m.id)].GetProperty(param).GetString(index);
} else { } 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){ void Monster::STRATEGY::RUN_STRATEGY(Monster&m,float fElapsedTime){
switch(m.strategy){ m.GetStrategy()(m,fElapsedTime,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;
}
} }

View File

@ -43,7 +43,7 @@ All rights reserved.
INCLUDE_BULLET_LIST INCLUDE_BULLET_LIST
INCLUDE_game 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.targetAcquireTimer=std::max(0.f,m.targetAcquireTimer-fElapsedTime);
m.attackCooldownTimer=std::max(0.f,m.attackCooldownTimer-fElapsedTime); m.attackCooldownTimer=std::max(0.f,m.attackCooldownTimer-fElapsedTime);
geom2d::line line(m.pos,game->GetPlayer()->GetPos()); geom2d::line line(m.pos,game->GetPlayer()->GetPos());

View File

@ -43,7 +43,7 @@ All rights reserved.
INCLUDE_game INCLUDE_game
INCLUDE_MONSTER_DATA 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); m.targetAcquireTimer=std::max(0.f,m.targetAcquireTimer-fElapsedTime);
if(m.targetAcquireTimer==0){ if(m.targetAcquireTimer==0){
m.targetAcquireTimer=ConfigFloat("WaitTime"); m.targetAcquireTimer=ConfigFloat("WaitTime");

View File

@ -43,7 +43,7 @@ All rights reserved.
INCLUDE_BULLET_LIST INCLUDE_BULLET_LIST
INCLUDE_game 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.targetAcquireTimer=std::max(0.f,m.targetAcquireTimer-fElapsedTime);
m.attackCooldownTimer=std::max(0.f,m.attackCooldownTimer-fElapsedTime); m.attackCooldownTimer=std::max(0.f,m.attackCooldownTimer-fElapsedTime);
if(m.queueShotTimer>0){ if(m.queueShotTimer>0){

View File

@ -52,7 +52,7 @@ INCLUDE_MONSTER_NAME_DATA
using A=Attribute; 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; float bulletSpd=ConfigFloat("BulletSpd")/100*24;
m.F(A::SHOOT_TIMER)=std::max(0.f,m.F(A::SHOOT_TIMER)-fElapsedTime); 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){ if(m.F(A::RUN_AWAY_TIMER)>0){
Monster::STRATEGY::RUN_AWAY(m,fElapsedTime,4); Monster::STRATEGY::RUN_AWAY(m,fElapsedTime,"Run Away");
/*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.*/
return; return;
} }
@ -361,7 +360,7 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe
}break; }break;
case 5:{ case 5:{
float targetSize=ConfigFloat("Phase5.SizeLossPerHit")/100*m.I(A::HITS_UNTIL_DEATH); 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){ if(targetSize>0){
m.SetSize(targetSize,false); m.SetSize(targetSize,false);
}else{ }else{

View File

@ -47,7 +47,7 @@ using A=Attribute;
INCLUDE_game INCLUDE_game
INCLUDE_BULLET_LIST 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); m.attackCooldownTimer=std::max(0.f,m.attackCooldownTimer-fElapsedTime);
if(m.F(A::SHOOT_ANIMATION_TIME)>0){ 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); m.F(A::SHOOT_ANIMATION_TIME)=std::max(0.f,m.F(A::SHOOT_ANIMATION_TIME)-fElapsedTime);

View File

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 2 #define VERSION_MINOR 2
#define VERSION_PATCH 1 #define VERSION_PATCH 1
#define VERSION_BUILD 4140 #define VERSION_BUILD 4146
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

View File

@ -36,9 +36,8 @@
# mob adopt a 5 second wait time. # mob adopt a 5 second wait time.
MonsterStrategy MonsterStrategy
{ {
0 Run Towards
{ {
Name = Run Towards
# How long to wait before attempting to path again. # How long to wait before attempting to path again.
WaitTime = 3 WaitTime = 3
# How far the monster will travel before reassessing for a new path. # 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. # 1 of X chance to stop after bumping into something.
BumpStopChance = 5 BumpStopChance = 5
} }
1 Shoot Afar
{ {
Name = Shoot Afar
# How far away the monster attempts to distance itself from the player # How far away the monster attempts to distance itself from the player
Range = 700 Range = 700
# If the player is farther than this distance, close in on them. # If the player is farther than this distance, close in on them.
@ -59,9 +57,8 @@ MonsterStrategy
BulletSize = 20 BulletSize = 20
BulletColor = 37, 131, 112, 255 BulletColor = 37, 131, 112, 255
} }
2 Turret
{ {
Name = Turret
# How far away the monster starts shooting from # How far away the monster starts shooting from
Range = 800 Range = 800
# How often the enemy shoots. # How often the enemy shoots.
@ -70,10 +67,9 @@ MonsterStrategy
BulletSize = 30 BulletSize = 30
BulletColor = 0, 255, 0, 255 BulletColor = 0, 255, 0, 255
} }
3
{
# The Slime King Boss script. # The Slime King Boss script.
Name = Slime King Slime King
{
# Which phase to start on. Should be 1 most of the time. # Which phase to start on. Should be 1 most of the time.
StartPhase = 1 StartPhase = 1
# How much time a jump will be pre-telegraphed. # How much time a jump will be pre-telegraphed.
@ -164,9 +160,8 @@ MonsterStrategy
Change = 0% Change = 0%
} }
} }
4 Run Away
{ {
Name = Run Away
# How far away the monster attempts to distance itself from the player # How far away the monster attempts to distance itself from the player
Range = 700 Range = 700
# If the player is farther than this distance, close in on them. # If the player is farther than this distance, close in on them.

View File

@ -65,6 +65,9 @@ public:
O&at(T key){ O&at(T key){
return map.at(key); return map.at(key);
} }
auto insert(T key,O obj){
return map.insert({key,obj});
}
size_t count(T key){ size_t count(T key){
return map.count(key); return map.count(key);
} }