mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-09 04:05:53 +00:00
Apply difficulty modifiers to damage
This commit is contained in:
parent
3c531bbe04
commit
bb0f17124d
15 changed files with 94 additions and 59 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue