Starsector API
Loading...
Searching...
No Matches
MalfunctioningComms.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 MalfunctioningComms extends BaseHullMod {
10 public static float ENGAGEMENT_REDUCTION = 0.4f;
11
12 public void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id) {
13 float effect = stats.getDynamic().getValue(Stats.DMOD_EFFECT_MULT);
14
15 stats.getFighterWingRange().modifyMult(id, 1f - ENGAGEMENT_REDUCTION * effect);
16 CompromisedStructure.modifyCost(hullSize, stats, id);
17 }
18
19 public String getDescriptionParam(int index, HullSize hullSize, ShipAPI ship) {
20 float effect = 1f;
21 if (ship != null) effect = ship.getMutableStats().getDynamic().getValue(Stats.DMOD_EFFECT_MULT);
22
23 if (index == 0) return "" + (int) Math.round(ENGAGEMENT_REDUCTION * 100f * effect) + "%";
24 if (index >= 1) return CompromisedStructure.getCostDescParam(index, 1);
25 return null;
26 }
27
28
29}
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)