Apply difficulty modifiers to damage

This commit is contained in:
Marco 2025-04-08 19:06:39 +02:00
commit bb0f17124d
15 changed files with 94 additions and 59 deletions

View file

@ -1,4 +1,5 @@
using System.Linq;
using Cirno.Scripts.Enums;
using Cirno.Scripts.Resources;
using Godot;
using Godot.Collections;
@ -60,8 +61,17 @@ public partial class GenericDamageReceiver : Area2D, IHittable
{
if (!Enabled) return;
if (Invulnerable) return;
// Change value based on difficulty
float difficultyReducedDmg = GlobalState.Instance.SessionSettings.Difficulty switch
{
DifficultyLevel.Easy => damage * 5,
DifficultyLevel.Normal => damage * 2,
DifficultyLevel.Hard or DifficultyLevel.Lunatic => damage,
_ => damage
};
var dmg = DamageResistances.Aggregate(damage, (current, resistance) => current * resistance.CalculateDamage(current, damageType));
var dmg = DamageResistances.Aggregate(difficultyReducedDmg, (current, resistance) => current * resistance.CalculateDamage(current, damageType));
HealthProvider.CurrentResource -= dmg;
}