Figured out the math for EXP per level

This commit is contained in:
2025-10-01 01:46:27 -07:00
parent 6ee1788337
commit 3bcb747473
2 changed files with 343 additions and 357 deletions

View File

@@ -8,8 +8,11 @@
<ItemGroup>
<Compile Remove="Game\state\states\**" />
<Compile Remove="Map\**" />
<EmbeddedResource Remove="Game\state\states\**" />
<EmbeddedResource Remove="Map\**" />
<None Remove="Game\state\states\**" />
<None Remove="Map\**" />
</ItemGroup>
<ItemGroup>
@@ -28,8 +31,4 @@
<ProjectReference Include="..\Zennysoft.Game.Godot.Implementation\Zennysoft.Game.Implementation.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Map\" />
</ItemGroup>
</Project>

View File

@@ -4,7 +4,6 @@ using Chickensoft.GodotNodeInterfaces;
using Chickensoft.Introspection;
using Chickensoft.SaveFileBuilder;
using Godot;
using Godot.Collections;
using SimpleInjector;
using System;
using Zennysoft.Ma.Adapter;
@@ -89,8 +88,6 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<ISaveChunk<Play
private float _knockbackStrength = 0.0f;
private Vector3 _knockbackDirection = Vector3.Zero;
private Dictionary<int, int> _expToNextLevel;
private DamageCalculator _damageCalculator;
#region Initialization
@@ -122,16 +119,6 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<ISaveChunk<Play
PlayerLogic.Set(Stats);
PlayerLogic.Set(_gameRepo);
_expToNextLevel = new Dictionary<int, int>
{
{ 2, 12 },
{ 3, 39 },
{ 4, 87 },
{ 5, 162 },
{ 6, 270 },
{ 7, 417 },
{ 8, 609 }
};
_damageCalculator = new DamageCalculator();
Hitbox.AreaEntered += Hitbox_AreaEntered;
@@ -331,7 +318,7 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<ISaveChunk<Play
var hpIncrease = rng.RandiRange(3, 6);
Stats.SetMaximumHP(Stats.MaximumHP.Value + hpIncrease);
var nextLevel = Stats.CurrentLevel.Value + 1;
var expToNextLevel = _expToNextLevel[nextLevel];
var expToNextLevel = (int)(6.5 * nextLevel + 4.5 * Mathf.Pow(nextLevel, 2) + Mathf.Pow(nextLevel, 3));
var newCurrentExp = Mathf.Max(Stats.CurrentExp.Value - Stats.ExpToNextLevel.Value, 0);
Stats.SetCurrentLevel(nextLevel);
Stats.SetExpToNextLevel(expToNextLevel);