Search in sources :

Example 1 with AttackModel

use of plugin.initiative.AttackModel in project pcgen by PCGen.

the class Initiative method hyperLinkSelected.

/**
	 * <p>Called when a hyperlink is selected in one of the text panes in {@code tpaneInfo}.
	 * Used to generate attack/skill, etc. dialogs.</p>
	 *
	 * @param e {@code HyperLinkEvent} that called this method.
	 * @param cbt {@code PcgCombatant} to perform action for.
	 */
private void hyperLinkSelected(HyperlinkEvent e, InitHolder cbt) {
    if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        PObjectModel model = PObjectModel.Factory(e.getDescription());
        if (model != null) {
            if ((model instanceof AttackModel) && (cbt instanceof PcgCombatant)) {
                InitHolder pcgcbt = cbt;
                performAttack((AttackModel) model, pcgcbt);
            } else if (model instanceof CheckModel) {
                performCheck((CheckModel) model);
            } else if (model instanceof SpellModel) {
                castSpell((SpellModel) model, cbt);
            } else if (model instanceof SaveModel) {
                performSave((SaveModel) model, cbt);
            } else if ((model instanceof DiceRollModel) && (cbt instanceof PcgCombatant)) {
                performDiceRoll((DiceRollModel) model);
            }
        }
    }
}
Also used : PcgCombatant(gmgen.plugin.PcgCombatant) SpellModel(plugin.initiative.SpellModel) DiceRollModel(plugin.initiative.DiceRollModel) PObjectModel(plugin.initiative.PObjectModel) SaveModel(plugin.initiative.SaveModel) AttackModel(plugin.initiative.AttackModel) CheckModel(plugin.initiative.CheckModel) InitHolder(gmgen.plugin.InitHolder)

Aggregations

InitHolder (gmgen.plugin.InitHolder)1 PcgCombatant (gmgen.plugin.PcgCombatant)1 AttackModel (plugin.initiative.AttackModel)1 CheckModel (plugin.initiative.CheckModel)1 DiceRollModel (plugin.initiative.DiceRollModel)1 PObjectModel (plugin.initiative.PObjectModel)1 SaveModel (plugin.initiative.SaveModel)1 SpellModel (plugin.initiative.SpellModel)1