コード例 #1
0
ファイル: BattleZone.cs プロジェクト: Latepate64/duel-masters
 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();
     }
 }
コード例 #2
0
ファイル: BattleZone.cs プロジェクト: Latepate64/duel-masters
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     if (disposing)
     {
         _pendingAbility?.Dispose();
         _pendingAbility = null;
         PermanentEnteringBattleZone?.Dispose();
         PermanentEnteringBattleZone = null;
         PermanentSourceZone?.Dispose();
         PermanentSourceZone = null;
     }
 }
コード例 #3
0
ファイル: BattleZone.cs プロジェクト: Latepate64/duel-masters
        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;
            }
        }
コード例 #4
0
ファイル: BattleZone.cs プロジェクト: Latepate64/duel-masters
        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);
            }
        }