Starsector API
All Classes Namespaces Files Functions Variables
ErraticInjector.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.Stats;
8
9public class ErraticInjector extends BaseHullMod {
10
11 public static float FUEL_PERCENT = 50;
12 public static float ZERO_FLUX_PENALTY = 10;
13
14 public void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id) {
15 float effect = stats.getDynamic().getValue(Stats.DMOD_EFFECT_MULT);
16 stats.getFuelUseMod().modifyPercent(id, FUEL_PERCENT * effect);
17
18 stats.getZeroFluxSpeedBoost().modifyFlat(id, -ZERO_FLUX_PENALTY * effect);
19
20 CompromisedStructure.modifyCost(hullSize, stats, id);
21 }
22
23 public String getDescriptionParam(int index, HullSize hullSize, ShipAPI ship) {
24 float effect = 1f;
25 if (ship != null) effect = ship.getMutableStats().getDynamic().getValue(Stats.DMOD_EFFECT_MULT);
26 if (index == 0) return "" + (int)Math.round(FUEL_PERCENT * effect) + "%";
27 if (index == 1) return "" + (int)Math.round(ZERO_FLUX_PENALTY * effect) + "";
28 if (index >= 2) return CompromisedStructure.getCostDescParam(index, 2);
29 return null;
30 }
31
32
33}
static String getCostDescParam(int index, int startIndex)
static void modifyCost(HullSize hullSize, MutableShipStatsAPI stats, String id)
String getDescriptionParam(int index, HullSize hullSize, ShipAPI ship)
void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id)