public string DealMinion(ActionStatus game, MinionCard Minion) { var Pos = Minion.战场位置; if (Pos.本方对方标识) { if (game.AllRole.MyPrivateInfo.handCards.Count != SystemManager.MaxHandCardCount) { game.AllRole.MyPrivateInfo.handCards.Add( CardUtility.GetCardInfoBySN(game.AllRole.MyPublicInfo.BattleField.BattleMinions[Pos.位置 - 1].序列号) ); } game.AllRole.MyPublicInfo.BattleField.BattleMinions[Pos.位置 - 1] = null; } else { if (game.AllRole.YourPrivateInfo.handCards.Count != SystemManager.MaxHandCardCount) { game.AllRole.YourPrivateInfo.handCards.Add( CardUtility.GetCardInfoBySN(game.AllRole.YourPublicInfo.BattleField.BattleMinions[Pos.位置 - 1].序列号) ); } game.AllRole.YourPublicInfo.BattleField.BattleMinions[Pos.位置 - 1] = null; } return String.Empty; }
/// <summary> /// 随从卡牌 /// </summary> /// <param name="game"></param> /// <param name="CardSn"></param> /// <param name="AIParm"></param> /// <param name="card"></param> /// <param name="ActionCodeLst"></param> /// <param name="PlayInfo"></param> public static void RunCS(ActionStatus game, string MinionCardSN, int Position) { int MinionPos = Position; var minion = (MinionCard)CardUtility.GetCardInfoBySN(MinionCardSN); //初始化 minion.初始化(); //必须在放入之前做得原因是,被放入的随从不能被触发这个事件 game.AllRole.MyPublicInfo.BattleField.PutToBattle(MinionPos, minion); if (!string.IsNullOrEmpty(minion.战吼效果)) { SpellCard spell = (SpellCard)CardUtility.GetCardInfoBySN(minion.战吼效果); if (!spell.FirstAbilityDefine.IsNeedTargetSelect()) { game.Interrupt.Step = 1; game.Interrupt.SessionData = "MINIONPOSITION:" + MinionPos + "|"; UseSpellAction.RunBS(game, minion.战吼效果); } } game.battleEvenetHandler.事件池.Add(new EventCard.全局事件() { 触发事件类型 = EventCard.事件类型枚举.召唤, 触发位置 = new CardUtility.指定位置结构体() { 位置 = MinionPos, 本方对方标识 = true } }); }
/// <summary> /// 效果点数的表达式计算 /// </summary> /// <param name="strEffectPoint"></param> /// <returns></returns> public static int GetEffectPoint(ActionStatus game, String strEffectPoint) { int point = 0; strEffectPoint = strEffectPoint.ToUpper(); if (!String.IsNullOrEmpty(strEffectPoint)) { if (strEffectPoint.StartsWith("=")) { switch (strEffectPoint.Substring(1)) { case "MYWEAPONAP": //本方武器攻击力 if (game.AllRole.MyPublicInfo.Hero.Weapon != null) point = game.AllRole.MyPublicInfo.Hero.Weapon.攻击力; break; default: break; } } else { point = int.Parse(strEffectPoint); } } return point; }
/// <summary> /// 抽牌【本方】 /// </summary> /// <param name="game"></param> /// <param name="Result"></param> private void DrawYourCard(ActionStatus game, List<string> Result) { if (string.IsNullOrEmpty(指定卡牌编号) || 指定卡牌编号 == CardUtility.strIgnore) { if (game.AllRole.YourPublicInfo.RemainCardDeckCount > 0) { if (SystemManager.游戏类型 == SystemManager.GameType.HTML版) { var drawCards = GameServer.DrawCard(game.GameId, !game.IsHost, 1); game.AllRole.YourPrivateInfo.handCards.Add(CardUtility.GetCardInfoBySN(drawCards[0])); } game.AllRole.YourPublicInfo.HandCardCount++; game.AllRole.YourPublicInfo.RemainCardDeckCount--; Result.Add(ActionCode.strCard + CardUtility.strSplitMark + CardUtility.strYou); } } else { if (SystemManager.游戏类型 == SystemManager.GameType.HTML版) { game.AllRole.YourPrivateInfo.handCards.Add(CardUtility.GetCardInfoBySN(指定卡牌编号)); } game.AllRole.YourPublicInfo.HandCardCount++; Result.Add(ActionCode.strCard + CardUtility.strSplitMark + CardUtility.strYou + CardUtility.strSplitMark + 指定卡牌编号); } }
/// <summary> /// 对方复原操作 /// </summary> /// <param name="game"></param> /// <param name="actField"></param> void IAtomicEffect.ReRunEffect(ActionStatus game, string[] actField) { int AttackPoint = int.Parse(actField[3]); if (actField[1] == CardUtility.strYou) { //MyInfo if (actField[2] == Client.BattleFieldInfo.HeroPos.ToString("D1")) { game.AllRole.MyPublicInfo.Hero.AfterBeAttack(AttackPoint); } else { game.AllRole.MyPublicInfo.BattleField.BattleMinions[int.Parse(actField[2]) - 1].设置被攻击后状态(AttackPoint); } } else { //YourInfo if (actField[2] == Client.BattleFieldInfo.HeroPos.ToString("D1")) { game.AllRole.MyPublicInfo.Hero.AfterBeAttack(AttackPoint); } else { game.AllRole.MyPublicInfo.BattleField.BattleMinions[int.Parse(actField[2]) - 1].设置被攻击后状态(AttackPoint); } } }
/// <summary> /// 抽牌【对方】 /// </summary> /// <param name="game"></param> /// <param name="Result"></param> private void DrawMyCard(ActionStatus game, List<string> Result) { if (string.IsNullOrEmpty(指定卡牌编号) || 指定卡牌编号 == CardUtility.strIgnore) { List<string> drawCards; if (SystemManager.游戏类型 == SystemManager.GameType.HTML版) { drawCards = GameServer.DrawCard(game.GameId, game.IsHost, 1); } else { drawCards = ClientRequest.DrawCard(game.GameId.ToString(GameServer.GameIdFormat), game.IsHost, 1); } if (drawCards.Count == 1) { game.AllRole.MyPrivateInfo.handCards.Add(CardUtility.GetCardInfoBySN(drawCards[0])); game.AllRole.MyPublicInfo.HandCardCount++; game.AllRole.MyPublicInfo.RemainCardDeckCount--; Result.Add(ActionCode.strCard + CardUtility.strSplitMark + CardUtility.strMe); } } else { game.AllRole.MyPrivateInfo.handCards.Add((CardUtility.GetCardInfoBySN(指定卡牌编号))); game.AllRole.MyPublicInfo.HandCardCount++; Result.Add(ActionCode.strCard + CardUtility.strSplitMark + CardUtility.strMe); } }
/// <summary> /// 对随从动作 /// </summary> /// <param name="game"></param> /// <param name="Minion"></param> /// <returns></returns> String IAtomicEffect.DealMinion(ActionStatus game, Card.MinionCard Minion) { var Summon = (Engine.Card.MinionCard)CardUtility.GetCardInfoBySN(变形目标卡牌编号); //一定要初始化,不然的话,生命值是0; Summon.初始化(); Summon.战场位置 = Minion.战场位置; //战场位置的继承 Minion = Summon; return Server.ActionCode.strStatus + CardUtility.strSplitMark + Minion.战场位置.ToString() + CardUtility.strSplitMark + 变形目标卡牌编号; }
/// <summary> /// TargetSelect /// </summary> /// <param name="option"></param> /// <param name="_actionStatus"></param> public TargetSelect(CardUtility.位置选择用参数结构体 option, ActionStatus _actionStatus) { InitializeComponent(); SelectOption = option; actionStatus = _actionStatus; Position.位置 = -1; ctlUsageCard.CardInfo = GameManager.MyClientManager.CurrentActiveCard; ctlUsageCard.Enabled = false; ctlUsageCard.Visible = true; }
/// <summary> /// 手牌消耗重置 /// </summary> public void ResetHandCardCost(ActionStatus game) { foreach (var card in handCards) { if (card.卡牌种类 == CardBasicInfo.资源类型枚举.法术) { card.使用成本 = card.使用成本 + game.AllRole.YourPublicInfo.BattleField.AbilityCost; if (card.使用成本 < 0) card.使用成本 = 0; } } }
/// <summary> /// 获得一个动作 /// </summary> /// <param name="gameStatus"></param> /// <returns></returns> public static void GetAction(ActionStatus gameStatus) { String Action = String.Empty; PublicInfo PlayInfo = gameStatus.AllRole.MyPublicInfo; PrivateInfo PlaySelfInfo = gameStatus.AllRole.MyPrivateInfo; List<String> Result = new List<string>(); //优先使用技能 if (PlayInfo.IsHeroSkillEnable(true)) { //召唤 if (PlayInfo.Hero.HeroSkill.FirstAbilityDefine.MainAbilityDefine.TrueAtomicEffect.AtomicEffectType == Effect.AtomicEffectDefine.AtomicEffectEnum.召唤 && PlayInfo.BattleField.MinionCount != SystemManager.MaxMinionCount) { gameStatus.Interrupt.ActionCard = new MinimizeBattleInfo.HandCardInfo(); gameStatus.Interrupt.ActionCard.Init(PlayInfo.Hero.HeroSkill); gameStatus.ActionName = "USEHEROSKILL"; gameStatus.Interrupt.Step = 1; gameStatus.Interrupt.ActionName = "SPELL"; PlayInfo.crystal.CurrentRemainPoint -= PlayInfo.Hero.HeroSkill.使用成本; PlayInfo.Hero.IsUsedHeroAbility = true; RunAction.StartActionCS(gameStatus, PlayInfo.Hero.HeroSkill.序列号, new string[] { }); gameStatus.Interrupt.ActionName = "SPELL"; return; } } //能上场的随从都上场 int HandCardIndex = HasBattleMinion(gameStatus); if (HandCardIndex != -1) { int newPos = PlayInfo.BattleField.MinionCount + 1; var card = PlaySelfInfo.handCards[HandCardIndex]; RunAction.StartActionCS(gameStatus, card.序列号, new string[] { newPos.ToString() }); PlayInfo.crystal.CurrentRemainPoint -= card.使用成本; PlaySelfInfo.RemoveUsedCard(card.序列号); PlayInfo.HandCardCount = PlaySelfInfo.handCards.Count; gameStatus.Interrupt.ActionCard = new MinimizeBattleInfo.HandCardInfo(); gameStatus.Interrupt.ActionCard.Init(card); gameStatus.Interrupt.ActionName = "MINION"; return; } //能攻击的随从都攻击,优先攻击英雄 int AttackPos = HasAttackMinion(gameStatus); if (AttackPos != -1) { int BeAttackedPos = GetAttackTarget(gameStatus); RunAction.Fight(gameStatus, AttackPos, BeAttackedPos, true); gameStatus.Interrupt.ActionName = "FIGHT"; gameStatus.Interrupt.ExternalInfo = AttackPos.ToString() + BeAttackedPos.ToString(); return; } gameStatus.Interrupt.ActionName = ActionCode.strEndTurn; }
/// <summary> /// 对方复原操作 /// </summary> /// <param name="game"></param> /// <param name="actField"></param> void IAtomicEffect.ReRunEffect(ActionStatus game, string[] actField) { if (actField[1] == CardUtility.strYou) { //MyInfo game.AllRole.MyPublicInfo.BattleField.BattleMinions[int.Parse(actField[2]) - 1] = (Engine.Card.MinionCard)CardUtility.GetCardInfoBySN(actField[3]); } else { game.AllRole.YourPublicInfo.BattleField.BattleMinions[int.Parse(actField[2]) - 1] = (Engine.Card.MinionCard)CardUtility.GetCardInfoBySN(actField[3]); } }
/// <summary> /// 攻击动作 /// </summary> /// <param name="game"></param> /// <param name="MyPos">攻击方</param> /// <param name="YourPos">被攻击方</param> /// <param name="IsMyAction">动作发起方</param> /// <returns></returns> public static List <string> Fight(ActionStatus game, int MyPos, int YourPos, bool IsMyAction) { game.battleEvenetHandler.事件池.Clear(); //FIGHT#1#2 string actionCode = ActionCode.strFight + CardUtility.strSplitMark + MyPos + CardUtility.strSplitMark + YourPos; List <string> ActionCodeLst = new List <string>(); ActionCodeLst.Add(actionCode); ActionCodeLst.AddRange(FightHandler.Fight(MyPos, YourPos, game, IsMyAction)); ActionCodeLst.AddRange(game.battleEvenetHandler.事件处理(game)); return(ActionCodeLst); }
/// <summary> /// 对英雄动作 /// </summary> /// <param name="game"></param> /// <param name="PlayInfo"></param> /// <returns></returns> String IAtomicEffect.DealHero(ActionStatus game, Client.PublicInfo PlayInfo) { switch (施加状态) { case strFreeze: PlayInfo.Hero.冰冻状态 = CardUtility.效果回合枚举.效果命中; break; default: break; } return Server.ActionCode.strStatus + CardUtility.strSplitMark + PlayInfo.Hero.战场位置.ToString() + CardUtility.strSplitMark + 施加状态; }
public static List<string> RunEffect(ActionStatus game, string PosField) { List<string> Result = new List<string>(); if (game.AllRole.MyPublicInfo.BattleField.MinionCount != SystemManager.MaxMinionCount) { game.AllRole.MyPublicInfo.BattleField.AppendToBattle(game.AllRole.YourPublicInfo.BattleField.BattleMinions[int.Parse(PosField) - 1].DeepCopy()); game.AllRole.YourPublicInfo.BattleField.BattleMinions[int.Parse(PosField) - 1] = null; //CONTROL#1 Result.Add(Server.ActionCode.strControl + CardUtility.strSplitMark + PosField[1]); } return Result; }
/// <summary> /// 对随从动作 /// </summary> /// <param name="game"></param> /// <param name="Minion"></param> /// <returns></returns> string IAtomicEffect.DealMinion(ActionStatus game, MinionCard Minion) { int HealthPoint = ExpressHandler.GetEffectPoint(game, 生命值回复表达式); if (Minion.设置被治疗后状态(HealthPoint)) { game.battleEvenetHandler.事件池.Add(new EventCard.全局事件() { 触发事件类型 = EventCard.事件类型枚举.治疗, 触发位置 = Minion.战场位置 }); } return Server.ActionCode.strHealth + CardUtility.strSplitMark + Minion.战场位置.ToString() + CardUtility.strSplitMark + HealthPoint.ToString(); }
/// <summary> /// 开始一个动作 /// </summary> /// <param name="actionStatus"> /// 在调用这个过程之前,actionStatus里面的本方和对方都应该已经设定好了 /// 在这里不进行任何的方向判断,默认这个方法是由MyInfo发起的 /// </param> /// <param name="CardSn"></param> /// <returns></returns> public static List <string> StartAction(ActionStatus actionStatus, string CardSn) { //清除事件池,注意,事件将在动作结束后整体结算 actionStatus.battleEvenetHandler.事件池.Clear(); CardBasicInfo card = CardUtility.GetCardInfoBySN(CardSn); List <string> ActionCodeLst = new List <string>(); //未知的异常,卡牌资料缺失 if (card == null) { return(ActionCodeLst); } PublicInfo PlayInfo = actionStatus.AllRole.MyPublicInfo; switch (card.卡牌种类) { case CardBasicInfo.资源类型枚举.法术: actionStatus.ActionName = "USESPELLCARD"; UseSpellAction.RunBS(actionStatus, CardSn); break; case CardBasicInfo.资源类型枚举.随从: actionStatus.ActionName = "USEMINIONCARD"; UseMinionAction.RunBS(actionStatus, CardSn); break; case CardBasicInfo.资源类型枚举.武器: ActionCodeLst.Add(ActionCode.strWeapon + CardUtility.strSplitMark + CardSn); PlayInfo.Hero.Weapon = (WeaponCard)card; break; case CardBasicInfo.资源类型枚举.奥秘: ActionCodeLst.Add(ActionCode.strSecret + CardUtility.strSplitMark + CardSn); actionStatus.AllRole.MyPrivateInfo.奥秘列表.Add((SecretCard)card); PlayInfo.Hero.SecretCount = actionStatus.AllRole.MyPrivateInfo.奥秘列表.Count; break; default: break; } //随从卡牌的连击效果启动 Combo(actionStatus, card, ActionCodeLst, PlayInfo); if (ActionCodeLst.Count != 0) { PlayInfo.连击状态 = true; ActionCodeLst.AddRange(actionStatus.battleEvenetHandler.事件处理(actionStatus)); } return(ActionCodeLst); }
/// <summary> /// 获得对象选择列表 /// </summary> /// <param name="game"></param> /// <returns></returns> public static string GetTargetListString(ActionStatus game) { List<string> Target = new List<string>(); if (game.AllRole.MyPublicInfo.Hero.能否成为动作对象) Target.Add(CardUtility.strMe + CardUtility.strSplitMark + BattleFieldInfo.HeroPos); for (int i = 0; i < game.AllRole.MyPublicInfo.BattleField.MinionCount; i++) { if (game.AllRole.MyPublicInfo.BattleField.BattleMinions[i].能否成为动作对象) Target.Add(CardUtility.strMe + CardUtility.strSplitMark + (i + 1).ToString("D1")); } if (game.AllRole.YourPublicInfo.Hero.能否成为动作对象) Target.Add(CardUtility.strYou + CardUtility.strSplitMark + BattleFieldInfo.HeroPos); for (int i = 0; i < game.AllRole.YourPublicInfo.BattleField.MinionCount; i++) { if (game.AllRole.YourPublicInfo.BattleField.BattleMinions[i].能否成为动作对象) Target.Add(CardUtility.strYou + CardUtility.strSplitMark + (i + 1).ToString("D1")); } return Target.ToListString(); }
/// <summary> /// 对英雄动作 /// </summary> /// <param name="game"></param> /// <param name="PlayInfo"></param> /// <returns></returns> String IAtomicEffect.DealHero(ActionStatus game, Client.PublicInfo PlayInfo) { int AttackPoint = ExpressHandler.GetEffectPoint(game, 伤害效果表达式); //调整伤害值 if (伤害加成) AttackPoint += game.AllRole.MyPublicInfo.BattleField.AbilityDamagePlus; if (PlayInfo.Hero.AfterBeAttack(AttackPoint)) { game.battleEvenetHandler.事件池.Add(new EventCard.全局事件() { 触发事件类型 = EventCard.事件类型枚举.受伤, 触发位置 = PlayInfo.Hero.战场位置 }); } return Server.ActionCode.strAttack + CardUtility.strSplitMark + PlayInfo.Hero.战场位置.ToString() + CardUtility.strSplitMark + AttackPoint.ToString(); }
/// <summary> /// 对方复原操作 /// </summary> /// <param name="game"></param> /// <param name="actField"></param> public static void ReRunEffect(ActionStatus game, String[] actField) { //Crystal#ME#4#4 //Me代表对方 YOU代表自己,必须反过来 if (actField[1] == CardUtility.strMe) { game.AllRole.YourPublicInfo.crystal.CurrentRemainPoint = int.Parse(actField[2]); game.AllRole.YourPublicInfo.crystal.CurrentFullPoint = int.Parse(actField[3]); } else { game.AllRole.MyPublicInfo.crystal.CurrentRemainPoint = int.Parse(actField[2]); game.AllRole.MyPublicInfo.crystal.CurrentFullPoint = int.Parse(actField[3]); } }
/// <summary> /// 对随从动作 /// </summary> /// <param name="game"></param> /// <param name="Minion"></param> /// <returns></returns> String IAtomicEffect.DealMinion(ActionStatus game, Card.MinionCard Minion) { int AttackPoint = ExpressHandler.GetEffectPoint(game, 伤害效果表达式); //调整伤害值 if (伤害加成) AttackPoint += game.AllRole.MyPublicInfo.BattleField.AbilityDamagePlus; if (Minion.设置被攻击后状态(AttackPoint)) { game.battleEvenetHandler.事件池.Add(new Engine.Card.EventCard.全局事件() { 触发事件类型 = EventCard.事件类型枚举.受伤, 触发位置 = Minion.战场位置 }); } return Server.ActionCode.strAttack + CardUtility.strSplitMark + Minion.战场位置.ToString() + CardUtility.strSplitMark + AttackPoint.ToString(); }
/// <summary> /// 对方复原操作 /// </summary> /// <param name="game"></param> /// <param name="actField"></param> void IAtomicEffect.ReRunEffect(ActionStatus game, string[] actField) { int HealthPoint = int.Parse(actField[3]); Client.PublicInfo info = actField[1] == CardUtility.strYou ? game.AllRole.MyPublicInfo : game.AllRole.YourPublicInfo; if (actField.Length == 6) { info.BattleField.BattleMinions[int.Parse(actField[2]) - 1].攻击力 = int.Parse(actField[3]); info.BattleField.BattleMinions[int.Parse(actField[2]) - 1].生命值 = int.Parse(actField[4]); info.BattleField.BattleMinions[int.Parse(actField[2]) - 1].生命值上限 = int.Parse(actField[5]); } else { info.BattleField.BattleMinions[int.Parse(actField[2]) - 1].本回合攻击力加成 = int.Parse(actField[3]); info.BattleField.BattleMinions[int.Parse(actField[2]) - 1].本回合生命力加成 = int.Parse(actField[4]); } }
/// <summary> /// 对方复原操作 /// </summary> /// <param name="game"></param> /// <param name="actField"></param> public static void ReRunEffect(ActionStatus game, String[] actField) { //WeaponPoint#ME#+0/+0 //Me代表对方 YOU代表自己,必须反过来 string[] Op = actField[2].Split("/".ToCharArray()); if (actField[1] == CardUtility.strMe) { game.AllRole.MyPublicInfo.Hero.Weapon.攻击力 += int.Parse(Op[0]); game.AllRole.MyPublicInfo.Hero.Weapon.耐久度 += int.Parse(Op[1]); } else { game.AllRole.YourPublicInfo.Hero.Weapon.攻击力 += int.Parse(Op[0]); game.AllRole.YourPublicInfo.Hero.Weapon.耐久度 += int.Parse(Op[1]); } }
/// <summary> /// 对英雄动作 /// </summary> /// <param name="game"></param> /// <param name="PlayInfo"></param> /// <returns></returns> string IAtomicEffect.DealHero(ActionStatus game, Client.PublicInfo PlayInfo) { int ShieldPoint = ExpressHandler.GetEffectPoint(game, 护甲回复表达式); int HealthPoint = ExpressHandler.GetEffectPoint(game, 生命值回复表达式); PlayInfo.Hero.AfterBeShield(ShieldPoint); if (PlayInfo.Hero.AfterBeHealth(HealthPoint)) { game.battleEvenetHandler.事件池.Add(new EventCard.全局事件() { 触发事件类型 = EventCard.事件类型枚举.治疗, 触发位置 = PlayInfo.Hero.战场位置 }); } return Server.ActionCode.strHealth + CardUtility.strSplitMark + PlayInfo.Hero.战场位置.ToString() + CardUtility.strSplitMark + HealthPoint.ToString() + CardUtility.strSplitMark + ShieldPoint.ToString(); }
/// <summary> /// 能上场的随从 /// </summary> /// <returns></returns> private static int HasBattleMinion(ActionStatus gameStatus) { PrivateInfo PlaySelfInfo = gameStatus.AllRole.MyPrivateInfo; PublicInfo PlayInfo = gameStatus.AllRole.MyPublicInfo; if (PlayInfo.BattleField.MinionCount == SystemManager.MaxMinionCount) return -1; for (int i = 0; i < PlaySelfInfo.handCards.Count; i++) { var card = PlaySelfInfo.handCards[i]; if (card.卡牌种类 == Card.CardBasicInfo.资源类型枚举.随从) { if (card.使用成本 <= PlayInfo.crystal.CurrentRemainPoint) { return i; } } } return -1; }
/// <summary> /// 法术执行 /// </summary> /// <param name="game"></param> /// <returns></returns> public List<string> RunEffect(ActionStatus game, CardUtility.目标选择方向枚举 Direct) { List<string> Result = new List<string>(); switch (Direct) { case CardUtility.目标选择方向枚举.本方: //#CARD#ME#M000001 DrawMyCard(game, Result); break; case CardUtility.目标选择方向枚举.对方: DrawYourCard(game, Result); break; case CardUtility.目标选择方向枚举.双方: DrawMyCard(game, Result); DrawYourCard(game, Result); break; } return Result; }
/// <summary> /// 对随从动作 /// </summary> /// <param name="game"></param> /// <param name="Minion"></param> /// <returns></returns> String IAtomicEffect.DealMinion(ActionStatus game, Card.MinionCard Minion) { int TurnCount = int.Parse(持续回合); if (TurnCount == CardUtility.Max) { Minion.攻击力 = ExpressHandler.PointProcess(Minion.攻击力, 攻击力); Minion.生命值 = ExpressHandler.PointProcess(Minion.生命值, 生命值); Minion.生命值上限 = ExpressHandler.PointProcess(Minion.生命值上限, 生命值); return Server.ActionCode.strPoint + CardUtility.strSplitMark + Minion.战场位置.ToString() + CardUtility.strSplitMark + Minion.攻击力.ToString() + CardUtility.strSplitMark + Minion.生命值.ToString() + CardUtility.strSplitMark + Minion.生命值上限.ToString(); } else { //本回合攻击力翻倍的对应 Minion.本回合攻击力加成 = ExpressHandler.PointProcess(Minion.攻击力, 攻击力) - Minion.攻击力; Minion.本回合生命力加成 = ExpressHandler.PointProcess(Minion.生命值上限, 生命值) - Minion.生命值上限; return Server.ActionCode.strPoint + CardUtility.strSplitMark + Minion.战场位置.ToString() + CardUtility.strSplitMark + Minion.本回合攻击力加成.ToString() + CardUtility.strSplitMark + Minion.本回合生命力加成.ToString(); } }
/// <summary> /// 开始一个动作 /// </summary> /// <param name="actionStatus"> /// 在调用这个过程之前,actionStatus里面的本方和对方都应该已经设定好了 /// 在这里不进行任何的方向判断,默认这个方法是由MyInfo发起的 /// </param> /// <param name="CardSn"></param> /// <returns></returns> public static List<string> StartAction(ActionStatus actionStatus, string CardSn) { //清除事件池,注意,事件将在动作结束后整体结算 actionStatus.battleEvenetHandler.事件池.Clear(); CardBasicInfo card = CardUtility.GetCardInfoBySN(CardSn); List<string> ActionCodeLst = new List<string>(); //未知的异常,卡牌资料缺失 if (card == null) return ActionCodeLst; PublicInfo PlayInfo = actionStatus.AllRole.MyPublicInfo; switch (card.卡牌种类) { case CardBasicInfo.资源类型枚举.法术: actionStatus.ActionName = "USESPELLCARD"; UseSpellAction.RunBS(actionStatus, CardSn); break; case CardBasicInfo.资源类型枚举.随从: actionStatus.ActionName = "USEMINIONCARD"; UseMinionAction.RunBS(actionStatus, CardSn); break; case CardBasicInfo.资源类型枚举.武器: ActionCodeLst.Add(ActionCode.strWeapon + CardUtility.strSplitMark + CardSn); PlayInfo.Hero.Weapon = (WeaponCard)card; break; case CardBasicInfo.资源类型枚举.奥秘: ActionCodeLst.Add(ActionCode.strSecret + CardUtility.strSplitMark + CardSn); actionStatus.AllRole.MyPrivateInfo.奥秘列表.Add((SecretCard)card); PlayInfo.Hero.SecretCount = actionStatus.AllRole.MyPrivateInfo.奥秘列表.Count; break; default: break; } //随从卡牌的连击效果启动 Combo(actionStatus, card, ActionCodeLst, PlayInfo); if (ActionCodeLst.Count != 0) { PlayInfo.连击状态 = true; ActionCodeLst.AddRange(actionStatus.battleEvenetHandler.事件处理(actionStatus)); } return ActionCodeLst; }
/// <summary> /// 对手回合结束的清场 /// </summary> public static List<String> TurnEnd(ActionStatus gameStatus) { List<String> ActionLst = new List<string>(); //对手回合加成属性的去除 int ExistMinionCount = gameStatus.AllRole.MyPublicInfo.BattleField.MinionCount; for (int i = 0; i < ExistMinionCount; i++) { if (gameStatus.AllRole.MyPublicInfo.BattleField.BattleMinions[i] != null) { gameStatus.AllRole.MyPublicInfo.BattleField.BattleMinions[i].本回合生命力加成 = 0; gameStatus.AllRole.MyPublicInfo.BattleField.BattleMinions[i].本回合攻击力加成 = 0; if (gameStatus.AllRole.MyPublicInfo.BattleField.BattleMinions[i].特殊效果 == MinionCard.特殊效果枚举.回合结束死亡) { gameStatus.AllRole.MyPublicInfo.BattleField.BattleMinions[i] = null; } } } gameStatus.AllRole.MyPublicInfo.BattleField.ClearDead(gameStatus.battleEvenetHandler, false); ActionLst.AddRange(ActionStatus.Settle(gameStatus)); ActionLst.AddRange(gameStatus.battleEvenetHandler.事件处理(gameStatus)); return ActionLst; }
/// <summary> /// 新的回合[不包含抽手牌] /// </summary> public static void TurnStart(ActionStatus gameStatus) { //过载的清算 if (gameStatus.AllRole.MyPublicInfo.OverloadPoint != 0) { gameStatus.AllRole.MyPublicInfo.crystal.ReduceCurrentPoint(gameStatus.AllRole.MyPublicInfo.OverloadPoint); gameStatus.AllRole.MyPublicInfo.OverloadPoint = 0; } //连击的重置 gameStatus.AllRole.MyPublicInfo.连击状态 = false; //魔法水晶的增加 gameStatus.AllRole.MyPublicInfo.crystal.NewTurn(); gameStatus.AllRole.MyPublicInfo.Hero.RemainAttackTimes = 1; gameStatus.AllRole.MyPublicInfo.Hero.IsUsedHeroAbility = false; gameStatus.AllRole.MyPublicInfo.BattleField.FreezeStatus(); //重置攻击次数,必须放在状态变化之后! //原因是剩余攻击回数和状态有关! foreach (var minion in gameStatus.AllRole.MyPublicInfo.BattleField.BattleMinions) { if (minion != null) minion.重置剩余攻击次数(); } }
/// <summary> /// 清算(核心方法) /// </summary> /// <returns></returns> public static List <string> Settle(ActionStatus game) { //每次原子操作后进行一次清算 //将亡语效果也发送给对方 List <string> actionlst = new List <string>(); //1.检查需要移除的对象 var MyDeadMinion = game.AllRole.MyPublicInfo.BattleField.ClearDead(game.battleEvenetHandler, true); var YourDeadMinion = game.AllRole.YourPublicInfo.BattleField.ClearDead(game.battleEvenetHandler, false); //2.重新计算Buff Buff.ResetBuff(game); //3.武器的移除 if (game.AllRole.MyPublicInfo.Hero.Weapon != null && game.AllRole.MyPublicInfo.Hero.Weapon.耐久度 == 0) { game.AllRole.MyPublicInfo.Hero.Weapon = null; } if (game.AllRole.YourPublicInfo.Hero.Weapon != null && game.AllRole.YourPublicInfo.Hero.Weapon.耐久度 == 0) { game.AllRole.YourPublicInfo.Hero.Weapon = null; } //发送结算同步信息 actionlst.Add(Server.ActionCode.strSettle); foreach (var minion in MyDeadMinion) { //亡语的时候,本方无需倒置方向 actionlst.AddRange(minion.发动亡语(game)); } //互换本方对方 game.Reverse(); foreach (var minion in YourDeadMinion) { //亡语的时候,对方需要倒置方向 //例如,亡语为 本方召唤一个随从,敌人亡语,变为敌方召唤一个随从 actionlst.AddRange(minion.发动亡语(game)); } //保持本方对方 game.Reverse(); return(actionlst); }
/// <summary> /// 根据施法对象获得不同法术 /// </summary> /// <param name="singleEffect"></param> /// <param name="game"></param> /// <param name="PosInfo"></param> /// <returns></returns> private static IAtomicEffect GetEffectHandler(EffectDefine singleEffect, ActionStatus game, string PosInfo) { AtomicEffectDefine atomic; if (string.IsNullOrEmpty(singleEffect.效果条件) || singleEffect.效果条件 == CardUtility.strIgnore || ExpressHandler.AtomicEffectPickCondition(game, PosInfo, singleEffect)) { atomic = singleEffect.TrueAtomicEffect; } else { atomic = singleEffect.FalseAtomicEffect; } IAtomicEffect IAtomic = new AttackEffect(); switch (atomic.AtomicEffectType) { case AtomicEffectDefine.AtomicEffectEnum.攻击: IAtomic = new AttackEffect(); break; case AtomicEffectDefine.AtomicEffectEnum.回复: IAtomic = new HealthEffect(); break; case AtomicEffectDefine.AtomicEffectEnum.状态: IAtomic = new StatusEffect(); break; case AtomicEffectDefine.AtomicEffectEnum.增益: IAtomic = new PointEffect(); break; case AtomicEffectDefine.AtomicEffectEnum.变形: IAtomic = new TransformEffect(); break; case AtomicEffectDefine.AtomicEffectEnum.召回: IAtomic = new CallBackEffect(); break; } IAtomic.GetField(atomic.InfoArray); return (IAtomicEffect)IAtomic; }
/// <summary> /// 对武器增益的法术实施 /// </summary> /// <param name="role"></param> /// <param name="Ability"></param> public List<string> RunEffect(ActionStatus game, Utility.CardUtility.目标选择方向枚举 Direct) { List<string> Result = new List<string>(); if (Direct == CardUtility.目标选择方向枚举.本方) { if (game.AllRole.MyPublicInfo.Hero.Weapon != null) { game.AllRole.MyPublicInfo.Hero.Weapon.攻击力 += int.Parse(攻击力); game.AllRole.MyPublicInfo.Hero.Weapon.耐久度 += int.Parse(耐久度); Result.Add(ActionCode.strWeaponPoint + CardUtility.strSplitMark + CardUtility.strMe + CardUtility.strSplitMark); } } else { if (game.AllRole.YourPublicInfo.Hero.Weapon != null) { game.AllRole.YourPublicInfo.Hero.Weapon.攻击力 += int.Parse(攻击力); game.AllRole.YourPublicInfo.Hero.Weapon.耐久度 += int.Parse(耐久度); Result.Add(ActionCode.strWeaponPoint + CardUtility.strSplitMark + CardUtility.strYou + CardUtility.strSplitMark); } } return Result; }
/// <summary> /// 对手回合结束的清场 /// </summary> public static List <String> TurnEnd(ActionStatus gameStatus) { List <String> ActionLst = new List <string>(); //对手回合加成属性的去除 int ExistMinionCount = gameStatus.AllRole.MyPublicInfo.BattleField.MinionCount; for (int i = 0; i < ExistMinionCount; i++) { if (gameStatus.AllRole.MyPublicInfo.BattleField.BattleMinions[i] != null) { gameStatus.AllRole.MyPublicInfo.BattleField.BattleMinions[i].本回合生命力加成 = 0; gameStatus.AllRole.MyPublicInfo.BattleField.BattleMinions[i].本回合攻击力加成 = 0; if (gameStatus.AllRole.MyPublicInfo.BattleField.BattleMinions[i].特殊效果 == MinionCard.特殊效果枚举.回合结束死亡) { gameStatus.AllRole.MyPublicInfo.BattleField.BattleMinions[i] = null; } } } gameStatus.AllRole.MyPublicInfo.BattleField.ClearDead(gameStatus.battleEvenetHandler, false); ActionLst.AddRange(ActionStatus.Settle(gameStatus)); ActionLst.AddRange(gameStatus.battleEvenetHandler.事件处理(gameStatus)); return(ActionLst); }
/// <summary> /// 事件处理 /// </summary> /// <returns></returns> public List<String> 事件处理(ActionStatus game) { if (事件特殊处理 != null) 事件特殊处理(game); List<String> Result = new List<string>(); for (int j = 0; j < 事件池.Count; j++) { EventCard.全局事件 事件 = 事件池[j]; for (int i = 0; i <game.AllRole.MyPublicInfo.BattleField.MinionCount; i++) { if (!(事件.触发事件类型 == EventCard.事件类型枚举.召唤 && 事件.触发位置.位置 == (i + 1) && 事件.触发位置.本方对方标识)) { Result.AddRange(game.AllRole.MyPublicInfo.BattleField.BattleMinions[i].事件处理方法(事件, game)); } } //转换触发方向,对方触发事件?结果是否传送?传送时候要改变strMe和strYou! 事件.触发位置.本方对方标识 = !事件.触发位置.本方对方标识; for (int i = 0; i <game.AllRole.YourPublicInfo.BattleField.MinionCount; i++) { game.AllRole.YourPublicInfo.BattleField.BattleMinions[i].事件处理方法(事件, game); } } return Result; }
/// <summary> /// 随从卡牌 /// </summary> /// <param name="game"></param> /// <param name="CardSn"></param> public static void RunBS(ActionStatus game, string CardSn) { int MinionPos = -1; MinionCard minion = minion = (MinionCard)CardUtility.GetCardInfoBySN(CardSn); //Step1 if (game.Interrupt.Step == 1) { if (game.AllRole.MyPublicInfo.BattleField.MinionCount != 0) { game.Interrupt.Step = 2; game.Interrupt.ActionName = "MINIONPOSITION"; return; } else { game.Interrupt.SessionData = "MINIONPOSITION:1|"; } MinionPos = 1; game.Interrupt.Step = 2; } //Step2 if (game.Interrupt.Step == 2) { if (MinionPos == -1) { MinionPos = int.Parse(game.Interrupt.SessionDic["MINIONPOSITION"]); } //初始化 minion.初始化(); //随从入场 game.AllRole.MyPublicInfo.BattleField.PutToBattle(MinionPos, minion); //必须在放入之前做得原因是,被放入的随从不能被触发这个事件 game.battleEvenetHandler.事件池.Add(new EventCard.全局事件() { 触发事件类型 = EventCard.事件类型枚举.召唤, 触发位置 = new CardUtility.指定位置结构体() { 位置 = MinionPos, 本方对方标识 = game.IsHost } }); game.Interrupt.Step = 3; } //Step3 if (game.Interrupt.Step == 3 && !string.IsNullOrEmpty(minion.战吼效果)) { SpellCard spell = (SpellCard)CardUtility.GetCardInfoBySN(minion.战吼效果); game.Interrupt.Step = 4; if (spell.FirstAbilityDefine.IsNeedTargetSelect()) { //这里先简单假设所有战吼,如果需要指定位置,则自身不能成为指定位置 spell.FirstAbilityDefine.MainAbilityDefine.AbliltyPosPicker.CanNotSelectPos.本方对方标识 = true; spell.FirstAbilityDefine.MainAbilityDefine.AbliltyPosPicker.CanNotSelectPos.位置 = int.Parse(game.Interrupt.SessionDic["MINIONPOSITION"]); SelectUtility.SetTargetSelectEnable(spell.FirstAbilityDefine.MainAbilityDefine.AbliltyPosPicker, game); game.Interrupt.ExternalInfo = SelectUtility.GetTargetListString(game); game.Interrupt.ActionName = "BATTLECRYPOSITION"; return; } } if (game.Interrupt.Step == 4) { //法术位置信息包含在SessionData中,传递下去 //这种类型的战吼,直接转换为施法 //这里约定:战吼是无需抉择的 game.Interrupt.ActionName = "RUNBATTLECRY"; game.Interrupt.Step = 1; if (game.Interrupt.SessionDic.ContainsKey("BATTLECRYPOSITION") && game.Interrupt.SessionDic["BATTLECRYPOSITION"] == "-1") { //放弃战吼,例如没有友方的时候的叫嚣的中士 game.Interrupt.Step = 99; } else { UseSpellAction.RunBS(game, minion.战吼效果); } } game.Interrupt.Step = 99; game.Interrupt.ActionName = CardUtility.strOK; }
/// <summary> /// 处理对方的动作 /// </summary> /// <param name="ActionCommand"></param> /// <param name="game"></param> public static void Process(string ActionCommand, ActionStatus game) { string[] actField = ActionCommand.Split(CardUtility.strSplitMark.ToCharArray()); switch (ActionCode.GetActionType(ActionCommand)) { case ActionCode.ActionType.Card: CardEffect.ReRunEffect(1, game, actField); break; case ActionCode.ActionType.UseMinion: int Pos = int.Parse(actField[2]); var minion = (MinionCard)CardUtility.GetCardInfoBySN(actField[1]); minion.初始化(); game.AllRole.YourPublicInfo.BattleField.PutToBattle(Pos, minion); Buff.ResetBuff(game); break; case ActionCode.ActionType.UseWeapon: game.AllRole.YourPublicInfo.Hero.Weapon = (WeaponCard)CardUtility.GetCardInfoBySN(actField[1]); break; case ActionCode.ActionType.UseSecret: game.AllRole.YourPublicInfo.Hero.SecretCount++;; break; case ActionCode.ActionType.UseAbility: break; case ActionCode.ActionType.Fight: //FIGHT#1#2 FightHandler.Fight(int.Parse(actField[2]), int.Parse(actField[1]), game, false); break; case ActionCode.ActionType.Point: IAtomicEffect point = new PointEffect(); point.ReRunEffect(game, actField); break; case ActionCode.ActionType.Health: IAtomicEffect health = new HealthEffect(); health.ReRunEffect(game, actField); break; case ActionCode.ActionType.Status: IAtomicEffect status = new StatusEffect(); status.ReRunEffect(game, actField); break; case ActionCode.ActionType.Transform: IAtomicEffect transform = new TransformEffect(); transform.ReRunEffect(game, actField); break; case ActionCode.ActionType.Attack: IAtomicEffect attack = new AttackEffect(); attack.ReRunEffect(game, actField); break; case ActionCode.ActionType.HitSecret: SecretCard.ReRunSecret(game, actField); break; case ActionCode.ActionType.Control: ControlEffect.ReRunEffect(game, actField); break; case ActionCode.ActionType.Summon: SummonEffect.ReRunEffect(game, actField); break; case ActionCode.ActionType.Crystal: CrystalEffect.ReRunEffect(game, actField); break; case ActionCode.ActionType.WeaponPoint: WeaponPointEffect.ReRunEffect(game, actField); break; case ActionCode.ActionType.Settle: ActionStatus.Settle(game); break; } }
/// <summary> /// 使用法术 /// </summary> /// <param name="game"></param> /// <param name="IsMyAction">对象方向转换</param> public static void RunBS(ActionStatus game, string CardSn) { List <string> Result = new List <string>(); SpellCard spell = (SpellCard)CardUtility.GetCardInfoBySN(CardSn); //Step1 CardUtility.抉择枚举 PickAbilityResult = CardUtility.抉择枚举.第一效果; SpellCard.AbilityDefine ability = new SpellCard.AbilityDefine(); if (game.Interrupt.Step == 1) { switch (spell.效果选择类型) { case SpellCard.效果选择类型枚举.无需选择: game.Interrupt.ExternalInfo = "1"; break; case SpellCard.效果选择类型枚举.主动选择: game.Interrupt.Step = 2; game.Interrupt.ActionName = "SPELLDECIDE"; game.Interrupt.ExternalInfo = spell.FirstAbilityDefine.描述 + CardUtility.strSplitArrayMark + spell.SecondAbilityDefine.描述; return; case SpellCard.效果选择类型枚举.自动判定: game.Interrupt.ExternalInfo = "1"; if (!ExpressHandler.AbilityPickCondition(game, spell.效果选择条件)) { PickAbilityResult = CardUtility.抉择枚举.第二效果; game.Interrupt.ExternalInfo = "2"; } break; default: break; } game.Interrupt.Step = 2; } //Step2 if (game.Interrupt.Step == 2) { if (spell.效果选择类型 == SpellCard.效果选择类型枚举.主动选择 && SystemManager.游戏类型 == SystemManager.GameType.HTML版) { switch (game.Interrupt.SessionDic["SPELLDECIDE"]) { case "1": PickAbilityResult = CardUtility.抉择枚举.第一效果; break; case "2": PickAbilityResult = CardUtility.抉择枚举.第二效果; break; default: PickAbilityResult = CardUtility.抉择枚举.取消; break; } } if (PickAbilityResult != CardUtility.抉择枚举.取消) { List <EffectDefine> SingleEffectList = new List <EffectDefine>(); if (PickAbilityResult == CardUtility.抉择枚举.第一效果) { ability = spell.FirstAbilityDefine; } else { ability = spell.SecondAbilityDefine; } if (game.ActionName == "USEMINIONCARD") { //如果整个大的动作时随从入场,并且如果这个战吼不需要指定位置,则现在的话,将入场随从设定为指定位置 ability.MainAbilityDefine.AbliltyPosPicker.SelectedPos.本方对方标识 = true; ability.MainAbilityDefine.AbliltyPosPicker.SelectedPos.位置 = int.Parse(game.Interrupt.SessionDic["MINIONPOSITION"]); } if (ability.IsNeedTargetSelect()) { if (game.ActionName == "USEMINIONCARD" && game.Interrupt.SessionDic.ContainsKey("BATTLECRYPOSITION")) { ability.MainAbilityDefine.AbliltyPosPicker.SelectedPos = CardUtility.指定位置结构体.FromString(game.Interrupt.SessionDic["BATTLECRYPOSITION"]); } else { if (game.ActionName == "USESPELLCARD" && game.Interrupt.SessionDic.ContainsKey("SPELLPOSITION")) { ability.MainAbilityDefine.AbliltyPosPicker.SelectedPos = CardUtility.指定位置结构体.FromString(game.Interrupt.SessionDic["SPELLPOSITION"]); } else { ability.MainAbilityDefine.AbliltyPosPicker.CanNotSelectPos.位置 = BattleFieldInfo.UnknowPos; SelectUtility.SetTargetSelectEnable(ability.MainAbilityDefine.AbliltyPosPicker, game); game.Interrupt.ExternalInfo = SelectUtility.GetTargetListString(game); game.Interrupt.ActionName = "SPELLPOSITION"; return; } } } game.Interrupt.Step = 3; } else { game.Interrupt.Step = -1; return; } } if (game.Interrupt.Step == 3) { SpellCard.RunAbility(game, ability); if (spell.法术卡牌类型 == CardBasicInfo.法术卡牌类型枚举.普通卡牌) { game.battleEvenetHandler.事件池.Add(new EventCard.全局事件() { 触发事件类型 = EventCard.事件类型枚举.施法, 触发位置 = new CardUtility.指定位置结构体() { 位置 = BattleFieldInfo.HeroPos, 本方对方标识 = true } }); } } game.Interrupt.Step = 99; game.Interrupt.ActionName = CardUtility.strOK; }