Search in sources :

Example 6 with SkillPointTypes

use of am2.api.spell.enums.SkillPointTypes in project ArsMagica2 by Mithion.

the class SkillData method getLearnState.

@Override
public LearnStates getLearnState(SkillTreeEntry entry, EntityPlayer player) {
    SkillData sk = SkillData.For(player);
    if (sk.isEntryKnown(entry)) {
        return LearnStates.LEARNED;
    }
    SkillPointTypes pointType = SkillTreeManager.instance.getSkillPointTypeForPart(entry.registeredItem);
    LearnStates state = entry.enabled ? (sk.getSpellPoints(pointType) > 0 ? LearnStates.CAN_LEARN : LearnStates.CANNOT_LEARN) : LearnStates.DISABLED;
    if (state == LearnStates.CAN_LEARN) {
        if (!RecursivePrerequisiteCheck(sk, entry)) {
            state = LearnStates.CANNOT_LEARN;
        }
    }
    if (sk.getPrimaryTree() != SkillTrees.None && entry.tree != SkillTrees.Talents && sk.getPrimaryTree() != entry.tree && entry.tier >= AMCore.config.getSkillTreeSecondaryTierCap()) {
        state = LearnStates.LOCKED;
    }
    return state;
}
Also used : ISkillData(am2.api.ISkillData) LearnStates(am2.api.spell.enums.LearnStates) SkillPointTypes(am2.api.spell.enums.SkillPointTypes)

Aggregations

SkillPointTypes (am2.api.spell.enums.SkillPointTypes)5 LearnStates (am2.api.spell.enums.LearnStates)3 SkillTreeEntry (am2.api.SkillTreeEntry)2 SkillData (am2.playerextensions.SkillData)2 ArrayList (java.util.ArrayList)2 ISkillData (am2.api.ISkillData)1 SkillLearnedEvent (am2.api.events.SkillLearnedEvent)1 ISkillTreeEntry (am2.api.spell.component.interfaces.ISkillTreeEntry)1 ISpellComponent (am2.api.spell.component.interfaces.ISpellComponent)1 Affinity (am2.api.spell.enums.Affinity)1 AMDataWriter (am2.network.AMDataWriter)1 InvalidParameterException (java.security.InvalidParameterException)1 List (java.util.List)1 FontRenderer (net.minecraft.client.gui.FontRenderer)1 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)1 IIcon (net.minecraft.util.IIcon)1