コード例 #1
0
    public static KeyValuePair <PCard, int> FindMostValuableToGet(PGame Game, PPlayer Player, PPlayer TargetPlayer, bool AllowHandCards = true, bool AllowEquipment = true, bool AllowAmbush = false, bool CanSee = false)
    {
        int Cof         = Player.TeamIndex == TargetPlayer.TeamIndex ? -1 : 1;
        int YangToowCof = TargetPlayer.Traffic != null && TargetPlayer.Traffic.Model is P_HsiYooYangToow && !Player.Age.Equals(TargetPlayer.Age) ? 0 : 1;
        KeyValuePair <PCard, int> HandCardResult = AllowHandCards ? PMath.Max(TargetPlayer.Area.HandCardArea.CardList, (PCard Card) => {
            if (CanSee)
            {
                return(Card.Model.AIInHandExpectation(Game, Player) * YangToowCof + Cof * Card.Model.AIInHandExpectation(Game, TargetPlayer));
            }
            else
            {
                return(Cof < 0 ? 0 : 2000 * YangToowCof + 2000 * Cof + PMath.RandInt(0, 10));
            }
        }) : new KeyValuePair <PCard, int>(null, int.MinValue);
        KeyValuePair <PCard, int> EquipResult = AllowEquipment ? PMath.Max(TargetPlayer.Area.EquipmentCardArea.CardList, (PCard Card) => {
            return(Card.Model.AIInHandExpectation(Game, Player) + Cof * Card.Model.AIInEquipExpectation(Game, TargetPlayer) - (TargetPlayer.General is P_HuaMulan ? 3500 * Cof : 0));
        }) : new KeyValuePair <PCard, int>(null, int.MinValue);
        KeyValuePair <PCard, int> AmbushResult = AllowAmbush ? PMath.Max(TargetPlayer.Area.AmbushCardArea.CardList, (PCard Card) => {
            return(Card.Model.AIInHandExpectation(Game, Player) + Cof * Card.Model.AIInAmbushExpectation(Game, TargetPlayer));
        }) : new KeyValuePair <PCard, int>(null, int.MinValue);
        KeyValuePair <PCard, int> Temp = HandCardResult.Value >= EquipResult.Value ? HandCardResult : EquipResult;

        Temp = Temp.Value >= AmbushResult.Value ? Temp : AmbushResult;
        if (Temp.Key == null)
        {
            return(new KeyValuePair <PCard, int>(null, 0));
        }
        return(Temp);
    }
コード例 #2
0
    /// <summary>
    /// 用于交给队友有价值的牌和弃置敌人的高价值牌
    /// </summary>
    /// <param name="Game"></param>
    /// <param name="Player"></param>
    /// <param name="TargetPlayer"></param>
    /// <param name="AllowHandCards"></param>
    /// <param name="AllowEquipment"></param>
    /// <param name="AllowAmbush"></param>
    /// <param name="CanSee"></param>
    /// <returns></returns>
    public static KeyValuePair <PCard, int> FindMostValuable(PGame Game, PPlayer Player, PPlayer TargetPlayer, bool AllowHandCards = true, bool AllowEquipment = true, bool AllowAmbush = false, bool CanSee = false)
    {
        int Cof = Player.TeamIndex == TargetPlayer.TeamIndex ? 1 : -1;
        KeyValuePair <PCard, int> HandCardResult = AllowHandCards ? PMath.Max(TargetPlayer.Area.HandCardArea.CardList, (PCard Card) => {
            if (CanSee)
            {
                return(Card.Model.AIInHandExpectation(Game, Player));
            }
            else
            {
                return(2000 + PMath.RandInt(-10, 10));
            }
        }) : new KeyValuePair <PCard, int>(null, int.MinValue);
        KeyValuePair <PCard, int> EquipResult = AllowEquipment ? PMath.Max(TargetPlayer.Area.EquipmentCardArea.CardList, (PCard Card) => {
            return(Card.Model.AIInEquipExpectation(Game, TargetPlayer) + (TargetPlayer.General is P_HuaMulan ? 3500 * Cof : 0));
        }) : new KeyValuePair <PCard, int>(null, int.MinValue);
        KeyValuePair <PCard, int> AmbushResult = AllowAmbush ? PMath.Max(TargetPlayer.Area.AmbushCardArea.CardList, (PCard Card) => {
            return(Card.Model.AIInAmbushExpectation(Game, TargetPlayer));
        }) : new KeyValuePair <PCard, int>(null, int.MinValue);
        KeyValuePair <PCard, int> Temp = HandCardResult.Value >= EquipResult.Value ? HandCardResult : EquipResult;

        Temp = Temp.Value >= AmbushResult.Value ? Temp : AmbushResult;
        if (Temp.Key == null)
        {
            return(new KeyValuePair <PCard, int>(null, 0));
        }
        return(Temp);
    }
