Fix attacks by player and enemy
This commit is contained in:
1
src/system/IHasPrimaryAttack.cs.uid
Normal file
1
src/system/IHasPrimaryAttack.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dwis2q4bq3mhn
|
||||
16
src/system/stats/BattleExtensions.cs
Normal file
16
src/system/stats/BattleExtensions.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user