Exemplo n.º 1
0
    private void HandleCardEffectsWorker(CardPotentialState curState)
    {
        if (_currentActiveCardEffects.Count > 0)
        {// get effects by their 'intended' usage state
            // would eventually move entire thing to event system so i could hook it up to
            // anims/fx etc and so it can be 'slowed' down
            var tempEffects = _currentActiveCardEffects.Where(x => x.Key.EffectPreferredState == curState).ToList();

            for (int i = 0; i < tempEffects.Count; i++)
            {
                var e = tempEffects[i].Key;
                e.OnActivateCardEffect();
                // would move code below to the effect itself, and it would simply invoke a method here instead
                if (e.CardEffectDefaults.BaseCardEffect == CardEffectType.Debug)
                {
                    ChangeTargetHealth(GetTarget(e.EffectTarget), e.CardEffectDefaults.EffectOnHealth);
                }
                _currentActiveCardEffects[e]--;

                if (_currentActiveCardEffects[e] <= 0)
                {
                    _currentActiveCardEffects.Remove(e);
                }
            }

            /*var tempList = new List<Card>();
             * for (int i = 0; i < _currentActiveCardEffects.Count; i++)
             * {
             *  var effect = _currentActiveCardEffects.ElementAt(i);
             *  var newEffectChange = effect.Key;
             *  newEffectChange.OnActivateCardEffect();
             *  _currentActiveCardEffects[effect.Key]--;
             *
             *  if (effect.Value <= 0)
             *  {
             *      _currentActiveCardEffects.Remove(effect.Key);
             *  }
             * }*/
            //
        }
    }
Exemplo n.º 2
0
 private void HandleAnyCardEffectsInPlay(CardPotentialState curState)
 {
     HandleCardEffectsWorker(curState);
 }