allow to configure when which schematic gets unlockable
This commit is contained in:
@@ -66,8 +66,8 @@ Simulation::Simulation(GameConfig config, unsigned int seed)
|
||||
for (const ShipDef& def : m_config.ships.ships)
|
||||
{
|
||||
SchematicState state;
|
||||
state.unlocked = def.availableFromStart;
|
||||
state.level = def.availableFromStart ? def.schematic.playerProductionLevel : 0;
|
||||
state.unlocked = (def.unlockAtStationLevel == -1);
|
||||
state.level = (def.unlockAtStationLevel == -1) ? def.schematic.playerProductionLevel : 0;
|
||||
m_schematicLevels[def.id] = state;
|
||||
}
|
||||
|
||||
@@ -139,8 +139,8 @@ void Simulation::reset(unsigned int seed)
|
||||
for (const ShipDef& def : m_config.ships.ships)
|
||||
{
|
||||
SchematicState state;
|
||||
state.unlocked = def.availableFromStart;
|
||||
state.level = def.availableFromStart ? def.schematic.playerProductionLevel : 0;
|
||||
state.unlocked = (def.unlockAtStationLevel == -1);
|
||||
state.level = (def.unlockAtStationLevel == -1) ? def.schematic.playerProductionLevel : 0;
|
||||
m_schematicLevels[def.id] = state;
|
||||
}
|
||||
|
||||
@@ -473,19 +473,23 @@ void Simulation::tickDeathsAndLoot()
|
||||
if (es0Gone && es1Gone &&
|
||||
m_currentEnemyStationEntities[0] != entt::null)
|
||||
{
|
||||
const int destroyedLevel = m_waveSystem->generation();
|
||||
m_waveSystem->onEnemyStationsDestroyed();
|
||||
placeEnemyStationSet(m_waveSystem->generation());
|
||||
awardSchematicDrop();
|
||||
awardSchematicDrop(destroyedLevel);
|
||||
}
|
||||
}
|
||||
|
||||
void Simulation::awardSchematicDrop()
|
||||
void Simulation::awardSchematicDrop(int destroyedStationLevel)
|
||||
{
|
||||
std::vector<std::string> ids;
|
||||
ids.reserve(m_config.ships.ships.size());
|
||||
for (const ShipDef& def : m_config.ships.ships)
|
||||
{
|
||||
ids.push_back(def.id);
|
||||
if (def.unlockAtStationLevel == -1 || def.unlockAtStationLevel <= destroyedStationLevel)
|
||||
{
|
||||
ids.push_back(def.id);
|
||||
}
|
||||
}
|
||||
|
||||
std::uniform_int_distribution<int> dist(0, static_cast<int>(ids.size()) - 1);
|
||||
|
||||
Reference in New Issue
Block a user