001package com.fs.starfarer.api.impl.campaign.skills; 002 003import java.awt.Color; 004 005import com.fs.starfarer.api.campaign.econ.MarketAPI; 006import com.fs.starfarer.api.characters.FleetStatsSkillEffect; 007import com.fs.starfarer.api.characters.MarketSkillEffect; 008import com.fs.starfarer.api.characters.MutableCharacterStatsAPI; 009import com.fs.starfarer.api.characters.SkillSpecAPI; 010import com.fs.starfarer.api.fleet.MutableFleetStatsAPI; 011import com.fs.starfarer.api.impl.campaign.ids.Stats; 012import com.fs.starfarer.api.ui.TooltipMakerAPI; 013import com.fs.starfarer.api.util.Misc; 014 015public class PlanetaryOperations { 016 017 public static int ATTACK_BONUS = 100; 018 public static int DEFEND_BONUS = 100; 019 public static float CASUALTIES_MULT = 0.75f; 020 public static float STABILITY_BONUS = 2; 021 022 public static class Level1 implements MarketSkillEffect { 023 public void apply(MarketAPI market, String id, float level) { 024 market.getStats().getDynamic().getMod(Stats.GROUND_DEFENSES_MOD).modifyMult(id, 1f + DEFEND_BONUS * 0.01f, "Ground operations"); 025 } 026 027 public void unapply(MarketAPI market, String id) { 028 //market.getStats().getDynamic().getMod(Stats.GROUND_DEFENSES_MOD).unmodifyPercent(id); 029 market.getStats().getDynamic().getMod(Stats.GROUND_DEFENSES_MOD).unmodifyMult(id); 030 } 031 032 public String getEffectDescription(float level) { 033 return "+" + (int)(DEFEND_BONUS) + "% effectiveness of ground defenses"; 034 } 035 036 public String getEffectPerLevelDescription() { 037 return null; 038 } 039 040 public ScopeDescription getScopeDescription() { 041 return ScopeDescription.GOVERNED_OUTPOST; 042 } 043 } 044 045 public static class Level2 implements MarketSkillEffect { 046 public void apply(MarketAPI market, String id, float level) { 047 market.getStability().modifyFlat(id, STABILITY_BONUS, "Ground operations"); 048 } 049 050 public void unapply(MarketAPI market, String id) { 051 market.getStability().unmodifyFlat(id); 052 } 053 054 public String getEffectDescription(float level) { 055 return "+" + (int)STABILITY_BONUS + " stability"; 056 } 057 058 public String getEffectPerLevelDescription() { 059 return null; 060 } 061 062 public ScopeDescription getScopeDescription() { 063 return ScopeDescription.GOVERNED_OUTPOST; 064 } 065 } 066 067 public static class Level3 extends BaseSkillEffectDescription implements FleetStatsSkillEffect { 068 public void apply(MutableFleetStatsAPI stats, String id, float level) { 069 //stats.getDynamic().getMod(Stats.PLANETARY_OPERATIONS_MOD).modifyMult(id, 1f + ATTACK_BONUS * 0.01f, "Planetary operations"); 070 stats.getDynamic().getMod(Stats.PLANETARY_OPERATIONS_MOD).modifyPercent(id, ATTACK_BONUS, "Ground operations"); 071 } 072 073 public void unapply(MutableFleetStatsAPI stats, String id) { 074 //stats.getDynamic().getMod(Stats.PLANETARY_OPERATIONS_MOD).unmodifyMult(id); 075 stats.getDynamic().getMod(Stats.PLANETARY_OPERATIONS_MOD).unmodifyPercent(id); 076 } 077 078 public void createCustomDescription(MutableCharacterStatsAPI stats, SkillSpecAPI skill, 079 TooltipMakerAPI info, float width) { 080 init(stats, skill); 081 082 float opad = 10f; 083 Color c = Misc.getBasePlayerColor(); 084 info.addPara("Affects: %s", opad + 5f, Misc.getGrayColor(), c, "fleet"); 085 info.addSpacer(opad); 086 info.addPara("+%s effectiveness of ground operations such as raids", 0f, hc, hc, 087 "" + (int) ATTACK_BONUS + "%"); 088 } 089 090 public String getEffectDescription(float level) { 091 return "+" + (int)(ATTACK_BONUS) + "% effectiveness of ground operations such as raids"; 092 } 093 094 public String getEffectPerLevelDescription() { 095 return null; 096 } 097 098 public ScopeDescription getScopeDescription() { 099 return ScopeDescription.FLEET; 100 } 101 } 102 103 public static class Level4 implements FleetStatsSkillEffect { 104 public void apply(MutableFleetStatsAPI stats, String id, float level) { 105 stats.getDynamic().getStat(Stats.PLANETARY_OPERATIONS_CASUALTIES_MULT).modifyMult(id, CASUALTIES_MULT, "Ground operations"); 106 } 107 108 public void unapply(MutableFleetStatsAPI stats, String id) { 109 stats.getDynamic().getStat(Stats.PLANETARY_OPERATIONS_CASUALTIES_MULT).unmodifyMult(id); 110 } 111 112// public void createCustomDescription(MutableCharacterStatsAPI stats, SkillSpecAPI skill, TooltipMakerAPI info, float width) { 113// init(stats, skill); 114// 115// float opad = 10f; 116// Color c = Misc.getBasePlayerColor(); 117// info.addPara("Affects: %s", opad + 5f, Misc.getGrayColor(), c, "fleet"); 118// info.addSpacer(opad); 119// info.addPara("+%s effectiveness of ground operations", 0f, hc, hc, 120// "" + (int) ATTACK_BONUS + "%"); 121// } 122 123 public String getEffectDescription(float level) { 124 return "-" + (int)Math.round((1f - CASUALTIES_MULT) * 100f) + "% marine casualties suffered during ground operations such as raids"; 125 } 126 127 public String getEffectPerLevelDescription() { 128 return null; 129 } 130 131 public ScopeDescription getScopeDescription() { 132 return ScopeDescription.FLEET; 133 } 134 } 135 136} 137 138