Class StratConFacility
StratConFacilityDefinition by ID and keeps only its
own state: who holds it, its tier, condition and garrison, how much the player knows about it, whether it has lent
its modifiers this week, whether it is a strategic objective, and any scenario modifiers added when it was placed.
What it does comes from the definition's profile for its current owner, so capturing it is just a change of owner.
Saves from before 0.51.01 held a full copy of the facility's old-format definition instead of an ID. Those
fields are still read, and resolveLegacyData() turns them into a definition ID once loading is done.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumHow badly a facility is damaged.static enumHow much the player knows about a facility.static enumHow large a facility is.static enum -
Constructor Summary
ConstructorsConstructorDescriptionFor loading from saves only.StratConFacility(StratConFacilityDefinition definition, ScenarioForceTemplate.ForceAlignment owner) Creates a facility of the given type, held by the given side. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAdditionalLocalModifiers(List<String> modifiers) Adds scenario modifiers to this facility alone, on top of its profile's local modifiers.voidaddTrait(FacilityTrait trait) Gives the facility a trait, unless it already has it.voidWorsens the facility after a fight on it that its holder lost: its condition drops one step, unless it is hardened, and its garrison loses one step.voidCosts the facility one garrison step after a fight on it that its holder did not lose.voidResets the ownership change score once a scenario's outcome has been settled, so it cannot carry over into the next scenario fought on this facility.voidReturns the biome temperature map (note: temperature mapping is in kelvins but stored in Celsius)intintgetIntel()booleanThis is a list of scenario modifier IDs that affect scenarios involving this facility directly: its garrison's, then any added when the facility was placed.intgetOwner()intintintThis is a list of scenario modifier IDs that affect scenarios in the same track as this facility.getTier()booleanbooleanhasTrait(FacilityTrait trait) voidbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanvoidRaises how much the player knows about the facility to at least the given level.voidremoveTrait(FacilityTrait trait) Takes a trait away from the facility, if it has it.voidTurns the old-format definition copy held by a facility from a save written before 0.51.01 into a definition ID.voidsetCondition(StratConFacility.FacilityCondition condition) voidsetGarrison(int garrison) Sets the facility's garrison, kept between 0 and its tier's maximum.voidSets how much the player knows about the facility, whether more or less than before.voidsetIsAvailable(boolean isAvailable) voidsetNetworked(boolean networked) voidvoidsetPlayerBuilt(boolean playerBuilt) voidsetStrategicObjective(boolean isStrategicObjective) voidSets the facility's tier, trimming its garrison to the new tier's maximum.voidsetVisible(boolean visible) Shorthand for the two intel changes most callers need:trueraises intel to at leastStratConFacility.FacilityIntel.SCOUTED, as scouting the hex does;falsehides the facility entirely.
-
Constructor Details
-
StratConFacility
public StratConFacility()For loading from saves only. -
StratConFacility
public StratConFacility(StratConFacilityDefinition definition, ScenarioForceTemplate.ForceAlignment owner) Creates a facility of the given type, held by the given side.- Parameters:
definition- the facility's typeowner- the side that holds it- Since:
- 0.51.01
-
-
Method Details
-
getDefinitionId
- Returns:
- the ID of the facility's definition
- Since:
- 0.51.01
-
getDefinition
- Returns:
- the facility's definition. If no loaded definition has its ID, an empty placeholder named after the ID, so a facility whose data has gone missing does nothing rather than breaking the sector.
- Since:
- 0.51.01
-
isDefinitionMissing
public boolean isDefinitionMissing()- Returns:
trueif no loaded definition has the facility's ID, so it stands on a placeholder. Its type is only a stand-in for drawing it: it is no source of supply and no synergy partner.- Since:
- 0.51.01
-
getProfile
- Returns:
- the profile that applies while the facility's current owner holds it
- Since:
- 0.51.01
-
getOwner
-
setOwner
-
isPlayerBuilt
public boolean isPlayerBuilt()- Returns:
trueif the player's side raised this facility with a Build order and still holds it. Such a facility costs upkeep each month and makes the next Build dearer.- Since:
- 0.51.01
-
setPlayerBuilt
public void setPlayerBuilt(boolean playerBuilt) -
getTraits
- Returns:
- the facility's traits, in the order they were given; the list itself, so callers may change it
- Since:
- 0.51.01
-
hasTrait
- Parameters:
trait- a trait- Returns:
trueif the facility has it- Since:
- 0.51.01
-
addTrait
Gives the facility a trait, unless it already has it. A conflicting trait it has is replaced.- Parameters:
trait- the trait to give- Since:
- 0.51.01
-
removeTrait
Takes a trait away from the facility, if it has it.- Parameters:
trait- the trait to remove- Since:
- 0.51.01
-
isReadyToSurrender
public boolean isReadyToSurrender()- Returns:
trueif the facility's garrison is low enough that it surrenders to a siege: none left, or one step left for a garrison with poor morale- Since:
- 0.51.01
-
isNetworked
public boolean isNetworked()- Returns:
trueif the facility has been linked to its holder's supply lines since it last changed sides. Only such a facility can be cut off; one that was never on them supplies itself.- Since:
- 0.51.01
-
setNetworked
public void setNetworked(boolean networked) -
isOwnerAlliedToPlayer
public boolean isOwnerAlliedToPlayer()- Returns:
trueif the facility owner is either allied to the player or is the player themselves,falseotherwise.
-
getFormattedDisplayableName
-
getDisplayableName
-
getFacilityType
-
getUserDescription
- Returns:
- what the facility does while its current owner holds it, or
nullif the profile has no description
-
getTier
- Returns:
- the facility's tier;
StratConFacility.FacilityTier.BASEfor one saved before tiers existed - Since:
- 0.51.01
-
setTier
Sets the facility's tier, trimming its garrison to the new tier's maximum.- Parameters:
tier- the new tier- Since:
- 0.51.01
-
getCondition
- Returns:
- the facility's condition;
StratConFacility.FacilityCondition.INTACTfor one saved before conditions existed - Since:
- 0.51.01
-
setCondition
-
getGarrison
public int getGarrison()- Returns:
- the facility's garrison, in steps from 0 to its tier's maximum; a full garrison for one saved before garrisons existed
- Since:
- 0.51.01
-
setGarrison
public void setGarrison(int garrison) Sets the facility's garrison, kept between 0 and its tier's maximum.- Parameters:
garrison- the new garrison, in steps- Since:
- 0.51.01
-
getGarrisonMaximum
public int getGarrisonMaximum()- Returns:
- the most garrison steps the facility can hold: its tier's maximum, one fewer if it is undermanned
- Since:
- 0.51.01
-
getIntel
- Returns:
- how much the player knows about the facility. Everything, if the player's side holds it.
- Since:
- 0.51.01
-
setIntel
Sets how much the player knows about the facility, whether more or less than before.- Parameters:
intel- the new intel level- Since:
- 0.51.01
-
raiseIntel
Raises how much the player knows about the facility to at least the given level. Never lowers it.- Parameters:
level- the level the player now has at least- Since:
- 0.51.01
-
getVisible
public boolean getVisible()- Returns:
trueif the player knows at least where the facility is
-
setVisible
public void setVisible(boolean visible) Shorthand for the two intel changes most callers need:trueraises intel to at leastStratConFacility.FacilityIntel.SCOUTED, as scouting the hex does;falsehides the facility entirely.- Parameters:
visible- whether the player has seen the facility
-
isVisible
public boolean isVisible() -
getIsAvailable
public boolean getIsAvailable() -
setIsAvailable
public void setIsAvailable(boolean isAvailable) -
isAvailable
public boolean isAvailable() -
getLocalModifiers
This is a list of scenario modifier IDs that affect scenarios involving this facility directly: its garrison's, then any added when the facility was placed.The garrison follows a ladder. With none left, the facility has no defenders of its own. At one step it has the current profile's local modifiers; each step above that adds the next garrison modifier for the holding side that the profile doesn't already have.
-
getAdditionalLocalModifiers
- Returns:
- the scenario modifier IDs added to this facility alone when it was placed, such as those of the objective it serves
- Since:
- 0.51.01
-
addAdditionalLocalModifiers
Adds scenario modifiers to this facility alone, on top of its profile's local modifiers.- Parameters:
modifiers- the scenario modifier IDs to add- Since:
- 0.51.01
-
isStrategicObjective
public boolean isStrategicObjective() -
setStrategicObjective
public void setStrategicObjective(boolean isStrategicObjective) -
getBiomes
-
getBiomeTempMap
Returns the biome temperature map (note: temperature mapping is in kelvins but stored in Celsius) -
incrementOwnershipChangeScore
public void incrementOwnershipChangeScore() -
decrementOwnershipChangeScore
public void decrementOwnershipChangeScore() -
getOwnershipChangeScore
public int getOwnershipChangeScore() -
clearOwnershipChangeScore
public void clearOwnershipChangeScore()Resets the ownership change score once a scenario's outcome has been settled, so it cannot carry over into the next scenario fought on this facility.- Since:
- 0.51.01
-
isRevealingTrack
public boolean isRevealingTrack()- Returns:
- whether the facility reveals its whole sector while its current owner holds it; never while crippled
-
getScanRangeIncrease
public int getScanRangeIncrease()- Returns:
- hexes the facility adds to the scan range of forces scouting its sector while its current owner holds it, adjusted for its condition
-
getScenarioOddsModifier
public int getScenarioOddsModifier()- Returns:
- the facility's change to its sector's scenario odds, adjusted for its condition
-
getMonthlySupportPoints
public int getMonthlySupportPoints()- Returns:
- the facility's monthly Employer Support change while its current owner holds it, with any extra from a well-stocked facility your side holds, adjusted for its condition
-
isPreventingAerospace
public boolean isPreventingAerospace()- Returns:
- whether the facility keeps air and space scenarios out of its sector; never while crippled
-
applyAttackerVictory
public void applyAttackerVictory()Worsens the facility after a fight on it that its holder lost: its condition drops one step, unless it is hardened, and its garrison loses one step.- Since:
- 0.51.01
-
applyDefenderHeld
public void applyDefenderHeld()Costs the facility one garrison step after a fight on it that its holder did not lose.- Since:
- 0.51.01
-
resolveLegacyData
public void resolveLegacyData()Turns the old-format definition copy held by a facility from a save written before 0.51.01 into a definition ID. The facility is matched to the loaded definition of the sameStratConFacility.FacilityType; any local modifiers beyond that definition's own are kept as the facility's additional ones. A facility that matches no loaded definition keeps its old data as a detached definition, so it still behaves as it did.Saves from before 0.51.01 also held a plain visibility flag, which becomes an intel level: seen facilities count as
StratConFacility.FacilityIntel.SCOUTED. Tier, condition and garrison take their defaults for such facilities (a fullStratConFacility.FacilityTier.BASE).Matching does nothing for a facility that already has a definition ID.
- Since:
- 0.51.01
-