Fix attacks by player and enemy

This commit is contained in:
2025-02-06 03:33:25 -08:00
parent 4e6c545e81
commit 0cdae88952
31 changed files with 231 additions and 64 deletions

View File

@@ -0,0 +1 @@
uid://dwis2q4bq3mhn

View File

@@ -0,0 +1,16 @@
using Godot;
namespace GameJamDungeon
{
public static class BattleExtensions
{
public static bool IsCriticalHit(double luckStat)
{
var rng = new RandomNumberGenerator();
rng.Randomize();
var roll = rng.Randf();
var isCriticalHit = roll <= luckStat;
return isCriticalHit;
}
}
}

View File

@@ -1,13 +0,0 @@
using Godot;
namespace GameJamDungeon
{
public static class DamageCalculator
{
public static double CalculateWeaponAttackDamage(int totalAttack, WeaponStats weapon)
{
var totalDamage = totalAttack * weapon.ElementalDamageBonus;
return Mathf.Max(totalDamage, 0.0);
}
}
}