コード例 #1
0
 public P_HsiYooYangToow() : base(CardName, PCardType.TrafficCard)
 {
     Point = 4;
     Index = 58;
     foreach (PTime Time in new PTime[] {
         PTime.Card.LeaveAreaTime
     })
     {
         MoveInEquipTriggerList.Add((PPlayer Player, PCard Card) => {
             return(new PTrigger(CardName)
             {
                 IsLocked = true,
                 Player = Player,
                 Time = Time,
                 AIPriority = 50,
                 Condition = (PGame Game) => {
                     PMoveCardTag MoveCardTag = Game.TagManager.FindPeekTag <PMoveCardTag>(PMoveCardTag.TagName);
                     PPlayer SourceOwner = MoveCardTag.Source.Owner;
                     PPlayer DestinationOwner = MoveCardTag.Destination.Owner;
                     return Player.Equals(SourceOwner) && !MoveCardTag.Source.IsAmbushArea() && DestinationOwner != null && MoveCardTag.Destination.IsHandCardArea() && !Player.Age.Equals(DestinationOwner.Age);
                 },
                 Effect = (PGame Game ) => {
                     AnnouceUseEquipmentSkill(Player);
                     PMoveCardTag MoveCardTag = Game.TagManager.FindPeekTag <PMoveCardTag>(PMoveCardTag.TagName);
                     MoveCardTag.Destination = Game.CardManager.ThrownCardHeap;
                 }
             });
         });
     }
 }
