Exemple #1
0
        public override Effect GetEffect(EffectMakerPerspective perspective, bool buff)
        {
            if (perspective.Phase == Phase.StartOfGame && perspective.Card.Zone == Zone.PutOff)
            {
                return(new StartInDeckEffect());
            }
            if (!perspective.IsPlayed())
            {
                clonedCards.Clear();
                clonedEffects.Clear();
                if (perspective.Card.Zone == Zone.Play)
                {
                    return(new EndEffect());
                }
                return(null);
            }
            while (clonedCards.Count < 3)
            {
                var card = perspective.Player.Play.FirstOrDefault(x => !clonedCards.Contains(x) && x != perspective.Card);
                if (card == null)
                {
                    break;
                }
                clonedCards.Add(card);
            }
            var clone = perspective.PrevEffects.FirstOrDefault(x => x.Caller == perspective.Player && x.Buff == buff &&
                                                               clonedCards.Contains(x.CallerCard) && !clonedEffects.Contains(x.Effect));

            if (clone != null)
            {
                clonedEffects.Add(clone.Effect);
                return(clone.Effect);
            }
            return(null);
        }
Exemple #2
0
 public override Effect GetEffect(EffectMakerPerspective perspective, bool buff)
 {
     if (perspective.Phase == Phase.StartOfGame && perspective.Card.Zone == Zone.PutOff)
     {
         return(new StartInDeckEffect());
     }
     if (state == 0 && perspective.IsPlayed() && !buff)
     {
         ++state;
         return(new AttackEffect(10));
     }
     if (state == 1 && perspective.IsPlayed() && !buff &&
         perspective.PrevEffects.CountAttackTaken(perspective.Opponent) - discarded * 15 > 15)
     {
         ++discarded;
         return(new DiscardEffect());
     }
     if (perspective.IsEnded())
     {
         state     = 0;
         discarded = 0;
         return(new EndEffect());
     }
     return(null);
 }
Exemple #3
0
 public override Effect GetEffect(EffectMakerPerspective perspective, bool buff)
 {
     if (cardsLeft > 0)
     {
         --cardsLeft;
         return(new DrawEffect());
     }
     if (done || perspective.IsPlayed() || !buff)
     {
         return(null);
     }
     done = true;
     if (perspective.IsEnded())
     {
         return(new FinishTurnEffect());
     }
     else if (perspective.Phase == Phase.Choose)
     {
         if (perspective.Game.Turn == 1)
         {
             cardsLeft = perspective.GameRules.StartingHand - 1;
             return(new DrawEffect());
         }
         else if (perspective.GameRules.StrictHandMax || perspective.Player.Hand.Count < perspective.GameRules.HandMax)
         {
             return(new DrawEffect());
         }
     }
     return(null);
 }
Exemple #4
0
 public override Effect GetEffect(EffectMakerPerspective perspective, bool buff)
 {
     if (perspective.Phase == Phase.StartOfGame && perspective.Card.Zone == Zone.PutOff)
     {
         return(new StartInDeckEffect());
     }
     if (perspective.IsEnded())
     {
         state = 0;
         saved = null;
         return(new EndEffect());
     }
     if (buff && perspective.Card.Zone == Zone.Hand)
     {
         if (saved == null)
         {
             saved = perspective.PrevEffects
                     .Where(x => x.Target == perspective.Player && x.Effect is DiscardEffect)
                     .Select(x => ((DiscardEffect)x.Effect).Discarded)
                     .FirstOrDefault(x => x != null && (x.Zone == Zone.Pile || x.Zone == Zone.Deck));
         }
         if (saved != null)
         {
             if (state == 0)
             {
                 ++state;
                 return(new MoveMatchingEffect(saved.Zone, Zone.Hand, x => x == saved));
             }
             if (state == 1)
             {
                 ++state;
                 return(new MoveEffect(perspective.Card.Zone, Zone.Play));
             }
         }
     }
     if (buff && perspective.IsPlayed())
     {
         if (state < 2)
         {
             state = 2;
         }
         if (state == 2)
         {
             ++state;
             return(new BlockEffect(10));
         }
         if (state == 3)
         {
             ++state;
             return(new DrawEffect());
         }
     }
     return(null);
 }
