示例#1
0
    public override void Heal(float amount, bool resurrect = false)
    {
        if (Health <= 0 && !resurrect)
        {
            return;
        }

        float healingScale = 1f;

        /*if (effects.Count > 0) {
         *  foreach (StatusEffect effect in effects) {
         *      if (effect is StatusEffectIncreaseHealing)
         *          healingScale = ((StatusEffectIncreaseHealing) effect).healingScale;
         *  }
         * }*/

        if (HasPassive())
        {
            Debug.Log("[Passive] > This hero has a passive, if it increases healing we should be doing something here");
        }

        Health += amount * healingScale;
        FCTInterface.SpawnText((amount * healingScale).ToString("0"), Camera.main.WorldToScreenPoint(this.handler.transform.position) + FCTOffset, 72f, textColor: Color.green);

        Health       = UnityEngine.Mathf.Min(Mathf.RoundToInt(hero.GetCoreStat(CoreStats.Health) * PlayerManager.Instance.GetBoost(BoostType.Health)), Health);
        healingScale = 1f;
    }
示例#2
0
    public override void TakeDamage(float damage)
    {
        float resolvedDamage = damage * DefenseDamageReduction * DamageReduction;

        Health -= resolvedDamage;

        FCTInterface.SpawnText(resolvedDamage.ToString("0"), Camera.main.WorldToScreenPoint(this.handler.transform.position) + FCTOffset, 92f);

        if (Health <= 0f)
        {
            //dead
            //handler.Die(); // doing this in the battle controller now
            handler.GetHit();

            // TRIGGER OnDeath here
            if (boss.HasPassiveSkill(SkillTriggers.OnDeath))
            {
                List <Skill> passives = boss.GetPassiveSkills(SkillTriggers.OnDeath);
                if (passives.Count > 0)
                {
                    // Add it to the battlecontroller incase multiple actors have died and multiple skills need to be activated
                    foreach (Skill passive in passives)
                    {
                        controller.AddOnDeathSKill(this, passive);
                    }
                }
            }
        }
        else
        {
            handler.GetHit();
        }
        Health = UnityEngine.Mathf.Max(0f, Health);

        // Check for HP phase change
        BossPatternTrigger Trigger = boss.GetCurrentPhaseTrigger();

        if (Trigger != null)
        {
            Debug.Log("[HealthTrigger] " + boss.Name + " has trigger: [" + Trigger.ToString() + "]\n");
        }

        if (Trigger != null && Trigger.Trigger == BossPhaseTriggerType.HealthPercent)
        {
            float percent = Health / (float)boss.MaxHealth;

            // if the condition is met, change the phase
            if (percent < Trigger.Condition)
            {
                boss.BossPhase = Trigger.PhaseChange;
                FCTInterface.SpawnText(Trigger.MessageOnChange, Camera.main.WorldToScreenPoint(this.handler.transform.position) + FCTOffset, 72f, textColor: Color.blue);
                Debug.Log("[HealthTrigger] " + boss.Name + " has triggered and changed from phase {" + Trigger.TargetPhase + "} to phase {" + boss.BossPhase + "}\n");
            }
        }

        if (onHealthChanged != null)
        {
            onHealthChanged();
        }
    }
示例#3
0
    public override void OnAllyDeath()
    {
        BossPatternTrigger Trigger = boss.GetCurrentPhaseTrigger();

        if (Trigger != null)
        {
            Debug.Log("[OnAllyDeathTrigger] " + boss.Name + " has trigger: [" + Trigger.ToString() + "]\n");
        }

        if (Trigger != null && Trigger.Trigger == BossPhaseTriggerType.OnAllyDeath)
        {
            boss.BossPhase = Trigger.PhaseChange;
            FCTInterface.SpawnText(Trigger.MessageOnChange, Camera.main.WorldToScreenPoint(this.handler.transform.position) + FCTOffset, 72f, textColor: Color.blue);
            Debug.Log("[OnAllyDeathTrigger] " + boss.Name + " has triggered and changed from phase {" + Trigger.TargetPhase + "} to phase {" + boss.BossPhase + "}\n");
        }
    }