コード例 #2
0
    public P_HuaMulan() : base("花木兰")
    {
        Sex   = PSex.Female;
        Age   = PAge.Renaissance;
        Index = 23;
        Cost  = 20;
        Tips  = "定位:爆发\n" +
                "难度:简单\n" +
                "史实:出自经典诗歌《木兰辞》。中国古代替父从军的女英雄。\n" +
                "攻略:\n花木兰是一名拥有不俗爆发能力的武将。【枭姬】的存在使得花木兰极度依赖装备牌,因此能够与唐寅、时迁等武将配合,同时也能够对这些武将形成强大的威慑力。【枭姬】往往能够提供绝地反杀的能力,或能使花木兰东山再起,因此在针对花木兰时必须注意其队伍的研究所或给牌武将,同时慎用【落凤弓】、【借刀杀人】等牌,从一定程度上来说提供了花木兰一定的防御力。【易装】是一个强大的爆发技能,不仅能与队友交换装备达成爆发,还能抢夺敌方的大量装备,形成局势逆转,因此可在一定程度上克制关羽。【易装】还可用来转换性别,从而使敌方的【百花裙】等装备失效。针对花木兰必须阻止其装备成形,因此吕蒙是一个不错的选择。";

        PSkill XiaoJi = new PSkill("枭姬")
        {
            SoftLockOpen = true
        };

        SkillList.Add(XiaoJi
                      .AddTrigger((PPlayer Player, PSkill Skill) => {
            return(new PTrigger(XiaoJi.Name)
            {
                IsLocked = false,
                Player = Player,
                Time = PTime.Card.LeaveAreaTime,
                AIPriority = 200,
                Condition = (PGame Game) => {
                    PMoveCardTag MoveCardTag = Game.TagManager.FindPeekTag <PMoveCardTag>(PMoveCardTag.TagName);
                    return Player.Area.EquipmentCardArea.Equals(MoveCardTag.Source) && !Player.Equals(MoveCardTag.Destination.Owner);
                },
                Effect = (PGame Game) => {
                    XiaoJi.AnnouceUseSkill(Player);
                    Game.GetCard(Player);
                    Game.GetMoney(Player, 1500);
                }
            });
        }));

        PPlayer YiZhuangTarget(PGame Game, PPlayer Player)
        {
            return(PMath.Max(Game.AlivePlayers(Player), (PPlayer TargetPlayer) => {
                int Profit = 0;
                PSex OriginalSex = Player.Sex;
                Player.Sex = PSex.Male;
                foreach (PCardType CardType in new PCardType[] {
                    PCardType.WeaponCard, PCardType.DefensorCard, PCardType.TrafficCard
                })
                {
                    PCard Card = Player.GetEquipment(CardType);
                    PCard TargetCard = TargetPlayer.GetEquipment(CardType);
                    if (Card != null)
                    {
                        Profit += 2000;
                        Profit -= Card.Model.AIInEquipExpectation(Game, Player);
                        Profit += Card.Model.AIInEquipExpectation(Game, TargetPlayer) * (Player.TeamIndex == TargetPlayer.TeamIndex ? 1 : -1);
                    }
                    if (TargetCard != null)
                    {
                        Profit += TargetCard.Model.AIInEquipExpectation(Game, Player);
                        Profit -= TargetCard.Model.AIInEquipExpectation(Game, TargetPlayer) * (Player.TeamIndex == TargetPlayer.TeamIndex ? 1 : -1);
                    }
                }
                Player.Sex = OriginalSex;
                return Profit - 7500;
            }, true).Key);
        }

        PSkill YiZhuang = new PSkill("易装")
        {
            Initiative = true
        };

        SkillList.Add(YiZhuang
                      .AnnounceGameOnce()
                      .AddTimeTrigger(
                          new PTime[] {
            PPeriod.FirstFreeTime.During,
            PPeriod.SecondFreeTime.During
        },
                          (PTime Time, PPlayer Player, PSkill Skill) => {
            return(new PTrigger(YiZhuang.Name)
            {
                IsLocked = false,
                Player = Player,
                Time = Time,
                AIPriority = 280,
                CanRepeat = true,
                Condition = (PGame Game) => {
                    return Player.Equals(Game.NowPlayer) && (Player.IsAI || Game.Logic.WaitingForEndFreeTime()) && Player.RemainLimit(YiZhuang.Name);
                },
                AICondition = (PGame Game) => {
                    if (Game.Teammates(Player).Exists((PPlayer _Player) => _Player.General is P_WuZhao))
                    {
                        PPlayer _Player = Game.PlayerList.Find((PPlayer __Player) => __Player.General is P_WuZhao);
                        if (_Player.RemainLimit("女权"))
                        {
                            return false;
                        }
                        else if (Player.Tags.ExistTag(P_WuZhao.NvQuanTag.Name))
                        {
                            return false;
                        }
                    }
                    return YiZhuangTarget(Game, Player) != null;
                },
                Effect = (PGame Game) => {
                    YiZhuang.AnnouceUseSkill(Player);
                    PPlayer Target = null;
                    if (Player.IsAI)
                    {
                        Target = YiZhuangTarget(Game, Player);
                    }
                    else
                    {
                        Target = PNetworkManager.NetworkServer.ChooseManager.AskForTargetPlayer(Player, PTrigger.Except(Player), YiZhuang.Name);
                    }
                    if (Target != null)
                    {
                        List <PCard> MulanEquipments = new List <PCard>();
                        foreach (PCard Card in Player.Area.EquipmentCardArea.CardList)
                        {
                            MulanEquipments.Add(Card);
                        }
                        List <PCard> TargetEquipements = new List <PCard>();
                        foreach (PCard Card in Target.Area.EquipmentCardArea.CardList)
                        {
                            TargetEquipements.Add(Card);
                        }
                        foreach (PCard Card in MulanEquipments)
                        {
                            Game.CardManager.MoveCard(Card, Player.Area.EquipmentCardArea, Game.CardManager.SettlingArea);
                        }
                        foreach (PCard Card in TargetEquipements)
                        {
                            Game.CardManager.MoveCard(Card, Target.Area.EquipmentCardArea, Game.CardManager.SettlingArea);
                        }
                        foreach (PCard Card in MulanEquipments)
                        {
                            Game.CardManager.MoveCard(Card, Game.CardManager.SettlingArea, Target.Area.EquipmentCardArea);
                        }
                        foreach (PCard Card in TargetEquipements)
                        {
                            Game.CardManager.MoveCard(Card, Game.CardManager.SettlingArea, Player.Area.EquipmentCardArea);
                        }
                        Player.Sex = PSex.Male;
                        Player.Tags.CreateTag(new PTag(YiZhuang.Name));
                        YiZhuang.DeclareUse(Player);
                    }
                }
            });
        }));
    }
