示例#1
0
        public override ISimpleTask Clone()
        {
            var clone = new SummonTask(Card, RemoveFromStack);

            clone.Copy(this);
            return(clone);
        }
示例#2
0
        public override ISimpleTask Clone()
        {
            var clone = new SummonTask(Side, Card, RemoveFromStack, _addToStack, _amount);

            clone.Copy(this);
            return(clone);
        }
示例#3
0
        public override TaskState Process()
        {
            if (Controller.BoardZone.IsFull)
            {
                return(TaskState.STOP);
            }

            var entities = IncludeTask.GetEntites(Type, Controller, Source, Target, Playables);

            if (entities.Count < 1)
            {
                return(TaskState.STOP);
            }

            entities.ForEach(p =>
            {
                // clone task here
                var task = new SummonTask(p.Card)
                {
                    Game       = Controller.Game,
                    Controller = Controller,
                    Source     = Source as IPlayable,
                    Target     = Target as IPlayable
                };

                Controller.Game.TaskQueue.Enqueue(task);
            });

            return(TaskState.COMPLETE);
        }
示例#4
0
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member

        public override TaskState Process()
        {
            if (Controller.BoardZone.IsFull)
            {
                return(TaskState.STOP);
            }

            List <IPlayable> entities = IncludeTask.GetEntites(Type, Controller, Source, Target, Playables);

            if (entities.Count < 1)
            {
                return(TaskState.STOP);
            }

            // shuffle list randomly if needed
            entities = RandomFlag ? entities.OrderBy(x => Util.Random.Next()).ToList() : entities;

            entities.ForEach(p =>
            {
                // clone task here
                var task = new SummonTask(SummonSide.DEFAULT, p.Card)
                {
                    Game       = Controller.Game,
                    Controller = Controller,
                    Source     = Source as IPlayable,
                    Target     = Target as IPlayable
                };

                Controller.Game.TaskQueue.Enqueue(task);
            });

            return(TaskState.COMPLETE);
        }
示例#5
0
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member

        public override TaskState Process()
        {
            if (Controller.BoardZone.IsFull)
            {
                return(TaskState.STOP);
            }

            List <IPlayable> entities = IncludeTask.GetEntities(Type, Controller, Source, Target, Playables).ToList();

            if (entities.Count < 1)
            {
                return(TaskState.STOP);
            }

            // shuffle list randomly if needed
            entities = RandomFlag ? entities.OrderBy(x => Util.Random.Next()).ToList() : entities;

            if (RandomFlag)
            {
                Game.OnRandomHappened(true);
            }

            int space = Controller.BoardZone.MaxSize - Controller.BoardZone.Count;

            if (space < entities.Count)
            {
                Playables = Playables.Take(space).ToList();
            }

            entities.ForEach(p =>
            {
                // clone task here
                var task = new SummonTask(_side, p.Card)
                {
                    Game       = Controller.Game,
                    Controller = Controller,
                    Source     = Source as IPlayable,
                    Target     = Target as IPlayable
                };

                Controller.Game.TaskQueue.Enqueue(task);
            });

            return(TaskState.COMPLETE);
        }
示例#6
0
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member

        public override TaskState Process()
        {
            if (Controller.BoardZone.IsFull)
            {
                return(TaskState.STOP);
            }

            IList <IPlayable> entities = IncludeTask.GetEntities(Type, Controller, Source, Target, Playables).ToList();

            if (entities.Count < 1)
            {
                return(TaskState.STOP);
            }

            // shuffle list randomly if needed
            entities = RandomFlag ? entities.OrderBy(x => Util.Random.Next()).ToList() : entities;

            if (RandomFlag)
            {
                Game.OnRandomHappened(true);
            }

            int space = Controller.BoardZone.MaxSize - Controller.BoardZone.Count;

            space = entities.Count > space ? space : entities.Count;

            if (entities[0].Zone == null || entities[0].Zone.Type != Enums.Zone.PLAY)
            {
                for (int i = 0; i < space; i++)
                {
                    // clone task here
                    var task = new SummonTask(_side, entities[i].Card)
                    {
                        Game       = Controller.Game,
                        Controller = Controller,
                        Source     = Source as IPlayable,
                        Target     = Target as IPlayable
                    };

                    Controller.Game.TaskQueue.Enqueue(task);
                }
            }
            else
            {
                for (int i = 0; i < entities.Count; i++)
                {
                    if (Controller.BoardZone.IsFull)
                    {
                        break;
                    }

                    Minion target = (Minion)entities[i];

                    var tags = new EntityData.Data((EntityData.Data)target.NativeTags);

                    if (target.Controller != Controller)
                    {
                        tags[GameTag.CONTROLLER] = Controller.PlayerId;
                    }

                    IPlayable copy = Entity.FromCard(Controller, target.Card, tags, Controller.BoardZone);

                    target.AppliedEnchantments?.ForEach(e =>
                    {
                        Enchantment instance = Enchantment.GetInstance(Controller, copy, copy, e.Card);
                        if (e[GameTag.TAG_SCRIPT_DATA_NUM_1] > 0)
                        {
                            instance[GameTag.TAG_SCRIPT_DATA_NUM_1] = e[GameTag.TAG_SCRIPT_DATA_NUM_1];
                            if (e[GameTag.TAG_SCRIPT_DATA_NUM_2] > 0)
                            {
                                instance[GameTag.TAG_SCRIPT_DATA_NUM_2] = e[GameTag.TAG_SCRIPT_DATA_NUM_2];
                            }
                        }
                    });

                    if (target.OngoingEffect != null && copy.OngoingEffect == null)
                    {
                        target.OngoingEffect.Clone(copy);
                    }

                    if (_addToStack)
                    {
                        Playables.Add(copy);
                    }
                }
            }



            return(TaskState.COMPLETE);
        }