示例#4
0
    public override void Heal(float amount, bool resurrect = false)
    {
        Debug.Log("Healing " + boss.Name);
        if (Health <= 0 && !resurrect)
        {
            return;
        }

        float healingScale = 1f;

        /*if (effects.Count > 0) {
         *  foreach (StatusEffect effect in effects) {
         *      if (effect is StatusEffectIncreaseHealing)
         *          healingScale = ((StatusEffectIncreaseHealing) effect).healingScale;
         *  }
         * }*/

        if (HasPassive())
        {
            Debug.Log("[Passive] > This boss has a passive, if it increases healing we should be doing something here");
        }

        Debug.Log("Healing Target " + boss.Name + " for " + amount * healingScale + " [CurrHP: " + Health + "]");

        if (Health < 0)
        {
            Health = 0;
        }
        Health += amount * healingScale;
        FCTInterface.SpawnText((amount * healingScale).ToString("0"), Camera.main.WorldToScreenPoint(this.handler.transform.position) + FCTOffset, 72f, textColor: Color.green);

        Debug.Log("Healed [CurrHP: " + Health + "]");

        Health       = UnityEngine.Mathf.Min(boss.MaxHealth, Health);
        healingScale = 1f;

        if (onHealthChanged != null)
        {
            onHealthChanged();
        }
    }
示例#5
0
    public void UpdateTurnCount()
    {
        TurnCount++;

        BossPatternTrigger Trigger = boss.GetCurrentPhaseTrigger();

        if (Trigger != null)
        {
            Debug.Log("[TurnTrigger] " + boss.Name + " has trigger: [" + Trigger.ToString() + "]\n");
        }

        if (Trigger != null && Trigger.Trigger == BossPhaseTriggerType.TurnsPassed)
        {
            if (TurnCount >= Trigger.Condition)
            {
                boss.BossPhase = Trigger.PhaseChange;
                FCTInterface.SpawnText(Trigger.MessageOnChange, Camera.main.WorldToScreenPoint(this.handler.transform.position) + FCTOffset, 72f, textColor: Color.blue);
                TurnCount = 0;
                Debug.Log("[TurnTrigger] " + boss.Name + " has triggered and changed from phase {" + Trigger.TargetPhase + "} to phase {" + boss.BossPhase + "}\n");
            }
        }
    }
