Starsector API
Loading...
Searching...
No Matches
IncreasedMaintenance.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 IncreasedMaintenance extends BaseHullMod {
10
11 public static float CREW_PERCENT = 30;
12 public static float SUPPLY_USE_MULT = 1.30f;
13 public static float MAX_CR_PENALTY = 0.05f;
14
15 public void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id) {
16 float effect = stats.getDynamic().getValue(Stats.DMOD_EFFECT_MULT);
17 //stats.getSuppliesPerMonth().modifyMult(id, 1f + (SUPPLY_USE_MULT - 1f) * effect);
18 stats.getSuppliesPerMonth().modifyPercent(id, Math.round((SUPPLY_USE_MULT - 1f) * effect * 100f));
19 stats.getMinCrewMod().modifyPercent(id, CREW_PERCENT * effect);
20 stats.getMaxCombatReadiness().modifyFlat(id, -Math.round(MAX_CR_PENALTY * effect * 100f) * 0.01f, "Increased Maintenance");
21 CompromisedStructure.modifyCost(hullSize, stats, id);
22 }
23
24 public String getDescriptionParam(int index, HullSize hullSize, ShipAPI ship) {
25 float effect = 1f;
26 if (ship != null) effect = ship.getMutableStats().getDynamic().getValue(Stats.DMOD_EFFECT_MULT);
27 if (index == 0) return "" + (int)Math.round((1f + (SUPPLY_USE_MULT - 1f) * effect - 1f) * 100f) + "%";
28 if (index == 1) return "" + (int)Math.round(CREW_PERCENT * effect) + "%";
29 if (index == 2) return "" + Math.round(MAX_CR_PENALTY * 100f * effect) + "%";
30 if (index >= 3) return CompromisedStructure.getCostDescParam(index, 3);
31 return null;
32 }
33
34
35}
static String getCostDescParam(int index, int startIndex)
static void modifyCost(HullSize hullSize, MutableShipStatsAPI stats, String id)
String getDescriptionParam(int index, HullSize hullSize, ShipAPI ship)
void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id)