/// <summary>
    /// Called when the buff is destroyed.
    /// </summary>
    public override void OnDestroy()
    {
        if (GameControl.control.talente[3])
        {
            if (jumpsLeft > 0)
            {
                List <Raider> raiderDict = RaiderDB.GetInstance().GetAllRaidersSortedByHealth();
                raiderDict.Remove(GetRaider());

                int countRaider = raiderDict.Count;
                for (int i = 0; i < countRaider; i++)
                {
                    Raider target = raiderDict.First();

                    if (!target.GetGameObject().GetComponent <RenewHot>())
                    {
                        target = raiderDict.First();
                        RenewHot buff = target.GetGameObject().AddComponent <RenewHot>();
                        buff.jumpsLeft = jumpsLeft - 1;
                        break;
                    }

                    raiderDict.Remove(target);
                }
            }
        }
    }
Exemple #2
0
    /// <summary>
    /// Called when the buff is destroyed.
    /// Decreases jumps by 1 and applies the buff to another raider.
    /// </summary>
    public void Jump()
    {
        GetRaider().Heal(HEALAMOUNT);
        if (jumpsLeft > 0)
        {
            List <Raider> raiderDict = RaiderDB.GetInstance().GetAllRaidersSortedByHealth();
            raiderDict.Remove(GetRaider());

            int countRaider = raiderDict.Count;
            for (int i = 0; i < countRaider; i++)
            {
                Raider target = raiderDict.First();

                if (!target.GetGameObject().GetComponent <PrayerBuff>())
                {
                    target = raiderDict.First();
                    PrayerBuff buff = target.GetGameObject().AddComponent <PrayerBuff>();
                    buff.jumpsLeft = jumpsLeft - 1;
                    break;
                }

                raiderDict.Remove(target);
            }
        }
    }
Exemple #3
0
    /// <summary>
    /// Gets called when the raider the buff is attached to receives fatal damage but bevore the damage is applied.
    /// This is i.e. used to proc guardian spirit.
    /// </summary>
    /// <param name="amount">The amount.</param>
    /// <returns>
    /// the new damage taken amount
    /// </returns>
    public override float OnFatalDamage(float amount)
    {
        bool hasGuardianSpirit = false;

        foreach (IBuff buff in GetComponent <BuffManager>().GetAllBuffsSortetByDuration())
        {
            if (buff.GetType() == typeof(GuardianSpiritBuff) || buff.GetType() == typeof(GuardianSpiritBuffInvis))
            {
                hasGuardianSpirit = true;
            }
        }

        if (!hasGuardianSpirit) //only damage when no guardian spirit
        {
            List <Raider> targetDict = RaiderDB.GetInstance().GetAllRaiders();
            targetDict.Remove(GetRaider());

            Destroy();

            foreach (Raider target in targetDict)
            {
                target.Damage(exploDmg);
            }

            Debug.Log("StoneTwo Exploded with Fatal Damage.");
        }

        return(amount);
    }
    /// <summary>
    /// Water Phase logic
    /// </summary>
    private void WaterPhase()
    {
        frostTimerCurrent += 0.02f;

        cooldownOverlayDebuff.fillAmount = frostTimerCurrent / frostTimer;

        if (frostTimerCurrent >= frostTimer) //deal raidwide damage
        {
            frostTimerCurrent = 0f;

            List <Raider> targetDict = new List <Raider>(RaiderDB.GetInstance().GetAllRaiders());

            foreach (Raider raider in targetDict)
            {
                raider.Damage(frostDamage);
            }
        }

        if (timeInPhase > phaseduration - 2.05f && timeInPhase < phaseduration - 1.95f) //emote for fire phase
        {
            GetComponent <Boss>().SetEmoteText(" " + emotePhaseThree);
        }

        else if (timeInPhase > phaseduration) //siwtch to fire phase
        {
            phaseID             = 1;
            timeInPhase         = 0;
            fireDotTimerCurrent = fireDotTimerStart;

            BossModImagePhase.sprite  = Resources.Load("Luft", typeof(Sprite)) as Sprite;
            BossModImageDebuff.sprite = Resources.Load("Feuer_Debuff", typeof(Sprite)) as Sprite;
        }
    }
    /// <summary>
    /// Called on every fixed update, selects a target randomly and damages it.
    /// If atleast one dd is alive, select one at random, else select a tank.
    /// </summary>
    void FixedUpdate()
    {
        if (!Gamestate.gamestate.GetPaused())
        {
            swingTimerCurrent += 0.02f;
            if (swingTimerCurrent >= swingTimer)
            {
                targetDict = new List <Raider>(RaiderDB.GetInstance().GetAllDDs());
                int numberTargets = targetDict.Count;

                if (numberTargets <= 0) //no dd is alive, load all raider
                {
                    targetDict    = new List <Raider>(RaiderDB.GetInstance().GetAllRaiders());
                    numberTargets = targetDict.Count;
                }

                if (target != null && targetDict.Count > 1 && targetDict.Contains(target))
                {
                    targetDict.Remove(target);
                }

                target = targetDict[Random.Range(0, targetDict.Count)];
                target.Damage(dmg);
                dmg += multiplieer;
                swingTimerCurrent = 0f;
            }
        }
    }
