Add more spell effects

This commit is contained in:
2026-02-26 02:09:38 -08:00
parent a686ce2fbc
commit fadb1652d4
20 changed files with 163 additions and 49 deletions

View File

@@ -91,7 +91,7 @@ public partial class Game : Node3D, IGame
GameState = _container.GetInstance<IGameState>();
QuestData = new QuestData();
RescuedItems = new RescuedItemDatabase();
RescuedItems = new RescuedItemDatabase(20);
ItemDatabase = ItemDatabase.Instance;
GameChunk = new SaveChunk<GameData>(
@@ -99,10 +99,7 @@ public partial class Game : Node3D, IGame
{
var gameData = new GameData()
{
RescuedItems = new RescuedItemDatabase()
{
Items = RescuedItems.Items
},
RescuedItems = new RescuedItemDatabase(RescuedItems.GetItems(), 20),
QuestData = new QuestData()
{
DeathCount = QuestData.DeathCount,
@@ -462,6 +459,9 @@ public partial class Game : Node3D, IGame
case ItemTag.ContainsBox:
_player.Inventory.TryAdd(_effectService.GetRandomItemOfType<BoxItem>());
break;
case ItemTag.RandomSpell:
_player.Inventory.TryAdd(_effectService.GetRandomItemOfType<EffectItem>());
break;
case ItemTag.ContainsRestorative:
_player.Inventory.TryAdd(_effectService.GetRandomItemOfType<ConsumableItem>());
break;
@@ -502,7 +502,6 @@ public partial class Game : Node3D, IGame
ThrowItem(item);
_player.Inventory.Items.Clear();
GameRepo.CloseInventory();
break;
}
}
@@ -581,7 +580,7 @@ public partial class Game : Node3D, IGame
_effectService.LowerCurrentArmorDefense();
break;
case UsableItemTag.RandomEffect:
_effectService.RandomEffect(effectItem);
_effectService.RandomEffect();
break;
case UsableItemTag.DoubleExp:
_effectService.DoubleExp();
@@ -641,7 +640,23 @@ public partial class Game : Node3D, IGame
_player.HealthComponent.SetCurrentHealth(1);
SfxDatabase.Instance.Play(SoundEffect.DecreaseStat);
break;
case UsableItemTag.DoubleStackedItems:
var stackableItems = _player.Inventory.Items.OfType<IStackable>().ToList();
stackableItems.ForEach(x => x.Count.OnNext(x.Count.Value * 2));
break;
case UsableItemTag.IdentifyRandomItem:
var unidentifiedItems = _player.Inventory.Items.Where(x => x.ItemTag == ItemTag.MysteryItem).ToList();
if (!unidentifiedItems.Any())
return;
var rng = new RandomNumberGenerator();
rng.Randomize();
var index = rng.RandiRange(0, unidentifiedItems.Count - 1);
_player.IdentifyItem(unidentifiedItems[index]);
break;
}
_player.EquipmentComponent.UpdateEquipment(_player.EquipmentComponent.EquippedWeapon.Value);
_player.EquipmentComponent.UpdateEquipment(_player.EquipmentComponent.EquippedArmor.Value);
_player.EquipmentComponent.UpdateEquipment(_player.EquipmentComponent.EquippedAccessory.Value);
}
private void RemoveItemOrSubtractFromItemCount(IBaseInventoryItem item)