Search in sources :

Example 16 with SkillCost

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

the class MonCSkillToSkillCostFacet method skillRemoved.

public void skillRemoved(DataFacetChangeEvent<CharID, Skill> dfce) {
    CharID id = dfce.getCharID();
    SkillCost cost = SkillCost.CLASS;
    Skill sk = dfce.getCDOMObject();
    Object source = dfce.getSource();
    for (PCClass cl : classFacet.getSet(id)) {
        if (cl.isMonster()) {
            remove(id, cl, cost, sk, source);
        }
    }
}
Also used : Skill(pcgen.core.Skill) SkillCost(pcgen.cdom.enumeration.SkillCost) PCClass(pcgen.core.PCClass) CharID(pcgen.cdom.enumeration.CharID)

Example 17 with SkillCost

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

the class GlobalToSkillCostFacet method dataAdded.

@Override
public void dataAdded(ScopeFacetChangeEvent<CharID, SkillCost, Skill> dfce) {
    CharID id = dfce.getCharID();
    SkillCost cost = dfce.getScope();
    Skill sk = dfce.getCDOMObject();
    Object source = dfce.getSource();
    for (PCClass cl : classFacet.getSet(id)) {
        add(id, cl, cost, sk, source);
    }
}
Also used : Skill(pcgen.core.Skill) SkillCost(pcgen.cdom.enumeration.SkillCost) PCClass(pcgen.core.PCClass) CharID(pcgen.cdom.enumeration.CharID)

Example 18 with SkillCost

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

the class MonCSkillToSkillCostFacet method skillAdded.

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

Example 19 with SkillCost

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

the class MonCSkillToSkillCostFacet method dataRemoved.

@Override
public void dataRemoved(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)) {
            remove(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 20 with SkillCost

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

the class SkillToken method getSkillPropValue.

/**
	 * Evaluate the property for the supplied skill and character. For
	 * properties such as ACP and the extended UNTRAINED property, the
	 * property text is required to be further parsed to pull out user
	 * defined text to be output in each case.
	 *
	 * @param aSkill The skill to be reported upon.
	 * @param property The property to be reported.
	 * @param propertyText The orginal text of the property.
	 * @param pc The character to be reported upon.
	 * @return The value of the property.
	 */
private String getSkillPropValue(Skill aSkill, int property, String propertyText, PlayerCharacter pc) {
    StringBuilder retValue = new StringBuilder();
    if (((property == SKILL_ABMOD) || (property == SKILL_MISC)) && //&& aSkill.get(ObjectKey.KEY_STAT) == null)
    false) {
        retValue.append("n/a");
    } else {
        switch(property) {
            case SKILL_NAME:
                retValue.append(QualifiedName.qualifiedName(pc, aSkill));
                break;
            case SKILL_TOTAL:
                if (SettingsHandler.getGame().hasSkillRankDisplayText()) {
                    retValue.append(SettingsHandler.getGame().getSkillRankDisplayText(SkillRankControl.getTotalRank(pc, aSkill).intValue() + SkillModifier.modifier(aSkill, pc)));
                } else {
                    retValue.append(Integer.toString(SkillRankControl.getTotalRank(pc, aSkill).intValue() + SkillModifier.modifier(aSkill, pc)));
                }
                break;
            case SKILL_RANK:
                if (SettingsHandler.getGame().hasSkillRankDisplayText()) {
                    retValue.append(SettingsHandler.getGame().getSkillRankDisplayText(SkillRankControl.getTotalRank(pc, aSkill).intValue()));
                } else {
                    retValue.append(SkillRankControl.getTotalRank(pc, aSkill).toString());
                }
                break;
            case SKILL_MOD:
                retValue.append(SkillModifier.modifier(aSkill, pc).toString());
                break;
            case SKILL_ABILITY:
                retValue.append(SkillInfoUtilities.getKeyStatFromStats(pc, aSkill));
                break;
            case SKILL_ABMOD:
                retValue.append(Integer.toString(SkillModifier.getStatMod(aSkill, pc)));
                break;
            case SKILL_MISC:
                retValue.append(Integer.toString(SkillModifier.modifier(aSkill, pc) - SkillModifier.getStatMod(aSkill, pc)));
                break;
            case SKILL_UNTRAINED:
                retValue.append(aSkill.getSafe(ObjectKey.USE_UNTRAINED) ? "Y" : "NO");
                break;
            case SKILL_EXCLUSIVE:
                retValue.append(aSkill.getSafe(ObjectKey.EXCLUSIVE) ? "Y" : "N");
                break;
            case SKILL_UNTRAINED_EXTENDED:
                retValue.append(getUntrainedOutput(aSkill, propertyText));
                break;
            case SKILL_ACP:
                retValue.append(getAcpOutput(aSkill, propertyText));
                break;
            case SKILL_COST:
                SkillCost cost = null;
                for (PCClass pcc : pc.getDisplay().getClassSet()) {
                    if (cost == null) {
                        cost = pc.getSkillCostForClass(aSkill, pcc);
                    } else {
                        SkillCost newCost = pc.getSkillCostForClass(aSkill, pcc);
                        if (SkillCost.CLASS.equals(newCost) || SkillCost.EXCLUSIVE.equals(cost)) {
                            cost = newCost;
                        }
                    }
                    if (SkillCost.CLASS.equals(cost)) {
                        break;
                    }
                }
                retValue.append(cost.toString());
                break;
            case SKILL_EXCLUSIVE_TOTAL:
                retValue.append(Integer.toString(((aSkill.getSafe(ObjectKey.EXCLUSIVE) || !aSkill.getSafe(ObjectKey.USE_UNTRAINED)) && (SkillRankControl.getTotalRank(pc, aSkill).intValue() == 0)) ? 0 : (SkillRankControl.getTotalRank(pc, aSkill).intValue() + SkillModifier.modifier(aSkill, pc))));
                break;
            case SKILL_TRAINED_TOTAL:
                retValue.append(Integer.toString((!aSkill.getSafe(ObjectKey.USE_UNTRAINED) && (SkillRankControl.getTotalRank(pc, aSkill).intValue() == 0)) ? 0 : (SkillRankControl.getTotalRank(pc, aSkill).intValue() + SkillModifier.modifier(aSkill, pc))));
                break;
            case SKILL_EXPLANATION:
                boolean shortFrom = !("_LONG".equals(propertyText.substring(7)));
                String bonusDetails = SkillCostDisplay.getModifierExplanation(aSkill, pc, shortFrom);
                retValue.append(bonusDetails);
                break;
            case SKILL_TYPE:
                String type = aSkill.getType();
                retValue.append(type);
                break;
            case SKILL_SIZE:
                retValue.append(Integer.toString((int) (pc.getSizeAdjustmentBonusTo("SKILL", aSkill.getKeyName()))));
                break;
            case SKILL_CLASSES:
                List<String> classes = new ArrayList<>();
                for (PCClass aClass : pc.getClassList()) {
                    if (pc.getSkillCostForClass(aSkill, aClass) == SkillCost.CLASS) {
                        classes.add(aClass.getDisplayName());
                    }
                }
                retValue.append(StringUtils.join(classes, "."));
                break;
            default:
                Logging.errorPrint("In ExportHandler._writeSkillProperty the propIdvalue " + property + " is not handled.");
                break;
        }
    }
    return retValue.toString();
}
Also used : SkillCost(pcgen.cdom.enumeration.SkillCost) ArrayList(java.util.ArrayList) PCClass(pcgen.core.PCClass)

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