Search in sources :

Example 1 with SystemAttribute

use of gmgen.plugin.SystemAttribute in project pcgen by PCGen.

the class XMLCombatant method createSystemVals.

/**
	 *
	 * <p>Creates system HP and system initiative values</p>
	 *
	 * @param dexVal
	 * @param conVal
	 * @param hpVal
	 * @param hpCurrVal
	 * @param subdual
	 * @param initBonus
	 */
private void createSystemVals(int dexVal, int conVal, int hpVal, int hpCurrVal, int subdual, int initBonus) {
    init = new SystemInitiative(new SystemAttribute("Dexterity", dexVal), initBonus);
    hitPoints = new SystemHP(new SystemAttribute("Constitution", conVal), hpVal, hpCurrVal);
    hitPoints.setSubdual(subdual);
}
Also used : SystemAttribute(gmgen.plugin.SystemAttribute) SystemInitiative(gmgen.plugin.SystemInitiative) SystemHP(gmgen.plugin.SystemHP)

Example 2 with SystemAttribute

use of gmgen.plugin.SystemAttribute in project pcgen by PCGen.

the class SavingThrowDialog method setDefaults.

/**
	 * <p>
	 * Sets all field defaults based on the combatant, dc, save type, etc.
	 * </p>
	 * @param saveType
	 */
private void setDefaults(int saveType) {
    int base = 0;
    int ability = 0;
    int magic = 0;
    int misc = 0;
    if (cbt instanceof PcgCombatant) {
        PcgCombatant pcgcbt = (PcgCombatant) cbt;
        PlayerCharacter pc = pcgcbt.getPC();
        new PlayerCharacterOutput(pc);
        List<PCCheck> checkList = Globals.getContext().getReferenceContext().getOrderSortedCDOMObjects(PCCheck.class);
        if (saveType == FORT_SAVE) {
            PCCheck fort = checkList.get(0);
            base = pc.calculateSaveBonus(fort, "BASE");
            ability = pc.calculateSaveBonus(fort, "STATMOD");
            magic = pc.calculateSaveBonus(fort, "MAGIC");
            misc = pc.calculateSaveBonus(fort, "MISC.NOMAGIC.NOSTAT");
        } else if (saveType == REF_SAVE) {
            PCCheck ref = checkList.get(1);
            base = pc.calculateSaveBonus(ref, "BASE");
            ability = pc.calculateSaveBonus(ref, "STATMOD");
            magic = pc.calculateSaveBonus(ref, "MAGIC");
            misc = pc.calculateSaveBonus(ref, "MISC.NOMAGIC.NOSTAT");
        } else if (saveType == WILL_SAVE) {
            PCCheck will = checkList.get(2);
            base = pc.calculateSaveBonus(will, "BASE");
            ability = pc.calculateSaveBonus(will, "STATMOD");
            magic = pc.calculateSaveBonus(will, "MAGIC");
            misc = pc.calculateSaveBonus(will, "MISC.NOMAGIC.NOSTAT");
        }
    } else if (cbt instanceof XMLCombatant) {
        XMLCombatant xmlcbt = (XMLCombatant) cbt;
        if (saveType == FORT_SAVE) {
            int mod = new SystemAttribute("Constitution", xmlcbt.getAttribute("Constitution")).getModifier();
            ability = mod;
            base = xmlcbt.getSave("Fortitude") - mod;
        } else if (saveType == REF_SAVE) {
            int mod = new SystemAttribute("Dexterity", xmlcbt.getAttribute("Dexterity")).getModifier();
            ability = mod;
            base = xmlcbt.getSave("Reflex") - mod;
        } else if (saveType == WILL_SAVE) {
            int mod = new SystemAttribute("Wisdom", xmlcbt.getAttribute("Wisdom")).getModifier();
            ability = mod;
            base = xmlcbt.getSave("Will") - mod;
        }
        magic = parseInt(saveMagic.getText());
        misc = parseInt(saveMisc.getText());
    }
    setDefaults(base, ability, magic, misc, parseInt(saveTemp.getText()));
}
Also used : SystemAttribute(gmgen.plugin.SystemAttribute) PlayerCharacterOutput(gmgen.plugin.PlayerCharacterOutput) PcgCombatant(gmgen.plugin.PcgCombatant) PlayerCharacter(pcgen.core.PlayerCharacter) PCCheck(pcgen.core.PCCheck) XMLCombatant(plugin.initiative.XMLCombatant)

Aggregations

SystemAttribute (gmgen.plugin.SystemAttribute)2 PcgCombatant (gmgen.plugin.PcgCombatant)1 PlayerCharacterOutput (gmgen.plugin.PlayerCharacterOutput)1 SystemHP (gmgen.plugin.SystemHP)1 SystemInitiative (gmgen.plugin.SystemInitiative)1 PCCheck (pcgen.core.PCCheck)1 PlayerCharacter (pcgen.core.PlayerCharacter)1 XMLCombatant (plugin.initiative.XMLCombatant)1