Search in sources :

Example 1 with BonusCoins

use of com.magmaguy.elitemobs.powers.bosspowers.BonusCoins in project EliteMobs by MagmaGuy.

the class ElitePowerParser method parsePowers.

public static HashSet<ElitePower> parsePowers(List<String> powers) {
    HashSet<ElitePower> elitePowers = new HashSet<>();
    CustomSummonPower customSummonPower = null;
    for (String powerName : powers) {
        if (powerName.split(":")[0].equalsIgnoreCase("summon") || powerName.split(":")[0].equalsIgnoreCase("summonable"))
            if (customSummonPower == null) {
                customSummonPower = new CustomSummonPower(powerName);
                elitePowers.add(customSummonPower);
            } else
                customSummonPower.addEntry(powerName);
        else {
            String[] parsedPowerName = powerName.split(":");
            if (ElitePower.getElitePower(parsedPowerName[0]) != null) {
                ElitePower elitePower = ElitePower.getElitePower(parsedPowerName[0]);
                elitePowers.add(elitePower);
                if (elitePower instanceof BonusCoins)
                    if (parsedPowerName.length > 1)
                        try {
                            ((BonusCoins) elitePower).setCoinMultiplier(Double.parseDouble(parsedPowerName[1]));
                        } catch (Exception ex) {
                            new WarningMessage("Multiplier " + parsedPowerName[1] + " for Bonus Coins power is not a valid multiplier!");
                        }
            } else
                new WarningMessage("Warning: power name " + powerName + " is not registered! Skipping it for custom mob construction...");
        }
    }
    return elitePowers;
}
Also used : CustomSummonPower(com.magmaguy.elitemobs.powers.meta.CustomSummonPower) WarningMessage(com.magmaguy.elitemobs.utils.WarningMessage) BonusCoins(com.magmaguy.elitemobs.powers.bosspowers.BonusCoins) ElitePower(com.magmaguy.elitemobs.powers.meta.ElitePower) HashSet(java.util.HashSet)

Aggregations

BonusCoins (com.magmaguy.elitemobs.powers.bosspowers.BonusCoins)1 CustomSummonPower (com.magmaguy.elitemobs.powers.meta.CustomSummonPower)1 ElitePower (com.magmaguy.elitemobs.powers.meta.ElitePower)1 WarningMessage (com.magmaguy.elitemobs.utils.WarningMessage)1 HashSet (java.util.HashSet)1