示例#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();
        }
        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);
       }
 }
        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);
        }