Refactor more stuff (Audio mostly)
This commit is contained in:
@@ -9,18 +9,20 @@ public class EffectService
|
||||
{
|
||||
private readonly IGame _game;
|
||||
private readonly IPlayer _player;
|
||||
private readonly IMap _map;
|
||||
|
||||
public EffectService(IGame game, IPlayer player)
|
||||
public EffectService(IGame game, IPlayer player, IMap map)
|
||||
{
|
||||
_game = game;
|
||||
_player = player;
|
||||
_map = map;
|
||||
}
|
||||
|
||||
public void TeleportEnemiesToCurrentRoom()
|
||||
{
|
||||
var currentFloor = _game.CurrentFloor;
|
||||
var rooms = currentFloor.Rooms;
|
||||
var currentRoom = _player.GetCurrentRoom();
|
||||
var currentRoom = _map.GetPlayersCurrentRoom();
|
||||
|
||||
if (currentRoom is not MonsterRoom)
|
||||
return;
|
||||
@@ -44,7 +46,7 @@ public class EffectService
|
||||
|
||||
public void KillHalfEnemiesInRoom()
|
||||
{
|
||||
var currentRoom = _player.GetCurrentRoom();
|
||||
var currentRoom = _map.GetPlayersCurrentRoom();
|
||||
if (currentRoom is not MonsterRoom)
|
||||
return;
|
||||
|
||||
@@ -57,7 +59,7 @@ public class EffectService
|
||||
|
||||
public void TurnAllEnemiesInRoomIntoHealingItem()
|
||||
{
|
||||
var currentRoom = _player.GetCurrentRoom();
|
||||
var currentRoom = _map.GetPlayersCurrentRoom();
|
||||
var currentEnemies = currentRoom.EnemiesInRoom;
|
||||
foreach (var enemy in currentEnemies)
|
||||
{
|
||||
@@ -83,7 +85,7 @@ public class EffectService
|
||||
|
||||
public void HealAllEnemiesAndPlayerInRoomToFull()
|
||||
{
|
||||
var currentRoom = _player.GetCurrentRoom();
|
||||
var currentRoom = _map.GetPlayersCurrentRoom();
|
||||
var currentEnemies = currentRoom.EnemiesInRoom;
|
||||
foreach (var enemy in currentEnemies)
|
||||
enemy.SetCurrentHP(enemy.GetMaximumHP());
|
||||
@@ -92,7 +94,7 @@ public class EffectService
|
||||
|
||||
public void AbsorbHPFromAllEnemiesInRoom()
|
||||
{
|
||||
var currentRoom = _player.GetCurrentRoom();
|
||||
var currentRoom = _map.GetPlayersCurrentRoom();
|
||||
var currentEnemies = currentRoom.EnemiesInRoom;
|
||||
var hpToAbsorb = 0.0;
|
||||
foreach (var enemy in currentEnemies)
|
||||
@@ -103,7 +105,7 @@ public class EffectService
|
||||
|
||||
public void DealElementalDamageToAllEnemiesInRoom(ElementType elementType)
|
||||
{
|
||||
var currentRoom = _player.GetCurrentRoom();
|
||||
var currentRoom = _map.GetPlayersCurrentRoom();
|
||||
var currentEnemies = currentRoom.EnemiesInRoom;
|
||||
foreach (var enemy in currentEnemies)
|
||||
enemy.TakeDamage(20, elementType);
|
||||
@@ -133,7 +135,7 @@ public class EffectService
|
||||
if (_player.EquippedWeapon.Value.ItemName == string.Empty)
|
||||
return;
|
||||
|
||||
var currentWeapon = _player.EquippedWeapon.Value;
|
||||
var currentWeapon = (Weapon)_player.EquippedWeapon.Value;
|
||||
currentWeapon.IncreaseWeaponAttack(1);
|
||||
}
|
||||
|
||||
@@ -142,7 +144,7 @@ public class EffectService
|
||||
if (_player.EquippedArmor.Value.ItemName == string.Empty)
|
||||
return;
|
||||
|
||||
var currentArmor = _player.EquippedArmor.Value;
|
||||
var currentArmor = (Armor)_player.EquippedArmor.Value;
|
||||
currentArmor.IncreaseArmorDefense(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
using Chickensoft.Introspection;
|
||||
using Chickensoft.Serialization;
|
||||
using Zennysoft.Ma.Adapter;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
[Meta, Id("equipable_item")]
|
||||
public abstract partial class EquipableItem : InventoryItem
|
||||
{
|
||||
public abstract ItemTag ItemTag { get; }
|
||||
|
||||
[Save("equipable_item_is_equipped")]
|
||||
public bool IsEquipped { get; set; }
|
||||
}
|
||||
@@ -1,11 +1,13 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
using Zennysoft.Game.Abstractions;
|
||||
using Zennysoft.Ma.Adapter;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class Restorative : Node3D
|
||||
public partial class Restorative : Node3D, IHealthPack
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
@@ -13,7 +15,7 @@ public partial class Restorative : Node3D
|
||||
|
||||
[Node] public Area3D Pickup { get; set; } = default!;
|
||||
|
||||
public int VTRestoreAmount => 4;
|
||||
public double RestoreAmount => 4;
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user