Example #1
0
        public override void Use(TrustedAI ai, Player player, ref CardUseStruct use, WrappedCard card)
        {
            Room room = ai.Room;
            List <ScoreStruct> scores = new List <ScoreStruct>();

            foreach (Player p in ai.GetEnemies(player))
            {
                if (!p.Chained && RoomLogic.CanBeChainedBy(room, p, player))
                {
                    ScoreStruct score = ai.FindCards2Discard(player, p, string.Empty, "he", HandlingMethod.MethodDiscard);
                    score.Players = new List <Player> {
                        p
                    };
                    scores.Add(score);
                }
            }

            if (scores.Count > 0)
            {
                ai.CompareByScore(ref scores);
                if (scores[0].Score > 0)
                {
                    use.Card = card;
                    use.To   = scores[0].Players;
                }
            }
        }
Example #2
0
        public override void Use(TrustedAI ai, Player player, ref CardUseStruct use, WrappedCard card)
        {
            Room room = ai.Room;
            List <ScoreStruct> scores = new List <ScoreStruct>();

            foreach (Player p in room.GetOtherPlayers(player))
            {
                if (!RoomLogic.InMyAttackRange(room, p, player) || p.IsNude())
                {
                    continue;
                }
                ScoreStruct score = ai.FindCards2Discard(player, p, "he", HandlingMethod.MethodDiscard);
                score.Players = new List <Player> {
                    p
                };
                if (ai.IsEnemy(p))
                {
                    if (p.HandcardNum + p.GetPile("wooden_ox").Count < 3 || ai.IsLackCard(p, Slash.ClassName))
                    {
                        score.Score += 3;
                    }
                    else
                    {
                        bool armor_ignore = false;
                        if (p.HasWeapon(QinggangSword.ClassName) || ai.HasSkill("jianchu", p))
                        {
                            armor_ignore = true;
                        }
                        else if (ai.HasSkill("paoxiao|paoxiao_fz", p))
                        {
                            Player lord = ai.FindPlayerBySkill("shouyue");
                            if (lord != null && RoomLogic.PlayerHasShownSkill(room, lord, "shouyue") && RoomLogic.WillBeFriendWith(room, p, lord))
                            {
                                armor_ignore = true;
                            }
                        }

                        if (!armor_ignore && ai.HasArmorEffect(player, RenwangShield.ClassName))
                        {
                            score.Score += 0.5;
                        }
                        if (!armor_ignore && ai.HasArmorEffect(player, EightDiagram.ClassName))
                        {
                            score.Score += 0.5;
                        }
                        if (ai.HasSkill("wushang", p))
                        {
                            score.Score -= 0.5;
                        }
                        if (p.HasWeapon(DragonPhoenix.ClassName))
                        {
                            score.Score -= 0.5;
                        }
                        if (ai.HasSkill("jianchu", p))
                        {
                            score.Score = -0.5;
                        }
                        if (ai.HasSkill("tieqi|tieqi_fz", p))
                        {
                            score.Score = 1;
                        }
                        if (ai.GetKnownCardsNums(Jink.ClassName, "he", player) == 0)
                        {
                            score.Score -= 2;
                        }
                    }
                }
                scores.Add(score);
            }

            if (scores.Count > 0)
            {
                ai.CompareByScore(ref scores);
                if (scores[0].Score > 2)
                {
                    use.Card = card;
                    use.To   = new List <Player>(scores[0].Players);
                }
            }
        }