public void PushTriggered() { if (_triggeredEffects.Count == 0) { return; } var active = _triggeredEffects .Where(x => x.Controller == Players.Active) .ToList(); var passive = _triggeredEffects .Where(x => x.Controller == Players.Passive) .ToList(); _triggeredEffects.Clear(); if (active.Count > 0) { Enqueue(new PushTriggeredEffects( Players.Active, active)); } if (passive.Count > 0) { Enqueue(new PushTriggeredEffects( Players.Passive, passive)); } }
private void Deactivate() { // disable handlers, which will be triggered when // ending modifiers lifetimes Unsubscribe(this); // should be set at start or there will be an // infinite loop _isActivated.Value = false; // create a copy of lifetime to despose // since when endlife is called the original // can change var lifetimes = _lifetimes.ToArray(); _lifetimes.Clear(); foreach (var lifetime in lifetimes) { lifetime.EndLife(); } // enable handlers back Subscribe(this); }
public void Deal() { foreach (var damage in _assigned) { damage.Source.DealDamageTo(damage.Amount, _player, isCombat: true); } _assigned.Clear(); }
private void RemoveAllScheduled() { foreach (var unit in _removeList) { RemovePermanently(unit); } _removeList.Clear(); }
public void DealAssignedDamage() { foreach (var damage in _assignedDamage) { damage.Source.DealDamageTo(damage.Amount, _card, isCombat: true); } _assignedDamage.Clear(); }
private void DeactivateSource() { foreach (var unit in _units) { _manaCache.Remove(unit); } _units.Clear(); Unsubscribe(_p.ManaOutput); }
public void Disable() { foreach (var lifetime in _lifetimes) { lifetime.EndLife(); } _lifetimes.Clear(); _isEnabled.Value = false; }
public void EmptyManaPool() { foreach (var unit in _manaPool.Where(x => !x.HasSource)) { RemovePermanently(unit); } lock (_manaPoolCountLock) { _manaPool.Clear(); } RemoveAllScheduled(); }
public void RemoveAll() { foreach (var blocker in _blockers) { blocker.RemoveFromCombat(); } foreach (var attacker in _attackers) { attacker.RemoveFromCombat(); } _blockers.Clear(); _attackers.Clear(); }
public void ClearAssignedDamage() { _assignedDamage.Clear(); }