Exemple #5
0
 public override Effect GetEffect(EffectMakerPerspective perspective, bool buff)
 {
     while (items[pos].SkipCondition(perspective)) // TODO infinite loop
     {
         pos = (pos + 1) % items.Count;
     }
     if (items[pos].Buff == buff && items[pos].PlayCondition(perspective))
     {
         var result = items[pos].Effect(perspective);
         pos = (pos + 1) % items.Count;
         return(result);
     }
     return(null);
 }
Exemple #6
0
 public override Effect GetEffect(EffectMakerPerspective perspective, bool buff)
 {
     if (perspective.Phase == Phase.StartOfGame && perspective.Card.Zone == Zone.PutOff)
     {
         return(new StartInDeckEffect());
     }
     if (state == 0 && perspective.IsPlayed() && !buff)
     {
         ++state;
         damage += 5;
         return(new AttackEffect(damage - 5));
     }
     if (state == 1 && perspective.IsEnded())
     {
         state = 0;
         return(new EndEffect());
     }
     return(null);
 }
Exemple #7
0
 public override Effect GetEffect(EffectMakerPerspective perspective, bool buff)
 {
     if (perspective.Phase == Phase.StartOfGame && perspective.Card.Zone == Zone.PutOff)
     {
         return(new StartInDeckEffect());
     }
     if (state == 0 && perspective.IsPlayed() && buff)
     {
         ++state;
         return(new HealEffect(5));
     }
     if (state == 1 && perspective.IsPlayed() && !buff)
     {
         ++state;
         return(new AttackEffect(5));
     }
     if (state == 2 && perspective.IsPlayed() && !buff)
     {
         ++state;
         revealEffect = new RevealRandomEffect(Zone.Hand);
         return(revealEffect);
     }
     if (state == 3)
     {
         if (stolenMaker == null && revealEffect.Revealed != null)
         {
             stolenMaker = revealEffect.Revealed.Type.Effects();
         }
         if (perspective.IsEnded())
         {
             state        = 0;
             revealEffect = null;
             stolenMaker  = null;
             return(new EndEffect());
         }
         if (perspective.IsPlayed() && stolenMaker != null)
         {
             return(stolenMaker.GetEffect(perspective, buff));
         }
     }
     return(null);
 }
Exemple #8
0
 public override Effect GetEffect(EffectMakerPerspective perspective, bool buff)
 {
     if (perspective.Phase == Phase.StartOfGame && perspective.Card.Zone == Zone.PutOff)
     {
         return(new StartInDeckEffect());
     }
     if (state == 0 && perspective.IsPlayed() && !buff)
     {
         ++state;
         return(new AttackEffect(5));
     }
     if (state == 1 && perspective.IsPlayed() && !buff)
     {
         ++state;
         moveEffect = new MoveRandomEffect(Zone.Deck, Zone.Pile);
         return(moveEffect);
     }
     if (state == 2)
     {
         if (stolenMaker == null && moveEffect.Moved != null)
         {
             stolenMaker = moveEffect.Moved.Type.Effects();
         }
         if (perspective.IsEnded())
         {
             state       = 0;
             moveEffect  = null;
             stolenMaker = null;
             return(new EndEffect());
         }
         if (perspective.IsPlayed() && stolenMaker != null)
         {
             return(stolenMaker.GetEffect(perspective, buff));
         }
     }
     return(null);
 }
Exemple #9
0
 public override Effect GetEffect(EffectMakerPerspective perspective, bool buff)
 {
     if (perspective.Phase == Phase.StartOfGame && perspective.Card.Zone == Zone.PutOff)
     {
         return(new StartInDeckEffect());
     }
     if (state == 0 && perspective.IsPlayed() && !buff)
     {
         state = 1;
         return(new AttackEffect(5));
     }
     if (state == 1)
     {
         if (perspective.IsEnded() && buff)
         {
             state   = 0;
             damage  = 0;
             healing = 0;
             return(new EndEffect());
         }
         if (perspective.IsPlayed())
         {
             if (!buff)
             {
                 damage = perspective.PrevEffects.CountAttackTaken(perspective.Opponent);
             }
             else if (damage > healing)
             {
                 var value = damage - healing;
                 healing = damage;
                 return(new HealEffect(value));
             }
         }
     }
     return(null);
 }