mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-22 16:03:47 +00:00
Globally calculated difficulty damage
This commit is contained in:
parent
5624d0178c
commit
4d62a0a385
4 changed files with 12 additions and 22 deletions
|
|
@ -70,13 +70,7 @@ public partial class GenericDamageReceiver : Area2D, IHittable
|
||||||
if (Invulnerable) return;
|
if (Invulnerable) return;
|
||||||
|
|
||||||
// Change value based on difficulty
|
// Change value based on difficulty
|
||||||
float difficultyReducedDmg = GlobalState.Instance.SessionSettings.Difficulty switch
|
float difficultyReducedDmg = damage * GlobalState.Instance.SessionSettings.DifficultyDamageMultiplier;
|
||||||
{
|
|
||||||
DifficultyLevel.Easy => damage * 5,
|
|
||||||
DifficultyLevel.Normal => damage * 2,
|
|
||||||
DifficultyLevel.Hard or DifficultyLevel.Lunatic => damage,
|
|
||||||
_ => damage
|
|
||||||
};
|
|
||||||
|
|
||||||
var dmg = DamageResistances.Aggregate(difficultyReducedDmg, (current, resistance) => current * resistance.CalculateDamage(current, damageType));
|
var dmg = DamageResistances.Aggregate(difficultyReducedDmg, (current, resistance) => current * resistance.CalculateDamage(current, damageType));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -185,13 +185,7 @@ public partial class PlayerDamageReceiver : Area2D
|
||||||
if (!Enabled) return;
|
if (!Enabled) return;
|
||||||
|
|
||||||
// Change value based on difficulty
|
// Change value based on difficulty
|
||||||
float difficultyReducedDmg = GlobalState.Instance.SessionSettings.Difficulty switch
|
float difficultyReducedDmg = damage / GlobalState.Instance.SessionSettings.DifficultyDamageMultiplier;
|
||||||
{
|
|
||||||
DifficultyLevel.Easy => damage / 5,
|
|
||||||
DifficultyLevel.Normal => damage / 2,
|
|
||||||
DifficultyLevel.Hard or DifficultyLevel.Lunatic => damage,
|
|
||||||
_ => damage
|
|
||||||
};
|
|
||||||
|
|
||||||
// Check if the shield is empty or damage has skip attributes
|
// Check if the shield is empty or damage has skip attributes
|
||||||
if (CurrentShield <= 0 || ShieldDamageResistances.Where(x => x.DamageType == type).Any(x => x.Attribute is DamageAttribute.Skip))
|
if (CurrentShield <= 0 || ShieldDamageResistances.Where(x => x.DamageType == type).Any(x => x.Attribute is DamageAttribute.Skip))
|
||||||
|
|
|
||||||
|
|
@ -43,13 +43,7 @@ public partial class PlayerGrazingModule : PlayerArea2DModule
|
||||||
//bullet.IsGrazed = true;
|
//bullet.IsGrazed = true;
|
||||||
var baseGrazeValue = bullet.BulletInfo.GrazeValue;
|
var baseGrazeValue = bullet.BulletInfo.GrazeValue;
|
||||||
|
|
||||||
float grazeShield = GlobalState.Instance.SessionSettings.Difficulty switch
|
float grazeShield = baseGrazeValue * GlobalState.Instance.SessionSettings.DifficultyDamageMultiplier;
|
||||||
{
|
|
||||||
DifficultyLevel.Easy => baseGrazeValue * 5,
|
|
||||||
DifficultyLevel.Normal => baseGrazeValue * 2,
|
|
||||||
DifficultyLevel.Hard or DifficultyLevel.Lunatic => baseGrazeValue,
|
|
||||||
_ => baseGrazeValue
|
|
||||||
};
|
|
||||||
|
|
||||||
Shield.CurrentResource += grazeShield;
|
Shield.CurrentResource += grazeShield;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,14 @@ public class SessionSettings
|
||||||
public float Health { get; set; }
|
public float Health { get; set; }
|
||||||
public float Shield { get; set; }
|
public float Shield { get; set; }
|
||||||
|
|
||||||
|
public float DifficultyDamageMultiplier => this.Difficulty switch
|
||||||
|
{
|
||||||
|
DifficultyLevel.Easy => 4f,
|
||||||
|
DifficultyLevel.Normal => 2f,
|
||||||
|
DifficultyLevel.Hard or DifficultyLevel.Lunatic => 1f,
|
||||||
|
_ => 1f
|
||||||
|
};
|
||||||
|
|
||||||
public void NewSession()
|
public void NewSession()
|
||||||
{
|
{
|
||||||
Items = new();
|
Items = new();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue