Class WarSimScript
java.lang.Object
com.fs.starfarer.api.impl.campaign.command.WarSimScript
- All Implemented Interfaces:
ObjectiveEventListener
,EveryFrameScript
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final float
static final float
static final String
protected List<StarSystemAPI>
protected TimeoutTracker<String>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addObjectiveActionResponse
(SectorEntityToken objective, FactionAPI faction, FactionAPI enemy) void
advance
(float amount) Use SectorAPI.getClock() to convert to campaign days.protected String
getBuildSimTimeoutId
(SectorEntityToken objective) protected String
getControlSimTimeoutId
(SectorEntityToken objective) protected String
getControlTimeoutId
(SectorEntityToken objective, FactionAPI faction) static WarSimScript.LocationDanger
getDangerFor
(float factionStrength, float enemyStrength) static WarSimScript.LocationDanger
getDangerFor
(FactionAPI faction, StarSystemAPI system) static WarSimScript.LocationDanger
getDangerFor
(String factionId, StarSystemAPI system) static float
getEnemyStrength
(FactionAPI faction, StarSystemAPI system) static float
getEnemyStrength
(FactionAPI faction, StarSystemAPI system, boolean assumeHostileToPlayer) static float
getEnemyStrength
(String factionId, StarSystemAPI system) static float
getEnemyStrength
(String factionId, StarSystemAPI system, boolean assumeHostileToPlayer) static float
getFactionStrength
(FactionAPI faction, StarSystemAPI system) static float
getFactionStrength
(String factionId, StarSystemAPI system) static CountingMap<FactionAPI>
getFactionStrengths
(StarSystemAPI system) static WarSimScript
static float
getRelativeEnemyStrength
(String factionId, StarSystemAPI system) static float
getRelativeFactionStrength
(String factionId, StarSystemAPI system) protected String
getStarSystemTimeoutId
(StarSystemAPI system) static float
getStationStrength
(FactionAPI faction, StarSystemAPI system, SectorEntityToken from) static boolean
isAlreadyFightingFor
(SectorEntityToken objective, FactionAPI faction) boolean
isDone()
void
processStarSystem
(StarSystemAPI system) protected Object
static void
removeFightOrdersFor
(SectorEntityToken target, FactionAPI faction) static void
removeNoFightingTimeoutForObjective
(SectorEntityToken objective, FactionAPI faction) void
reportObjectiveChangedHands
(SectorEntityToken objective, FactionAPI from, FactionAPI to) void
reportObjectiveDestroyed
(SectorEntityToken objective, SectorEntityToken stableLocation, FactionAPI enemy) boolean
static void
setNoFightingForObjective
(SectorEntityToken objective, FactionAPI faction, float timeout) protected boolean
wantsToOwnObjective
(FactionAPI faction, CountingMap<FactionAPI> str, SectorEntityToken o) If it doesn't already own it, it's owned by an enemy, and the faction either has the closest market to it or is the strongest in-system faction.
-
Field Details
-
KEY
- See Also:
-
CHECK_DAYS
public static final float CHECK_DAYS- See Also:
-
CHECK_PROB
public static final float CHECK_PROB- See Also:
-
timeouts
-
queue
-
-
Constructor Details
-
WarSimScript
public WarSimScript()
-
-
Method Details
-
getInstance
-
readResolve
-
advance
public void advance(float amount) Description copied from interface:EveryFrameScript
Use SectorAPI.getClock() to convert to campaign days.- Specified by:
advance
in interfaceEveryFrameScript
- Parameters:
amount
- seconds elapsed during the last frame.
-
processStarSystem
-
wantsToOwnObjective
protected boolean wantsToOwnObjective(FactionAPI faction, CountingMap<FactionAPI> str, SectorEntityToken o) If it doesn't already own it, it's owned by an enemy, and the faction either has the closest market to it or is the strongest in-system faction. Or: owned by a non-hostile faction that has no colony presence in the system, and this faction does- Parameters:
faction
-str
-o
-- Returns:
-
reportObjectiveChangedHands
public void reportObjectiveChangedHands(SectorEntityToken objective, FactionAPI from, FactionAPI to) - Specified by:
reportObjectiveChangedHands
in interfaceObjectiveEventListener
-
reportObjectiveDestroyed
public void reportObjectiveDestroyed(SectorEntityToken objective, SectorEntityToken stableLocation, FactionAPI enemy) - Specified by:
reportObjectiveDestroyed
in interfaceObjectiveEventListener
-
getStarSystemTimeoutId
-
getBuildSimTimeoutId
-
getControlSimTimeoutId
-
getControlTimeoutId
-
addObjectiveActionResponse
protected void addObjectiveActionResponse(SectorEntityToken objective, FactionAPI faction, FactionAPI enemy) -
isDone
public boolean isDone()- Specified by:
isDone
in interfaceEveryFrameScript
- Returns:
- true when the script is finished and can be cleaned up by the engine.
-
runWhilePaused
public boolean runWhilePaused()- Specified by:
runWhilePaused
in interfaceEveryFrameScript
- Returns:
- whether advance() should be called while the campaign engine is paused.
-
getFactionStrengths
-
getRelativeEnemyStrength
-
getRelativeFactionStrength
-
getEnemyStrength
-
getEnemyStrength
-
getEnemyStrength
public static float getEnemyStrength(String factionId, StarSystemAPI system, boolean assumeHostileToPlayer) -
getEnemyStrength
public static float getEnemyStrength(FactionAPI faction, StarSystemAPI system, boolean assumeHostileToPlayer) -
getFactionStrength
-
getFactionStrength
-
getStationStrength
public static float getStationStrength(FactionAPI faction, StarSystemAPI system, SectorEntityToken from) -
getTimeouts
-
removeFightOrdersFor
-
setNoFightingForObjective
public static void setNoFightingForObjective(SectorEntityToken objective, FactionAPI faction, float timeout) -
removeNoFightingTimeoutForObjective
public static void removeNoFightingTimeoutForObjective(SectorEntityToken objective, FactionAPI faction) -
isAlreadyFightingFor
-
getDangerFor
-
getDangerFor
-
getDangerFor
-