Collaborative changes

This commit is contained in:
2026-04-22 21:26:21 -07:00
parent 6f79c64924
commit c6b958c577
39 changed files with 7634 additions and 1875 deletions

View File

@@ -472,7 +472,7 @@ public partial class Game : Node3D, IGame
case ItemTag.DamagesPlayer:
_effectService.DamagesPlayer(boxItem.Stats.DamageToPlayer);
InventoryEventNotification.Invoke($"{boxItem.Stats.DamageToPlayer} damage done to self.");
await ToSignal(GetTree().CreateTimer(2f), "timeout");
await ToSignal(GetTree().CreateTimer(0.5f), "timeout");
GameRepo.CloseInventory();
break;
case ItemTag.ContainsAccessory:
@@ -560,15 +560,39 @@ public partial class Game : Node3D, IGame
foreach (var item in _player.Inventory.Items.ToList())
ThrowItem(item);
_player.Inventory.Items.Clear();
InventoryEventNotification.Invoke($"All items have been ejected from inventory.");
await ToSignal(GetTree().CreateTimer(2f), "timeout");
GameRepo.CloseInventory();
BroadcastMessage($"All items have been ejected from inventory.");
break;
}
}
private void EnactConsumableItemEffects(ConsumableItem consumableItem)
{
if (consumableItem.HealHPAmount > 0 && consumableItem.HealVTAmount > 0)
{
SfxDatabase.Instance.Play(SoundEffect.Eucharistia);
if (_player.HealthComponent.AtFullHealth && _player.VTComponent.AtFullVT)
{
_player.HealthComponent.RaiseMaximumHP(consumableItem.RaiseHPAmount, true);
_player.VTComponent.RaiseMaximumVT(consumableItem.RaiseVTAmount, true);
InventoryEventNotification.Invoke($"Raised maximum HP by {consumableItem.RaiseHPAmount}." + System.Environment.NewLine + $"Raised maximum VT by {consumableItem.RaiseVTAmount}.");
}
else
{
_player.HealthComponent.Heal(consumableItem.HealHPAmount);
_player.VTComponent.Restore(consumableItem.HealVTAmount);
InventoryEventNotification.Invoke($"Restored {consumableItem.RaiseHPAmount}HP." + System.Environment.NewLine + $"Restored {consumableItem.RaiseVTAmount}VT.");
}
if (_player.StatusEffectComponent.Rust.Value)
{
_player.StatusEffectComponent.Reset();
InventoryEventNotification.Invoke($"All status afflictments have faded.");
}
return;
}
if (_player.HealthComponent.AtFullHealth && consumableItem.RaiseHPAmount > 0)
{
_player.HealthComponent.RaiseMaximumHP(consumableItem.RaiseHPAmount, true);
@@ -586,13 +610,13 @@ public partial class Game : Node3D, IGame
var currentHP = _player.HealthComponent.CurrentHP;
_player.HealthComponent.Heal(consumableItem.HealHPAmount);
SfxDatabase.Instance.Play(SoundEffect.HealHP);
InventoryEventNotification.Invoke($"Restored {consumableItem.HealHPAmount} HP.");
InventoryEventNotification.Invoke($"Restored {consumableItem.HealHPAmount}HP.");
}
else if (consumableItem.HealVTAmount > 0)
{
_player.VTComponent.Restore(consumableItem.HealVTAmount);
SfxDatabase.Instance.Play(SoundEffect.HealVT);
InventoryEventNotification.Invoke($"Restored {consumableItem.HealVTAmount} VT.");
InventoryEventNotification.Invoke($"Restored {consumableItem.HealVTAmount}VT.");
}
if (consumableItem.Stats.HealsStatusAilments)
@@ -607,78 +631,74 @@ public partial class Game : Node3D, IGame
switch (effectItem.UsableItemTag)
{
case UsableItemTag.TeleportAllEnemiesToRoom:
_effectService.TeleportEnemiesToCurrentRoom(GetTree().GetNodesInGroup("enemy").OfType<IEnemy>().ToList());
_effectService.TeleportEnemiesToCurrentRoom([.. GetTree().GetNodesInGroup("enemy").OfType<IEnemy>()]);
SfxDatabase.Instance.Play(SoundEffect.RecallEnemies);
InventoryEventNotification.Invoke($"All enemies have been summoned.");
await ToSignal(GetTree().CreateTimer(2f), "timeout");
GameRepo.CloseInventory();
BroadcastMessage($"All entities have been summoned.");
_player.PlaySpellFX(SpellFXEnum.DivinityRecall);
break;
case UsableItemTag.KillHalfEnemiesInRoom:
_effectService.KillHalfEnemiesInRoom();
InventoryEventNotification.Invoke($"The balance has been achieved.");
await ToSignal(GetTree().CreateTimer(2f), "timeout");
GameRepo.CloseInventory();
BroadcastMessage($"The balance has been achieved.");
break;
case UsableItemTag.TurnAllEnemiesIntoHealingItem:
_effectService.TurnAllEnemiesInRoomIntoHealingItem();
InventoryEventNotification.Invoke($"Enemies in current room have been converted.");
await ToSignal(GetTree().CreateTimer(2f), "timeout");
GameRepo.CloseInventory();
BroadcastMessage($"Entities in current room have been converted.");
break;
case UsableItemTag.HealsAllInRoomToMaxHP:
_effectService.HealAllEnemiesAndPlayerInRoomToFull();
InventoryEventNotification.Invoke($"All present have been renewed.");
await ToSignal(GetTree().CreateTimer(2f), "timeout");
GameRepo.CloseInventory();
BroadcastMessage($"All present have been renewed.");
break;
case UsableItemTag.AbsorbHPFromAllEnemiesInRoom:
var hpAbsorbed = _effectService.AbsorbHPFromAllEnemiesInRoom();
if (hpAbsorbed == 0)
{
InventoryEventNotification.Invoke($"No enemies present to absorb from or invalid location.");
await ToSignal(GetTree().CreateTimer(2f), "timeout");
GameRepo.CloseInventory();
BroadcastMessage($"No entities present to absorb from or invalid location.");
return;
}
_player.HealthComponent.Heal(hpAbsorbed);
InventoryEventNotification.Invoke($"Enemies have surrendered {hpAbsorbed} to you.");
await ToSignal(GetTree().CreateTimer(2f), "timeout");
GameRepo.CloseInventory();
BroadcastMessage($"Entities have surrendered {hpAbsorbed}HP to you.");
_player.PlaySpellFX(SpellFXEnum.Kyuuketsuki);
break;
case UsableItemTag.DealElementalDamageToAllEnemiesInRoom:
_effectService.DealElementalDamageToAllEnemiesInRoom(effectItem.Stats.ElementalDamageType);
InventoryEventNotification.Invoke($"All enemies present have taken {effectItem.Stats.ElementalDamageType} to you.");
await ToSignal(GetTree().CreateTimer(2f), "timeout");
GameRepo.CloseInventory();
BroadcastMessage($"All entities present have taken {effectItem.Stats.ElementalDamageType} to you.");
break;
case UsableItemTag.SwapHPAndVT:
_effectService.SwapHPandVT();
InventoryEventNotification.Invoke($"HP and VT have been traded.");
await ToSignal(GetTree().CreateTimer(2f), "timeout");
GameRepo.CloseInventory();
await ToSignal(GetTree().CreateTimer(0.5f), "timeout");
break;
case UsableItemTag.RaiseCurrentWeaponAttack:
if (string.IsNullOrEmpty(_player.EquipmentComponent.EquippedWeapon.Value.ItemName))
return;
_effectService.RaiseCurrentWeaponAttack();
InventoryEventNotification.Invoke($"{_player.EquipmentComponent.EquippedWeapon.Value}'s attack has risen by 1.");
await ToSignal(GetTree().CreateTimer(0.5f), "timeout");
break;
case UsableItemTag.RaiseCurrentDefenseArmor:
if (string.IsNullOrEmpty(_player.EquipmentComponent.EquippedArmor.Value.ItemName))
return;
_effectService.RaiseCurrentArmorDefense();
InventoryEventNotification.Invoke($"{_player.EquipmentComponent.EquippedArmor.Value}'s defense has risen by 1.");
await ToSignal(GetTree().CreateTimer(0.5f), "timeout");
break;
case UsableItemTag.RaiseLevel:
_effectService.RaiseLevel();
InventoryEventNotification.Invoke($"Level increased to {_player.ExperiencePointsComponent.Level.Value}");
await ToSignal(GetTree().CreateTimer(0.5f), "timeout");
break;
case UsableItemTag.LowerLevel:
_effectService.LowerLevel();
InventoryEventNotification.Invoke($"Level decreased to {_player.ExperiencePointsComponent.Level.Value}");
await ToSignal(GetTree().CreateTimer(0.5f), "timeout");
break;
case UsableItemTag.LowerCurrentDefenseArmor:
if (string.IsNullOrEmpty(_player.EquipmentComponent.EquippedArmor.Value.ItemName))
@@ -706,7 +726,7 @@ public partial class Game : Node3D, IGame
InventoryEventNotification.Invoke($"Moved to exit room.");
else
InventoryEventNotification.Invoke($"Unable to locate exit room.");
await ToSignal(GetTree().CreateTimer(2f), "timeout");
await ToSignal(GetTree().CreateTimer(0.5f), "timeout");
GameRepo.CloseInventory();
break;
case UsableItemTag.IncreaseAttack: