public override int AIInEquipExpectation(PGame Game, PPlayer Player) { return(500 + 4000 * Player.Area.HandCardArea.CardList.FindAll((PCard Card) => { PCardModel Model = Card.Model; return Model is P_ManTiienKuoHai || Model is P_HsiaoLiTsaangTao || Model is P_ChiaTaoFaKuo; }).Count); }
/// <summary> /// 获得牌行为 /// </summary> /// <param name="Player">获得牌的玩家</param> /// <param name="TargetPlayer">被获得牌的玩家</param> /// <param name="Directly">是否直接转移装备</param> /// <returns>获得的牌</returns> public PCard GetCardFrom(PPlayer Player, PPlayer TargetPlayer, bool AllowHandCards = true, bool AllowEquipment = true, bool AllowJudge = false, bool Directly = false) { string Title = "请选择获得一张" + (AllowHandCards ? "[手牌]" : string.Empty) + (AllowEquipment ? "[装备]" : string.Empty) + (AllowJudge ? "[伏兵]" : string.Empty); PCard TargetCard = ChooseCard(Player, TargetPlayer, Title, AllowHandCards, AllowEquipment, AllowJudge, true); if (TargetCard != null) { PNetworkManager.NetworkServer.TellClients(new PShowInformationOrder(Player.Name + "获得了" + TargetPlayer.Name + "的" + (TargetPlayer.Area.HandCardArea.CardList.Contains(TargetCard) ? "1张手牌" : TargetCard.Name))); if (TargetPlayer.Area.HandCardArea.CardList.Contains(TargetCard)) { CardManager.MoveCard(TargetCard, TargetPlayer.Area.HandCardArea, Player.Area.HandCardArea); } else if (TargetPlayer.Area.EquipmentCardArea.CardList.Contains(TargetCard)) { if (Directly) { CardManager.MoveCard(TargetCard, TargetPlayer.Area.EquipmentCardArea, Player.Area.EquipmentCardArea); } else { CardManager.MoveCard(TargetCard, TargetPlayer.Area.EquipmentCardArea, Player.Area.HandCardArea); } } else if (TargetPlayer.Area.AmbushCardArea.CardList.Contains(TargetCard)) { CardManager.MoveCard(TargetCard, TargetPlayer.Area.AmbushCardArea, Player.Area.HandCardArea); } } return(TargetCard); }
public override void AnnouceInvokeJudge(PGame Game, PPlayer Player, PCard Card) { base.AnnouceInvokeJudge(Game, Player, Card); int Result = Game.Judge(Player, new Func <int>(() => { if (Player.Area.EquipmentCardArea.CardNumber > 0) { return(6); } else { return(5); } })()); if (Result != 6) { if (Player.Area.EquipmentCardArea.CardNumber > 0) { Game.ThrowCard(Player, Player, false, true); } if (Game.GetNextPlayer(Player).Area.AmbushCardArea.CardList.Exists((PCard _Card) => _Card.Model is P_HsienChing)) { Game.CardManager.MoveCard(Card, Player.Area.AmbushCardArea, Game.GetNextPlayer(Game.GetNextPlayer(Player)).Area.AmbushCardArea); } else { Game.CardManager.MoveCard(Card, Player.Area.AmbushCardArea, Game.GetNextPlayer(Player).Area.AmbushCardArea); } } else { Game.CardManager.MoveCard(Card, Player.Area.AmbushCardArea, Game.CardManager.ThrownCardHeap); } }
public void Die(PPlayer Player, PPlayer Killer) { PNetworkManager.NetworkServer.TellClients(new PShowInformationOrder(Player.Name + "死亡!")); Monitor.CallTime(PTime.DieTime, new PDyingTag(Player, Killer)); Map.BlockList.ForEach((PBlock Block) => { if (Player.Equals(Block.Lord)) { Block.Lord = null; Block.HouseNumber = 0; Block.BusinessType = PBusinessType.NoType; PNetworkManager.NetworkServer.TellClients(new PRefreshBlockBasicOrder(Block)); } }); CardManager.ThrowAll(Player.Area); Player.IsAlive = false; PNetworkManager.NetworkServer.TellClients(new PDieOrder(Player.Index.ToString())); Monitor.CallTime(PTime.AfterDieTime, new PDyingTag(Player, Killer)); if (GameOver()) { PLogger.Log("游戏结束"); EndGame(); } else if (!NowPlayer.IsAlive) { PLogger.Log("因为当前玩家死亡,回合中止"); TagManager.PopTag <PStepCountTag>(PStepCountTag.TagName); TagManager.PopTag <PDiceResultTag>(PDiceResultTag.TagName); TagManager.PopTag <PTag>(PTag.FreeTimeOperationTag.Name); Monitor.EndTurnDirectly = true; } }
/// <summary> /// 摸一张牌,返回摸到的牌 /// </summary> /// <param name="Player"></param> /// <param name="OnlyShow">是否是展示卡牌(摸到结算区)</param> /// <returns></returns> public PCard GetCard(PPlayer Player, bool OnlyShow = false) { if (Player == null || !Player.IsAlive) { return(null); } if (CardManager.CardHeap.CardNumber == 0 && CardManager.ThrownCardHeap.CardNumber > 0) { CardManager.CardHeap.CardList.AddRange(CardManager.ThrownCardHeap.CardList); CardManager.ThrownCardHeap.CardList.Clear(); CardManager.CardHeap.Wash(); } PCard Got = null; if (CardManager.CardHeap.CardNumber > 0) { CardManager.MoveCard(Got = CardManager.CardHeap.TopCard, CardManager.CardHeap, OnlyShow ? CardManager.SettlingArea : Player.Area.HandCardArea); } if (NowPeriod != null) { if (OnlyShow) { PNetworkManager.NetworkServer.TellClients(new PShowInformationOrder(Player.Name + "展示了" + Got.Name)); } else { PNetworkManager.NetworkServer.TellClients(new PShowInformationOrder(Player.Name + "摸了1张牌")); } } return(Got); }
public override int AIInHandExpectation(PGame Game, PPlayer Player) { int Basic = 1000; int Sum = 0; List <PPlayer> Targets = AIEmitTargets(Game, Player); Targets.ForEach((PPlayer _Player) => { if (!(_Player.Defensor != null && _Player.Defensor.Model is P_YooHsi && Targets.Count > 1)) { int Cof = (_Player.TeamIndex == Player.TeamIndex ? 1 : -1); if (_Player.General is P_LiuJi) { Sum += 1200 * 6 / 5 * Cof; } else { int Choose1 = PAiMapAnalyzer.ChangeFaceExpect(Game, _Player); int Choose2 = _Player.Money <= 1000 ? -30000 : -1000; int Chosen = Math.Max(Choose1, Choose2); Sum += Chosen * Cof; } } }); Sum = Sum * 5 / 6; Basic = Math.Max(Basic, Sum); return(Math.Max(Basic, base.AIInHandExpectation(Game, Player))); }
public PChiaTaoFaKuoTriggerInstaller() : base("假道伐虢的记录") { TriggerList.Add(new PTrigger("假道伐虢[开始记录]") { IsLocked = true, Time = PPeriod.StartTurn.During, Effect = (PGame Game) => { Game.TagManager.PopTag <PChiaTaoFaKuoTag>(PChiaTaoFaKuoTag.TagName); Game.TagManager.CreateTag(new PChiaTaoFaKuoTag(new List <PPlayer>())); } }); TriggerList.Add(new PTrigger("假道伐虢[经过土地]") { IsLocked = true, Time = PTime.MovePositionTime, Effect = (PGame Game) => { PTransportTag TransportTag = Game.TagManager.FindPeekTag <PTransportTag>(PTransportTag.TagName); PPlayer Lord = TransportTag.Destination.Lord; if (Lord != null && !Lord.Equals(Game.NowPlayer)) { PChiaTaoFaKuoTag ChiaTaoFaKuoTag = Game.TagManager.FindPeekTag <PChiaTaoFaKuoTag>(PChiaTaoFaKuoTag.TagName); if (!ChiaTaoFaKuoTag.LordList.Contains(Lord)) { ChiaTaoFaKuoTag.LordList.Add(Lord); } } } }); }
private List <PPlayer> AIEmitTargets(PGame Game, PPlayer Player) { return(new List <PPlayer>() { Player }); }
/// <summary> /// 创建一个推送动画 /// </summary> /// <param name="StartPoint"></param> public static void PushAnimation(PPlayer Player, string PushText, PPushType PushType) { const int FrameNumber = 25; const float TotalTime = 0.5f; float Offset = 100.0f; Vector3 Speed = new Vector3(0.0f, Offset / FrameNumber, 0.0f); Text NewPush = null; Color PushColor = PushType.PushColor; AddAnimation("推送[" + PushText + "]", () => { PushColor.a -= 0.8f / FrameNumber; NewPush.color = PushColor; NewPush.rectTransform.Translate(Speed); }, FrameNumber, TotalTime, () => { PUIManager.AddNewUIAction("删除推送[" + PushText + "]", () => { UnityEngine.Object.Destroy(NewPush.gameObject); }); }, () => { NewPush = UnityEngine.Object.Instantiate(PUIManager.GetUI <PMapUI>().PushText); NewPush.transform.SetParent(PUIManager.GetUI <PMapUI>().UIBackgroundImage); NewPush.rectTransform.localScale *= PUIManager.GetUI <PMapUI>().PushText.rectTransform.lossyScale.y; NewPush.color = PushColor; NewPush.text = PushText; NewPush.rectTransform.position = PPlayerScene.GetScreenPosition(Player); NewPush.gameObject.SetActive(true); }); }
// 这个是Client端的StartGame // Server的StartGame在PGame里 public void StartGame(List <PGeneral> DefaultGenerals = null) { #region 初始化玩家列表 PlayerList = new List <PPlayer>(); for (int i = 0; i < PlayerNumber; ++i) { PlayerList.Add(new PPlayer() { Index = i, Name = PSystem.CurrentRoom.PlayerList[i].PlayerType.Equals(PPlayerType.Player) ? PSystem.CurrentRoom.PlayerList[i].Nickname : "P" + (i + 1).ToString(), IsAlive = true, Money = PPlayer.Config.DefaultMoney, TeamIndex = GameMode.Seats[i].Party - 1, Tags = null }); PBlock Position = Map.BlockList.Find((PBlock Block) => Block.StartPointIndex == i % Map.StartPointNumber); if (Position != null) { PlayerList[i].Position = Position; } else { PlayerList[i].Position = Map.BlockList[0]; } } #endregion NowPlayer = null; NowPeriod = null; }
/// <summary> /// 建造城堡可以获得的赠送房屋数量 /// </summary> /// <param name="Player"></param> /// <param name="Block"></param> /// <returns></returns> public int GetBonusHouseNumberOfCastle(PPlayer Player, PBlock Block) { int[] dx = { 1, -1, 0, 0 }; int[] dy = { 0, 0, 1, -1 }; int OriginalX = Block.X; int OriginalY = Block.Y; int sum = 0, x, y; for (int i = 0; i < 4; ++i) { x = OriginalX; y = OriginalY; do { x += dx[i]; y += dy[i]; PBlock TempBlock = Map.FindBlockByCoordinate(x, y); if (TempBlock != null) { if (TempBlock.Lord != null && !TempBlock.Lord.Equals(Player)) { sum += TempBlock.HouseNumber; } } else { break; } } while (true); } return(sum); }
public override int AIInHandExpectation(PGame Game, PPlayer Player) { int Basic = 0; Basic = Math.Max(Basic, PAiMapAnalyzer.OutOfGameExpect(Game, Player, true, true) - 2000 * (Player.Area.HandCardArea.CardNumber - 1)); return(Math.Max(Basic, base.AIInHandExpectation(Game, Player))); }
public static void Announce(PGame Game, PPlayer Player, string ArchName) { if (Player != null && Player.IsUser && Game.PlayerList.TrueForAll((PPlayer _Player) => _Player.IsAI || _Player.TeamIndex == Player.TeamIndex)) { PNetworkManager.NetworkServer.TellClient(Player, new PAnnounceArchOrder(Player.Index.ToString(), ArchName)); } }
public virtual int AIInHandExpectation(PGame Game, PPlayer Player) { int Basic = 0; if (Player.General is P_YuJi) { Basic += 400 * Point; } if (Player.General is P_WangXu && Point % 3 == 0) { if (Game.Teammates(Player, false).Count > 0) { Basic += 2900; } } if (Player.General is P_ShiQian && Point == 1) { Basic += 5900; } if (Player.General is P_Faraday && Point % 3 == 0) { Basic += 3000; } if (Player.General is P_Gryu && Point % 2 == 0) { Basic += 2500; } if (Player.General is P_ChenSheng && Point % 2 == 1) { Basic += 2500; } return(Basic); }
public P_HsiYooYangToow() : base(CardName, PCardType.TrafficCard) { Point = 4; Index = 58; foreach (PTime Time in new PTime[] { PTime.Card.LeaveAreaTime }) { MoveInEquipTriggerList.Add((PPlayer Player, PCard Card) => { return(new PTrigger(CardName) { IsLocked = true, Player = Player, Time = Time, AIPriority = 50, Condition = (PGame Game) => { PMoveCardTag MoveCardTag = Game.TagManager.FindPeekTag <PMoveCardTag>(PMoveCardTag.TagName); PPlayer SourceOwner = MoveCardTag.Source.Owner; PPlayer DestinationOwner = MoveCardTag.Destination.Owner; return Player.Equals(SourceOwner) && !MoveCardTag.Source.IsAmbushArea() && DestinationOwner != null && MoveCardTag.Destination.IsHandCardArea() && !Player.Age.Equals(DestinationOwner.Age); }, Effect = (PGame Game ) => { AnnouceUseEquipmentSkill(Player); PMoveCardTag MoveCardTag = Game.TagManager.FindPeekTag <PMoveCardTag>(PMoveCardTag.TagName); MoveCardTag.Destination = Game.CardManager.ThrownCardHeap; } }); }); } }
protected static Action <PGame> MakeNormalEffect(PPlayer Player, PCard Card, TargetChooser AITargetChooser, TargetChooser PlayerTargetChooser, EffectFunc Effect, Action <PGame, PPlayer, List <PPlayer> > StartAction = null, Action <PGame, PPlayer, List <PPlayer> > EndAction = null) { return((PGame Game) => { List <PPlayer> Targets = Player.IsAI ? AITargetChooser(Game, Player) : PlayerTargetChooser(Game, Player); Targets.RemoveAll((PPlayer _Player) => _Player == null); if (Targets.Count == 0) { return; } Game.Monitor.CallTime(PTime.Card.AfterEmitTargetTime, new PUseCardTag(Card, Player, Targets)); if (Card.Point > 0) { Game.CardManager.MoveCard(Card, Player.Area.HandCardArea, Game.CardManager.SettlingArea); } Game.Monitor.CallTime(PTime.Card.AfterBecomeTargetTime, new PUseCardTag(Card, Player, Targets)); Targets = ArrangeTargets(Game, Targets, Player); Game.TagManager.CreateTag(new PUseCardTag(Card, Player, Targets)); StartAction?.Invoke(Game, Player, Targets); Targets.ForEach((PPlayer Target) => { if (Target != null && Target.IsAlive) { Effect(Game, Player, Target); } }); EndAction?.Invoke(Game, Player, Targets); Game.TagManager.PopTag <PUseCardTag>(PUseCardTag.TagName); if (Card.Point > 0) { Game.CardManager.MoveCard(Card, Game.CardManager.SettlingArea, Game.CardManager.ThrownCardHeap); } Game.Monitor.CallTime(PTime.Card.EndSettleTime, new PUseCardTag(Card, Player, Targets)); }); }
public int AIExpect(PGame Game, PPlayer Player, PBlock Block) { int[] dx = { 1, -1, 0, 0 }; int[] dy = { 0, 0, 1, -1 }; int OriginalX = Block.X; int OriginalY = Block.Y; int sum, x, y; sum = PAiMapAnalyzer.HouseValue(Game, Player, Block); for (int i = 0; i < 4; ++i) { x = OriginalX; y = OriginalY; do { x += dx[i]; y += dy[i]; PBlock TempBlock = Game.Map.FindBlockByCoordinate(x, y); if (TempBlock != null) { if (TempBlock.Lord != null) { sum += PAiMapAnalyzer.HouseValue(Game, Player, TempBlock); } } else { break; } } while (true); } return(sum); }
public PTollTag(PPlayer FromPlayer, PPlayer ToPlayer, int Toll, PBlock Block) : base(TagName) { AppendField(FromPlayerFieldName, FromPlayer); AppendField(ToPlayerFieldName, ToPlayer); AppendField(TollFieldName, Toll); AppendField(BlockFieldName, Block); }
public override void AnnouceInvokeJudge(PGame Game, PPlayer Player, PCard Card) { base.AnnouceInvokeJudge(Game, Player, Card); int Result = Game.Judge(Player, new Func <int>(() => { if (Game.Enemies(Player).Count > Game.Teammates(Player, false).Count&& !(Game.Teammates(Player, false).Exists((PPlayer _Player) => _Player.Money <= 1000))) { return(6); } return(2); })()); if (Result != 2) { Game.LoseMoney(Player, 1000); if (Game.GetNextPlayer(Player).Area.AmbushCardArea.CardList.Exists((PCard _Card) => _Card.Model is P_WevnI)) { Game.CardManager.MoveCard(Card, Player.Area.AmbushCardArea, Game.GetNextPlayer(Game.GetNextPlayer(Player)).Area.AmbushCardArea); } else { Game.CardManager.MoveCard(Card, Player.Area.AmbushCardArea, Game.GetNextPlayer(Player).Area.AmbushCardArea); } } else { Game.CardManager.MoveCard(Card, Player.Area.AmbushCardArea, Game.CardManager.ThrownCardHeap); } }
void Awake() { thirdPersonCam.SetActive(SceneSetup.instance.cameraType == ModPlayerSDK.CameraType.ThirdPerson); cinemaLight.SetActive(Room.CustomProperties.SafeGet("type", "") == RoomType.Cinema); if (photonView.IsMine) { LocalPlayer = this; transform.LookAt(Camera.main.transform); transform.localEulerAngles = new Vector3( 0, transform.localEulerAngles.y, 0); } else { Destroy(thirdPersonCam); } impact = GetComponent <ImpactReceiver>(); nickname = photonView.Controller.NickName; nicknameText.text = nickname; userId = photonView.Controller.UserId; owner = photonView.Controller; Room.players[userId] = this; LoadCharacterMesh(); DontDestroyOnLoad(gameObject); }
public void LoseMoney(PPlayer Player, int Money, bool IsInjure = false) { PLoseMoneyTag LoseMoneyTag = Monitor.CallTime(PTime.LoseMoneyTime, new PLoseMoneyTag(Player, Money, IsInjure)); PPlayer LoseMoneyPlayer = LoseMoneyTag.Player; int MoneyCount = LoseMoneyTag.Money; if (LoseMoneyPlayer != null && LoseMoneyPlayer.IsAlive && MoneyCount > 0) { LoseMoneyPlayer.Money -= MoneyCount; PNetworkManager.NetworkServer.TellClients(new PPushTextOrder(LoseMoneyPlayer.Index.ToString(), "-" + MoneyCount.ToString(), LoseMoneyTag.IsInjure ? PPushType.Injure.Name : PPushType.Throw.Name)); PNetworkManager.NetworkServer.TellClients(new PShowInformationOrder(LoseMoneyPlayer.Name + "失去金钱" + MoneyCount.ToString())); PNetworkManager.NetworkServer.TellClients(new PRefreshMoneyOrder(LoseMoneyPlayer)); if (LoseMoneyPlayer.Money <= 0) { if (IsInjure) { PInjureTag InjureTag = TagManager.FindPeekTag <PInjureTag>(PInjureTag.TagName); Dying(LoseMoneyPlayer, InjureTag.FromPlayer, InjureTag.InjureSource); } else { Dying(LoseMoneyPlayer, null, null); } } } }
/// <summary> /// 牌堆里的牌(未进入弃牌堆或可见区域)的平均收益 /// </summary> /// <param name="Game"></param> /// <param name="Player"></param> /// <returns></returns> public static int Expect(PGame Game, PPlayer Player) { double SingleExpect(PCard Card) { int Base = Card.Model.AIInHandExpectation(Game, Player); return(Base); } double Sum = PMath.Sum(Game.CardManager.CardHeap.CardList.ConvertAll(SingleExpect)); int Count = Game.CardManager.CardHeap.CardNumber; if (Count <= 10) { Sum += PMath.Sum(Game.CardManager.ThrownCardHeap.CardList.ConvertAll(SingleExpect)); Count += Game.CardManager.ThrownCardHeap.CardNumber; } if (Count == 0) { return(0); } else { return((int)Sum / Count); } }
public void Prepared(string IPAddress) { if (Room.AllAi()) { PThread.Async(() => { PThread.WaitUntil(() => ReadyToStartGameFlag); StartGame(); }); } PPlayer TargetPlayer = PNetworkManager.NetworkServer.Game.PlayerList.Find((PPlayer Player) => Player.IPAddress.Equals(IPAddress)); if (TargetPlayer != null) { lock (PreparedList) { PreparedList[TargetPlayer.Index] = true; } if (PreparedList.TrueForAll((bool x) => x)) { PThread.Async(() => { PThread.WaitUntil(() => ReadyToStartGameFlag); StartGame(); }); } } }
/// <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); }
/// <summary> /// 弃一座房屋(没有则不弃) /// </summary> /// <param name="Player"></param> /// <param name="TargetPlayer"></param> /// <param name="Title"></param> public void ThrowHouse(PPlayer Player, PPlayer TargetPlayer, string Title) { if (TargetPlayer.HasHouse) { PBlock TargetBlock = null; if (Player.IsAI) { if (Player.TeamIndex == TargetPlayer.TeamIndex) { TargetBlock = PAiMapAnalyzer.MinValueHouse(this, TargetPlayer).Key; } else { TargetBlock = PAiMapAnalyzer.MaxValueHouse(this, TargetPlayer).Key; } } else { TargetBlock = PNetworkManager.NetworkServer.ChooseManager.AskToChooseBlock(Player, "[" + Title + "]选择" + TargetPlayer.Name + "的房屋", (PBlock Block) => TargetPlayer.Equals(Block.Lord) && Block.HouseNumber > 0); } if (TargetBlock != null) { PNetworkManager.NetworkServer.TellClients(new PHighlightBlockOrder(TargetBlock.Index.ToString())); LoseHouse(TargetBlock, 1); } } }
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); }
public List <PPlayer> AIEmitTargets(PGame Game, PPlayer Player) { return(new List <PPlayer>() { RoundExpect(Game, Player) >= 1000 && (Player.Defensor == null || !(Player.Defensor.Model is P_ChiiHsingPaao)) ? Player : null }); }
public PInjureTag(PPlayer FromPlayer, PPlayer ToPlayer, int Injure, PObject InjureSource) : base(TagName) { AppendField(FromPlayerFieldName, FromPlayer); AppendField(ToPlayerFieldName, ToPlayer); AppendField(InjureFieldName, Injure); AppendField(InjureSourceFieldName, InjureSource); }
public List <PPlayer> AIEmitTargets(PGame Game, PPlayer Player) { return(new List <PPlayer>() { FindTarget(Game, Player).Key }); }
public static List <PBlock> NextBlocks(PGame Game, PPlayer Player, PBlock StartBlock = null) { if (StartBlock == null) { StartBlock = Player.Position; } List <PBlock> Answer = new List <PBlock>(); PBlock Block = StartBlock; if (!Player.NoLadder) { Block = Block.NextBlock; } if (Player.Traffic != null && Player.Traffic.Model is P_ChiihTuu) { Block = Block.NextBlock; } if (Player.NoLadder) { Answer.Add(Block); } else { for (int i = 0; i < 6; ++i, Block = Block.NextBlock) { Answer.Add(Block); } } return(Answer); }