コード例 #3
0
ファイル: PCardArea.cs プロジェクト: ClazyChen/Richer-4
 public PCard RandomCard()
 {
     if (CardNumber < 1)
     {
         return(null);
     }
     return(CardList[PMath.RandInt(0, CardList.Count - 1)]);
 }
コード例 #4
0
 public List<PPlayer> AIEmitTargets(PGame Game, PPlayer Player) {
     PPlayer Target = PMath.Max(Game.Enemies(Player).FindAll((PPlayer _Player) => _Player.HasHouse && 
     (_Player.Defensor == null || !(_Player.Defensor.Model is P_ChiiHsingPaao)) && 
     !_Player.Area.AmbushCardArea.CardList.Exists((PCard _Card) => _Card.Model.Name.Equals(CardName)) &&
     !(_Player.General is P_LiuJi)),
     (PPlayer _Player) => PAiMapAnalyzer.MinValueHouse(Game, _Player).Value + PMath.RandInt(0, 10)).Key;
     return new List<PPlayer>() { Target};
 }
コード例 #5
0
ファイル: PMapUI.cs プロジェクト: ClazyChen/Richer-4
 /// <summary>
 /// 播放掷骰子的动画
 /// </summary>
 /// <param name="DiceResult">掷骰子的结果</param>
 public void Dice(int DiceResult)
 {
     PAnimation.AddAnimation("掷骰子", () => {
         int DiceMiddleResult = PMath.RandInt(1, 6);
         DiceImage.sprite     = DiceSpriteList[DiceMiddleResult - 1];
     }, PAnimation.DiceAnimation.FrameNumber, PAnimation.DiceAnimation.TotalTime, () => {
         PUIManager.AddNewUIAction("掷骰子-显示最终结果", () => {
             DiceImage.sprite = DiceSpriteList[DiceResult - 1];
         });
     }, () => {
         DiceImage.gameObject.SetActive(true);
     });
 }
コード例 #6
0
    /// <summary>
    /// 进行一次判定
    /// </summary>
    /// <param name="Player"></param>
    /// <param name="AdvisedNumber">建议的结果</param>
    /// <returns></returns>
    public int Judge(PPlayer Player, int AdvisedNumber)
    {
        if (!Player.IsAlive)
        {
            return(7);
        }
        int       Result   = PMath.RandInt(1, 6);
        PJudgeTag JudgeTag = Monitor.CallTime(PTime.Judge.JudgeTime, new PJudgeTag(Player, Result, AdvisedNumber));

        PNetworkManager.NetworkServer.TellClients(new PShowInformationOrder(Player.Name + "的判定结果:" + JudgeTag.Result));
        PNetworkManager.NetworkServer.TellClients(new PPushTextOrder(Player.Index.ToString(), "判定结果:" + JudgeTag.Result, PPushType.Information.Name));
        Monitor.CallTime(PTime.Judge.AfterJudgeTime, JudgeTag);
        return(JudgeTag.Result);
    }
