/// <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="worksheet"></param> /// <param name="rowCount"></param> /// <returns></returns> private static EffectDefine GetEffectDefine(dynamic worksheet, ref int rowCount) { EffectDefine effect = new EffectDefine(); //当前行是第一效果的标题栏 rowCount++; //当前行是第一效果的内容栏 effect.AbliltyPosPicker.EffictTargetSelectMode = CardUtility.GetEnum<Engine.Utility.CardUtility.TargetSelectModeEnum>(worksheet.Cells(rowCount, 3).Text, Engine.Utility.CardUtility.TargetSelectModeEnum.不用选择); effect.AbliltyPosPicker.EffectTargetSelectDirect = CardUtility.GetEnum<Engine.Utility.CardUtility.TargetSelectDirectEnum>(worksheet.Cells(rowCount, 4).Text, Engine.Utility.CardUtility.TargetSelectDirectEnum.双方); effect.AbliltyPosPicker.EffectTargetSelectRole = CardUtility.GetEnum<Engine.Utility.CardUtility.TargetSelectRoleEnum>(worksheet.Cells(rowCount, 5).Text, Engine.Utility.CardUtility.TargetSelectRoleEnum.英雄); effect.AbliltyPosPicker.EffectTargetSelectCondition = worksheet.Cells(rowCount, 6).Text; effect.EffectCount = CardUtility.GetInt(worksheet.Cells(rowCount, 7).Text); effect.效果条件 = worksheet.Cells(rowCount, 8).Text; effect.TrueAtomicEffect.描述 = worksheet.Cells(rowCount, 9).Text; effect.TrueAtomicEffect.AtomicEffectType = CardUtility.GetEnum<Engine.Effect.AtomicEffectDefine.AtomicEffectEnum>(worksheet.Cells(rowCount, 10).Text, Engine.Effect.AtomicEffectDefine.AtomicEffectEnum.未定义); for (int i = 11; i < 15; i++) { if (String.IsNullOrEmpty(worksheet.Cells(rowCount, i).Text)) break; effect.TrueAtomicEffect.InfoArray.Add((worksheet.Cells(rowCount, i).Text)); } if (effect.效果条件 != CardUtility.strIgnore) { rowCount++; //当前行是第二效果的标题栏 rowCount++; //当前行是第二效果的内容栏 effect.FalseAtomicEffect.描述 = worksheet.Cells(rowCount, 9).Text; effect.FalseAtomicEffect.AtomicEffectType = CardUtility.GetEnum<Engine.Effect.AtomicEffectDefine.AtomicEffectEnum>(worksheet.Cells(rowCount, 10).Text, Engine.Effect.AtomicEffectDefine.AtomicEffectEnum.未定义); for (int i = 11; i < 15; i++) { if (String.IsNullOrEmpty(worksheet.Cells(rowCount, i).Text)) break; effect.FalseAtomicEffect.InfoArray.Add((worksheet.Cells(rowCount, i).Text)); } } return effect; }
/// <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> /// 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> public void Init() { MainAbilityDefine = new EffectDefine(); AppendAbilityDefine = new EffectDefine(); }
/// <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="RandomSeed"></param> /// <returns></returns> public static List<String> RunSingleEffect(EffectDefine singleEffect, Engine.Client.GameManager game, int RandomSeed) { List<String> Result = new List<string>(); List<String> PosList = GetTargetList(singleEffect.AbliltyPosPicker, game, RandomSeed); foreach (String PosInfo in PosList) { var PosField = PosInfo.Split(CardUtility.strSplitMark.ToCharArray()); var strResult = String.Empty; if (PosField[0] == CardUtility.strMe) { switch (int.Parse(PosField[1])) { case Engine.Client.BattleFieldInfo.HeroPos: Result.Add(GetEffectHandler(singleEffect, game, CardUtility.strMe + CardUtility.strSplitMark + Client.BattleFieldInfo.HeroPos.ToString("D1")).DealHero(game, game.MyInfo)); break; case Engine.Client.BattleFieldInfo.AllMinionPos: for (int i = 0; i < game.MyInfo.BattleField.MinionCount; i++) { Result.Add(GetEffectHandler(singleEffect, game, CardUtility.strMe + CardUtility.strSplitMark + (i + 1).ToString("D1")).DealMinion(game, game.MyInfo.BattleField.BattleMinions[i])); } break; case Engine.Client.BattleFieldInfo.AllRolePos: Result.Add(GetEffectHandler(singleEffect, game, CardUtility.strMe + CardUtility.strSplitMark + Client.BattleFieldInfo.HeroPos.ToString("D1")).DealHero(game, game.MyInfo)); for (int i = 0; i < game.MyInfo.BattleField.MinionCount; i++) { Result.Add(GetEffectHandler(singleEffect, game, CardUtility.strMe + CardUtility.strSplitMark + (i + 1).ToString("D1")).DealMinion(game, game.MyInfo.BattleField.BattleMinions[i])); } break; default: Result.Add(GetEffectHandler(singleEffect, game, PosInfo).DealMinion(game, game.MyInfo.BattleField.BattleMinions[int.Parse(PosField[1]) - 1])); break; } } else { switch (int.Parse(PosField[1])) { case Engine.Client.BattleFieldInfo.HeroPos: Result.Add(GetEffectHandler(singleEffect, game, CardUtility.strYou + CardUtility.strSplitMark + Client.BattleFieldInfo.HeroPos.ToString("D1")).DealHero(game, game.YourInfo)); break; case Engine.Client.BattleFieldInfo.AllMinionPos: for (int i = 0; i < game.YourInfo.BattleField.MinionCount; i++) { Result.Add(GetEffectHandler(singleEffect, game, CardUtility.strYou + CardUtility.strSplitMark + (i + 1).ToString("D1")).DealMinion(game, game.YourInfo.BattleField.BattleMinions[i])); } break; case Engine.Client.BattleFieldInfo.AllRolePos: Result.Add(GetEffectHandler(singleEffect, game, CardUtility.strYou + CardUtility.strSplitMark + Client.BattleFieldInfo.HeroPos.ToString("D1")).DealHero(game, game.YourInfo)); for (int i = 0; i < game.YourInfo.BattleField.MinionCount; i++) { Result.Add(GetEffectHandler(singleEffect, game, CardUtility.strYou + CardUtility.strSplitMark + (i + 1).ToString("D1")).DealMinion(game, game.YourInfo.BattleField.BattleMinions[i])); } break; default: Result.Add(GetEffectHandler(singleEffect, game, PosInfo).DealMinion(game, game.YourInfo.BattleField.BattleMinions[int.Parse(PosField[1]) - 1])); break; } } } return Result; }
/// <summary> /// 运行单一效果 /// </summary> /// <param name="game"></param> /// <param name="Ability"></param> /// <param name="Result"></param> private static void RunEffect(ActionStatus game, EffectDefine SingleEffect, List<string> Result) { switch (SingleEffect.TrueAtomicEffect.AtomicEffectType) { case AtomicEffectDefine.AtomicEffectEnum.卡牌: case AtomicEffectDefine.AtomicEffectEnum.水晶: case AtomicEffectDefine.AtomicEffectEnum.召唤: case AtomicEffectDefine.AtomicEffectEnum.武器: Result.AddRange(RunGameSystemEffect(game, SingleEffect.TrueAtomicEffect, SingleEffect.AbliltyPosPicker)); break; case AtomicEffectDefine.AtomicEffectEnum.控制: Result.AddRange(ControlEffect.RunEffect(game, SingleEffect.AbliltyPosPicker.SelectedPos.ToString())); break; case AtomicEffectDefine.AtomicEffectEnum.未定义: break; default: Result.AddRange(Effecthandler.RunSingleEffect(SingleEffect, game, ActionStatus.RandomSeed)); break; } }
/// <summary> /// 实施效果 /// </summary> /// <param name="singleEffect"></param> /// <param name="game"></param> /// <param name="RandomSeed"></param> /// <returns></returns> public static List <string> RunSingleEffect(EffectDefine singleEffect, ActionStatus game, int RandomSeed) { List <string> Result = new List <string>(); List <string> PosList = SelectUtility.GetTargetList(singleEffect.AbliltyPosPicker, game, RandomSeed); foreach (string PosInfo in PosList) { var PosField = PosInfo.Split(CardUtility.strSplitMark.ToCharArray()); var strResult = string.Empty; if (PosField[0] == CardUtility.strMe) { switch (int.Parse(PosField[1])) { case BattleFieldInfo.HeroPos: Result.Add(GetEffectHandler(singleEffect, game, CardUtility.strMe + CardUtility.strSplitMark + BattleFieldInfo.HeroPos.ToString("D1")).DealHero(game, game.AllRole.MyPublicInfo)); break; case BattleFieldInfo.AllMinionPos: for (int i = 0; i < game.AllRole.MyPublicInfo.BattleField.MinionCount; i++) { Result.Add(GetEffectHandler(singleEffect, game, CardUtility.strMe + CardUtility.strSplitMark + (i + 1).ToString("D1")).DealMinion(game, game.AllRole.MyPublicInfo.BattleField.BattleMinions[i])); } break; case BattleFieldInfo.AllRolePos: Result.Add(GetEffectHandler(singleEffect, game, CardUtility.strMe + CardUtility.strSplitMark + BattleFieldInfo.HeroPos.ToString("D1")).DealHero(game, game.AllRole.MyPublicInfo)); for (int i = 0; i < game.AllRole.MyPublicInfo.BattleField.MinionCount; i++) { Result.Add(GetEffectHandler(singleEffect, game, CardUtility.strMe + CardUtility.strSplitMark + (i + 1).ToString("D1")).DealMinion(game, game.AllRole.MyPublicInfo.BattleField.BattleMinions[i])); } break; default: Result.Add(GetEffectHandler(singleEffect, game, PosInfo).DealMinion(game, game.AllRole.MyPublicInfo.BattleField.BattleMinions[int.Parse(PosField[1]) - 1])); break; } } else { switch (int.Parse(PosField[1])) { case BattleFieldInfo.HeroPos: Result.Add(GetEffectHandler(singleEffect, game, CardUtility.strYou + CardUtility.strSplitMark + BattleFieldInfo.HeroPos.ToString("D1")).DealHero(game, game.AllRole.YourPublicInfo)); break; case BattleFieldInfo.AllMinionPos: for (int i = 0; i < game.AllRole.YourPublicInfo.BattleField.MinionCount; i++) { Result.Add(GetEffectHandler(singleEffect, game, CardUtility.strYou + CardUtility.strSplitMark + (i + 1).ToString("D1")).DealMinion(game, game.AllRole.YourPublicInfo.BattleField.BattleMinions[i])); } break; case BattleFieldInfo.AllRolePos: Result.Add(GetEffectHandler(singleEffect, game, CardUtility.strYou + CardUtility.strSplitMark + BattleFieldInfo.HeroPos.ToString("D1")).DealHero(game, game.AllRole.YourPublicInfo)); for (int i = 0; i < game.AllRole.YourPublicInfo.BattleField.MinionCount; i++) { Result.Add(GetEffectHandler(singleEffect, game, CardUtility.strYou + CardUtility.strSplitMark + (i + 1).ToString("D1")).DealMinion(game, game.AllRole.YourPublicInfo.BattleField.BattleMinions[i])); } break; default: Result.Add(GetEffectHandler(singleEffect, game, PosInfo).DealMinion(game, game.AllRole.YourPublicInfo.BattleField.BattleMinions[int.Parse(PosField[1]) - 1])); break; } } } return(Result); }