Search in sources :

Example 1 with SoliniaAARankEffect

use of com.solinia.solinia.Models.SoliniaAARankEffect in project solinia3-core by mixxit.

the class Utils method getTotalAAEffectStat.

public static int getTotalAAEffectStat(LivingEntity bukkitLivingEntity, String stat) {
    if (!(bukkitLivingEntity instanceof Player))
        return 0;
    try {
        ISoliniaPlayer player = SoliniaPlayerAdapter.Adapt((Player) bukkitLivingEntity);
        int total = 0;
        int effectIdLookup = 0;
        switch(stat) {
            case "STRENGTH":
                effectIdLookup = Utils.getEffectIdFromEffectType(SpellEffectType.STR);
                break;
            case "STAMINA":
                effectIdLookup = Utils.getEffectIdFromEffectType(SpellEffectType.STA);
                break;
            case "AGILITY":
                effectIdLookup = Utils.getEffectIdFromEffectType(SpellEffectType.AGI);
                break;
            case "DEXTERITY":
                effectIdLookup = Utils.getEffectIdFromEffectType(SpellEffectType.DEX);
                break;
            case "INTELLIGENCE":
                effectIdLookup = Utils.getEffectIdFromEffectType(SpellEffectType.INT);
                break;
            case "WISDOM":
                effectIdLookup = Utils.getEffectIdFromEffectType(SpellEffectType.WIS);
                break;
            case "CHARISMA":
                effectIdLookup = Utils.getEffectIdFromEffectType(SpellEffectType.CHA);
                break;
            default:
                break;
        }
        if (effectIdLookup == 0)
            return 0;
        for (SoliniaAARankEffect effect : player.getRanksEffectsOfEffectType(effectIdLookup)) {
            total += effect.getBase1();
        }
        return total;
    } catch (CoreStateInitException e) {
        return 0;
    }
}
Also used : Player(org.bukkit.entity.Player) ISoliniaPlayer(com.solinia.solinia.Interfaces.ISoliniaPlayer) SoliniaAARankEffect(com.solinia.solinia.Models.SoliniaAARankEffect) CoreStateInitException(com.solinia.solinia.Exceptions.CoreStateInitException) ISoliniaPlayer(com.solinia.solinia.Interfaces.ISoliniaPlayer)

Example 2 with SoliniaAARankEffect

use of com.solinia.solinia.Models.SoliniaAARankEffect in project solinia3-core by mixxit.

the class Utils method getTotalAAEffectMaxHp.

public static double getTotalAAEffectMaxHp(LivingEntity bukkitLivingEntity) {
    if (!(bukkitLivingEntity instanceof Player))
        return 0;
    try {
        ISoliniaPlayer player = SoliniaPlayerAdapter.Adapt((Player) bukkitLivingEntity);
        int total = 0;
        int effectIdLookup = 0;
        effectIdLookup = Utils.getEffectIdFromEffectType(SpellEffectType.MaxHPChange);
        if (effectIdLookup > 0) {
            for (SoliniaAARankEffect effect : player.getRanksEffectsOfEffectType(effectIdLookup)) {
                total += effect.getBase1();
            }
        }
        effectIdLookup = Utils.getEffectIdFromEffectType(SpellEffectType.TotalHP);
        if (effectIdLookup > 0) {
            for (SoliniaAARankEffect effect : player.getRanksEffectsOfEffectType(effectIdLookup)) {
                total += effect.getBase1();
            }
        }
        return total;
    } catch (CoreStateInitException e) {
        return 0;
    }
}
Also used : Player(org.bukkit.entity.Player) ISoliniaPlayer(com.solinia.solinia.Interfaces.ISoliniaPlayer) SoliniaAARankEffect(com.solinia.solinia.Models.SoliniaAARankEffect) CoreStateInitException(com.solinia.solinia.Exceptions.CoreStateInitException) ISoliniaPlayer(com.solinia.solinia.Interfaces.ISoliniaPlayer)

Example 3 with SoliniaAARankEffect

use of com.solinia.solinia.Models.SoliniaAARankEffect in project solinia3-core by mixxit.

the class Utils method getTotalAAEffectEffectType.

public static int getTotalAAEffectEffectType(LivingEntity bukkitLivingEntity, SpellEffectType effectType) {
    if (!(bukkitLivingEntity instanceof Player))
        return 0;
    try {
        ISoliniaPlayer player = SoliniaPlayerAdapter.Adapt((Player) bukkitLivingEntity);
        int total = 0;
        for (SoliniaAARankEffect effect : player.getRanksEffectsOfEffectType(Utils.getEffectIdFromEffectType(effectType))) {
            total += effect.getBase1();
        }
        return total;
    } catch (CoreStateInitException e) {
        return 0;
    }
}
Also used : Player(org.bukkit.entity.Player) ISoliniaPlayer(com.solinia.solinia.Interfaces.ISoliniaPlayer) SoliniaAARankEffect(com.solinia.solinia.Models.SoliniaAARankEffect) CoreStateInitException(com.solinia.solinia.Exceptions.CoreStateInitException) ISoliniaPlayer(com.solinia.solinia.Interfaces.ISoliniaPlayer)

Aggregations

CoreStateInitException (com.solinia.solinia.Exceptions.CoreStateInitException)3 ISoliniaPlayer (com.solinia.solinia.Interfaces.ISoliniaPlayer)3 SoliniaAARankEffect (com.solinia.solinia.Models.SoliniaAARankEffect)3 Player (org.bukkit.entity.Player)3