mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-11 20:55:55 +00:00
Destroyable chests
This commit is contained in:
parent
f1f542efc4
commit
80e0eda977
14 changed files with 253 additions and 27 deletions
37
Scripts/Resources/DamageResistance.cs
Normal file
37
Scripts/Resources/DamageResistance.cs
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
using System;
|
||||
using Cirno.Scripts.Enums;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Resources;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class DamageResistance : Resource
|
||||
{
|
||||
[Export]
|
||||
public DamageType DamageType { get; set; } = DamageType.Neutral;
|
||||
|
||||
[Export]
|
||||
public DamageAttribute Attribute { get; set; } = DamageAttribute.Neutral;
|
||||
|
||||
public float CalculateDamage(float damage, DamageType incomingDamageType)
|
||||
{
|
||||
if (DamageType != incomingDamageType) return 1;
|
||||
|
||||
switch (Attribute)
|
||||
{
|
||||
case DamageAttribute.Neutral:
|
||||
return 1;
|
||||
break;
|
||||
case DamageAttribute.Resist:
|
||||
return 0.5f;
|
||||
break;
|
||||
case DamageAttribute.Weak:
|
||||
return 2;
|
||||
break;
|
||||
case DamageAttribute.Immune:
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
1
Scripts/Resources/DamageResistance.cs.uid
Normal file
1
Scripts/Resources/DamageResistance.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://ddsqqfx1usc3j
|
||||
Loading…
Add table
Add a link
Reference in a new issue