Пример #1
0
 private List <PPlayer> AIEmitTargets(PGame Game, PPlayer Player)
 {
     return(new List <PPlayer> {
         PAiTargetChooser.InjureTarget(Game, Player, Player, (PGame _Game, PPlayer _Player) => {
             PChiaTaoFaKuoTag ChiaTaoFaKuoTag = _Game.TagManager.FindPeekTag <PChiaTaoFaKuoTag>(PChiaTaoFaKuoTag.TagName);
             return ChiaTaoFaKuoTag.LordList.Contains(_Player) && Player.TeamIndex != _Player.TeamIndex;
         }, 1000, Instantiate())
     });
 }
Пример #2
0
 private KeyValuePair <PCard, int> TeammateValueCard(PGame Game, PPlayer Player, PPlayer _Player)
 {
     return(PMath.Max(Player.Area.HandCardArea.CardList.FindAll((PCard Card) => Card.Type.IsEquipment()), (PCard Card) => {
         int New = Card.Model.AIInEquipExpectation(Game, _Player);
         PCard CurrentEquip = _Player.GetEquipment(Card.Type);
         int Current = CurrentEquip == null ? 0 : CurrentEquip.Model.AIInEquipExpectation(Game, _Player);
         int Delta = (_Player.Area.EquipmentCardArea.CardNumber + (CurrentEquip == null ? 1 : 0)) * 500;
         return New - Current + PAiTargetChooser.InjureExpect(Game, Player, Player, _Player, Delta, Instantiate())
         + Math.Max(0, PAiCardExpectation.FindMostValuableToGet(Game, Player, _Player).Value);
     }));
 }
Пример #3
0
    private List <PPlayer> AIEmitTargets(PGame Game, PPlayer Player)
    {
        PInjureTag InjureTag = Game.TagManager.FindPeekTag <PInjureTag>(PInjureTag.TagName);
        PPlayer    Target    = PAiTargetChooser.InjureTarget(Game, InjureTag.FromPlayer, Player, (PGame _Game, PPlayer _Player) => {
            return(_Player.IsAlive && !_Player.Equals(Player) && !_Player.Equals(InjureTag.FromPlayer));
        }, InjureTag.Injure, InjureTag.InjureSource);

        return(new List <PPlayer>()
        {
            Target
        });
    }
Пример #4
0
    public List <PPlayer> AIEmitTargets(PGame Game, PPlayer Player)
    {
        int ExpectedMoney = 700;

        if (Player.General is P_LiuJi)
        {
            ExpectedMoney = 1200;
        }
        PPlayer Target = PAiTargetChooser.InjureTarget(Game, Player, Player, PTrigger.Except(Player), ExpectedMoney, Instantiate());

        return(new List <PPlayer>()
        {
            Target
        });
    }
Пример #5
0
 public P_HunShuiMoYoo() : base(CardName)
 {
     Point = 4;
     Index = 20;
     foreach (PTime Time in new PTime[] {
         PTime.Card.EndSettleTime
     })
     {
         MoveInHandTriggerList.Add((PPlayer Player, PCard Card) => {
             return(new PTrigger(CardName)
             {
                 IsLocked = false,
                 Player = Player,
                 Time = Time,
                 AIPriority = 100,
                 Condition = (PGame Game) => {
                     PUseCardTag UseCardTag = Game.TagManager.FindPeekTag <PUseCardTag>(PUseCardTag.TagName);
                     return UseCardTag.TargetList.Count >= 2;
                 },
                 AICondition = (PGame Game) => {
                     if (Player.General is P_WuZhao && Player.RemainLimit(PSkillInfo.女权.Name))
                     {
                         return false;
                     }
                     int Value = 0;
                     PUseCardTag UseCardTag = Game.TagManager.FindPeekTag <PUseCardTag>(PUseCardTag.TagName);
                     UseCardTag.TargetList.ForEach((PPlayer _Player) => {
                         if (_Player.CanBeInjured && !(_Player.Defensor != null && _Player.Defensor.Model is P_YooHsi))
                         {
                             Value += PAiTargetChooser.InjureExpect(Game, Player, Player, _Player, 500, Card);
                         }
                     });
                     return Value >= 1000 && !Player.OutOfGame && P_PanYue.XianJuTest(Game, Player);
                 },
                 Effect = MakeNormalEffect(Player, Card, AIEmitTargets, AIEmitTargets,
                                           (PGame Game, PPlayer User, PPlayer Target) => {
                     Game.Injure(User, Target, 500, Card);
                 })
             });
         });
     }
 }
Пример #6
0
 public P_YinYooehChiiang() : base(CardName, PCardType.WeaponCard)
 {
     Point = 3;
     Index = 45;
     foreach (PTime Time in new PTime[] {
         PTime.Card.EndSettleTime
     })
     {
         MoveInEquipTriggerList.Add((PPlayer Player, PCard Card) => {
             return(new PTrigger(CardName)
             {
                 IsLocked = false,
                 Player = Player,
                 Time = Time,
                 Condition = (PGame Game) => {
                     PUseCardTag UseCardTag = Game.TagManager.FindPeekTag <PUseCardTag>(PUseCardTag.TagName);
                     return !Game.NowPlayer.Equals(Player) && UseCardTag.User.Equals(Player);
                 },
                 Effect = (PGame Game) => {
                     AnnouceUseEquipmentSkill(Player);
                     PPlayer TargetPlayer = null;
                     if (Player.IsAI)
                     {
                         TargetPlayer = PAiTargetChooser.InjureTarget(Game, Player, Player, PTrigger.Except(Player), 1000, Card);
                     }
                     else
                     {
                         TargetPlayer = PNetworkManager.NetworkServer.ChooseManager.AskForTargetPlayer(Player, PTrigger.Except(Player), CardName);
                     }
                     if (TargetPlayer != null)
                     {
                         Game.Injure(Player, TargetPlayer, 1000, Card);
                     }
                 }
             });
         });
     }
 }
Пример #7
0
 public P_KuanMevnChoTsev() : base(CardName)
 {
     Point = 4;
     Index = 22;
     foreach (PTime Time in new PTime[] {
         PPeriod.FirstFreeTime.During,
         PPeriod.SecondFreeTime.During
     })
     {
         MoveInHandTriggerList.Add((PPlayer Player, PCard Card) => {
             return(new PTrigger(CardName)
             {
                 IsLocked = false,
                 Player = Player,
                 Time = Time,
                 AIPriority = 80,
                 Condition = (PGame Game) => {
                     return Player.Equals(Game.NowPlayer) && (Player.IsAI || Game.Logic.WaitingForEndFreeTime()) && AIEmitTargets(Game, Player).Count > 0;
                 },
                 AICondition = (PGame Game) => {
                     if (Player.General is P_WuZhao && Player.RemainLimit(PSkillInfo.女权.Name))
                     {
                         return false;
                     }
                     List <PPlayer> Targets = AIEmitTargets(Game, Player);
                     bool MultiTarget = Targets.Count > 1;
                     Targets = Targets.FindAll((PPlayer _Player) => !(_Player.HasEquipment <P_YooHsi>() && MultiTarget));
                     return PMath.Sum(Targets.ConvertAll((PPlayer Target) => (double)PAiTargetChooser.InjureExpect(Game, Player, Player, Target, 1000, Card))) >= 2000 &&
                     P_PanYue.XianJuTest(Game, Player);
                 },
                 Effect = MakeNormalEffect(Player, Card, AIEmitTargets, AIEmitTargets,
                                           (PGame Game, PPlayer User, PPlayer Target) => {
                     Game.Injure(User, Target, 1000, Card);
                 })
             });
         });
     }
 }
