Starsector API
Loading...
Searching...
No Matches
RecoveryShuttles.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.HullMods;
8import com.fs.starfarer.api.impl.campaign.ids.Stats;
9import com.fs.starfarer.api.util.Misc;
10
11public class RecoveryShuttles extends BaseHullMod {
12
13 public static float CREW_LOSS_MULT = 0.25f;
14
15 public static float SMOD_CREW_LOSS_MULT = 0.05f;
16
17
18 public void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id) {
19 boolean sMod = isSMod(stats);
20 float mult = CREW_LOSS_MULT;
21 if (sMod) mult = SMOD_CREW_LOSS_MULT;
23 }
24
25 public String getSModDescriptionParam(int index, HullSize hullSize) {
26 if (index == 0) return "" + (int) ((1f - SMOD_CREW_LOSS_MULT) * 100f) + "%";
27 return null;
28 }
29 public String getDescriptionParam(int index, HullSize hullSize) {
30 if (index == 0) return "" + (int) ((1f - CREW_LOSS_MULT) * 100f) + "%";
31 return null;
32 }
33
34 public boolean isApplicableToShip(ShipAPI ship) {
35 if (Misc.isAutomated(ship.getVariant())) return false;
36
37 if (ship.getVariant().hasHullMod(HullMods.CONVERTED_HANGAR)) return true;
38
39 //int bays = (int) ship.getMutableStats().getNumFighterBays().getBaseValue();
40 int bays = (int) ship.getMutableStats().getNumFighterBays().getModifiedValue();
41// if (ship != null && ship.getVariant().getHullSpec().getBuiltInWings().size() >= bays) {
42// return false;
43// }
44 return ship != null && bays > 0;
45 }
46
47 public String getUnapplicableReason(ShipAPI ship) {
48 if (ship != null && Misc.isAutomated(ship.getVariant())) {
49 return "Can not be installed on automated ships";
50 }
51 return "Ship does not have fighter bays";
52 }
53}
54
55
56
57
boolean isSMod(MutableShipStatsAPI stats)
void modifyMult(String source, float value)
String getSModDescriptionParam(int index, HullSize hullSize)
void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id)
String getDescriptionParam(int index, HullSize hullSize)
static boolean isAutomated(MutableShipStatsAPI stats)
Definition Misc.java:5491
MutableShipStatsAPI getMutableStats()