Starsector API
Loading...
Searching...
No Matches
AuxiliaryFuelTanks.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.hullmods;
2
3import java.util.HashMap;
4import java.util.Map;
5
6import com.fs.starfarer.api.combat.MutableShipStatsAPI;
7import com.fs.starfarer.api.combat.ShipAPI.HullSize;
8import com.fs.starfarer.api.impl.campaign.ids.HullMods;
9
11
12 public static final float MIN_FRACTION = 0.3f;
13
14 private static Map mag = new HashMap();
15 static {
16 mag.put(HullSize.FRIGATE, 30f);
17 mag.put(HullSize.DESTROYER, 60f);
18 mag.put(HullSize.CRUISER, 100f);
19 mag.put(HullSize.CAPITAL_SHIP, 200f);
20 }
21
22 public void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id) {
23
24 float mod = (Float) mag.get(hullSize);
25 if (stats.getVariant() != null) {
26 mod = Math.max(stats.getVariant().getHullSpec().getFuel() * MIN_FRACTION, mod);
27 }
28 boolean sMod = isSMod(stats);
29 if (sMod) mod *= AdditionalBerthing.SMOD_MULT;
30 stats.getFuelMod().modifyFlat(id, mod);
31
32 if (!sMod && stats.getVariant() != null && stats.getVariant().hasHullMod(HullMods.CIVGRADE) && !stats.getVariant().hasHullMod(HullMods.MILITARIZED_SUBSYSTEMS)) {
33 stats.getSuppliesPerMonth().modifyPercent(id, AdditionalBerthing.MAINTENANCE_PERCENT);
34 }
35 }
36
37 public String getDescriptionParam(int index, HullSize hullSize) {
38 if (index == 0) return "" + ((Float) mag.get(HullSize.FRIGATE)).intValue();
39 if (index == 1) return "" + ((Float) mag.get(HullSize.DESTROYER)).intValue();
40 if (index == 2) return "" + ((Float) mag.get(HullSize.CRUISER)).intValue();
41 if (index == 3) return "" + ((Float) mag.get(HullSize.CAPITAL_SHIP)).intValue();
42 if (index == 4) return "" + (int) Math.round(MIN_FRACTION * 100f) + "%";
43 if (index == 5) return "" + (int)Math.round(AdditionalBerthing.MAINTENANCE_PERCENT) + "%";
44 return null;
45 }
46
47}
48
49
50
51
String getDescriptionParam(int index, HullSize hullSize)
void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id)