/// <summary> /// 抽牌魔法 /// </summary> /// <param name="role"></param> /// <param name="magic"></param> public static void ModifyCardStock(RoleInfo role, EffectDefine magic) { //抽牌 var cards = role.cardStock.DrawCard(magic.StandardEffectPoint); //加入手牌 role.handCards.AddRange(cards); }
/// <summary> /// 一个完整的(魔法)效果定义 /// </summary> /// <summary> /// 使用单个魔法效果 /// </summary> /// <param name="enviroment">整个战场环境</param> /// <param name="IsFirst">是先手玩家还是后手玩家</param> /// <param name="magic">使用魔法定义</param> /// <remarks>服务器端方法,一张卡牌通常会有选择或者副作用,这是客户端处理的东西</remarks> public static RoleInfo GetSingleTargetRole(BattleEnviroment enviroment, Boolean IsFirst, EffectDefine magic) { RoleInfo SingleTargetRole = null; switch (magic.EffectTargetSelectDirect) { case CardUtility.TargetSelectDirectEnum.本方: if (IsFirst) { SingleTargetRole = enviroment.FirstPlayer; } else { SingleTargetRole = enviroment.SecondPlayer; } break; case CardUtility.TargetSelectDirectEnum.对方: if (IsFirst) { SingleTargetRole = enviroment.SecondPlayer; } else { SingleTargetRole = enviroment.FirstPlayer; } break; case CardUtility.TargetSelectDirectEnum.无限制: break; default: break; } return SingleTargetRole; }
/// <summary> /// 对法力水晶的法术实施 /// </summary> /// <param name="role"></param> /// <param name="magic"></param> public static void ModifyCrystal(RoleInfo role, EffectDefine magic) { string[] Op = magic.AddtionInfo.Split("/".ToCharArray()); int point = 0; //±N/±N 增加减少 可用水晶 / 增加减少 空水晶 //可用水晶 if (Op[0].Substring(1, 1) != "0") { point = int.Parse(Op[0].Substring(1, 1)); if (Op[0].Substring(0, 1) == "+") { for (int i = 0; i < point; i++) { role.crystal.AddCurrentPoint(); } } else { for (int i = 0; i < point; i++) { role.crystal.ReduceCurrentPoint(); } } } //空水晶 if (Op[1].Substring(1, 1) != "0") { point = int.Parse(Op[1].Substring(1, 1)); if (Op[1].Substring(0, 1) == "+") { for (int i = 0; i < point; i++) { role.crystal.AddFullPoint(); } } else { for (int i = 0; i < point; i++) { role.crystal.ReduceFullPoint(); } } } }