/// <summary>
 /// Used to display an array
 /// </summary>
 public void ShowDebuffList()
 {
     for (int i = 0; i < abilityEditor.debuffs.Count; i++)
     {
         DebuffEffect eff = abilityEditor.debuffs[i];
         EditorGUILayout.BeginHorizontal();
         EditorGUILayout.LabelField("Debuff Name:", GUILayout.MaxWidth(120));
         eff.EffectName = EditorGUILayout.TextField(eff.EffectName);
         if (GUILayout.Button("Delete Debuff", GUILayout.MaxWidth(100)))
         {
             abilityEditor.debuffs.RemoveAt(i);
             i--;
         }
         else
         {
             EditorGUILayout.EndHorizontal();
             EditorGUILayout.BeginHorizontal();
             EditorGUILayout.LabelField("Require Unstable Static:", GUILayout.MaxWidth(145));
             eff.RequireUnstableStatic = EditorGUILayout.Toggle(eff.RequireUnstableStatic);
             EditorGUILayout.EndHorizontal();
             EditorGUILayout.BeginHorizontal();
             eff.DebuffType = (DebuffEffect.Debuff)EditorGUILayout.EnumPopup("Debuff Type", eff.DebuffType);
             EditorGUILayout.EndHorizontal();
             EditorGUILayout.BeginHorizontal();
             eff.EffectDurationType = (StatusEffect.EffectDuration)EditorGUILayout.EnumPopup("Debuff Duration Type", eff.EffectDurationType);
             EditorGUILayout.EndHorizontal();
             EditorGUILayout.BeginHorizontal();
             if (eff.EffectDurationType == StatusEffect.EffectDuration.OverTime)
             {
                 EditorGUILayout.LabelField("Debuff Duration (In Turns)");
                 eff.Duration = Mathf.Clamp(EditorGUILayout.IntField(eff.Duration), 1, 10);
             }
             EditorGUILayout.EndHorizontal();
             EditorGUILayout.BeginHorizontal();
             if (eff.DebuffType == DebuffEffect.Debuff.Damage)
             {
                 EditorGUILayout.LabelField("Total Damage Amount");
                 eff.Damage = EditorGUILayout.FloatField(eff.Damage);
             }
             if (eff.DebuffType == DebuffEffect.Debuff.StaticGrip)
             {
                 EditorGUILayout.LabelField("Damage Per Hex");
                 eff.StaticGripDamagePerHex = EditorGUILayout.IntField(eff.StaticGripDamagePerHex);
             }
             EditorGUILayout.EndHorizontal();
             EditorGUILayout.BeginHorizontal();
             if (eff.DebuffType == DebuffEffect.Debuff.Slow)
             {
                 EditorGUILayout.LabelField("Move Speed Reduction (Percent)", GUILayout.MaxWidth(200));
                 eff.SlowPercent = Mathf.Clamp(EditorGUILayout.FloatField(eff.SlowPercent, GUILayout.MaxWidth(50)), 0, 1);
                 eff.SlowPercent = GUILayout.HorizontalSlider(eff.SlowPercent, 0f, 1f);
             }
             EditorGUILayout.EndHorizontal();
         }
         EditorGUILayout.LabelField("___________________________________________________________________________");
     }
 }
Esempio n. 2
0
    /// <summary>
    /// constructor for copying a debuff
    /// </summary>
    public DebuffEffect(DebuffEffect e)
    {
        EffectName         = e.EffectName;
        EffectDurationType = e.EffectDurationType;
        Duration           = e.Duration;

        DebuffType  = e.DebuffType;
        Damage      = e.Damage;
        SlowPercent = e.SlowPercent;
    }
Esempio n. 3
0
 protected void RemoveEnfeeble()
 {
     for (int i = 0; i < debuffs.Count; i++)
     {
         DebuffEffect e = debuffs [i];
         if (e.DebuffType == DebuffEffect.Debuff.Enfeeble)
         {
             debuffs.Remove(e);
             i--;
         }
     }
     enfeebled = false;
 }
Esempio n. 4
0
 /// <summary>
 /// Lower or remove duration of all existing debuffs
 /// </summary>
 protected void DecrementDebuffs()
 {
     for (int i = 0; i < debuffs.Count; i++)           //Reduce durations of all debuffs and remove if they hit 0
     {
         DebuffEffect effect = debuffs [i];
         effect.Duration--;
         if (effect.Duration <= 0)
         {
             debuffs.Remove(effect);
             i--;
         }
     }
 }
Esempio n. 5
0
 /// <summary>
 /// Removes the unstable static.
 /// </summary>
 protected void RemoveUnstableStatic()
 {
     for (int i = 0; i < debuffs.Count; i++)
     {
         DebuffEffect e = debuffs [i];
         if (e.DebuffType == DebuffEffect.Debuff.UnstableStatic)
         {
             debuffs.Remove(e);
             i--;
         }
     }
     hasUnstableStatic = false;
 }
