void AttackTo(BaseHero from, BaseHero hero) { from.ReduceHP(expend, true); hero.ReduceHP(attackHP); UnityTools.Log(from.name + " 使用 " + name + " 攻击 " + hero.name + " 造成 " + attackHP + " 点伤害,消耗 " + expend + "点血量"); HeroAction treatAction = new HeroAction(); treatAction.action = HeroActionType.Skill; SkillAction skillAction = new SkillAction(); skillAction.action = SkillActionType.MiniHP; skillAction.args = new object[] { expend }; treatAction.args = new object[] { from, hero, this, skillAction }; from.AddAction(treatAction); HeroAction treatAction1 = new HeroAction(); treatAction1.action = HeroActionType.Skill; SkillAction skillAction1 = new SkillAction(); skillAction1.action = SkillActionType.MiniHP; skillAction1.args = new object[] { attackHP }; treatAction1.args = new object[] { from, hero, this, skillAction1 }; hero.AddAction(treatAction1); }
void AttackTo(BaseHero from, BaseHero hero) { from.ReduceMP(expend); hero.ReduceHP(attackHP); UnityTools.Log(from.name + " 使用 " + name + " 攻击 " + hero.name + " 造成 " + attackHP + " 点伤害,眩晕" + dizzDuration + "毫秒,消耗 " + expend + "点MP"); HeroAction treatAction = new HeroAction(); treatAction.action = HeroActionType.Skill; SkillAction skillAction = new SkillAction(); skillAction.action = SkillActionType.MiniMP; skillAction.args = new object[] { expend }; treatAction.args = new object[] { from, hero, this, skillAction }; from.AddAction(treatAction); HeroAction treatAction1 = new HeroAction(); treatAction1.action = HeroActionType.Skill; SkillAction skillAction1 = new SkillAction(); skillAction1.action = SkillActionType.MiniHP; skillAction1.args = new object[] { attackHP }; treatAction1.args = new object[] { from, hero, this, skillAction1 }; hero.AddAction(treatAction1); Buff buff = new Buff(); buff.type = BuffType.Dizzy; buff.start = now; buff.duration = dizzDuration; hero.AddBuff(buff); }
void normalAttack() { BaseHero target = null; foreach (BaseHero hero in GameData.g_listHero) { if (hero.group != group) { target = hero; } } if (target != null) { HeroAction action = new HeroAction(); action.action = HeroActionType.Attack; action.args = new object[] { target }; actions.Enqueue(action); uint randAttack = GameData.g_srand.Next((uint)(attackMax - attackMin)); Fix64 reduce = (attackMin + randAttack) / 100; if (armor >= Fix64.Zero) { Fix64 percent = (target.armor / 100 * 6) / (100 + target.armor / 100 * 6); reduce = reduce * (Fix64.One - percent); } else { Fix64 deeper = (Fix64)2 - Fix64.Pow((Fix64)0.94, (int)(Fix64.Abs(target.armor) / 100)); reduce = reduce * deeper; } target.ReduceHP(reduce); target.BeAttack(this); } }