public static bool Run(IMagicalInteraction ths, OccultTypes intendedType) { bool succeeded = true; if (!ths.OnPreFailureCheck()) { return(false); } bool epicFailure; ths.SpellCastingSucceeded = MagicPointControl.IsFailure(ths, intendedType, out epicFailure); if (!ths.SpellCastingSucceeded) { ths.SpellCastingEpiclyFailed = epicFailure; } ths.StandardEntry(); ths.BeginCommodityUpdates(); try { if (!ths.OnPostFailureCheck()) { return(false); } MagicPointControl.UsePoints(ths.Actor, ths.SpellPoints, intendedType); if (ths.SpellCastingSucceeded) { ths.OnSpellSuccess(); } else if ((ths.EpicFailureAllowed()) && (ths.SpellCastingEpiclyFailed)) { succeeded = false; ths.OnSpellEpicFailure(); } else { succeeded = false; ths.OnSpellFailure(); } EventTracker.SendEvent(EventTypeId.kCastSpell, ths.Actor); } finally { ths.EndCommodityUpdates(succeeded); ths.StandardExit(); } return(succeeded); }
public static bool Run(IMagicalInteraction ths, OccultTypes intendedType) { bool succeeded = true; if (!ths.OnPreFailureCheck()) return false; bool epicFailure; ths.SpellCastingSucceeded = MagicPointControl.IsFailure(ths, intendedType, out epicFailure); if (!ths.SpellCastingSucceeded) { ths.SpellCastingEpiclyFailed = epicFailure; } ths.StandardEntry(); ths.BeginCommodityUpdates(); try { if (!ths.OnPostFailureCheck()) return false; MagicPointControl.UsePoints(ths.Actor, ths.SpellPoints, intendedType); if (ths.SpellCastingSucceeded) { ths.OnSpellSuccess(); } else if ((ths.EpicFailureAllowed()) && (ths.SpellCastingEpiclyFailed)) { succeeded = false; ths.OnSpellEpicFailure(); } else { succeeded = false; ths.OnSpellFailure(); } EventTracker.SendEvent(EventTypeId.kCastSpell, ths.Actor); } finally { ths.EndCommodityUpdates(succeeded); ths.StandardExit(); } return succeeded; }