Search in sources :

Example 1 with ISoliniaAAAbility

use of com.solinia.solinia.Interfaces.ISoliniaAAAbility in project solinia3-core by mixxit.

the class ConfigurationManager method editAAAbility.

@Override
public void editAAAbility(int aaid, String setting, String value) throws InvalidAASettingException {
    ISoliniaAAAbility aaability = getAAAbility(aaid);
    aaability.editSetting(setting, value);
}
Also used : ISoliniaAAAbility(com.solinia.solinia.Interfaces.ISoliniaAAAbility)

Example 2 with ISoliniaAAAbility

use of com.solinia.solinia.Interfaces.ISoliniaAAAbility in project solinia3-core by mixxit.

the class ConfigurationManager method resetAARankRepository.

@Override
public void resetAARankRepository() {
    this.aarankcache.clear();
    this.spellaarankcache.clear();
    for (ISoliniaAAAbility ability : getAAAbilities()) {
        for (ISoliniaAARank rank : ability.getRanks()) {
            this.aarankcache.put(rank.getId(), rank);
            if (this.spellaarankcache.get(rank.getSpell()) == null)
                this.spellaarankcache.put(rank.getSpell(), new ArrayList<Integer>());
            if (this.spellaarankcache.get(rank.getSpell()).contains(rank.getId()))
                continue;
            this.spellaarankcache.get(rank.getSpell()).add(rank.getId());
        }
    }
    System.out.println("* AA Rank and SpelltoAARank cache has been reset");
}
Also used : ISoliniaAARank(com.solinia.solinia.Interfaces.ISoliniaAARank) ArrayList(java.util.ArrayList) ISoliniaAAAbility(com.solinia.solinia.Interfaces.ISoliniaAAAbility)

Example 3 with ISoliniaAAAbility

use of com.solinia.solinia.Interfaces.ISoliniaAAAbility in project solinia3-core by mixxit.

the class SoliniaLivingEntity method getMaxStat.

@Override
public int getMaxStat(String skillname) {
    int baseMaxStat = 255;
    ISoliniaAAAbility aa = null;
    try {
        aa = StateManager.getInstance().getConfigurationManager().getFirstAAAbilityBySysname("PLANARPOWER");
    } catch (CoreStateInitException e) {
    }
    int rank = 0;
    if (aa != null) {
        rank = Utils.getRankOfAAAbility(getBukkitLivingEntity(), aa);
    }
    if (rank == 0) {
        return baseMaxStat;
    } else {
        return baseMaxStat + (rank * 5);
    }
}
Also used : CoreStateInitException(com.solinia.solinia.Exceptions.CoreStateInitException) ISoliniaAAAbility(com.solinia.solinia.Interfaces.ISoliniaAAAbility)

Example 4 with ISoliniaAAAbility

use of com.solinia.solinia.Interfaces.ISoliniaAAAbility in project solinia3-core by mixxit.

the class PlayerRegenTickTimer method grantPlayerRegenBonuses.