コード例 #7
0
ファイル: PCardArea.cs プロジェクト: ClazyChen/Richer-4
 /// <summary>
 /// 洗牌操作
 /// </summary>
 public void Wash()
 {
     for (int i = CardList.Count - 1; i > 0; --i)
     {
         int t1 = PMath.RandInt(0, i);
         int t2 = i;
         if (t1 != t2)
         {
             PCard Temp = CardList[t1];
             CardList[t1] = CardList[t2];
             CardList[t2] = Temp;
         }
     }
 }
コード例 #8
0
    /// <summary>
    /// 这个函数用来弃牌/转化牌,因此花木兰的装备value会被-3500计算
    /// </summary>
    /// <param name="Game"></param>
    /// <param name="Player">用来衡量价值的主视角</param>
    /// <param name="TargetPlayer">衡量对象区域的所有者</param>
    /// <param name="AllowHandCards"></param>
    /// <param name="AllowEquipment"></param>
    /// <param name="AllowAmbush"></param>
    /// <param name="CanSee"></param>
    /// <param name="Condition"></param>
    /// <returns></returns>
    public static KeyValuePair <PCard, int> FindLeastValuable(PGame Game, PPlayer Player, PPlayer TargetPlayer, bool AllowHandCards = true, bool AllowEquipment = true, bool AllowAmbush = false, bool CanSee = false, Predicate <PCard> Condition = null)
    {
        KeyValuePair <PCard, int> HandCardResult = AllowHandCards ?  PMath.Min(TargetPlayer.Area.HandCardArea.CardList.FindAll((PCard Card) => {
            return(Condition == null || Condition(Card));
        }), (PCard Card) => {
            if (CanSee)
            {
                return(Card.Model.AIInHandExpectation(Game, Player));
            }
            else
            {
                return(2000 + PMath.RandInt(-10, 10));
            }
        }) : new KeyValuePair <PCard, int>(null, int.MaxValue);
        KeyValuePair <PCard, int> EquipResult = AllowEquipment ? PMath.Min(TargetPlayer.Area.EquipmentCardArea.CardList.FindAll((PCard Card) => {
            return(Condition == null || Condition(Card));
        }), (PCard Card) => {
            int MulanCof = (TargetPlayer.General is P_HuaMulan ? 3500 : 0);
            if (CanSee)
            {
                int Current  = Card.Model.AIInEquipExpectation(Game, TargetPlayer);
                int MaxEquip = PMath.Max(Player.Area.HandCardArea.CardList, (PCard _Card) => _Card.Model.AIInEquipExpectation(Game, Player)).Value;
                if (Current <= MaxEquip)
                {
                    return(500 - MulanCof);
                }
                else
                {
                    return(Current - Math.Max(0, MaxEquip) - MulanCof);
                }
            }
            else
            {
                return(Card.Model.AIInEquipExpectation(Game, Player) - MulanCof);
            }
        }) : new KeyValuePair <PCard, int>(null, int.MaxValue);
        KeyValuePair <PCard, int> AmbushResult = AllowAmbush ? PMath.Min(TargetPlayer.Area.AmbushCardArea.CardList.FindAll((PCard Card) => {
            return(Condition == null || Condition(Card));
        }), (PCard Card) => {
            return(Card.Model.AIInAmbushExpectation(Game, TargetPlayer));
        }) : new KeyValuePair <PCard, int>(null, int.MaxValue);
        KeyValuePair <PCard, int> Temp = HandCardResult.Value <= EquipResult.Value ? HandCardResult : EquipResult;

        Temp = Temp.Value <= AmbushResult.Value ? Temp : AmbushResult;
        if (Temp.Key == null)
        {
            return(new KeyValuePair <PCard, int>(null, 0));
        }
        return(Temp);
    }
