public void Initialize(Card card, Game game) { foreach (var castInstruction in _castRules) { castInstruction.Initialize(card, game); } }
public Attacker(Card card, Game game) { Game = game; _card = card; _blockers.Initialize(ChangeTracker); _assignedDamage.Initialize(ChangeTracker); _isBlocked.Initialize(ChangeTracker); }
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); } }
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); }
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); } }
public void PutOnBottom(Card card) { if (card.Zone == Name) { MoveToEnd(card); } else { AddToEnd(card); } }
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(); }
public bool IsBlocker(Card card) { return FindBlocker(card) != null; }
public bool IsAttacker(Card card) { return FindAttacker(card) != null; }
public override void AfterRemove(Card card) { card.OnCardLeftBattlefield(); }
public Damage(int amount, bool isCombat, Card source) { _amount = new Trackable<int>(amount); IsCombat = isCombat; Source = source; }
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)); }
public override void AfterAdd(Card card) { card.OnCardJoinedBattlefield(); }
public void Initialize(Card card, Game game) { _abilities.Initialize(game.ChangeTracker, card); foreach (var activatedAbility in _abilities) { activatedAbility.Initialize(card, game); } }
private Attacker CreateAttacker(Card card) { return new Attacker(card, Game); }
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(); }
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; }
private Attacker FindAttacker(Card cardAttacker) { return _attackers.FirstOrDefault(a => a.Card == cardAttacker); }
private Blocker CreateBlocker(Card blocker, Attacker attacker) { return new Blocker(blocker, attacker, Game); }
public bool HasBlockers(Card card) { var attacker = FindAttacker(card); if (attacker == null) return false; return attacker.BlockersCount > 0; }
public bool CanBeBlockedBy(Card creature) { return _card.CanBeBlockedBy(creature); }
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()); }
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; }
public Card GetAttacker(Card blocker) { var attacker = FindBlocker(blocker).Attacker; return attacker != null ? attacker.Card : null; }
public override void Initialize(Card owningCard, Game game) { base.Initialize(owningCard, game); _p.Cost.Initialize(owningCard, game, _p.TargetSelector.Cost.FirstOrDefault()); _lastActivation.Initialize(ChangeTracker); }
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); }