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 PRefreshGeneralOrder(PPlayer Player) : this() { int SkillCount = Player.General.SkillList.Count; List <string> Answer = new List <string> { Player.Index.ToString(), Player.General.Name, SkillCount.ToString() }; for (int i = 0; i < SkillCount; ++i) { PSkill Skill = Player.General.SkillList[i]; Answer.Add(Skill.Name); if (Skill.SoftLockOpen) { if (Skill.Lock) { Answer.Add(PSkillType.SoftLock.Name); } else { Answer.Add(PSkillType.SoftLockUnlock.Name); } } else { if (Skill.Lock) { Answer.Add(PSkillType.Lock.Name); } else { if (Skill.Initiative) { if (Player.RemainLimitForAlivePlayers(Skill.Name, PNetworkManager.NetworkServer.Game) && Player.RemainLimit(Skill.Name, true)) { Answer.Add(PSkillType.Initiative.Name); } else { Answer.Add(PSkillType.InitiativeInactive.Name); } } else { Answer.Add(PSkillType.Passive.Name); } } } } args = Answer.ToArray(); }
public P_HuaMulan() : base("花木兰") { Sex = PSex.Female; Age = PAge.Renaissance; Index = 23; Cost = 20; Tips = "定位:爆发\n" + "难度:简单\n" + "史实:出自经典诗歌《木兰辞》。中国古代替父从军的女英雄。\n" + "攻略:\n花木兰是一名拥有不俗爆发能力的武将。【枭姬】的存在使得花木兰极度依赖装备牌,因此能够与唐寅、时迁等武将配合,同时也能够对这些武将形成强大的威慑力。【枭姬】往往能够提供绝地反杀的能力,或能使花木兰东山再起,因此在针对花木兰时必须注意其队伍的研究所或给牌武将,同时慎用【落凤弓】、【借刀杀人】等牌,从一定程度上来说提供了花木兰一定的防御力。【易装】是一个强大的爆发技能,不仅能与队友交换装备达成爆发,还能抢夺敌方的大量装备,形成局势逆转,因此可在一定程度上克制关羽。【易装】还可用来转换性别,从而使敌方的【百花裙】等装备失效。针对花木兰必须阻止其装备成形,因此吕蒙是一个不错的选择。"; PSkill XiaoJi = new PSkill("枭姬") { SoftLockOpen = true }; SkillList.Add(XiaoJi .AddTrigger((PPlayer Player, PSkill Skill) => { return(new PTrigger(XiaoJi.Name) { IsLocked = false, Player = Player, Time = PTime.Card.LeaveAreaTime, AIPriority = 200, Condition = (PGame Game) => { PMoveCardTag MoveCardTag = Game.TagManager.FindPeekTag <PMoveCardTag>(PMoveCardTag.TagName); return Player.Area.EquipmentCardArea.Equals(MoveCardTag.Source) && !Player.Equals(MoveCardTag.Destination.Owner); }, Effect = (PGame Game) => { XiaoJi.AnnouceUseSkill(Player); Game.GetCard(Player); Game.GetMoney(Player, 1500); } }); })); PPlayer YiZhuangTarget(PGame Game, PPlayer Player) { return(PMath.Max(Game.AlivePlayers(Player), (PPlayer TargetPlayer) => { int Profit = 0; PSex OriginalSex = Player.Sex; Player.Sex = PSex.Male; foreach (PCardType CardType in new PCardType[] { PCardType.WeaponCard, PCardType.DefensorCard, PCardType.TrafficCard }) { PCard Card = Player.GetEquipment(CardType); PCard TargetCard = TargetPlayer.GetEquipment(CardType); if (Card != null) { Profit += 2000; Profit -= Card.Model.AIInEquipExpectation(Game, Player); Profit += Card.Model.AIInEquipExpectation(Game, TargetPlayer) * (Player.TeamIndex == TargetPlayer.TeamIndex ? 1 : -1); } if (TargetCard != null) { Profit += TargetCard.Model.AIInEquipExpectation(Game, Player); Profit -= TargetCard.Model.AIInEquipExpectation(Game, TargetPlayer) * (Player.TeamIndex == TargetPlayer.TeamIndex ? 1 : -1); } } Player.Sex = OriginalSex; return Profit - 7500; }, true).Key); } PSkill YiZhuang = new PSkill("易装") { Initiative = true }; SkillList.Add(YiZhuang .AnnounceGameOnce() .AddTimeTrigger( new PTime[] { PPeriod.FirstFreeTime.During, PPeriod.SecondFreeTime.During }, (PTime Time, PPlayer Player, PSkill Skill) => { return(new PTrigger(YiZhuang.Name) { IsLocked = false, Player = Player, Time = Time, AIPriority = 280, CanRepeat = true, Condition = (PGame Game) => { return Player.Equals(Game.NowPlayer) && (Player.IsAI || Game.Logic.WaitingForEndFreeTime()) && Player.RemainLimit(YiZhuang.Name); }, AICondition = (PGame Game) => { if (Game.Teammates(Player).Exists((PPlayer _Player) => _Player.General is P_WuZhao)) { PPlayer _Player = Game.PlayerList.Find((PPlayer __Player) => __Player.General is P_WuZhao); if (_Player.RemainLimit("女权")) { return false; } else if (Player.Tags.ExistTag(P_WuZhao.NvQuanTag.Name)) { return false; } } return YiZhuangTarget(Game, Player) != null; }, Effect = (PGame Game) => { YiZhuang.AnnouceUseSkill(Player); PPlayer Target = null; if (Player.IsAI) { Target = YiZhuangTarget(Game, Player); } else { Target = PNetworkManager.NetworkServer.ChooseManager.AskForTargetPlayer(Player, PTrigger.Except(Player), YiZhuang.Name); } if (Target != null) { List <PCard> MulanEquipments = new List <PCard>(); foreach (PCard Card in Player.Area.EquipmentCardArea.CardList) { MulanEquipments.Add(Card); } List <PCard> TargetEquipements = new List <PCard>(); foreach (PCard Card in Target.Area.EquipmentCardArea.CardList) { TargetEquipements.Add(Card); } foreach (PCard Card in MulanEquipments) { Game.CardManager.MoveCard(Card, Player.Area.EquipmentCardArea, Game.CardManager.SettlingArea); } foreach (PCard Card in TargetEquipements) { Game.CardManager.MoveCard(Card, Target.Area.EquipmentCardArea, Game.CardManager.SettlingArea); } foreach (PCard Card in MulanEquipments) { Game.CardManager.MoveCard(Card, Game.CardManager.SettlingArea, Target.Area.EquipmentCardArea); } foreach (PCard Card in TargetEquipements) { Game.CardManager.MoveCard(Card, Game.CardManager.SettlingArea, Player.Area.EquipmentCardArea); } Player.Sex = PSex.Male; Player.Tags.CreateTag(new PTag(YiZhuang.Name)); YiZhuang.DeclareUse(Player); } } }); })); }
public static bool XianJuTest(PGame Game, PPlayer Player) { string XianJu = "闲居"; // 依据闲居,优化使用伤害类计策牌的条件 if (Player.General is P_PanYue && Game.NowPlayer.Equals(Player)) { if (!Game.NowPeriod.IsAfter(PPeriod.WalkingStage)) { List <PBlock> NextBlocks = PAiMapAnalyzer.NextBlocks(Game, Player); return(NextBlocks.Exists((PBlock Block) => Block.Lord != null && Block.Lord.TeamIndex != Player.TeamIndex && Block.Toll >= Player.Money) || !NextBlocks.Exists((PBlock Block) => Block.Lord != null && Block.Lord.TeamIndex == Player.TeamIndex) || !Player.RemainLimit(XianJu)); } else { return(Player.Position.Lord == null || Player.Position.Lord.TeamIndex != Player.TeamIndex || Player.Money <= 2000 || !Player.RemainLimit(XianJu)); } } return(true); }
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); }