コード例 #9
0
 public PDiceTriggerInstaller() : base("掷骰子")
 {
     TriggerList.Add(new PTrigger("掷骰子")
     {
         IsLocked = true,
         Time     = PPeriod.DiceStage.During,
         Effect   = (PGame Game) => {
             int DiceResult = PMath.RandInt(1, 6);
             PNetworkManager.NetworkServer.TellClients(new PDiceResultOrder(DiceResult.ToString()));
             Game.TagManager.CreateTag(new PDiceResultTag(DiceResult));
         }
     });
     TriggerList.Add(new PTrigger("点数转为步数")
     {
         IsLocked = true,
         Time     = PPeriod.WalkingStage.Before,
         Effect   = (PGame Game) => {
             PDiceResultTag Tag = Game.TagManager.PopTag <PDiceResultTag>(PDiceResultTag.TagName);
             int DiceResult     = (Tag != null ? Tag.DiceResult : 0);
             Game.TagManager.CreateTag(new PStepCountTag(DiceResult));
         }
     });
 }
コード例 #10
0
ファイル: P_LevPuSsuShu.cs プロジェクト: ClazyChen/Richer-4
    public List <PPlayer> AIEmitTargets(PGame Game, PPlayer Player)
    {
        PPlayer Target = PMath.Max(Game.Enemies(Player).FindAll(
                                       (PPlayer _Player) => _Player.Area.HandCardArea.CardNumber >= 4 &&
                                       (_Player.Defensor == null || !(_Player.Defensor.Model is P_ChiiHsingPaao)) &&
                                       !_Player.Area.AmbushCardArea.CardList.Exists((PCard _Card) =>
                                                                                    _Card.Model.Name.Equals(CardName)) &&
                                       !(_Player.General is P_LiuJi))
                                   , (PPlayer _Player) => _Player.Area.HandCardArea.CardNumber * 100 + PMath.RandInt(0, 10)).Key;

        return(new List <PPlayer>()
        {
            Target
        });
    }
コード例 #11
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="Game"></param>
 /// <param name="Player"></param>
 /// <param name="Condition"></param>
 /// <param name="ExpectedMoney"></param>
 /// <returns></returns>
 public static PPlayer InjureTarget(PGame Game, PPlayer FromPlayer, PPlayer Player, PTrigger.PlayerCondition Condition = null, int ExpectedMoney = 0, PObject Source = null, bool AllowNegative = false)
 {
     return(PMath.Max(Game.PlayerList.FindAll((PPlayer Target) => Target.IsAlive && (Condition == null || Condition(Game, Target))), (PPlayer Target) => {
         return InjureExpect(Game, Player, FromPlayer, Target, ExpectedMoney, Source) + PMath.RandInt(0, 10);
     }, !AllowNegative).Key);
 }
コード例 #12
0
 public static PPlayer MostValuableCardUser(PGame Game, List <PPlayer> PlayerList)
 {
     return(PMath.Max(PlayerList, (PPlayer Player) => Expect(Game, Player) + PMath.RandInt(-10, 10)).Key);
 }
コード例 #13
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));
                 }
             });
         });
     }
 }
コード例 #14
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);
            }
        });
    }
