Implement most jewels

This commit is contained in:
2026-02-12 02:36:25 -08:00
parent 230b47061d
commit b475df6f68
27 changed files with 681 additions and 162 deletions

View File

@@ -5,7 +5,6 @@ using Godot;
using System;
using System.Collections.Generic;
using System.Linq;
using Zennysoft.Game.Abstractions;
using Zennysoft.Game.Implementation;
using Zennysoft.Ma.Adapter;
@@ -92,7 +91,9 @@ public partial class Inventory : Node, IInventory
var consumables = listToSort.Where(x => x is ConsumableItem).OrderBy(x => x as ConsumableItem, new ConsumableComparer());
var throwables = listToSort.Where(x => x is ThrowableItem).OrderBy(x => x as ThrowableItem, new ThrowableComparer());
var effectItems = listToSort.Where(x => x is EffectItem).OrderBy(x => x as EffectItem, new EffectComparer());
Items = [.. equippedItems, .. weapons, .. armor, .. accessories, .. ammo, .. consumables, .. throwables, .. effectItems];
var jewelItems = listToSort.Where(x => x is Jewel).OrderBy(x => x as Jewel, new JewelComparer());
var setItems = listToSort.Where(x => x is Plastique).OrderBy(x => x as Plastique, new SetItemComparer());
Items = [.. equippedItems, .. weapons, .. armor, .. accessories, .. ammo, .. consumables, .. throwables, .. effectItems, .. jewelItems, .. setItems];
var stackableItems = Items.OfType<IStackable>();
var itemsToStack = stackableItems.GroupBy(x => ((InventoryItem)x).ItemName).Where(x => x.Count() > 1);
@@ -146,6 +147,22 @@ public partial class Inventory : Node, IInventory
}
}
public class JewelComparer : IComparer<Jewel>
{
public int Compare(Jewel x, Jewel y)
{
return x.ItemName.CompareTo(y.ItemName);
}
}
public class SetItemComparer : IComparer<Plastique>
{
public int Compare(Plastique x, Plastique y)
{
return x.ItemName.CompareTo(y.ItemName);
}
}
public class ConsumableComparer : IComparer<ConsumableItem>
{
public int Compare(ConsumableItem x, ConsumableItem y)

View File

@@ -17,6 +17,9 @@ public partial class Accessory : EquipableItem
public override void _Ready()
{
_sprite.Texture = Stats.Texture;
_bonusDamage = Stats.BonusAttack;
_bonusDefense = Stats.BonusDefense;
_bonusLuck = Stats.BonusLuck;
}
public override string ItemName => Stats.Name;
@@ -28,16 +31,16 @@ public partial class Accessory : EquipableItem
public override float ThrowSpeed => Stats.ThrowSpeed;
public override int BonusAttack => Stats.BonusAttack;
public override int BonusAttack { get => _bonusDamage; }
public override int BonusDefense => Stats.BonusDefense;
public override int BonusDefense { get => _bonusDefense; }
public override int BonusLuck { get => _bonusLuck; }
public override int BonusHP => Stats.BonusHP;
public override int BonusVT => Stats.BonusVT;
public override int BonusLuck { get => Stats.BonusLuck + _bonusLuck; }
public override ElementalResistanceSet ElementalResistance => new ElementalResistanceSet(Stats.AeolicResistance, Stats.HydricResistance, Stats.IgneousResistance, Stats.FerrumResistance, Stats.TelluricResistance, Stats.HolyResistance, Stats.CurseResistance);
[Save("accessory_tag")]
@@ -45,6 +48,12 @@ public partial class Accessory : EquipableItem
public override ItemTag ItemTag => Stats.ItemTag;
[Save("accessory_bonus_damage")]
private int _bonusDamage { get; set; } = 0;
[Save("accessory_bonus_damage")]
private int _bonusDefense { get; set; } = 0;
[Save("accessory_bonus_luck")]
private int _bonusLuck { get; set; } = 0;

View File

@@ -17,6 +17,9 @@ public partial class Armor : EquipableItem
public override void _Ready()
{
_sprite.Texture = Stats.Texture;
_bonusDamage = Stats.BonusAttack;
_bonusDefense = Stats.BonusDefense;
_bonusLuck = Stats.BonusLuck;
}
public override string ItemName => Stats.Name;
@@ -29,11 +32,17 @@ public partial class Armor : EquipableItem
public override float ThrowSpeed => Stats.ThrowSpeed;
public override int BonusDefense => Stats.BonusDefense + _bonusDefense;
public override int BonusAttack { get => _bonusDamage; }
public override int BonusLuck { get => Stats.BonusLuck + _bonusLuck; }
public override int BonusDefense { get => _bonusDefense; }
[Save("bonus_defense")]
public override int BonusLuck { get => _bonusLuck; }
[Save("armor_bonus_damage")]
private int _bonusDamage { get; set; } = 0;
[Save("armor_bonus_damage")]
private int _bonusDefense { get; set; } = 0;
[Save("armor_bonus_luck")]

View File

@@ -36,40 +36,4 @@ public partial class Jewel : InventoryItem, IAugmentItem
public JewelStats Stats { get; set; } = new JewelStats();
public JewelTags Augment => Stats.JewelTag;
public void ApplyAugment(Weapon weapon)
{
weapon.Augment = new Augment(Stats.JewelTag);
switch (Stats.JewelTag)
{
case JewelTags.AeolicElement:
weapon.Stats.WeaponElement = ElementType.Aeolic;
break;
}
}
public void ApplyAugment(Armor armor)
{
armor.Augment = new Augment(Stats.JewelTag);
switch (Stats.JewelTag)
{
case JewelTags.AeolicElement:
armor.Stats.AeolicResistance += 25;
break;
case JewelTags.HydricElement:
armor.Stats.HydricResistance += 25;
break;
case JewelTags.IgneousElement:
armor.Stats.IgneousResistance += 25;
break;
case JewelTags.TelluricElement:
armor.Stats.TelluricResistance += 25;
break;
}
}
public void ApplyAugment(Accessory accessory)
{
accessory.Augment = new Augment(Stats.JewelTag);
}
}

