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.ElectronicWarfareScript; 011 012public class SensorArrayEffect extends BaseBattleObjectiveEffect { 013 014// public static final float SENSOR_ARRAY_RANGE_BONUS = 25f; 015// public static final float SENSOR_ARRAY_DAMAGE_BONUS = 10f; 016 //public static final float SENSOR_ARRAY_FOG_LIFT_RADIUS = 5000f; 017 public static final float SENSOR_ARRAY_FOG_LIFT_RADIUS = 999f; 018// public static final int SENSOR_ARRAY_COMMAND_POINTS = 1; 019 020 private List<ShipStatusItem> items = new ArrayList<ShipStatusItem>(); 021 private String id; 022 023 public void init(CombatEngineAPI engine, BattleObjectiveAPI objective) { 024 super.init(engine, objective); 025 id = "sensor_array_boost_" + objective.toString(); 026 027// ShipStatusItem item = new ShipStatusItem(objective.getDisplayName(), 028// String.format("+%d%% weapon damage", 029// (int) SENSOR_ARRAY_DAMAGE_BONUS), 030// false); 031// items.add(item); 032 } 033 034 public void advance(float amount) { 035// for (ShipAPI ship : engine.getShips()) { 036// //if (ship.isFighter() || ship.isFrigate()) continue; 037// if (ship.getOwner() == objective.getOwner()) { 038//// ship.getMutableStats().getBallisticWeaponRangeBonus().modifyPercent(id, SENSOR_ARRAY_RANGE_BONUS); 039//// ship.getMutableStats().getEnergyWeaponRangeBonus().modifyPercent(id, SENSOR_ARRAY_RANGE_BONUS); 040// 041// ship.getMutableStats().getBallisticWeaponDamageMult().modifyPercent(id, SENSOR_ARRAY_DAMAGE_BONUS); 042// ship.getMutableStats().getEnergyWeaponDamageMult().modifyPercent(id, SENSOR_ARRAY_DAMAGE_BONUS); 043// ship.getMutableStats().getMissileWeaponDamageMult().modifyPercent(id, SENSOR_ARRAY_DAMAGE_BONUS); 044// 045// } else { 046//// ship.getMutableStats().getBallisticWeaponRangeBonus().unmodify(id); 047//// ship.getMutableStats().getEnergyWeaponRangeBonus().unmodify(id); 048// 049// ship.getMutableStats().getBallisticWeaponDamageMult().unmodify(id); 050// ship.getMutableStats().getEnergyWeaponDamageMult().unmodify(id); 051// ship.getMutableStats().getMissileWeaponDamageMult().unmodify(id); 052// } 053// } 054// 055// giveCommandPointsForCapturing(SENSOR_ARRAY_COMMAND_POINTS); 056 057 revealArea(SENSOR_ARRAY_FOG_LIFT_RADIUS); 058 } 059 060 061 public String getLongDescription() { 062 float min = Global.getSettings().getFloat("minFractionOfBattleSizeForSmallerSide"); 063 int total = Global.getSettings().getBattleSize(); 064 int maxPoints = (int)Math.round(total * (1f - min)); 065 return String.format( 066 "+%d%% ECM rating\n" + 067 "reduces enemy weapon range\n" + 068 "by half of the total ECM rating\n" + 069 //"%d%% base maximum reduction\n" + 070 "%d%% maximum reduction\n\n" + 071 //"can be improved by skills\n\n" + 072 "+%d bonus deployment points\n" + 073 "up to a maximum of " + maxPoints + " points", 074 (int)ElectronicWarfareScript.PER_JAMMER, 075 (int)ElectronicWarfareScript.BASE_MAXIMUM, 076 getBonusDeploymentPoints()); 077// return String.format( 078// "+%d%% ECM rating\n" + 079// "reduces weapon range for\n" + 080// "side with lower ECM rating\n" + 081// //"%d%% base maximum reduction\n" + 082// "%d%% maximum reduction\n\n" + 083// //"can be improved by skills\n\n" + 084// "+%d bonus deployment points\n" + 085// "up to a maximum of " + maxPoints + " points", 086// (int)ElectronicWarfareScript.PER_JAMMER, 087// (int)ElectronicWarfareScript.BASE_MAXIMUM, 088// getBonusDeploymentPoints()); 089// return String.format( 090// "command points: +%s\n" + 091// "reveal area: %d\n" + 092// "\n" + 093// //"ship weapon range: +%d%%\n" + 094// "damage: +%d%%\n", 095// //"no bonus to fighters\n" + 096// //"no bonus to frigates", 097// SENSOR_ARRAY_COMMAND_POINTS, 098// (int) SENSOR_ARRAY_FOG_LIFT_RADIUS, 099// (int) SENSOR_ARRAY_DAMAGE_BONUS); 100 } 101 102 public List<ShipStatusItem> getStatusItemsFor(ShipAPI ship) { 103// if (ship.getOwner() == objective.getOwner()) { 104//// if (ship.isFighter()) { 105//// return itemsNAFighters; 106//// } 107//// if (ship.isFrigate()) { 108//// return itemsNAFrigates; 109//// } 110// return items; 111// } 112 return null; 113 } 114} 115 116 117 118 119 120 121