コード例 #15
0
ファイル: P_FanChienChi.cs プロジェクト: ClazyChen/Richer-4
 public P_FanChienChi() : base(CardName)
 {
     Point = 6;
     Index = 33;
     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 = 65,
                 Condition = PTrigger.Initiative(Player),
                 AICondition = (PGame Game) => {
                     if (Player.General is P_WuZhao && Player.RemainLimit(PSkillInfo.女权.Name))
                     {
                         return false;
                     }
                     return AIInHandExpectation(Game, Player) > 1000 && P_PanYue.XianJuTest(Game, Player);
                 },
                 Effect = MakeNormalEffect(Player, Card, AIEmitTargets, AIEmitTargets,
                                           (PGame Game, PPlayer User, PPlayer Target) => {
                     int ChosenNumber = 1;
                     if (Target.IsAI)
                     {
                         if (Target.General is P_LiuJi)
                         {
                             ChosenNumber = 6;
                         }
                         else
                         {
                             ChosenNumber = PMath.RandInt(1, 6);
                         }
                     }
                     else
                     {
                         ChosenNumber = PNetworkManager.NetworkServer.ChooseManager
                                        .Ask1To6(Target, "反间计[选择1个数字]");
                     }
                     PNetworkManager.NetworkServer.TellClients(new
                                                               PShowInformationOrder(Target.Name + "选择了" + ChosenNumber));
                     int JudgeResult = Game.Judge(Target, 6);
                     if (JudgeResult != ChosenNumber)
                     {
                         // 故弄玄虚失效
                         User.Tags.PopTag <PTag>(Gunxx);
                         int Test = 0;
                         if (Target.IsAI)
                         {
                             int Choose1 = PAiMapAnalyzer.ChangeFaceExpect(Game, Target);
                             int Choose2 = Target.Money <= 1000 ? -30000 : -1000;
                             Test = (Choose1 > Choose2 ? 0 : 1);
                         }
                         else
                         {
                             Test = PNetworkManager.NetworkServer.ChooseManager
                                    .Ask(Target, "反间计[选择一项]", new string[] {
                                 "翻面", "弃1000"
                             });
                         }
                         if (Test == 0)
                         {
                             PNetworkManager.NetworkServer.TellClients(new
                                                                       PShowInformationOrder(Target.Name + "选择了翻面"));
                             Game.ChangeFace(Target);
                         }
                         else
                         {
                             PNetworkManager.NetworkServer.TellClients(new
                                                                       PShowInformationOrder(Target.Name + "选择了弃1000"));
                             Game.LoseMoney(Target, 1000);
                         }
                     }
                 }, (PGame Game, PPlayer User, List <PPlayer> Targets) => {
                     // 为了故弄玄虚成就做的初始化
                     if (Targets.Count > 0)
                     {
                         User.Tags.CreateTag(new PTag(Gunxx)
                         {
                             Visible = false
                         });
                     }
                 }, (PGame Game, PPlayer User, List <PPlayer> Targets) => {
                     // 判定故弄玄虚
                     if (User.Tags.PopTag <PTag>(Gunxx) != null)
                     {
                         PArch.Announce(Game, User, Gunxx);
                     }
                 })
             });
         });
     }
 }