Пример #8
0
    public P_YuJi() : base("虞姬")
    {
        Sex   = PSex.Female;
        Age   = PAge.Classic;
        Index = 13;
        Cost  = 15;
        Tips  = "定位:攻击\n" +
                "难度:简单\n" +
                "史实:楚汉相争时期,西楚霸王项羽的美人,项羽曾为其作《垓下歌》。\n" +
                "攻略:\n虞姬是一个依赖于手牌的武将,所以研究所是她和她的队友的优先选择。对于虞姬而言,如何较为准确地衡量手牌的价值是一个比较困难的问题。对于两张点数不同的牌,两张牌自身的价值有高有低,两张牌用来【剑舞】的价值也有高有低,使用什么牌来【剑舞】,是虞姬玩家水平分别的体现。\n" +
                "通常,虞姬玩家可以弃掉自己不需要的装备、伏兵和难以发挥积极作用的【擒贼擒王】、【假痴不癫】、【空城计】等牌发动【剑舞】。虞姬玩家也可以在手上存留很多牌,当与敌人近身接触时,把所有牌都用来【剑舞】,造成巨大的输出,以求直接杀死对手。";

        PSkill JianWu = new PSkill("剑舞")
        {
            Initiative = true
        };

        KeyValuePair <PCard, int> JianWuTest(PGame Game, PPlayer Player)
        {
            KeyValuePair <PCard, int> Answer = new KeyValuePair <PCard, int>(null, 0);

            for (int i = 1; i <= 6; ++i)
            {
                int Expect = (int)PMath.Sum(Game.AlivePlayers().FindAll((PPlayer _Player) => {
                    return(!_Player.Equals(Player) && _Player.Distance(Player) <= i);
                }).ConvertAll((PPlayer _Player) => {
                    return((double)PAiTargetChooser.InjureExpect(Game, Player, Player, _Player, 800, JianWu));
                }));
                KeyValuePair <PCard, int> Test = PMath.Max(Player.Area.HandCardArea.CardList.FindAll((PCard Card) => Card.Point == i), (PCard Card) => {
                    return(Expect - Card.Model.AIInHandExpectation(Game, Player));
                }, true);
                if (Test.Value > Answer.Value)
                {
                    Answer = Test;
                }
            }
            return(Answer);
        }

        SkillList.Add(JianWu
                      .AddTimeTrigger(
                          new PTime[] {
            PPeriod.FirstFreeTime.During,
            PPeriod.SecondFreeTime.During
        },
                          (PTime Time, PPlayer Player, PSkill Skill) => {
            return(new PTrigger(JianWu.Name)
            {
                IsLocked = false,
                Player = Player,
                Time = Time,
                AIPriority = 190,
                CanRepeat = true,
                Condition = (PGame Game) => {
                    return Player.Equals(Game.NowPlayer) && (Player.IsAI || Game.Logic.WaitingForEndFreeTime()) && Player.Area.HandCardArea.CardNumber > 0;
                },
                AICondition = (PGame Game) => {
                    return JianWuTest(Game, Player).Key != null;
                },
                Effect = (PGame Game) => {
                    JianWu.AnnouceUseSkill(Player);
                    PCard TargetCard = null;
                    if (Player.IsAI)
                    {
                        TargetCard = JianWuTest(Game, Player).Key;
                        PNetworkManager.NetworkServer.TellClients(new PShowInformationOrder(Player.Name + "弃置了" + Player.Name + "的" + TargetCard.Name));
                        Game.CardManager.MoveCard(TargetCard, Player.Area.HandCardArea, Game.CardManager.ThrownCardHeap);
                    }
                    else
                    {
                        TargetCard = Game.ThrowCard(Player, Player, true, false);
                    }
                    if (TargetCard != null)
                    {
                        Game.Traverse((PPlayer _Player) => {
                            if (!_Player.Equals(Player) && _Player.Distance(Player) <= TargetCard.Point)
                            {
                                Game.Injure(Player, _Player, 800, JianWu);
                            }
                        }, Player);
                    }
                }
            });
        }));
    }
Пример #9
0
    public P_IzayoiMiku() : base("诱宵美九")
    {
        Sex   = PSex.Female;
        Age   = PAge.Industrial;
        Index = 28;
        Cost  = 50;
        Tips  = "定位:攻击\n" +
                "难度:简单\n" +
                "史实:轻小说《约会大作战》中女主角。龙胆寺女子学院学生,歌手,偶像。\n" +
                "攻略:\n【独奏】可以压制住全部的防御牌,既不能被闪避也不能被减伤,还无法通过【借尸还魂】、【走为上计】自救,一定程度上使得项羽、廉颇、屈原一类的自伤角色不敢铤而走险。贞德的【圣女】能够对【独奏】形成一定程度的克制。如果美九有【古锭刀】,则每一次过路费都触发【古锭刀】技能的效果,从而成为很强的火力点。新版美九的【独奏】无法触发花木兰的【枭姬】,但花木兰仍可以通过【易装】给她【古锭刀】来形成配合。\n美九的团队通常需要建一座城堡来发动【轮舞曲】。如果在未来大概率拿不到新的商业用地的情况下,即使是3级城堡,在【轮舞曲】之后也相当于免费升了2级的购物中心。";

        NewGeneral = true;

        PSkill Solo = new PSkill("独奏");

        SkillList.Add(Solo
                      .AddTrigger(
                          (PPlayer Player, PSkill Skill) => {
            return(new PTrigger(Solo.Name)
            {
                IsLocked = false,
                Player = Player,
                Time = PTime.Injure.BeforeEmitInjure,
                AIPriority = 200,
                Condition = (PGame Game) => {
                    PInjureTag InjureTag = Game.TagManager.FindPeekTag <PInjureTag>(PInjureTag.TagName);
                    return Player.Equals(InjureTag.FromPlayer) && InjureTag.Injure > 0 && InjureTag.ToPlayer != null && InjureTag.ToPlayer.Area.OwnerCardNumber > 0;
                },
                AICondition = (PGame Game) => {
                    PInjureTag InjureTag = Game.TagManager.FindPeekTag <PInjureTag>(PInjureTag.TagName);
                    PPlayer ToPlayer = InjureTag.ToPlayer;
                    return ToPlayer.TeamIndex != Player.TeamIndex || (ToPlayer.General is P_Gabriel);
                },
                Effect = (PGame Game) => {
                    PInjureTag InjureTag = Game.TagManager.FindPeekTag <PInjureTag>(PInjureTag.TagName);
                    PPlayerCardArea ToPlayerArea = InjureTag.ToPlayer.Area;
                    Solo.AnnouceUseSkill(Player);
                    Game.CardManager.MoveAll(ToPlayerArea.HandCardArea, ToPlayerArea.OutOfGameArea);
                    // Game.CardManager.MoveAll(ToPlayerArea.EquipmentCardArea, ToPlayerArea.OutOfGameArea);
                    Player.Tags.CreateTag(new PSoloTag());
                }
            });
        })
                      .AddTrigger(
                          (PPlayer Player, PSkill Skill) => {
            return(new PTrigger(Solo.Name)
            {
                IsLocked = true,
                Player = Player,
                Time = PTime.Injure.EndSettle,
                AIPriority = 200,
                Condition = (PGame Game) => {
                    PInjureTag InjureTag = Game.TagManager.FindPeekTag <PInjureTag>(PInjureTag.TagName);
                    return Player.Equals(InjureTag.FromPlayer) && InjureTag.Injure > 0 && InjureTag.ToPlayer != null && Player.Tags.ExistTag(PSoloTag.TagName);
                },
                Effect = (PGame Game) => {
                    Solo.AnnouceUseSkill(Player);
                    PInjureTag InjureTag = Game.TagManager.FindPeekTag <PInjureTag>(PInjureTag.TagName);
                    PPlayer ToPlayer = InjureTag.ToPlayer;
                    Player.Tags.PopTag <PSoloTag>(PSoloTag.TagName);
                    if (ToPlayer.IsAlive)
                    {
                        Game.CardManager.MoveAll(ToPlayer.Area.OutOfGameArea, ToPlayer.Area.HandCardArea);
                    }
                    else
                    {
                        Game.CardManager.MoveAll(ToPlayer.Area.OutOfGameArea, Player.Area.HandCardArea);
                        PPlayer ExtraTarget = null;
                        int ExtraInjure = PMath.Percent(InjureTag.Injure, 50);
                        if (Player.IsAI)
                        {
                            ExtraTarget = PAiTargetChooser.InjureTarget(Game, Player, Player, PTrigger.Except(Player), ExtraInjure, Solo);
                        }
                        else
                        {
                            ExtraTarget = PNetworkManager.NetworkServer.ChooseManager.AskForTargetPlayer(Player, PTrigger.Except(Player), Solo.Name + "[造成" + ExtraInjure.ToString() + "点伤害]", true);
                        }
                        if (ExtraTarget != null)
                        {
                            Game.Injure(Player, ExtraTarget, ExtraInjure, Solo);
                        }
                    }
                }
            });
        }));

        PSkill Rando = new PSkill("轮舞曲")
        {
            Initiative = true
        };

        SkillList.Add(Rando
                      .AnnounceGameOnce()
                      .AddTimeTrigger(
                          new PTime[] {
            PPeriod.FirstFreeTime.During,
            PPeriod.SecondFreeTime.During
        },
                          (PTime Time, PPlayer Player, PSkill Skill) => {
            return(new PTrigger(Rando.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(Rando.Name) &&
                    Game.Map.BlockList.Exists((PBlock Block) => Block.Lord != null && Block.IsBusinessLand);
                },
                AICondition = (PGame Game) => {
                    PBlock MaxHouseBlock = PMath.Max(Game.Map.BlockList.FindAll((PBlock Block) => Block.Lord != null && Block.IsBusinessLand && Block.Lord.TeamIndex == Player.TeamIndex && !Block.BusinessType.Equals(PBusinessType.ShoppingCenter)), (PBlock Block) => Block.HouseNumber, true).Key;
                    if (MaxHouseBlock == null)
                    {
                        return false;
                    }
                    int ClubBonus = PMath.Percent(MaxHouseBlock.Price, 40) * Game.Enemies(Player).Count *MaxHouseBlock.HouseNumber;
                    if (MaxHouseBlock.BusinessType.Equals(PBusinessType.Institute))
                    {
                        ClubBonus -= 4000 * Game.Teammates(Player).Count;
                    }
                    int TeammateCardBonus = -2000 * PMath.Sum(Game.Teammates(Player, false).ConvertAll((PPlayer _Player) => Math.Min(2, _Player.Area.HandCardArea.CardNumber)));
                    int EnemyCardBonus = 2000 * PMath.Sum(Game.Enemies(Player).ConvertAll((PPlayer _Player) => Math.Min(2, _Player.Area.HandCardArea.CardNumber)));
                    int SumBonus = ClubBonus + TeammateCardBonus + EnemyCardBonus;
                    return SumBonus >= 8000 * (1 + Game.Map.BlockList.FindAll((PBlock _Block) => _Block.IsBusinessLand && _Block.Lord == null).Count);
                },
                Effect = (PGame Game) => {
                    Rando.AnnouceUseSkill(Player);
                    Game.Traverse((PPlayer _Player) => {
                        if (_Player != Player)
                        {
                            for (int i = 0; i < 2; ++i)
                            {
                                if (_Player.Area.HandCardArea.CardNumber > 0)
                                {
                                    Game.ThrowCard(_Player, _Player, true, false, false);
                                }
                            }
                        }
                    }, Player);
                    PBlock Target = null;
                    if (Player.IsAI)
                    {
                        PBlock MaxHouseBlock = PMath.Max(Game.Map.BlockList.FindAll((PBlock Block) => Block.Lord != null && Block.IsBusinessLand && Block.Lord.TeamIndex == Player.TeamIndex && !Block.BusinessType.Equals(PBusinessType.ShoppingCenter)), (PBlock Block) => Block.HouseNumber, true).Key;
                        Target = MaxHouseBlock;
                    }
                    else
                    {
                        Target = PNetworkManager.NetworkServer.ChooseManager.AskToChooseBlock(Player, Rando.Name + "-选择一处商业用地", (PBlock Block) => Block.IsBusinessLand && Block.Lord != null);
                    }
                    Target.BusinessType = PBusinessType.Club;
                    PNetworkManager.NetworkServer.TellClients(new PRefreshBlockBasicOrder(Target));
                    Rando.DeclareUse(Player);
                }
            });
        }));
    }
