Include code to analyze monster spawns
This commit is contained in:
parent
812791de8a
commit
3ba7d0519b
@ -78,6 +78,7 @@ All rights reserved.
|
|||||||
INCLUDE_EMITTER_LIST
|
INCLUDE_EMITTER_LIST
|
||||||
INCLUDE_ITEM_CATEGORIES
|
INCLUDE_ITEM_CATEGORIES
|
||||||
INCLUDE_BACKDROP_DATA
|
INCLUDE_BACKDROP_DATA
|
||||||
|
INCLUDE_MONSTER_DATA
|
||||||
|
|
||||||
bool _DEBUG_MAP_LOAD_INFO = false;
|
bool _DEBUG_MAP_LOAD_INFO = false;
|
||||||
//360x240
|
//360x240
|
||||||
@ -2321,6 +2322,43 @@ void AiL::InitializeLevels(){
|
|||||||
backdrop.Load("backdrop_directory"_S+DATA["Backdrops"][key].GetString(),nullptr,false,false);
|
backdrop.Load("backdrop_directory"_S+DATA["Backdrops"][key].GetString(),nullptr,false,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if("display_spawn_report"_I){
|
||||||
|
for(auto&[map,data]:MAP_DATA){
|
||||||
|
std::map<std::string,long>monsterCounts;
|
||||||
|
for(auto&[key,value]:MAP_DATA[map].SpawnerData){
|
||||||
|
SpawnerTag&spawnData=MAP_DATA[map].SpawnerData[key];
|
||||||
|
|
||||||
|
vf2d spawnerRadius=vf2d{spawnData.ObjectData.GetFloat("width"),spawnData.ObjectData.GetFloat("height")}/2;
|
||||||
|
for(XMLTag&monster:spawnData.monsters){
|
||||||
|
std::string monsterName=monster.GetString("value");
|
||||||
|
monsterCounts[monsterName]++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::cout<<"Spawns Report for "<<map<<":"<<std::endl;
|
||||||
|
for(auto&[monster,count]:monsterCounts){
|
||||||
|
std::cout<<"\t"<<count<<"x "<<monster<<std::endl;
|
||||||
|
}
|
||||||
|
std::map<ItemInfo*,long>totalDrops;
|
||||||
|
std::cout<<"Monte Carlo Test: 1 million tries:"<<std::endl;
|
||||||
|
for(int i=0;i<1000000;i++){
|
||||||
|
//Try to kill every single monster and see what drops.
|
||||||
|
for(auto&[monster,count]:monsterCounts){
|
||||||
|
Monster m=Monster{{0,0},MONSTER_DATA[monster]};
|
||||||
|
for(int j=0;j<count;j++){
|
||||||
|
auto drops=m.SpawnDrops();
|
||||||
|
for(auto&[itemInfo,count]:drops){
|
||||||
|
totalDrops[itemInfo]+=count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::cout<<"Average: "<<std::endl;
|
||||||
|
for(auto&[itemInfo,count]:totalDrops){
|
||||||
|
std::cout<<"\t"<<itemInfo->Name()<<" x"<<(count/1000000l);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Test::RunMapTests();
|
Test::RunMapTests();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user