1package com.fs.starfarer.api.impl.hullmods;
3import java.util.ArrayList;
4import java.util.LinkedHashSet;
10import com.fs.starfarer.api.Global;
11import com.fs.starfarer.api.combat.BaseHullMod;
12import com.fs.starfarer.api.combat.MutableShipStatsAPI;
13import com.fs.starfarer.api.combat.ShipAPI;
14import com.fs.starfarer.api.combat.ShipAPI.HullSize;
15import com.fs.starfarer.api.graphics.SpriteAPI;
16import com.fs.starfarer.api.impl.campaign.ids.HullMods;
17import com.fs.starfarer.api.impl.campaign.ids.Stats;
18import com.fs.starfarer.api.impl.campaign.ids.Strings;
19import com.fs.starfarer.api.loading.FighterWingSpecAPI;
20import com.fs.starfarer.api.ui.Alignment;
21import com.fs.starfarer.api.ui.TooltipMakerAPI;
22import com.fs.starfarer.api.util.Misc;
63 cost +=
spec.getOpCost(stats);
74 List<String> result =
new ArrayList<>();
85 return new ArrayList<String>();
94 return 1f + dpMod / suppliesPerDep;
103 boolean sMod =
isSMod(stats);
107 else if (hullSize == HullSize.CAPITAL_SHIP) bonus =
SMOD_CAPITAL;
178 return "Ship's combat readiness lost per deployment is too high";
180 if (ship !=
null && ship.
isFrigate())
return "Can not be installed on a frigate";
184 return "Can not be installed on a phase ship";
199 if (sprite !=
null) {
211 cat =
"fighterSkinsPlayerOnly";
214 if (skin !=
null)
return skin;
216 cat =
"fighterSkinsPlayerAndNPC";
224 String exclude =
"fighterSkinsExcludeFromSharing";
231 List<SpriteAPI> matching =
new ArrayList<SpriteAPI>();
232 for (String key : skins) {
233 if (key.equals(
id +
"_" + style)) {
236 if (key.startsWith(
id) && !noSharing.contains(key)) {
241 if (!matching.isEmpty()) {
243 float minDist = Float.MAX_VALUE;
247 if (dist < minDist) {
290 tooltip.
addPara(
"Converts the ship's standard shuttle hangar to house a fighter bay. "
291 +
"The improvised flight deck, its crew, and the related machinery all function "
292 +
"at a pace below that of a dedicated carrier.", opad);
303 tooltip.
addPara(
"Increases fighter refit time by %s, "
304 +
"and the fighter replacement rate both decays and recovers %s more slowly. "
305 +
"In addition, bombers returning to rearm (or fighters returning for repairs) "
306 +
"take %s of their base refit time to relaunch, "
307 +
"where normally it takes under a second. "
314 tooltip.
addPara(
"Increases the minimum crew by %s to account for pilots and flight crews. "
315 +
"Increases the ship's deployment points and supply cost to recover "
316 +
"from deployment by %s for every %s ordnance points spent on "
317 +
"fighters, or by at least %s point. This comes with a proportional increase "
318 +
"in combat readiness lost per deployment.", opad, h,
324 if (isForModSpec || ship ==
null || ship.
getMutableStats() ==
null)
return;
339 tooltip.
addPara(
"Deployment cost: %s", opad, h,
"+" + dpMod);
343 float sizeW = width - numW - 10f;
348 new Object [] {
"Wing", sizeW,
"Seconds to relaunch", numW});
352 float refitPortion =
spec.getRefitTime() *
371 List<String> negated =
new ArrayList<String>();
372 if (!refitPenalty) negated.add(
"refit time and rate recovery modifiers");
373 if (!rearmIncrease) negated.add(
"relaunch delay");
374 if (!crewIncrease) negated.add(
"increased crew requirement");
375 if (!dpIncrease) negated.add(
"deployment cost increase");
377 if (!negated.isEmpty()) {
379 String isOrAre =
"is";
380 if (negated.size() > 1) isOrAre =
"are";
381 if (negated.size() >= 4) isOrAre +=
" all";
static SettingsAPI getSettings()
boolean isSMod(MutableShipStatsAPI stats)
void modifyFlat(String source, float value)
void modifyPercent(String source, float value)
void modifyMult(String source, float value)
void modifyMult(String source, float value)
void modifyFlat(String source, float value)
float computeEffective(float baseValue)
static final String CONVERTED_BAY
static final String REPLACEMENT_RATE_INCREASE_MULT
static final String DEPLOYMENT_POINTS_MOD
static final String FORCE_ALLOW_CONVERTED_HANGAR
static final String FIGHTER_REARM_TIME_EXTRA_FRACTION_OF_BASE_REFIT_TIME_MOD
static final String CONVERTED_HANGAR_NO_REARM_INCREASE
static final String CONVERTED_HANGAR_NO_REFIT_PENALTY
static final String REPLACEMENT_RATE_DECREASE_MULT
static final String CONVERTED_HANGAR_NO_CREW_INCREASE
static final String CONVERTED_HANGAR_NO_DP_INCREASE
static final String CONVERTED_HANGAR_MOD
static float FIGHTER_OP_PER_DP
void applyEffectsToFighterSpawnedByShip(ShipAPI fighter, ShipAPI ship, String id)
static SpriteAPI getFighterSkin(ShipAPI fighter, ShipAPI carrier)
static float SMOD_CAPITAL
String getSModDescriptionParam(int index, HullSize hullSize, ShipAPI ship)
void addPostDescriptionSection(TooltipMakerAPI tooltip, HullSize hullSize, final ShipAPI ship, float width, boolean isForModSpec)
boolean isApplicableToShip(ShipAPI ship)
static int computeDPModifier(float fighterOPCost)
static void setFighterSkin(ShipAPI fighter, ShipAPI carrier)
static float SMOD_CRUISER
static float REPLACEMENT_TIME_MULT
static SpriteAPI getFighterSkin(String cat, ShipAPI fighter, ShipAPI carrier)
static float REARM_TIME_FRACTION
boolean shouldAddDescriptionToTooltip(HullSize hullSize, ShipAPI ship, boolean isForModSpec)
static List< String > getFighterWings(MutableShipStatsAPI stats)
static float CR_THRESHOLD_UNINSTALLABLE
float computeCRMult(float suppliesPerDep, float dpMod)
static float getFighterOPCost(MutableShipStatsAPI stats)
void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id)
String getUnapplicableReason(ShipAPI ship)
static Color getTextColor()
static float getColorDist(Color one, Color two)
static Color getNegativeHighlightColor()
static Color getBasePlayerColor()
static Color getBrightPlayerColor()
static Color getHighlightColor()
static String getAndJoined(List< String > strings)
static Color getDarkPlayerColor()
static Color getPositiveHighlightColor()
static String getRoundedValueMaxOneAfterDecimal(float value)
static String getRoundedValueOneAfterDecimalIfNotWhole(float value)
List< String > getSpriteKeys(String category)
FighterWingSpecAPI getFighterWingSpec(String wingId)
SpriteAPI getSprite(String filename)
MutableStat getNumFighterBays()
DynamicStatsAPI getDynamic()
MutableStat getFighterRefitTimeMult()
StatBonus getCRPerDeploymentPercent()
MutableStat getSuppliesToRecover()
StatBonus getMinCrewMod()
ShipVariantAPI getVariant()
FleetMemberAPI getFleetMember()
ShipHullSpecAPI getHullSpec()
MutableShipStatsAPI getMutableStats()
ShipVariantAPI getVariant()
void setSprite(String category, String key)
float getSuppliesToRecover()
List< String > getFittedWings()
boolean hasHullMod(String id)
ShipHullSpecAPI getHullSpec()
Color getAverageBrightColor()
MutableStat getStat(String id)
float getValue(String id)
StatBonus getMod(String id)