Пример #10
0
    public P_HuaXiong() : base("华雄")
    {
        Sex   = PSex.Male;
        Age   = PAge.Medieval;
        Index = 10;
        Cost  = 20;
        Tips  = "定位:辅助\n" +
                "难度:中等\n" +
                "史实:汉末董卓帐下都督,在《三国演义》中,华雄是一员猛将,曾击败孙坚,斩杀祖茂、俞涉、潘凤。\n" +
                "攻略:\n" +
                "1.华雄的资本是初始比其他人多出的15000资金,这让华雄成为了前期被擒贼擒王围堵的对象,降低了华雄的预期土地水平。因此耀武的实际收益小于15000。\n" +
                "2.耀武的收益是一次性的。和持续性收益的武将相比,节奏越快的战斗,华雄的优势越大。加快游戏节奏的诸葛连弩、草木皆兵,甚至闪电,都可以帮助扩大华雄的相对收益。\n" +
                "3.叫阵是一个期望收益为负的技能,除非有希望斩杀或者有不需要的装备,不应该随意发动叫阵。\n" +
                "4.叫阵是一个直击技能。如果存储一些装备牌,就可以在敌人现金较少的时候连续叫阵实现斩杀。因此,手牌数多的华雄可以限制敌人将现金转化成房屋等其他战斗资源的决策。\n" +
                "5.在团队里华雄主要充当一个奶妈角色,用其天然的高现金数,让队友收取过路费。同时华雄凭借叫阵也能承担一个直击斩杀手的功能。\n" +
                "6.到游戏后期,因为耀武的均回合收益已经下降到很低,华雄能为团队做出的贡献很少。";

        PSkill YaoWu = new PSkill("耀武")
        {
            Lock = true
        };

        SkillList.Add(YaoWu
                      .AddTrigger(
                          (PPlayer Player, PSkill Skill) => {
            return(new PTrigger(YaoWu.Name)
            {
                IsLocked = true,
                Player = Player,
                Time = PTime.StartGameTime,
                AIPriority = 100,
                Effect = (PGame Game) => {
                    YaoWu.AnnouceUseSkill(Player);
                    Player.Money = PMath.Percent(Player.Money, 150);
                    PNetworkManager.NetworkServer.TellClients(new PRefreshMoneyOrder(Player));
                }
            });
        }));

        PSkill JiaoZhen = new PSkill("叫阵")
        {
            Initiative = true
        };

        SkillList.Add(JiaoZhen
                      .AddTimeTrigger(
                          new PTime[] {
            PPeriod.FirstFreeTime.During,
            PPeriod.SecondFreeTime.During
        },
                          (PTime Time, PPlayer Player, PSkill Skill) => {
            return(new PTrigger(JiaoZhen.Name)
            {
                IsLocked = false,
                Player = Player,
                Time = Time,
                AIPriority = 200,
                CanRepeat = true,
                Condition = (PGame Game) => {
                    return Player.Equals(Game.NowPlayer) && (Player.IsAI || Game.Logic.WaitingForEndFreeTime()) && Player.Area.EquipmentCardArea.CardNumber > 0;
                },
                AICondition = (PGame Game) => {
                    if (PAiTargetChooser.InjureTarget(Game, Player, Player, (PGame _Game, PPlayer _Player) => {
                        return _Player.IsAlive && !_Player.Equals(Player) && !(_Player.General is P_LiuJi);
                    }, 1000, JiaoZhen) == null || Player.Money <= 2000)
                    {
                        return false;
                    }
                    if (Game.Enemies(Player).Exists((PPlayer _Player) => _Player.Money <= 2000))
                    {
                        return true;
                    }
                    foreach (PCardType CardType in new PCardType[] {
                        PCardType.WeaponCard, PCardType.DefensorCard, PCardType.TrafficCard
                    })
                    {
                        KeyValuePair <PCard, int> MaxCard = PMath.Max(
                            Player.Area.HandCardArea.CardList.FindAll((PCard _Card) =>
                                                                      _Card.Type.Equals(CardType)),
                            (PCard _Card) => _Card.Model.AIInEquipExpectation(Game, Player));
                        PCard CurrentCard = Player.GetEquipment(CardType);
                        if (CurrentCard != null)
                        {
                            int Expect = CurrentCard.Model.AIInEquipExpectation(Game, Player);
                            if (MaxCard.Value > Expect)
                            {
                                return true;
                            }
                            if (Expect <= 1000)
                            {
                                return true;
                            }
                        }
                    }
                    return false;
                },
                Effect = (PGame Game) => {
                    JiaoZhen.AnnouceUseSkill(Player);
                    PPlayer Target = null;
                    if (Player.IsAI)
                    {
                        Target = PAiTargetChooser.InjureTarget(Game, Player, Player, (PGame _Game, PPlayer _Player) => {
                            return _Player.IsAlive && !_Player.Equals(Player) && !(_Player.General is P_LiuJi);
                        }, 1000, JiaoZhen);
                    }
                    else
                    {
                        Target = PNetworkManager.NetworkServer.ChooseManager.AskForTargetPlayer(Player, PTrigger.Except(Player), JiaoZhen.Name, true);
                    }
                    if (Target != null)
                    {
                        if (Game.PkPoint(Player, Target) > 0)
                        {
                            Game.Injure(Player, Target, 1000, JiaoZhen);
                        }
                        else
                        {
                            Game.ThrowCard(Player, Player, false);
                            Game.LoseMoney(Player, 1000);
                        }
                    }
                }
            });
        }));
    }
