Пример #1
0
        public override List <WrappedCard> GetViewAsCards(TrustedAI ai, string pattern, Player player)
        {
            List <WrappedCard> result = new List <WrappedCard>();
            Room        room          = ai.Room;
            WrappedCard hujia         = new WrappedCard(HujiaCard.ClassName)
            {
                Skill = Name
            };

            if (pattern == "Jink" && !player.HasFlag(string.Format("hujia_{0}", room.GetRoomState().GetCurrentResponseID())))
            {
                foreach (Player p in room.GetOtherPlayers(player))
                {
                    if (p.Kingdom == "wei" && ai.HasArmorEffect(p, EightDiagram.ClassName))
                    {
                        WrappedCard jink = new WrappedCard(Jink.ClassName)
                        {
                            Skill = Name, UserString = RoomLogic.CardToString(room, hujia)
                        };
                        return(new List <WrappedCard> {
                            jink
                        });
                    }
                }

                List <int> ids = player.GetCards("he");
                ids.AddRange(player.GetHandPile());
                int jink_count = 0;
                foreach (int id in ids)
                {
                    if (ai.IsCard(id, pattern, player))
                    {
                        jink_count++;
                    }
                }

                if (jink_count == 0)
                {
                    foreach (Player p in room.GetOtherPlayers(player))
                    {
                        if (ai.IsFriend(p) && p.Kingdom == "wei")
                        {
                            WrappedCard jink = new WrappedCard(Jink.ClassName)
                            {
                                Skill = Name, UserString = RoomLogic.CardToString(room, hujia)
                            };
                            return(new List <WrappedCard> {
                                jink
                            });
                        }
                    }
                }
            }
            return(result);
        }
Пример #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);
                }
            }
        }