Implement even more inventory/UI stuff

This commit is contained in:
2024-09-10 01:22:34 -07:00
parent 911f75da14
commit 62a9f99b81
18 changed files with 79 additions and 51 deletions

View File

@@ -113,7 +113,6 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
{ {
Raycast.DebugShapeCustomColor = Color.FromString("Purple", Colors.Purple); Raycast.DebugShapeCustomColor = Color.FromString("Purple", Colors.Purple);
EnemyLogic.Input(new EnemyLogic.Input.Alerted()); EnemyLogic.Input(new EnemyLogic.Input.Alerted());
} }
} }
} }
@@ -139,6 +138,8 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
}) })
.Handle((in EnemyLogic.Output.HitByPlayer output) => .Handle((in EnemyLogic.Output.HitByPlayer output) =>
{ {
if (GameRepo.EquippedWeapon.Value.WeaponInfo.WeaponTags.Contains(WeaponTag.SelfDamage))
GameRepo.PlayerStatInfo.Value.CurrentHP -= 5;
}); });
this.Provide(); this.Provide();
@@ -183,7 +184,7 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
var roll = rng.Randf(); var roll = rng.Randf();
if (roll <= GameRepo.EquippedWeapon.Value.WeaponInfo.Luck) if (roll <= GameRepo.EquippedWeapon.Value.WeaponInfo.Luck)
isCriticalHit = true; isCriticalHit = true;
var damage = DamageCalculator.CalculatePlayerDamage(hitBox.Damage, hitBox.GetParent<IPlayer>().PlayerStatInfo, EnemyStatInfo, GameRepo.EquippedWeapon.Value.WeaponInfo, isCriticalHit); var damage = DamageCalculator.CalculatePlayerDamage(hitBox.GetParent<IPlayer>().PlayerStatInfo, EnemyStatInfo, GameRepo.EquippedWeapon.Value.WeaponInfo, isCriticalHit);
GD.Print($"Enemy Hit for {damage} damage."); GD.Print($"Enemy Hit for {damage} damage.");
EnemyLogic.Input(new EnemyLogic.Input.HitByPlayer(damage)); EnemyLogic.Input(new EnemyLogic.Input.HitByPlayer(damage));
} }

View File

@@ -24,7 +24,7 @@ namespace GameJamDungeon
public int MaxDefense { get; set; } public int MaxDefense { get; set; }
[Export] [Export]
public float Luck { get; set; } = 0.05f; public double Luck { get; set; } = 0.05f;
[Export] [Export]
public double TelluricResistance { get; set; } public double TelluricResistance { get; set; }

View File