Пример #11
0
 public P_ShevngTungChiHsi() : base(CardName)
 {
     Point = 1;
     Index = 6;
     foreach (PTime Time in new PTime[] {
         PTime.Card.AfterEmitTargetTime
     })
     {
         MoveInHandTriggerList.Add((PPlayer Player, PCard Card) => {
             return(new PTrigger(CardName)
             {
                 IsLocked = false,
                 Player = Player,
                 Time = Time,
                 AIPriority = 100,
                 Condition = (PGame Game) => {
                     PUseCardTag UseCardTag = Game.TagManager.FindPeekTag <PUseCardTag>(PUseCardTag.TagName);
                     return UseCardTag.TargetList.Count == 1 && UseCardTag.Card.Type.Equals(PCardType.SchemeCard) && !UseCardTag.Card.Name.Equals(P_ChinChaanToowChiiao.CardName);
                 },
                 AICondition = (PGame Game) => {
                     PUseCardTag UseCardTag = Game.TagManager.FindPeekTag <PUseCardTag>(PUseCardTag.TagName);
                     if (UseCardTag.Card.Model.Name.Equals(P_ManTiienKuoHai.CardName) ||
                         UseCardTag.Card.Model.Name.Equals(P_WeiWeiChiuChao.CardName) ||
                         UseCardTag.Card.Model.Name.Equals(P_CheevnHuoTaChieh.CardName) ||
                         UseCardTag.Card.Model.Name.Equals(P_LiTaiTaaoChiang.CardName) ||
                         UseCardTag.Card.Model.Name.Equals(P_ShunShouChiienYang.CardName) ||
                         UseCardTag.Card.Model.Name.Equals(P_TaTsaaoChingShev.CardName) ||
                         UseCardTag.Card.Model.Name.Equals(P_KuanMevnChoTsev.CardName) ||
                         UseCardTag.Card.Model.Name.Equals(P_ChihSangMaHuai.CardName) ||
                         UseCardTag.Card.Model.Name.Equals(P_FanChienChi.CardName) ||
                         UseCardTag.Card.Model.Name.Equals(P_ChiehTaoShaJevn.CardName) ||
                         UseCardTag.Card.Model.Name.Equals(P_PaaoChuanYinYoo.CardName) ||
                         UseCardTag.Card.Model.Name.Equals(P_ChiaTaoFaKuo.CardName))
                     {
                         return UseCardTag.TargetList[0].TeamIndex == Player.TeamIndex && UseCardTag.User.TeamIndex != Player.TeamIndex;
                     }
                     else if (UseCardTag.Card.Name.Equals(P_WuChungShevngYou.CardName) ||
                              UseCardTag.Card.Model.Name.Equals(P_AnTuCheevnTsaang.CardName) ||
                              UseCardTag.Card.Model.Name.Equals(P_ChiehShihHuanHun.CardName) ||
                              UseCardTag.Card.Model.Name.Equals(P_YooenChiaoChinKung.CardName) ||
                              UseCardTag.Card.Model.Name.Equals(P_TsouWeiShangChi.CardName))
                     {
                         return UseCardTag.TargetList[0].TeamIndex != Player.TeamIndex;
                     }
                     else if (UseCardTag.Card.Model.Name.Equals(P_YooChiinKuTsung.CardName))
                     {
                         return UseCardTag.TargetList[0].TeamIndex == Player.TeamIndex && Game.TagManager.FindPeekTag <PInjureTag>(PInjureTag.TagName).Injure <= 3000;
                     }
                     else if (UseCardTag.Card.Model.Name.Equals(P_ChiinTsevChiinWang.CardName))
                     {
                         return UseCardTag.User.TeamIndex != Player.TeamIndex && PMath.Max(Game.PlayerList, (PPlayer _Player) => {
                             if (Player.TeamIndex == _Player.TeamIndex)
                             {
                                 return PAiMapAnalyzer.ChangeFaceExpect(Game, _Player);
                             }
                             else
                             {
                                 return -PAiMapAnalyzer.ChangeFaceExpect(Game, _Player);
                             }
                         }).Value - PAiMapAnalyzer.ChangeFaceExpect(Game, UseCardTag.TargetList[0]) * (UseCardTag.TargetList[0].TeamIndex == Player.TeamIndex ? 1 : -1) >= 3000;
                     }
                     else if (UseCardTag.Card.Model.Name.Equals(P_ShangWuChoouTii.CardName))
                     {
                         int NowValue = PAiMapAnalyzer.Expect(Game, UseCardTag.TargetList[0], UseCardTag.TargetList[0].Position) * (UseCardTag.TargetList[0].TeamIndex == Player.TeamIndex ? 1 : -1);
                         int MaxValue = PMath.Max(Game.PlayerList, (PPlayer _Player) => {
                             if (_Player.TeamIndex == Player.TeamIndex)
                             {
                                 return PAiMapAnalyzer.Expect(Game, _Player, _Player.Position);
                             }
                             else
                             {
                                 return -PAiMapAnalyzer.Expect(Game, _Player, _Player.Position);
                             }
                         }, true).Value;
                         return MaxValue - NowValue >= 3000;
                     }
                     else if (UseCardTag.Card.Model.Name.Equals(P_KuungCheevngChi.CardName))
                     {
                         KeyValuePair <PPlayer, int> Target = PMath.Max(Game.Enemies(Player), (PPlayer _Player) => _Player.Area.HandCardArea.CardNumber);
                         return Target.Value >= 3 && !UseCardTag.TargetList[0].Equals(Target.Key);
                     }
                     else if (UseCardTag.Card.Model.Name.Equals(P_HsiaoLiTsaangTao.CardName))
                     {
                         return UseCardTag.User.TeamIndex != Player.TeamIndex && (UseCardTag.TargetList[0].TeamIndex != Player.TeamIndex || UseCardTag.TargetList[0].Area.EquipmentCardArea.CardNumber > 0 || UseCardTag.TargetList[0].Money <= 500);
                     }
                     return false;
                 },
                 Effect = (PGame Game) => {
                     List <PPlayer> Targets = new List <PPlayer>();
                     Game.Monitor.CallTime(PTime.Card.AfterEmitTargetTime, new PUseCardTag(Card, Player, Targets));
                     Game.CardManager.MoveCard(Card, Player.Area.HandCardArea, Game.CardManager.SettlingArea);
                     Game.Monitor.CallTime(PTime.Card.AfterBecomeTargetTime, new PUseCardTag(Card, Player, Targets));
                     PUseCardTag UseCardTag = Game.TagManager.FindPeekTag <PUseCardTag>(PUseCardTag.TagName);
                     PPlayer Target = null;
                     if (Player.IsUser)
                     {
                         List <PPlayer> TargetList = new List <PPlayer>()
                         {
                             null
                         };
                         TargetList.AddRange(Game.PlayerList.FindAll((PPlayer _Player) => !_Player.Equals(UseCardTag.TargetList[0]) && _Player.IsAlive));
                         List <string> TargetNameList = TargetList.ConvertAll((PPlayer _Player) => {
                             if (_Player == null)
                             {
                                 return "令该计策牌无效";
                             }
                             else
                             {
                                 return "转移给:" + _Player.Name;
                             }
                         });
                         Target = TargetList[PNetworkManager.NetworkServer.ChooseManager.Ask(Player, "选择一项", TargetNameList.ToArray())];
                     }
                     else
                     {
                         if (UseCardTag.Card.Model.Name.Equals(P_ManTiienKuoHai.CardName))
                         {
                             Target = PAiTargetChooser.InjureTarget(Game, UseCardTag.User, Player, PTrigger.Except(UseCardTag.TargetList[0]), 700, UseCardTag.Card, true);
                         }
                         else if (UseCardTag.Card.Model.Name.Equals(P_KuanMevnChoTsev.CardName) ||
                                  UseCardTag.Card.Model.Name.Equals(P_ChiaTaoFaKuo.CardName))
                         {
                             Target = PAiTargetChooser.InjureTarget(Game, UseCardTag.User, Player, PTrigger.Except(UseCardTag.TargetList[0]), 1000, UseCardTag.Card, true);
                         }
                         else if (UseCardTag.Card.Model.Name.Equals(P_ChihSangMaHuai.CardName))
                         {
                             Target = PAiTargetChooser.InjureTarget(Game, Game.TagManager.FindPeekTag <PInjureTag>(PInjureTag.TagName).FromPlayer, Player, null, Game.TagManager.FindPeekTag <PInjureTag>(PInjureTag.TagName).Injure, Game.TagManager.FindPeekTag <PInjureTag>(PInjureTag.TagName).InjureSource, true);
                         }
                         else if (UseCardTag.Card.Model.Name.Equals(P_ChiinTsevChiinWang.CardName))
                         {
                             Target = PMath.Max(Game.PlayerList, (PPlayer _Player) => {
                                 if (Player.TeamIndex == _Player.TeamIndex)
                                 {
                                     return PAiMapAnalyzer.ChangeFaceExpect(Game, _Player);
                                 }
                                 else
                                 {
                                     return -PAiMapAnalyzer.ChangeFaceExpect(Game, _Player);
                                 }
                             }).Key;
                         }
                         else if (UseCardTag.Card.Model.Name.Equals(P_TaTsaaoChingShev.CardName))
                         {
                             List <PPlayer> PossibleEnemies = Game.Enemies(Player).FindAll((PPlayer _Player) => Player.HasHouse);
                             if (PossibleEnemies.Count > 0)
                             {
                                 Target = PossibleEnemies[PMath.RandInt(0, PossibleEnemies.Count - 1)];
                             }
                         }
                         else if (UseCardTag.Card.Model.Name.Equals(P_ChiehShihHuanHun.CardName))
                         {
                             int MaxMoney = PMath.Max(Game.PlayerList, (PPlayer _Player) => {
                                 return _Player.Money;
                             }).Value;
                             Target = PMath.Max(Game.PlayerList, (PPlayer _Player) => {
                                 int Delta = Math.Min(10000, MaxMoney - _Player.Money) - 2000 * _Player.Area.HandCardArea.CardNumber - (int)PMath.Sum(_Player.Area.EquipmentCardArea.CardList.ConvertAll((PCard _Card) => (double)_Card.Model.AIInEquipExpectation(Game, _Player)));
                                 if (_Player.TeamIndex == Player.TeamIndex)
                                 {
                                     return Delta;
                                 }
                                 else
                                 {
                                     return -Delta;
                                 }
                             }).Key;
                         }
                         else if (UseCardTag.Card.Model.Name.Equals(P_WuChungShevngYou.CardName) ||
                                  UseCardTag.Card.Name.Equals(P_AnTuCheevnTsaang.CardName))
                         {
                             Target = PAiCardExpectation.MostValuableCardUser(Game, Game.Teammates(Player));
                         }
                         else if (UseCardTag.Card.Model.Name.Equals(P_ShangWuChoouTii.CardName))
                         {
                             Target = PMath.Max(Game.AlivePlayers(), (PPlayer _Player) => {
                                 if (_Player.TeamIndex == Player.TeamIndex)
                                 {
                                     return PAiMapAnalyzer.Expect(Game, _Player, _Player.Position);
                                 }
                                 else
                                 {
                                     return -PAiMapAnalyzer.Expect(Game, _Player, _Player.Position);
                                 }
                             }, true).Key;
                         }
                         else if (UseCardTag.Card.Model.Name.Equals(P_KuungCheevngChi.CardName))
                         {
                             Target = PMath.Max(Game.Enemies(Player), (PPlayer _Player) => _Player.Area.HandCardArea.CardNumber).Key;
                         }
                         else if (UseCardTag.Card.Model.Name.Equals(P_TsouWeiShangChi.CardName))
                         {
                             Target = PMath.Max(Game.Teammates(Player), (PPlayer _Player) => PAiMapAnalyzer.OutOfGameExpect(Game, Player)).Key;
                         }
                     }
                     if (Target == null || Target == UseCardTag.TargetList[0])
                     {
                         PNetworkManager.NetworkServer.TellClients(new PShowInformationOrder("声东击西:无效"));
                         #region 成就:地府的公正
                         if (UseCardTag.Card.Model is P_ChiehShihHuanHun)
                         {
                             PArch.Announce(Game, Player, "地府的公正");
                         }
                         #endregion
                         UseCardTag.TargetList.Clear();
                     }
                     else
                     {
                         PNetworkManager.NetworkServer.TellClients(new PShowInformationOrder("声东击西:转移给" + Target.Name));
                         UseCardTag.TargetList[0] = Target;
                     }
                     Game.CardManager.MoveCard(Card, Game.CardManager.SettlingArea, Game.CardManager.ThrownCardHeap);
                     Game.Monitor.CallTime(PTime.Card.EndSettleTime, new PUseCardTag(Card, Player, Targets));
                 }
             });
         });
     }
 }
