001package com.fs.starfarer.api.impl.campaign.skills; 002 003import com.fs.starfarer.api.characters.ShipSkillEffect; 004import com.fs.starfarer.api.combat.MutableShipStatsAPI; 005import com.fs.starfarer.api.combat.ShipAPI.HullSize; 006import com.fs.starfarer.api.impl.campaign.ids.Stats; 007 008public class ReliabilityEngineering { 009 010 public static float PEAK_TIME_BONUS = 60; 011 public static float DEGRADE_REDUCTION_PERCENT = 25f; 012 public static float MAX_CR_BONUS = 15; 013 014 public static float OVERLOAD_REDUCTION = 30f; 015 016 public static class Level1 implements ShipSkillEffect { 017 018 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) { 019 stats.getDynamic().getMod(Stats.INDIVIDUAL_SHIP_RECOVERY_MOD).modifyFlat(id, 1000f); 020 } 021 022 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) { 023 stats.getDynamic().getMod(Stats.INDIVIDUAL_SHIP_RECOVERY_MOD).unmodify(id); 024 } 025 026 public String getEffectDescription(float level) { 027 return "If lost in combat, ship is almost always recoverable"; 028 } 029 030 public String getEffectPerLevelDescription() { 031 return null; 032 } 033 034 public ScopeDescription getScopeDescription() { 035 return ScopeDescription.PILOTED_SHIP; 036 } 037 } 038 039 public static class Level2 implements ShipSkillEffect { 040 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) { 041 stats.getPeakCRDuration().modifyFlat(id, PEAK_TIME_BONUS); 042 } 043 044 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) { 045 stats.getPeakCRDuration().unmodifyFlat(id); 046 } 047 048 public String getEffectDescription(float level) { 049 return "+" + (int)(PEAK_TIME_BONUS) + " seconds peak operating time"; 050 } 051 052 public String getEffectPerLevelDescription() { 053 return null; 054 } 055 056 public ScopeDescription getScopeDescription() { 057 return ScopeDescription.PILOTED_SHIP; 058 } 059 } 060 061 public static class Level3 implements ShipSkillEffect { 062 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) { 063 stats.getCRLossPerSecondPercent().modifyMult(id, 1f - DEGRADE_REDUCTION_PERCENT / 100f); 064 } 065 066 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) { 067 stats.getCRLossPerSecondPercent().unmodifyMult(id); 068 } 069 070 public String getEffectDescription(float level) { 071 return "-" + (int)(DEGRADE_REDUCTION_PERCENT) + "% combat readiness degradation rate after peak performance time runs out"; 072 } 073 074 public String getEffectPerLevelDescription() { 075 return null; 076 } 077 078 public ScopeDescription getScopeDescription() { 079 return ScopeDescription.PILOTED_SHIP; 080 } 081 } 082 083 public static class Level4 implements ShipSkillEffect { 084 085 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) { 086 stats.getMaxCombatReadiness().modifyFlat(id, MAX_CR_BONUS * 0.01f, "Reliabilty Engineering skill"); 087 } 088 089 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) { 090 stats.getMaxCombatReadiness().unmodify(id); 091 } 092 093 public String getEffectDescription(float level) { 094 return "+" + (int)(MAX_CR_BONUS) + "% maximum combat readiness"; 095 } 096 097 public String getEffectPerLevelDescription() { 098 return null; 099 } 100 101 public ScopeDescription getScopeDescription() { 102 return ScopeDescription.PILOTED_SHIP; 103 } 104 } 105 106 public static class Level5 implements ShipSkillEffect { 107 108 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) { 109 stats.getOverloadTimeMod().modifyMult(id, 1f - OVERLOAD_REDUCTION / 100f); 110 } 111 112 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) { 113 stats.getOverloadTimeMod().unmodify(id); 114 } 115 116 public String getEffectDescription(float level) { 117 return "-" + (int)(OVERLOAD_REDUCTION) + "% overload duration"; 118 } 119 120 public String getEffectPerLevelDescription() { 121 return null; 122 } 123 124 public ScopeDescription getScopeDescription() { 125 return ScopeDescription.PILOTED_SHIP; 126 } 127 } 128 129 130 131// public static class Level2 implements ShipSkillEffect { 132// public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) { 133// stats.getCriticalMalfunctionChance().modifyMult(id, 1f - CRITICAL_MALFUNCTION_REDUCTION / 100f); 134// stats.getWeaponMalfunctionChance().modifyMult(id, 1f - MALFUNCTION_REDUCTION / 100f); 135// stats.getEngineMalfunctionChance().modifyMult(id, 1f - MALFUNCTION_REDUCTION / 100f); 136// } 137// 138// public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) { 139// stats.getCriticalMalfunctionChance().unmodify(id); 140// stats.getWeaponMalfunctionChance().unmodify(id); 141// stats.getEngineMalfunctionChance().unmodify(id); 142// } 143// 144// public String getEffectDescription(float level) { 145// //return "" + (int)(RECOVERY_RATE_BONUS) + "% faster repairs and CR recovery"; 146// //return "-" + (int)(CRITICAL_MALFUNCTION_REDUCTION) + "% chance of critical malfunctions when at low combat readiness"; 147// return "-" + (int)(CRITICAL_MALFUNCTION_REDUCTION) + "% chance of malfunctions when at low combat readiness"; 148// } 149// 150// public String getEffectPerLevelDescription() { 151// return null; 152// } 153// 154// public ScopeDescription getScopeDescription() { 155// return ScopeDescription.PILOTED_SHIP; 156// } 157// } 158 159 160 161 162}