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)
        {
            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 + "点伤害");
        }
Ejemplo n.º 3
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.º 4
0
        /// <summary>
        /// 执行一个Buff或者Debuff
        /// </summary>
        /// <param name="hero">buff执行对象</param>
        /// <param name="buff">要执行的buff</param>
        public void ExcuteBuff(HeroMono hero, Buff buff)
        {
            long temp = 0;

            switch (buff.BuffType)
            {
            case Global.BuffType.IncreaseAttack:
                temp = buff.ChangeHeroProperty.Attack.RealTempValue(hero.CurrentAttack);
                hero.CurrentAttack += temp;
                if (temp > 0)
                {
                    hero.ShowHeroHub(HubType.IncreseAttack, new ValueUnit(temp, Global.UnitType.Value));
                }
                else
                {
                    hero.ShowHeroHub(HubType.DecreseAttack, new ValueUnit(-temp, Global.UnitType.Value));
                }
                break;

            case Global.BuffType.IncreaseDefense:
                temp = buff.ChangeHeroProperty.Defense.RealTempValue(hero.CurrentDefense);
                hero.CurrentDefense += temp;
                if (temp > 0)
                {
                    hero.ShowHeroHub(HubType.IncreseDefense, new ValueUnit(temp, Global.UnitType.Value));
                }
                else
                {
                    hero.ShowHeroHub(HubType.DecreseDefense, new ValueUnit(-temp, Global.UnitType.Value));
                }
                break;

            case Global.BuffType.IncreaseLife:
                temp              = buff.ChangeHeroProperty.CurrentLife.RealTempValue(hero.CurrentMaxLife);
                hero.CurrentLife += temp;
                if (temp > 0)
                {
                    hero.ShowHeroHub(HubType.IncreseLife, new ValueUnit(temp, Global.UnitType.Value));
                }
                else
                {
                    hero.ShowHeroHub(HubType.DecreseLife, new ValueUnit(-temp, Global.UnitType.Value));
                }
                break;

            case Global.BuffType.IncreaseMagic:
                temp = buff.ChangeHeroProperty.CurrentMagic.RealTempValue(hero.CurrentMaxMagic);
                hero.CurrentMagic += temp;
                if (temp > 0)
                {
                    hero.ShowHeroHub(HubType.IncreseMagic, new ValueUnit(temp, Global.UnitType.Value));
                }
                else
                {
                    hero.ShowHeroHub(HubType.DecreseMagic, new ValueUnit(-temp, Global.UnitType.Value));
                }
                break;

            case Global.BuffType.IncreaseMagicAttack:
                temp = buff.ChangeHeroProperty.MagicAttack.RealTempValue(hero.CurrentMagicAttack);
                hero.CurrentMagicAttack += temp;
                if (temp > 0)
                {
                    hero.ShowHeroHub(HubType.IncreseMagicAttack, new ValueUnit(temp, Global.UnitType.Value));
                }
                else
                {
                    hero.ShowHeroHub(HubType.DecreseMagicAttack, new ValueUnit(-temp, Global.UnitType.Value));
                }
                break;

            case Global.BuffType.IncreaseMagicDefense:
                temp = buff.ChangeHeroProperty.MagicDefense.RealTempValue(hero.CurrentMagicDefense);
                hero.CurrentMagicDefense += temp;
                if (temp > 0)
                {
                    hero.ShowHeroHub(HubType.IncreseMagicDefense, new ValueUnit(temp, Global.UnitType.Value));
                }
                else
                {
                    hero.ShowHeroHub(HubType.DecreseMagicDefense, new ValueUnit(-temp, Global.UnitType.Value));
                }
                break;

            case Global.BuffType.IncreaseSpeed:
                temp = buff.ChangeHeroProperty.Speed.RealTempValue(hero.CurrentSpeed);
                hero.CurrentSpeed += temp;
                if (temp > 0)
                {
                    hero.ShowHeroHub(HubType.IncreseSpeed, new ValueUnit(temp, Global.UnitType.Value));
                }
                else
                {
                    hero.ShowHeroHub(HubType.DecreseSpeed, new ValueUnit(-temp, Global.UnitType.Value));
                }
                break;

            case Global.BuffType.IncreaseMaxLife:
                temp = buff.ChangeHeroProperty.MaxLife.RealTempValue(hero.CurrentMaxLife);
                hero.CurrentMaxLife += temp;
                if (temp > 0)
                {
                    hero.ShowHeroHub(HubType.IncreseMaxLife, new ValueUnit(temp, Global.UnitType.Value));
                }
                else
                {
                    hero.ShowHeroHub(HubType.DecreseMaxLife, new ValueUnit(-temp, Global.UnitType.Value));
                }
                break;

            case Global.BuffType.IncreaseMaxMagic:
                temp = buff.ChangeHeroProperty.MaxMagic.RealTempValue(hero.CurrentMaxMagic);
                hero.CurrentMaxMagic += temp;
                if (temp > 0)
                {
                    hero.ShowHeroHub(HubType.IncreseMaxMagic, new ValueUnit(-temp, Global.UnitType.Value));
                }
                else
                {
                    hero.ShowHeroHub(HubType.DecreseMaxMagic, new ValueUnit(-temp, Global.UnitType.Value));
                }
                break;

            case Global.BuffType.ActiveTurn:
                hero.CurrentTurnLast += buff.ChangeHeroProperty.Turn;
                BattleController.Instance.DebugLog(LogType.INFO, hero.Name + "回合数增加:" + buff.ChangeHeroProperty.Turn);
                break;
            }
        }