Search in sources :

Example 1 with SystemHP

use of gmgen.plugin.SystemHP 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 SystemHP

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

the class Initiative method pasteNew.

/**  pastes the copied combatant
	 * @param toPaste
	 */
private void pasteNew(InitHolder toPaste) {
    if (toPaste instanceof XMLCombatant) {
        XMLCombatant cb = (XMLCombatant) toPaste;
        SystemInitiative init = cb.getInitiative();
        SystemHP hitPoints = cb.getHP();
        String name = initList.getUniqueName(cb.getName());
        InitHolder newCbt = new XMLCombatant(name, toPaste.getPlayer(), init.getAttribute().getValue(), hitPoints.getAttribute().getValue(), hitPoints.getMax(), hitPoints.getCurrent(), hitPoints.getSubdual(), init.getBonus(), cb.getCombatantType(), cb.getCR());
        initList.add(newCbt);
    }
    if (toPaste instanceof PcgCombatant) {
    //			PcgCombatant cb = (PcgCombatant) toPaste;
    //			PCGen_Frame1.getInst().loadPCFromFile(
    //				new File(cb.getPC().getFileName()), false, true);
    // As character exists in pcgen it is automatically added in to the init list
    }
    refreshTable();
}
Also used : SystemInitiative(gmgen.plugin.SystemInitiative) PcgCombatant(gmgen.plugin.PcgCombatant) SystemHP(gmgen.plugin.SystemHP) XMLCombatant(plugin.initiative.XMLCombatant) InitHolder(gmgen.plugin.InitHolder)

Example 3 with SystemHP

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

the class Initiative method doMassiveDamage.

/**
	 * Do Massive damage
	 * @param cbt
	 * @param damage
	 */
private void doMassiveDamage(Combatant cbt, int damage) {
    int massiveType = SettingsHandler.getGMGenOption(InitiativePlugin.LOG_NAME + ".Damage.Massive.Type", PreferencesMassiveDamagePanel.MASSIVE_DND);
    boolean isMassive = false;
    if (massiveType == PreferencesMassiveDamagePanel.MASSIVE_DND) {
        isMassive = SystemHP.isDndMassive(cbt, damage);
    } else if (massiveType == PreferencesMassiveDamagePanel.MASSIVE_D20_MODERN) {
        isMassive = SystemHP.isD20ModernMassive(cbt, damage);
    } else if (massiveType == PreferencesMassiveDamagePanel.MASSIVE_HOUSE_HALF) {
        isMassive = SystemHP.isHouseHalfMassive(cbt, damage);
    }
    if (isMassive) {
        SavingThrowDialog dialog = new SavingThrowDialog(GMGenSystem.inst, true, cbt, 15, SavingThrowDialog.FORT_SAVE);
        dialog.setVisible(true);
        dialog.dispose();
        //Show the dialog and get it's results
        int returnVal = dialog.getReturnValue();
        int roll = dialog.getRoll();
        int total = dialog.getTotal();
        int dc = dialog.getDC();
        //Create a message out with the results
        StringBuilder sb = new StringBuilder();
        sb.append(dialog.getSaveAbbrev(dialog.getSaveType()));
        sb.append(" save DC " + dc);
        if (roll > 0) {
            sb.append(" with a roll of " + (roll + total));
            sb.append(" (" + total + " + Roll: " + roll + ')');
        }
        //write out the results to the combat tab
        if (returnVal == SavingThrowDialog.PASS_OPTION) {
            writeToCombatTabWithRound(cbt.getName() + " (" + cbt.getPlayer() + ") Passed a " + sb + " to avoid massive damage effects");
        } else if (returnVal == SavingThrowDialog.FAIL_OPTION) {
            writeToCombatTabWithRound(cbt.getName() + " (" + cbt.getPlayer() + ") Failed a " + sb + " to avoid massive damage effects");
            //Failure
            int massiveEffect = SettingsHandler.getGMGenOption(InitiativePlugin.LOG_NAME + ".Damage.Massive.Effect", PreferencesMassiveDamagePanel.MASSIVE_EFFECT_KILL);
            if (massiveEffect == PreferencesMassiveDamagePanel.MASSIVE_EFFECT_KILL) {
                cbt.kill();
                combatantDied(cbt);
            } else if (massiveEffect == PreferencesMassiveDamagePanel.MASSIVE_EFFECT_NEGATIVE) {
                SystemHP hp = cbt.getHP();
                int current = hp.getCurrent();
                cbt.damage(current + 1);
            } else if (massiveEffect == PreferencesMassiveDamagePanel.MASSIVE_EFFECT_HALF_TOTAL) {
                SystemHP hp = cbt.getHP();
                int max = hp.getMax();
                cbt.damage(max / 2);
            } else if (massiveEffect == PreferencesMassiveDamagePanel.MASSIVE_EFFECT_HALF_CURRENT) {
                SystemHP hp = cbt.getHP();
                int current = hp.getCurrent();
                cbt.damage(current / 2);
            }
        }
    }
    combatantUpdated(cbt);
}
Also used : SystemHP(gmgen.plugin.SystemHP)

Aggregations

SystemHP (gmgen.plugin.SystemHP)3 SystemInitiative (gmgen.plugin.SystemInitiative)2 InitHolder (gmgen.plugin.InitHolder)1 PcgCombatant (gmgen.plugin.PcgCombatant)1 SystemAttribute (gmgen.plugin.SystemAttribute)1 XMLCombatant (plugin.initiative.XMLCombatant)1