Starsector API
Loading...
Searching...
No Matches
CarrierCommand.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign.skills;
2
3import com.fs.starfarer.api.characters.ShipSkillEffect;
4import com.fs.starfarer.api.combat.MutableShipStatsAPI;
5import com.fs.starfarer.api.combat.ShipAPI.HullSize;
6import com.fs.starfarer.api.impl.campaign.ids.Stats;
7
8public class CarrierCommand {
9
10 public static final float FIGHTER_CREW_LOSS_REDUCTION = 20f;
11 public static final float FIGHTER_RAMAGE_REDUCTION = 20f;
12 public static final float FIGHTER_REPLACEMENT_RATE_BONUS = 20f;
13
14
15
16 public static class Level1 implements ShipSkillEffect {
17
18 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
19 stats.getDynamic().getStat(Stats.FIGHTER_CREW_LOSS_MULT).modifyMult(id, 1f - FIGHTER_CREW_LOSS_REDUCTION / 100f);
20 }
21
22 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
23 stats.getDynamic().getStat(Stats.FIGHTER_CREW_LOSS_MULT).unmodify(id);
24 }
25
26 public String getEffectDescription(float level) {
27 return "-" + (int)(FIGHTER_CREW_LOSS_REDUCTION) + "% crew lost due to fighter losses in combat";
28 }
29
30 public String getEffectPerLevelDescription() {
31 return null;
32 }
33
34 public ScopeDescription getScopeDescription() {
35 return ScopeDescription.PILOTED_SHIP;
36 }
37 }
38
39 public static class Level2 implements ShipSkillEffect {
40 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
41 stats.getHullDamageTakenMult().modifyMult(id, 1f - FIGHTER_RAMAGE_REDUCTION / 100f);
42 stats.getArmorDamageTakenMult().modifyMult(id, 1f - FIGHTER_RAMAGE_REDUCTION / 100f);
43 stats.getShieldDamageTakenMult().modifyMult(id, 1f - FIGHTER_RAMAGE_REDUCTION / 100f);
44 }
45
46 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
47 stats.getHullDamageTakenMult().unmodify(id);
48 stats.getArmorDamageTakenMult().unmodify(id);
49 stats.getShieldDamageTakenMult().unmodify(id);
50 }
51
52 public String getEffectDescription(float level) {
53 return "-" + (int)(FIGHTER_RAMAGE_REDUCTION) + "% damage taken";
54 }
55
56 public String getEffectPerLevelDescription() {
57 return null;
58 }
59
60 public ScopeDescription getScopeDescription() {
61 return ScopeDescription.SHIP_FIGHTERS;
62 }
63 }
64
65 public static class Level3 implements ShipSkillEffect {
66
67 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
68 float timeMult = 1f / ((100f + FIGHTER_REPLACEMENT_RATE_BONUS) / 100f);
69 stats.getFighterRefitTimeMult().modifyMult(id, timeMult);
70 }
71
72 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
73 stats.getFighterRefitTimeMult().unmodify(id);
74 }
75
76 public String getEffectDescription(float level) {
77 return "" + (int)(FIGHTER_REPLACEMENT_RATE_BONUS) + "% faster fighter replacements";
78 }
79
80 public String getEffectPerLevelDescription() {
81 return null;
82 }
83
84 public ScopeDescription getScopeDescription() {
85 return ScopeDescription.PILOTED_SHIP;
86 }
87 }
88
89}