public BattleZone(BattleZone zone) : base(zone.Cards.Select(x => x.Copy())) { _pendingAbility = zone._pendingAbility?.Copy() as AsPermanentEntersBattleZoneAbility; if (zone.PermanentEnteringBattleZone != null) { PermanentEnteringBattleZone = new Card(zone.PermanentEnteringBattleZone, false); } if (zone.PermanentSourceZone != null) { PermanentSourceZone = zone.PermanentSourceZone.Copy(); } }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if (disposing) { _pendingAbility?.Dispose(); _pendingAbility = null; PermanentEnteringBattleZone?.Dispose(); PermanentEnteringBattleZone = null; PermanentSourceZone?.Dispose(); PermanentSourceZone = null; } }
public void Add(Duel duel, Decision decision) { var dec = _pendingAbility.Apply(duel, decision); if (dec != null) { throw new NotImplementedException("Should never happen in TCG"); } else { Add(duel, true); _pendingAbility = null; } }
public override Choice Add(Card card, Duel duel, Zone source) { card.RevealedTo = duel.Players.Select(x => x.Id).ToList(); PermanentEnteringBattleZone = card; PermanentSourceZone = source; var abilities = PermanentEnteringBattleZone.Abilities.OfType <AsPermanentEntersBattleZoneAbility>(); if (abilities.Any()) { _pendingAbility = abilities.Single(); return(_pendingAbility.Apply(duel, null)); } else { Add(duel, false); return(null); } }