1package com.fs.starfarer.api.impl.campaign.skills;
3import java.util.HashSet;
7import com.fs.starfarer.api.Global;
8import com.fs.starfarer.api.characters.PersonAPI;
9import com.fs.starfarer.api.combat.BaseEveryFrameCombatPlugin;
10import com.fs.starfarer.api.combat.BattleObjectiveAPI;
11import com.fs.starfarer.api.combat.CombatEngineAPI;
12import com.fs.starfarer.api.combat.CombatFleetManagerAPI;
13import com.fs.starfarer.api.combat.DeployedFleetMemberAPI;
14import com.fs.starfarer.api.combat.MutableStat.StatMod;
15import com.fs.starfarer.api.combat.ShipAPI;
16import com.fs.starfarer.api.combat.ViewportAPI;
17import com.fs.starfarer.api.impl.campaign.ids.BattleObjectives;
18import com.fs.starfarer.api.impl.campaign.ids.Stats;
19import com.fs.starfarer.api.input.InputEventAPI;
27 public static final String
BONUS_ID =
"coord_maneuvers_bonus";
34 private ShipAPI prevPlayerShip =
null;
35 private int skipFrames = 0;
36 private Set<CombatFleetManagerAPI> needsCleanup =
new HashSet<CombatFleetManagerAPI>();
37 public void advance(
float amount, List<InputEventAPI> events) {
38 if (engine ==
null)
return;
45 if (playerShip != prevPlayerShip) {
46 prevPlayerShip = playerShip;
71 String
id = SupportDoctrine.SUPPORT_DOCTRINE_DP_REDUCTION_ID +
"_reverse";
74 if (bonus !=
null && bonus.value != 0) {
111 boolean buoysOnly =
true;
115 if (member.isFighterWing())
continue;
116 if (member.isStationModule())
continue;
122 if (total > 0) buoysOnly =
false;
126 if (obj.getOwner() == manager.
getOwner() && BattleObjectives.NAV_BUOY.equals(obj.getType())) {
140 boolean includeSelf =
false;
142 for (DeployedFleetMemberAPI member : deployed) {
143 if (member.isFighterWing())
continue;
144 if (member.getShip() ==
null)
continue;
146 float curr = member.getShip().getMutableStats().getDynamic().getValue(Stats.COORDINATED_MANEUVERS_FLAT, 0f);
147 if (includeSelf) curr = 0f;
149 float bonus = Math.min(max, Math.max(0f, total - curr));
150 member.getShip().getMutableStats().getMaxSpeed().modifyPercent(
BONUS_ID, bonus);
153 needsCleanup.add(manager);
160 if (includeSelf) curr = 0f;
162 float bonus = Math.min(max, Math.max(0f, total - curr));
164 String title =
"Coordinated Maneuvers:" +
" " + (int) Math.min(max, total) +
"%";
166 String data =
"+" + (int)bonus +
"% top speed";
171 title +=
" (" + numBuoys +
")";
173 data =
"+" + (int)bonus +
"% top speed";
175 String icon = Global.getSettings().getSpriteName(
"ui",
"icon_tactical_coordinated_maneuvers");
183 if (needsCleanup.contains(manager)) {
184 needsCleanup.remove(manager);
187 if (member.isFighterWing())
continue;
188 if (member.getShip() ==
null)
continue;
189 member.getShip().getMutableStats().getMaxSpeed().unmodify(
BONUS_ID);
199 if (member.isFighterWing())
continue;
200 if (member.isStationModule())
continue;
201 if (member.getMember() ==
null)
continue;
204 PersonAPI fc = member.getMember().getFleetCommander();
205 if (fc ==
null) fc = member.getMember().getFleetCommanderForStats();
206 ShipAPI ship = member.getShip();
208 if (ship ==
null)
continue;
209 if (fc ==
null)
continue;
212 boolean hasFC =
false;
214 String
id =
"fc_zf_bonus";
224 if (applyAccelAndTurnModifiers) {
void modifyFlat(String source, float value)
void unmodifyFlat(String source)
StatMod getFlatBonus(String source)
void modifyFlat(String source, float value)
void unmodifyFlat(String source)
static final String COORDINATED_MANEUVERS_MAX
static final String DEPLOYMENT_POINTS_MOD
static final String COORDINATED_MANEUVERS_FLAT
static float ZERO_FLUX_SPEED_BONUS_SMALL
static float ZERO_FLUX_TURN_ACCEL_BONUS
static float ZERO_FLUX_TURN_BONUS
static float ZERO_FLUX_ACCEL_BONUS
static float ZERO_FLUX_SPEED_BONUS
static String SUPPORT_DOCTRINE_DP_REDUCTION_ID
void maintainStatusForPlayerShip(Object key, String spriteName, String title, String data, boolean isDebuff)
CombatFleetManagerAPI getFleetManager(FleetSide side)
List< BattleObjectiveAPI > getObjectives()
ShipAPI getShipPlayerIsTransferringCommandFrom()
List< DeployedFleetMemberAPI > getDeployedCopyDFM()
List< PersonAPI > getAllFleetCommanders()
MutableStat getZeroFluxSpeedBoost()
DynamicStatsAPI getDynamic()
MutableStat getDeceleration()
MutableStat getTurnAcceleration()
MutableStat getMaxTurnRate()
MutableStat getAcceleration()
boolean areAnyEnemiesInRange()
boolean isEngineBoostActive()
MutableShipStatsAPI getMutableStats()
FleetMemberAPI getFleetMember()
MutableShipStatsAPI getStats()
float getValue(String id)
StatBonus getMod(String id)