private void grantPlayerRegenBonuses(Player player) {
    if (player.isDead())
        return;
    // Apply Crouch Mana Regen Bonus
    int manaregen = 1;
    ISoliniaPlayer solplayer = null;
    try {
        solplayer = SoliniaPlayerAdapter.Adapt(player);
    } catch (CoreStateInitException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
    if (solplayer == null)
        return;
    // a players mana regen based on if they are meditating (sneaking)
    manaregen += getPlayerMeditatingManaBonus(solplayer);
    ISoliniaAAAbility aa = null;
    try {
        if (solplayer.getAARanks().size() > 0)
            aa = StateManager.getInstance().getConfigurationManager().getFirstAAAbilityBySysname("MENTALCLARITY");
    } catch (CoreStateInitException e) {
    }
    int aamanaregenrank = 0;
    if (aa != null) {
        if (solplayer.getAARanks().size() > 0)
            aamanaregenrank = Utils.getRankOfAAAbility(player, aa);
        manaregen += aamanaregenrank;
    }
    ISoliniaAAAbility emaa = null;
    try {
        if (solplayer.getAARanks().size() > 0)
            emaa = StateManager.getInstance().getConfigurationManager().getFirstAAAbilityBySysname("MENTALCLARITY");
    } catch (CoreStateInitException e) {
    }
    int emaamanaregenrank = 0;
    if (emaa != null) {
        if (solplayer.getAARanks().size() > 0)
            emaamanaregenrank = Utils.getRankOfAAAbility(player, emaa);
        manaregen += emaamanaregenrank;
    }
    manaregen += solplayer.getItemMpRegenBonuses();
    // Hp and Mana Regen from Items
    int hpregen = 0;
    ISoliniaAAAbility hpaa = null;
    try {
        hpaa = StateManager.getInstance().getConfigurationManager().getFirstAAAbilityBySysname("INNATEREGENERATION");
    } catch (CoreStateInitException e) {
    }
    int aahpregenrank = 0;
    if (hpaa != null) {
        aahpregenrank = Utils.getRankOfAAAbility(player, hpaa);
        hpregen += aahpregenrank;
    }
    hpregen += solplayer.getItemHpRegenBonuses();
    // Process HP Regeneration
    if (hpregen > 0) {
        int amount = (int) Math.round(player.getHealth()) + hpregen;
        if (amount > player.getMaxHealth()) {
            amount = (int) Math.round(player.getMaxHealth());
        }
        if (amount < 0)
            amount = 0;
        player.setHealth(amount);
    }
    // Process Mana Regeneration
    // System.out.println(player.getName() + " was found to have " + manaregen + " mana regen");
    solplayer.increasePlayerMana(manaregen);
}
Also used : CoreStateInitException(com.solinia.solinia.Exceptions.CoreStateInitException) ISoliniaPlayer(com.solinia.solinia.Interfaces.ISoliniaPlayer) ISoliniaAAAbility(com.solinia.solinia.Interfaces.ISoliniaAAAbility)

Example 5 with ISoliniaAAAbility

use of com.solinia.solinia.Interfaces.ISoliniaAAAbility in project solinia3-core by mixxit.

the class SoliniaSpell method getActSpellCost.

@Override
public int getActSpellCost(ISoliniaLivingEntity solEntity) {
    // TODO Frenzied Devastation
    // TODO Clairevoyance
    int cost = getMana();
    int spec = 0;
    if (solEntity.isPlayer()) {
        try {
            String skillName = (Utils.getSkillType(getSkill()).name().toUpperCase());
            ISoliniaPlayer player = SoliniaPlayerAdapter.Adapt((Player) solEntity.getBukkitLivingEntity());
            if (player != null)
                if (Utils.getSpecialisationSkills().contains(skillName.toUpperCase()))
                    if (player.getSpecialisation() != null && player.getSpecialisation().equals(skillName.toUpperCase()))
                        spec = solEntity.getSkill("SPECIALISE" + skillName.toUpperCase());
        } catch (CoreStateInitException e) {
        // skip
        }
    }
    float bonus = 1;
    int rank = 0;
    int advancedrank = 0;
    ISoliniaAAAbility aa = null;
    try {
        aa = StateManager.getInstance().getConfigurationManager().getFirstAAAbilityBySysname("SPELLCASTINGMASTERY");
    } catch (CoreStateInitException e) {
    }
    if (aa != null) {
        rank = Utils.getRankOfAAAbility(solEntity.getBukkitLivingEntity(), aa);
        switch(rank) {
            case 1:
                bonus += 0.05;
                break;
            case 2:
                bonus += 0.15;
                break;
            case 3:
                bonus += 0.30;
                break;
        }
    // TODO advanced rank
    // bonus += (0.05 * advancedrank);
    }
    int SuccessChance = Utils.RandomBetween(0, 100);
    double PercentManaReduction = 0;
    if (SuccessChance <= (spec * 0.3 * bonus)) {
        PercentManaReduction = (1 + 0.05 * spec);
        switch(rank) {
            case 1:
                PercentManaReduction += 2.5;
                break;
            case 2:
                PercentManaReduction += 5.0;
                break;
            case 3:
                PercentManaReduction += 10.0;
                break;
        }
    /* TODO Advanced Spell Casting Mastery
			switch(advancedrank) {
				case 1:
					PercentManaReduction += 2.5;
					break;
				case 2:
					PercentManaReduction += 5.0;
					break;
				case 3:
					PercentManaReduction += 10.0;
					break;
			}
			*/
    }
    // TODO Spell Reduction effects on items/buffs
    // TODO Focus Effects
    cost -= cost * PercentManaReduction / 100;
    if (cost < 0)
        cost = 0;
    return cost;
}
Also used : CoreStateInitException(com.solinia.solinia.Exceptions.CoreStateInitException) ISoliniaPlayer(com.solinia.solinia.Interfaces.ISoliniaPlayer) ISoliniaAAAbility(com.solinia.solinia.Interfaces.ISoliniaAAAbility)

Aggregations

ISoliniaAAAbility (com.solinia.solinia.Interfaces.ISoliniaAAAbility)9 CoreStateInitException (com.solinia.solinia.Exceptions.CoreStateInitException)6 ISoliniaPlayer (com.solinia.solinia.Interfaces.ISoliniaPlayer)3 ISoliniaAARank (com.solinia.solinia.Interfaces.ISoliniaAARank)2 ISoliniaLivingEntity (com.solinia.solinia.Interfaces.ISoliniaLivingEntity)2 ArrayList (java.util.ArrayList)2 Player (org.bukkit.entity.Player)2 Gson (com.google.gson.Gson)1 GsonBuilder (com.google.gson.GsonBuilder)1 InvalidAASettingException (com.solinia.solinia.Exceptions.InvalidAASettingException)1 ISoliniaAAEffectTypeAdapterFactory (com.solinia.solinia.Factories.ISoliniaAAEffectTypeAdapterFactory)1 ISoliniaAARankTypeAdapterFactory (com.solinia.solinia.Factories.ISoliniaAARankTypeAdapterFactory)1 SoliniaAAEffect (com.solinia.solinia.Models.SoliniaAAEffect)1 SoliniaAARank (com.solinia.solinia.Models.SoliniaAARank)1 BufferedReader (java.io.BufferedReader)1 FileNotFoundException (java.io.FileNotFoundException)1 FileReader (java.io.FileReader)1 List (java.util.List)1 ComponentBuilder (net.md_5.bungee.api.chat.ComponentBuilder)1 HoverEvent (net.md_5.bungee.api.chat.HoverEvent)1