Esempio n. 6
0
 /// <summary>
 /// Removes silences.
 /// </summary>
 protected void RemoveSilences()
 {
     for (int i = 0; i < debuffs.Count; i++)
     {
         DebuffEffect e = debuffs [i];
         if (e.DebuffType == DebuffEffect.Debuff.Silence)
         {
             debuffs.Remove(e);
             i--;
         }
     }
     silenced = false;
 }
Esempio n. 7
0
 /// <summary>
 /// Removes roots.
 /// </summary>
 protected void RemoveRoots()
 {
     for (int i = 0; i < debuffs.Count; i++)
     {
         DebuffEffect e = debuffs [i];
         if (e.DebuffType == DebuffEffect.Debuff.Root)
         {
             debuffs.Remove(e);
             i--;
         }
     }
     rooted          = false;
     MovementIsDirty = true;
 }
Esempio n. 8
0
    /// <summary>
    /// Removes slows.
    /// </summary>
    protected void RemoveSlows()
    {
        for (int i = 0; i < debuffs.Count; i++)
        {
            DebuffEffect e = debuffs [i];
            if (e.DebuffType == DebuffEffect.Debuff.Slow)
            {
                debuffs.Remove(e);
                i--;
            }
        }

        remainingMoveDistance += currentAmountSlowed;
        currentAmountSlowed    = 0;
        MovementIsDirty        = true;
    }
Esempio n. 9
0
 /// <summary>
 /// Handles the static grip effect
 /// </summary>
 void HandleStaticGrip(DebuffEffect e)
 {
     if (!hasStaticGrip)
     {
         staticGripStart = CurrentlyOccupiedHexagon;
         hasStaticGrip   = true;
     }
     ApplySlow(.5f);
     if (e.Duration == 1)           //Proccing stage
     {
         float d = BoardManager.instance.DistanceBetweenHexagons(staticGripStart, CurrentlyOccupiedHexagon);
         ApplyDamage((int)d * (int)e.StaticGripDamagePerHex);
         Hexagon h = BoardManager.instance.StaticGripHex(CurrentlyOccupiedHexagon, staticGripStart);
         if (h != null)
         {
             IssueMovement(h);
         }
         staticGripStart = null;
         hasStaticGrip   = false;
     }
 }
Esempio n. 10
0
    /// <summary>
    /// Applies the debuffs called at the start of each turn
    /// </summary>
    void ApplyDebuffs()
    {
        for (int i = 0; i < debuffs.Count; i++)           //Go through and apply all debuffs
        {
            DebuffEffect effect = debuffs [i];

            if (effect.DebuffType == DebuffEffect.Debuff.Damage)
            {
                ApplyDamage((int)effect.Damage);
            }
            else if (effect.DebuffType == DebuffEffect.Debuff.Slow)
            {
                ApplySlow(effect.SlowPercent);
            }
            else if (effect.DebuffType == DebuffEffect.Debuff.Stun)
            {
                ApplyStun();
            }
            else if (effect.DebuffType == DebuffEffect.Debuff.Silence)
            {
                ApplySilence();
            }
            else if (effect.DebuffType == DebuffEffect.Debuff.Root)
            {
                ApplyRoot();
            }
            else if (effect.DebuffType == DebuffEffect.Debuff.UnstableStatic)
            {
                ApplyUnstableStatic();
            }
            else if (effect.DebuffType == DebuffEffect.Debuff.Enfeeble)
            {
                ApplyEnfeeble();
            }
            else if (effect.DebuffType == DebuffEffect.Debuff.StaticGrip)
            {
                HandleStaticGrip(effect);
            }
        }
    }
