public void PurchaseLand(PPlayer Player, PBlock Block) { PPurchaseLandTag PurchaseLandTag = Monitor.CallTime(PTime.PurchaseLandTime, new PPurchaseLandTag(Player, Block)); Player = PurchaseLandTag.Player; Block = PurchaseLandTag.Block; int LandPrice = PurchaseLandTag.LandPrice; if (Player != null && Block != null && Player.IsAlive) { LoseMoney(Player, LandPrice); Block.Lord = Player; GetHouse(Block, 1); PNetworkManager.NetworkServer.TellClients(new PRefreshBlockBasicOrder(Block)); if (Block.IsBusinessLand && Block.BusinessType.Equals(PBusinessType.NoType)) { PBusinessType ChosenType = PBusinessType.NoType; List <PBusinessType> Types = new List <PBusinessType>() { PBusinessType.ShoppingCenter, PBusinessType.Institute, PBusinessType.Altar, PBusinessType.Castle, PBusinessType.Park }; if (Player.IsUser) { ChosenType = Types[PNetworkManager.NetworkServer.ChooseManager.Ask(Player, "选择商业用地的发展方向", Types.ConvertAll((PBusinessType BusinessType) => BusinessType.Name).ToArray(), Types.ConvertAll((PBusinessType BusinessType) => BusinessType.ToolTip).ToArray())]; } else { ChosenType = PAiBusinessChooser.ChooseDirection(this, Player, Block); } Block.BusinessType = ChosenType; if (ChosenType.Equals(PBusinessType.Park)) { GetMoney(Player, PMath.Percent(Block.Price, 50)); } else if (ChosenType.Equals(PBusinessType.Castle)) { GetHouse(Block, GetBonusHouseNumberOfCastle(Player, Block)); } PNetworkManager.NetworkServer.TellClients(new PRefreshBlockBasicOrder(Block)); } else { Block.BusinessType = PBusinessType.NoType; } PNetworkManager.NetworkServer.TellClients(new PShowInformationOrder(Player.Name + "购买了" + Block.Name)); } }
public static int Expect(PGame Game, PPlayer Player, PBlock Block, bool InPortal = false) { int DeltaMoney = 0; int Disaster = Block.GetMoneyStopSolid; if (Disaster < 0 && -Disaster <= 1000 && Player.Traffic != null && Player.Traffic.Model is P_NanManHsiang) { Disaster = 0; } else if (Disaster < 0 && Player.Defensor != null && Player.Defensor.Model is P_YinYangChing) { Disaster = 0; } DeltaMoney += Disaster; Disaster = PMath.Percent(Player.Money, Block.GetMoneyStopPercent); if (Disaster < 0 && -Disaster <= 1000 && Player.Traffic != null && Player.Traffic.Model is P_NanManHsiang) { Disaster = 0; } else if (Disaster < 0 && Player.Defensor != null && Player.Defensor.Model is P_YinYangChing) { Disaster = 0; } DeltaMoney += Disaster; if (Block.Lord != null && Block.Lord.TeamIndex != Player.TeamIndex) { int Toll = Block.Toll; if (Block.BusinessType.Equals(PBusinessType.ShoppingCenter)) { Toll *= 2; } if (Block.BusinessType.Equals(PBusinessType.Club)) { Toll += PMath.Percent(Toll, 100); } if (Block.Lord.Weapon != null && Block.Lord.Weapon.Model is P_KuTingTao && Player.Area.HandCardArea.CardNumber == 0) { Toll *= 2; } if (Toll <= 1000 && Player.Traffic != null && Player.Traffic.Model is P_NanManHsiang) { Toll = 0; } DeltaMoney -= Toll; } if (Player.Money + DeltaMoney <= 0) { return(-30000 + DeltaMoney * 2); } else if (Player.Money <= 3000) { DeltaMoney *= 2; } DeltaMoney += 2000 * Block.GetCardStop; int LandValue = 0; if (Block.Lord == null && Block.Price < Player.Money) { LandValue = PMath.Percent(Block.Price, 10) * Game.Enemies(Player).Count; if (Block.IsBusinessLand) { LandValue += PMath.Max(PAiBusinessChooser.DirectionExpectations(Game, Player, Block)); } } else if (Player.Equals(Block.Lord)) { int PurchaseLimit = Player.PurchaseLimit; LandValue += PMath.Percent(Block.Price, 20) * Game.Enemies(Player).Count *PurchaseLimit; if (Block.BusinessType.Equals(PBusinessType.Park)) { LandValue += PMath.Percent(Block.Price, 60) * PurchaseLimit; } else if (Block.BusinessType.Equals(PBusinessType.ShoppingCenter) || Block.BusinessType.Equals(PBusinessType.Club)) { LandValue += PMath.Percent(Block.Price, 20) * Game.Enemies(Player).Count *PurchaseLimit; } if (Player.General is P_YangYuHuan) { LandValue += P_ShunShouChiienYang.AIExpect(Game, Player, 0).Value; } } if (Block.Lord != null && Block.Lord.TeamIndex == Player.TeamIndex) { if (Block.BusinessType.Equals(PBusinessType.Institute)) { LandValue += 2 * 2000; } else if (Block.BusinessType.Equals(PBusinessType.Pawnshop)) { LandValue += 2000; } if (Player.General is P_PanYue && (Block.PortalBlockList.Count == 0 || InPortal)) { if (!Player.Equals(Game.NowPlayer) || Player.RemainLimit("闲居")) { LandValue += PMath.Percent(Block.Price, 20 * Game.Enemies(Player).Count + 50); } } } int PortalValue = 0; if (!InPortal && Block.PortalBlockList.Count > 0) { PortalValue = PMath.Max(Block.PortalBlockList, (PBlock _Block) => Expect(Game, Player, _Block, true)).Value; } return(DeltaMoney + LandValue * 20 / GetRingLength(Game, Block) + PortalValue); }
public static int ChangeFaceExpect(PGame Game, PPlayer Player, PBlock Start = null) { if (Start == null) { Start = Player.Position; } int Value = 0; List <PBlock> Blocks = NextBlocks(Game, Player); foreach (PBlock Block in Blocks) { int DeltaMoney = 0; int Disaster = Block.GetMoneyStopSolid; if (Disaster < 0 && -Disaster <= 1000 && Player.Traffic != null && Player.Traffic.Model is P_NanManHsiang) { Disaster = 0; } else if (Disaster < 0 && Player.Defensor != null && Player.Defensor.Model is P_YinYangChing) { Disaster = 0; } DeltaMoney += Disaster; Disaster = PMath.Percent(Player.Money, Block.GetMoneyStopPercent); if (Disaster < 0 && -Disaster <= 1000 && Player.Traffic != null && Player.Traffic.Model is P_NanManHsiang) { Disaster = 0; } else if (Disaster < 0 && Player.Defensor != null && Player.Defensor.Model is P_YinYangChing) { Disaster = 0; } DeltaMoney += Disaster; if (Block.Lord != null && Block.Lord.TeamIndex != Player.TeamIndex) { int Toll = Block.Toll; if (Block.BusinessType.Equals(PBusinessType.ShoppingCenter)) { Toll *= 2; } if (Block.BusinessType.Equals(PBusinessType.Club)) { Toll += PMath.Percent(Toll, 100); } if (Block.Lord.Weapon != null && Block.Lord.Weapon.Model is P_KuTingTao && Player.Area.HandCardArea.CardNumber == 0) { Toll *= 2; } if (Toll <= 1000 && Player.Traffic != null && Player.Traffic.Model is P_NanManHsiang) { Toll = 0; } DeltaMoney -= Toll; } if (-DeltaMoney >= Player.Money) { Value = 1000 * Blocks.Count; break; } else if (Block.Lord == null && Block.Price < Player.Money) { int LandValue = PMath.Percent(Block.Price, 10) * Game.Enemies(Player).Count; if (Block.IsBusinessLand) { LandValue += PMath.Max(PAiBusinessChooser.DirectionExpectations(Game, Player, Block)); } Value -= LandValue; } } Value /= Blocks.Count; Value *= (Player.BackFace ? -1 : 1); // 陈胜特殊处理 if (Player.General is P_ChenSheng) { int CurrentValue = StartFromExpect(Game, Player, Player.Position, 0, false); int MaxValue = PMath.Max(new List <int> { 1, 2, 3, 4, 5, 6 }, (int ChenShengStep) => StartFromExpect(Game, Player, Game.Map.NextStepBlock(Player.Position, ChenShengStep), 0, false)).Value - CurrentValue; Value += 2000 + MaxValue; } return(Value); }