示例#6
0
    public override void TakeDamage(float damage)
    {
        float resolvedDamage = damage * hero.GetDamageMitigation * hero.DamageReduction;
        float damageScale    = 1f;

        /*foreach (EquipmentType type in hero.EquipedItems.Keys) {
         *  if (hero.EquipedItems[type] != null) {
         *      StatusEffect effect = null;
         *      foreach (ItemAffix affix in hero.EquipedItems[type].Affixes) {
         *          effect = null;
         *
         *          if (affix.ContainsStatus() && affix.data.data.StatusTriggerType == StatusTriggerTime.OnHit) {
         *              effect = affix.data.data.Status;
         *              ApplyStatusEffect(effect);
         *          }
         *      }
         *  }
         * }*/

        if (effects.Count > 0)
        {
            foreach (StatusEffect effect in effects)
            {
                if (effect is StatusEffectReducedDamage)
                {
                    damageScale = ((StatusEffectReducedDamage)effect).damageScale;
                }

                if (_blockBuffCount > 0)
                {
                    damageScale = 0f;
                    _blockBuffCount--;
                }
            }
        }

        if (this.hero.data.Class == HeroClass.Assassin && (Random.Range(0f, 1f) < ASSASSIN_DODGE_CHANCE + Mathf.Min(((float)this.hero.GetSecondaryStat(SecondaryStats.Dodge) / 100f), 0.75f)))
        {
            FCTInterface.SpawnText("dodge", Camera.main.WorldToScreenPoint(this.handler.transform.position) + FCTOffset, 72f, textColor: Color.green);
            return;
        }
        else if (Random.Range(0f, 1f) < Mathf.Min(((float)this.hero.GetSecondaryStat(SecondaryStats.Dodge) / 100f), .75f))
        {
            FCTInterface.SpawnText("dodge", Camera.main.WorldToScreenPoint(this.handler.transform.position) + FCTOffset, 72f, textColor: Color.yellow);
            return;
        }

        if (HasPassive())
        {
            Debug.Log("[Passive] > This hero has a passive, if it's an active defense or damage reduction passive we should be doing something here");
        }

        if (ShieldAmount > 0f && damage > 0f)
        {
            if ((ShieldAmount - resolvedDamage) < 0f)
            {
                resolvedDamage -= ShieldAmount;
                FCTInterface.SpawnText(ShieldAmount.ToString("0"), Camera.main.WorldToScreenPoint(this.handler.transform.position) + FCTOffset, 72f, textColor: Color.blue);
                ShieldAmount = 0f;

                Health -= resolvedDamage * damageScale;
                handler.Shield.SetActive(false);
                // TODO print FTC text from here
                FCTInterface.SpawnText(resolvedDamage.ToString("0"), Camera.main.WorldToScreenPoint(this.handler.transform.position) + FCTOffset, 72f);
            }
            else
            {
                ShieldAmount -= resolvedDamage;
                FCTInterface.SpawnText((resolvedDamage * damageScale).ToString("0"), Camera.main.WorldToScreenPoint(this.handler.transform.position) + FCTOffset, 72f, textColor: Color.blue);
                resolvedDamage = 0f;
            }
        }
        else
        {
            Health -= resolvedDamage * damageScale;

            FCTInterface.SpawnText((resolvedDamage * damageScale).ToString("0"), Camera.main.WorldToScreenPoint(this.handler.transform.position) + FCTOffset, 72f);
        }

        //Debug.Log(Name + " Took " + resolvedDamage + " damage and has [" + Health + " / " + hero.GetCoreStat(CoreStats.Health) + "] remaining");

        if (Health <= 1f)
        {
            //dead
            //handler.Die();
            handler.GetHit();

            if (this.hero.data.Class == HeroClass.Bruiser && (Random.Range(0f, 1f) < ATTACKER_ENDURE_CHANCE) && !this.hero.EndureTriggered)
            {
                this.hero.EndureTriggered = true;
                FCTInterface.SpawnText("Endure", Camera.main.WorldToScreenPoint(this.handler.transform.position) + FCTOffset, 72f, textColor: Color.green);
                Health = 1f;
                handler.GetHit();
            }
            else
            {
                Debug.Log(Name + " died!");
                //handler.Die();

                // TRIGGER OnDeath here
                if (hero.HasPassiveSkill(SkillTriggers.OnDeath))
                {
                    List <Skill> passives = hero.GetPassiveSkills(SkillTriggers.OnDeath);
                    if (passives.Count > 0)
                    {
                        // Add it to the battlecontroller incase multiple actors have died and multiple skills need to be activated
                        foreach (Skill passive in passives)
                        {
                            controller.AddOnDeathSKill(this, passive);
                        }
                    }
                }
            }
        }
        else
        {
            if (Health > Mathf.RoundToInt(hero.GetCoreStat(CoreStats.Health) * PlayerManager.Instance.GetBoost(BoostType.Health)))
            {
                Health = Mathf.RoundToInt(hero.GetCoreStat(CoreStats.Health) * PlayerManager.Instance.GetBoost(BoostType.Health));
            }
            handler.GetHit();
        }
        Health = UnityEngine.Mathf.Max(0f, Health);
        //Debug.Log(Name + " has [" + Health + " / " + hero.GetCoreStat(CoreStats.Health) + "] remaining at the end of TakeDamage");
        damageScale = 1f;
    }