Starsector API
Loading...
Searching...
No Matches
FaultyAutomatedSystems.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.hullmods;
2
3import com.fs.starfarer.api.combat.BaseHullMod;
4import com.fs.starfarer.api.combat.MutableShipStatsAPI;
5import com.fs.starfarer.api.combat.ShipAPI;
6import com.fs.starfarer.api.combat.ShipAPI.HullSize;
7import com.fs.starfarer.api.impl.campaign.ids.Stats;
8
9public class FaultyAutomatedSystems extends BaseHullMod {
10
11 public static float CREW_PERCENT = 50f;
12 public static float MAX_CR_PENALTY = 0.05f;
13
14 public void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id) {
15 float effect = stats.getDynamic().getValue(Stats.DMOD_EFFECT_MULT);
16
17 stats.getMinCrewMod().modifyPercent(id, CREW_PERCENT * effect);
18 stats.getMaxCombatReadiness().modifyFlat(id, -Math.round(MAX_CR_PENALTY * effect * 100f) * 0.01f, "Faulty Automated Systems");
19
20 CompromisedStructure.modifyCost(hullSize, stats, id);
21 }
22
23 public String getDescriptionParam(int index, HullSize hullSize, ShipAPI ship) {
24 float effect = 1f;
25 if (ship != null) effect = ship.getMutableStats().getDynamic().getValue(Stats.DMOD_EFFECT_MULT);
26 if (index == 0) return "" + (int) Math.round(CREW_PERCENT * effect) + "%";
27 if (index == 1) return "" + Math.round(MAX_CR_PENALTY * 100f * effect) + "%";
28 if (index >= 2) return CompromisedStructure.getCostDescParam(index, 2);
29 return null;
30 }
31
32
33}
static String getCostDescParam(int index, int startIndex)
static void modifyCost(HullSize hullSize, MutableShipStatsAPI stats, String id)
void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id)
String getDescriptionParam(int index, HullSize hullSize, ShipAPI ship)