In progress item changes

This commit is contained in:
2026-02-13 15:59:10 -08:00
parent d6faf8642a
commit 0ab6ef1343
180 changed files with 3552 additions and 2023 deletions

View File

@@ -228,14 +228,14 @@ public class EffectService
_player.TakeDamage(new AttackData(damage, ElementType.None, true, true));
}
public void RerollItem(InventoryItem itemToReroll)
public void RerollItem(IBaseInventoryItem itemToReroll)
{
var itemReroller = new ItemReroller(ItemDatabase.Instance);
itemReroller.RerollItem(itemToReroll, _player.Inventory);
}
public T GetRandomItemOfType<T>(T itemToExclude = null)
where T : InventoryItem => ItemDatabase.Instance.PickItem(itemToExclude);
public T GetRandomItemOfType<T>(params T[] itemsToExclude)
where T : IBaseInventoryItem => ItemDatabase.Instance.PickItem(itemsToExclude);
public void RandomSpell()
{
@@ -243,14 +243,14 @@ public class EffectService
}
public void DropTo1HPAndGainRareItem<T>()
where T : InventoryItem
where T : IBaseInventoryItem
{
_player.HealthComponent.SetCurrentHealth(1);
_player.Inventory.TryAdd(ItemDatabase.Instance.PickRareItem<T>());
}
public void TradeRandomItem<T>(BoxItem box)
where T : InventoryItem
where T : IBaseInventoryItem
{
var tradableItems = _player.Inventory.Items.OfType<T>().Where(x => x != box).ToList();
@@ -258,7 +258,7 @@ public class EffectService
rng.Randomize();
var randomIndex = rng.RandiRange(0, tradableItems.Count - 1);
var randomItem = tradableItems[randomIndex];
if (randomItem is EquipableItem equipableItem)
if (randomItem is IEquipableItem equipableItem)
{
if (_player.EquipmentComponent.IsItemEquipped(equipableItem))
_player.Unequip(equipableItem);
@@ -268,13 +268,12 @@ public class EffectService
GetRandomItemOfType<T>();
}
public IEnumerable<InventoryItem> TradeAllRandomItems<T>(BoxItem box)
where T : InventoryItem
public IEnumerable<IBaseInventoryItem> TradeAllRandomItems(BoxItem box)
{
var newInventory = new List<InventoryItem>();
var items = _player.Inventory.Items.OfType<T>().Where(x => x != box).ToList();
var newInventory = new List<IBaseInventoryItem>();
var items = _player.Inventory.Items.ToList();
foreach (var item in items)
newInventory.Add(GetRandomItemOfType<T>());
newInventory.Add(GetRandomItemOfType<IBaseInventoryItem>());
return newInventory;
}
@@ -294,7 +293,7 @@ public class EffectService
}
public void GetBasicItem<T>()
where T : InventoryItem
where T : IBaseInventoryItem
{
_player.Inventory.TryAdd(ItemDatabase.Instance.PickBasicItem<T>());
}

View File

