public static async Task StatusAilment(UserAccount user) { if (user.Debuffs.Count > 0) { for (int i = user.Debuffs.Count - 1; i >= 0; i--) { switch (user.Debuffs[i].Name) { case "Burn": await StatusAilments.Burn(user, user.Debuffs.ElementAt(i)); break; default: await StatusAilments.DecreaseDebuffCountDown(user, user.Debuffs.ElementAt(i)); break; } } } if (user.Buffs.Count > 0) { for (int i = user.Buffs.Count - 1; i >= 0; i--) { switch (user.Buffs[i].Name) { default: await StatusAilments.DecreaseBuffCountDown(user, user.Buffs.ElementAt(i)); break; } } } }
/// <summary> /// Deals damage to the enemy and applies a status ailment. If the health reaches 0, the enemy invoke the killed event and disable itself. /// </summary> /// <param name="ailment">Ailment type.</param> /// <param name="effectPotency">The effectiveness of the Ailment. (Slow: 0 to 1)</param> /// <param name="effectDuration">The duration of the Ailment.</param> /// <returns>The remaining health of the enemy.</returns> public float DealDamage(float damage, StatusAilments ailment, float effectPotency, float effectDuration) { if (ailment == StatusAilments.Slowed) { Slow(effectPotency, effectDuration); } return(DealDamage(damage)); }