View File

@@ -5,6 +5,7 @@
[resource]
script = ExtResource("1_dxj8h")
JewelTag = 15
Name = "Black Egg"
Description = "Increase Attack, Defense, and Luck."
SpawnRate = 0.5

View File

@@ -5,6 +5,7 @@
[resource]
script = ExtResource("1_vvfsu")
JewelTag = 16
Name = "Cat's Eye"
Description = "Dramatically increases Luck."
SpawnRate = 0.5

View File

@@ -5,6 +5,7 @@
[resource]
script = ExtResource("1_k60ln")
JewelTag = 3
Name = "Cinnabar Structure"
Description = "Hastens VT, adds or improves Rust."
SpawnRate = 0.5

View File

@@ -5,6 +5,7 @@
[resource]
script = ExtResource("1_pn071")
JewelTag = 4
Name = "Foolish Orb"
Description = "Lowers EXP gain."
SpawnRate = 0.5

View File

@@ -5,6 +5,7 @@
[resource]
script = ExtResource("1_c23yr")
JewelTag = 5
Name = "Glue Orb"
Description = "Prevents item from being unequipped."
SpawnRate = 0.5

View File

@@ -5,6 +5,7 @@
[resource]
script = ExtResource("1_7gwjj")
JewelTag = 6
Name = "Heirloom Stone"
Description = "Returns item to the surface world."
SpawnRate = 0.5

View File

@@ -5,6 +5,7 @@
[resource]
script = ExtResource("1_qh03l")
JewelTag = 8
Name = "Igneous Jewel"
Description = ""
SpawnRate = 0.5

View File

@@ -5,8 +5,9 @@
[resource]
script = ExtResource("1_ivvck")
JewelTag = 9
Name = "Mercury Prism"
Description = ""
Description = "Increases EXP Gain rate."
SpawnRate = 0.5
BonusAttack = 0
BonusDefense = 0

View File

@@ -5,8 +5,9 @@
[resource]
script = ExtResource("1_cabnq")
JewelTag = 11
Name = "Metabolic Jewel"
Description = ""
Description = "Slows VT Rate reduction."
SpawnRate = 0.5
BonusAttack = 0
BonusDefense = 0

View File

@@ -5,8 +5,9 @@
[resource]
script = ExtResource("1_75k4l")
JewelTag = 12
Name = "Ossified Cortex"
Description = ""
Description = "Identifes all items automatically."
SpawnRate = 0.5
BonusAttack = 0
BonusDefense = 0

View File

@@ -5,8 +5,9 @@
[resource]
script = ExtResource("1_fkhpb")
JewelTag = 13
Name = "Rejection Stone"
Description = ""
Description = "Revives the user once. Breaks item on use."
SpawnRate = 0.5
BonusAttack = 0
BonusDefense = 0

View File

@@ -5,8 +5,9 @@
[resource]
script = ExtResource("1_868vv")
JewelTag = 0
Name = "Tarnished Jewel"
Description = ""
Description = "No effect."
SpawnRate = 0.5
BonusAttack = 0
BonusDefense = 0

View File

@@ -5,6 +5,7 @@
[resource]
script = ExtResource("2_c8kww")
JewelTag = 14
Name = "Telluric Jewel"
Description = "Add Telluric damage to Weapon or Telluric resistance to Armor."
SpawnRate = 0.5