Пример #12
0
    public PBlockTriggerInstaller() : base("格子的停留结算")
    {
        TriggerList.Add(new PTrigger("初始化结算阶段购买土地或房屋的次数")
        {
            IsLocked = true,
            Time     = PPeriod.SettleStage.Before,
            Effect   = (PGame Game) => {
                Game.TagManager.CreateTag(new PPurchaseTag(1, 0));
            }
        });
        TriggerList.Add(new PTrigger("清除结算阶段购买土地或房屋的次数")
        {
            IsLocked = true,
            Time     = PPeriod.SettleStage.After,
            Effect   = (PGame Game) => {
                Game.TagManager.PopTag <PPurchaseTag>(PPurchaseTag.TagName);
            }
        });
        TriggerList.Add(new PTrigger("奖励点(固定数额)")
        {
            IsLocked  = true,
            Time      = PPeriod.SettleStage.During,
            Condition = (PGame Game) => {
                return(Game.NowPlayer.Position.GetMoneyStopSolid > 0);
            },
            Effect = (PGame Game) => {
                Game.GetMoney(Game.NowPlayer, Game.NowPlayer.Position.GetMoneyStopSolid);
            }
        });
        TriggerList.Add(new PTrigger("奖励点(百分比)")
        {
            IsLocked  = true,
            Time      = PPeriod.SettleStage.During,
            Condition = (PGame Game) => {
                return(Game.NowPlayer.Position.GetMoneyStopPercent > 0);
            },
            Effect = (PGame Game) => {
                Game.GetMoney(Game.NowPlayer, PMath.Percent(Game.NowPlayer.Money, Game.NowPlayer.Position.GetMoneyStopPercent));
            }
        });
        TriggerList.Add(new PTrigger("天灾(固定数额)")
        {
            IsLocked  = true,
            Time      = PPeriod.SettleStage.During,
            Condition = (PGame Game) => {
                return(Game.NowPlayer.Position.GetMoneyStopSolid < 0);
            },
            Effect = (PGame Game) => {
                Game.Injure(null, Game.NowPlayer, -Game.NowPlayer.Position.GetMoneyStopSolid, null);
            }
        });
        TriggerList.Add(new PTrigger("天灾(百分比)")
        {
            IsLocked  = true,
            Time      = PPeriod.SettleStage.During,
            Condition = (PGame Game) => {
                return(Game.NowPlayer.Position.GetMoneyStopPercent < 0);
            },
            Effect = (PGame Game) => {
                Game.Injure(null, Game.NowPlayer, PMath.Percent(Game.NowPlayer.Money, -Game.NowPlayer.Position.GetMoneyStopPercent), null);
            }
        });
        TriggerList.Add(new PTrigger("牌库")
        {
            IsLocked  = true,
            Time      = PPeriod.SettleStage.During,
            Condition = (PGame Game) => {
                return(Game.NowPlayer.Position.GetCardStop > 0);
            },
            Effect = (PGame Game) => {
                Game.GetCard(Game.NowPlayer, Game.NowPlayer.Position.GetCardStop);
            }
        });
        MultiPlayerTriggerList.Add((PPlayer Player) => new PTrigger("购买土地")
        {
            IsLocked  = false,
            Player    = Player,
            Time      = PPeriod.SettleStage.During,
            Condition = (PGame Game) => {
                PBlock NowBlock          = Game.NowPlayer.Position;
                PPurchaseTag PurchaseTag = Game.TagManager.FindPeekTag <PPurchaseTag>(PPurchaseTag.TagName);
                return(Game.NowPlayer.Equals(Player) && NowBlock.CanPurchase && NowBlock.Lord == null && PurchaseTag.Count < PurchaseTag.Limit && NowBlock.Price < Game.NowPlayer.Money);
            },
            Effect = (PGame Game) => {
                Game.TagManager.FindPeekTag <PPurchaseTag>(PPurchaseTag.TagName).Count++;
                Game.PurchaseLand(Game.NowPlayer, Game.NowPlayer.Position);
            }
        });
        MultiPlayerTriggerList.Add((PPlayer Player) => new PTrigger("购买房屋")
        {
            IsLocked  = false,
            Player    = Player,
            Time      = PPeriod.SettleStage.During,
            CanRepeat = true,
            Condition = (PGame Game) => {
                PBlock NowBlock          = Game.NowPlayer.Position;
                PPurchaseTag PurchaseTag = Game.TagManager.FindPeekTag <PPurchaseTag>(PPurchaseTag.TagName);
                return(Game.NowPlayer.Equals(Player) && Game.NowPlayer.Equals(NowBlock.Lord) && PurchaseTag.Count < PurchaseTag.Limit && NowBlock.HousePrice < Game.NowPlayer.Money);
            },
            AICondition = (PGame Game) => {
                PBlock NowBlock          = Game.NowPlayer.Position;
                PPurchaseTag PurchaseTag = Game.TagManager.FindPeekTag <PPurchaseTag>(PPurchaseTag.TagName);

                /*
                 * AI的买房策略:
                 * 第1次:必买
                 * 第2次:钱多于20000 or 钱多于10000且地价高于2000
                 * 以上:钱多于15000且地价多于3000 or 钱多于10000且为购物中心
                 *
                 * 必买:公园 or 破军歌姬
                 * 必不买:廉颇 or 无房被兵
                 *
                 * 赵云:2000次数上限为3,1000无限建
                 */
                if (NowBlock.BusinessType.Equals(PBusinessType.Park))
                {
                    return(true);
                }
                if (Player.General is P_Gabriel && Game.AlivePlayersExist <P_IzayoiMiku>())
                {
                    return(true);
                }
                if (Player.General is P_LianPo)
                {
                    return(false);
                }
                if (Player.Area.AmbushCardArea.CardList.Exists((PCard Card) => Card.Model is P_PingLiangTsuunTuan) && !Player.HasHouse)
                {
                    return(false);
                }
                if (PurchaseTag.Count == 0)
                {
                    return(true);
                }
                if (PurchaseTag.Count == 1)
                {
                    if (Player.Money >= 20000)
                    {
                        return(true);
                    }
                    else if (Player.Money >= 10000 && NowBlock.Price >= 2000)
                    {
                        return(true);
                    }
                }
                if (Player.Money >= 15000 && NowBlock.Price >= 3000)
                {
                    return(true);
                }
                if (Player.Money >= 10000 && (NowBlock.BusinessType.Equals(PBusinessType.ShoppingCenter) || NowBlock.BusinessType.Equals(PBusinessType.Club)))
                {
                    return(true);
                }
                if (Player.General is P_ZhaoYun)
                {
                    if (Player.Money >= 5000 && NowBlock.Price < 3000 && PurchaseTag.Count <= 2)
                    {
                        return(true);
                    }
                    if (Player.Money >= 2000 && NowBlock.Price < 2000)
                    {
                        return(true);
                    }
                }
                return(false);
            },
            Effect = (PGame Game) => {
                Game.TagManager.FindPeekTag <PPurchaseTag>(PPurchaseTag.TagName).Count++;
                Game.PurchaseHouse(Game.NowPlayer, Game.NowPlayer.Position);
            }
        });
        MultiPlayerTriggerList.Add((PPlayer Player) => new PTrigger("研究所[视察研究成果]")
        {
            Player    = Player,
            Time      = PPeriod.SettleStage.During,
            Condition = (PGame Game) => {
                PBlock NowBlock = Game.NowPlayer.Position;
                return(Player.Equals(NowBlock.Lord) && NowBlock.BusinessType.Equals(PBusinessType.Institute));
            },
            AICondition = (PGame Game) => {
                return(Player.TeamIndex == Game.NowPlayer.TeamIndex);
            },
            Effect = (PGame Game) => {
                int Number = PMath.RandInt(2, 7) / 2;
                Game.GetCard(Game.NowPlayer, Number);
            }
        });
        MultiPlayerTriggerList.Add((PPlayer Player) => new PTrigger("当铺[典当手牌]")
        {
            Player    = Player,
            Time      = PPeriod.SettleStage.During,
            Condition = (PGame Game) => {
                PBlock NowBlock = Game.NowPlayer.Position;
                return(Game.NowPlayer.Equals(Player) && NowBlock.Lord != null && Player.Area.HandCardArea.CardNumber > 0 && NowBlock.BusinessType.Equals(PBusinessType.Pawnshop));
            },
            AICondition = (PGame Game) => {
                return(Game.NowPlayer.TeamIndex == Game.NowPlayer.Position.Lord.TeamIndex || PAiCardExpectation.FindLeastValuable(Game, Player, Player, true, false, false, true).Value < 750);
            },
            Effect = (PGame Game) => {
                Game.GiveCardTo(Game.NowPlayer, Game.NowPlayer.Position.Lord, true, false);
                Game.GetMoney(Game.NowPlayer, 2000);
            }
        });
        TriggerList.Add(new PTrigger("公园[扩建政府补助]")
        {
            IsLocked  = true,
            Time      = PTime.PurchaseHouseTime,
            Condition = (PGame Game) => {
                return(Game.TagManager.FindPeekTag <PPurchaseHouseTag>(PPurchaseHouseTag.TagName).Block.BusinessType.Equals(PBusinessType.Park));
            },
            Effect = (PGame Game) => {
                PPurchaseHouseTag PurchaseHouseTag = Game.TagManager.FindPeekTag <PPurchaseHouseTag>(PPurchaseHouseTag.TagName);
                Game.GetMoney(PurchaseHouseTag.Player, PMath.Percent(PurchaseHouseTag.Block.Price, 10));
            }
        });
        MultiPlayerTriggerList.Add((PPlayer Player) => new PTrigger("收取过路费")
        {
            Player    = Player,
            Time      = PPeriod.SettleStage.During,
            Condition = (PGame Game) => {
                return(!Game.NowPlayer.Equals(Player) && Player.Equals(Game.NowPlayer.Position.Lord));
            },
            AICondition = (PGame Game) => {
                if ((Game.NowPlayer.General is P_PanYue || Game.NowPlayer.General is P_ChenSheng) && Game.NowPlayer.TeamIndex == Player.TeamIndex)
                {
                    // 给闲居和起义让路
                    return(false);
                }
                return(PAiTargetChooser.InjureExpect(Game, Player, Player, Game.NowPlayer, Game.NowPlayer.Position.Toll, Game.NowPlayer.Position) > 0);
            },
            Effect = (PGame Game) => {
                Game.Toll(Player, Game.NowPlayer, Game.NowPlayer.Position);
            }
        });
    }
