001package com.fs.starfarer.api.impl.combat; 002 003import java.awt.Color; 004import java.util.EnumSet; 005 006import com.fs.starfarer.api.combat.MutableShipStatsAPI; 007import com.fs.starfarer.api.combat.ShipAPI; 008import com.fs.starfarer.api.combat.WeaponAPI.WeaponType; 009 010public class DamperFieldOmegaStats extends BaseShipSystemScript { 011 012 public static Object KEY_SHIP = new Object(); 013 public static float INCOMING_DAMAGE_MULT = 0.5f; 014 public static float FLUX_USE_MULT = 0.5f; 015 public static float REPAIR_RATE_MULT = 10f; 016 017 public static class TargetData { 018 public ShipAPI target; 019 public TargetData(ShipAPI target) { 020 this.target = target; 021 } 022 } 023 024 025 public void apply(MutableShipStatsAPI stats, final String id, State state, float effectLevel) { 026 ShipAPI ship = null; 027 if (stats.getEntity() instanceof ShipAPI) { 028 ship = (ShipAPI) stats.getEntity(); 029 } else { 030 return; 031 } 032 033 ship.fadeToColor(KEY_SHIP, new Color(75,75,75,255), 0.1f, 0.1f, effectLevel); 034 //ship.fadeToColor(KEY_SHIP, new Color(100,100,100,255), 0.1f, 0.1f, effectLevel); 035 ship.setWeaponGlow(effectLevel, new Color(100,165,255,255), EnumSet.of(WeaponType.BALLISTIC, WeaponType.ENERGY, WeaponType.MISSILE)); 036 ship.getEngineController().fadeToOtherColor(KEY_SHIP, new Color(0,0,0,0), new Color(0,0,0,0), effectLevel, 0.75f * effectLevel); 037 //ship.setJitter(KEY_SHIP, new Color(100,165,255,55), effectLevel, 1, 0f, 5f); 038 ship.setJitterUnder(KEY_SHIP, new Color(100,165,255,255), effectLevel, 15, 0f, 15f); 039 //ship.setShowModuleJitterUnder(true); 040 041 effectLevel = 1f; 042 stats.getBallisticWeaponFluxCostMod().modifyMult(id, 1f - (1f - FLUX_USE_MULT) * effectLevel); 043 stats.getEnergyWeaponFluxCostMod().modifyMult(id, 1f - (1f - FLUX_USE_MULT) * effectLevel); 044 stats.getMissileWeaponFluxCostMod().modifyMult(id, 1f - (1f - FLUX_USE_MULT) * effectLevel); 045 046 stats.getHullDamageTakenMult().modifyMult(id, 1f - (1f - INCOMING_DAMAGE_MULT) * effectLevel); 047 stats.getArmorDamageTakenMult().modifyMult(id, 1f - (1f - INCOMING_DAMAGE_MULT) * effectLevel); 048 stats.getEmpDamageTakenMult().modifyMult(id, 1f - (1f - INCOMING_DAMAGE_MULT) * effectLevel); 049 050 stats.getCombatEngineRepairTimeMult().modifyMult(id, 1f / (1f + (REPAIR_RATE_MULT - 1f) * effectLevel)); 051 stats.getCombatWeaponRepairTimeMult().modifyMult(id, 1f / (1f + (REPAIR_RATE_MULT - 1f) * effectLevel)); 052 } 053 054 055 public void unapply(MutableShipStatsAPI stats, String id) { 056 stats.getBallisticWeaponFluxCostMod().unmodify(id); 057 stats.getEnergyWeaponFluxCostMod().unmodify(id); 058 stats.getMissileWeaponFluxCostMod().unmodify(id); 059 060 stats.getHullDamageTakenMult().unmodify(id); 061 stats.getArmorDamageTakenMult().unmodify(id); 062 stats.getEmpDamageTakenMult().unmodify(id); 063 064 stats.getCombatEngineRepairTimeMult().unmodifyMult(id); 065 stats.getCombatWeaponRepairTimeMult().unmodifyMult(id); 066 } 067 068 069 public StatusData getStatusData(int index, State state, float effectLevel) { 070 effectLevel = 1f; 071 float percent = (1f - FLUX_USE_MULT) * effectLevel * 100; 072 if (index == 0) { 073 return new StatusData((int) percent + "% less flux generated", false); 074 } 075 percent = (1f - INCOMING_DAMAGE_MULT) * effectLevel * 100; 076 if (index == 1) { 077 return new StatusData((int) percent + "% less damage taken", false); 078 } 079 080 percent = REPAIR_RATE_MULT * effectLevel * 100f; 081 if (index == 2) { 082 return new StatusData((int) percent + "% faster repairs", false); 083 } 084 return null; 085 } 086 087} 088 089 090