Esempio n. 11
0
    /// <summary>
    /// Receives an ability hit and applies status effects
    /// </summary>
    public void ReceiveAbilityHit(AbilityDescription ability, List <AbilityModifier> modifiers = null)
    {
        if (modifiers != null)
        {
            foreach (AbilityModifier mod in modifiers)
            {
                if (mod.ModifierType == AbilityModifier.Modifier.RemoveStunEffect)
                {
                    for (int i = 0; i < ability.debuffs.Count; i++)
                    {
                        DebuffEffect e = ability.debuffs [i];
                        if (e.DebuffType == DebuffEffect.Debuff.Stun)
                        {
                            ability.debuffs.RemoveAt(i);
                            i--;
                        }
                    }
                }
            }
        }

        for (int i = 0; i < ability.debuffs.Count; i++)
        {
            DebuffEffect effect = ability.debuffs [i];
            if (effect.RequireUnstableStatic && !hasUnstableStatic)
            {
                ability.debuffs.RemoveAt(i);
                i--;
            }
            else if (effect.RequireUnstableStatic && hasUnstableStatic)
            {
                RemoveUnstableStatic();
            }
        }

        foreach (DebuffEffect effect in ability.debuffs)
        {
            if (effect.DebuffType == DebuffEffect.Debuff.Damage)
            {
                ApplyDamage((int)effect.Damage, modifiers);
            }
            else if (effect.DebuffType == DebuffEffect.Debuff.Slow)
            {
                ApplySlow(effect.SlowPercent);
            }
            else if (effect.DebuffType == DebuffEffect.Debuff.Stun)
            {
                ApplyStun();
            }
            else if (effect.DebuffType == DebuffEffect.Debuff.Silence)
            {
                ApplySilence();
            }
            else if (effect.DebuffType == DebuffEffect.Debuff.Root)
            {
                ApplyRoot();
            }
            else if (effect.DebuffType == DebuffEffect.Debuff.UnstableStatic)
            {
                ApplyUnstableStatic();
            }
            else if (effect.DebuffType == DebuffEffect.Debuff.Enfeeble)
            {
                ApplyEnfeeble();
            }
            else if (effect.DebuffType == DebuffEffect.Debuff.StaticGrip)
            {
                HandleStaticGrip(effect);
            }

            if (effect.EffectDurationType == StatusEffect.EffectDuration.OverTime)
            {
                if (debuffs.Contains(effect))
                {
                    debuffs.Remove(effect);
                }
                debuffs.Add(new DebuffEffect(effect));
            }
        }

        foreach (BuffEffect effect in ability.buffs)
        {
            if (effect.BuffType == BuffEffect.Buff.RemoveDebuffs)
            {
                debuffs.Clear();
                RemoveStuns();
                RemoveSlows();
                RemoveRoots();
                RemoveSilences();
                RemoveUnstableStatic();
            }
            else if (effect.BuffType == BuffEffect.Buff.Absorb)
            {
                ApplyAbsorb((int)effect.amount);
            }
            else if (effect.BuffType == BuffEffect.Buff.FullHeal)
            {
                ApplyHeal(int.MaxValue);
            }
            else if (effect.BuffType == BuffEffect.Buff.Heal)
            {
                ApplyHeal((int)effect.amount);
            }
            else if (effect.BuffType == (BuffEffect.Buff.MovementIncrease))
            {
                ApplyMovementIncrease(Mathf.RoundToInt(effect.amount));
            }
            else if (effect.BuffType == BuffEffect.Buff.StaticShell)
            {
                HandleStaticShell(effect);
            }
            if (effect.EffectDurationType == StatusEffect.EffectDuration.OverTime)
            {
                if (buffs.Contains(effect))
                {
                    buffs.Remove(effect);
                }
                buffs.Add(new BuffEffect(effect));
            }
        }
    }
Esempio n. 12
0
    /// <summary>
    /// Applies the hex status effects.
    /// </summary>
    public void ApplyHexStatusEffects()
    {
        foreach (StatusEffect e in CurrentlyOccupiedHexagon.HexEffects)
        {
            if (e.EffectDurationType == StatusEffect.EffectDuration.OverTime)
            {
                if (e is BuffEffect)
                {
                    BuffEffect b = e as BuffEffect;

                    if (b.BuffType == BuffEffect.Buff.RemoveDebuffs)
                    {
                        debuffs.Clear();
                        RemoveStuns();
                        RemoveSlows();
                        RemoveRoots();
                        RemoveSilences();
                        RemoveUnstableStatic();
                    }
                    else if (b.BuffType == BuffEffect.Buff.Absorb)
                    {
                        ApplyAbsorb((int)b.amount);
                    }
                    else if (b.BuffType == BuffEffect.Buff.FullHeal)
                    {
                        ApplyHeal(int.MaxValue);
                    }
                    else if (b.BuffType == BuffEffect.Buff.Heal)
                    {
                        ApplyHeal((int)b.amount);
                    }
                    else if (b.BuffType == (BuffEffect.Buff.MovementIncrease))
                    {
                        ApplyMovementIncrease(Mathf.RoundToInt(b.amount));
                    }
                    if (b.EffectDurationType == StatusEffect.EffectDuration.OverTime)
                    {
                        if (buffs.Contains(b))
                        {
                            buffs.Remove(b);
                        }
                        buffs.Add(new BuffEffect(b));
                    }
                }
                else if (e is DebuffEffect)
                {
                    DebuffEffect d = e as DebuffEffect;

                    if (d.DebuffType == DebuffEffect.Debuff.Damage)
                    {
                        ApplyDamage((int)d.Damage);
                    }
                    else if (d.DebuffType == DebuffEffect.Debuff.Slow)
                    {
                        ApplySlow(d.SlowPercent);
                    }
                    else if (d.DebuffType == DebuffEffect.Debuff.Stun)
                    {
                        ApplyStun();
                    }
                    else if (d.DebuffType == DebuffEffect.Debuff.Silence)
                    {
                        ApplySilence();
                    }
                    else if (d.DebuffType == DebuffEffect.Debuff.Root)
                    {
                        ApplyRoot();
                    }
                    else if (d.DebuffType == DebuffEffect.Debuff.UnstableStatic)
                    {
                        ApplyUnstableStatic();
                    }
                    else if (d.DebuffType == DebuffEffect.Debuff.Enfeeble)
                    {
                        ApplyEnfeeble();
                    }

                    if (d.EffectDurationType == StatusEffect.EffectDuration.OverTime)
                    {
                        if (debuffs.Contains(d))
                        {
                            debuffs.Remove(d);
                        }
                        debuffs.Add(new DebuffEffect(d));
                    }
                }
            }
        }
    }