Beispiel #1
0
        public override List <WrappedCard> GetViewAsCards(TrustedAI ai, string pattern, Player player)
        {
            Room               room    = ai.Room;
            Player             jiaozhu = ai.FindPlayerBySkill("hongfa");
            List <WrappedCard> result  = new List <WrappedCard>();

            if (jiaozhu != null && RoomLogic.WillBeFriendWith(room, player, jiaozhu) && pattern == Slash.ClassName)
            {
                foreach (int id in jiaozhu.GetPile("heavenly_army"))
                {
                    WrappedCard hongfa = new WrappedCard("HongfaCard")
                    {
                        Skill = "hongfa"
                    };
                    hongfa.AddSubCard(id);

                    WrappedCard slash = new WrappedCard(Slash.ClassName)
                    {
                        Skill = "hongfa"
                    };
                    slash.AddSubCard(id);
                    slash            = RoomLogic.ParseUseCard(room, slash);
                    slash.UserString = RoomLogic.CardToString(room, hongfa);
                    result.Add(slash);
                }
            }

            return(result);
        }
Beispiel #2
0
        public override List <WrappedCard> GetTurnUse(TrustedAI ai, Player player)
        {
            Room       room = ai.Room;
            List <int> ids  = player.GetCards("he");

            ids.AddRange(player.GetHandPile());

            foreach (int id in ids)
            {
                WrappedCard card = ai.Room.GetCard(id);
                if (WrappedCard.IsRed(card.Suit))
                {
                    WrappedCard slash = new WrappedCard(Slash.ClassName)
                    {
                        Skill     = Name,
                        ShowSkill = Name
                    };
                    slash.AddSubCard(card);
                    slash = RoomLogic.ParseUseCard(room, slash);
                    return(new List <WrappedCard> {
                        slash
                    });
                }
            }
            return(null);
        }
Beispiel #3
0
        public override bool TargetFilter(Room room, List <Player> targets, Player to_select, Player Self, WrappedCard card)
        {
            WrappedCard ba = new WrappedCard(card.UserString);

            ba.AddSubCard(card);
            ba = RoomLogic.ParseUseCard(room, ba);
            FunctionCard bcard = Engine.GetFunctionCard(card.UserString);

            return(bcard.TargetFilter(room, targets, to_select, Self, ba));
        }
        public virtual void OnCardAnnounce(Room room, CardUseStruct use, bool ignore_rule)
        {
            if (use.EffectCount == null)
            {
                use.EffectCount = new List <EffctCount>();
            }
            use.Card = RoomLogic.ParseUseCard(room, use.Card);
            room.ShowSkill(use.From, use.Card.ShowSkill, use.Card.SkillPosition);

            if (!ignore_rule)
            {
                CheckTargetModSkillShow(room, use);
            }

            WrappedCard use_card = use.Card;

            //将卡牌转化为延时锦囊就相当于改写了该牌的牌名,必须对其重写以保证此延时锦囊将来可以正确生效
            if (Engine.GetFunctionCard(use_card.Name) is DelayedTrick && RoomLogic.IsVirtualCard(room, use_card) && use_card.SubCards.Count == 1)
            {
                WrappedCard wrapped = room.GetCard(use_card.GetEffectiveId());
                wrapped.TakeOver(use_card);
                use.Card = wrapped;
            }

            //record big or small for fighttogether
            if (Engine.GetFunctionCard(use_card.Name) is FightTogether && use.To.Count > 0)
            {
                List <string> big_kingdoms = RoomLogic.GetBigKingdoms(room);
                if (big_kingdoms.Count > 0)
                {
                    string target_kingdom = (use.To[0].HasShownOneGeneral() ?
                                             (use.To[0].Role == "careerist" ? use.To[0].Name : use.To[0].Kingdom) : string.Empty);
                    bool big = big_kingdoms.Contains(target_kingdom);
                    if (big)
                    {
                        use.Pattern = "big";
                    }
                    else
                    {
                        use.Pattern = "small";
                    }
                }
                else
                {
                    use.Pattern = "unknown";
                }
            }

            OnUse(room, use);
        }
        public override List <WrappedCard> GetTurnUse(TrustedAI ai, Player player)
        {
            Room       room = ai.Room;
            List <int> ids  = player.GetCards("h");

            ids.AddRange(player.GetHandPile());
            List <int> spades = new List <int>();

            foreach (int id in ids)
            {
                if (room.GetCard(id).Suit == WrappedCard.CardSuit.Spade)
                {
                    spades.Add(id);
                }
            }

            List <WrappedCard> result = new List <WrappedCard>();

            if (spades.Count > 0)
            {
                ai.SortByUseValue(ref spades, false);
                WrappedCard card = new WrappedCard(GuishuCard.ClassName)
                {
                    Skill     = Name,
                    ShowSkill = Name
                };
                card.AddSubCard(spades[0]);

                if (player.GetMark(Name) == 0 || player.GetMark(Name) == 1)
                {
                    card.UserString = BefriendAttacking.ClassName;
                    WrappedCard ba = new WrappedCard(BefriendAttacking.ClassName)
                    {
                        Skill     = Name,
                        ShowSkill = Name,
                    };
                    ba.AddSubCard(card);
                    ba            = RoomLogic.ParseUseCard(room, ba);
                    ba.UserString = RoomLogic.CardToString(room, card);
                    result.Add(ba);
                }
                else if (spades.Count > 1)
                {
                    card.UserString = KnownBoth.ClassName;
                    result.Add(card);
                }
            }
            return(result);
        }
