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;
9
10public class RecoveryShuttles extends BaseHullMod {
11
12 public static float CREW_LOSS_MULT = 0.25f;
13
14 public static float SMOD_CREW_LOSS_MULT = 0.05f;
15
16
17 public void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id) {
18 boolean sMod = isSMod(stats);
19 float mult = CREW_LOSS_MULT;
20 if (sMod) mult = SMOD_CREW_LOSS_MULT;
21 stats.getDynamic().getStat(Stats.FIGHTER_CREW_LOSS_MULT).modifyMult(id, mult);
22 }
23
24 public String getSModDescriptionParam(int index, HullSize hullSize) {
25 if (index == 0) return "" + (int) ((1f - SMOD_CREW_LOSS_MULT) * 100f) + "%";
26 return null;
27 }
28 public String getDescriptionParam(int index, HullSize hullSize) {
29 if (index == 0) return "" + (int) ((1f - CREW_LOSS_MULT) * 100f) + "%";
30 return null;
31 }
32
33 public boolean isApplicableToShip(ShipAPI ship) {
34 if (ship.getVariant().hasHullMod(HullMods.AUTOMATED)) return false;
35
36 //int bays = (int) ship.getMutableStats().getNumFighterBays().getBaseValue();
37 int bays = (int) ship.getMutableStats().getNumFighterBays().getModifiedValue();
38// if (ship != null && ship.getVariant().getHullSpec().getBuiltInWings().size() >= bays) {
39// return false;
40// }
41 return ship != null && bays > 0;
42 }
43
44 public String getUnapplicableReason(ShipAPI ship) {
45 if (ship != null && ship.getVariant().hasHullMod(HullMods.AUTOMATED)) {
46 return "Can not be installed on automated ships";
47 }
48 return "Ship does not have fighter bays";
49 }
50}
51
52
53
54
String getSModDescriptionParam(int index, HullSize hullSize)
void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id)
String getDescriptionParam(int index, HullSize hullSize)