@Override public int getBonus() { String initiativeVar = ControlUtilities.getControlToken(Globals.getContext(), CControl.INITIATIVE); String initiativeStatVar = ControlUtilities.getControlToken(Globals.getContext(), CControl.INITIATIVESTAT); if (initiativeVar == null) { PCStat dex = Globals.getContext() .getReferenceContext() .silentlyGetConstructedCDOMObject(PCStat.class, "DEX"); return display.processOldInitiativeMod() - pc.getStatModFor(dex) + incrementalBonus; } return ((Number) pc.getGlobal(initiativeVar)).intValue() - ((Number) pc.getGlobal(initiativeStatVar)).intValue() + incrementalBonus; }
@Override public int getModifier() { String initiativeVar = ControlUtilities.getControlToken(Globals.getContext(), CControl.INITIATIVE); if (initiativeVar == null) { return pc.getDisplay().processOldInitiativeMod() + incrementalBonus; } return ((Number) pc.getGlobal(initiativeVar)).intValue() + incrementalBonus; }
@Override public void setBonus(int bonus) { String initiativeVar = ControlUtilities.getControlToken(Globals.getContext(), CControl.INITIATIVE); if (initiativeVar == null) { this.incrementalBonus = bonus - display.processOldInitiativeMod(); } else { this.incrementalBonus = bonus - ((Number) pc.getGlobal(initiativeVar)).intValue(); } setCurrentInitiative(roll + getModifier() + mod); }