@@ -27,9 +27,9 @@ public partial class Inventory : Node, IInventory
}
[Save("inventory_items")]
public List<InventoryItem> Items { get; private set; }
public List<IBaseInventoryItem> Items { get; private set; }
public bool PickUpItem(InventoryItem item)
public bool PickUpItem(IBaseInventoryItem item)
{
var isAdded = TryAdd(item);
if (isAdded)
@@ -43,7 +43,7 @@ public partial class Inventory : Node, IInventory
return isAdded;
}
public bool TryAdd(InventoryItem inventoryItem)
public bool TryAdd(IBaseInventoryItem inventoryItem)
{
if (Items.Count >= _maxInventorySize)
return false;
@@ -55,7 +55,7 @@ public partial class Inventory : Node, IInventory
public bool AtCapacity() => Items.Count >= _maxInventorySize;
public bool TryInsert(InventoryItem inventoryItem, int index)
public bool TryInsert(IBaseInventoryItem inventoryItem, int index)
{
if (Items.Count >= _maxInventorySize || index >= _maxInventorySize || index < 0)
return false;
@@ -65,20 +65,20 @@ public partial class Inventory : Node, IInventory
return true;
}
public void Remove(InventoryItem inventoryItem)
public void Remove(IBaseInventoryItem inventoryItem)
{
Items.Remove(inventoryItem);
InventoryChanged?.Invoke();
}
public bool Sort(EquipableItem currentWeapon, EquipableItem currentArmor, EquipableItem currentAccessory, EquipableItem currentAmmo)
public bool Sort(IWeapon currentWeapon, IArmor currentArmor, IAccessory currentAccessory, IEquipableItem currentAmmo)
{
var initialList = Items;
var equippedWeapon = Items.OfType<Weapon>().Where(x => x == currentWeapon);
var equippedArmor = Items.OfType<Armor>().Where(x => x == currentArmor);
var equippedAccessory = Items.OfType<Accessory>().Where(x => x == currentAccessory);
var equippedAmmo = Items.OfType<Ammo>().Where(x => x == currentAmmo);
var equippedItems = new List<InventoryItem>();
var equippedItems = new List<IBaseInventoryItem>();
equippedItems.AddRange(equippedWeapon);
equippedItems.AddRange(equippedArmor);
equippedItems.AddRange(equippedAccessory);
@@ -96,12 +96,12 @@ public partial class Inventory : Node, IInventory
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);
var itemsToStack = stackableItems.GroupBy(x => ((IBaseInventoryItem)x).ItemName).Where(x => x.Count() > 1);
foreach (var itemStack in itemsToStack)
{
var firstItem = itemStack.First();
firstItem.SetCount(itemStack.Sum(x => x.Count.Value));
var itemsToRemove = itemStack.Except([firstItem]).Cast<InventoryItem>();
var itemsToRemove = itemStack.Except([firstItem]).Cast<IBaseInventoryItem>();
foreach (var item in itemsToRemove)
Remove(item);
}

View File

@@ -14,37 +14,37 @@ public class ItemDatabase
public static ItemDatabase Instance { get { return lazy.Value; } }
public ImmutableList<InventoryItem> Items { get; set; }
public ImmutableList<IBaseInventoryItem> Items { get; set; }
public T PickItem<T>(T itemToExclude = null)
where T : InventoryItem
public T PickItem<T>(params T[] itemsToExclude)
where T : IBaseInventoryItem
{
var itemsToSelectFrom = Items.OfType<T>();
return PickItemInternal(itemsToSelectFrom, itemToExclude);
return PickItemInternal(itemsToSelectFrom, itemsToExclude);
}
public T PickRareItem<T>(T itemToExclude = null)
where T : InventoryItem
public T PickRareItem<T>(params T[] itemsToExclude)
where T : IBaseInventoryItem
{
var getRareItems = Items.OfType<T>().Where(x => x.SpawnRate < 0.1f);
return PickItemInternal(getRareItems, itemToExclude);
return PickItemInternal(getRareItems, itemsToExclude);
}
public T PickBasicItem<T>(T itemToExclude = null)
where T : InventoryItem
public T PickBasicItem<T>(params T[] itemsToExclude)
where T : IBaseInventoryItem
{
var getBasicItems = Items.OfType<T>().Where(x => x.SpawnRate > 0.5f);
return PickItemInternal(getBasicItems, itemToExclude);
return PickItemInternal(getBasicItems, itemsToExclude);
}
private T PickItemInternal<T>(IEnumerable<T> itemsToSelectFrom, T itemToExclude = null)
where T : InventoryItem
private T PickItemInternal<T>(IEnumerable<T> itemsToSelectFrom, params T[] itemsToExclude)
where T : IBaseInventoryItem
{
var rng = new RandomNumberGenerator();
rng.Randomize();
if (itemToExclude is not null)
itemsToSelectFrom = [.. itemsToSelectFrom.Where(x => x.ItemName != itemToExclude.ItemName)];
if (itemsToExclude.Any())
itemsToSelectFrom.Except(itemsToExclude);
var weights = itemsToSelectFrom.Select(x => x.SpawnRate).ToArray();
var selectedItem = itemsToSelectFrom.ToArray()[rng.RandWeighted(weights)];
@@ -54,7 +54,7 @@ public class ItemDatabase
private ItemDatabase()
{
var database = new List<InventoryItem>();
var database = new List<IBaseInventoryItem>();
var armorResources = DirAccess.GetFilesAt("res://src/items/armor/resources/");
var weaponResources = DirAccess.GetFilesAt("res://src/items/weapons/resources/");
var accessoryResources = DirAccess.GetFilesAt("res://src/items/accessory/resources/");

View File

@@ -12,7 +12,7 @@ public class ItemReroller
}
public T RerollItem<T>(T itemToReroll, IInventory inventory, bool insertIntoInventory = true)
where T : InventoryItem
where T : IBaseInventoryItem
{
var currentIndex = inventory.Items.IndexOf(itemToReroll);
@@ -27,7 +27,7 @@ public class ItemReroller
return rolledItem;
}
public InventoryItem RerollItemToAny(InventoryItem itemToReroll, IInventory inventory, bool insertIntoInventory = true)
public IBaseInventoryItem RerollItemToAny(IBaseInventoryItem itemToReroll, IInventory inventory, bool insertIntoInventory = true)
{
var currentIndex = inventory.Items.IndexOf(itemToReroll);

View File

@@ -8,7 +8,7 @@ using Zennysoft.Ma.Adapter.Entity;
namespace Zennysoft.Game.Ma;
[Meta(typeof(IAutoNode)), Id("accessory")]
public partial class Accessory : EquipableItem
public partial class Accessory : Node3D, IAccessory
{
public override void _Notification(int what) => this.Notify(what);
@@ -21,32 +21,32 @@ public partial class Accessory : EquipableItem
_bonusDefense = Stats.BonusDefense;
_bonusLuck = Stats.BonusLuck;
}
public override string ItemName => Stats.Name;
public string ItemName => Stats.Name;
public override string Description => Stats.Description;
public string Description => Stats.Description;
public override float SpawnRate => Stats.SpawnRate;
public float SpawnRate => Stats.SpawnRate;
public override int ThrowDamage => Stats.ThrowDamage;
public int ThrowDamage => Stats.ThrowDamage;
public override float ThrowSpeed => Stats.ThrowSpeed;
public float ThrowSpeed => Stats.ThrowSpeed;
public override int BonusAttack { get => _bonusDamage; }
public int BonusAttack { get => _bonusDamage; }
public override int BonusDefense { get => _bonusDefense; }
public int BonusDefense { get => _bonusDefense; }
public override int BonusLuck { get => _bonusLuck; }
public int BonusLuck { get => _bonusLuck; }
public override int BonusHP => Stats.BonusHP;
public int BonusHP => Stats.BonusHP;
public override int BonusVT => Stats.BonusVT;
public int BonusVT => Stats.BonusVT;
public override ElementalResistanceSet ElementalResistance => new ElementalResistanceSet(Stats.AeolicResistance, Stats.HydricResistance, Stats.IgneousResistance, Stats.FerrumResistance, Stats.TelluricResistance, Stats.HolyResistance, Stats.CurseResistance);
public ElementalResistanceSet ElementalResistance => new ElementalResistanceSet(Stats.AeolicResistance, Stats.HydricResistance, Stats.IgneousResistance, Stats.FerrumResistance, Stats.TelluricResistance, Stats.HolyResistance, Stats.CurseResistance);
[Save("accessory_tag")]
public AccessoryTag AccessoryTag => Stats.AccessoryTag;
public override ItemTag ItemTag => Stats.ItemTag;
public ItemTag ItemTag => Stats.ItemTag;
[Save("accessory_bonus_damage")]
private int _bonusDamage { get; set; } = 0;
@@ -72,6 +72,8 @@ public partial class Accessory : EquipableItem
[Export]
[Save("accessory_stats")]
public AccessoryStats Stats { get; set; } = new AccessoryStats();
public Augment Augment { get; set; }
public bool Glued { get; set; }
public override Texture2D GetTexture() => Stats.Texture;
public Texture2D GetTexture() => Stats.Texture;
}

View File

@@ -6,9 +6,10 @@ using Godot;
using Zennysoft.Game.Implementation;
using Zennysoft.Game.Ma;
using Zennysoft.Ma.Adapter;
using Zennysoft.Ma.Adapter.Entity;
[Meta(typeof(IAutoNode)), Id("ammo")]
public partial class Ammo : EquipableItem, IStackable
public partial class Ammo : Node3D, IEquipableItem, IStackable
{
public override void _Notification(int what) => this.Notify(what);
@@ -21,19 +22,19 @@ public partial class Ammo : EquipableItem, IStackable
}
public override string ItemName => Stats.Name;
public string ItemName => Stats.Name;
public override string Description => Stats.Description;
public string Description => Stats.Description;
public override float SpawnRate => Stats.SpawnRate;
public float SpawnRate => Stats.SpawnRate;
public override int ThrowDamage => Stats.ThrowDamage;
public int ThrowDamage => Stats.ThrowDamage;
public override float ThrowSpeed => Stats.ThrowSpeed;
public float ThrowSpeed => Stats.ThrowSpeed;
public override ItemTag ItemTag => Stats.ItemTag;
public ItemTag ItemTag => Stats.ItemTag;
public override Texture2D GetTexture() => Stats.Texture;
public Texture2D GetTexture() => Stats.Texture;
[Save("ammo_item_count")]
public AutoProp<int> Count { get; private set; }
@@ -46,4 +47,11 @@ public partial class Ammo : EquipableItem, IStackable
[Export]
[Save("ammo_stats")]
public AmmoStats Stats { get; set; } = new AmmoStats();
public int BonusAttack { get; }
public int BonusDefense { get; }
public int BonusHP { get; }
public int BonusVT { get; }
public int BonusLuck { get; }
public bool Glued { get; set; }
public ElementalResistanceSet ElementalResistance { get; }
}

View File

@@ -8,7 +8,7 @@ using Zennysoft.Ma.Adapter.Entity;
namespace Zennysoft.Game.Ma;
[Meta(typeof(IAutoNode)), Id("armor")]
public partial class Armor : EquipableItem
public partial class Armor : Node3D, IArmor
{
public override void _Notification(int what) => this.Notify(what);
@@ -22,21 +22,21 @@ public partial class Armor : EquipableItem
_bonusLuck = Stats.BonusLuck;
}
public override string ItemName => Stats.Name;
public string ItemName => Stats.Name;
public override string Description => Stats.Description;
public string Description => Stats.Description;
public override float SpawnRate => Stats.SpawnRate;
public float SpawnRate => Stats.SpawnRate;
public override int ThrowDamage => Stats.ThrowDamage;
public int ThrowDamage => Stats.ThrowDamage;
public override float ThrowSpeed => Stats.ThrowSpeed;
public float ThrowSpeed => Stats.ThrowSpeed;
public override int BonusAttack { get => _bonusDamage; }
public int BonusAttack { get => _bonusDamage; }
public override int BonusDefense { get => _bonusDefense; }
public int BonusDefense { get => _bonusDefense; }
public override int BonusLuck { get => _bonusLuck; }
public int BonusLuck { get => _bonusLuck; }
public void IncreaseAttack(int bonus) => _bonusDamage += bonus;
@@ -60,14 +60,19 @@ public partial class Armor : EquipableItem
[Save("armor_bonus_luck")]
private int _bonusLuck { get; set; } = 0;
public override ElementalResistanceSet ElementalResistance => new ElementalResistanceSet(Stats.AeolicResistance, Stats.HydricResistance, Stats.IgneousResistance, Stats.FerrumResistance, Stats.TelluricResistance, Stats.HolyResistance, Stats.CurseResistance);
public ElementalResistanceSet ElementalResistance => new ElementalResistanceSet(Stats.AeolicResistance, Stats.HydricResistance, Stats.IgneousResistance, Stats.FerrumResistance, Stats.TelluricResistance, Stats.HolyResistance, Stats.CurseResistance);
public void IncreaseArmorDefense(int bonus) => _bonusDefense += bonus;
public override ItemTag ItemTag => Stats.ItemTag;
public ItemTag ItemTag => Stats.ItemTag;
[Save("armor_stats")]
[Export]
public ArmorStats Stats { get; set; } = new ArmorStats();
public override Texture2D GetTexture() => Stats.Texture;
public Augment Augment { get; set; }
public int BonusHP { get; }
public int BonusVT { get; }
public bool Glued { get; set; }
public Texture2D GetTexture() => Stats.Texture;
}