Exemple #6
0
    /// <summary>
    /// Called once every fixed update.
    /// </summary>
    void FixedUpdate()
    {
        swingTimerCurrent += 0.02f;

        if (swingTimerCurrent > swingTimerPulsing - 2.05f && swingTimerCurrent < swingTimerPulsing - 1.95f)
        {
            GetComponent <Boss>().SetEmoteText(" " + emoteText);
        }

        cooldownOverlay.fillAmount = swingTimerCurrent / swingTimerPulsing;

        if (swingTimerCurrent >= swingTimerPulsing)
        {
            List <Raider> targetDict = new List <Raider>(RaiderDB.GetInstance().GetAllRaiders());

            foreach (Raider raider in targetDict)
            {
                raider.Damage(dmgAoe);
            }

            aoeCount++;
            swingTimerCurrent = 0f;

            if (aoeCount >= ticksAoe) //pulsing is over
            {
                aoeCount          = 0;
                swingTimerPulsing = swingTimer;
            }
            else
            {
                swingTimerPulsing = DELAYAOE;
            }
        }
    }
 /// <summary>
 /// Gets called when popup button 2 is clicked.
 /// </summary>
 public void ButtonTwo()
 {
     buttonTwoClicked = true;
     popupTwo.SetActive(false);
     popupThree.SetActive(true);
     RaiderDB.GetInstance().GetAllTanks().First().Damage(40);
 }
Exemple #8
0
    /// <summary>
    /// Called when a cast is sucesfully finished.
    /// Applys the guardian spirit buff to the current target.
    /// Applys the guardian spirit invis buff to every other raider if the talent is selected.
    /// </summary>
    public override void OnCastSucess()
    {
        Raider target = GetTarget();

        if (!target.GetGameObject().GetComponent <GuardianSpiritBuff>())                          //check if target allready has the buff
        {
            GuardianSpiritBuff buff = target.GetGameObject().AddComponent <GuardianSpiritBuff>(); //apply new buff
        }
        else
        {
            target.GetGameObject().GetComponent <GuardianSpiritBuff>().Reset(); //refresh old buff
        }

        if (GameControl.control.talente[8]) //apply invis buff to every other raider if talent is picked
        {
            List <Raider> raiderDict = RaiderDB.GetInstance().GetAllRaidersSortedByHealth();

            raiderDict.Remove(target);

            foreach (Raider raider in raiderDict)
            {
                GuardianSpiritBuffInvis buff = raider.GetGameObject().AddComponent <GuardianSpiritBuffInvis>();
            }
        }
    }
