Starsector API
Loading...
Searching...
No Matches
DefectiveManufactory.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 DefectiveManufactory extends BaseHullMod {
10
11 //public static float SPEED_REDUCTION = 0.33333333f;
12 //public static float DAMAGE_INCREASE = 0.5f;
13 public static float SPEED_REDUCTION = 0.25f;
14 public static float DAMAGE_INCREASE = 0.25f;
15
16
17 public void applyEffectsToFighterSpawnedByShip(ShipAPI fighter, ShipAPI ship, String id) {
18 float effect = ship.getMutableStats().getDynamic().getValue(Stats.DMOD_EFFECT_MULT);
19
20 MutableShipStatsAPI stats = fighter.getMutableStats();
21
22 stats.getMaxSpeed().modifyMult(id, 1f - SPEED_REDUCTION * effect);
23
24 stats.getArmorDamageTakenMult().modifyPercent(id, DAMAGE_INCREASE * 100f * effect);
25 stats.getShieldDamageTakenMult().modifyPercent(id, DAMAGE_INCREASE * 100f * effect);
26 stats.getHullDamageTakenMult().modifyPercent(id, DAMAGE_INCREASE * 100f * effect);
27
28 //fighter.setHeavyDHullOverlay();
29 fighter.setLightDHullOverlay();
30 }
31
32 public void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id) {
33 CompromisedStructure.modifyCost(hullSize, stats, id);
34 }
35
36
37 public String getDescriptionParam(int index, HullSize hullSize, ShipAPI ship) {
38 float effect = 1f;
39 if (ship != null) effect = ship.getMutableStats().getDynamic().getValue(Stats.DMOD_EFFECT_MULT);
40
41 if (index == 0) return "" + (int) Math.round(SPEED_REDUCTION * 100f * effect) + "%";
42 if (index == 1) return "" + (int) Math.round(DAMAGE_INCREASE * 100f * effect) + "%";
43 if (index >= 2) return CompromisedStructure.getCostDescParam(index, 2);
44 return null;
45 }
46}
47
48
49
50
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)
void applyEffectsToFighterSpawnedByShip(ShipAPI fighter, ShipAPI ship, String id)