コード例 #1
0
ファイル: AddCardTo.cs プロジェクト: leod/SabberStone
        public override ISimpleTask Clone()
        {
            var clone = new AddCardTo(Card, Type, _amount);

            clone.Copy(this);
            return(clone);
        }
コード例 #2
0
ファイル: AddCardTo.cs プロジェクト: chalkos/SabberStone
        public override ISimpleTask Clone()
        {
            var clone = new AddCardTo(Playable, Card, Type);

            clone.Copy(this);
            return(clone);
        }
コード例 #3
0
        public override TaskState Process()
        {
            var minion = Source as Minion;

            if (minion != null && ScriptTags == null)
            {
                Generic.CreateChoiceCards.Invoke(Controller, Source, null, ChoiceType.GENERAL, ChoiceAction.KAZAKUS, minion.Card.Entourage.Select(Cards.FromId).ToList(), null);
                return(TaskState.COMPLETE);
            }

            Game.Log(LogLevel.INFO, BlockType.PLAY, "PotionGenerating", $"Current scripttags = {string.Join(",", ScriptTags)}");

            if (ScriptTags.Count < 3)
            {
                int cost = KazakusPotionSpells.First(p =>
                                                     p[GameTag.TAG_SCRIPT_DATA_NUM_1] == ScriptTags[0]).Cost;
                var cardIdList = KazakusPotionSpells.Where(p =>
                                                           p[GameTag.TAG_SCRIPT_DATA_NUM_1] < 1000 && p.Cost == cost &&
                                                           (ScriptTags.Count != 2 || p[GameTag.TAG_SCRIPT_DATA_NUM_1] != ScriptTags[1])).ToList();

                var cardList = new List <Card>();
                while (cardList.Count < 3)
                {
                    Card card = Util.Choose <Card>(cardIdList);
                    cardList.Add(card);
                    cardIdList.RemoveAll(p => p == card);
                }

                Generic.CreateChoiceCards.Invoke(Controller, Source, null, ChoiceType.GENERAL, ChoiceAction.KAZAKUS, cardList, null);
                return(TaskState.COMPLETE);
            }

            // create card ...
            Card baseCard = KazakusPotionSpells.First(p => p[GameTag.TAG_SCRIPT_DATA_NUM_1] == ScriptTags[0]);
            Card spell1   = KazakusPotionSpells.First(p => p.Cost == baseCard.Cost && p[GameTag.TAG_SCRIPT_DATA_NUM_1] == ScriptTags[1]);
            Card spell2   = KazakusPotionSpells.First(p => p.Cost == baseCard.Cost && p[GameTag.TAG_SCRIPT_DATA_NUM_1] == ScriptTags[2]);

            baseCard.Text         = "(1) " + spell1.Text + "(2) " + spell2.Text;
            baseCard.Enchantments = new List <Enchantment>();
            baseCard.Enchantments.AddRange(spell1.Enchantments);
            spell1.PlayRequirements.ToList().ForEach(p =>
            {
                if (!baseCard.PlayRequirements.ContainsKey(p.Key))
                {
                    baseCard.PlayRequirements.Add(p.Key, p.Value);
                }
            });
            baseCard.Enchantments.AddRange(spell2.Enchantments);
            spell2.PlayRequirements.ToList().ForEach(p =>
            {
                if (!baseCard.PlayRequirements.ContainsKey(p.Key))
                {
                    baseCard.PlayRequirements.Add(p.Key, p.Value);
                }
            });

            var task = new AddCardTo(baseCard, EntityType.HAND)
            {
                Game       = Controller.Game,
                Controller = Controller,
                Source     = Source as IPlayable,
                Target     = Target as IPlayable
            };

            Controller.Game.TaskQueue.Enqueue(task);

            // remove tag script from used kazakus entities
            foreach (IPlayable playables in Controller.SetasideZone.GetAll.Where(p => p.Card.Id.StartsWith("CFM_621")))
            {
                playables[GameTag.TAG_SCRIPT_DATA_NUM_1] = 0;
            }

            return(TaskState.COMPLETE);
        }