Пример #13
0
    public P_LvZhi() : base("吕雉")
    {
        Sex        = PSex.Female;
        Age        = PAge.Classic;
        Index      = 29;
        Cost       = 30;
        NewGeneral = true;
        Tips       = "定位:攻击\n" +
                     "难度:简单\n" +
                     "史实:汉高祖刘邦的皇后,惠帝、二少帝时的皇太后。统治时期实行与民休息的政策,为文景之治奠定了基础。\n" +
                     "攻略:\n-";

        PSkill ZhenSha = new PSkill("鸩杀")
        {
            Initiative = true
        };

        PPlayer ZhenShaTarget(PGame Game, PPlayer Player)
        {
            List <PPlayer> PossibleTargets = Game.AlivePlayers(Player).FindAll((PPlayer _Player) => _Player.Distance(Player) <= 1);
            PPlayer        Target          = PMath.Max(PossibleTargets, (PPlayer _Player) => {
                int InjureValue = PAiTargetChooser.InjureExpect(Game, Player, Player, _Player, ZhenShaInjure, ZhenSha);
                if (_Player.TeamIndex == Player.TeamIndex)
                {
                    KeyValuePair <PCard, int> MaxValueCard = PAiCardExpectation.FindMostValuable(Game, _Player, Player, true, false, false, true);
                    int MaxValue = MaxValueCard.Value - MaxValueCard.Key.AIInHandExpectation(Game, Player);
                    return(MaxValue + InjureValue);
                }
                else
                {
                    KeyValuePair <PCard, int> MinValueCard = PAiCardExpectation.FindLeastValuable(Game, _Player, Player, true, false, false, true);
                    int MinValue = MinValueCard.Value + MinValueCard.Key.AIInHandExpectation(Game, Player);
                    return(-MinValue + InjureValue);
                }
            }, true).Key;

            return(Target);
        }

        SkillList.Add(ZhenSha
                      .AnnounceTurnOnce()
                      .AddTimeTrigger(
                          new PTime[] {
            PPeriod.FirstFreeTime.During,
            PPeriod.SecondFreeTime.During
        },
                          (PTime Time, PPlayer Player, PSkill Skill) => {
            return(new PTrigger(ZhenSha.Name)
            {
                IsLocked = false,
                Player = Player,
                Time = Time,
                AIPriority = 40,
                CanRepeat = true,
                Condition = (PGame Game) => {
                    return Player.Equals(Game.NowPlayer) && (Player.IsAI || Game.Logic.WaitingForEndFreeTime()) && Player.RemainLimit(ZhenSha.Name) && Player.Area.HandCardArea.CardNumber > 0 && Game.AlivePlayers(Player).Exists((PPlayer _Player) => _Player.Distance(Player) <= 1);
                },
                AICondition = (PGame Game) => {
                    return ZhenShaTarget(Game, Player) != null;
                },
                Effect = (PGame Game) => {
                    ZhenSha.AnnouceUseSkill(Player);
                    PPlayer Target = null;
                    if (Player.IsAI)
                    {
                        Target = ZhenShaTarget(Game, Player);
                    }
                    else
                    {
                        Target = PNetworkManager.NetworkServer.ChooseManager.AskForTargetPlayer(Player, (PGame _Game, PPlayer _Player) => _Player.Distance(Player) <= 1 && !_Player.Equals(Player), ZhenSha.Name, true);
                    }
                    if (Target != null)
                    {
                        Game.GiveCardTo(Player, Target, true, false);
                        Game.Injure(Player, Target, 1500, ZhenSha);
                        ZhenSha.DeclareUse(Player);
                    }
                }
            });
        }));
        PSkill XuMou = new PSkill("蓄谋")
        {
            Lock = true
        };

        SkillList.Add(XuMou
                      .AddTrigger(
                          (PPlayer Player, PSkill Skill) => {
            return(new PTrigger(XuMou.Name)
            {
                IsLocked = true,
                Player = Player,
                Time = PTime.LeaveDyingTime,
                AIPriority = 100,
                Condition = (PGame Game) => {
                    PDyingTag DyingTag = Game.TagManager.FindPeekTag <PDyingTag>(PDyingTag.TagName);
                    return Player.Equals(DyingTag.Killer) && !Player.Equals(DyingTag.Player);
                },
                Effect = (PGame Game) => {
                    XuMou.AnnouceUseSkill(Player);
                    PDyingTag DyingTag = Game.TagManager.FindPeekTag <PDyingTag>(PDyingTag.TagName);
                    DyingTag.Player.Money = 0;
                    Game.Die(DyingTag.Player, DyingTag.Killer);
                }
            });
        }));
    }
