This commit is contained in:
2025-03-07 01:52:56 -08:00
parent 65e4af8595
commit e7ef669c29
16 changed files with 15 additions and 41 deletions

View File

@@ -80,6 +80,8 @@ public partial class Game : Node3D, IGame
private EffectService _effectService;
private double _expRate = 1;
public void Setup()
{
_container = new SimpleInjector.Container();
@@ -371,7 +373,7 @@ public partial class Game : Node3D, IGame
public void EnemyDefeated(Vector3 defeatedLocation, EnemyStatResource resource)
{
Player.GainExp(resource.ExpFromDefeat * GameRepo.EXPRate);
Player.GainExp(resource.ExpFromDefeat * _expRate);
}
private void DropRestorative(Vector3 vector)
@@ -444,13 +446,13 @@ public partial class Game : Node3D, IGame
ToggleInventory();
AnnounceMessageOnMainScreen("Experience points temporarily doubled.");
DoubleEXPTimer.Start(lengthOfEffect.Seconds);
GameRepo.EXPRate = 2;
_expRate = 2;
}
private void DoubleEXPTimer_Timeout()
{
DoubleEXPTimer.Stop();
GameRepo.EXPRate = 1;
_expRate = 1;
AnnounceMessageOnMainScreen("Experience points effect wore off.");
}

View File

@@ -133,7 +133,7 @@ public partial class InventoryMenu : Control, IInventoryMenu
private void ExpToNextLevel_Sync(int obj) => EXPValue.Text = $"{Player.Stats.CurrentExp.Value}/{obj}";
// TODO: Change font style when EXP Bonus effect is active
private void CurrentExp_Sync(int obj) => EXPValue.Text = $"{obj}/{Player.Stats.ExpToNextLevel.Value}";
private void CurrentExp_Sync(double obj) => EXPValue.Text = $"{obj}/{Player.Stats.ExpToNextLevel.Value}";
private void MaxDefense_Sync(int obj) => DEFValue.Text = $"{Player.Stats.CurrentDefense.Value}/{obj}";
@@ -246,7 +246,8 @@ public partial class InventoryMenu : Control, IInventoryMenu
private void PopulatePlayerInfo()
{
FloorLabel.Text = $"Floor {_gameRepo.CurrentFloor:D2}";
// TODO: Fix
FloorLabel.Text = $"Floor 01";
if (ItemSlots.Any())
{

View File

@@ -20,7 +20,7 @@ public interface IPlayer : IKillable, IProvide<ISaveChunk<PlayerData>>
public void Knockback(float impulse);
public void GainExp(int expGained);
public void GainExp(double expGained);
public void LevelUp();

View File

@@ -380,7 +380,7 @@ public partial class Player : CharacterBody3D, IPlayer
_knockbackDirection = GlobalBasis.Z.Normalized();
}
public void GainExp(int expGained)
public void GainExp(double expGained)
{
Stats.SetCurrentExp(Stats.CurrentExp.Value + expGained);
}
@@ -571,7 +571,7 @@ public partial class Player : CharacterBody3D, IPlayer
Die();
}
private void CurrentEXP_Sync(int newExp)
private void CurrentEXP_Sync(double newExp)
{
if (Stats.CurrentExp.Value >= Stats.ExpToNextLevel.Value)
LevelUp();

View File

@@ -17,7 +17,7 @@ public partial record PlayerStats
[Save("maximumVT")]
public int MaximumVT { get; init; }
[Save("currentExp")]
public int CurrentExp { get; init; }
public double CurrentExp { get; init; }
[Save("currentLevel")]
public int CurrentLevel { get; init; }
[Save("currentAttack")]
@@ -68,7 +68,7 @@ public class PlayerStatController
public IAutoProp<int> CurrentDefense => _currentDefense;
public IAutoProp<int> MaxDefense => _maxDefense;
public IAutoProp<int> BonusDefense => _bonusDefense;
public IAutoProp<int> CurrentExp => _currentExp;
public IAutoProp<double> CurrentExp => _currentExp;
public IAutoProp<int> ExpToNextLevel => _expToNextLevel;
public IAutoProp<int> CurrentLevel => _currentLevel;
public IAutoProp<double> Luck => _luck;
@@ -91,7 +91,7 @@ public class PlayerStatController
{
_maximumVT.OnNext(newValue);
}
public void SetCurrentExp(int newValue)
public void SetCurrentExp(double newValue)
{
_currentExp.OnNext(newValue);
}
@@ -139,7 +139,7 @@ public class PlayerStatController
private readonly AutoProp<int> _maximumHP = new(-1);
private readonly AutoProp<int> _currentVT = new(-1);
private readonly AutoProp<int> _maximumVT = new(-1);
private readonly AutoProp<int> _currentExp = new(-1);
private readonly AutoProp<double> _currentExp = new(-1);
private readonly AutoProp<int> _currentLevel = new(-1);
private readonly AutoProp<int> _currentAttack = new(-1);
private readonly AutoProp<int> _bonusAttack = new(-1);