Starsector API
Loading...
Searching...
No Matches
AdditionalBerthing.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 float MIN_FRACTION = 0.3f;
13 public static float MAINTENANCE_PERCENT = 50;
14
15 public static float SMOD_MULT = 2f;
16
17 private static Map mag = new HashMap();
18 static {
19 mag.put(HullSize.FRIGATE, 30f);
20 mag.put(HullSize.DESTROYER, 60f);
21 mag.put(HullSize.CRUISER, 100f);
22 mag.put(HullSize.CAPITAL_SHIP, 200f);
23 }
24
25 public void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id) {
26
27
28 float mod = (Float) mag.get(hullSize);
29 if (stats.getVariant() != null) {
30 mod = Math.max(stats.getVariant().getHullSpec().getMaxCrew() * MIN_FRACTION, mod);
31 }
32 boolean sMod = isSMod(stats);
33 if (sMod) mod *= SMOD_MULT;
34 stats.getMaxCrewMod().modifyFlat(id, mod);
35
36 if (!sMod && stats.getVariant() != null && stats.getVariant().hasHullMod(HullMods.CIVGRADE) && !stats.getVariant().hasHullMod(HullMods.MILITARIZED_SUBSYSTEMS)) {
37 stats.getSuppliesPerMonth().modifyPercent(id, MAINTENANCE_PERCENT);
38 }
39 }
40
41// public String getSModDescriptionParam(int index, HullSize hullSize) {
42// if (index == 0) return "" + (int) Math.round((SMOD_MULT - 1f) * 100f) + "%";
43// return null;
44// }
45
46 public String getDescriptionParam(int index, HullSize hullSize) {
47 if (index == 0) return "" + ((Float) mag.get(HullSize.FRIGATE)).intValue();
48 if (index == 1) return "" + ((Float) mag.get(HullSize.DESTROYER)).intValue();
49 if (index == 2) return "" + ((Float) mag.get(HullSize.CRUISER)).intValue();
50 if (index == 3) return "" + ((Float) mag.get(HullSize.CAPITAL_SHIP)).intValue();
51 if (index == 4) return "" + (int) Math.round(MIN_FRACTION * 100f) + "%";
52 if (index == 5) return "" + (int)Math.round(MAINTENANCE_PERCENT) + "%";
53 return null;
54 }
55
56}
57
58
59
60
String getDescriptionParam(int index, HullSize hullSize)
void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id)