Esempio n. 1
0
        public void ChangeZone(IZone destination, Action <Card> add)
        {
            var source = _zone.Value;

            Asrt.False(destination == source,
                       "Cannot change zones, when source zone and destination zone are the same.");

            source.Remove(this);
            _zone.Value = destination;
            add(this);

            if (destination.Name != source.Name)
            {
                if (destination.Name == Zone.Battlefield)
                {
                    HasSummoningSickness = true;
                    JoinedBattlefield.Raise();
                }

                // if card goes to library and it is not hidden, change its default zone visibility
                if (destination.Name == Zone.Library && !_isHidden)
                {
                    if (source.Name == Zone.Hand)
                    {
                        Peek(true);
                    }
                    else if (source.Name == Zone.Battlefield || source.Name == Zone.Graveyard || source.Name == Zone.Exile)
                    {
                        Reveal(true);
                    }
                }

                if (destination.Name == Zone.Hand && !_isHidden)
                {
                    if (source.Name == Zone.Battlefield || source.Name == Zone.Graveyard || source.Name == Zone.Exile)
                    {
                        Reveal(true);
                    }
                }

                Publish(new ZoneChangedEvent(this, source.Name, destination.Name));

                if (source.Name == Zone.Battlefield)
                {
                    Combat.Remove(this);

                    DetachAttachments();
                    Detach();
                    Untap();
                    ClearDamage();

                    HasSummoningSickness = false;

                    LeftBattlefield.Raise();
                }
            }
        }
Esempio n. 2
0
        public void OnCardLeftBattlefield()
        {
            Combat.Remove(this);

            DetachAttachments();
            Detach();
            Untap();
            ClearDamage();

            HasSummoningSickness = false;

            LeftBattlefield.Raise();
        }
Esempio n. 3
0
        private void UpdateValue()
        {
            var oldValue = _currentValue.Value;
            var newValue = _baseValue.Value;

            foreach (var modifier in _modifiers.OrderBy(x => x.Priority))
            {
                newValue = modifier.Apply(newValue);
            }

            if (!oldValue.Equals(newValue))
            {
                Value = newValue;

                Changed.Raise(new CharacteristicChangedParams <T>(oldValue, newValue));
                OnCharacteristicChanged(oldValue, newValue);
            }
        }
Esempio n. 4
0
 protected void NotifyModifierHasChanged()
 {
     Changed.Raise();
 }
Esempio n. 5
0
 protected void End()
 {
     Ended.Raise();
 }
Esempio n. 6
0
 private void OnParametersChanged(CharacteristicChangedParams <CardParameters> p)
 {
     Changed.Raise();
 }
Esempio n. 7
0
 public void OnCardJoinedBattlefield()
 {
     HasSummoningSickness = true;
     JoinedBattlefield.Raise();
 }