예제 #1
0
        public override CardUseStruct OnResponding(TrustedAI ai, Player player, string pattern, string prompt, object data)
        {
            CardUseStruct result = new CardUseStruct
            {
                From = player,
                To   = new List <Player>()
            };
            Room room = ai.Room;
            int  sub  = -1;

            foreach (int id in player.GetPile("sorcery"))
            {
                WrappedCard card = room.GetCard(id);
                if (card.Suit == WrappedCard.CardSuit.Club || card.Suit == WrappedCard.CardSuit.Spade)
                {
                    sub = id;
                    break;
                }
            }
            if (sub == -1)
            {
                sub = player.GetPile("sorcery")[0];
            }
            WrappedCard qianhuan = new WrappedCard("QianhuanCard")
            {
                Mute  = true,
                Skill = Name
            };

            qianhuan.AddSubCard(sub);

            if (room.ContainsTag("qianhuan_data") && room.GetTag("qianhuan_data") is CardUseStruct use)
            {
                if (ai.IsCancelTarget(use.Card, use.To[0], use.From) || !ai.IsCardEffect(use.Card, use.To[0], use.From))
                {
                    return(result);
                }

                if (use.Card.Name == SupplyShortage.ClassName || use.Card.Name == Indulgence.ClassName || use.Card.Name == Snatch.ClassName)
                {
                    if (use.From != null && ai.IsEnemy(use.From))
                    {
                        result.Card = qianhuan;
                        return(result);
                    }
                }
                else if (use.Card.Name == BurningCamps.ClassName)
                {
                    DamageStruct damage = new DamageStruct(use.Card, use.From, use.To[0], 1, DamageStruct.DamageNature.Fire);
                    if (player.GetPile("sorcery").Count >= 3 && ai.GetDamageScore(damage).Score < 0 || ai.GetDamageScore(damage).Score < -5)
                    {
                        result.Card = qianhuan;
                        return(result);
                    }
                }
                else if (use.Card.Name.Contains(Slash.ClassName))
                {
                    DamageStruct damage = new DamageStruct(use.Card, use.From, use.To[0], 1 + use.Drank);
                    if (use.Card.Name == FireSlash.ClassName)
                    {
                        damage.Nature = DamageStruct.DamageNature.Fire;
                    }
                    else if (use.Card.Name == ThunderSlash.ClassName)
                    {
                        damage.Nature = DamageStruct.DamageNature.Thunder;
                    }
                    double value = ai.GetDamageScore(damage).Score;
                    if (value < -5 || (ai.IsWeak(use.To[0]) && value < 0) || (value < 0 && player.GetPile("sorcery").Count >= 3))
                    {
                        result.Card = qianhuan;
                        return(result);
                    }
                }
                else if (use.Card.Name == ArcheryAttack.ClassName)
                {
                    DamageStruct damage = new DamageStruct(use.Card, use.From, use.To[0]);
                    double       value  = ai.GetDamageScore(damage).Score;
                    if ((value < -5 || (ai.IsWeak(use.To[0]) && value < 0)) && player != use.To[0] ? ai.IsLackCard(use.To[0], Jink.ClassName) : ai.GetKnownCardsNums(Jink.ClassName, "he", use.To[0]) == 0)
                    {
                        result.Card = qianhuan;
                        return(result);
                    }
                }
                else if (use.Card.Name == SavageAssault.ClassName)
                {
                    Player       menghuo = ai.FindPlayerBySkill("huoshou");
                    DamageStruct damage  = new DamageStruct(use.Card, menghuo ?? use.From, use.To[0]);
                    double       value   = ai.GetDamageScore(damage).Score;
                    if ((value < -5 || (ai.IsWeak(use.To[0]) && value < 0)) && (player != use.To[0] ? ai.IsLackCard(use.To[0], Slash.ClassName)
                        : ai.GetKnownCardsNums(Slash.ClassName, "he", use.To[0]) == 0 || RoomLogic.IsHandCardLimited(room, use.To[0], HandlingMethod.MethodResponse)))
                    {
                        result.Card = qianhuan;
                        return(result);
                    }
                }
                else if (use.Card.Name == Duel.ClassName)
                {
                    DamageStruct damage = new DamageStruct(use.Card, use.From, use.To[0]);
                    double       value  = ai.GetDamageScore(damage).Score;
                    if (value < -5 || ((ai.IsWeak(use.To[0]) || player.GetPile("sorcery").Count >= 3) && value < 0))
                    {
                        result.Card = qianhuan;
                        return(result);
                    }
                }
            }

            return(result);
        }