@@ -50,8 +50,6 @@ public partial class Game : Node3D, IGame
private List<IDungeonFloor> Floors; private List<IDungeonFloor> Floors;
private int _currentFloor = -1;
public void Setup() public void Setup()
{ {
GameRepo = new GameRepo(); GameRepo = new GameRepo();
@@ -88,7 +86,7 @@ public partial class Game : Node3D, IGame
.Handle((in GameLogic.Output.LoadNextFloor _) => .Handle((in GameLogic.Output.LoadNextFloor _) =>
{ {
AnimationPlayer.Play("wait_and_load"); AnimationPlayer.Play("wait_and_load");
var currentFloor = Floors.ElementAt(_currentFloor); var currentFloor = Floors.ElementAt(GameRepo.CurrentFloor);
currentFloor.CallDeferred(MethodName.QueueFree, []); currentFloor.CallDeferred(MethodName.QueueFree, []);
if (GameRepo.EquippedWeapon.Value.WeaponInfo != null && GameRepo.EquippedWeapon.Value.WeaponInfo.WeaponTags.Contains(WeaponTag.BreaksOnChange)) if (GameRepo.EquippedWeapon.Value.WeaponInfo != null && GameRepo.EquippedWeapon.Value.WeaponInfo.WeaponTags.Contains(WeaponTag.BreaksOnChange))
@@ -120,7 +118,7 @@ public partial class Game : Node3D, IGame
private void AnimationPlayer_AnimationStarted(StringName animName) private void AnimationPlayer_AnimationStarted(StringName animName)
{ {
var newFloor = Floors.ElementAt(_currentFloor + 1); var newFloor = Floors.ElementAt(GameRepo.CurrentFloor + 1);
newFloor.CallDeferred(nameof(newFloor.InitializeDungeon), []); newFloor.CallDeferred(nameof(newFloor.InitializeDungeon), []);
newFloor.Show(); newFloor.Show();
} }
@@ -129,7 +127,7 @@ public partial class Game : Node3D, IGame
{ {
var spawnPoints = GetTree().GetNodesInGroup("Exit").OfType<Marker3D>(); var spawnPoints = GetTree().GetNodesInGroup("Exit").OfType<Marker3D>();
Teleport.GlobalPosition = spawnPoints.Last().GlobalPosition; Teleport.GlobalPosition = spawnPoints.Last().GlobalPosition;
_currentFloor++; GameRepo.CurrentFloor++;
} }
public override void _Process(double delta) public override void _Process(double delta)

View File

@@ -46,6 +46,8 @@ public interface IGameRepo : IDisposable
public void EquipItem(IEquipable item); public void EquipItem(IEquipable item);
public void UnequipItem(IEquipable item); public void UnequipItem(IEquipable item);
public int CurrentFloor { get; set; }
} }
public class GameRepo : IGameRepo public class GameRepo : IGameRepo
@@ -86,6 +88,8 @@ public class GameRepo : IGameRepo
public AutoProp<PlayerStatInfo> PlayerStatInfo => _playerStatInfo; public AutoProp<PlayerStatInfo> PlayerStatInfo => _playerStatInfo;
public int CurrentFloor { get; set; } = -1;
public GameRepo() public GameRepo()
{ {
_inventoryItems = new AutoProp<List<IInventoryItem>>([]); _inventoryItems = new AutoProp<List<IInventoryItem>>([]);
@@ -130,6 +134,17 @@ public class GameRepo : IGameRepo
public void OnAccessoryEquipped(Accessory equippedItem) public void OnAccessoryEquipped(Accessory equippedItem)
{ {
PlayerStatInfo.Value.BonusAttack -= _equippedAccessory.Value.AccessoryInfo.ATKUp;
PlayerStatInfo.Value.BonusDefense -= _equippedAccessory.Value.AccessoryInfo.DEFUp;
PlayerStatInfo.Value.MaximumHP -= _equippedAccessory.Value.AccessoryInfo.MaxHPUp;
PlayerStatInfo.Value.MaximumVT -= _equippedAccessory.Value.AccessoryInfo.MaxVTUp;
PlayerStatInfo.Value.Luck -= _equippedAccessory.Value.AccessoryInfo.LUCKUp;
PlayerStatInfo.Value.BonusAttack += equippedItem.AccessoryInfo.ATKUp;
PlayerStatInfo.Value.BonusDefense += equippedItem.AccessoryInfo.DEFUp;
PlayerStatInfo.Value.MaximumHP += equippedItem.AccessoryInfo.MaxHPUp;
PlayerStatInfo.Value.MaximumVT += equippedItem.AccessoryInfo.MaxVTUp;
PlayerStatInfo.Value.Luck += equippedItem.AccessoryInfo.LUCKUp;
_equippedAccessory.OnNext(equippedItem); _equippedAccessory.OnNext(equippedItem);
} }

View File

@@ -3,10 +3,8 @@ using Godot;
public interface IHitbox : IArea3D public interface IHitbox : IArea3D
{ {
public int Damage { get; set; }
} }
public partial class Hitbox : Area3D, IHitbox public partial class Hitbox : Area3D, IHitbox
{ {
public int Damage { get; set; }
} }

View File

@@ -64,8 +64,7 @@ public partial class InventoryMenu : Control, IInventoryMenu
public void PopulatePlayerInfo() public void PopulatePlayerInfo()
{ {
FloorLabel.Text = $"Level {GameRepo.CurrentFloor:D2}";
FloorLabel.Text = $"Floor 0";
var currentLevel = GameRepo.PlayerStatInfo.Value.CurrentLevel; var currentLevel = GameRepo.PlayerStatInfo.Value.CurrentLevel;
CurrentLevelLabel.Text = $"Level {currentLevel:D2}"; CurrentLevelLabel.Text = $"Level {currentLevel:D2}";
@@ -227,6 +226,16 @@ public partial class InventoryMenu : Control, IInventoryMenu
ATKBonusLabel.Text = atkBonus != 0 ? $"{atkBonus:+0;-#}" : "..."; ATKBonusLabel.Text = atkBonus != 0 ? $"{atkBonus:+0;-#}" : "...";
var defBonus = GameRepo.PlayerStatInfo.Value.BonusDefense; var defBonus = GameRepo.PlayerStatInfo.Value.BonusDefense;
DEFBonusLabel.Text = defBonus != 0 ? $"{defBonus:+0;-#}" : "..."; DEFBonusLabel.Text = defBonus != 0 ? $"{defBonus:+0;-#}" : "...";
var currentHP = GameRepo.PlayerStatInfo.Value.CurrentHP;
var maxHP = GameRepo.PlayerStatInfo.Value.MaximumHP;
HPValue.Text = $"{currentHP}/{maxHP}";
var currentVT = GameRepo.PlayerStatInfo.Value.CurrentVT;
var maxVT = GameRepo.PlayerStatInfo.Value.MaximumVT;
VTValue.Text = $"{currentVT}/{maxVT}";
} }
} }
} }

View File

@@ -130,7 +130,7 @@ layout_mode = 2
[node name="FloorLabel" type="Label" parent="InventoryInfo/HBoxContainer/PlayerInfo/FloorBox"] [node name="FloorLabel" type="Label" parent="InventoryInfo/HBoxContainer/PlayerInfo/FloorBox"]
unique_name_in_owner = true unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
text = "FLOOR 02" text = "FLOOR 00"
label_settings = SubResource("LabelSettings_q0afw") label_settings = SubResource("LabelSettings_q0afw")
[node name="LevelBox" type="HBoxContainer" parent="InventoryInfo/HBoxContainer/PlayerInfo"] [node name="LevelBox" type="HBoxContainer" parent="InventoryInfo/HBoxContainer/PlayerInfo"]
@@ -143,7 +143,7 @@ layout_mode = 2
[node name="CurrentLevelLabel" type="Label" parent="InventoryInfo/HBoxContainer/PlayerInfo/LevelBox"] [node name="CurrentLevelLabel" type="Label" parent="InventoryInfo/HBoxContainer/PlayerInfo/LevelBox"]
unique_name_in_owner = true unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
text = "LEVEL 4" text = "LEVEL 0"
label_settings = SubResource("LabelSettings_yw3yo") label_settings = SubResource("LabelSettings_yw3yo")
[node name="ReferenceRect2" type="ReferenceRect" parent="InventoryInfo/HBoxContainer/PlayerInfo"] [node name="ReferenceRect2" type="ReferenceRect" parent="InventoryInfo/HBoxContainer/PlayerInfo"]
@@ -272,7 +272,7 @@ layout_mode = 2
[node name="ATKBonusLabel" type="Label" parent="InventoryInfo/HBoxContainer/PlayerInfo/ATKBox"] [node name="ATKBonusLabel" type="Label" parent="InventoryInfo/HBoxContainer/PlayerInfo/ATKBox"]
unique_name_in_owner = true unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
text = "+50" text = "..."
label_settings = ExtResource("6_tmdno") label_settings = ExtResource("6_tmdno")
[node name="DEFBox" type="HBoxContainer" parent="InventoryInfo/HBoxContainer/PlayerInfo"] [node name="DEFBox" type="HBoxContainer" parent="InventoryInfo/HBoxContainer/PlayerInfo"]
@@ -329,7 +329,6 @@ unique_name_in_owner = true
custom_minimum_size = Vector2(800, 100) custom_minimum_size = Vector2(800, 100)
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 0 size_flags_horizontal = 0
text = "Mask of the Goddess of Destruction"
label_settings = ExtResource("6_q3oua") label_settings = ExtResource("6_q3oua")
autowrap_mode = 2 autowrap_mode = 2
@@ -338,7 +337,6 @@ unique_name_in_owner = true
custom_minimum_size = Vector2(800, 200) custom_minimum_size = Vector2(800, 200)
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 0 size_flags_horizontal = 0
text = "Raises ATK"
label_settings = SubResource("LabelSettings_mundu") label_settings = SubResource("LabelSettings_mundu")
autowrap_mode = 2 autowrap_mode = 2

View File

@@ -18,7 +18,7 @@ public partial class Accessory : Node3D, IInventoryItem, IEquipable
public InventoryItemInfo Info => AccessoryInfo; public InventoryItemInfo Info => AccessoryInfo;
[Export] [Export]
public AccessoryInfo AccessoryInfo { get; set; } public AccessoryInfo AccessoryInfo { get; set; } = new AccessoryInfo();
[Node] public Sprite3D Sprite { get; set; } = default!; [Node] public Sprite3D Sprite { get; set; } = default!;

View File

@@ -7,19 +7,19 @@ namespace GameJamDungeon;
public partial class AccessoryInfo : InventoryItemInfo public partial class AccessoryInfo : InventoryItemInfo
{ {
[Export] [Export]
public int ATKUp { get; set; } public int ATKUp { get; set; } = 0;
[Export] [Export]
public int DEFUp { get; set; } public int DEFUp { get; set; } = 0;
[Export] [Export]
public double LUCKUp { get; set; } public double LUCKUp { get; set; } = 0;
[Export] [Export]
public int MaxHPUp { get; set; } public int MaxHPUp { get; set; } = 0;
[Export] [Export]
public int MaxVTUp { get; set; } public int MaxVTUp { get; set; } = 0;
[Export] [Export]
public Godot.Collections.Array<AccessoryTag> AccessoryTags { get; set; } = new Godot.Collections.Array<AccessoryTag>(); public Godot.Collections.Array<AccessoryTag> AccessoryTags { get; set; } = new Godot.Collections.Array<AccessoryTag>();

View File

@@ -31,7 +31,6 @@ public partial class ThrowableItem : Node3D, IInventoryItem
public void OnReady() public void OnReady()
{ {
AnimationPlayer.AnimationFinished += OnAnimationFinished; AnimationPlayer.AnimationFinished += OnAnimationFinished;
Hitbox.Damage = 5;
Sprite.Texture = ThrowableItemInfo.Texture; Sprite.Texture = ThrowableItemInfo.Texture;
Pickup.BodyEntered += OnEntered; Pickup.BodyEntered += OnEntered;
} }

View File

@@ -17,7 +17,7 @@ public partial class Weapon : Node3D, IInventoryItem, IEquipable
public InventoryItemInfo Info => WeaponInfo; public InventoryItemInfo Info => WeaponInfo;
[Export] [Export]
public WeaponInfo WeaponInfo { get; set; } = new WeaponInfo() { Damage = 1 }; public WeaponInfo WeaponInfo { get; set; } = new WeaponInfo();
[Node] public Sprite3D Sprite { get; set; } = default!; [Node] public Sprite3D Sprite { get; set; } = default!;

View File

@@ -5,7 +5,7 @@ using Godot;
public partial class WeaponInfo : InventoryItemInfo public partial class WeaponInfo : InventoryItemInfo
{ {
[Export] [Export]
public int Damage { get; set; } = 1; public int Damage { get; set; } = 0;
[Export] [Export]
public double Luck { get; set; } = 0.05; public double Luck { get; set; } = 0.05;

View File

@@ -13,7 +13,7 @@ AeolicDamageBonus = 0.0
BaseHydricDamageBonus = 0.0 BaseHydricDamageBonus = 0.0
IgneousDamageBonus = 0.0 IgneousDamageBonus = 0.0
FerrumDamageBonus = 0.0 FerrumDamageBonus = 0.0
WeaponTags = [] WeaponTags = [0]
Name = "Kubel" Name = "Kubel"
Description = "+9 ATK Description = "+9 ATK
A very powerful spear. A very powerful spear.

View File

@@ -73,12 +73,10 @@ namespace GameJamDungeon
[Node] public Label VTNumber { get; set; } = default!; [Node] public Label VTNumber { get; set; } = default!;
[Node] public Label LevelNumber { get; set; } = default!;
[Node] public IArea3D CollisionDetector { get; set; } = default!; [Node] public IArea3D CollisionDetector { get; set; } = default!;
private AutoProp<double> _currentHP { get; set; } = default!;
private AutoProp<int> _currentVT { get; set; } = default!;
public void Initialize() public void Initialize()
{ {
AnimationPlayer.AnimationFinished += OnAnimationFinished; AnimationPlayer.AnimationFinished += OnAnimationFinished;
@@ -100,11 +98,6 @@ namespace GameJamDungeon
GameRepo.SetPlayerStatInfo(PlayerStatInfo); GameRepo.SetPlayerStatInfo(PlayerStatInfo);
_currentHP = new AutoProp<double>(PlayerStatInfo.MaximumHP);
_currentVT = new AutoProp<int>(PlayerStatInfo.MaximumVT);
_currentHP.Sync += OnHPChanged;
_currentVT.Sync += OnVTChanged;
HealthTimer.Timeout += OnHealthTimerTimeout; HealthTimer.Timeout += OnHealthTimerTimeout;
CollisionDetector.AreaEntered += OnEnemyHitBoxEntered; CollisionDetector.AreaEntered += OnEnemyHitBoxEntered;
} }
@@ -125,8 +118,6 @@ namespace GameJamDungeon
var attackSpeed = (float)weaponInfo.AttackSpeed; var attackSpeed = (float)weaponInfo.AttackSpeed;
AnimationPlayer.SetSpeedScale(attackSpeed); AnimationPlayer.SetSpeedScale(attackSpeed);
AnimationPlayer.Play("attack"); AnimationPlayer.Play("attack");
if (weaponInfo.WeaponTags.Contains(WeaponTag.SelfDamage))
_currentHP.OnNext(_currentHP.Value - 5);
}) })
.Handle((in PlayerLogic.Output.ThrowItem output) => .Handle((in PlayerLogic.Output.ThrowItem output) =>
{ {
@@ -153,7 +144,7 @@ namespace GameJamDungeon
{ {
if (area is IHitbox hitBox) if (area is IHitbox hitBox)
{ {
if (_currentHP.Value > 0) if (GameRepo.PlayerStatInfo.Value.CurrentHP > 0)
{ {
var enemy = hitBox.GetParent<IEnemy>(); var enemy = hitBox.GetParent<IEnemy>();
var isCriticalHit = false; var isCriticalHit = false;
@@ -162,8 +153,8 @@ namespace GameJamDungeon
var roll = rng.Randf(); var roll = rng.Randf();
if (roll <= enemy.EnemyStatInfo.Luck) if (roll <= enemy.EnemyStatInfo.Luck)
isCriticalHit = true; isCriticalHit = true;
var damage = DamageCalculator.CalculateEnemyDamage(hitBox.Damage, PlayerStatInfo, enemy.EnemyStatInfo, GameRepo.EquippedArmor.Value.ArmorInfo, isCriticalHit); var damage = DamageCalculator.CalculateEnemyDamage(PlayerStatInfo, enemy.EnemyStatInfo, GameRepo.EquippedArmor.Value.ArmorInfo, isCriticalHit);
_currentHP.OnNext(_currentHP.Value - damage); GameRepo.PlayerStatInfo.Value.CurrentHP = GameRepo.PlayerStatInfo.Value.CurrentHP - damage;
GD.Print($"Player hit for {damage} damage."); GD.Print($"Player hit for {damage} damage.");
} }
} }
@@ -178,6 +169,13 @@ namespace GameJamDungeon
PlayerLogic.Input(new PlayerLogic.Input.Moved(GlobalPosition)); PlayerLogic.Input(new PlayerLogic.Input.Moved(GlobalPosition));
} }
public override void _Process(double delta)
{
OnHPChanged(GameRepo.PlayerStatInfo.Value.CurrentHP);
OnVTChanged(GameRepo.PlayerStatInfo.Value.CurrentVT);
OnLevelChanged(GameRepo.PlayerStatInfo.Value.CurrentLevel);
}
public Vector3 GetGlobalInputVector() public Vector3 GetGlobalInputVector()
{ {
var rawInput = Input.GetVector(GameInputs.MoveLeft, GameInputs.MoveRight, GameInputs.MoveUp, GameInputs.MoveDown); var rawInput = Input.GetVector(GameInputs.MoveLeft, GameInputs.MoveRight, GameInputs.MoveUp, GameInputs.MoveDown);
@@ -224,8 +222,6 @@ namespace GameJamDungeon
AnimationPlayer.AnimationFinished -= OnAnimationFinished; AnimationPlayer.AnimationFinished -= OnAnimationFinished;
} }
private void OnEquippedWeaponChanged(Weapon info) => Hitbox.Damage = info.WeaponInfo.Damage;
private void OnHPChanged(double newHP) private void OnHPChanged(double newHP)
{ {
HPNumber.Text = $"{Mathf.RoundToInt(newHP)}/{PlayerStatInfo.MaximumHP}"; HPNumber.Text = $"{Mathf.RoundToInt(newHP)}/{PlayerStatInfo.MaximumHP}";
@@ -242,14 +238,19 @@ namespace GameJamDungeon
VTNumber.Text = $"{newVT}/{PlayerStatInfo.MaximumVT}"; VTNumber.Text = $"{newVT}/{PlayerStatInfo.MaximumVT}";
} }
private void OnLevelChanged(int newLevel)
{
LevelNumber.Text = $"{newLevel}";
}
private void OnPlayerPositionUpdated(Vector3 globalPosition) => GlobalPosition = globalPosition; private void OnPlayerPositionUpdated(Vector3 globalPosition) => GlobalPosition = globalPosition;
private void OnHealthTimerTimeout() private void OnHealthTimerTimeout()
{ {
if (_currentVT.Value > 0) if (GameRepo.PlayerStatInfo.Value.CurrentVT > 0)
_currentVT.OnNext(_currentVT.Value - 1); GameRepo.PlayerStatInfo.Value.CurrentVT = GameRepo.PlayerStatInfo.Value.CurrentVT - 1;
else else
_currentHP.OnNext(_currentHP.Value - 1); GameRepo.PlayerStatInfo.Value.CurrentHP = GameRepo.PlayerStatInfo.Value.CurrentHP - 1;
} }
} }
} }

View File

@@ -28,6 +28,7 @@ CurrentDefense = 8
MaxDefense = 8 MaxDefense = 8
BonusAttack = 0 BonusAttack = 0
BonusDefense = 0 BonusDefense = 0
Luck = 0.0
[sub_resource type="BoxShape3D" id="BoxShape3D_wedu3"] [sub_resource type="BoxShape3D" id="BoxShape3D_wedu3"]
@@ -215,7 +216,8 @@ texture = ExtResource("10_rsd7v")
expand_mode = 1 expand_mode = 1
stretch_mode = 4 stretch_mode = 4
[node name="Level" type="Label" parent="PlayerInfoUI/HBoxContainer/CenterContainer"] [node name="LevelNumber" type="Label" parent="PlayerInfoUI/HBoxContainer/CenterContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(80, 80) custom_minimum_size = Vector2(80, 80)
layout_mode = 2 layout_mode = 2
text = "99" text = "99"

View File

@@ -45,6 +45,9 @@ namespace GameJamDungeon
[Export] [Export]
public int BonusDefense { get => _bonusDefense.Value; set => _bonusDefense.OnNext(value); } public int BonusDefense { get => _bonusDefense.Value; set => _bonusDefense.OnNext(value); }
[Export]
public double Luck { get => _luck.Value; set => _luck.OnNext(value); }
// AutoProp backing data // AutoProp backing data
private readonly AutoProp<double> _currentHP = new AutoProp<double>(0); private readonly AutoProp<double> _currentHP = new AutoProp<double>(0);
private readonly AutoProp<double> _maximumHP = new AutoProp<double>(0); private readonly AutoProp<double> _maximumHP = new AutoProp<double>(0);
@@ -64,5 +67,7 @@ namespace GameJamDungeon
private readonly AutoProp<int> _bonusAttack = new AutoProp<int>(0); private readonly AutoProp<int> _bonusAttack = new AutoProp<int>(0);
private readonly AutoProp<int> _bonusDefense = new AutoProp<int>(0); private readonly AutoProp<int> _bonusDefense = new AutoProp<int>(0);
private readonly AutoProp<double> _luck = new AutoProp<double>(0.0);
} }
} }

