/// <summary>
 /// Performs a simple auto-attack on the specified player. The calling procedure is responsible
 /// to ensure that the auto-attack is only called when off cooldown.
 /// </summary>
 /// <returns>
 /// The new cooldown of the auto-attack.
 /// </returns>
 /// <param name='enemy'>
 /// The enemy to attack.
 /// </param>
 public float autoAttack(EnemyScript enemy)
 {
     a.Stop();
         setRunning(false);
         a.Play("Attack" + (((int)(Random.value * 3)) + 1));
         enemy.damage(WeaponDamage);
         ValorDebuff debuff = new ValorDebuff(valorDebuffTexture);
         enemy.applyDebuff(debuff, true);
         lastCombatTime = Time.time;
         stunTime = Time.time + 1f; //Delay after attack
         return Time.time + WeaponSpeed;
 }
    /*
     * Returns the time of the next auto-attack
     * */
    public float autoAttack(EnemyScript enemy)
    {
        float damageAmount = getWeaponDamage();
        if(finalHourActive){
            damageAmount *= 1.4f;
            awardHealth (damageAmount * .5f);
        }

        if(tumbleAttack){
            damageAmount *= 1.3f;
            tumbleAttack = false;
        }

        currentMana += 10;
        if(currentMana > maxMana)
            currentMana = maxMana;

        string[] keys = new string[debuffs.Keys.Count];
        debuffs.Keys.CopyTo(keys, 0);

        //Check for expired debuffs
        foreach(string obj in keys){
            Debuff debuff = (Debuff) debuffs[obj];
            damageAmount = debuff.applyDebuff(damageAmount);
        }

        GameObject bolt = (GameObject) Instantiate(boltObject, gameObject.transform.position, Quaternion.identity);
        SeekingProjectileScript seekScript = bolt.GetComponent(typeof(SeekingProjectileScript)) as SeekingProjectileScript;
        seekScript.setTarget(enemy.gameObject);
        seekScript.setDamage(damageAmount);
        seekScript.setSpeed(1.5f);
        enemy.applyDebuff(new SwiftDeathDebuff(enemy), false);

        Stun(1f);

        a.Stop();
        a.Play("Attack" + (((int)(Random.value * 2)) + 1));
        running = false;
        lastCombatTime = Time.time;
        //enemy.damage(damageAmount);
        return Time.time + WeaponSpeed;
    }