Exemple #9
0
    /// <summary>
    /// Damages the raider by an amount, i.e. decreases the currentHealth.
    /// </summary>
    /// <param name="amount">The amount.</param>
    public void Damage(float amount)
    {
        if (alive)
        {
            foreach (IBuff buff in GetComponent <BuffManager>().GetAllBuffsSortetByDuration())
            {
                amount = buff.OnDamageTaken(amount); //call the DamageTaken method in every buff
            }

            foreach (IBuff buff in GetComponent <BuffManager>().GetAllBuffsSortetByDuration())
            {
                if (currentHealth - amount <= 0)
                {
                    amount = buff.OnFatalDamage(amount); //if the damage would kill the raider call the FatalDamage method in every buff
                }
            }

            foreach (Raider raider in RaiderDB.GetInstance().GetAllRaiders())
            {
                foreach (IBuff buff in raider.GetGameObject().GetComponent <BuffManager>().GetAllBuffsSortetByDuration())
                {
                    amount = buff.OnGlobalDamageTaken(amount);  //call the GlobalDamageTaken method in every buff for every raider
                }
            }

            CombatTextManager.manager.CreateDmgText(transform.position, this, amount);
            currentHealth = currentHealth - amount;
            UpdateHpBar();
        }
    }
Exemple #10
0
    /// <summary>
    /// Called on every fixed update.
    /// </summary>
    void FixedUpdate()
    {
        swingTimerCurrent += 0.02f;
        if (swingTimerCurrent > swingTimer - 2.05f && swingTimerCurrent < swingTimer - 1.95f)
        {
            GetComponent <Boss>().SetEmoteText(" " + emoteText);
        }

        cooldownOverlay.fillAmount = swingTimerCurrent / swingTimer;

        if (swingTimerCurrent >= swingTimer)
        {
            targetDict = new List <Raider>(RaiderDB.GetInstance().GetAllDDs());
            if (target != null && targetDict.Count > 1)
            {
                targetDict.Remove(target);
            }
            if (targetDict.Count == 0)
            {
                targetDict = new List <Raider>(RaiderDB.GetInstance().GetAllRaiders());
            }
            target = targetDict[Random.Range(0, targetDict.Count)];
            target.GetGameObject().AddComponent <MarkDebuff>();
            swingTimerCurrent = 0f;
        }
    }
 /// <summary>
 /// Makes sure the is only one Instance of this class.
 /// </summary>
 /// <returns></returns>
 public static RaiderDB GetInstance()
 {
     if (self == null)
     {
         self = new RaiderDB();
     }
     return(self);
 }
Exemple #12
0
 public void Cast()
 {
     raiderDict = RaiderDB.GetInstance().GetAllTanks();
     foreach (Raider raider in raiderDict)
     {
         GenerateBuff(raider);
     }
 }
Exemple #13
0
    // Update is called once per frame
    void FixedUpdate()
    {
        List <Raider> targetDict = new List <Raider>(RaiderDB.GetInstance().GetAllRaiders());

        foreach (Raider raider in targetDict)
        {
            raider.HealSimple(2000, false);
        }
    }
    /// <summary>
    /// Damages every raider for the pulsing damage.
    /// </summary>
    private void AttackPulsing()
    {
        List <Raider> targetDict = new List <Raider>(RaiderDB.GetInstance().GetAllRaiders());

        foreach (Raider raider in targetDict)
        {
            raider.Damage(dmgAoe);
        }
    }
