/// <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="item"></param> /// <param name="game"></param> public static void Process(string item, GameManager game) { string[] actField = item.Split(CardUtility.strSplitMark.ToCharArray()); switch (Engine.Server.ActionCode.GetActionType(item)) { case ActionCode.ActionType.Card: CardEffect.ReRunEffect(game, actField); break; case ActionCode.ActionType.UseMinion: int Pos = int.Parse(actField[2]); var minion = (Engine.Card.MinionCard)Engine.Utility.CardUtility.GetCardInfoBySN(actField[1]); minion.Init(); game.YourInfo.BattleField.PutToBattle(Pos, minion); game.YourInfo.BattleField.ResetBuff(); break; case ActionCode.ActionType.UseWeapon: game.YourInfo.Weapon = (Engine.Card.WeaponCard)Engine.Utility.CardUtility.GetCardInfoBySN(actField[1]); break; case ActionCode.ActionType.UseSecret: game.YourInfo.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, true); 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: game.Settle(); break; } }
/// <summary> /// Buff的设置 /// </summary> public static void ResetBuff(ActionStatus game) { //去除所有光环效果 //Buff不但是对本方战场产生效果,也可以对对方产生效果,所以必须放到全局的高度 for (int i = 0; i < game.AllRole.MyPublicInfo.BattleField.MinionCount; i++) { if (game.AllRole.MyPublicInfo.BattleField.BattleMinions[i] != null) { game.AllRole.MyPublicInfo.BattleField.BattleMinions[i].受战场效果.Clear(); } } for (int i = 0; i < game.AllRole.YourPublicInfo.BattleField.MinionCount; i++) { if (game.AllRole.YourPublicInfo.BattleField.BattleMinions[i] != null) { game.AllRole.YourPublicInfo.BattleField.BattleMinions[i].受战场效果.Clear(); } } game.AllRole.MyPublicInfo.BattleField.AbilityCost = 0; game.AllRole.MyPublicInfo.BattleField.AbilityDamagePlus = 0; game.AllRole.MyPublicInfo.BattleField.MinionCost = 0; game.AllRole.YourPublicInfo.BattleField.AbilityCost = 0; game.AllRole.YourPublicInfo.BattleField.AbilityDamagePlus = 0; game.AllRole.YourPublicInfo.BattleField.MinionCost = 0; //设置光环效果 for (int i = 0; i < game.AllRole.MyPublicInfo.BattleField.MinionCount; i++) { var minion = game.AllRole.MyPublicInfo.BattleField.BattleMinions[i]; if (minion != null && !string.IsNullOrEmpty(minion.光环效果.信息)) { switch (minion.光环效果.类型) { case 光环类型枚举.增加攻防: EffectDefine singleEffect = new EffectDefine(); PointEffect t = new PointEffect(); singleEffect.TrueAtomicEffect = new AtomicEffectDefine(); singleEffect.TrueAtomicEffect.AtomicEffectType = AtomicEffectDefine.AtomicEffectEnum.增益; singleEffect.TrueAtomicEffect.InfoArray = new List <String>(minion.光环效果.信息.Split(CardUtility.strSplitArrayMark.ToCharArray())); singleEffect.FalseAtomicEffect = new AtomicEffectDefine(); singleEffect.FalseAtomicEffect.AtomicEffectType = AtomicEffectDefine.AtomicEffectEnum.未定义; Effecthandler.RunSingleEffect(singleEffect, game, 0); break; case 光环类型枚举.施法成本: switch (minion.光环效果.范围.EffectTargetSelectDirect) { case CardUtility.目标选择方向枚举.本方: game.AllRole.MyPublicInfo.BattleField.AbilityCost += int.Parse(minion.光环效果.信息); break; case CardUtility.目标选择方向枚举.对方: game.AllRole.YourPublicInfo.BattleField.AbilityCost += int.Parse(minion.光环效果.信息); break; case CardUtility.目标选择方向枚举.双方: game.AllRole.MyPublicInfo.BattleField.AbilityCost += int.Parse(minion.光环效果.信息); game.AllRole.YourPublicInfo.BattleField.AbilityCost += int.Parse(minion.光环效果.信息); break; default: break; } break; case 光环类型枚举.法术效果: switch (minion.光环效果.范围.EffectTargetSelectDirect) { case CardUtility.目标选择方向枚举.本方: game.AllRole.MyPublicInfo.BattleField.AbilityDamagePlus += int.Parse(minion.光环效果.信息); break; case CardUtility.目标选择方向枚举.对方: game.AllRole.YourPublicInfo.BattleField.AbilityDamagePlus += int.Parse(minion.光环效果.信息); break; case CardUtility.目标选择方向枚举.双方: game.AllRole.MyPublicInfo.BattleField.AbilityDamagePlus += int.Parse(minion.光环效果.信息); game.AllRole.YourPublicInfo.BattleField.AbilityDamagePlus += int.Parse(minion.光环效果.信息); break; default: break; } break; case 光环类型枚举.随从成本: switch (minion.光环效果.范围.EffectTargetSelectDirect) { case CardUtility.目标选择方向枚举.本方: game.AllRole.MyPublicInfo.BattleField.MinionCost += int.Parse(minion.光环效果.信息); break; case CardUtility.目标选择方向枚举.对方: game.AllRole.YourPublicInfo.BattleField.MinionCost += int.Parse(minion.光环效果.信息); break; case CardUtility.目标选择方向枚举.双方: game.AllRole.MyPublicInfo.BattleField.MinionCost += int.Parse(minion.光环效果.信息); game.AllRole.YourPublicInfo.BattleField.MinionCost += int.Parse(minion.光环效果.信息); break; default: break; } break; default: break; } } } }
/// <summary> /// Buff的设置 /// </summary> public static void ResetBuff(ActionStatus game) { //去除所有光环效果 //Buff不但是对本方战场产生效果,也可以对对方产生效果,所以必须放到全局的高度 for (int i = 0; i < game.AllRole.MyPublicInfo.BattleField.MinionCount; i++) { if (game.AllRole.MyPublicInfo.BattleField.BattleMinions[i] != null) game.AllRole.MyPublicInfo.BattleField.BattleMinions[i].受战场效果.Clear(); } for (int i = 0; i < game.AllRole.YourPublicInfo.BattleField.MinionCount; i++) { if (game.AllRole.YourPublicInfo.BattleField.BattleMinions[i] != null) game.AllRole.YourPublicInfo.BattleField.BattleMinions[i].受战场效果.Clear(); } game.AllRole.MyPublicInfo.BattleField.AbilityCost = 0; game.AllRole.MyPublicInfo.BattleField.AbilityDamagePlus = 0; game.AllRole.MyPublicInfo.BattleField.MinionCost = 0; game.AllRole.YourPublicInfo.BattleField.AbilityCost = 0; game.AllRole.YourPublicInfo.BattleField.AbilityDamagePlus = 0; game.AllRole.YourPublicInfo.BattleField.MinionCost = 0; //设置光环效果 for (int i = 0; i < game.AllRole.MyPublicInfo.BattleField.MinionCount; i++) { var minion = game.AllRole.MyPublicInfo.BattleField.BattleMinions[i]; if (minion != null && !string.IsNullOrEmpty(minion.光环效果.信息)) { switch (minion.光环效果.类型) { case 光环类型枚举.增加攻防: EffectDefine singleEffect = new EffectDefine(); PointEffect t = new PointEffect(); singleEffect.TrueAtomicEffect = new AtomicEffectDefine(); singleEffect.TrueAtomicEffect.AtomicEffectType = AtomicEffectDefine.AtomicEffectEnum.增益; singleEffect.TrueAtomicEffect.InfoArray = new List<String>(minion.光环效果.信息.Split(CardUtility.strSplitArrayMark.ToCharArray())); singleEffect.FalseAtomicEffect = new AtomicEffectDefine(); singleEffect.FalseAtomicEffect.AtomicEffectType = AtomicEffectDefine.AtomicEffectEnum.未定义; Effecthandler.RunSingleEffect(singleEffect, game, 0); break; case 光环类型枚举.施法成本: switch (minion.光环效果.范围.EffectTargetSelectDirect) { case CardUtility.目标选择方向枚举.本方: game.AllRole.MyPublicInfo.BattleField.AbilityCost += int.Parse(minion.光环效果.信息); break; case CardUtility.目标选择方向枚举.对方: game.AllRole.YourPublicInfo.BattleField.AbilityCost += int.Parse(minion.光环效果.信息); break; case CardUtility.目标选择方向枚举.双方: game.AllRole.MyPublicInfo.BattleField.AbilityCost += int.Parse(minion.光环效果.信息); game.AllRole.YourPublicInfo.BattleField.AbilityCost += int.Parse(minion.光环效果.信息); break; default: break; } break; case 光环类型枚举.法术效果: switch (minion.光环效果.范围.EffectTargetSelectDirect) { case CardUtility.目标选择方向枚举.本方: game.AllRole.MyPublicInfo.BattleField.AbilityDamagePlus += int.Parse(minion.光环效果.信息); break; case CardUtility.目标选择方向枚举.对方: game.AllRole.YourPublicInfo.BattleField.AbilityDamagePlus += int.Parse(minion.光环效果.信息); break; case CardUtility.目标选择方向枚举.双方: game.AllRole.MyPublicInfo.BattleField.AbilityDamagePlus += int.Parse(minion.光环效果.信息); game.AllRole.YourPublicInfo.BattleField.AbilityDamagePlus += int.Parse(minion.光环效果.信息); break; default: break; } break; case 光环类型枚举.随从成本: switch (minion.光环效果.范围.EffectTargetSelectDirect) { case CardUtility.目标选择方向枚举.本方: game.AllRole.MyPublicInfo.BattleField.MinionCost += int.Parse(minion.光环效果.信息); break; case CardUtility.目标选择方向枚举.对方: game.AllRole.YourPublicInfo.BattleField.MinionCost += int.Parse(minion.光环效果.信息); break; case CardUtility.目标选择方向枚举.双方: game.AllRole.MyPublicInfo.BattleField.MinionCost += int.Parse(minion.光环效果.信息); game.AllRole.YourPublicInfo.BattleField.MinionCost += int.Parse(minion.光环效果.信息); break; default: break; } break; default: break; } } } }
/// <summary> /// 根据施法对象获得不同法术 /// </summary> /// <param name="singleEffect"></param> /// <param name="game"></param> /// <param name="PosInfo"></param> /// <returns></returns> private static IAtomicEffect GetEffectHandler(EffectDefine singleEffect, Engine.Client.GameManager 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; } IAtomic.GetField(atomic.InfoArray); return (IAtomicEffect)IAtomic; }
/// <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="MinionPos"></param> public List<String> 发动战吼(int MinionPos, GameManager game) { List<String> ActionCodeLst = new List<string>(); if (!String.IsNullOrEmpty(BattleMinions[MinionPos - 1].战吼效果)) { List<int> PosList = new List<int>(); if (BattleMinions[MinionPos - 1].战吼类型 == MinionCard.战吼类型列表.相邻) { //相邻左边随从存在? if (MinionPos != 1) PosList.Add(MinionPos - 1); //相邻右边随从存在? if (MinionPos != MinionCount) PosList.Add(MinionPos + 1); } else { //自身 PosList.Add(MinionPos); } //处理状态和数值变化 var 战吼 = (Engine.Card.AbilityCard)Engine.Utility.CardUtility.GetCardInfoBySN(BattleMinions[MinionPos - 1].战吼效果); foreach (int PosInfo in PosList) { switch (战吼.FirstAbilityDefine.MainAbilityDefine.TrueAtomicEffect.AtomicEffectType) { case Engine.Effect.AtomicEffectDefine.AtomicEffectEnum.增益: IAtomicEffect IAtomicPoint = new PointEffect(); IAtomicPoint.GetField(战吼.FirstAbilityDefine.MainAbilityDefine.TrueAtomicEffect.InfoArray); IAtomicPoint.DealMinion(game, BattleMinions[PosInfo - 1]); ActionCodeLst.Add(Engine.Server.ActionCode.strPoint + Engine.Utility.CardUtility.strSplitMark + Engine.Utility.CardUtility.strMe + Engine.Utility.CardUtility.strSplitMark + PosInfo + Engine.Utility.CardUtility.strSplitMark + 战吼.FirstAbilityDefine.MainAbilityDefine); break; case Engine.Effect.AtomicEffectDefine.AtomicEffectEnum.状态: IAtomicEffect IAtomicStatus = new StatusEffect(); IAtomicStatus.GetField(战吼.FirstAbilityDefine.MainAbilityDefine.TrueAtomicEffect.InfoArray); IAtomicStatus.DealMinion(game, BattleMinions[PosInfo - 1]); ActionCodeLst.Add(Engine.Server.ActionCode.strStatus + Engine.Utility.CardUtility.strSplitMark + Engine.Utility.CardUtility.strMe + Engine.Utility.CardUtility.strSplitMark + PosInfo + Engine.Utility.CardUtility.strSplitMark + 战吼.FirstAbilityDefine.MainAbilityDefine); break; } switch (战吼.SecondAbilityDefine.MainAbilityDefine.TrueAtomicEffect.AtomicEffectType) { case Engine.Effect.AtomicEffectDefine.AtomicEffectEnum.增益: IAtomicEffect IAtomicPoint = new PointEffect(); IAtomicPoint.GetField(战吼.FirstAbilityDefine.MainAbilityDefine.TrueAtomicEffect.InfoArray); IAtomicPoint.DealMinion(game, BattleMinions[PosInfo - 1]); ActionCodeLst.Add(Engine.Server.ActionCode.strPoint + Engine.Utility.CardUtility.strSplitMark + Engine.Utility.CardUtility.strMe + Engine.Utility.CardUtility.strSplitMark + PosInfo + Engine.Utility.CardUtility.strSplitMark + 战吼.SecondAbilityDefine.MainAbilityDefine); break; case Engine.Effect.AtomicEffectDefine.AtomicEffectEnum.状态: IAtomicEffect IAtomicStatus = new StatusEffect(); IAtomicStatus.GetField(战吼.FirstAbilityDefine.MainAbilityDefine.TrueAtomicEffect.InfoArray); IAtomicStatus.DealMinion(game, BattleMinions[PosInfo - 1]); ActionCodeLst.Add(Engine.Server.ActionCode.strStatus + Engine.Utility.CardUtility.strSplitMark + Engine.Utility.CardUtility.strMe + Engine.Utility.CardUtility.strSplitMark + PosInfo + Engine.Utility.CardUtility.strSplitMark + 战吼.SecondAbilityDefine.MainAbilityDefine); break; } } } return ActionCodeLst; }