/// <summary> /// Executes the event logic. /// </summary> /// <param name="context">The execution context.</param> public override void Execute(IEventContext context) { context.ThrowIfNull(nameof(context)); if (!typeof(IOperationContext).IsAssignableFrom(context.GetType())) { throw new ArgumentException($"{nameof(context)} must be an {nameof(IOperationContext)}."); } var operationContext = context as IOperationContext; // Reset the operation's Repeat property, to avoid implementations running perpetually. this.RepeatAfter = TimeSpan.MinValue; this.Execute(operationContext); // Add any exhaustion for the requestor of the operation, if any. if (this.GetRequestor(operationContext.CreatureFinder) is ICreatureWithExhaustion requestor) { requestor.AddExhaustion(this.ExhaustionType, operationContext.Scheduler.CurrentTime, this.ExhaustionCost); } }