Refactor Player class to use components, also use components in Enemy class types and fiddle with boss structure

This commit is contained in:
2025-10-22 02:41:08 -07:00
parent 44fd8c82b0
commit 6ec45c4805
85 changed files with 941 additions and 1449 deletions

View File

@@ -98,7 +98,7 @@ public class EffectService
var currentEnemies = currentRoom.EnemiesInRoom;
//foreach (var enemy in currentEnemies)
// enemy.SetCurrentHP(enemy.GetMaximumHP());
_player.Stats.SetCurrentHP(_player.Stats.MaximumHP.Value);
_player.HealthComponent.SetHealth(_player.HealthComponent.MaximumHP.Value);
}
public void AbsorbHPFromAllEnemiesInRoom()
@@ -112,7 +112,7 @@ public class EffectService
var hpToAbsorb = 0.0;
//foreach (var enemy in currentEnemies)
// hpToAbsorb += enemy.CurrentHP.Value * 0.05;
_player.Stats.SetCurrentHP(_player.Stats.CurrentHP.Value + (int)hpToAbsorb);
_player.HealthComponent.Heal((int)hpToAbsorb);
GD.Print("HP to absorb: " + hpToAbsorb);
}
@@ -133,11 +133,11 @@ public class EffectService
public void SwapHPandVT()
{
var oldHp = _player.Stats.CurrentHP.Value;
var oldVt = _player.Stats.CurrentVT.Value;
var oldHp = _player.HealthComponent.CurrentHP.Value;
var oldVt = _player.VTComponent.CurrentVT.Value;
_player.Stats.SetCurrentHP(oldVt);
_player.Stats.SetCurrentVT(oldHp);
_player.HealthComponent.SetHealth(oldVt);
_player.VTComponent.SetVT(oldHp);
}
public void RandomEffect(EffectItem item)
@@ -157,7 +157,7 @@ public class EffectService
var currentWeapon = (Weapon)_player.EquippedWeapon.Value;
currentWeapon.IncreaseWeaponAttack(1);
_player.ModifyBonusAttack(1);
//_player.ModifyBonusAttack(1);
}
public void RaiseCurrentArmorDefense()
@@ -167,7 +167,7 @@ public class EffectService
var currentArmor = (Armor)_player.EquippedArmor.Value;
currentArmor.IncreaseArmorDefense(1);
_player.ModifyBonusDefense(1);
_player.DefenseComponent.RaiseBonusDefense(1);
}
public void RaiseLevel()