예제 #1
0
        //服务器操作响应
        public override void Activate(ref CardUseStruct card_use)
        {
            UpdatePlayers();
            to_use = GetTurnUse();

            to_use.Sort((x, y) => { return(GetDynamicUsePriority(x) > GetDynamicUsePriority(y) ? -1 : 1); });

            foreach (CardUseStruct use in to_use)
            {
                WrappedCard card = use.Card;
                if (!RoomLogic.IsCardLimited(room, self, card, HandlingMethod.MethodUse) ||
                    (card.CanRecast && !RoomLogic.IsCardLimited(room, self, card, HandlingMethod.MethodRecast)))
                {
                    string  class_name = card.Name.Contains(Slash.ClassName) ? Slash.ClassName : card.Name;
                    UseCard _use       = Engine.GetCardUsage(class_name);
                    if (_use != null)
                    {
                        _use.Use(this, self, ref card_use, card);
                        if (card_use.Card != null)
                        {
                            to_use.Clear();
                            return;
                        }
                    }
                }
            }

            to_use.Clear();
        }
        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]);
                }
            }
        }