Пример #14
0
    public P_HeShen() : base("和珅")
    {
        Sex   = PSex.Male;
        Age   = PAge.Industrial;
        Index = 24;
        Cost  = 30;
        Tips  = "定位:防御\n" +
                "难度:简单\n" +
                "史实:清朝中期权臣,中国历史上有名的巨贪,聚敛了约十亿两白银的巨大财富。\n" +
                "攻略:\n和珅是一名拥有不错防御力的武将。【贪污】使和珅的起始资金变相增加,而【受贿】可用于关键击杀,但一般都用于辅助队友。和珅的技能使用基本没有任何难度,因此十分适合新手使用。";

        PSkill TanWu = new PSkill("贪污")
        {
            Lock = true
        };

        SkillList.Add(TanWu
                      .AddTrigger(
                          (PPlayer Player, PSkill Skill) => {
            return(new PTrigger(TanWu.Name)
            {
                IsLocked = true,
                Player = Player,
                Time = PTime.PurchaseLandTime,
                Condition = (PGame Game) => {
                    PPurchaseLandTag PurchaseLandTag = Game.TagManager.FindPeekTag <PPurchaseLandTag>(PPurchaseLandTag.TagName);
                    return Player.Equals(PurchaseLandTag.Player);
                },
                Effect = (PGame Game) => {
                    TanWu.AnnouceUseSkill(Player);
                    PPurchaseLandTag PurchaseLandTag = Game.TagManager.FindPeekTag <PPurchaseLandTag>(PPurchaseLandTag.TagName);
                    PurchaseLandTag.LandPrice = PMath.Percent(PurchaseLandTag.LandPrice, 50);
                }
            });
        })
                      .AddTrigger(
                          (PPlayer Player, PSkill Skill) => {
            return(new PTrigger(TanWu.Name)
            {
                IsLocked = true,
                Player = Player,
                Time = PTime.PurchaseHouseTime,
                Condition = (PGame Game) => {
                    PPurchaseHouseTag PurchaseHouseTag = Game.TagManager.FindPeekTag <PPurchaseHouseTag>(PPurchaseHouseTag.TagName);
                    return Player.Equals(PurchaseHouseTag.Player);
                },
                Effect = (PGame Game) => {
                    TanWu.AnnouceUseSkill(Player);
                    PPurchaseHouseTag PurchaseHouseTag = Game.TagManager.FindPeekTag <PPurchaseHouseTag>(PPurchaseHouseTag.TagName);
                    PurchaseHouseTag.HousePrice = PMath.Percent(PurchaseHouseTag.HousePrice, 50);
                }
            });
        }));
        PSkill ShouHui = new PSkill("受贿")
        {
            Initiative = true
        };

        int ShouHuiExpect(PGame Game, PPlayer Player)
        {
            int Sum = 0;
            int Cnt = 0;

            foreach (PBlock Block in PAiMapAnalyzer.NextBlocks(Game, Player))
            {
                if (Block.CanPurchase && Block.Lord == null)
                {
                    Sum += Block.Price;
                    Cnt++;
                }
                else if (Player.Equals(Block.Lord))
                {
                    Sum += Block.HousePrice;
                    Cnt++;
                }
            }
            if (Cnt == 0)
            {
                return(-1);
            }
            else
            {
                return(Sum / Cnt);
            }
        }

        PPlayer ShouHuiTarget(PGame Game, PPlayer Player)
        {
            foreach (PPlayer Target in Game.Teammates(Player))
            {
                if (ShouHuiExpect(Game, Target) >= 1500 && Target.Money >= 2000 && Player.RemainLimit(ShouHui.Name, Target))
                {
                    return(Target);
                }
            }
            foreach (PPlayer Target in Game.Enemies(Player))
            {
                if (Player.RemainLimit(ShouHui.Name, Target))
                {
                    int Expect = ShouHuiExpect(Game, Target);
                    if (Expect < 0)
                    {
                        Expect = 3000; // 无法判断下次购买土地或房屋的收益
                    }
                    Expect -= PAiTargetChooser.InjureExpect(Game, Player, Player, Target, 1000, ShouHui);
                    if (Expect <= -1000)
                    {
                        return(Target);
                    }
                }
            }
            return(null);
        }

        SkillList.Add(ShouHui
                      .AnnounceEachPlayerOnce()
                      .AddTimeTrigger(
                          new PTime[] {
            PPeriod.FirstFreeTime.During,
            PPeriod.SecondFreeTime.During
        },
                          (PTime Time, PPlayer Player, PSkill Skill) => {
            return(new PTrigger(ShouHui.Name)
            {
                IsLocked = false,
                Player = Player,
                Time = Time,
                AIPriority = 10,
                CanRepeat = true,
                Condition = (PGame Game) => {
                    return Player.Equals(Game.NowPlayer) && (Player.IsAI || Game.Logic.WaitingForEndFreeTime()) && Game.AlivePlayers().Exists((PPlayer _Player) => Player.RemainLimit(ShouHui.Name, _Player));
                },
                AICondition = (PGame Game) => {
                    return ShouHuiTarget(Game, Player) != null;
                },
                Effect = (PGame Game) => {
                    ShouHui.AnnouceUseSkill(Player);
                    PPlayer Target = null;
                    if (Player.IsAI)
                    {
                        Target = ShouHuiTarget(Game, Player);
                    }
                    else
                    {
                        Target = PNetworkManager.NetworkServer.ChooseManager.AskForTargetPlayer(Player, (PGame _Game, PPlayer _Player) => Player.RemainLimit(ShouHui.Name, _Player), ShouHui.Name, true);
                    }
                    if (Target != null)
                    {
                        Game.Injure(Player, Target, 1000, ShouHui);
                        Target.Tags.CreateTag(new PShouHuiTag());
                        ShouHui.DeclareUseFor(Player, Target);
                    }
                }
            });
        })
                      .AddTrigger(
                          (PPlayer Player, PSkill Skill) => {
            return(new PTrigger(ShouHui.Name)
            {
                IsLocked = true,
                Player = null,
                Time = PTime.PurchaseLandTime,
                Condition = (PGame Game) => {
                    PPurchaseLandTag PurchaseLandTag = Game.TagManager.FindPeekTag <PPurchaseLandTag>(PPurchaseLandTag.TagName);
                    return PurchaseLandTag.Player.Tags.ExistTag(PShouHuiTag.TagName);
                },
                Effect = (PGame Game) => {
                    PPurchaseLandTag PurchaseLandTag = Game.TagManager.FindPeekTag <PPurchaseLandTag>(PPurchaseLandTag.TagName);
                    PurchaseLandTag.LandPrice = 0;
                    ShouHui.AnnouceUseSkill(PurchaseLandTag.Player);
                    PurchaseLandTag.Player.Tags.PopTag <PShouHuiTag>(PShouHuiTag.TagName);
                }
            });
        })
                      .AddTrigger(
                          (PPlayer Player, PSkill Skill) => {
            return(new PTrigger(ShouHui.Name)
            {
                IsLocked = true,
                Player = null,
                Time = PTime.PurchaseHouseTime,
                Condition = (PGame Game) => {
                    PPurchaseHouseTag PurchaseHouseTag = Game.TagManager.FindPeekTag <PPurchaseHouseTag>(PPurchaseHouseTag.TagName);
                    return PurchaseHouseTag.Player.Tags.ExistTag(PShouHuiTag.TagName);
                },
                Effect = (PGame Game) => {
                    PPurchaseHouseTag PurchaseHouseTag = Game.TagManager.FindPeekTag <PPurchaseHouseTag>(PPurchaseHouseTag.TagName);
                    PurchaseHouseTag.HousePrice = 0;
                    ShouHui.AnnouceUseSkill(PurchaseHouseTag.Player);
                    PurchaseHouseTag.Player.Tags.PopTag <PShouHuiTag>(PShouHuiTag.TagName);
                }
            });
        }));
    }
