Search in sources :

Example 6 with SkillCost

use of pcgen.cdom.enumeration.SkillCost in project pcgen by PCGen.

the class MonCSkillToSkillCostFacet method dataAdded.

@Override
public void dataAdded(DataFacetChangeEvent<CharID, PCClass> dfce) {
    PCClass cl = dfce.getCDOMObject();
    if (cl.isMonster()) {
        CharID id = dfce.getCharID();
        SkillCost cost = SkillCost.CLASS;
        for (Skill sk : monsterCSkillFacet.getSet(id)) {
            add(id, cl, cost, sk, monsterCSkillFacet);
        }
    }
}
Also used : Skill(pcgen.core.Skill) SkillCost(pcgen.cdom.enumeration.SkillCost) PCClass(pcgen.core.PCClass) CharID(pcgen.cdom.enumeration.CharID)

Example 7 with SkillCost

use of pcgen.cdom.enumeration.SkillCost in project pcgen by PCGen.

the class SkillpointsToken method getUsedSkillPoints.

/**
	 * Get the used skill points for the PC
	 * @param pc
	 * @return the used skill points for the PC
	 */
public static int getUsedSkillPoints(PlayerCharacter pc) {
    float usedPoints = 0;
    for (Skill aSkill : pc.getDisplay().getSkillSet()) {
        for (PCClass pcc : pc.getSkillRankClasses(aSkill)) {
            Double rank = pc.getSkillRankForClass(aSkill, pcc);
            if (rank == null) {
                rank = 0.0d;
            }
            SkillCost skillCost = pc.getSkillCostForClass(aSkill, pcc);
            usedPoints += (rank * skillCost.getCost());
        }
    }
    return (int) usedPoints;
}
Also used : Skill(pcgen.core.Skill) SkillCost(pcgen.cdom.enumeration.SkillCost) PCClass(pcgen.core.PCClass)

Example 8 with SkillCost

use of pcgen.cdom.enumeration.SkillCost in project pcgen by PCGen.

the class SkillCostTableModel method getValueAt.

@Override
public Object getValueAt(int rowIndex, int columnIndex) {
    int index = selectionModel.getMinSelectionIndex();
    CharacterLevelFacade level = null;
    if (index != -1) {
        level = levels.getElementAt(index);
    }
    SkillCost cost = SkillCost.values()[rowIndex];
    switch(columnIndex) {
        case 0:
            return cost;
        case 1:
            if (levels == null) {
                return 0;
            }
            return levels.getRankCost(level, cost);
        case 2:
            if (levels == null) {
                return 0.0;
            }
            return levels.getMaxRanks(level, cost, false);
        default:
            throw new IndexOutOfBoundsException();
    }
}
Also used : CharacterLevelFacade(pcgen.facade.core.CharacterLevelFacade) SkillCost(pcgen.cdom.enumeration.SkillCost)

Example 9 with SkillCost

use of pcgen.cdom.enumeration.SkillCost in project pcgen by PCGen.

the class CharacterLevelsFacadeImpl method scanForLevelToRefundSkill.

private CharacterLevelFacade scanForLevelToRefundSkill(Skill aSkill, float testRank, PCClass classToMatch) {
    for (int i = 0; i < charLevels.size(); i++) {
        CharacterLevelFacade testLevel = getElementAt(i);
        //Logging.errorPrint("Checking " + testLevel);
        String lvlClassName = getLevelInfo(testLevel).getClassKeyName();
        if (classToMatch != null && !classToMatch.getKeyName().equals(lvlClassName)) {
            //Logging.errorPrint("Skipping level " + testLevel + " as it is not the same class as " + classToMatch);
            continue;
        }
        if (!classHasRanksIn(aSkill, ((CharacterLevelFacadeImpl) testLevel).getSelectedClass())) {
            //Logging.errorPrint("Skipping level " + testLevel + " as it does not have ranks in " + aSkill);
            continue;
        }
        if (getSpentSkillPoints(testLevel) <= 0) {
            //Logging.errorPrint("Skipping level " + testLevel + " as it does not have spent points.");
            continue;
        }
        SkillCost skillCost = getSkillCost(testLevel, aSkill);
        float maxRanks = getMaxRanks(testLevel, skillCost, isClassSkillForMaxRanks(testLevel, aSkill));
        if (!Float.isNaN(maxRanks) && maxRanks >= testRank) {
            //Logging.errorPrint("Selected level " + testLevel);
            return testLevel;
        }
    //Logging.errorPrint("Skipping level " + testLevel + " as skill is above max ranks");
    }
    return null;
}
Also used : CharacterLevelFacade(pcgen.facade.core.CharacterLevelFacade) SkillCost(pcgen.cdom.enumeration.SkillCost)

Example 10 with SkillCost

use of pcgen.cdom.enumeration.SkillCost in project pcgen by PCGen.

the class CharacterLevelsFacadeImpl method scanForwardforLevelToBuySkill.

private CharacterLevelFacade scanForwardforLevelToBuySkill(Skill aSkill, float testRank, int baseLevelIndex, SkillCost costToMatch) {
    for (int i = baseLevelIndex; i < charLevels.size(); i++) {
        CharacterLevelFacade testLevel = getElementAt(i);
        //Logging.errorPrint("Checking " + testLevel);
        if (getRemainingSkillPoints(testLevel) <= 0) {
            //Logging.errorPrint("Skipping level " + testLevel + " as it does not have points left.");
            continue;
        }
        SkillCost skillCost = getSkillCost(testLevel, aSkill);
        if (costToMatch != null && skillCost.getCost() != costToMatch.getCost()) {
            //Logging.errorPrint("Skipping level " + testLevel + " as it is not the same cost as " + costToMatch);
            continue;
        }
        float maxRanks = getMaxRanks(testLevel, skillCost, isClassSkillForMaxRanks(testLevel, aSkill));
        if (!Float.isNaN(maxRanks) && maxRanks >= testRank) {
            //Logging.errorPrint("Selected level " + testLevel);
            return testLevel;
        }
    //Logging.errorPrint("Skipping level " + testLevel + " as skill is above max ranks");
    }
    return null;
}
Also used : CharacterLevelFacade(pcgen.facade.core.CharacterLevelFacade) SkillCost(pcgen.cdom.enumeration.SkillCost)

Aggregations

SkillCost (pcgen.cdom.enumeration.SkillCost)22 Skill (pcgen.core.Skill)16 PCClass (pcgen.core.PCClass)15 CharID (pcgen.cdom.enumeration.CharID)11 CharacterLevelFacade (pcgen.facade.core.CharacterLevelFacade)4 ArrayList (java.util.ArrayList)3 ClassSkillList (pcgen.cdom.list.ClassSkillList)3 DataSetID (pcgen.cdom.enumeration.DataSetID)2 AssociatedPrereqObject (pcgen.cdom.base.AssociatedPrereqObject)1 CDOMObject (pcgen.cdom.base.CDOMObject)1 CDOMReference (pcgen.cdom.base.CDOMReference)1 SkillSituation (pcgen.cdom.helper.SkillSituation)1 CharacterDisplay (pcgen.core.display.CharacterDisplay)1 PCLevelInfo (pcgen.core.pclevelinfo.PCLevelInfo)1