Exemple #15
0
 /// <summary>
 /// The attack routine.
 /// Select every raider and damage him.
 /// </summary>
 private void Attack()
 {
     targetDict = new List <Raider>(RaiderDB.GetInstance().GetAllRaiders());
     foreach (Raider raider in targetDict)
     {
         raider.Damage(dmg);
     }
     swingTimerCurrent = 0f;
 }
    /// <summary>
    /// Called when the raider triggers a swing.
    /// </summary>
    public override void OnSwing()
    {
        foreach (Raider raider in RaiderDB.GetInstance().GetAllRaiders())
        {
            raider.HealSimple(healAmount, true);
        }

        Damage(currentDmg);
        currentDmg += dmgMultiplier;
    }
    /// <summary>
    /// Gets called when the raider the buff is attached to takes healing.
    /// The amount can be modivied here, i.e. if the buff increses the healing taken by 20% we just return amount * 1.2.
    /// If the heal amount should not be modified we just return the original value.
    /// </summary>
    /// <param name="amount">The amount.</param>
    /// <returns>
    /// the new healamount
    /// </returns>
    public override float OnHealingTaken(float amount)
    {
        List <Raider> raiderDict = RaiderDB.GetInstance().GetAllRaiders();
        float         healAmount = amount * 0.05f;

        foreach (Raider target in raiderDict)
        {
            target.HealSimple(healAmount, false);
        }

        return(amount);
    }
    public void Cast()
    {
        cooldownTimer = 0f;
        onCooldown    = true;
        targetDict    = RaiderDB.GetInstance().GetAllRaiders();
        float anzTargets = targetDict.Count;

        foreach (Raider raider in targetDict)
        {
            raider.HealSimple(storedHealth * multiplyer / anzTargets, true);
        }
        storedHealth = 0;
    }
Exemple #19
0
 public void Cast()
 {
     cooldownTimer         = 0f;
     cooldownMax           = cooldown;
     onCooldown            = true;
     cooldownOverlay.color = new Color32(160, 160, 160, 160);
     raiderDict            = RaiderDB.GetInstance().GetAllRaidersSortedByHealth();
     target = raiderDict.First();
     if (target != null)
     {
         target.Heal(healAmount);
     }
 }
Exemple #20
0
    /// <summary>
    /// Called with every fixed update
    /// </summary>
    public override void OnFixedUpdate()
    {
        if (currentHealth >= MAXHEALTH && IsAlive() && !activated) //activate
        {
            activated = true;

            foreach (Raider raider in RaiderDB.GetInstance().GetAllRaiders()) //increase raider max hp by 50 and increase healmultiplier
            {
                raider.ChangeHealmultiplier(2);
                raider.IncreaseMaxHealth(50f);
                raider.Heal(50);
            }
        }
    }
    /// <summary>
    /// Called when a cast is sucesfully finished. Heals the target and another raider.
    /// </summary>
    public override void OnCastSucess()
    {
        //heal target
        GetTarget().Heal(HEALAMOUNT);

        //get all raider sorted by health
        List <Raider> raiderDict = RaiderDB.GetInstance().GetAllRaidersSortedByHealth();

        for (int i = 0; i < numberJumps && i < raiderDict.Count(); i++)
        {
            raiderDict.Remove(GetTarget());      //remove original target
            raiderDict.First().Heal(HEALAMOUNT); //heal lowest raider
        }
    }
Exemple #22
0
 /// <summary>
 /// Called on every fixed update.
 /// </summary>
 void FixedUpdate()
 {
     swingTimerCurrent += 0.02f;
     if (swingTimerCurrent >= swingTimer)
     {
         List <Raider> targetDict = new List <Raider>(RaiderDB.GetInstance().GetAllRaiders());
         foreach (Raider raider in targetDict)
         {
             raider.Damage(dmgAoe);
         }
         swingTimerCurrent = 0;
         dmgAoe           += multiplier;
     }
 }
    /// <summary>
    /// Called with every fixed update
    /// </summary>
    public override void OnFixedUpdate()
    {
        if (currentHealth >= MAXHEALTH && IsAlive() && !activated) //activate
        {
            activated = true;

            foreach (Raider raider in RaiderDB.GetInstance().GetAllRaiders()) //increase raider max hp by 50 and apply invis buff
            {
                raider.GetGameObject().AddComponent <GreenBuffInvis>();
                raider.IncreaseMaxHealth(50f);
                raider.Heal(50);
            }
        }
    }
