001package com.fs.starfarer.api.impl.campaign.skills; 002 003import com.fs.starfarer.api.characters.MutableCharacterStatsAPI; 004import com.fs.starfarer.api.characters.ShipSkillEffect; 005import com.fs.starfarer.api.combat.MutableShipStatsAPI; 006import com.fs.starfarer.api.combat.ShipAPI.HullSize; 007import com.fs.starfarer.api.util.Misc; 008 009public class OrdnanceExpertise { 010 011 public static float MAX_CR_BONUS = 15; 012 //public static float FLUX_PER_OP = 2; 013 public static float FLUX_PER_OP = 1.5f; 014 public static float CAP_PER_OP = 20; 015 016 017 018 019// public static class Level1 extends BaseSkillEffectDescription implements AfterShipCreationSkillEffect { 020// public void applyEffectsAfterShipCreation(ShipAPI ship, String id) { 021// ship.addListener(new RangedSpecDamageDealtMod()); 022// } 023// 024// public void unapplyEffectsAfterShipCreation(ShipAPI ship, String id) { 025// ship.removeListenerOfClass(RangedSpecDamageDealtMod.class); 026// } 027// 028// public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) { 029// 030// } 031// public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {} 032// 033// public String getEffectDescription(float level) { 034// return null; 035// } 036// 037// public void createCustomDescription(MutableCharacterStatsAPI stats, SkillSpecAPI skill, 038// TooltipMakerAPI info, float width) { 039// init(stats, skill); 040// 041// 042// 043// if (CRITS) { 044// info.addPara("Ballistic and energy weapons have a chance to deal %s damage at long range", 045// 0f, hc, hc, "+" + (int) CRIT_DAMAGE_BONUS_PERCENT + "%"); 046// info.addPara(indent + "%s chance at %s range and below, " + 047// "%s chance at %s range and above", 048// 0f, tc, hc, 049// "0%", 050// "" + (int) MIN_RANGE, 051// "" + (int) MAX_CHANCE_PERCENT + "%", 052// "" + (int) MAX_RANGE 053// ); 054// } else { 055// info.addPara("Ballistic and energy weapons deal up to %s damage at long range", 056// 0f, hc, hc, "+" + (int) MAX_CHANCE_PERCENT + "%"); 057// info.addPara(indent + "%s at %s range and below, " + 058// "%s at %s range and above", 059// 0f, tc, hc, 060// "0%", 061// "" + (int) MIN_RANGE, 062// "" + (int) MAX_CHANCE_PERCENT + "%", 063// "" + (int) MAX_RANGE 064// ); 065// } 066// //info.addPara(indent + "Beam weapons have their damage increased by the chance percentage instead", tc, 0f); 067// } 068// 069// public ScopeDescription getScopeDescription() { 070// return ScopeDescription.PILOTED_SHIP; 071// } 072// } 073 074 075 public static class Level1 implements ShipSkillEffect { 076 077// public void applyEffectsAfterShipCreation(ShipAPI ship, String id) { 078// System.out.println("ewfwefwe"); 079// } 080// public void unapplyEffectsAfterShipCreation(ShipAPI ship, String id) { 081// } 082 083 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) { 084 if (stats.getVariant() != null) { 085 MutableCharacterStatsAPI cStats = BaseSkillEffectDescription.getCommanderStats(stats); 086 float flux = FLUX_PER_OP * stats.getVariant().computeWeaponOPCost(cStats); 087 stats.getFluxDissipation().modifyFlat(id, flux); 088 } 089 } 090 091 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) { 092 stats.getFluxDissipation().unmodifyFlat(id); 093 } 094 095 public String getEffectDescription(float level) { 096 if ((int)FLUX_PER_OP != FLUX_PER_OP) { 097// if (FLUX_PER_OP == 1.5f) { 098// return "+3 flux dissipation per every 2 ordnance points spent on weapons"; 099// } 100 return "+" + Misc.getRoundedValueMaxOneAfterDecimal(FLUX_PER_OP) + " flux dissipation per ordnance point spent on weapons"; 101 } 102 return "+" + (int)(FLUX_PER_OP) + " flux dissipation per ordnance point spent on weapons"; 103 } 104 105 public String getEffectPerLevelDescription() { 106 return null; 107 } 108 109 public ScopeDescription getScopeDescription() { 110 return ScopeDescription.PILOTED_SHIP; 111 } 112 } 113 114 public static class Level3 implements ShipSkillEffect { 115 116 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) { 117 if (stats.getVariant() != null) { 118 MutableCharacterStatsAPI cStats = BaseSkillEffectDescription.getCommanderStats(stats); 119 float flux = CAP_PER_OP * stats.getVariant().computeWeaponOPCost(cStats); 120 stats.getFluxCapacity().modifyFlat(id, flux); 121 } 122 } 123 124 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) { 125 stats.getFluxCapacity().unmodifyFlat(id); 126 } 127 128 public String getEffectDescription(float level) { 129 return "+" + (int)(CAP_PER_OP) + " flux capacity per ordnance point spent on weapons"; 130 } 131 132 public String getEffectPerLevelDescription() { 133 return null; 134 } 135 136 public ScopeDescription getScopeDescription() { 137 return ScopeDescription.PILOTED_SHIP; 138 } 139 } 140 141 public static class Level2 implements ShipSkillEffect { 142 143 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) { 144 stats.getMaxCombatReadiness().modifyFlat(id, MAX_CR_BONUS * 0.01f, "Ordnance Expertise skill"); 145 } 146 147 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) { 148 stats.getMaxCombatReadiness().unmodify(id); 149 } 150 151 public String getEffectDescription(float level) { 152 return "+" + (int)(MAX_CR_BONUS) + "% maximum combat readiness"; 153 } 154 155 public String getEffectPerLevelDescription() { 156 return null; 157 } 158 159 public ScopeDescription getScopeDescription() { 160 return ScopeDescription.PILOTED_SHIP; 161 } 162 } 163 164} 165 166 167 168 169 170 171 172 173 174 175