public override bool Ingnore(Room room, Player player, int card_id)
        {
            Player lord = RoomLogic.FindPlayerBySkillName(room, Name);

            if (lord != null && player.Camp == lord.Camp && WrappedCard.IsBlack(room.GetCard(card_id).Suit))
            {
                return(true);
            }
            return(false);
        }
        public override TriggerStruct Triggerable(TriggerEvent triggerEvent, Room room, Player player, ref object data, Player ask_who)
        {
            Player luji = RoomLogic.FindPlayerBySkillName(room, Name);

            if (player.Phase == PlayerPhase.Draw && luji != null && luji.Camp == player.Camp)
            {
                return(new TriggerStruct(Name, luji));
            }

            return(new TriggerStruct());
        }
        public override bool IsProhibited(Room room, Player from, Player to, WrappedCard card, List <Player> others = null)
        {
            Player       lord  = RoomLogic.FindPlayerBySkillName(room, Name);
            FunctionCard fcard = Engine.GetFunctionCard(card.Name);

            if (!(fcard is SkillCard) && lord != null && to != null && from != null && from.Camp != to.Camp && lord.Camp == to.Camp)
            {
                foreach (Player p in room.GetOtherPlayers(to))
                {
                    if (p.Hp <= to.Hp && to.Camp == p.Camp)
                    {
                        return(false);
                    }
                }
                return(true);
            }
            return(false);
        }
示例#4
0
        public override List <int> OnExchange(TrustedAI ai, Player player, string pattern, int min, int max, string pile)
        {
            if (ai.WillShowForDefence())
            {
                Room room = ai.Room;
                //有君角在,不要用太平发动
                Player lord = RoomLogic.FindPlayerBySkillName(room, "wendao");

                List <int> ids = new List <int>();
                foreach (int id in player.HandCards)
                {
                    WrappedCard card = room.GetCard(id);
                    if (card.Name == PeaceSpell.ClassName && lord != null)
                    {
                        continue;
                    }
                    bool add = true;
                    foreach (int _id in player.GetPile("sorcery"))
                    {
                        if (room.GetCard(_id).Suit == card.Suit)
                        {
                            add = false;
                            break;
                        }
                    }
                    if (add)
                    {
                        ids.Add(id);
                    }
                }

                foreach (int id in player.GetEquips())
                {
                    WrappedCard card = room.GetCard(id);
                    if (card.Name == PeaceSpell.ClassName && lord != null)
                    {
                        continue;
                    }
                    bool add = true;
                    foreach (int _id in player.GetPile("sorcery"))
                    {
                        if (room.GetCard(_id).Suit == card.Suit)
                        {
                            add = false;
                            break;
                        }
                    }
                    if (add)
                    {
                        ids.Add(id);
                    }
                }

                if (ids.Count > 0)
                {
                    ai.SortByKeepValue(ref ids, false);
                    foreach (int id in ids)
                    {
                        double keep = ai.GetKeepValue(id, player);
                        double use  = ai.GetUseValue(id, player);
                        if (keep < 0 || (keep <= 5 && use <= 5))
                        {
                            return new List <int> {
                                       id
                            }
                        }
                        ;
                    }
                }
            }

            return(new List <int>());
        }