Пример #1
0
 public void Initialize(Card card, Game game)
 {
     foreach (var castInstruction in _castRules)
       {
     castInstruction.Initialize(card, game);
       }
 }
Пример #2
0
        public Attacker(Card card, Game game)
        {
            Game = game;
              _card = card;

              _blockers.Initialize(ChangeTracker);
              _assignedDamage.Initialize(ChangeTracker);
              _isBlocked.Initialize(ChangeTracker);
        }
Пример #3
0
        public override void Initialize(Card owningCard, Game game)
        {
            base.Initialize(owningCard, game);

              _p.ManaOutput.Initialize(this, game);
              _units.Initialize(ChangeTracker);
              _manaCache = owningCard.Controller.ManaCache;

              SubscribeToEvents();
        }
Пример #4
0
        public void Initialize(Card card, Game game)
        {
            Game = game;

              _abilities.Initialize(game.ChangeTracker, card);

              foreach (var triggeredAbility in _abilities)
              {
            triggeredAbility.Initialize(card, game);
              }
        }
Пример #5
0
        public Blocker(Card card, Attacker attacker, Game game)
        {
            Card = card;
              Game = game;

              _attacker = new Trackable<Attacker>(attacker);
              _attacker.Initialize(ChangeTracker);

              _assignedDamage.Initialize(ChangeTracker);
              _damageAssignmentOrder.Initialize(ChangeTracker);
        }
Пример #6
0
 public void PutOnTop(Card card)
 {
     if (card.Zone == Name)
       {
     MoveToFront(card);
       }
       else
       {
     AddToFront(card);
       }
 }
Пример #7
0
        public void Initialize(Card source, Game game)
        {
            Game = game;

              _continiousEffects.Initialize(ChangeTracker);

              foreach (var continiousEffect in _continiousEffects)
              {
            continiousEffect.Initialize(source, Game);
              }
        }
Пример #8
0
 public void PutOnBottom(Card card)
 {
     if (card.Zone == Name)
       {
     MoveToEnd(card);
       }
       else
       {
     AddToEnd(card);
       }
 }
Пример #9
0
        public override void Initialize(Card owningCard, Game game)
        {
            base.Initialize(owningCard, game);

              foreach (var trigger in _p.Triggers)
              {
            trigger.Initialize(this, Game);
            RegisterTriggerListener(trigger);
              }

              if (!_p.TriggerOnlyIfOwningCardIsInPlay || owningCard.Zone == Zone.Battlefield)
            ActivateTriggers();

              SubscribeToEvents();
        }
Пример #10
0
 public bool IsBlocker(Card card)
 {
     return FindBlocker(card) != null;
 }
Пример #11
0
 public bool IsAttacker(Card card)
 {
     return FindAttacker(card) != null;
 }
Пример #12
0
 public override void AfterRemove(Card card)
 {
     card.OnCardLeftBattlefield();
 }
Пример #13
0
 public Damage(int amount, bool isCombat, Card source)
 {
     _amount = new Trackable<int>(amount);
       IsCombat = isCombat;
       Source = source;
 }
Пример #14
0
        public void JoinAttack(Card card, bool wasDeclared = false)
        {
            var attacker = CreateAttacker(card);
              _attackers.Add(attacker);

              if (!card.Has().Vigilance)
            card.Tap();

              Publish(new AttackerJoinedCombatEvent(attacker, wasDeclared));
        }
Пример #15
0
 public override void AfterAdd(Card card)
 {
     card.OnCardJoinedBattlefield();
 }
Пример #16
0
        public void Initialize(Card card, Game game)
        {
            _abilities.Initialize(game.ChangeTracker, card);

              foreach (var activatedAbility in _abilities)
              {
            activatedAbility.Initialize(card, game);
              }
        }
Пример #17
0
 private Attacker CreateAttacker(Card card)
 {
     return new Attacker(card, Game);
 }
Пример #18
0
        private void PutToZoneAfterResolve(Card card)
        {
            if (card.Is().Sorcery || card.Is().Instant)
              {
            card.PutToGraveyard();
            return;
              }

              if (card.Is().Aura)
              {
            var attachedCardController = card.GetControllerOfACardThisIsAttachedTo();
            attachedCardController.PutCardToBattlefield(card);
            return;
              }

              card.PutToBattlefield();
        }
Пример #19
0
 public IEnumerable<Card> GetBlockers(Card attacker)
 {
     return FindAttacker(attacker).Blockers.Select(x => x.Card);
 }
 public PreventAllDamageFromSourceToTarget(Card source, object creatureOrPlayer, bool onlyOnce)
 {
     _onlyOnce = onlyOnce;
       _source = source;
       _creatureOrPlayer = creatureOrPlayer;
 }
Пример #21
0
 private Attacker FindAttacker(Card cardAttacker)
 {
     return _attackers.FirstOrDefault(a => a.Card == cardAttacker);
 }
Пример #22
0
 private Blocker CreateBlocker(Card blocker, Attacker attacker)
 {
     return new Blocker(blocker, attacker, Game);
 }
Пример #23
0
        public bool HasBlockers(Card card)
        {
            var attacker = FindAttacker(card);

              if (attacker == null)
            return false;

              return attacker.BlockersCount > 0;
        }
Пример #24
0
 public bool CanBeBlockedBy(Card creature)
 {
     return _card.CanBeBlockedBy(creature);
 }
Пример #25
0
        public void Initialize(Card card, Game game)
        {
            Game = game;
              _card = card;

              _p.TargetSelector.Initialize(card, game);

              foreach (var aiInstruction in _p.Rules)
              {
            aiInstruction.Initialize(game);
              }

              _p.Cost.Initialize(card, game, _p.TargetSelector.Cost.FirstOrDefault());
        }
Пример #26
0
        public void Remove(Card card)
        {
            var attacker = FindAttacker(card);

              if (attacker != null)
              {
            _attackers.Remove(attacker);
            attacker.RemoveFromCombat();
            return;
              }

              var blocker = FindBlocker(card);

              if (blocker != null)
              {
            _blockers.Remove(blocker);
            blocker.RemoveFromCombat();
              }
        }
 public PreventAllDamageFromSource(Card source, bool preventCombatOnly)
 {
     _source = source;
       _preventCombatOnly = preventCombatOnly;
 }
Пример #28
0
 public Card GetAttacker(Card blocker)
 {
     var attacker = FindBlocker(blocker).Attacker;
       return attacker != null ? attacker.Card : null;
 }
Пример #29
0
 public override void Initialize(Card owningCard, Game game)
 {
     base.Initialize(owningCard, game);
       _p.Cost.Initialize(owningCard, game, _p.TargetSelector.Cost.FirstOrDefault());
       _lastActivation.Initialize(ChangeTracker);
 }
Пример #30
0
        public virtual void Initialize(Card owningCard, Game game)
        {
            _owner = owningCard;
              Game = game;

              _p.TargetSelector.Initialize(owningCard, game);

              foreach (var rule in _p.Rules)
              {
            rule.Initialize(game);
              }

              _isEnabled.Initialize(Game.ChangeTracker);
        }