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