Пример #1
0
        public override List <GameAction> GetActions()
        {
            List <GameAction> res = new List <GameAction>();

            ActionCommandMap.Clear();

            GameAction done = new GameAction(-1, -1, "Done");

            res.Add(done);

            int i = 0;

            foreach (Card attacker in MyGame.MyCombatHandler.AttackerToTargetMap.Keys)
            {
                ICanBeAttacked icba          = MyGame.MyCombatHandler.AttackerToTargetMap[attacker];
                Boolean        isAttackingMe = false;
                if (icba is Card)
                {
                    isAttackingMe = ((Card)icba).Controller.ID == MyPlayer.ID;
                }
                else
                {
                    isAttackingMe = ((Player)icba).ID == MyPlayer.ID;
                }

                if (isAttackingMe)
                {
                    IEnumerable <Card> creats = MyGame.GetCards(ZoneType.Battlefield, MyPlayer.Value(MyGame)).Where(x => { return(x.CurrentCharacteristics.CardTypes.Contains("Creature")); });
                    foreach (Card c in creats)
                    {
                        if (Utilities.CanBlockAttacker(c, attacker))
                        {
                            GameAction blo = new GameAction(i++, c.ID, "Block " + attacker.ToString(MyGame) + " with this");
                            ActionCommandMap.Add(blo, new CommandAddBlocker(c.ID, attacker.ID));
                            res.Add(blo);
                        }
                    }
                }
            }

            foreach (Card attacker in MyGame.MyCombatHandler.AttackerToBlockersMap.Keys)
            {
                foreach (Card blocker in MyGame.MyCombatHandler.AttackerToBlockersMap[attacker])
                {
                    if (blocker.Controller.ID == MyPlayer.ID)
                    {
                        GameAction blorem = new GameAction(i++, blocker.ID, "Remove " + blocker.ToString(MyGame) + " from blocking.");
                        ActionCommandMap.Add(blorem, new CommandRemoveBlocker(attacker.ID, blocker.ID));
                        res.Add(blorem);
                    }
                }
            }

            return(res);
        }
Пример #2
0
        public override List <GameAction> GetActions()
        {
            List <GameAction> res = new List <GameAction>();

            ActionCommandMap.Clear();

            GameAction done = new GameAction(-1, -1, "Done");

            ActionCommandMap.Add(done, null); //Advance to blocking phase.
            res.Add(done);

            int i = 0;
            IEnumerable <Card> availableCreatures = MyGame.GetCards(ZoneType.Battlefield, MyPlayer.Value(MyGame)).Where(x => { return(x.CurrentCharacteristics.CardTypes.Contains("Creature")); });

            foreach (Card creat in availableCreatures)
            {
                if (!creat.HasSummoningSickness)
                {
                    IEnumerable <Player> opponents = MyGame.GetPlayers().Where(x => { return(x.ID != MyPlayer.ID); });
                    foreach (Player p in opponents)
                    {
                        GameAction gaplayer = new GameAction(i++, creat.ID, "Attack " + p.ToString(MyGame) + "with " + creat.ToString(MyGame));

                        ActionCommandMap.Add(gaplayer, new CommandAddAttacker(creat.ID, p.ID));
                        res.Add(gaplayer);

                        IEnumerable <LazyGameObject <Card> > walkers = p.MyZones[ZoneType.Battlefield].Contents.Where(x => { return(x.Value(MyGame).CurrentCharacteristics.CardTypes.Contains("Planeswalker")); });
                        foreach (LazyGameObject <Card> plw in walkers)
                        {
                            GameAction gaplw = new GameAction(i++, creat.ID, "Attack with " + creat.ToString(MyGame));

                            ActionCommandMap.Add(gaplw, new CommandAddAttacker(creat.ID, plw.ID));
                            res.Add(gaplw);
                        }
                    }
                }
            }

            foreach (Card att in MyGame.MyCombatHandler.AttackerToTargetMap.Keys)
            {
                GameAction garem = new GameAction(i++, att.ID, "Remove " + att.ToString(MyGame) + " from attacking.");

                ActionCommandMap.Add(garem, new CommandRemoveAttacker(att.ID));
                res.Add(garem);
            }

            return(res);
        }