Subsystem: NuclearMissileSilo
	Name: #NUCLEARMISSILESILO_NAME
	Description: #NUCLEARMISSILESILO_DESC
	BaseColor: #993366 // #7946f9
	TypeColor: #993366 // #7946f9
	Picture: SubsystemButtonArt::4
	Elevation: 2

	Tags: BaseCost, HeraldsDLC
	Tags: WeaponBase, MissileBase, Category:Weapons, Rotatable, NuclearWarhead, SecondaryDPS
	Tags: Weapon, IsExplosiveWeapon, HasInternals, Homing
	Hull: Flagship, Station

	Size := HexSize * Hexes
	Range := (Size + 1500) * 2
	Damage := Size * 100
	Reload := 120.0 * min(1.0 + Size/512, 2.0)
	Speed := max(50, Range / 90)
	//Speed := max(100, Range / 45)
	Tracking := 1.5
	Radius := 50.0 + (log(Size*16) / log(2) * 12.0)
	SupplyCost := 0
	PowerUse := 10 * Size
	Hex.Mass := HexSize

	out DPS := Damage / Reload * 5

	Hex.MaintainCost := 2.0 * Size

	//HasWarhead := 1
	NumNukeSilos := 1
	//NuclearWarheadCost := 2.0 * ShipSize
	NuclearWarheadCost := ShipSize
	NuclearWarheadLabor := 0.2 * ShipSize
	//NuclearWarheadStorage := Sum.NumNukeSilos * 4
	//NuclearWarheadStorage := Sum.Hexes
	NuclearWarheadStorage := 1
	//NuclearWarheadStorage := NuclearWarheadStorage + 1

	Hex.HP := 18 * HexSize
	Hex.Resistance := 0.2

	Hook: OnEnable(AddStatus(NuclearWarhead))
	Hook: LimitStatusStacks(NuclearWarhead, NuclearWarheadStorage)
	//Hook: LimitStatusStacks(NuclearWarhead, Sum.NumNukeSilos)
	//Hook: LimitStatusStacks(NuclearWarhead, Sum.Hexes)
	//Hook: RefillStatusConstruction(Warhead, WarheadStorage, Warhead)

	Modifier: AoERadiusFactor(Factor)
		Radius := Radius * Factor

	Requires:
		Command = 1
		Power = PowerUse

	Assert: Sum.NumNukeSilos <= 1
		Unique: True
		Message: Designs may only have 1 Nuclear Missile Silo.

	Assert: Hexes <= 16
		Message: Nuclear Missile Silo may not be larger than 16 hexes.

	Module: Default

	Module: Core
		Hex.HP := Hex.HP * 3
		Hex.BuildCost := 5.0 * Hex.BuildCost + NuclearWarheadCost
		Hex.LaborCost := Hex.LaborCost + NuclearWarheadLabor
		Hex.Mass := 5.0 * Hex.Mass

		Sprite: Warhead::0
		DrawMode: 1

		Hex.DamageResist := ShipSize / 64.0
		Effect: DamageResist
			Resist = Hex.DamageResist

	Module: NuclearWarheadTube
		Name: #S_NUCLEARWARHEAD_TUBE
		Description: #S_NUCLEARWARHEAD_TUBE_DESC
		DefaultUnlock: True

		Sprite: WarheadTube
		
		Hook: OnEnable(AddStatus(NuclearWarhead))

		NuclearWarheadStorage := NuclearWarheadStorage + 1
		Hex.BuildCost := Hex.BuildCost + NuclearWarheadCost
		Hex.LaborCostt := Hex.BuildCost + NuclearWarheadLabor

	Effector: NuclearMissile
		Range = Range
		Damage = Damage
		Reload = Reload
		Speed = Speed
		Tracking = Tracking
		Radius = Radius
		//SupplyCost = SupplyCost * Reload
