Starsector API
Loading...
Searching...
No Matches
AssaultPackage.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 AssaultPackage extends BaseHullMod {
11
12// public static float FLUX_PERCENT = 25f;
13// public static float HULL_PERCENT = 25f;
14// public static float ARMOR_PERCENT = 25f;
15 public static float FLUX_CAPACITY_PERCENT = 10f;
16 public static float HULL_PERCENT = 10f;
17 public static float ARMOR_PERCENT = 5f;
18
19 public void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id) {
20
21 float mult = MilitarizedSubsystems.getEffectMult(stats);
22 stats.getHullBonus().modifyPercent(id, HULL_PERCENT * mult);
23 stats.getArmorBonus().modifyPercent(id, ARMOR_PERCENT * mult);
24 stats.getFluxCapacity().modifyPercent(id, FLUX_CAPACITY_PERCENT * mult);
25
26 stats.getDynamic().getMod(Stats.ACT_AS_COMBAT_SHIP).modifyFlat(id, 1f);
27 }
28
29
30
31 public String getDescriptionParam(int index, HullSize hullSize) {
32 float mult = MilitarizedSubsystems.getEffectMult(null);
33 if (index == 0) return "" + (int) Math.round(HULL_PERCENT * mult) + "%";
34 if (index == 1) return "" + (int) Math.round(ARMOR_PERCENT * mult) + "%";
35 if (index == 2) return "" + (int)Math.round(FLUX_CAPACITY_PERCENT * mult) + "%";
36 return null;
37 }
38 @Override
39 public boolean isApplicableToShip(ShipAPI ship) {
40 if (shipHasOtherModInCategory(ship, spec.getId(), HullMods.TAG_CIV_PACKAGE)) return false;
41 return ship.getVariant().hasHullMod(HullMods.MILITARIZED_SUBSYSTEMS);
42 }
43
44 @Override
45 public String getUnapplicableReason(ShipAPI ship) {
46 if (shipHasOtherModInCategory(ship, spec.getId(), HullMods.TAG_CIV_PACKAGE)) {
47 return "Can only install one combat package on a civilian-grade hull";
48 }
49 if (!ship.getVariant().hasHullMod(HullMods.MILITARIZED_SUBSYSTEMS)) {
50 return "Can only be installed on civilian-grade hulls with Militarized Subsystems";
51 }
52 return super.getUnapplicableReason(ship);
53 }
54
55
56}
57
String getDescriptionParam(int index, HullSize hullSize)
void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id)