Fix up equipping inventory items, fill out the rest of the inventory labels
This commit is contained in:
@@ -98,6 +98,8 @@ namespace GameJamDungeon
|
||||
GameRepo.SetPlayerGlobalPosition(GlobalPosition);
|
||||
GameRepo.PlayerGlobalPosition.Sync += OnPlayerPositionUpdated;
|
||||
|
||||
GameRepo.SetPlayerStatInfo(PlayerStatInfo);
|
||||
|
||||
_currentHP = new AutoProp<double>(PlayerStatInfo.MaximumHP);
|
||||
_currentVT = new AutoProp<int>(PlayerStatInfo.MaximumVT);
|
||||
_currentHP.Sync += OnHPChanged;
|
||||
@@ -119,7 +121,7 @@ namespace GameJamDungeon
|
||||
})
|
||||
.Handle((in PlayerLogic.Output.Animations.Attack output) =>
|
||||
{
|
||||
var weaponInfo = GameRepo.EquippedWeapon.WeaponInfo;
|
||||
var weaponInfo = GameRepo.EquippedWeapon.Value.WeaponInfo;
|
||||
var attackSpeed = (float)weaponInfo.AttackSpeed;
|
||||
AnimationPlayer.SetSpeedScale(attackSpeed);
|
||||
AnimationPlayer.Play("attack");
|
||||
@@ -160,7 +162,7 @@ namespace GameJamDungeon
|
||||
var roll = rng.Randf();
|
||||
if (roll <= enemy.EnemyStatInfo.Luck)
|
||||
isCriticalHit = true;
|
||||
var damage = DamageCalculator.CalculateEnemyDamage(hitBox.Damage, PlayerStatInfo, enemy.EnemyStatInfo, GameRepo.EquippedArmor.ArmorInfo, isCriticalHit);
|
||||
var damage = DamageCalculator.CalculateEnemyDamage(hitBox.Damage, PlayerStatInfo, enemy.EnemyStatInfo, GameRepo.EquippedArmor.Value.ArmorInfo, isCriticalHit);
|
||||
_currentHP.OnNext(_currentHP.Value - damage);
|
||||
GD.Print($"Player hit for {damage} damage.");
|
||||
}
|
||||
|
||||
@@ -15,10 +15,19 @@
|
||||
|
||||
[sub_resource type="Resource" id="Resource_up0v1"]
|
||||
script = ExtResource("2_n88di")
|
||||
CurrentHP = 100.0
|
||||
MaximumHP = 100.0
|
||||
CurrentVT = 90
|
||||
MaximumVT = 90
|
||||
BaseAttack = 10
|
||||
BaseDefense = 5
|
||||
CurrentLevel = 1
|
||||
CurrentEXP = 0
|
||||
EXPToNextLevel = 100
|
||||
CurrentAttack = 12
|
||||
MaxAttack = 12
|
||||
CurrentDefense = 8
|
||||
MaxDefense = 8
|
||||
BonusAttack = 0
|
||||
BonusDefense = 0
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_wedu3"]
|
||||
|
||||
|
||||
@@ -1,31 +1,7 @@
|
||||
using Chickensoft.Collections;
|
||||
using Chickensoft.Serialization;
|
||||
using Godot;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace GameJamDungeon
|
||||
namespace GameJamDungeon
|
||||
{
|
||||
public partial record PlayerData
|
||||
{
|
||||
[Save("global_transform")]
|
||||
public required Transform3D GlobalTransform { get; init; }
|
||||
|
||||
[Save("state_machine")]
|
||||
public required PlayerLogic StateMachine { get; init; }
|
||||
|
||||
[Save("PlayerEquippedSword")]
|
||||
public required IAutoProp<WeaponInfo> EquippedWeapon { get; set; }
|
||||
|
||||
[Save("PlayerInventory")]
|
||||
public required InventoryItemInfo[] Inventory { get; set; } = new InventoryItemInfo[5];
|
||||
|
||||
[Save("PlayerStats")]
|
||||
public required PlayerStatInfo PlayerStats { get; set; }
|
||||
|
||||
[Save("CurrentHP")]
|
||||
public required int CurrentHP { get; set; }
|
||||
|
||||
[Save("CurrentVT")]
|
||||
public required int CurrentVT { get; set; }
|
||||
// TODO: Implement save system
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Godot;
|
||||
using Chickensoft.Collections;
|
||||
using Godot;
|
||||
|
||||
namespace GameJamDungeon
|
||||
{
|
||||
@@ -6,15 +7,62 @@ namespace GameJamDungeon
|
||||
public partial class PlayerStatInfo : Resource, ICharacterStats
|
||||
{
|
||||
[Export]
|
||||
public double MaximumHP { get; set; }
|
||||
public double CurrentHP { get => _currentHP.Value; set => _currentHP.OnNext(value); }
|
||||
|
||||
[Export]
|
||||
public int MaximumVT { get; set; }
|
||||
public double MaximumHP { get => _maximumHP.Value; set => _maximumHP.OnNext(value); }
|
||||
|
||||
[Export]
|
||||
public int BaseAttack { get; set; }
|
||||
public int CurrentVT { get => _currentVT.Value; set => _currentVT.OnNext(value); }
|
||||
|
||||
[Export]
|
||||
public int BaseDefense { get; set; }
|
||||
public int MaximumVT { get => _maximumVT.Value; set => _maximumVT.OnNext(value); }
|
||||
|
||||
[Export]
|
||||
public int CurrentLevel { get => _currentLevel.Value; set => _currentLevel.OnNext(value); }
|
||||
|
||||
|
||||
[Export]
|
||||
public int CurrentEXP { get => _currentExp.Value; set => _currentExp.OnNext(value); }
|
||||
|
||||
[Export]
|
||||
public int EXPToNextLevel { get => _expToNextLevel.Value; set => _expToNextLevel.OnNext(value); }
|
||||
|
||||
[Export]
|
||||
public int CurrentAttack { get => _currentAttack.Value; set => _currentAttack.OnNext(value); }
|
||||
|
||||
[Export]
|
||||
public int MaxAttack { get => _maxAttack.Value; set => _maxAttack.OnNext(value); }
|
||||
|
||||
[Export]
|
||||
public int CurrentDefense { get => _currentDefense.Value; set => _currentDefense.OnNext(value); }
|
||||
[Export]
|
||||
public int MaxDefense { get => _maxDefense.Value; set => _maxDefense.OnNext(value); }
|
||||
|
||||
[Export]
|
||||
public int BonusAttack { get => _bonusAttack.Value; set => _bonusAttack.OnNext(value); }
|
||||
|
||||
[Export]
|
||||
public int BonusDefense { get => _bonusDefense.Value; set => _bonusDefense.OnNext(value); }
|
||||
|
||||
// AutoProp backing data
|
||||
private readonly AutoProp<double> _currentHP = new AutoProp<double>(0);
|
||||
private readonly AutoProp<double> _maximumHP = new AutoProp<double>(0);
|
||||
|
||||
private readonly AutoProp<int> _currentVT = new AutoProp<int>(0);
|
||||
private readonly AutoProp<int> _maximumVT = new AutoProp<int>(0);
|
||||
|
||||
private readonly AutoProp<int> _currentExp = new AutoProp<int>(0);
|
||||
private readonly AutoProp<int> _expToNextLevel = new AutoProp<int>(0);
|
||||
private readonly AutoProp<int> _currentLevel = new AutoProp<int>(0);
|
||||
|
||||
private readonly AutoProp<int> _currentAttack = new AutoProp<int>(0);
|
||||
private readonly AutoProp<int> _currentDefense = new AutoProp<int>(0);
|
||||
|
||||
private readonly AutoProp<int> _maxAttack = new AutoProp<int>(0);
|
||||
private readonly AutoProp<int> _maxDefense = new AutoProp<int>(0);
|
||||
|
||||
private readonly AutoProp<int> _bonusAttack = new AutoProp<int>(0);
|
||||
private readonly AutoProp<int> _bonusDefense = new AutoProp<int>(0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user