Пример #15
0
    /// <summary>
    /// 将一个玩家移出游戏对其的收益,无卡牌收益嵌套
    /// </summary>
    /// <param name="Game"></param>
    /// <param name="Player"></param>
    /// <param name="Including">是否包含其行走阶段</param>
    /// <returns></returns>
    public static int OutOfGameExpect(PGame Game, PPlayer Player, bool Including = false, bool IncludingOnly = false)
    {
        if (Player.OutOfGame)
        {
            return(0);
        }
        int Sum = 0;

        // 一轮其他角色可能造成的过路费收益总和的相反数
        if (!IncludingOnly)
        {
            PPlayer _Player = Game.NowPlayer;
            if (Player.Equals(Game.NowPlayer))
            {
                _Player = Game.GetNextPlayer(_Player);
            }
            for (; !_Player.Equals(Player); _Player = Game.GetNextPlayer(_Player))
            {
                if (_Player.Equals(Game.NowPlayer) && Game.NowPeriod.IsAfter(PPeriod.WalkingStage))
                {
                    continue;
                }
                int           Temp   = 0;
                List <PBlock> Blocks = NextBlocks(Game, _Player);
                Blocks.ForEach((PBlock Block) => {
                    int BlockTemp = 0;
                    if (Block.Lord != null && Player.Equals(Block.Lord))
                    {
                        BlockTemp = Math.Max(0, PAiTargetChooser.InjureExpect(Game, Player, Player, _Player, Block.Toll, Block));
                    }
                    if (_Player.General is P_Newton)
                    {
                        PBlock PossibleBlock = Game.Map.NextStepBlock(Block, P_Newton.Grx_Next(Game, _Player.Position).Value);
                        if (PossibleBlock.Lord != null && Player.Equals(PossibleBlock.Lord))
                        {
                            BlockTemp = Math.Min(BlockTemp, Math.Max(0, PAiTargetChooser.InjureExpect(Game, Player, Player, _Player, Block.Toll, Block)));
                        }
                        else
                        {
                            BlockTemp = 0;
                        }
                    }
                    Temp -= BlockTemp;
                });
                Sum += Temp / Math.Max(1, Blocks.Count);
            }
        }
        int SumSelf = 0;

        if (Including)
        {
            List <PBlock> Blocks = NextBlocks(Game, Player);
            Blocks.ForEach((PBlock Block) => {
                int BlockTemp = 0;
                if (Block.Lord != null && Player.TeamIndex != Block.Lord.TeamIndex)
                {
                    BlockTemp = Math.Max(0, -PAiTargetChooser.InjureExpect(Game, Player, Block.Lord, Player, Block.Toll, Block));
                }
                if (Player.General is P_Newton)
                {
                    PBlock PossibleBlock = Game.Map.NextStepBlock(Block, P_Newton.Grx_Next(Game, Player.Position).Value);
                    if (PossibleBlock.Lord != null && Player.TeamIndex != PossibleBlock.Lord.TeamIndex)
                    {
                        BlockTemp = Math.Max(BlockTemp, Math.Max(0, -PAiTargetChooser.InjureExpect(Game, Player, Block.Lord, Player, Block.Toll, Block)));
                    }
                    else
                    {
                        BlockTemp = 0;
                    }
                }
                SumSelf += BlockTemp;
            });
            SumSelf /= Math.Max(1, Blocks.Count);
        }
        return(Sum + SumSelf);
    }
Пример #16
0
    public P_Washington() : base("华盛顿")
    {
        Sex   = PSex.Male;
        Age   = PAge.Renaissance;
        Index = 27;
        Cost  = 30;
        Tips  = "定位:攻击\n" +
                "难度:困难\n" +
                "史实:美国政治家、军事家、革命家,首任总统,美国开国元勋之一,在美国独立战争中任大陆军的总司令。华盛顿主持起草了《独立宣言》,制定美国宪法,领导创立并完善了共和政体。\n" +
                "攻略:\n华盛顿每局游戏可以发动两次无损技能,所以技能发动时机是关键。由于每名其他角色可以选择两个选项,所以华盛顿对对方只有两种可能性,一种是通过对方没有手牌来迫使对方承受高伤害,一种是通过对方有高伤害风险迫使对方承受所有手牌的损失。其中前者比较常见。虽然华盛顿的技能是全体范围,但发动的条件苛刻且转瞬即逝,通常如果能对其中一个敌人有巨大收益已经实属不易,所以第一次发动应该果断一些,不强求同时威胁多个敌人,第二次可以作为威慑适当保留。";
        NewGeneral = true;
        PSkill MinZhu = new PSkill("民主")
        {
            Initiative = true
        };
        const int MinZhuCof = 800;

        SkillList.Add(MinZhu
                      .AnnounceGameTimes(2)
                      .AddTimeTrigger(
                          new PTime[] {
            PPeriod.FirstFreeTime.During,
            PPeriod.SecondFreeTime.During
        },
                          (PTime Time, PPlayer Player, PSkill Skill) => {
            return(new PTrigger(MinZhu.Name)
            {
                IsLocked = false,
                Player = Player,
                Time = Time,
                AIPriority = 20,
                CanRepeat = true,
                Condition = (PGame Game) => {
                    return Player.Equals(Game.NowPlayer) && (Player.IsAI || Game.Logic.WaitingForEndFreeTime()) && Player.RemainLimit(MinZhu.Name) && !Player.Tags.ExistTag(PElectronTag.TagName);
                },
                AICondition = (PGame Game) => {
                    int Sum = 0;
                    Game.AlivePlayers(Player).ForEach((PPlayer _Player) => {
                        int Cof = _Player.TeamIndex == Player.TeamIndex ? 1 : -1;
                        int Expect1 = 2000 * Cof + PAiTargetChooser.InjureExpect(Game, Player, Player, _Player, MinZhuCof * _Player.Position.HouseNumber, MinZhu);
                        int Expect2 = -2000 * _Player.Area.HandCardArea.CardNumber * Cof;
                        if (_Player.Area.HandCardArea.CardNumber >= 1 && (Expect2 < Expect1 ^ Cof == 1))
                        {
                            Sum += Expect2;
                        }
                        else
                        {
                            Sum += Expect1;
                        }
                    });
                    return Sum >= 1300 * (Game.AlivePlayerNumber - 1);
                },
                Effect = (PGame Game) => {
                    MinZhu.AnnouceUseSkill(Player);
                    Game.Traverse((PPlayer _Player) => {
                        if (!_Player.Equals(Player))
                        {
                            int ChosenResult = 0;
                            if (_Player.Area.HandCardArea.CardNumber >= 1)
                            {
                                if (_Player.IsAI)
                                {
                                    int Expect1 = 2000 + PAiTargetChooser.InjureExpect(Game, _Player, Player, _Player, MinZhuCof * _Player.Position.HouseNumber, MinZhu);
                                    int Expect2 = 0;
                                    _Player.Area.HandCardArea.CardList.ForEach((PCard Card) => {
                                        Expect2 -= Card.Model.AIInHandExpectation(Game, _Player);
                                    });
                                    if (Expect2 >= Expect1)
                                    {
                                        ChosenResult = 1;
                                    }
                                }
                                else
                                {
                                    ChosenResult = PNetworkManager.NetworkServer.ChooseManager.Ask(_Player, MinZhu.Name + "-选择一项", new string[] {
                                        "令" + Player.Name + "对你造成" + (MinZhuCof * _Player.Position.HouseNumber).ToString() + "点伤害,摸一张牌",
                                        "弃置所有手牌"
                                    });
                                }
                            }
                            if (ChosenResult == 0)
                            {
                                Game.Injure(Player, _Player, MinZhuCof * _Player.Position.HouseNumber, MinZhu);
                                if (_Player.IsAlive)
                                {
                                    Game.GetCard(_Player);
                                }
                            }
                            else
                            {
                                for (int i = _Player.Area.HandCardArea.CardNumber - 1; i >= 0; --i)
                                {
                                    Game.CardManager.MoveCard(_Player.Area.HandCardArea.CardList[i], _Player.Area.HandCardArea, Game.CardManager.ThrownCardHeap);
                                }
                            }
                        }
                    }, Player);
                    MinZhu.DeclareUse(Player);
                    if (Player.RemainLimit(MinZhu.Name))
                    {
                        Player.Tags.CreateTag(new PElectronTag());
                    }
                }
            });
        })
                      .AddTrigger((PPlayer Player, PSkill Skill) => {
            return(new PTrigger(MinZhu.Name)
            {
                IsLocked = true,
                Player = Player,
                Time = PPeriod.EndTurn.During,
                Condition = (PGame Game) => {
                    return Player.Equals(Game.NowPlayer) && Player.Tags.ExistTag(PElectronTag.TagName);
                },
                Effect = (PGame Game) => {
                    if (--Player.Tags.FindPeekTag <PElectronTag>(PElectronTag.TagName).Value <= 0)
                    {
                        Player.Tags.PopTag <PElectronTag>(PElectronTag.TagName);
                    }
                    PNetworkManager.NetworkServer.TellClients(new PRefreshMarkStringOrder(Player));
                }
            });
        }));
    }