Exemplo n.º 1
0
 protected override void beforeAttack()
 {
     if (this.Target.transform == GameManager.gameMain.GetBoss() && this.healPoint.CurValue<this.healPoint.MaxValue/2)
     {
         Skillbase heroPower = this.passiveSkill.Find((sk) => { return sk.SkillId == Skill.HeroPower; });
         if (heroPower != null )
             heroPower.Cast(this);
     }
 }
Exemplo n.º 2
0
    public IEnumerator Attack()
    {
        while (attacking)
        {
            if (attackCooldown > Time.time)
            {
                yield return(new WaitForSeconds(0.03f));

                continue;
            }
            attackCooldown = Time.time + 200f / this.speed.MaxValue;
            beforeAttack();
            this.chara.DoAttack();

            bool doAttack = true;
            if (this.skills.Count > 0 && Random.Range(0, 100) < 20)
            {
                int       castSkId  = Random.Range(0, this.skills.Count);
                Skillbase castSkill = this.skills[castSkId];
                if (castSkill.Cast(this))
                {
                    this.manaPoint.Exp += 1;
                    this.chara.OnSkillCast(castSkill);
                    doAttack = false;
                }
            }
            if (doAttack)
            {
                int floatDmg = Random.Range(this.luck.MaxValue / -5, this.luck.MaxValue / 5);
                int atk      = this.attack.MaxValue + floatDmg;
                this.attack.Exp += (floatDmg > 0)?1:0;
                this.luck.Exp   += (floatDmg == this.luck.MaxValue / 5 ? -1 : floatDmg == (this.luck.MaxValue / 5 - 1) ? 1 : 0);
                this.Target.OnAttack(this, this.attack.MaxValue, this.luck.MaxValue);
            }
            yield return(new WaitForSeconds(200f / this.speed.MaxValue));
        }
    }