private KeyValuePair <PCard, int> TeammateValueCard(PGame Game, PPlayer Player, PPlayer _Player) { return(PMath.Max(Player.Area.HandCardArea.CardList.FindAll((PCard Card) => Card.Type.IsEquipment()), (PCard Card) => { int New = Card.Model.AIInEquipExpectation(Game, _Player); PCard CurrentEquip = _Player.GetEquipment(Card.Type); int Current = CurrentEquip == null ? 0 : CurrentEquip.Model.AIInEquipExpectation(Game, _Player); int Delta = (_Player.Area.EquipmentCardArea.CardNumber + (CurrentEquip == null ? 1 : 0)) * 500; return New - Current + PAiTargetChooser.InjureExpect(Game, Player, Player, _Player, Delta, Instantiate()) + Math.Max(0, PAiCardExpectation.FindMostValuableToGet(Game, Player, _Player).Value); })); }
public P_HunShuiMoYoo() : base(CardName) { Point = 4; Index = 20; foreach (PTime Time in new PTime[] { PTime.Card.EndSettleTime }) { 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 >= 2; }, AICondition = (PGame Game) => { if (Player.General is P_WuZhao && Player.RemainLimit(PSkillInfo.女权.Name)) { return false; } int Value = 0; PUseCardTag UseCardTag = Game.TagManager.FindPeekTag <PUseCardTag>(PUseCardTag.TagName); UseCardTag.TargetList.ForEach((PPlayer _Player) => { if (_Player.CanBeInjured && !(_Player.Defensor != null && _Player.Defensor.Model is P_YooHsi)) { Value += PAiTargetChooser.InjureExpect(Game, Player, Player, _Player, 500, Card); } }); return Value >= 1000 && !Player.OutOfGame && P_PanYue.XianJuTest(Game, Player); }, Effect = MakeNormalEffect(Player, Card, AIEmitTargets, AIEmitTargets, (PGame Game, PPlayer User, PPlayer Target) => { Game.Injure(User, Target, 500, Card); }) }); }); } }
public P_KuanMevnChoTsev() : base(CardName) { Point = 4; Index = 22; 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 = 80, Condition = (PGame Game) => { return Player.Equals(Game.NowPlayer) && (Player.IsAI || Game.Logic.WaitingForEndFreeTime()) && AIEmitTargets(Game, Player).Count > 0; }, AICondition = (PGame Game) => { if (Player.General is P_WuZhao && Player.RemainLimit(PSkillInfo.女权.Name)) { return false; } List <PPlayer> Targets = AIEmitTargets(Game, Player); bool MultiTarget = Targets.Count > 1; Targets = Targets.FindAll((PPlayer _Player) => !(_Player.HasEquipment <P_YooHsi>() && MultiTarget)); return PMath.Sum(Targets.ConvertAll((PPlayer Target) => (double)PAiTargetChooser.InjureExpect(Game, Player, Player, Target, 1000, Card))) >= 2000 && P_PanYue.XianJuTest(Game, Player); }, Effect = MakeNormalEffect(Player, Card, AIEmitTargets, AIEmitTargets, (PGame Game, PPlayer User, PPlayer Target) => { Game.Injure(User, Target, 1000, Card); }) }); }); } }
public P_YuJi() : base("虞姬") { Sex = PSex.Female; Age = PAge.Classic; Index = 13; Cost = 15; Tips = "定位:攻击\n" + "难度:简单\n" + "史实:楚汉相争时期,西楚霸王项羽的美人,项羽曾为其作《垓下歌》。\n" + "攻略:\n虞姬是一个依赖于手牌的武将,所以研究所是她和她的队友的优先选择。对于虞姬而言,如何较为准确地衡量手牌的价值是一个比较困难的问题。对于两张点数不同的牌,两张牌自身的价值有高有低,两张牌用来【剑舞】的价值也有高有低,使用什么牌来【剑舞】,是虞姬玩家水平分别的体现。\n" + "通常,虞姬玩家可以弃掉自己不需要的装备、伏兵和难以发挥积极作用的【擒贼擒王】、【假痴不癫】、【空城计】等牌发动【剑舞】。虞姬玩家也可以在手上存留很多牌,当与敌人近身接触时,把所有牌都用来【剑舞】,造成巨大的输出,以求直接杀死对手。"; PSkill JianWu = new PSkill("剑舞") { Initiative = true }; KeyValuePair <PCard, int> JianWuTest(PGame Game, PPlayer Player) { KeyValuePair <PCard, int> Answer = new KeyValuePair <PCard, int>(null, 0); for (int i = 1; i <= 6; ++i) { int Expect = (int)PMath.Sum(Game.AlivePlayers().FindAll((PPlayer _Player) => { return(!_Player.Equals(Player) && _Player.Distance(Player) <= i); }).ConvertAll((PPlayer _Player) => { return((double)PAiTargetChooser.InjureExpect(Game, Player, Player, _Player, 800, JianWu)); })); KeyValuePair <PCard, int> Test = PMath.Max(Player.Area.HandCardArea.CardList.FindAll((PCard Card) => Card.Point == i), (PCard Card) => { return(Expect - Card.Model.AIInHandExpectation(Game, Player)); }, true); if (Test.Value > Answer.Value) { Answer = Test; } } return(Answer); } SkillList.Add(JianWu .AddTimeTrigger( new PTime[] { PPeriod.FirstFreeTime.During, PPeriod.SecondFreeTime.During }, (PTime Time, PPlayer Player, PSkill Skill) => { return(new PTrigger(JianWu.Name) { IsLocked = false, Player = Player, Time = Time, AIPriority = 190, CanRepeat = true, Condition = (PGame Game) => { return Player.Equals(Game.NowPlayer) && (Player.IsAI || Game.Logic.WaitingForEndFreeTime()) && Player.Area.HandCardArea.CardNumber > 0; }, AICondition = (PGame Game) => { return JianWuTest(Game, Player).Key != null; }, Effect = (PGame Game) => { JianWu.AnnouceUseSkill(Player); PCard TargetCard = null; if (Player.IsAI) { TargetCard = JianWuTest(Game, Player).Key; PNetworkManager.NetworkServer.TellClients(new PShowInformationOrder(Player.Name + "弃置了" + Player.Name + "的" + TargetCard.Name)); Game.CardManager.MoveCard(TargetCard, Player.Area.HandCardArea, Game.CardManager.ThrownCardHeap); } else { TargetCard = Game.ThrowCard(Player, Player, true, false); } if (TargetCard != null) { Game.Traverse((PPlayer _Player) => { if (!_Player.Equals(Player) && _Player.Distance(Player) <= TargetCard.Point) { Game.Injure(Player, _Player, 800, JianWu); } }, Player); } } }); })); }
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); } }); }
public P_LvZhi() : base("吕雉") { Sex = PSex.Female; Age = PAge.Classic; Index = 29; Cost = 30; NewGeneral = true; Tips = "定位:攻击\n" + "难度:简单\n" + "史实:汉高祖刘邦的皇后,惠帝、二少帝时的皇太后。统治时期实行与民休息的政策,为文景之治奠定了基础。\n" + "攻略:\n-"; PSkill ZhenSha = new PSkill("鸩杀") { Initiative = true }; PPlayer ZhenShaTarget(PGame Game, PPlayer Player) { List <PPlayer> PossibleTargets = Game.AlivePlayers(Player).FindAll((PPlayer _Player) => _Player.Distance(Player) <= 1); PPlayer Target = PMath.Max(PossibleTargets, (PPlayer _Player) => { int InjureValue = PAiTargetChooser.InjureExpect(Game, Player, Player, _Player, ZhenShaInjure, ZhenSha); if (_Player.TeamIndex == Player.TeamIndex) { KeyValuePair <PCard, int> MaxValueCard = PAiCardExpectation.FindMostValuable(Game, _Player, Player, true, false, false, true); int MaxValue = MaxValueCard.Value - MaxValueCard.Key.AIInHandExpectation(Game, Player); return(MaxValue + InjureValue); } else { KeyValuePair <PCard, int> MinValueCard = PAiCardExpectation.FindLeastValuable(Game, _Player, Player, true, false, false, true); int MinValue = MinValueCard.Value + MinValueCard.Key.AIInHandExpectation(Game, Player); return(-MinValue + InjureValue); } }, true).Key; return(Target); } SkillList.Add(ZhenSha .AnnounceTurnOnce() .AddTimeTrigger( new PTime[] { PPeriod.FirstFreeTime.During, PPeriod.SecondFreeTime.During }, (PTime Time, PPlayer Player, PSkill Skill) => { return(new PTrigger(ZhenSha.Name) { IsLocked = false, Player = Player, Time = Time, AIPriority = 40, CanRepeat = true, Condition = (PGame Game) => { return Player.Equals(Game.NowPlayer) && (Player.IsAI || Game.Logic.WaitingForEndFreeTime()) && Player.RemainLimit(ZhenSha.Name) && Player.Area.HandCardArea.CardNumber > 0 && Game.AlivePlayers(Player).Exists((PPlayer _Player) => _Player.Distance(Player) <= 1); }, AICondition = (PGame Game) => { return ZhenShaTarget(Game, Player) != null; }, Effect = (PGame Game) => { ZhenSha.AnnouceUseSkill(Player); PPlayer Target = null; if (Player.IsAI) { Target = ZhenShaTarget(Game, Player); } else { Target = PNetworkManager.NetworkServer.ChooseManager.AskForTargetPlayer(Player, (PGame _Game, PPlayer _Player) => _Player.Distance(Player) <= 1 && !_Player.Equals(Player), ZhenSha.Name, true); } if (Target != null) { Game.GiveCardTo(Player, Target, true, false); Game.Injure(Player, Target, 1500, ZhenSha); ZhenSha.DeclareUse(Player); } } }); })); PSkill XuMou = new PSkill("蓄谋") { Lock = true }; SkillList.Add(XuMou .AddTrigger( (PPlayer Player, PSkill Skill) => { return(new PTrigger(XuMou.Name) { IsLocked = true, Player = Player, Time = PTime.LeaveDyingTime, AIPriority = 100, Condition = (PGame Game) => { PDyingTag DyingTag = Game.TagManager.FindPeekTag <PDyingTag>(PDyingTag.TagName); return Player.Equals(DyingTag.Killer) && !Player.Equals(DyingTag.Player); }, Effect = (PGame Game) => { XuMou.AnnouceUseSkill(Player); PDyingTag DyingTag = Game.TagManager.FindPeekTag <PDyingTag>(PDyingTag.TagName); DyingTag.Player.Money = 0; Game.Die(DyingTag.Player, DyingTag.Killer); } }); })); }
public P_HeShen() : base("和珅") { Sex = PSex.Male; Age = PAge.Industrial; Index = 24; Cost = 30; Tips = "定位:防御\n" + "难度:简单\n" + "史实:清朝中期权臣,中国历史上有名的巨贪,聚敛了约十亿两白银的巨大财富。\n" + "攻略:\n和珅是一名拥有不错防御力的武将。【贪污】使和珅的起始资金变相增加,而【受贿】可用于关键击杀,但一般都用于辅助队友。和珅的技能使用基本没有任何难度,因此十分适合新手使用。"; PSkill TanWu = new PSkill("贪污") { Lock = true }; SkillList.Add(TanWu .AddTrigger( (PPlayer Player, PSkill Skill) => { return(new PTrigger(TanWu.Name) { IsLocked = true, Player = Player, Time = PTime.PurchaseLandTime, Condition = (PGame Game) => { PPurchaseLandTag PurchaseLandTag = Game.TagManager.FindPeekTag <PPurchaseLandTag>(PPurchaseLandTag.TagName); return Player.Equals(PurchaseLandTag.Player); }, Effect = (PGame Game) => { TanWu.AnnouceUseSkill(Player); PPurchaseLandTag PurchaseLandTag = Game.TagManager.FindPeekTag <PPurchaseLandTag>(PPurchaseLandTag.TagName); PurchaseLandTag.LandPrice = PMath.Percent(PurchaseLandTag.LandPrice, 50); } }); }) .AddTrigger( (PPlayer Player, PSkill Skill) => { return(new PTrigger(TanWu.Name) { IsLocked = true, Player = Player, Time = PTime.PurchaseHouseTime, Condition = (PGame Game) => { PPurchaseHouseTag PurchaseHouseTag = Game.TagManager.FindPeekTag <PPurchaseHouseTag>(PPurchaseHouseTag.TagName); return Player.Equals(PurchaseHouseTag.Player); }, Effect = (PGame Game) => { TanWu.AnnouceUseSkill(Player); PPurchaseHouseTag PurchaseHouseTag = Game.TagManager.FindPeekTag <PPurchaseHouseTag>(PPurchaseHouseTag.TagName); PurchaseHouseTag.HousePrice = PMath.Percent(PurchaseHouseTag.HousePrice, 50); } }); })); PSkill ShouHui = new PSkill("受贿") { Initiative = true }; int ShouHuiExpect(PGame Game, PPlayer Player) { int Sum = 0; int Cnt = 0; foreach (PBlock Block in PAiMapAnalyzer.NextBlocks(Game, Player)) { if (Block.CanPurchase && Block.Lord == null) { Sum += Block.Price; Cnt++; } else if (Player.Equals(Block.Lord)) { Sum += Block.HousePrice; Cnt++; } } if (Cnt == 0) { return(-1); } else { return(Sum / Cnt); } } PPlayer ShouHuiTarget(PGame Game, PPlayer Player) { foreach (PPlayer Target in Game.Teammates(Player)) { if (ShouHuiExpect(Game, Target) >= 1500 && Target.Money >= 2000 && Player.RemainLimit(ShouHui.Name, Target)) { return(Target); } } foreach (PPlayer Target in Game.Enemies(Player)) { if (Player.RemainLimit(ShouHui.Name, Target)) { int Expect = ShouHuiExpect(Game, Target); if (Expect < 0) { Expect = 3000; // 无法判断下次购买土地或房屋的收益 } Expect -= PAiTargetChooser.InjureExpect(Game, Player, Player, Target, 1000, ShouHui); if (Expect <= -1000) { return(Target); } } } return(null); } SkillList.Add(ShouHui .AnnounceEachPlayerOnce() .AddTimeTrigger( new PTime[] { PPeriod.FirstFreeTime.During, PPeriod.SecondFreeTime.During }, (PTime Time, PPlayer Player, PSkill Skill) => { return(new PTrigger(ShouHui.Name) { IsLocked = false, Player = Player, Time = Time, AIPriority = 10, CanRepeat = true, Condition = (PGame Game) => { return Player.Equals(Game.NowPlayer) && (Player.IsAI || Game.Logic.WaitingForEndFreeTime()) && Game.AlivePlayers().Exists((PPlayer _Player) => Player.RemainLimit(ShouHui.Name, _Player)); }, AICondition = (PGame Game) => { return ShouHuiTarget(Game, Player) != null; }, Effect = (PGame Game) => { ShouHui.AnnouceUseSkill(Player); PPlayer Target = null; if (Player.IsAI) { Target = ShouHuiTarget(Game, Player); } else { Target = PNetworkManager.NetworkServer.ChooseManager.AskForTargetPlayer(Player, (PGame _Game, PPlayer _Player) => Player.RemainLimit(ShouHui.Name, _Player), ShouHui.Name, true); } if (Target != null) { Game.Injure(Player, Target, 1000, ShouHui); Target.Tags.CreateTag(new PShouHuiTag()); ShouHui.DeclareUseFor(Player, Target); } } }); }) .AddTrigger( (PPlayer Player, PSkill Skill) => { return(new PTrigger(ShouHui.Name) { IsLocked = true, Player = null, Time = PTime.PurchaseLandTime, Condition = (PGame Game) => { PPurchaseLandTag PurchaseLandTag = Game.TagManager.FindPeekTag <PPurchaseLandTag>(PPurchaseLandTag.TagName); return PurchaseLandTag.Player.Tags.ExistTag(PShouHuiTag.TagName); }, Effect = (PGame Game) => { PPurchaseLandTag PurchaseLandTag = Game.TagManager.FindPeekTag <PPurchaseLandTag>(PPurchaseLandTag.TagName); PurchaseLandTag.LandPrice = 0; ShouHui.AnnouceUseSkill(PurchaseLandTag.Player); PurchaseLandTag.Player.Tags.PopTag <PShouHuiTag>(PShouHuiTag.TagName); } }); }) .AddTrigger( (PPlayer Player, PSkill Skill) => { return(new PTrigger(ShouHui.Name) { IsLocked = true, Player = null, Time = PTime.PurchaseHouseTime, Condition = (PGame Game) => { PPurchaseHouseTag PurchaseHouseTag = Game.TagManager.FindPeekTag <PPurchaseHouseTag>(PPurchaseHouseTag.TagName); return PurchaseHouseTag.Player.Tags.ExistTag(PShouHuiTag.TagName); }, Effect = (PGame Game) => { PPurchaseHouseTag PurchaseHouseTag = Game.TagManager.FindPeekTag <PPurchaseHouseTag>(PPurchaseHouseTag.TagName); PurchaseHouseTag.HousePrice = 0; ShouHui.AnnouceUseSkill(PurchaseHouseTag.Player); PurchaseHouseTag.Player.Tags.PopTag <PShouHuiTag>(PShouHuiTag.TagName); } }); })); }
/// <summary> /// 将一个玩家移出游戏对其的收益,无卡牌收益嵌套 /// </summary> /// <param name="Game"></param> /// <param name="Player"></param> /// <param name="Including">是否包含其行走阶段</param> /// <returns></returns> public static int OutOfGameExpect(PGame Game, PPlayer Player, bool Including = false, bool IncludingOnly = false) { if (Player.OutOfGame) { return(0); } int Sum = 0; // 一轮其他角色可能造成的过路费收益总和的相反数 if (!IncludingOnly) { PPlayer _Player = Game.NowPlayer; if (Player.Equals(Game.NowPlayer)) { _Player = Game.GetNextPlayer(_Player); } for (; !_Player.Equals(Player); _Player = Game.GetNextPlayer(_Player)) { if (_Player.Equals(Game.NowPlayer) && Game.NowPeriod.IsAfter(PPeriod.WalkingStage)) { continue; } int Temp = 0; List <PBlock> Blocks = NextBlocks(Game, _Player); Blocks.ForEach((PBlock Block) => { int BlockTemp = 0; if (Block.Lord != null && Player.Equals(Block.Lord)) { BlockTemp = Math.Max(0, PAiTargetChooser.InjureExpect(Game, Player, Player, _Player, Block.Toll, Block)); } if (_Player.General is P_Newton) { PBlock PossibleBlock = Game.Map.NextStepBlock(Block, P_Newton.Grx_Next(Game, _Player.Position).Value); if (PossibleBlock.Lord != null && Player.Equals(PossibleBlock.Lord)) { BlockTemp = Math.Min(BlockTemp, Math.Max(0, PAiTargetChooser.InjureExpect(Game, Player, Player, _Player, Block.Toll, Block))); } else { BlockTemp = 0; } } Temp -= BlockTemp; }); Sum += Temp / Math.Max(1, Blocks.Count); } } int SumSelf = 0; if (Including) { List <PBlock> Blocks = NextBlocks(Game, Player); Blocks.ForEach((PBlock Block) => { int BlockTemp = 0; if (Block.Lord != null && Player.TeamIndex != Block.Lord.TeamIndex) { BlockTemp = Math.Max(0, -PAiTargetChooser.InjureExpect(Game, Player, Block.Lord, Player, Block.Toll, Block)); } if (Player.General is P_Newton) { PBlock PossibleBlock = Game.Map.NextStepBlock(Block, P_Newton.Grx_Next(Game, Player.Position).Value); if (PossibleBlock.Lord != null && Player.TeamIndex != PossibleBlock.Lord.TeamIndex) { BlockTemp = Math.Max(BlockTemp, Math.Max(0, -PAiTargetChooser.InjureExpect(Game, Player, Block.Lord, Player, Block.Toll, Block))); } else { BlockTemp = 0; } } SumSelf += BlockTemp; }); SumSelf /= Math.Max(1, Blocks.Count); } return(Sum + SumSelf); }
public P_Washington() : base("华盛顿") { Sex = PSex.Male; Age = PAge.Renaissance; Index = 27; Cost = 30; Tips = "定位:攻击\n" + "难度:困难\n" + "史实:美国政治家、军事家、革命家,首任总统,美国开国元勋之一,在美国独立战争中任大陆军的总司令。华盛顿主持起草了《独立宣言》,制定美国宪法,领导创立并完善了共和政体。\n" + "攻略:\n华盛顿每局游戏可以发动两次无损技能,所以技能发动时机是关键。由于每名其他角色可以选择两个选项,所以华盛顿对对方只有两种可能性,一种是通过对方没有手牌来迫使对方承受高伤害,一种是通过对方有高伤害风险迫使对方承受所有手牌的损失。其中前者比较常见。虽然华盛顿的技能是全体范围,但发动的条件苛刻且转瞬即逝,通常如果能对其中一个敌人有巨大收益已经实属不易,所以第一次发动应该果断一些,不强求同时威胁多个敌人,第二次可以作为威慑适当保留。"; NewGeneral = true; PSkill MinZhu = new PSkill("民主") { Initiative = true }; const int MinZhuCof = 800; SkillList.Add(MinZhu .AnnounceGameTimes(2) .AddTimeTrigger( new PTime[] { PPeriod.FirstFreeTime.During, PPeriod.SecondFreeTime.During }, (PTime Time, PPlayer Player, PSkill Skill) => { return(new PTrigger(MinZhu.Name) { IsLocked = false, Player = Player, Time = Time, AIPriority = 20, CanRepeat = true, Condition = (PGame Game) => { return Player.Equals(Game.NowPlayer) && (Player.IsAI || Game.Logic.WaitingForEndFreeTime()) && Player.RemainLimit(MinZhu.Name) && !Player.Tags.ExistTag(PElectronTag.TagName); }, AICondition = (PGame Game) => { int Sum = 0; Game.AlivePlayers(Player).ForEach((PPlayer _Player) => { int Cof = _Player.TeamIndex == Player.TeamIndex ? 1 : -1; int Expect1 = 2000 * Cof + PAiTargetChooser.InjureExpect(Game, Player, Player, _Player, MinZhuCof * _Player.Position.HouseNumber, MinZhu); int Expect2 = -2000 * _Player.Area.HandCardArea.CardNumber * Cof; if (_Player.Area.HandCardArea.CardNumber >= 1 && (Expect2 < Expect1 ^ Cof == 1)) { Sum += Expect2; } else { Sum += Expect1; } }); return Sum >= 1300 * (Game.AlivePlayerNumber - 1); }, Effect = (PGame Game) => { MinZhu.AnnouceUseSkill(Player); Game.Traverse((PPlayer _Player) => { if (!_Player.Equals(Player)) { int ChosenResult = 0; if (_Player.Area.HandCardArea.CardNumber >= 1) { if (_Player.IsAI) { int Expect1 = 2000 + PAiTargetChooser.InjureExpect(Game, _Player, Player, _Player, MinZhuCof * _Player.Position.HouseNumber, MinZhu); int Expect2 = 0; _Player.Area.HandCardArea.CardList.ForEach((PCard Card) => { Expect2 -= Card.Model.AIInHandExpectation(Game, _Player); }); if (Expect2 >= Expect1) { ChosenResult = 1; } } else { ChosenResult = PNetworkManager.NetworkServer.ChooseManager.Ask(_Player, MinZhu.Name + "-选择一项", new string[] { "令" + Player.Name + "对你造成" + (MinZhuCof * _Player.Position.HouseNumber).ToString() + "点伤害,摸一张牌", "弃置所有手牌" }); } } if (ChosenResult == 0) { Game.Injure(Player, _Player, MinZhuCof * _Player.Position.HouseNumber, MinZhu); if (_Player.IsAlive) { Game.GetCard(_Player); } } else { for (int i = _Player.Area.HandCardArea.CardNumber - 1; i >= 0; --i) { Game.CardManager.MoveCard(_Player.Area.HandCardArea.CardList[i], _Player.Area.HandCardArea, Game.CardManager.ThrownCardHeap); } } } }, Player); MinZhu.DeclareUse(Player); if (Player.RemainLimit(MinZhu.Name)) { Player.Tags.CreateTag(new PElectronTag()); } } }); }) .AddTrigger((PPlayer Player, PSkill Skill) => { return(new PTrigger(MinZhu.Name) { IsLocked = true, Player = Player, Time = PPeriod.EndTurn.During, Condition = (PGame Game) => { return Player.Equals(Game.NowPlayer) && Player.Tags.ExistTag(PElectronTag.TagName); }, Effect = (PGame Game) => { if (--Player.Tags.FindPeekTag <PElectronTag>(PElectronTag.TagName).Value <= 0) { Player.Tags.PopTag <PElectronTag>(PElectronTag.TagName); } PNetworkManager.NetworkServer.TellClients(new PRefreshMarkStringOrder(Player)); } }); })); }