implement waves

This commit is contained in:
2026-04-20 14:10:01 +02:00
parent 65de4ddc5c
commit 498b97db20
17 changed files with 1798 additions and 18 deletions

View File

@@ -1,7 +1,9 @@
#pragma once
#include <map>
#include <memory>
#include <random>
#include <string>
#include <vector>
#include "BeltSystem.h"
@@ -12,8 +14,10 @@
#include "Tick.h"
class BuildingSystem;
class CombatSystem;
class ShipSystem;
class ScrapSystem;
class WaveSystem;
class Simulation
{
@@ -31,8 +35,14 @@ public:
// Returns all blueprint drop events since the last drain.
std::vector<BlueprintDropEvent> drainBlueprintDropEvents();
Tick currentTick() const;
int buildingBlocksStock() const;
Tick currentTick() const;
int buildingBlocksStock() const;
bool isGameOver() const;
double threatLevel() const;
// Blueprint state queries.
int blueprintLevel(const std::string& shipId) const;
bool isBlueprintUnlocked(const std::string& shipId) const;
BuildingSystem& buildings();
const BuildingSystem& buildings() const;
@@ -46,17 +56,47 @@ public:
private:
EntityId allocateId(); // Strictly increasing; never returns kInvalidEntityId.
// Populate HQ, player defence stations, and the first enemy station set.
void placeInitialStructures();
// Place two enemy defence stations for the given generation level.
// Stores their IDs in m_currentEnemyStationIds.
void placeEnemyStationSet(int generation);
// Tick step 9: remove dead ships and buildings, drop scrap, handle push.
void tickDeathsAndLoot();
// Award a random blueprint drop (REQ-DEF-BLUEPRINT-DROP) and emit the event.
void awardBlueprintDrop();
const GameConfig& m_config;
std::mt19937 m_rng;
Tick m_currentTick;
EntityId m_nextId;
int m_buildingBlocksStock;
bool m_gameOver = false;
// Pre-placed structure IDs.
EntityId m_hqId;
EntityId m_playerStation1Id;
EntityId m_playerStation2Id;
EntityId m_currentEnemyStationIds[2];
// Blueprint unlock state (REQ-DEF-BLUEPRINT-DROP).
struct BlueprintState
{
bool unlocked;
int level;
};
std::map<std::string, BlueprintState> m_blueprintLevels;
BeltSystem m_beltSystem;
std::unique_ptr<BuildingSystem> m_buildingSystem;
std::unique_ptr<ShipSystem> m_shipSystem;
std::unique_ptr<ScrapSystem> m_scrapSystem;
std::unique_ptr<WaveSystem> m_waveSystem;
std::unique_ptr<CombatSystem> m_combatSystem;
std::vector<FireEvent> m_fireEvents;
std::vector<BlueprintDropEvent> m_blueprintDropEvents;