Subsystem: AncientsShieldGenerator
	Name: #ANCIENTSSHIELDGENERATOR_NAME
	Description: #ANCIENTSSHIELDGENERATOR_DESC
	BaseColor: #0044db
	Elevation: 1

	DamageOrder: -100

	Tags: BaseCost
	Tags: IsShield, Defense, Category:Defense, HasInternals, ShieldBase
	Tags: SecondaryDefense
	Hull: Flagship, Station

	Size := HexSize * Hexes
	ShieldCapacity := Size * 60
	ShieldRegen := Size * 2.5
	//ShieldHexes := Hexes
	ShieldHexes := max(Hexes*128/(ShipSize/HexSize), 1.0)
	PowerUse := 12.5 * Size

	//Shield Mitigation
	ShieldMitFactor := 6
	ShieldMitCap := 65
	//Mitigation := min((1 - pow((1-ShieldMitFactor/100), (Sum.ShieldHexes-1))) * 100, 75)
	//Mitigation := min((1 - pow((1-ShieldMitFactor/100), (ShieldHexes-1))) * 100, 75)
	Mitigation := min((1 - pow((1-ShieldMitFactor/100), (ShieldHexes-1))) * 100, ShieldMitCap)
	//This is only for data display purposes
	ShieldAbsorbRate := ShieldRegen / (1 - Mitigation/100)

	//Must limit to one for mitigation calculations to work correctly
	HasShieldGen := 1

	Hex.Resistance := 0.5
	Hex.HP := 12 * HexSize
	Hex.Mass := 2.5 * HexSize
	Hex.MaintainCost := 4.0 * HexSize

	//Effect: ShieldDamage
	Effect: DOFShieldDamage
		Mitigation = Mitigation
	
	Requires:
		Command = 1
		Power = PowerUse

	//Enforce one generator limit
	Assert: Sum.HasShieldGen <= 1
		Unique: True
		Message: #ERROR_ONLY_ONE
	
	Module: Core
		Sprite: DOFGenerator1
		Hex.BuildCost := 3.5 * Hex.BuildCost
