示例#1
0
        public void Attack(Hero target)
        {
            if (_battleCon._crystalMon <= 0)
            {
                //Debug.Log("end 3");
                _battleCon._waitEndTurn = true;
                return;
            }
            _anim.SetTrigger("IsAttack");
            //_anim.SetBool("IsAttack", true);
            OnPassiveWorking();
            int useCrystal = Random.Range(1, 11);

            //Debug.Log("b crystal " + _battleCon._crystalMon+"use "+ useCrystal);
            skill = attack[0];

            if (_hate >= 100)
            {
                if (Random.Range(0f, 1f) > 0.5f)
                {
                    Hate       = 0;
                    useCrystal = attack[1].skill.crystal;
                    skill      = attack[1];
                }
            }
            int oldCrystal = _battleCon._crystalMon;

            _battleCon._crystalMon -= useCrystal;
            //Debug.Log("f crystal " + _battleCon._crystalMon);
            if (_buffCon._defenseList.ToList().Count > 0 && _buffCon._defenseList[0].crystal == (useCrystal > oldCrystal? oldCrystal > 3? oldCrystal / 3 : oldCrystal : useCrystal) && skill.skill.effect != "")
            {
                //Debug.Log("defense crystal " + _buffCon._defenseList[0].crystal);
                _battleCon.RunCounterAttack();
                target.Hate += (int)(skill.hate * 1.5);
            }
            else
            {
                if (skill.skill.type == _Attack.PHYSICAL)
                {
                    //Debug.Log("mon damage " + ATK + " skill bonus " + skill.skill.bonusDmg + " dmg*bonus " + (ATK * skill.skill.bonusDmg)+" - def "+ target.hero.DEF);
                    _damage = (int)(ATK * skill.skill.bonusDmg * _passiveBonusATK * _eventBonusDmg * _buffBonusATK - target.hero.DEF * _buffBonusDEF * _passiveBonusDEF);
                }
                else
                {
                    //Debug.Log("mon damage " + ATK + " skill bonus " + skill.skill.bonusDmg + " dmg*bonus " + (ATK * skill.skill.bonusDmg) + " - mdef " + target.hero.MDEF);
                    _damage = (int)(ATK * skill.skill.bonusDmg * _passiveBonusMATK * _eventBonusDmg * _buffBonusMATK - target.hero.MDEF * _buffBonusMDEF * _passiveBonusMDEF);
                }

                if (type - target.hero.hero.type == -1 || type - target.hero.hero.type == 2)
                {
                    _damage = (int)(_damage * 1.25);
                }
                else if (type - target.hero.hero.type == 0)
                {
                    _damage = _damage;
                }
                else
                {
                    _damage = (int)(_damage * 0.75);
                }
                //Debug.Log("mon damage final " + _damage);
                target.hp -= _damage;
                for (int i = 0; i < skill.buff.Count; i++)
                {
                    skill.buff[i].startTime    = _battleCon._turnAround;
                    skill.buff[i].originalSize = _originalSize;
                    _buffCon.AddBuff(skill.buff[i]);
                }
                target.Hate += skill.hate;
                _battleCon.AttackEffect(skill, _damage, _Model.PLAYER);
            }

            Hate += skill.hate / 3;
            _buffCon.RemoveDefense(0);
            attackCount++;
        }
示例#2
0
        public void Attack(bool ultimate = false, bool questionFail = false, int stack = 1)
        {
            _anim.SetTrigger("IsAttack");
            if (ultimate)
            {
                skill = hero.attack[1];
            }
            else
            {
                skill = hero.attack[0];
            }

            Monster target = _battleCon.GetMonFocus();

            OnPassiveWorking();

            for (int i = 0; i < skill.buff.Count; i++)
            {
                skill.buff[i].startTime    = _battleCon._turnAround;
                skill.buff[i].originalSize = _originalSize;
                _buffCon.AddBuff(skill.buff[i]);
            }

            if (skill.skill.type != _Attack.BUFF)
            {
                //Damage = Damage + 500;//for tester.

                if (skill.skill.type == _Attack.PHYSICAL)
                {
                    //Debug.Log("hero damage " + hero.ATK + " skill bonus " + skill.skill.bonusDmg + " dmg*bonus " + (hero.ATK * skill.skill.bonusDmg) + " - def " + target.DEF);
                    _damage = (int)(hero.ATK * skill.skill.bonusDmg * _passiveBonusATK * _eventBonusDmg * _buffBonusATK * stack - target.DEF * _buffBonusDEF * _passiveBonusDEF);
                }
                else
                {
                    //Debug.Log("hero damage " + hero.ATK + " skill bonus " + skill.skill.bonusDmg + " dmg*bonus " + (hero.ATK * skill.skill.bonusDmg) + " - mdef " + target.MDEF);
                    _damage = (int)(hero.ATK * skill.skill.bonusDmg * _passiveBonusMATK * _eventBonusDmg * _buffBonusMATK * stack - target.MDEF * _buffBonusMDEF * _passiveBonusMDEF);
                }

                if (hero.hero.type - target.type == -1 || hero.hero.type - target.type == 2)
                {
                    _damage = (int)(_damage * 1.25);
                }
                else if (hero.hero.type - target.type == 0)
                {
                    _damage = _damage;
                }
                else
                {
                    _damage = (int)(_damage * 0.75);
                }
                int hpOld = target.hp;
                if (questionFail)
                {
                    _damage = _damage / 2;
                }
                //Debug.Log("hero damage final " + _damage);
                target.hp -= _damage;
                _battleCon._damage_of_each_hero[_battleCon.GetMonFocus().slotId, slotId] += hpOld - target.hp;
            }
            else
            {
                _damage = _damage * 0;
            }

            target.Hate += skill.hate;
            Hate        += (skill.hate / 3) * stack;

            _battleCon.AttackEffect(skill, _damage, _Model.MONSTER);
        }