Esempio n. 1
0
        protected override void OnCharacteristicChanged(Player oldValue, Player newValue)
        {
            if (_card.Zone != Zone.Battlefield)
            {
                return;
            }

            Combat.Remove(_card);

            // When equipment changes controller it can already be in the correct zone
            // if it is do not try to change it again (eg Avarice Amulet).
            if (!_card.IsAttached && !newValue.Battlefield.Contains(_card))
            {
                newValue.PutCardToBattlefield(_card);

                foreach (var attachment in _card.Attachments.Where(x => x.IsPermanent && (x.Is().Aura || x.Is().Equipment)))
                {
                    newValue.PutCardToBattlefield(attachment);
                }
            }

            _card.HasSummoningSickness = true;

            Publish(new ControllerChangedEvent(_card));
        }
Esempio n. 2
0
 private void Regenerate()
 {
     Tap();
     ClearDamage();
     HasRegenerationShield = false;
     Combat.Remove(this);
 }
Esempio n. 3
0
        protected override void OnCharacteristicChanged(Player oldValue, Player newValue)
        {
            if (_card.Zone != Zone.Battlefield)
            {
                return;
            }

            Combat.Remove(_card);

            if (!_card.IsAttached)
            {
                Value.PutCardToBattlefield(_card);

                foreach (var attachment in _card.Attachments.Where(x => x.IsPermanent && (x.Is().Aura || x.Is().Equipment)))
                {
                    // for auras and equipments just change battlefield
                    // do not change the control
                    Value.PutCardToBattlefield(attachment);
                }
            }

            _card.HasSummoningSickness = true;

            Publish(new ControllerChangedEvent(_card));
        }
Esempio n. 4
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. 5
0
        public void OnCardLeftBattlefield()
        {
            Combat.Remove(this);

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

            HasSummoningSickness = false;

            LeftBattlefield.Raise();
        }