Beispiel #6
0
        public override List <WrappedCard> GetViewAsCards(TrustedAI ai, string pattern, Player player)
        {
            List <WrappedCard> cards = new List <WrappedCard>();

            if (pattern == Snatch.ClassName && player.GetPile("field").Count > 0)
            {
                foreach (int id in player.GetPile("field"))
                {
                    WrappedCard shun = new WrappedCard(Snatch.ClassName)
                    {
                        Skill     = Name,
                        ShowSkill = Name
                    };
                    shun.AddSubCard(id);
                    shun = RoomLogic.ParseUseCard(ai.Room, shun);
                    cards.Add(shun);
                }
            }

            return(cards);
        }
Beispiel #7
0
        public override WrappedCard ViewAs(TrustedAI ai, Player player, int id, bool current, Player.Place place)
        {
            Room        room = ai.Room;
            WrappedCard card = room.GetCard(id);

            if (card.HasFlag("using"))
            {
                return(null);
            }
            if (WrappedCard.IsRed(card.Suit))
            {
                WrappedCard slash = new WrappedCard(Slash.ClassName)
                {
                    Skill     = Name,
                    ShowSkill = Name
                };
                slash.AddSubCard(card);
                slash = RoomLogic.ParseUseCard(room, slash);
                return(slash);
            }

            return(null);
        }
        public override void Use(TrustedAI ai, Player player, ref CardUseStruct use, WrappedCard card)
        {
            if (player.GetMark("guishu") == 2)
            {
                WrappedCard kb = new WrappedCard(KnownBoth.ClassName)
                {
                    Skill     = Name,
                    ShowSkill = Name,
                };
                kb.AddSubCard(card);
                kb = RoomLogic.ParseUseCard(ai.Room, kb);

                UseCard e = Engine.GetCardUsage(KnownBoth.ClassName);
                if (e != null)
                {
                    CardUseStruct dummy = new CardUseStruct(null, player, new List <Player>())
                    {
                        IsDummy = true
                    };
                    e.Use(ai, player, ref dummy, kb);
                    if (dummy.Card == kb && dummy.To.Count > 0)
                    {
                        use.Card = card;
                        use.To   = dummy.To;
                        return;
                    }
                }

                Room          room    = ai.Room;
                List <Player> targets = ai.Exclude(room.GetOtherPlayers(player), kb);
                if (targets.Count > 0)
                {
                    use.Card = card;
                    use.To.Add(targets[0]);
                }
            }
        }
Beispiel #9
0
        public override WrappedCard Validate(Room room, CardUseStruct use)
        {
            Player      player = use.From;
            WrappedCard ba     = new WrappedCard(use.Card.UserString)
            {
                Skill         = "guishu",
                ShowSkill     = "guishu",
                SkillPosition = use.Card.SkillPosition
            };

            ba.AddSubCard(use.Card);
            ba = RoomLogic.ParseUseCard(room, ba);

            if (ba.Name == BefriendAttacking.ClassName)
            {
                player.SetMark("guishu", 2);
            }
            else
            {
                player.SetMark("guishu", 1);
            }

            return(ba);
        }
Beispiel #10
0
        public override List <WrappedCard> GetGuhuoCards(Room room, List <WrappedCard> cards, Player player)
        {
            List <WrappedCard> result = new List <WrappedCard>();

            if (cards.Count == 1)
            {
                foreach (FunctionCard fcard in room.AvailableFunctionCards)
                {
                    if (fcard.Name == BefriendAttacking.ClassName && (player.GetMark(Name) == 0 || player.GetMark(Name) == 1))
                    {
                        WrappedCard ba = new WrappedCard(BefriendAttacking.ClassName)
                        {
                            Skill     = Name,
                            ShowSkill = Name,
                        };
                        ba.AddSubCards(cards);
                        ba = RoomLogic.ParseUseCard(room, ba);
                        result.Add(ba);
                    }

                    if (fcard.Name == KnownBoth.ClassName && (player.GetMark(Name) == 0 || player.GetMark(Name) == 2))
                    {
                        WrappedCard kb = new WrappedCard(KnownBoth.ClassName)
                        {
                            Skill     = Name,
                            ShowSkill = Name,
                        };
                        kb.AddSubCards(cards);
                        kb = RoomLogic.ParseUseCard(room, kb);
                        result.Add(kb);
                    }
                }
            }

            return(result);
        }