コード例 #16
0
    public P_TangYin() : base("唐寅")
    {
        Sex   = PSex.Male;
        Age   = PAge.Industrial;
        Index = 20;
        Cost  = 25;
        Tips  = "定位:攻击\n" +
                "难度:简单\n" +
                "史实:明代画家、书法家、诗人,“明四家”和“吴中四才子”之一。以风流之名传于世,后代有“唐伯虎点秋香”等传说。\n" +
                "攻略:\n唐寅是一个上手简单的攻击型武将,并且具有一定的防御能力。【风流】作为主要输出技能,能够保持前期的经济压制和后期的装备压制,并可通过伤害类计策触发,因此【浑水摸鱼】【关门捉贼】等牌都是关键牌。【浪子】作为防御技能,能够在后期积累了一定装备的基础上避开关键区域,防止崩盘,因此唐寅对装备牌的需求也较大。唐寅可通过对队友造成伤害以获得装备;反之,【风流】的输出也会受到装备的限制,对手可以通过给唐寅没用的装备,替换唐寅原本的装备,降低【风流】的收益甚至令其变为负收益。";

        PSkill LangZi = new PSkill("浪子");

        SkillList.Add(LangZi
                      .AddTimeTrigger(
                          new PTime[] {
            PPeriod.DiceStage.Start
        },
                          (PTime Time, PPlayer Player, PSkill Skill) => {
            return(new PTrigger(LangZi.Name)
            {
                IsLocked = false,
                Player = Player,
                Time = Time,
                AIPriority = 10,
                Condition = (PGame Game) => {
                    return Player.Equals(Game.NowPlayer) &&
                    Player.HasEquipInArea();
                },
                AICondition = (PGame Game) => {
                    KeyValuePair <PCard, int> CardValue = PAiCardExpectation.EquipToThrow(Game, Player);
                    KeyValuePair <int, int> SkillValue = LangZiBannedNumber(Game, Player);
                    return CardValue.Key != null && SkillValue.Key > 0 && SkillValue.Value >= 100 && SkillValue.Value + CardValue.Value >= 300;
                },
                Effect = (PGame Game) => {
                    LangZi.AnnouceUseSkill(Player);
                    PCard TargetCard = null;
                    if (Player.IsAI)
                    {
                        TargetCard = PAiCardExpectation.EquipToThrow(Game, Player).Key;
                    }
                    else
                    {
                        do
                        {
                            TargetCard = PNetworkManager.NetworkServer.ChooseManager.AskToChooseOwnCard(Player, LangZi.Name + "[选择一张装备牌]", true, true);
                        } while (!TargetCard.Type.IsEquipment());
                    }
                    if (TargetCard != null)
                    {
                        int BannedNumber = 0;
                        if (Player.IsAI)
                        {
                            BannedNumber = LangZiBannedNumber(Game, Player).Key;
                        }
                        else
                        {
                            BannedNumber = PNetworkManager.NetworkServer.ChooseManager.Ask1To6(Player, LangZi.Name + "[选择不会被掷出的数字]");
                        }
                        if (BannedNumber > 0)
                        {
                            Game.CardManager.MoveCard(TargetCard, Player.Area.HandCardArea.CardList.Contains(TargetCard) ? Player.Area.HandCardArea : Player.Area.EquipmentCardArea, Game.CardManager.ThrownCardHeap);
                            Player.Tags.CreateTag(new PNumberedTag(LangZi.Name, BannedNumber));
                        }
                    }
                }
            });
        })
                      .AddTrigger((PPlayer Player, PSkill Skill) => {
            return(new PTrigger(LangZi.Name + "[掷骰无效触发]")
            {
                IsLocked = true,
                Player = Player,
                Time = PPeriod.DiceStage.During,
                Condition = (PGame Game) => {
                    return Player.Equals(Game.NowPlayer) && Player.Tags.ExistTag(LangZi.Name);
                },
                Effect = (PGame Game) => {
                    int BannedNumber = Player.Tags.PopTag <PNumberedTag>(LangZi.Name).Value;
                    PDiceResultTag DiceResult = Game.TagManager.FindPeekTag <PDiceResultTag>(PDiceResultTag.TagName);
                    if (BannedNumber == DiceResult.DiceResult)
                    {
                        LangZi.AnnouceUseSkill(Player);
                        int NewNumber = BannedNumber;
                        while (NewNumber == BannedNumber)
                        {
                            NewNumber = PMath.RandInt(1, 6);
                        }
                        PNetworkManager.NetworkServer.TellClients(new PShowInformationOrder("掷骰结果更改为" + NewNumber.ToString()));
                        DiceResult.DiceResult = NewNumber;
                    }
                }
            });
        })
                      );
        PSkill    FengLiu       = new PSkill("风流");
        const int FengLiuInjure = 600;

        SkillList.Add(FengLiu
                      .AddTimeTrigger(
                          new PTime[] {
            PTime.Injure.EmitInjure
        },
                          (PTime Time, PPlayer Player, PSkill Skill) => {
            return(new PTrigger(FengLiu.Name)
            {
                IsLocked = false,
                Player = Player,
                Time = Time,
                AIPriority = 150,
                Condition = (PGame Game) => {
                    PInjureTag InjureTag = Game.TagManager.FindPeekTag <PInjureTag>(PInjureTag.TagName);
                    return InjureTag.Injure > 0 && Player.Equals(InjureTag.FromPlayer) && InjureTag.ToPlayer != null && !Player.Equals(InjureTag.ToPlayer);
                },
                AICondition = (PGame Game) => {
                    PInjureTag InjureTag = Game.TagManager.FindPeekTag <PInjureTag>(PInjureTag.TagName);
                    PPlayer ToPlayer = InjureTag.ToPlayer;
                    if (ToPlayer.TeamIndex == Player.TeamIndex)
                    {
                        if (ToPlayer.Money > FengLiuInjure + InjureTag.Injure && ToPlayer.Money > Player.Money)
                        {
                            return true;
                        }
                        else if (ToPlayer.Money <= InjureTag.Injure)
                        {
                            return true;
                        }
                        else if (ToPlayer.Area.EquipmentCardArea.CardNumber == 0)
                        {
                            return false;
                        }
                    }
                    foreach (PCardType CardType in new PCardType[] {
                        PCardType.WeaponCard, PCardType.DefensorCard, PCardType.TrafficCard
                    })
                    {
                        PCard CurrentCard = Player.GetEquipment(CardType);
                        PCard TestCard = ToPlayer.GetEquipment(CardType);
                        if (ToPlayer.TeamIndex == Player.TeamIndex)
                        {
                            if (CurrentCard == null && TestCard != null && TestCard.Model.AIInEquipExpectation(Game, Player) > TestCard.Model.AIInEquipExpectation(Game, ToPlayer))
                            {
                                return true;
                            }
                        }
                        else if (CurrentCard != null && TestCard != null && CurrentCard.Model.AIInEquipExpectation(Game, Player) >= TestCard.Model.AIInEquipExpectation(Game, Player) + TestCard.Model.AIInEquipExpectation(Game, ToPlayer))
                        {
                            return false;
                        }
                    }
                    return ToPlayer.TeamIndex != Player.TeamIndex;
                },
                Effect = (PGame Game) => {
                    FengLiu.AnnouceUseSkill(Player);
                    PInjureTag InjureTag = Game.TagManager.FindPeekTag <PInjureTag>(PInjureTag.TagName);
                    PPlayer ToPlayer = InjureTag.ToPlayer;
                    int Answer = 0;
                    PCard TargetCard = null;
                    if (ToPlayer.Area.EquipmentCardArea.CardNumber == 0)
                    {
                        Answer = 1;
                    }
                    else
                    {
                        if (ToPlayer.IsAI)
                        {
                            if (ToPlayer.TeamIndex == Player.TeamIndex)
                            {
                                if (ToPlayer.Money <= InjureTag.Injure)
                                {
                                    Answer = 1;
                                }
                                else if (PAiCardExpectation.FindMostValuable(Game, Player, ToPlayer, false, true, false, true).Value > 0)
                                {
                                    Answer = 1;
                                }
                            }
                            else
                            {
                                int Value = FengLiuInjure * 2;
                                if (ToPlayer.Money <= InjureTag.Injure)
                                {
                                    Value -= FengLiuInjure;
                                }
                                else if (ToPlayer.Money <= InjureTag.Injure + FengLiuInjure)
                                {
                                    Value += 30000;
                                }

                                foreach (PCard TestCard in ToPlayer.Area.EquipmentCardArea.CardList)
                                {
                                    int NowValue = TestCard.Model.AIInEquipExpectation(Game, ToPlayer);
                                    int GiveValue = TestCard.Model.AIInEquipExpectation(Game, Player);
                                    int OverrideValue = 0;
                                    if (Player.GetEquipment(TestCard.Type) != null)
                                    {
                                        OverrideValue = Player.GetEquipment(TestCard.Type).Model.AIInEquipExpectation(Game, Player);
                                    }
                                    int ExtraValue = ToPlayer.General is P_HuaMulan ? 3500 : 0;
                                    if (Value > NowValue + GiveValue - OverrideValue - ExtraValue)
                                    {
                                        Value = NowValue + GiveValue - OverrideValue - ExtraValue;
                                        TargetCard = TestCard;
                                    }
                                }
                                if (TargetCard == null)
                                {
                                    Answer = 1;
                                }
                            }
                        }
                        else
                        {
                            Answer = PNetworkManager.NetworkServer.ChooseManager.Ask(ToPlayer, FengLiu.Name, new string[] { "交给" + Player.Name + "一件装备", "受到的伤害+" + FengLiuInjure.ToString() });
                        }
                    }
                    if (Answer == 0)
                    {
                        Game.GiveCardTo(ToPlayer, Player, false, true, false, true);
                    }
                    else
                    {
                        InjureTag.Injure += FengLiuInjure;
                    }
                }
            });
        })
                      );
    }
