Starsector API
Loading...
Searching...
No Matches
GlitchedSensorArray.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 GlitchedSensorArray extends BaseHullMod {
10 public static final float RANGE_MULT = 0.9f;
11 public static final float SENSOR_MULT = 0.5f;
12
13 public void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id) {
14 float effect = stats.getDynamic().getValue(Stats.DMOD_EFFECT_MULT);
15 float rangeMult = RANGE_MULT + (1f - RANGE_MULT) * (1f - effect);
16 float sensorMult = SENSOR_MULT + (1f - SENSOR_MULT) * (1f - effect);
17
18
19 stats.getBallisticWeaponRangeBonus().modifyMult(id, rangeMult);
20 stats.getEnergyWeaponRangeBonus().modifyMult(id, rangeMult);
21 stats.getSensorStrength().modifyMult(id, sensorMult);
22 CompromisedStructure.modifyCost(hullSize, stats, id);
23 }
24
25 public String getDescriptionParam(int index, HullSize hullSize, ShipAPI ship) {
26 float effect = 1f;
27 if (ship != null) effect = ship.getMutableStats().getDynamic().getValue(Stats.DMOD_EFFECT_MULT);
28 float rangeMult = RANGE_MULT + (1f - RANGE_MULT) * (1f - effect);
29 float sensorMult = SENSOR_MULT + (1f - SENSOR_MULT) * (1f - effect);
30
31 if (index == 0) return "" + (int) Math.round((1f - rangeMult) * 100f) + "%";
32 //if (index == 1) return "50%";
33 if (index == 1) return "" + (int) Math.round((1f - sensorMult) * 100f) + "%";
34 if (index >= 2) return CompromisedStructure.getCostDescParam(index, 2);
35 return null;
36 }
37
38
39}
40
41
42
43
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)