View File

@@ -4,9 +4,9 @@ namespace GameJamDungeon
{ {
public static class DamageCalculator public static class DamageCalculator
{ {
public static double CalculatePlayerDamage(int attackDamage, PlayerStatInfo playerStatInfo, EnemyStatInfo enemyStatInfo, WeaponInfo weapon, bool isCriticalHit) public static double CalculatePlayerDamage(PlayerStatInfo playerStatInfo, EnemyStatInfo enemyStatInfo, WeaponInfo weapon, bool isCriticalHit)
{ {
var baseDamage = attackDamage + playerStatInfo.CurrentAttack; var baseDamage = playerStatInfo.CurrentAttack + playerStatInfo.BonusAttack;
var hydricResistance = enemyStatInfo.HydricResistance; var hydricResistance = enemyStatInfo.HydricResistance;
var igneousResistance = enemyStatInfo.IgneousResistance; var igneousResistance = enemyStatInfo.IgneousResistance;
var telluricResistance = enemyStatInfo.TelluricResistance; var telluricResistance = enemyStatInfo.TelluricResistance;
@@ -36,9 +36,9 @@ namespace GameJamDungeon
return calculatedDamage; return calculatedDamage;
} }
public static double CalculateEnemyDamage(int attackDamage, PlayerStatInfo playerStatInfo, EnemyStatInfo enemyStatInfo, ArmorInfo armor, bool isCriticalHit) public static double CalculateEnemyDamage(PlayerStatInfo playerStatInfo, EnemyStatInfo enemyStatInfo, ArmorInfo armor, bool isCriticalHit)
{ {
var baseDamage = attackDamage + enemyStatInfo.CurrentAttack; var baseDamage = enemyStatInfo.CurrentAttack;
var elementADamage = (enemyStatInfo.BaseHydricDamageBonus > 0 ? enemyStatInfo.BaseHydricDamageBonus - armor.HydricResistance : 0) / 100; var elementADamage = (enemyStatInfo.BaseHydricDamageBonus > 0 ? enemyStatInfo.BaseHydricDamageBonus - armor.HydricResistance : 0) / 100;
var elementBDamage = (enemyStatInfo.IgneousDamageBonus > 0 ? enemyStatInfo.IgneousDamageBonus - armor.IgneousResistance : 0) / 100; var elementBDamage = (enemyStatInfo.IgneousDamageBonus > 0 ? enemyStatInfo.IgneousDamageBonus - armor.IgneousResistance : 0) / 100;
var elementCDamage = (enemyStatInfo.TelluricDamageBonus > 0 ? enemyStatInfo.TelluricDamageBonus - armor.TelluricResistance : 0) / 100; var elementCDamage = (enemyStatInfo.TelluricDamageBonus > 0 ? enemyStatInfo.TelluricDamageBonus - armor.TelluricResistance : 0) / 100;

View File

@@ -13,5 +13,7 @@
public int MaxAttack { get; } public int MaxAttack { get; }
public int MaxDefense { get; } public int MaxDefense { get; }
public double Luck { get; }
} }
} }