Exemple #24
0
    /// <summary>
    /// Called with every fixed update
    /// </summary>
    public override void OnFixedUpdate()
    {
        if (currentHealth >= MAXHEALTH && IsAlive() && !activated) //activate
        {
            activated     = true;
            base.canSwing = true;

            foreach (Raider raider in RaiderDB.GetInstance().GetAllRaiders()) //increase raider max hp by 50
            {
                raider.IncreaseMaxHealth(50f);
                raider.Heal(50);
            }
        }
    }
    /// <summary>
    /// The Cleave logik, hits both tanks if alive, if only one tank is alive the cleave damage is deacreased and every raider is damaged.
    /// </summary>
    private void AttackCleave()
    {
        float         dmgCleaveActual  = dmgCleave;
        List <Raider> targetDictCleave = new List <Raider>(RaiderDB.GetInstance().GetAllTanks());

        if (targetDictCleave.Count <= 1)
        {
            targetDictCleave = new List <Raider>(RaiderDB.GetInstance().GetAllRaiders());
            dmgCleaveActual *= 0.5f;
        }
        foreach (Raider raider in targetDictCleave)
        {
            raider.Damage(dmgCleaveActual);
        }
    }
    /// <summary>
    /// Air phase logic.
    /// </summary>
    private void AirPhase()
    {
        if (timeInPhase > phaseduration - 2.05f && timeInPhase < phaseduration - 1.95f) //emote for water phase
        {
            GetComponent <Boss>().SetEmoteText(" " + emotePhaseTwo);
        }

        List <Raider> targetDict = new List <Raider>(RaiderDB.GetInstance().GetAllRaiders());

        foreach (Raider target in targetDict) //set bossmod text for air debuff strength
        {
            AlakirWasserDebuff wasserBuff = target.GetGameObject().GetComponent <AlakirWasserDebuff>();
            if (wasserBuff != null)
            {
                string text = "" + (100 - (wasserBuff.getHealMultiplier() * 100));
                BossModTextDebuff.text = text.Split('.')[0];
                break;
            }
        }

        if (timeInPhase > phaseduration) //switch to water phase
        {
            targetDict = new List <Raider>(RaiderDB.GetInstance().GetAllRaiders());

            foreach (Raider target in targetDict)
            {
                AlakirFeuerDebuff feuerBuff = target.GetGameObject().GetComponent <AlakirFeuerDebuff>();
                if (feuerBuff != null)
                {
                    feuerBuff.Destroy();
                }

                AlakirWasserDebuff wasserBuff = target.GetGameObject().GetComponent <AlakirWasserDebuff>();
                if (wasserBuff != null)
                {
                    wasserBuff.Destroy();
                }
            }

            BossModImagePhase.sprite      = Resources.Load("Feuer_Debuff", typeof(Sprite)) as Sprite;
            BossModImageDebuff.sprite     = Resources.Load("Blizzard", typeof(Sprite)) as Sprite;
            BossModTextDebuff.text        = "";
            cooldownOverlayDebuff.enabled = true;

            phaseID     = 3;
            timeInPhase = 0;
        }
    }
