init
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using VOID.Generic.Dict;
|
||||
|
||||
namespace VOID.Generic.Objects.Abstract.Data
|
||||
{
|
||||
[Serializable]
|
||||
public record Resistances
|
||||
{
|
||||
public float physicalResistance = 0f;
|
||||
public float magicalResistance = 0f;
|
||||
public float fireResistance = 0f;
|
||||
public float waterResistance = 0f;
|
||||
public float earthResistance = 0f;
|
||||
public float airResistance = 0f;
|
||||
public float poisonResistance = 0f;
|
||||
public float lightResistance = 0f;
|
||||
public float darkResistance = 0f;
|
||||
public float healResistance = 2f;
|
||||
|
||||
public float Get(DamageType type)
|
||||
{
|
||||
return type switch
|
||||
{
|
||||
DamageType.Physical => physicalResistance,
|
||||
DamageType.Magical => magicalResistance,
|
||||
DamageType.Fire => fireResistance,
|
||||
DamageType.Water => waterResistance,
|
||||
DamageType.Earth => earthResistance,
|
||||
DamageType.Air => airResistance,
|
||||
DamageType.Poison => poisonResistance,
|
||||
DamageType.Light => lightResistance,
|
||||
DamageType.Dark => darkResistance,
|
||||
DamageType.Heal => healResistance,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(type), type, null)
|
||||
};
|
||||
}
|
||||
|
||||
public void Set(DamageType type, float value)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case DamageType.Physical: physicalResistance = value; return;
|
||||
case DamageType.Magical: magicalResistance = value; return;
|
||||
case DamageType.Fire: fireResistance = value; return;
|
||||
case DamageType.Water: waterResistance = value; return;
|
||||
case DamageType.Earth: earthResistance = value; return;
|
||||
case DamageType.Air: airResistance = value; return;
|
||||
case DamageType.Poison: poisonResistance = value; return;
|
||||
case DamageType.Light: lightResistance = value; return;
|
||||
case DamageType.Dark: darkResistance = value; return;
|
||||
case DamageType.Heal: healResistance = value; return;
|
||||
default: throw new ArgumentOutOfRangeException(nameof(type), type, null);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user