/// <summary> /// Creates a delayed action that has it's effects applied after an amount of rounds has passed. /// </summary> /// <param name="actor">The character performing the action.</param> /// <param name="action">The action being performed.</param> /// <param name="targets">The list of target positions the action targets.</param> private void CreateDelayedAction(Character actor, ActionBase action, IReadOnlyList <int> targets) { if (!_delayedActions.ContainsKey(actor)) { _delayedActions[actor] = new List <DelayedAction>(); } DamageTypes totalDamage = DamageCalculator.GetDamage(actor, action); int totalHeal = DamageCalculator.GetHealing(actor, action); int percentageHealing = DamageCalculator.GetHealingPercentage(actor, action); int rand = _random.Next(1, 101); int totalCritChance = action.CritChance > 0 ? action.CritChance + actor.CritChance : 0; if (totalCritChance > rand) { int critMultiplier = actor.CritMultiplier + action.CritMultiplier + 100; totalDamage = totalDamage * critMultiplier / 100; totalHeal = totalHeal * critMultiplier / 100; } _delayedActions[actor].Add(new DelayedAction() { Actor = actor, BaseAction = action, TotalDamage = totalDamage, HealAmount = totalHeal, HealPercentage = percentageHealing, TurnsRemaining = action.Delay, Targets = targets }); DelayedActionBeginChannel?.Invoke(this, new CombatLoggableEventArgs() { LogMessage = CombatMessenger.GetBeginChannelMessage(actor.Name, action.Name) }); }
private void OnDelayedActionBeginChannel(object sender, CombatLoggableEventArgs args) { DelayedActionBeginChannel?.Invoke(sender, args); }