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 010/** 011 * UNUSED, not related to CryofluxTransducerEffect. 012 */ 013public class CryofluxTransducerStats extends BaseShipSystemScript { 014 public static final Object KEY_SHIP = new Object(); 015 public static final Color DEFAULT_JITTER_COLOR = new Color(100,165,255,75); 016 public static final float INCOMING_DAMAGE_MULT = 0.5f; 017 public static final float FLUX_USE_MULT = 0.5f; 018 019 public static class TargetData { 020 public ShipAPI target; 021 public TargetData(ShipAPI target) { 022 this.target = target; 023 } 024 } 025 026 027 public void apply(MutableShipStatsAPI stats, final String id, State state, float effectLevel) { 028 ShipAPI ship = null; 029 if (stats.getEntity() instanceof ShipAPI) { 030 ship = (ShipAPI) stats.getEntity(); 031 } else { 032 return; 033 } 034 035 ship.fadeToColor(KEY_SHIP, new Color(75,75,75,255), 0.1f, 0.1f, effectLevel); 036 //ship.fadeToColor(KEY_SHIP, new Color(100,100,100,255), 0.1f, 0.1f, effectLevel); 037 ship.setWeaponGlow(effectLevel, new Color(100,165,255,255), EnumSet.of(WeaponType.BALLISTIC, WeaponType.ENERGY, WeaponType.MISSILE)); 038 ship.getEngineController().fadeToOtherColor(KEY_SHIP, new Color(0,0,0,0), new Color(0,0,0,0), effectLevel, 0.75f * effectLevel); 039 //ship.setJitter(KEY_SHIP, new Color(100,165,255,55), effectLevel, 1, 0f, 5f); 040 ship.setJitterUnder(KEY_SHIP, new Color(100,165,255,255), effectLevel, 15, 0f, 15f); 041 //ship.setShowModuleJitterUnder(true); 042 043 effectLevel = 1f; 044 stats.getBallisticWeaponFluxCostMod().modifyMult(id, 1f - (1f - FLUX_USE_MULT) * effectLevel); 045 stats.getEnergyWeaponFluxCostMod().modifyMult(id, 1f - (1f - FLUX_USE_MULT) * effectLevel); 046 stats.getMissileWeaponFluxCostMod().modifyMult(id, 1f - (1f - FLUX_USE_MULT) * effectLevel); 047 048 stats.getHullDamageTakenMult().modifyMult(id, 1f - (1f - INCOMING_DAMAGE_MULT) * effectLevel); 049 stats.getArmorDamageTakenMult().modifyMult(id, 1f - (1f - INCOMING_DAMAGE_MULT) * effectLevel); 050 stats.getEmpDamageTakenMult().modifyMult(id, 1f - (1f - INCOMING_DAMAGE_MULT) * effectLevel); 051 } 052 053 054 public void unapply(MutableShipStatsAPI stats, String id) { 055 stats.getBallisticWeaponFluxCostMod().unmodify(id); 056 stats.getEnergyWeaponFluxCostMod().unmodify(id); 057 stats.getMissileWeaponFluxCostMod().unmodify(id); 058 059 stats.getHullDamageTakenMult().unmodify(id); 060 stats.getArmorDamageTakenMult().unmodify(id); 061 stats.getEmpDamageTakenMult().unmodify(id); 062 } 063 064 public StatusData getStatusData(int index, State state, float effectLevel) { 065 effectLevel = 1f; 066 float percent = (1f - FLUX_USE_MULT) * effectLevel * 100; 067 if (index == 0) { 068 return new StatusData((int) percent + "% less flux generated", false); 069 } 070 percent = (1f - INCOMING_DAMAGE_MULT) * effectLevel * 100; 071 if (index == 1) { 072 return new StatusData((int) percent + "% less damage taken", false); 073 } 074 return null; 075 } 076 077} 078 079 080 081 082 083 084 085