package data.scripts.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;
import com.fs.starfarer.api.combat.ShipAPI.HullSize;
import com.fs.starfarer.api.impl.campaign.ids.Factions;
//import com.fs.starfarer.api.impl.campaign.ids.Stats;
import com.fs.starfarer.api.util.Misc;

public class CHM_hegemony extends BaseHullMod {

	private static final Map mag = new HashMap();
	static {
		mag.put(HullSize.FRIGATE, 35f);
		mag.put(HullSize.DESTROYER, 50f);
		mag.put(HullSize.CRUISER, 65f);
		mag.put(HullSize.CAPITAL_SHIP, 80f);
	}
	@Override
	public void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id) {
		stats.getArmorBonus().modifyFlat(id, (Float) mag.get(hullSize));
	}
    @Override
    public void applyEffectsAfterShipCreation(ShipAPI ship, String id) {
                if (!Factions.HEGEMONY.equals(Misc.getCommissionFactionId())) {
                    ship.getVariant().removeMod("CHM_hegemony");
           }
                if (ship.getVariant().hasHullMod("CHM_commission")) {
                    ship.getVariant().removeMod("CHM_commission");
                }
    }	
      @Override
	public String getDescriptionParam(int index, HullSize hullSize) {
		if (index == 0) return "" + ((Float) mag.get(HullSize.FRIGATE)).intValue();
		if (index == 1) return "" + ((Float) mag.get(HullSize.DESTROYER)).intValue();
		if (index == 2) return "" + ((Float) mag.get(HullSize.CRUISER)).intValue();
		if (index == 3) return "" + ((Float) mag.get(HullSize.CAPITAL_SHIP)).intValue();
		return null;
	}
}