コード例 #3
0
 public void MoveCard(PCard Card, PCardArea Source, PCardArea Destination)
 {
     PLogger.Log("[" + Card.Name + "]将要从[" + Source.Name + "]移动到[" + Destination.Name + "]");
     if (Source.CardList.Contains(Card))
     {
         PMoveCardTag MoveCardTag = Game.Monitor.CallTime(PTime.Card.LeaveAreaTime, new PMoveCardTag(Card, Source, Destination));
         MoveCardTag.Source.CardList.Remove(Card);
         if (MoveCardTag.Source.Owner != null)
         {
             if (MoveCardTag.Source.IsHandCardArea())
             {
                 PNetworkManager.NetworkServer.TellClient(MoveCardTag.Source.Owner, new PRefreshHandCardsOrder(MoveCardTag.Source.ToStringArray()));
                 PNetworkManager.NetworkServer.TellClients(new PRefreshHandCardNumberOrder(MoveCardTag.Source.Owner.Index.ToString(), MoveCardTag.Source.CardNumber.ToString()));
             }
             else if (MoveCardTag.Source.IsEquipmentArea())
             {
                 PNetworkManager.NetworkServer.TellClient(MoveCardTag.Source.Owner, new PRefreshEquipmentsOrder(MoveCardTag.Source.ToStringArray()));
                 PNetworkManager.NetworkServer.TellClients(new PRefreshEquipStringOrder(MoveCardTag.Source.Owner));
             }
             else if (MoveCardTag.Source.IsAmbushArea())
             {
                 PNetworkManager.NetworkServer.TellClient(MoveCardTag.Source.Owner, new PRefreshAmbushOrder(MoveCardTag.Source.ToStringArray()));
                 PNetworkManager.NetworkServer.TellClients(new PRefreshAmbushStringOrder(MoveCardTag.Source.Owner));
             }
         }
         if (MoveCardTag.Destination.IsEquipmentArea())
         {
             PCard CurrentCard = MoveCardTag.Destination.Owner.GetEquipment(Card.Type);
             if (CurrentCard != null)
             {
                 MoveCard(CurrentCard, MoveCardTag.Destination, ThrownCardHeap);
             }
         }
         if (!MoveCardTag.Destination.Equals(SettlingArea))
         {
             Card.Model = PObject.ListSubTypeInstances <PCardModel>().Find((PCardModel Model) => Model.Name.Equals(Card.Name));
         }
         Game.Monitor.CallTime(PTime.Card.EnterAreaTime, MoveCardTag);
         MoveCardTag.Destination.CardList.Add(Card);
         if (MoveCardTag.Destination.Owner != null)
         {
             if (MoveCardTag.Destination.IsHandCardArea())
             {
                 MoveCardTag.Destination.Arrange();
                 PNetworkManager.NetworkServer.TellClient(MoveCardTag.Destination.Owner, new PRefreshHandCardsOrder(MoveCardTag.Destination.ToStringArray()));
                 PNetworkManager.NetworkServer.TellClients(new PRefreshHandCardNumberOrder(MoveCardTag.Destination.Owner.Index.ToString(), MoveCardTag.Destination.CardNumber.ToString()));
             }
             else if (MoveCardTag.Destination.IsEquipmentArea())
             {
                 MoveCardTag.Destination.Arrange();
                 PNetworkManager.NetworkServer.TellClient(MoveCardTag.Destination.Owner, new PRefreshEquipmentsOrder(MoveCardTag.Destination.ToStringArray()));
                 PNetworkManager.NetworkServer.TellClients(new PRefreshEquipStringOrder(MoveCardTag.Destination.Owner));
             }
             else if (MoveCardTag.Destination.IsAmbushArea())
             {
                 PNetworkManager.NetworkServer.TellClient(MoveCardTag.Destination.Owner, new PRefreshAmbushOrder(MoveCardTag.Destination.ToStringArray()));
                 PNetworkManager.NetworkServer.TellClients(new PRefreshAmbushStringOrder(MoveCardTag.Destination.Owner));
             }
         }
     }
 }
