/// <summary> /// 回复卡牌 /// </summary> /// <returns></returns> public BaseSkill getRecoverSkill(int number) { //还要消耗栏 UseSkill cardEffect1 = (sender, args) => { BaseRoleAction baseRole = (BaseRoleAction)sender; if (baseRole.GetMp() >= number) { baseRole.SetMp(baseRole.GetMp() - number); return(new ReturnDTO(RETURN_CODE.SUCCESS)); } else { //打断 Console.WriteLine("法力值不足"); return(new ReturnDTO(RETURN_CODE.BATTLE_HAS_NO_MP)); } }; UseSkill cardEffect2 = (sender, args) => { BaseRoleAction baseRole = ((BaseRoleAction)sender); //TODO 让target受到伤害。反射判断target有没有受伤害都脚本 // baseRole.attacked();的动画 baseRole.SetHp(baseRole.GetHp() + number); return(new ReturnDTO(RETURN_CODE.SUCCESS)); }; BaseSkill card = new BaseSkill(2, "回复术", "", 1, 1, 1, false, number, null, "没有什么是钱解决不了的问题", new UseSkill[] { cardEffect1, cardEffect2 }); card.IsAvailable = true; return(card); }
public object CollectManager; //搜集的卡牌列表 public GameModel(long accountId, long roleId) { this.roleId = roleId; this.accountId = accountId; //TODO 初始化一个游戏角色模型! this.baseRole = new PlayerBattleRole(); }
/// <summary> /// 回复卡牌 /// </summary> /// <returns></returns> public BaseCard getRecoverCard(int number) { UseCard cardEffect = (sender, args) => { BaseRoleAction baseRole = (BaseRoleAction)sender; //TODO 让target受到伤害。反射判断target有没有受伤害都脚本 // baseRole.attacked();的动画 baseRole.SetHp(baseRole.GetHp() + number); return(new ReturnDTO(RETURN_CODE.SUCCESS)); }; PermanentCard card = new PermanentCard(2, "回复术", "", 1, 1, 1, false, null, "没有什么是钱解决不了的问题", new UseCard[] { cardEffect }); card.IsAvailable = true; return(card); }
public static UseSkill getSkillWhenNoSkill() { UseSkill boming = (sender, args) => { BaseRoleAction source = (BaseRoleAction)sender; List <BaseRoleAction> baseRoles = ((UseSkillEventArgs)args).targets; var baseRole = baseRoles[0]; //TODO 让target受到伤害。反射判断target有没有受伤害都脚本 // baseRole.attacked();的动画 var hp = (int)Math.Round(source.GetMaxHp() * 0.1, 0); baseRole.SetHp(baseRole.GetHp() - hp); source.SetHp(source.GetHp() - hp); return(new ReturnDTO(RETURN_CODE.SUCCESS)); }; return(boming); }
public static UseSkill checkMpIsEnough(int mp) { //还要消耗栏 UseSkill cardEffect1 = (sender, args) => { BaseRoleAction baseRole = (BaseRoleAction)sender; if (baseRole.GetMp() >= mp) { baseRole.SetMp(baseRole.GetMp() - mp); return(new ReturnDTO(RETURN_CODE.SUCCESS)); } else { //打断 Console.WriteLine("法力值不足"); return(new ReturnDTO(RETURN_CODE.BATTLE_HAS_NO_MP)); } }; return(cardEffect1); }
private void _init(string roomId, long accontId, BaseRoleAction role, RoleType roleType) { this.accontId = accontId; this.id = CommonUtil.getUUID(); this.role = role; this.roomId = roomId; this.roleType = roleType; //初始化房间角色信息 // 信息托管 this.cardList = role.GetBaseCards(); this.skillList = role.GetBaseSkills(); //TODO 如果技能和卡牌为空,那么设置一个默认的技能(搏命!每次消耗10%的最大生命值,造成其同等伤害!) //判断buff效果 foreach (var item in buffs) { if (item.buffType == BuffType.ONE_EFFECT) { item.effect(this.role, this.role); } } }
/// <summary> /// 作用于同一个物体身上 /// </summary> /// <param name="baseRole"></param> /// <param name="baseRoleAction"></param> public virtual void effect(object baseRole, BaseRoleAction baseRoleAction) { //(BaseRoleData)baseRole,用到的时候再转换 }
public TwoPlayerRoomRole(string roomId, BaseRoleAction role, RoleType roleType) : base(roomId, role, roleType) { }
public RoomRole(string roomId, long accontId, BaseRoleAction role, RoleType roleType) { _init(roomId, accontId, role, roleType); }
/// <summary> /// 默认不是自己的回合 /// </summary> //override public bool IsMyTime //{ // get { return isMyTime; } // set // { // isMyTime = value; // //如果我是玩家,进入我的回合 // if (isMyTime && roleType == RoleType.PLAYER) // { // //打印我能用的技能 // foreach (var item in cardList) // { // Console.WriteLine("我拥有卡牌:" + item.Name + " 介绍:" + item.Description); // } // foreach (var item in skillList) // { // Console.WriteLine("我拥有技能:" + item.Name + " 介绍:" + item.Description + "消耗MP:" + item.needMp); // } // } // } //} public RoomRole(string roomId, BaseRoleAction role, RoleType roleType) { _init(roomId, -1, role, roleType); }