|
- package data.hullmods;
- import java.util.HashMap;
- import java.util.Map;
- import com.fs.starfarer.api.combat.BaseHullMod;
- import com.fs.starfarer.api.combat.MutableShipStatsAPI;
- import com.fs.starfarer.api.combat.ShipAPI.HullSize;
- import com.fs.starfarer.api.combat.ShipAPI;
- public class BeamSuperCap extends BaseHullMod {
- private static Map mag1 = new HashMap();
- static {
- mag1.put(HullSize.FRIGATE, -1000f);
- mag1.put(HullSize.DESTROYER, -2000f);
- mag1.put(HullSize.CRUISER, -3000f);
- mag1.put(HullSize.CAPITAL_SHIP, -5000f);
- }
- private static Map mag2 = new HashMap();
- static {
- mag2.put(HullSize.FRIGATE, 0.75f);
- mag2.put(HullSize.DESTROYER, 0.65f);
- mag2.put(HullSize.CRUISER, 0.55f);
- mag2.put(HullSize.CAPITAL_SHIP, 0.45f);
- }
- private static Map mag3 = new HashMap();
- static {
- mag3.put(HullSize.FRIGATE, 20f);
- mag3.put(HullSize.DESTROYER, 40f);
- mag3.put(HullSize.CRUISER, 50f);
- mag3.put(HullSize.CAPITAL_SHIP, 60f);
- }
- private static Map mag4 = new HashMap();
- static {
- mag4.put(HullSize.FRIGATE, 20f);
- mag4.put(HullSize.DESTROYER, 30f);
- mag4.put(HullSize.CRUISER, 35f);
- mag4.put(HullSize.CAPITAL_SHIP, 40f);
- }
-
- public void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id) {
- stats.getFluxCapacity().modifyFlat(id, (Float) mag1.get(hullSize));
- stats.getEnergyRoFMult().modifyMult(id, (Float) mag2.get(hullSize));
- stats.getEnergyAmmoRegenMult().modifyMult(id, (Float) mag2.get(hullSize));
- stats.getBeamWeaponDamageMult().modifyPercent(id, (Float) mag3.get(hullSize));
- stats.getBeamWeaponRangeBonus().modifyPercent(id, (Float) mag4.get(hullSize));
- }
-
- public String getDescriptionParam(int index, HullSize hullSize) {
- if (index == 0) return "" + ((Float) mag1.get(HullSize.FRIGATE)).intValue();
- if (index == 1) return "" + ((Float) mag1.get(HullSize.DESTROYER)).intValue();
- if (index == 2) return "" + ((Float) mag1.get(HullSize.CRUISER)).intValue();
- if (index == 3) return "" + ((Float) mag1.get(HullSize.CAPITAL_SHIP)).intValue();
- if (index == 4) return "" + ((Float) mag2.get(HullSize.FRIGATE)).intValue();
- if (index == 5) return "" + ((Float) mag2.get(HullSize.DESTROYER)).intValue();
- if (index == 6) return "" + ((Float) mag2.get(HullSize.CRUISER)).intValue();
- if (index == 7) return "" + ((Float) mag2.get(HullSize.CAPITAL_SHIP)).intValue();
- if (index == 8) return "" + ((Float) mag3.get(HullSize.FRIGATE)).intValue();
- if (index == 9) return "" + ((Float) mag3.get(HullSize.DESTROYER)).intValue();
- if (index == 10) return "" + ((Float) mag3.get(HullSize.CRUISER)).intValue();
- if (index == 11) return "" + ((Float) mag3.get(HullSize.CAPITAL_SHIP)).intValue();
- if (index == 12) return "" + ((Float) mag4.get(HullSize.FRIGATE)).intValue();
- if (index == 13) return "" + ((Float) mag4.get(HullSize.DESTROYER)).intValue();
- if (index == 14) return "" + ((Float) mag4.get(HullSize.CRUISER)).intValue();
- if (index == 15) return "" + ((Float) mag4.get(HullSize.CAPITAL_SHIP)).intValue();
- if (index == 16) return "" + ((Float) mag1.get(hullSize)).intValue();
- if (index == 17) return "" + ((Float) mag2.get(hullSize)).intValue();
- if (index == 18) return "" + ((Float) mag3.get(hullSize)).intValue();
- if (index == 19) return "" + ((Float) mag4.get(hullSize)).intValue();
- return null;
- }
- }
复制代码 在描述里我想要把index4-15 17-19 全部用百分比的绝对值表示,不知道绝对值函数和百分号插哪里。
|
|