001package com.fs.starfarer.api.impl.combat; 002 003import java.util.ArrayList; 004import java.util.List; 005 006import com.fs.starfarer.api.Global; 007import com.fs.starfarer.api.combat.BattleObjectiveAPI; 008import com.fs.starfarer.api.combat.CombatEngineAPI; 009import com.fs.starfarer.api.combat.ShipAPI; 010import com.fs.starfarer.api.impl.campaign.skills.CoordinatedManeuversScript; 011 012public class NavBuoyEffect extends BaseBattleObjectiveEffect { 013 014// public static final String NEBULA_NAVIGATION_KEY = "nebula_navigation"; 015 016 017// public static final String NAV_BUOY_ID = "nav_buoy"; 018// public static final float NAV_BUOY_TOP_SPEED_BONUS = 15f; 019// public static final float NAV_BUOY_MANEUVERABILITY_BONUS = 25f; 020// public static final int NAV_BUOY_COMMAND_POINTS = 1; 021 022 public static final float NAV_BUOY_FOG_LIFT_RADIUS = 999f; 023 024 private List<ShipStatusItem> items = new ArrayList<ShipStatusItem>(); 025 026 private String id; 027 028 public void init(CombatEngineAPI engine, BattleObjectiveAPI objective) { 029 super.init(engine, objective); 030 031 id = "nav_buoy_boost_" + objective.toString(); 032 033// ShipStatusItem item = new ShipStatusItem(objective.getDisplayName(), 034// String.format("+%d top speed, +%d%% maneuver", 035// (int) NAV_BUOY_TOP_SPEED_BONUS, 036// (int) NAV_BUOY_MANEUVERABILITY_BONUS), 037// false); 038// items.add(item); 039 040// item = new ShipStatusItem("Nav Buoy Deployed", 041// "nebula navigation", 042// false); 043// item.setKey(NEBULA_NAVIGATION_KEY); 044// items.add(item); 045 } 046 047 public void advance(float amount) { 048// boolean zeroHasNav = false; 049// boolean oneHasNav = false; 050// for (BattleObjectiveAPI obj : engine.getObjectives()) { 051// if (obj.getOwner() == 0 && NAV_BUOY_ID.equals(obj.getType())) { 052// zeroHasNav = true; 053// } 054// if (obj.getOwner() == 1 && NAV_BUOY_ID.equals(obj.getType())) { 055// oneHasNav = true; 056// } 057// } 058// 059// for (ShipAPI ship : engine.getShips()) { 060// //if (ship.isFighter() || ship.isFrigate()) continue; 061// if (ship.getOwner() == objective.getOwner()) { 062// ship.getMutableStats().getMaxSpeed().modifyFlat(id, NAV_BUOY_TOP_SPEED_BONUS); 063// ship.getMutableStats().getAcceleration().modifyPercent(id, NAV_BUOY_MANEUVERABILITY_BONUS); 064// ship.getMutableStats().getDeceleration().modifyPercent(id, NAV_BUOY_MANEUVERABILITY_BONUS); 065// ship.getMutableStats().getTurnAcceleration().modifyPercent(id,NAV_BUOY_MANEUVERABILITY_BONUS); 066// } else { 067// ship.getMutableStats().getMaxSpeed().unmodify(id); 068// ship.getMutableStats().getAcceleration().unmodify(id); 069// ship.getMutableStats().getDeceleration().unmodify(id); 070// ship.getMutableStats().getTurnAcceleration().unmodify(id); 071// } 072//// if ((ship.getOwner() == 0 && zeroHasNav) || (ship.getOwner() == 1 && oneHasNav)) { 073//// ship.setAffectedByNebula(false); 074//// } else { 075//// ship.setAffectedByNebula(true); 076//// } 077// } 078 079// giveCommandPointsForCapturing(NAV_BUOY_COMMAND_POINTS); 080 081 revealArea(NAV_BUOY_FOG_LIFT_RADIUS); 082 } 083 084 085 public String getLongDescription() { 086 float min = Global.getSettings().getFloat("minFractionOfBattleSizeForSmallerSide"); 087 int total = Global.getSettings().getBattleSize(); 088 int maxPoints = (int)Math.round(total * (1f - min)); 089 return String.format( 090 "+%d%% top speed\n" + 091 "%d%% base total maximum\n" + 092 //"can be improved by skills\n\n" + 093 "+%d bonus deployment points\n" + 094 "up to a maximum of " + maxPoints + " points", 095 (int)CoordinatedManeuversScript.PER_BUOY, 096 (int)CoordinatedManeuversScript.BASE_MAXIMUM, 097 getBonusDeploymentPoints()); 098// return String.format( 099// "command points: +%d\n" + 100// "\n" + 101// "ship maneuverability: +%d%%\n" + 102// "ship top speed: +%d\n", 103// //"ships unaffected by nebula interference\n", 104// //"no bonus to fighters\n" + 105// //"no bonus to frigates", 106// NAV_BUOY_COMMAND_POINTS, 107// (int) NAV_BUOY_TOP_SPEED_BONUS, 108// (int) NAV_BUOY_MANEUVERABILITY_BONUS); 109 } 110 111 public List<ShipStatusItem> getStatusItemsFor(ShipAPI ship) { 112// if (ship.getOwner() == objective.getOwner()) { 113//// if (ship.isFighter()) { 114//// return itemsNAFighters; 115//// } 116//// if (ship.isFrigate()) { 117//// return itemsNAFrigates; 118//// } 119// return items; 120// } 121 return null; 122 } 123} 124 125 126 127 128 129 130