public override int AIInHandExpectation(PGame Game, PPlayer Player) { int Basic = 4000; int ShiQian = 0;// Game.Enemies(Player).FindAll((PPlayer _Player) => _Player.General is P_ShiQian).Count; Basic *= Game.Enemies(Player).Count - ShiQian; Basic /= Game.Enemies(Player).Count; return(Math.Max(Basic, base.AIInHandExpectation(Game, Player))); }
public List <PPlayer> AIEmitTargets(PGame Game, PPlayer Player) { PPlayer Target1 = PMath.Min(Game.Enemies(Player).FindAll((PPlayer _Player) => !_Player.HasEquipment <P_YooHsi>() && !(_Player.General is P_LiuJi)), (PPlayer _Player) => _Player.Money).Key; PPlayer Target2 = PMath.Min(Game.Enemies(Player).FindAll((PPlayer _Player) => !_Player.Equals(Target1) && !_Player.HasEquipment <P_YooHsi>() && !(_Player.General is P_LiuJi)), (PPlayer _Player) => _Player.Money).Key; return(new List <PPlayer>() { Target1, Target2 }); }
public static List <int> DirectionExpectations(PGame Game, PPlayer Player, PBlock Block) { /* * AI决策商业用地类型的机制: * 购物中心收益:2*(40%*max(1,20*建房次数上限/环长)+20%)*地价*敌方人数 * 研究所收益 :牌堆期望收益*2*己方人数 * 公园收益 :(max(1,20*建房次数上限/环长)*60%+50%)*地价 * 城堡收益 :(50%+敌方人数*20%)*赠送房屋数量*地价 * 当铺收益 :2000*己方人数 * * 特殊计算: * 杨玉环:研究所+4000 */ int RingLength = PAiMapAnalyzer.GetRingLength(Game, Block); int MaxOperationCount = Player.PurchaseLimit; int MikuBias = (Player.General is P_IzayoiMiku && Player.RemainLimit("轮舞曲")) ? 1 : 0; int ShoppingCenterExpectation = 2 * PMath.Percent(Block.Price, 40 * Math.Max(1, 20 * MaxOperationCount / RingLength) + 20) * Game.Enemies(Player).Count; int InsituteExpectation = 2000 * 2 * Game.Teammates(Player).Count; int ParkExpectation = PMath.Percent(Block.Price, 60 * Math.Max(1, 20 * MaxOperationCount / RingLength) + 50); int CastleExpectation = Game.Enemies(Player).Exists((PPlayer _Player) => _Player.Money > 3000 && _Player.Weapon != null && _Player.Weapon.Model is P_ToouShihChi) ? 0: PMath.Percent(Block.Price, 50 + 20 * Game.Enemies(Player).Count) * Game.GetBonusHouseNumberOfCastle(Player, Block); if (MikuBias == 1 && Game.GetBonusHouseNumberOfCastle(Player, Block) >= PMath.Max(Game.Map.BlockList.FindAll((PBlock _Block) => _Block.IsBusinessLand && _Block.Lord != null && _Block.Lord.TeamIndex == Player.TeamIndex).ConvertAll((PBlock _Block) => _Block.HouseNumber))) { CastleExpectation = PMath.Percent(Block.Price, 50 + 40 * Game.Enemies(Player).Count) * Game.GetBonusHouseNumberOfCastle(Player, Block); } int PawnshopExpectation = 2000 * Game.Teammates(Player).Count; int AltarExpectation = 1000 * 20 * 6 / RingLength * Game.Enemies(Player).Count; if (Player.General is P_YangYuHuan) { InsituteExpectation += 4000; } if (Player.General is P_Xdyu || Player.General is P_Gryu) { ShoppingCenterExpectation += 4000; } List <int> ExpectationList = new List <int>() { ShoppingCenterExpectation, InsituteExpectation, ParkExpectation, CastleExpectation, AltarExpectation }; return(ExpectationList); }
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); } }
public int AiChooseResult(PGame Game, PPlayer Player) { List <PPlayer> Enemies = Game.Enemies(Player); List <PPlayer> Teammates = Game.Teammates(Player); if (Teammates.Exists((PPlayer _Player) => _Player.Money <= 500)) { return(1); } else if (Enemies.Exists((PPlayer _Player) => _Player.Money <= 500)) { return(0); } else { if (Enemies.Count > Teammates.Count) { return(0); } else if (Enemies.Count < Teammates.Count) { return(1); } else { return(-1); } } }
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}; }
public override int AIInHandExpectation(PGame Game, PPlayer Player) { int Basic = Player.Area.HandCardArea.CardList.Exists((PCard Card) => Card.Type.IsEquipment()) ? 2000 : 0; int Test = 1000 * PMath.Max(Game.Enemies(Player), (PPlayer _Player) => _Player.Area.EquipmentCardArea.CardNumber).Value; Basic = Math.Max(Basic, Test); return(Math.Max(Basic, base.AIInHandExpectation(Game, Player))); }
private List <PPlayer> AIEmitTargets(PGame Game, PPlayer Player) { if (Player.Tags.ExistTag(P_WuZhao.NvQuanTag.Name) && Player.HasInHand <P_HunShuiMoYoo>()) { return(Game.Enemies(Player)); } return(Game.Teammates(Player)); }
public List <PPlayer> AIEmitTargets(PGame Game, PPlayer Player) { return(new List <PPlayer>() { PMath.Max(Game.Enemies(Player), (PPlayer _Player) => { return -PAiMapAnalyzer.OutOfGameExpect(Game, _Player); }, true).Key }); }
public override int AIInHandExpectation(PGame Game, PPlayer Player) { int Basic = PAiMapAnalyzer.MaxValueHouse(Game, Player).Value; Basic = Math.Max(1000, PMath.Max(Game.Enemies(Player), (PPlayer _Player) => { return(PAiMapAnalyzer.MaxValueHouse(Game, _Player).Value + Basic); }, true).Value); return(Math.Max(Basic, base.AIInHandExpectation(Game, Player))); }
public override int AIInHandExpectation(PGame Game, PPlayer Player) { int Basic = 3000; if (Game.Enemies(Player).Count < 2) { return(0); } return(Math.Max(Basic, base.AIInHandExpectation(Game, Player))); }
private KeyValuePair <PPlayer, int> FindTarget(PGame Game, PPlayer Player) { int Basic = PAiMapAnalyzer.MaxValueHouse(Game, Player).Value; return(PMath.Max(Game.Enemies(Player).FindAll((PPlayer _Player) => _Player.Area.EquipmentCardArea.CardNumber > 0), (PPlayer _Player) => { int HouseValue = _Player.HasHouse ? PAiMapAnalyzer.MaxValueHouse(Game, _Player).Value + Basic : 30000; int EquipValue = PMath.Max(_Player.Area.EquipmentCardArea.CardList, (PCard Card ) => Card.Model.AIInEquipExpectation(Game, _Player) + Card.Model.AIInHandExpectation(Game, Player)).Value; return Math.Min(HouseValue, EquipValue); }, true)); }
public override int AIInHandExpectation(PGame Game, PPlayer Player) { int Basic = 0; int OutOfGameExpect = PMath.Max(Game.Enemies(Player), (PPlayer _Player) => { return(-PAiMapAnalyzer.OutOfGameExpect(Game, _Player)); }, true).Value; Basic = Math.Max(Basic, OutOfGameExpect); return(Math.Max(Basic, base.AIInHandExpectation(Game, Player))); }
public override int AIInHandExpectation(PGame Game, PPlayer Player) { int Test = PMath.Max(Game.Enemies(Player), (PPlayer _Player) => { if (_Player.General is P_LiuJi) { return(0); } return(_Player.Area.HandCardArea.CardNumber / 2 * 2000 * 5 / 6); }).Value; int Base = 3500; int Basic = Math.Max(Base, Test); return(Math.Max(Basic, base.AIInHandExpectation(Game, Player))); }
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 }); }
public override int AIInHandExpectation(PGame Game, PPlayer Player) { int Basic = 0; if (Game.Enemies(Player).Count < 2) { if (Game.Teammates(Player).Count < 2) { Basic = 0; } Basic = 1000; } Basic = 6000; return(Math.Max(Basic, base.AIInHandExpectation(Game, Player))); }
public override int AIInHandExpectation(PGame Game, PPlayer Player) { int Basic = 1400; if (Player.General is P_LiuJi) { Basic = 2400; } int MinEnemyMoney = PMath.Min(Game.Enemies(Player), (PPlayer Test) => Test.Money).Value; if (MinEnemyMoney <= 1200) { Basic += 5000 * (7 - MinEnemyMoney / 200); } return(Math.Max(Basic, base.AIInHandExpectation(Game, Player))); }
public static int HouseValue(PGame Game, PPlayer Player, PBlock Block) { if (Block.Lord == null) { return(0); } int EnemyCount = Game.Enemies(Block.Lord).Count; int Value = PMath.Percent(Block.Price, 50 + 20 * EnemyCount * (Block.BusinessType.Equals(PBusinessType.ShoppingCenter) ? 2 : 1) * (Block.BusinessType.Equals(PBusinessType.Club) ? 2 : 1)); if (Player.TeamIndex == Block.Lord.TeamIndex) { return(Value); } else { return(-Value); } }
public override int AIInEquipExpectation(PGame Game, PPlayer Player) { int Base = 0; if (Player.General is P_ZhaoYun) { Base += 2000; } if (Player.Money <= 5000) { return(Base + 500); } else if (Player.Money <= 10000) { return(Base + 1000); } else { return(Base + 1200 * Game.Enemies(Player).Count); } }
public List <PPlayer> AIEmitTargets(PGame Game, PPlayer Player) { // 情况1:选择队友,当自己有多余的装备可以放在队友的空装备栏时且队友不会死时 // 情况2:选择敌人, // A、当可以杀死敌人时 // B、当可以换上更差的装备时 KeyValuePair <PPlayer, int> TeammateTarget = PMath.Max(Game.Teammates(Player, false), (PPlayer _Player) => { return(TeammateValueCard(Game, Player, _Player).Value); }, true); KeyValuePair <PPlayer, int> EnemyTarget = PMath.Max(Game.Enemies(Player), (PPlayer _Player) => { return(EnemyValueCard(Game, Player, _Player).Value); }, true); PPlayer Target = TeammateTarget.Value > EnemyTarget.Value ? TeammateTarget.Key : EnemyTarget.Key; return(new List <PPlayer>() { Target }); }
public override int AIInHandExpectation(PGame Game, PPlayer Player) { int Basic = 0; bool MultiTarget = AIEmitTargets(Game, Player).Count > 1; Game.Teammates(Player, false).ForEach((PPlayer _Player) => { KeyValuePair <PBlock, int> Test = PAiMapAnalyzer.MinValueHouse(Game, _Player); if (Test.Key != null && !(_Player.Defensor != null && _Player.Defensor.Model is P_YooHsi && MultiTarget)) { Basic -= Test.Value; } }); Game.Enemies(Player).ForEach((PPlayer _Player) => { KeyValuePair <PBlock, int> Test = PAiMapAnalyzer.MinValueHouse(Game, _Player); if (Test.Key != null && !(_Player.Defensor != null && _Player.Defensor.Model is P_YooHsi && MultiTarget)) { Basic += Test.Value; } }); Basic = Math.Max(Basic, 500); return(Math.Max(Basic, base.AIInHandExpectation(Game, Player))); }
public override int AIInEquipExpectation(PGame Game, PPlayer Player) { return(500 + Player.Money >= 10000 ? 0 : 2000 * Math.Abs(Game.Enemies(Player).Count - Game.Teammates(Player).Count)); }
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); }
public override int AIInEquipExpectation(PGame Game, PPlayer Player) { return(500 + 4000 * Game.Enemies(Player).FindAll((PPlayer _Player) => _Player.Area.HandCardArea.CardNumber == 0 || Player.General is P_IzayoiMiku).Count); }
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 override int AIInEquipExpectation(PGame Game, PPlayer Player) { return(6000 * Game.Enemies(Player).FindAll((PPlayer _Player ) => !_Player.Sex.Equals(Player.Sex)).Count / Math.Min(1, Game.Enemies(Player).Count)); }
public override int AIInEquipExpectation(PGame Game, PPlayer Player) { return(500 + 2000 * (int)PMath.Sum(Game.Enemies(Player).ConvertAll((PPlayer _Player) => (double)_Player.Area.EquipmentCardArea.CardNumber))); }
public override int AIInEquipExpectation(PGame Game, PPlayer Player) { return(1500 * Game.Enemies(Player).FindAll((PPlayer _Player) => !_Player.Age.Equals(Player.Age)).Count); }