View File

@@ -6,7 +6,7 @@ using Zennysoft.Game.Ma;
using Zennysoft.Ma.Adapter;
[Meta(typeof(IAutoNode)), Id("box_item")]
public partial class BoxItem : InventoryItem
public partial class BoxItem : Node3D, IBaseInventoryItem
{
public override void _Notification(int what) => this.Notify(what);
@@ -16,19 +16,19 @@ public partial class BoxItem : InventoryItem
[Save("box_stats")]
public BoxItemStats Stats { get; set; } = new BoxItemStats();
public override string ItemName => Stats.Name;
public string ItemName => Stats.Name;
public override string Description => Stats.Description;
public string Description => Stats.Description;
public override float SpawnRate => Stats.SpawnRate;
public float SpawnRate => Stats.SpawnRate;
public override int ThrowDamage => Stats.ThrowDamage;
public int ThrowDamage => Stats.ThrowDamage;
public override float ThrowSpeed => Stats.ThrowSpeed;
public float ThrowSpeed => Stats.ThrowSpeed;
public override ItemTag ItemTag => Stats.ItemTag;
public ItemTag ItemTag => Stats.ItemTag;
public override Texture2D GetTexture() => Stats.Texture;
public Texture2D GetTexture() => Stats.Texture;
public void OnReady()
{

View File

@@ -7,7 +7,7 @@ using Zennysoft.Ma.Adapter;
namespace Zennysoft.Game.Ma;
[Meta(typeof(IAutoNode)), Id("consumable_item")]
public partial class ConsumableItem : InventoryItem
public partial class ConsumableItem : Node3D, IBaseInventoryItem
{
public override void _Notification(int what) => this.Notify(what);
@@ -15,15 +15,15 @@ public partial class ConsumableItem : InventoryItem
public override void _Ready() => _sprite.Texture = Stats.Texture;
public override string ItemName => Stats.Name;
public string ItemName => Stats.Name;
public override string Description => Stats.Description;
public string Description => Stats.Description;
public override float SpawnRate => Stats.SpawnRate;
public float SpawnRate => Stats.SpawnRate;
public override int ThrowDamage => Stats.ThrowDamage;
public int ThrowDamage => Stats.ThrowDamage;
public override float ThrowSpeed => Stats.ThrowSpeed;
public float ThrowSpeed => Stats.ThrowSpeed;
[Save("consumable_heal_hp")]
public int HealHPAmount => Stats.HealHPAmount;
@@ -34,10 +34,10 @@ public partial class ConsumableItem : InventoryItem
[Save("consumable_increase_vt")]
public int RaiseVTAmount => Stats.PermanentRaiseVTAmount;
public override ItemTag ItemTag => Stats.ItemTag;
public ItemTag ItemTag => Stats.ItemTag;
[Export]
[Save("consumable_item_stats")]
public ConsumableItemStats Stats { get; set; } = new ConsumableItemStats();
public override Texture2D GetTexture() => Stats.Texture;
public Texture2D GetTexture() => Stats.Texture;
}

View File

@@ -18,7 +18,7 @@ public partial class DroppedItem : RigidBody3D, IDroppedItem
[Node] private Area3D Pickup { get; set; } = default!;
public InventoryItem Item { get; set; }
public IBaseInventoryItem Item { get; set; }
public void OnResolved()
{

View File

@@ -7,7 +7,7 @@ using Zennysoft.Ma.Adapter;
namespace Zennysoft.Game.Ma;
[Meta(typeof(IAutoNode)), Id("effect_item")]
public partial class EffectItem : InventoryItem
public partial class EffectItem : Node3D, IBaseInventoryItem
{
public override void _Notification(int what) => this.Notify(what);
@@ -18,20 +18,20 @@ public partial class EffectItem : InventoryItem
_sprite.Texture = Stats.Texture;
}
public override string ItemName => Stats.Name;
public string ItemName => Stats.Name;
public override string Description => Stats.Description;
public string Description => Stats.Description;
public override float SpawnRate => Stats.SpawnRate;
public float SpawnRate => Stats.SpawnRate;
public override int ThrowDamage => Stats.ThrowDamage;
public int ThrowDamage => Stats.ThrowDamage;
public override float ThrowSpeed => Stats.ThrowSpeed;
public float ThrowSpeed => Stats.ThrowSpeed;
[Save("usable_tag")]
public UsableItemTag UsableItemTag => Stats.UsableItemTag;
public override ItemTag ItemTag => Stats.ItemTag;
public ItemTag ItemTag => Stats.ItemTag;
public void SetEffectTag(UsableItemTag effect) => Stats.UsableItemTag = effect;
@@ -39,5 +39,5 @@ public partial class EffectItem : InventoryItem
[Save("effect_item_stats")]
public EffectItemStats Stats { get; set; } = new EffectItemStats();
public override Texture2D GetTexture() => Stats.Texture;
public Texture2D GetTexture() => Stats.Texture;
}

View File

@@ -6,7 +6,7 @@ using Zennysoft.Game.Ma;
using Zennysoft.Ma.Adapter;
[Meta(typeof(IAutoNode)), Id("jewel")]
public partial class Jewel : InventoryItem, IAugmentItem
public partial class Jewel : Node3D, IAugmentItem
{
public override void _Notification(int what) => this.Notify(what);
@@ -17,23 +17,23 @@ public partial class Jewel : InventoryItem, IAugmentItem
_sprite.Texture = Stats.Texture;
}
public override string ItemName => Stats.Name;
public string ItemName => Stats.Name;
public override string Description => Stats.Description;
public string Description => Stats.Description;
public override float SpawnRate => Stats.SpawnRate;
public float SpawnRate => Stats.SpawnRate;
public override int ThrowDamage => Stats.ThrowDamage;
public int ThrowDamage => Stats.ThrowDamage;
public override float ThrowSpeed => Stats.ThrowSpeed;
public float ThrowSpeed => Stats.ThrowSpeed;
public override ItemTag ItemTag => Stats.ItemTag;
public ItemTag ItemTag => Stats.ItemTag;
public override Texture2D GetTexture() => Stats.Texture;
public Texture2D GetTexture() => Stats.Texture;
[Export]
[Save("jewel_stats")]
public JewelStats Stats { get; set; } = new JewelStats();
public JewelTags Augment => Stats.JewelTag;
public IAugmentType Augment { get; set; }
}

View File

@@ -7,30 +7,30 @@ using Zennysoft.Ma.Adapter;
using Zennysoft.Ma.Adapter.Entity;
[Meta(typeof(IAutoNode))]
public partial class Plastique : InventoryItem
public partial class Plastique : Node3D, IBaseInventoryItem
{
public override void _Notification(int what) => this.Notify(what);
[Node] private Sprite3D _sprite { get; set; }
public override string ItemName => Stats.Name;
public string ItemName => Stats.Name;
public override string Description => Stats.Description;
public string Description => Stats.Description;
public override float SpawnRate => Stats.SpawnRate;
public float SpawnRate => Stats.SpawnRate;
public override int ThrowDamage => Stats.ThrowDamage;
public int ThrowDamage => Stats.ThrowDamage;
public override float ThrowSpeed => Stats.ThrowSpeed;
public float ThrowSpeed => Stats.ThrowSpeed;
public override ItemTag ItemTag => Stats.ItemTag;
public ItemTag ItemTag => Stats.ItemTag;
public void OnResolved()
{
_sprite.Texture = Stats.Texture;
_sprite.Texture = Stats.Texture;
}
public override Texture2D GetTexture() => Stats.Texture;
public Texture2D GetTexture() => Stats.Texture;
[Export]
[Save("inventory_stats")]

View File

@@ -9,7 +9,7 @@ using Zennysoft.Ma.Adapter;
namespace Zennysoft.Game.Ma;
[Meta(typeof(IAutoNode)), Id("throwable_item")]
public partial class ThrowableItem : InventoryItem, IStackable
public partial class ThrowableItem : Node3D, IBaseInventoryItem, IStackable
{
public override void _Notification(int what) => this.Notify(what);
@@ -23,15 +23,15 @@ public partial class ThrowableItem : InventoryItem, IStackable
Count = new AutoProp<int>(rng.RandiRange(Stats.MinimumCount, Stats.MaximumCount));
}
public override string ItemName => Stats.Name;
public string ItemName => Stats.Name;
public override string Description => Stats.Description;
public string Description => Stats.Description;
public override float SpawnRate => Stats.SpawnRate;
public float SpawnRate => Stats.SpawnRate;
public override int ThrowDamage => Stats.ThrowDamage;
public int ThrowDamage => Stats.ThrowDamage;
public override float ThrowSpeed => Stats.ThrowSpeed;
public float ThrowSpeed => Stats.ThrowSpeed;
[Save("throwable_item_element")]
public ElementType ElementType => Stats.ElementType;
@@ -40,7 +40,7 @@ public partial class ThrowableItem : InventoryItem, IStackable
[Save("throwable_item_heal_vt")]
public int HealVTAmount => Stats.HealVTAmount;
public override ItemTag ItemTag => Stats.ItemTag;
public ItemTag ItemTag => Stats.ItemTag;
public void SetElementType(ElementType elementType) => Stats.ElementType = elementType;
@@ -53,7 +53,7 @@ public partial class ThrowableItem : InventoryItem, IStackable
[Save("throwable_item_stats")]
public ThrowableItemStats Stats { get; set; }
public override Texture2D GetTexture() => Stats.Texture;
public Texture2D GetTexture() => Stats.Texture;
public void SetCount(int count) => Count.OnNext(count);
}

View File

@@ -15,7 +15,7 @@ public partial class ThrownItem : RigidBody3D, IThrownItem
[Dependency] public IGame Game => this.DependOn<IGame>();
public InventoryItem ItemThatIsThrown { get; set; }
public IBaseInventoryItem ItemThatIsThrown { get; set; }
private EffectService _effectService;
private ItemReroller _itemReroller;

View File

@@ -2,14 +2,13 @@ using Chickensoft.AutoInject;
using Chickensoft.Introspection;
using Chickensoft.Serialization;
using Godot;
using System;
using Zennysoft.Ma.Adapter;
using Zennysoft.Ma.Adapter.Entity;
namespace Zennysoft.Game.Ma;
[Meta(typeof(IAutoNode)), Id("weapon")]
public partial class Weapon : EquipableItem
public partial class Weapon : Node3D, IWeapon
{
public override void _Notification(int what) => this.Notify(what);
@@ -25,26 +24,26 @@ public partial class Weapon : EquipableItem
_bonusLuck = Stats.BonusLuck;
}
public override string ItemName => Stats.Name;
public string ItemName => Stats.Name;
public override string Description => Stats.Description;
public string Description => Stats.Description;
public override float SpawnRate => Stats.SpawnRate;
public float SpawnRate => Stats.SpawnRate;
public override int ThrowDamage => Stats.ThrowDamage;
public int ThrowDamage => Stats.ThrowDamage;
public override float ThrowSpeed => Stats.ThrowSpeed;
public float ThrowSpeed => Stats.ThrowSpeed;
[Save("weapon_attack_speed")]
public double AttackSpeed => Stats.AttackSpeed;
[Save("weapon_tag")]
public WeaponTag WeaponTag => Stats.WeaponTag;
public override ItemTag ItemTag => Stats.ItemTag;
public ItemTag ItemTag => Stats.ItemTag;
[Save("weapon_element")]
public ElementType WeaponElement => Stats.WeaponElement;
public override ElementalResistanceSet ElementalResistance => new ElementalResistanceSet(Stats.AeolicResistance, Stats.HydricResistance, Stats.IgneousResistance, Stats.FerrumResistance, Stats.TelluricResistance, Stats.HolyResistance, Stats.CurseResistance);
public ElementalResistanceSet ElementalResistance => new ElementalResistanceSet(Stats.AeolicResistance, Stats.HydricResistance, Stats.IgneousResistance, Stats.FerrumResistance, Stats.TelluricResistance, Stats.HolyResistance, Stats.CurseResistance);
public void IncreaseAttack(int bonus) => _bonusDamage += bonus;
@@ -58,11 +57,15 @@ public partial class Weapon : EquipableItem
public void SetLuck(int newBonus) => _bonusLuck = newBonus;
public override int BonusAttack { get => _bonusDamage; }
public int BonusAttack { get => _bonusDamage; }
public override int BonusDefense { get => _bonusDefense; }
public int BonusDefense { get => _bonusDefense; }
public override int BonusLuck { get => _bonusLuck; }
public int BonusLuck { get => _bonusLuck; }
public int BonusHP { get; }
public int BonusVT { get; }
[Save("weapon_bonus_damage")]
private int _bonusDamage { get; set; } = 0;
@@ -76,6 +79,9 @@ public partial class Weapon : EquipableItem
[Export]
[Save("weapon_stats")]
public WeaponStats Stats { get; set; } = new WeaponStats();
public Augment Augment { get; set; }
public override Texture2D GetTexture() => Stats.Texture;
public bool Glued { get; set; }
public Texture2D GetTexture() => Stats.Texture;
}