Exemple #27
0
    /// <summary>
    /// Called with every fixed update
    /// </summary>
    public override void OnFixedUpdate()
    {
        if (raider.GetHealth() >= 1f)
        {
            List <Raider> targetDict = RaiderDB.GetInstance().GetAllRaiders();

            Destroy();

            foreach (Raider target in targetDict)
            {
                target.Damage(exploDmg);
            }

            Debug.Log("StoneOne Exploded with at 100% Health.");
        }
    }
 /// <summary>
 /// Called with every update.
 /// Checks if the current level is lost/won.
 /// Detects when the Escape/Back button is pressed.
 /// </summary>
 void Update()
 {
     if (SceneManager.GetActiveScene().name == "Tutorial") //slightly different behaviour for the tutorial
     {
         if (Input.GetKeyDown(KeyCode.Escape))
         {
             SceneManager.LoadScene("MainMenu");
         }
         else if (RaiderDB.GetInstance().GetAllRaiders().Count == 0 && !finished)
         {
             Popup.GetComponentInChildren <Text>().text = "Your group was destroyed before you could kill " + Boss.name + ". Try again.";
             finished = true;
             Destroy(Boss.gameObject);
             FindObjectOfType <SpellBarManagerTutorial>().DisableButtons();
             Popup.SetActive(true);
         }
         else if (Boss.GetCurrentHp() <= 0 && !finished)
         {
             string textPopup = "You killed " + Boss.name;
             Popup.GetComponentInChildren <Text>().text = textPopup;
             finished = true;
             Destroy(Boss.gameObject);
             FindObjectOfType <SpellBarManagerTutorial>().DisableButtons();
             Popup.SetActive(true);
         }
     }
     else
     {
         if (Input.GetKeyDown(KeyCode.Escape))
         {
             SceneManager.LoadScene("Skill_Selector");
         }
         else if (RaiderDB.GetInstance().GetAllRaiders().Count == 0 && !finished)
         {
             Popup.GetComponentInChildren <Text>().text = "Your group was destroyed before you could kill " + Boss.name + ". Try again.";
             finished = true;
             Destroy(Boss.gameObject);
             FindObjectOfType <SpellBarManager>().DisableButtons();
             Popup.SetActive(true);
         }
         else if (Boss.GetCurrentHp() <= 0 && !finished)
         {
             OnBossKill();
         }
     }
 }
Exemple #29
0
    /// <summary>
    /// Gets called when the raider the buff is attached to receives fatal damage but bevore the damage is applied.
    /// This is i.e. used to proc guardian spirit.
    /// </summary>
    /// <param name="amount">The amount.</param>
    /// <returns>
    /// the new damage taken amount
    /// </returns>
    public override float OnFatalDamage(float amount)
    {
        GetRaider().HealSimple(300, false);
        Destroy();

        if (GameControl.control.talente[8])
        {
            List <Raider> raiderDict = RaiderDB.GetInstance().GetAllRaidersSortedByHealth();
            raiderDict.Remove(GetRaider());

            foreach (Raider raider in raiderDict)
            {
                raider.GetGameObject().GetComponent <IGuardianSpirit>().Destroy();
            }
        }

        return(0);
    }
    /// <summary>
    /// Called with every fixed update.
    /// </summary>
    void FixedUpdate()
    {
        swingTimerCurrent += 0.02f;

        if (swingTimerCurrent > swingTimer - 2.05f && swingTimerCurrent < swingTimer - 1.95f && !healDebuff)
        {
            GetComponent <Boss>().SetEmoteText(" " + emoteText);
        }
        else if (swingTimerCurrent > swingTimer - 2.05f && swingTimerCurrent < swingTimer - 1.95f && healDebuff)
        {
            GetComponent <Boss>().SetEmoteText(" " + emoteText2);
        }

        cooldownOverlay.fillAmount = swingTimerCurrent / swingTimer;

        if (swingTimerCurrent >= swingTimer)
        {
            List <Raider> targetDict = new List <Raider>(RaiderDB.GetInstance().GetAllDDs());
            if (targetDict.Count <= 0)
            {
                targetDict = new List <Raider>(RaiderDB.GetInstance().GetAllRaiders());
            }
            if (target != null && targetDict.Count > 1)
            {
                targetDict.Remove(target);
            }
            if (healDebuff)
            {
                target = targetDict[Random.Range(0, targetDict.Count)];
                target.GetGameObject().AddComponent <HealDebuff>();
                healDebuff          = false;
                BossModImage.sprite = Resources.Load("Dot_Debuff", typeof(Sprite)) as Sprite;
            }
            else if (!healDebuff)
            {
                target = targetDict[Random.Range(0, targetDict.Count)];
                target.GetGameObject().AddComponent <DotDebuff>();
                healDebuff          = true;
                BossModImage.sprite = Resources.Load("Heal_Debuff", typeof(Sprite)) as Sprite;
            }
            swingTimerCurrent = 0f;
        }
    }