Ejemplo n.º 1
0
        /// <summary>
        /// 技能防御
        /// </summary>
        public virtual void DefenseSkill(HeroMono attacker, HeroMono defender)
        {
            long hurt = 0;

            //完全物理攻击,没有任何添加
            hurt = attacker.CurrentAttack + this.Attack - defender.CurrentDefense;
            defender.CurrentLife -= hurt;
            //播放动画
            defender.PlayTriggerAnimation(HeroAnimation.MagicDefense1);
            if (!defender.HasLife())
            {
                defender.ExcuteBuff(Global.BuffActiveState.IsDead);
                defender.ExcuteSkill(Global.BuffActiveState.IsDead);
            }
            else
            {
                //如果是物理攻击防御技能则发动
                defender.ExcuteBuff(Global.BuffActiveState.Attacked);
                defender.ExcuteSkill(Global.BuffActiveState.Attacked);
            }
            //显示HeroHub
            if (hurt > 0)
            {
                defender.ShowHeroHub(HubType.DecreseLife, new ValueUnit(hurt, Global.UnitType.Value));
            }
            else if (hurt == 0)
            {
                defender.ShowHeroHub(HubType.Miss);
            }
            //进行buff判断
            AddSkillBuff(attacker, defender);
            Debug.Log((attacker.IsPlayerHero ? "玩家的" : "敌人的") + attacker.Name + "使用技能" + this.Name + "对" + defender.Name + "造成" + hurt + "点伤害");
        }
Ejemplo n.º 2
0
 public override void DefenseSkill(HeroMono attacker, HeroMono defender)
 {
     //完全魔法攻击,没有任何添加
     defender.CurrentLife += this.CauseHeroProperty.CurrentLife.RealTempValue(defender.CurrentMaxLife);
     //设置为未死亡状态
     defender.IsDeath = false;
     //播放动画
     defender.PlayTriggerAnimation(HeroAnimation.Idle);
     //正常的显示
     defender.ShowHeroHub(HubType.IncreseLife, new ValueUnit(this.CauseHeroProperty.CurrentLife.RealTempValue(defender.CurrentMaxLife), Global.UnitType.Value));
     //进行buff判断
     AddSkillBuff(attacker, defender);
     // Debug.Log((attacker.IsPlayerHero ? "玩家的" : "敌人的") + attacker.Name + "使用技能" + this.Name + "对" + defender.Name + "造成0点伤害");
 }
Ejemplo n.º 3
0
        public override void DefenseSkill(HeroMono attacker, HeroMono defender)
        {
            long hurt = 0;
            //完全物理攻击,没有任何添加
            bool is_physicl_critical = this.IsInPercent(CriticalChance);

            hurt = attacker.CurrentAttack + Mathf.RoundToInt(this.Attack * (is_physicl_critical ? 2 : 1)) - defender.CurrentDefense;
            defender.CurrentLife -= hurt;
            //播放动画
            defender.PlayTriggerAnimation(HeroAnimation.Defense1);
            if (!defender.HasLife())
            {
                defender.ExcuteBuff(Global.BuffActiveState.IsDead);
                defender.ExcuteSkill(Global.BuffActiveState.IsDead);
            }
            else
            {
                //如果是物理攻击防御技能则发动
                defender.ExcuteBuff(Global.BuffActiveState.Attacked);
                defender.ExcuteSkill(Global.BuffActiveState.Attacked);
            }
            //显示HeroHub
            if (is_physicl_critical)
            {
                if (hurt > 0)
                {
                    defender.ShowHeroHub(HubType.Critical, new ValueUnit(hurt, Global.UnitType.Value));
                }
                else if (hurt == 0)
                {
                    defender.ShowHeroHub(HubType.Miss);
                }
            }
            //正常的显示
            else if (hurt > 0)
            {
                defender.ShowHeroHub(HubType.DecreseLife, new ValueUnit(hurt, Global.UnitType.Value));
            }
            else if (hurt == 0)
            {
                defender.ShowHeroHub(HubType.Miss);
            }
            //进行buff判断
            AddSkillBuff(attacker, defender);
            // Debug.Log((attacker.IsPlayerHero ? "玩家的" : "敌人的") + attacker.Name + "使用技能" + this.Name + "对" + defender.Name + "造成" + hurt + "点伤害");
        }