/// <summary>
    /// Called when a cast is sucesfully finished. Heals the numberTargets lowest raiders.
    /// </summary>
    public override void OnCastSucess()
    {
        List <Raider> raiderDict = RaiderDB.GetInstance().GetAllRaidersSortedByHealth();

        if (raiderDict.Count() < numberTargets) //if less raiders are alive than we can target, decrease number of targets
        {
            numberTargets = raiderDict.Count();
        }

        for (int i = 0; i < numberTargets; i++) //heal numberTargets raider
        {
            Raider target = raiderDict.First();
            if (target.IsAlive())
            {
                target.Heal(healAmount);
            }
            raiderDict.Remove(target);
        }
    }
예제 #2
0
    /// <summary>
    /// Called on every fixed update, i.e. 50 times a second.
    /// </summary>
    void FixedUpdate()
    {
        if (!Gamestate.gamestate.GetPaused())
        {
            currentTargetTimer += 0.02f;
            currentSwingTimer  += 0.02f;

            if (target == null || !target.IsAlive() || currentTargetTimer >= changeTargetTimer) //if we don't have a target, the target is dead or we are rdy for a targetchange, select a new target
            {
                ChangeTarget();
            }

            if (currentSwingTimer >= swingTimer) //the attack timer is rdy
            {
                target.Damage(dmg);
                dmg += multiplier;
                currentSwingTimer = 0f;
            }
        }
    }
예제 #3
0
    /// <summary>
    /// Checks if we can cast the spell and starts the cast procedure.
    /// </summary>
    public void StartCast()
    {
        if (!gamestate.GetCastBar().IsCasting() && !gamestate.GetGcdBar().GetIsInGcd() && !onCooldown)
        { //we are not casting, are not in an gcd (Global Cooldown) and the spell is not on cooldown
            target = gamestate.GetTarget();
            if (target != null && target.IsAlive())
            {
                if (manaCost >= 0) //spell costs Mana
                {
                    if (gamestate.DecreaseMana(manaCost))
                    {                                       //we have enough Mana to cast the spell
                        if (castTime == 0)
                        {
                            CastInstant(); //spell with no casttime
                        }
                        else
                        {
                            StartCoroutine(Cast()); //spell with casttime
                        }
                    }
                }
                else //spel regenerates Mana
                {
                    gamestate.IncreaseMana(manaCost * -1);

                    if (castTime == 0)
                    {
                        CastInstant(); //spell with no casttime
                    }
                    else
                    {
                        StartCoroutine(Cast()); //spell with casttime
                    }
                }
            }
        }
    }
예제 #4
0
    /// <summary>
    /// Called on every fixet update.
    /// </summary>
    void FixedUpdate()
    {
        if (target == null || target != null && !target.IsAlive()) //Change target if has no target or target is dead
        {
            ChangeTarget();
        }

        if (canAttack) //AutoAttack Damage
        {
            target.Damage(dmgAutoAttack);
            timer          = StartCoroutine(Timer(swingTimerAutoAttack));
            dmgAutoAttack += multiplierAutoAttack;
        }

        swingTimerCleaveCurrent += 0.02f;
        swingTimerFixateCurrent += 0.02f;


        if (swingTimerCleaveCurrent > swingTimerCleave - 2.05f && swingTimerCleaveCurrent < swingTimerCleave - 1.95f)
        {
            GetComponent <Boss>().SetEmoteText(" " + emoteText1);
        }
        else if (swingTimerFixateCurrent > swingTimerFixate - 2.05f && swingTimerFixateCurrent < swingTimerFixate - 1.95f)
        {
            GetComponent <Boss>().SetEmoteText(" " + emoteText2);
        }

        //cooldownoverlay cleave
        cooldownOverlayCleave.fillAmount = swingTimerCleaveCurrent / swingTimerCleave;

        //cooldownoverlay fixate
        cooldownOverlayFixate.fillAmount = swingTimerFixateCurrent / swingTimerFixate;

        if (swingTimerCleaveCurrent >= swingTimerCleave) //cleave
        {
            AttackCleave();
            cleavesBetweenFixateRemaining--;
            swingTimerCleaveCurrent = 0f;

            if (cleavesBetweenFixateRemaining > 0)
            {
                swingTimerCleave = swingTimer;
            }
            else
            {
                swingTimerCleave = swingTimer * 2 + DELAYFIXATE * (hitsFixate - 1);
            }
        }

        if (swingTimerFixateCurrent >= swingTimerFixate) //fixate
        {
            StopAllCoroutines();                         //stop autoattacks
            canAttack = false;

            AttackFixate();

            countFixate++;
            swingTimerFixateCurrent = 0f;
            if (countFixate >= hitsFixate)
            {
                ChangeTarget();
                timer            = StartCoroutine(Timer(0.5f));
                dmgFixateCurrent = dmgFixate;
                countFixate      = 0;
                cleavesBetweenFixateRemaining = cleavesBetweenFixate;
                swingTimerFixate        = swingTimer * (cleavesBetweenFixate + 1);
                swingTimerCleaveCurrent = swingTimer + DELAYFIXATE * (hitsFixate - 1);
            }
            else
            {
                swingTimerFixate = DELAYFIXATE;
            }
        }
    }