Files
dota_factory/src/lib/config/ShipsConfig.h

92 lines
1.9 KiB
C++

#pragma once
#include <optional>
#include <string>
#include <vector>
#include "Formula.h"
#include "RecipesConfig.h" // for RecipeIngredient
// Build materials and initial per-schematic production level
// (REQ-BLD-SHIPYARD, REQ-DEF-SCHEMATIC-DROP).
struct ShipSchematic
{
std::vector<RecipeIngredient> materials;
int playerProductionLevel;
double productionTimeSeconds;
};
// Wave scheduling cost (REQ-WAV-THREAT-COST). Ships with cost_formula that
// always evaluates to 0 are ineligible as wave picks.
struct ShipThreat
{
Formula costFormula;
};
struct ShipHealth
{
Formula hpFormula; // REQ-SHP-STATS
};
struct ShipMovement
{
Formula speedFormula; // REQ-SHP-STATS, REQ-SHP-MOVEMENT
};
struct ShipSensor
{
Formula sensorRangeFormula; // REQ-SHP-SENSOR, REQ-SHP-STATS
};
struct ShipCombat
{
Formula damageFormula;
Formula attackRangeFormula;
Formula attackRateFormula; // shots per second
};
// Optional; present only on salvage ships (REQ-SHP-SALVAGE).
struct ShipSalvage
{
double collectionRange;
int cargoCapacity;
};
// Optional; present only on repair ships (REQ-SHP-REPAIR).
struct ShipRepair
{
Formula repairRateFormula;
Formula repairRangeFormula;
};
// Scrap dropped on destruction (REQ-RES-SCRAP-DROP).
struct ShipLoot
{
int scrapDrop;
};
struct ShipDef
{
std::string id;
bool availableFromStart;
ShipSchematic schematic;
ShipThreat threat;
ShipHealth health;
ShipMovement movement;
ShipSensor sensor;
ShipLoot loot;
// Role-specific sections. A ship is a combat ship if combat is present,
// a salvage ship if salvage is present, etc. A ship may have multiple
// of these set (hybrid ships) once the behavior systems support it.
std::optional<ShipCombat> combat;
std::optional<ShipSalvage> salvage;
std::optional<ShipRepair> repair;
};
struct ShipsConfig
{
std::vector<ShipDef> ships;
};