コード例 #17
0
ファイル: P_LianPo.cs プロジェクト: ClazyChen/Richer-4
    public P_LianPo() : base("廉颇")
    {
        Sex   = PSex.Male;
        Age   = PAge.Classic;
        Index = 1;
        Tips  = "定位:辅助\n" +
                "难度:中等\n" +
                "史实:战国时期赵国名将,被誉为“战国四大名将”之一,曾击退燕国入侵,斩杀栗腹。\n" +
                "攻略:\n廉颇可以把自己的现金转移给队友,同时让队友摸牌。和王诩、虞姬等技能依赖于手牌的武将组队时,廉颇是一个不错的选择,提高队友的技能发动频率。\n" +
                "新人推荐使用廉颇,给大神队友更多的牌,让队友有更大的发挥空间。\n" +
                "因为廉颇的现金可以给队友提供每回合2000(一张牌)的收益,廉颇很容易成为敌人的集火对象,在这种情况下,可以减少房屋的建造(除购物中心外,建房收益均不及负荆收益),让自己的现金发挥更大的价值。";

        PSkill FuJing = new PSkill("负荆")
        {
            Initiative = true
        };

        SkillList.Add(FuJing
                      .AnnounceTurnOnce()
                      .AddTimeTrigger(
                          new PTime[] {
            PPeriod.FirstFreeTime.During,
            PPeriod.SecondFreeTime.During
        },
                          (PTime Time, PPlayer Player, PSkill Skill) => {
            return(new PTrigger(FuJing.Name)
            {
                IsLocked = false,
                Player = Player,
                Time = Time,
                AIPriority = 180,
                CanRepeat = true,
                Condition = (PGame Game) => {
                    return Player.Equals(Game.NowPlayer) && (Player.IsAI || Game.Logic.WaitingForEndFreeTime()) && Player.RemainLimit(FuJing.Name);
                },
                AICondition = (PGame Game) => {
                    if (Game.Teammates(Player, false).Count == 0 || Player.Money < 6000)
                    {
                        return false;
                    }
                    if (Player.Money >= 15000 || !Player.CanBeInjured)
                    {
                        return true;
                    }
                    else
                    {
                        bool CanGo = true;
                        PAiMapAnalyzer.NextBlocks(Game, Player).ForEach((PBlock Block) => {
                            if (Block.Lord == null && Block.CanPurchase && Block.Price >= Player.Money - 8000)
                            {
                                CanGo = false;
                            }
                            if (Block.Lord != null && Block.Lord.TeamIndex != Player.TeamIndex && Block.Toll >= Player.Money - 8000)
                            {
                                CanGo = false;
                            }
                        });
                        return CanGo;
                    }
                },
                Effect = (PGame Game) => {
                    FuJing.AnnouceUseSkill(Player);
                    PPlayer Target = null;
                    if (Player.IsAI)
                    {
                        Target = PMath.Max(Game.Teammates(Player, false), (PPlayer _Player) => _Player.AiCardExpectation + PMath.RandInt(0, 5) + ((Player.Defensor != null && Player.Defensor.Model is P_PaiHuaChooon && !Player.Sex.Equals(_Player.Sex)) ? 1500 : 0)).Key;
                    }
                    else
                    {
                        Target = PNetworkManager.NetworkServer.ChooseManager.AskForTargetPlayer(Player, PTrigger.Except(Player), FuJing.Name, true);
                    }
                    if (Target != null)
                    {
                        Game.Injure(Target, Player, 3000, FuJing);
                        Game.GetCard(Target, 1);
                        FuJing.DeclareUse(Player);
                    }
                }
            });
        }));
    }