コード例 #4
0
 public PCardTriggerInstaller() : base("卡牌移入移出区域")
 {
     TriggerList.Add(new PTrigger("游戏开始时摸牌")
     {
         IsLocked = true,
         Time     = PTime.StartGameTime,
         Effect   = (PGame Game) => {
             Game.PlayerList.ForEach((PPlayer Player) => {
                 Game.GetCard(Player, Config.StartGameCardCount);
                 int LuckyCardCount = 0;
                 while (LuckyCardCount < 3 && Player.IsUser && PNetworkManager.NetworkServer.ChooseManager.AskYesOrNo(Player, "是否使用手气卡?剩余次数=" + (3 - LuckyCardCount)))
                 {
                     Game.CardManager.ThrowAll(Player.Area);
                     LuckyCardCount++;
                     Game.GetCard(Player, Config.StartGameCardCount);
                 }
             });
         }
     });
     TriggerList.Add(new PTrigger("卡牌移入手牌装载触发器")
     {
         IsLocked  = true,
         Time      = PTime.Card.EnterAreaTime,
         Condition = (PGame Game) => {
             PMoveCardTag MoveTagFlag = Game.TagManager.FindPeekTag <PMoveCardTag>(PMoveCardTag.TagName);
             return(MoveTagFlag.Destination.IsHandCardArea());
         },
         Effect = (PGame Game) => {
             PMoveCardTag MoveTagFlag = Game.TagManager.FindPeekTag <PMoveCardTag>(PMoveCardTag.TagName);
             PPlayer Accepter         = MoveTagFlag.Destination.Owner;
             MoveTagFlag.Card.MoveInHandTriggerList = MoveTagFlag.Card.Model.MoveInHandTriggerList.ConvertAll((Func <PPlayer, PCard, PTrigger> Trigger) => Trigger(Accepter, MoveTagFlag.Card));
             MoveTagFlag.Card.MoveInHandTriggerList.ForEach((PTrigger Trigger) => {
                 Game.Monitor.AddTrigger(Trigger);
             });
         }
     });
     TriggerList.Add(new PTrigger("卡牌移出手牌摘下触发器")
     {
         IsLocked  = true,
         Time      = PTime.Card.LeaveAreaTime,
         Condition = (PGame Game) => {
             PMoveCardTag MoveTagFlag = Game.TagManager.FindPeekTag <PMoveCardTag>(PMoveCardTag.TagName);
             return(MoveTagFlag.Source.IsHandCardArea());
         },
         Effect = (PGame Game) => {
             PMoveCardTag MoveTagFlag = Game.TagManager.FindPeekTag <PMoveCardTag>(PMoveCardTag.TagName);
             PPlayer Giver            = MoveTagFlag.Source.Owner;
             MoveTagFlag.Card.MoveInHandTriggerList.ForEach((PTrigger Trigger) => {
                 Game.Monitor.RemoveTrigger(Trigger);
             });
         }
     });
     TriggerList.Add(new PTrigger("卡牌移入装备区装载触发器")
     {
         IsLocked  = true,
         Time      = PTime.Card.EnterAreaTime,
         Condition = (PGame Game) => {
             PMoveCardTag MoveTagFlag = Game.TagManager.FindPeekTag <PMoveCardTag>(PMoveCardTag.TagName);
             return(MoveTagFlag.Destination.IsEquipmentArea());
         },
         Effect = (PGame Game) => {
             PMoveCardTag MoveTagFlag = Game.TagManager.FindPeekTag <PMoveCardTag>(PMoveCardTag.TagName);
             PPlayer Accepter         = MoveTagFlag.Destination.Owner;
             MoveTagFlag.Card.MoveInEquipTriggerList = MoveTagFlag.Card.Model.MoveInEquipTriggerList.ConvertAll((Func <PPlayer, PCard, PTrigger> Trigger) => Trigger(Accepter, MoveTagFlag.Card));
             MoveTagFlag.Card.MoveInEquipTriggerList.ForEach((PTrigger Trigger) => {
                 Game.Monitor.AddTrigger(Trigger);
             });
         }
     });
     TriggerList.Add(new PTrigger("卡牌移出装备区摘下触发器")
     {
         IsLocked  = true,
         Time      = PTime.Card.LeaveAreaTime,
         Condition = (PGame Game) => {
             PMoveCardTag MoveTagFlag = Game.TagManager.FindPeekTag <PMoveCardTag>(PMoveCardTag.TagName);
             return(MoveTagFlag.Source.IsEquipmentArea());
         },
         Effect = (PGame Game) => {
             PMoveCardTag MoveTagFlag = Game.TagManager.FindPeekTag <PMoveCardTag>(PMoveCardTag.TagName);
             PPlayer Giver            = MoveTagFlag.Source.Owner;
             MoveTagFlag.Card.MoveInEquipTriggerList.ForEach((PTrigger Trigger) => {
                 Game.Monitor.RemoveTrigger(Trigger);
             });
         }
     });
     TriggerList.Add(new PTrigger("通知客户端卡牌指定目标")
     {
         IsLocked = true,
         Time     = PTime.Card.AfterEmitTargetTime,
         Effect   = (PGame Game) => {
             PUseCardTag UseCardTag    = Game.TagManager.FindPeekTag <PUseCardTag>(PUseCardTag.TagName);
             PPlayer User              = UseCardTag.User;
             PCard Card                = UseCardTag.Card;
             List <PPlayer> TargetList = UseCardTag.TargetList;
             if (User != null && Card != null && TargetList != null && !TargetList.Contains(null))
             {
                 PNetworkManager.NetworkServer.TellClients(new PPushTextOrder(User.Index.ToString(), Card.Model.Name, PPushType.Information.Name));
                 if (Card.Name.Equals(Card.Model.Name))
                 {
                     PNetworkManager.NetworkServer.TellClients(new PShowInformationOrder(User.Name + "使用了" + Card.Name));
                 }
                 else
                 {
                     PNetworkManager.NetworkServer.TellClients(new PShowInformationOrder(User.Name + "把" + Card.Name + "当做" + Card.Model.Name + "使用"));
                 }
                 PNetworkManager.NetworkServer.TellClients(new PShowInformationOrder("目标:" + string.Join(",", TargetList.ConvertAll((PPlayer Player) => Player.Name))));
             }
         }
     });
 }