More inventory fixes

This commit is contained in:
2024-09-10 00:26:12 -07:00
parent 086370987c
commit 911f75da14
15 changed files with 47 additions and 306 deletions

View File

@@ -92,8 +92,8 @@ public partial class InventoryMenu : Control, IInventoryMenu
var atkBonus = GameRepo.PlayerStatInfo.Value.BonusAttack;
var defBonus = GameRepo.PlayerStatInfo.Value.BonusDefense;
ATKBonusLabel.Text = atkBonus != 0 ? $"{atkBonus}" : "...";
DEFBonusLabel.Text = defBonus != 0 ? $"{defBonus}" : "...";
ATKBonusLabel.Text = atkBonus != 0 ? $"{atkBonus:+0;-#}" : "...";
DEFBonusLabel.Text = defBonus != 0 ? $"{defBonus:+0;-#}" : "...";
// TODO: Change font style when EXP Bonus effect is active
var currentExp = GameRepo.PlayerStatInfo.Value.CurrentEXP;

View File

@@ -1,10 +1,13 @@
using Chickensoft.AutoInject;
using Chickensoft.GodotNodeInterfaces;
using System;
namespace GameJamDungeon
{
public interface IInventoryItem : INode3D
{
public Guid ID { get; }
public IGameRepo GameRepo { get; }
public InventoryItemInfo Info { get; }

View File

@@ -7,10 +7,12 @@ using System.Collections.Generic;
using System.Linq;
[Meta(typeof(IAutoNode))]
public partial class Accessory : Node3D, IInventoryItem, IEquipable, IEquatable<Accessory>
public partial class Accessory : Node3D, IInventoryItem, IEquipable
{
public override void _Notification(int what) => this.Notify(what);
public Guid ID { get; } = new Guid();
[Dependency] public IGameRepo GameRepo => this.DependOn<IGameRepo>();
public InventoryItemInfo Info => AccessoryInfo;
@@ -37,100 +39,4 @@ public partial class Accessory : Node3D, IInventoryItem, IEquipable, IEquatable<
GameRepo.InventoryItems.OnNext(inventoryList);
QueueFree();
}
public override bool Equals(object obj)
{
return Equals(obj as Accessory);
}
public bool Equals(Accessory other)
{
return other is not null &&
NativeInstance.Equals(other.NativeInstance) &&
EqualityComparer<NodePath>.Default.Equals(_ImportPath, other._ImportPath) &&
EqualityComparer<StringName>.Default.Equals(Name, other.Name) &&
UniqueNameInOwner == other.UniqueNameInOwner &&
SceneFilePath == other.SceneFilePath &&
EqualityComparer<Node>.Default.Equals(Owner, other.Owner) &&
EqualityComparer<MultiplayerApi>.Default.Equals(Multiplayer, other.Multiplayer) &&
ProcessMode == other.ProcessMode &&
ProcessPriority == other.ProcessPriority &&
ProcessPhysicsPriority == other.ProcessPhysicsPriority &&
ProcessThreadGroup == other.ProcessThreadGroup &&
ProcessThreadGroupOrder == other.ProcessThreadGroupOrder &&
ProcessThreadMessages == other.ProcessThreadMessages &&
PhysicsInterpolationMode == other.PhysicsInterpolationMode &&
AutoTranslateMode == other.AutoTranslateMode &&
EditorDescription == other.EditorDescription &&
Transform.Equals(other.Transform) &&
GlobalTransform.Equals(other.GlobalTransform) &&
Position.Equals(other.Position) &&
Rotation.Equals(other.Rotation) &&
RotationDegrees.Equals(other.RotationDegrees) &&
Quaternion.Equals(other.Quaternion) &&
Basis.Equals(other.Basis) &&
Scale.Equals(other.Scale) &&
RotationEditMode == other.RotationEditMode &&
RotationOrder == other.RotationOrder &&
TopLevel == other.TopLevel &&
GlobalPosition.Equals(other.GlobalPosition) &&
GlobalBasis.Equals(other.GlobalBasis) &&
GlobalRotation.Equals(other.GlobalRotation) &&
GlobalRotationDegrees.Equals(other.GlobalRotationDegrees) &&
Visible == other.Visible &&
EqualityComparer<NodePath>.Default.Equals(VisibilityParent, other.VisibilityParent) &&
EqualityComparer<IGameRepo>.Default.Equals(GameRepo, other.GameRepo) &&
EqualityComparer<InventoryItemInfo>.Default.Equals(Info, other.Info) &&
EqualityComparer<AccessoryInfo>.Default.Equals(AccessoryInfo, other.AccessoryInfo) &&
EqualityComparer<Sprite3D>.Default.Equals(Sprite, other.Sprite) &&
EqualityComparer<Area3D>.Default.Equals(Pickup, other.Pickup) &&
EqualityComparer<MixinBlackboard>.Default.Equals(MixinState, other.MixinState) &&
EqualityComparer<IMetatype>.Default.Equals(Metatype, other.Metatype);
}
public override int GetHashCode()
{
HashCode hash = new HashCode();
hash.Add(NativeInstance);
hash.Add(_ImportPath);
hash.Add(Name);
hash.Add(UniqueNameInOwner);
hash.Add(SceneFilePath);
hash.Add(Owner);
hash.Add(Multiplayer);
hash.Add(ProcessMode);
hash.Add(ProcessPriority);
hash.Add(ProcessPhysicsPriority);
hash.Add(ProcessThreadGroup);
hash.Add(ProcessThreadGroupOrder);
hash.Add(ProcessThreadMessages);
hash.Add(PhysicsInterpolationMode);
hash.Add(AutoTranslateMode);
hash.Add(EditorDescription);
hash.Add(Transform);
hash.Add(GlobalTransform);
hash.Add(Position);
hash.Add(Rotation);
hash.Add(RotationDegrees);
hash.Add(Quaternion);
hash.Add(Basis);
hash.Add(Scale);
hash.Add(RotationEditMode);
hash.Add(RotationOrder);
hash.Add(TopLevel);
hash.Add(GlobalPosition);
hash.Add(GlobalBasis);
hash.Add(GlobalRotation);
hash.Add(GlobalRotationDegrees);
hash.Add(Visible);
hash.Add(VisibilityParent);
hash.Add(GameRepo);
hash.Add(Info);
hash.Add(AccessoryInfo);
hash.Add(Sprite);
hash.Add(Pickup);
hash.Add(MixinState);
hash.Add(Metatype);
return hash.ToHashCode();
}
}

View File

@@ -7,10 +7,11 @@
script = ExtResource("1_sjkji")
ATKUp = 0
DEFUp = 0
LUCKUp = 0.0
LUCKUp = 0.15
MaxHPUp = 0
MaxVTUp = 0
AccessoryTags = []
Name = "Mask of the Goddess of Avarice"
Description = ""
Description = "Raises LUCK."
Texture = ExtResource("1_578a0")
SpawnRate = 0.5

View File

@@ -7,10 +7,12 @@ using System.Collections.Generic;
using System.Linq;
[Meta(typeof(IAutoNode))]
public partial class Armor : Node3D, IInventoryItem, IEquipable, IEquatable<Armor>
public partial class Armor : Node3D, IInventoryItem, IEquipable
{
public override void _Notification(int what) => this.Notify(what);
public Guid ID { get; } = new Guid();
[Dependency] public IGameRepo GameRepo => this.DependOn<IGameRepo>();
public InventoryItemInfo Info => ArmorInfo;
@@ -37,100 +39,4 @@ public partial class Armor : Node3D, IInventoryItem, IEquipable, IEquatable<Armo
GameRepo.InventoryItems.OnNext(inventoryList);
QueueFree();
}
public override bool Equals(object obj)
{
return Equals(obj as Armor);
}
public bool Equals(Armor other)
{
return other is not null &&
NativeInstance.Equals(other.NativeInstance) &&
EqualityComparer<NodePath>.Default.Equals(_ImportPath, other._ImportPath) &&
EqualityComparer<StringName>.Default.Equals(Name, other.Name) &&
UniqueNameInOwner == other.UniqueNameInOwner &&
SceneFilePath == other.SceneFilePath &&
EqualityComparer<Node>.Default.Equals(Owner, other.Owner) &&
EqualityComparer<MultiplayerApi>.Default.Equals(Multiplayer, other.Multiplayer) &&
ProcessMode == other.ProcessMode &&
ProcessPriority == other.ProcessPriority &&
ProcessPhysicsPriority == other.ProcessPhysicsPriority &&
ProcessThreadGroup == other.ProcessThreadGroup &&
ProcessThreadGroupOrder == other.ProcessThreadGroupOrder &&
ProcessThreadMessages == other.ProcessThreadMessages &&
PhysicsInterpolationMode == other.PhysicsInterpolationMode &&
AutoTranslateMode == other.AutoTranslateMode &&
EditorDescription == other.EditorDescription &&
Transform.Equals(other.Transform) &&
GlobalTransform.Equals(other.GlobalTransform) &&
Position.Equals(other.Position) &&
Rotation.Equals(other.Rotation) &&
RotationDegrees.Equals(other.RotationDegrees) &&
Quaternion.Equals(other.Quaternion) &&
Basis.Equals(other.Basis) &&
Scale.Equals(other.Scale) &&
RotationEditMode == other.RotationEditMode &&
RotationOrder == other.RotationOrder &&
TopLevel == other.TopLevel &&
GlobalPosition.Equals(other.GlobalPosition) &&
GlobalBasis.Equals(other.GlobalBasis) &&
GlobalRotation.Equals(other.GlobalRotation) &&
GlobalRotationDegrees.Equals(other.GlobalRotationDegrees) &&
Visible == other.Visible &&
EqualityComparer<NodePath>.Default.Equals(VisibilityParent, other.VisibilityParent) &&
EqualityComparer<IGameRepo>.Default.Equals(GameRepo, other.GameRepo) &&
EqualityComparer<InventoryItemInfo>.Default.Equals(Info, other.Info) &&
EqualityComparer<ArmorInfo>.Default.Equals(ArmorInfo, other.ArmorInfo) &&
EqualityComparer<Sprite3D>.Default.Equals(Sprite, other.Sprite) &&
EqualityComparer<Area3D>.Default.Equals(Pickup, other.Pickup) &&
EqualityComparer<MixinBlackboard>.Default.Equals(MixinState, other.MixinState) &&
EqualityComparer<IMetatype>.Default.Equals(Metatype, other.Metatype);
}
public override int GetHashCode()
{
HashCode hash = new HashCode();
hash.Add(NativeInstance);
hash.Add(_ImportPath);
hash.Add(Name);
hash.Add(UniqueNameInOwner);
hash.Add(SceneFilePath);
hash.Add(Owner);
hash.Add(Multiplayer);
hash.Add(ProcessMode);
hash.Add(ProcessPriority);
hash.Add(ProcessPhysicsPriority);
hash.Add(ProcessThreadGroup);
hash.Add(ProcessThreadGroupOrder);
hash.Add(ProcessThreadMessages);
hash.Add(PhysicsInterpolationMode);
hash.Add(AutoTranslateMode);
hash.Add(EditorDescription);
hash.Add(Transform);
hash.Add(GlobalTransform);
hash.Add(Position);
hash.Add(Rotation);
hash.Add(RotationDegrees);
hash.Add(Quaternion);
hash.Add(Basis);
hash.Add(Scale);
hash.Add(RotationEditMode);
hash.Add(RotationOrder);
hash.Add(TopLevel);
hash.Add(GlobalPosition);
hash.Add(GlobalBasis);
hash.Add(GlobalRotation);
hash.Add(GlobalRotationDegrees);
hash.Add(Visible);
hash.Add(VisibilityParent);
hash.Add(GameRepo);
hash.Add(Info);
hash.Add(ArmorInfo);
hash.Add(Sprite);
hash.Add(Pickup);
hash.Add(MixinState);
hash.Add(Metatype);
return hash.ToHashCode();
}
}

View File

@@ -10,6 +10,8 @@ public partial class ConsumableItem : Node3D, IInventoryItem
{
public override void _Notification(int what) => this.Notify(what);
public Guid ID { get; } = new Guid();
[Dependency] public IGameRepo GameRepo => this.DependOn<IGameRepo>();
public InventoryItemInfo Info => ConsumableItemInfo;

View File

@@ -3,6 +3,7 @@ using Chickensoft.GodotNodeInterfaces;
using Chickensoft.Introspection;
using GameJamDungeon;
using Godot;
using System;
using System.Linq;
[Meta(typeof(IAutoNode))]
@@ -10,6 +11,8 @@ public partial class ThrowableItem : Node3D, IInventoryItem
{
public override void _Notification(int what) => this.Notify(what);
public Guid ID { get; } = new Guid();
[Dependency] public IGameRepo GameRepo => this.DependOn<IGameRepo>();
[Node] public IAnimationPlayer AnimationPlayer { get; set; } = default!;

View File

@@ -3,14 +3,15 @@ using Chickensoft.Introspection;
using GameJamDungeon;
using Godot;
using System;
using System.Collections.Generic;
using System.Linq;
[Meta(typeof(IAutoNode))]
public partial class Weapon : Node3D, IInventoryItem, IEquipable, IEquatable<Weapon>
public partial class Weapon : Node3D, IInventoryItem, IEquipable
{
public override void _Notification(int what) => this.Notify(what);
public Guid ID { get; } = new Guid();
[Dependency] public IGameRepo GameRepo => this.DependOn<IGameRepo>();
public InventoryItemInfo Info => WeaponInfo;
@@ -37,100 +38,4 @@ public partial class Weapon : Node3D, IInventoryItem, IEquipable, IEquatable<Wea
GameRepo.InventoryItems.OnNext(inventoryList);
QueueFree();
}
public override bool Equals(object obj)
{
return Equals(obj as Weapon);
}
public bool Equals(Weapon other)
{
return other is not null &&
NativeInstance.Equals(other.NativeInstance) &&
EqualityComparer<NodePath>.Default.Equals(_ImportPath, other._ImportPath) &&
EqualityComparer<StringName>.Default.Equals(Name, other.Name) &&
UniqueNameInOwner == other.UniqueNameInOwner &&
SceneFilePath == other.SceneFilePath &&
EqualityComparer<Node>.Default.Equals(Owner, other.Owner) &&
EqualityComparer<MultiplayerApi>.Default.Equals(Multiplayer, other.Multiplayer) &&
ProcessMode == other.ProcessMode &&
ProcessPriority == other.ProcessPriority &&
ProcessPhysicsPriority == other.ProcessPhysicsPriority &&
ProcessThreadGroup == other.ProcessThreadGroup &&
ProcessThreadGroupOrder == other.ProcessThreadGroupOrder &&
ProcessThreadMessages == other.ProcessThreadMessages &&
PhysicsInterpolationMode == other.PhysicsInterpolationMode &&
AutoTranslateMode == other.AutoTranslateMode &&
EditorDescription == other.EditorDescription &&
Transform.Equals(other.Transform) &&
GlobalTransform.Equals(other.GlobalTransform) &&
Position.Equals(other.Position) &&
Rotation.Equals(other.Rotation) &&
RotationDegrees.Equals(other.RotationDegrees) &&
Quaternion.Equals(other.Quaternion) &&
Basis.Equals(other.Basis) &&
Scale.Equals(other.Scale) &&
RotationEditMode == other.RotationEditMode &&
RotationOrder == other.RotationOrder &&
TopLevel == other.TopLevel &&
GlobalPosition.Equals(other.GlobalPosition) &&
GlobalBasis.Equals(other.GlobalBasis) &&
GlobalRotation.Equals(other.GlobalRotation) &&
GlobalRotationDegrees.Equals(other.GlobalRotationDegrees) &&
Visible == other.Visible &&
EqualityComparer<NodePath>.Default.Equals(VisibilityParent, other.VisibilityParent) &&
EqualityComparer<IGameRepo>.Default.Equals(GameRepo, other.GameRepo) &&
EqualityComparer<InventoryItemInfo>.Default.Equals(Info, other.Info) &&
EqualityComparer<WeaponInfo>.Default.Equals(WeaponInfo, other.WeaponInfo) &&
EqualityComparer<Sprite3D>.Default.Equals(Sprite, other.Sprite) &&
EqualityComparer<Area3D>.Default.Equals(Pickup, other.Pickup) &&
EqualityComparer<MixinBlackboard>.Default.Equals(MixinState, other.MixinState) &&
EqualityComparer<IMetatype>.Default.Equals(Metatype, other.Metatype);
}
public override int GetHashCode()
{
HashCode hash = new HashCode();
hash.Add(NativeInstance);
hash.Add(_ImportPath);
hash.Add(Name);
hash.Add(UniqueNameInOwner);
hash.Add(SceneFilePath);
hash.Add(Owner);
hash.Add(Multiplayer);
hash.Add(ProcessMode);
hash.Add(ProcessPriority);
hash.Add(ProcessPhysicsPriority);
hash.Add(ProcessThreadGroup);
hash.Add(ProcessThreadGroupOrder);
hash.Add(ProcessThreadMessages);
hash.Add(PhysicsInterpolationMode);
hash.Add(AutoTranslateMode);
hash.Add(EditorDescription);
hash.Add(Transform);
hash.Add(GlobalTransform);
hash.Add(Position);
hash.Add(Rotation);
hash.Add(RotationDegrees);
hash.Add(Quaternion);
hash.Add(Basis);
hash.Add(Scale);
hash.Add(RotationEditMode);
hash.Add(RotationOrder);
hash.Add(TopLevel);
hash.Add(GlobalPosition);
hash.Add(GlobalBasis);
hash.Add(GlobalRotation);
hash.Add(GlobalRotationDegrees);
hash.Add(Visible);
hash.Add(VisibilityParent);
hash.Add(GameRepo);
hash.Add(Info);
hash.Add(WeaponInfo);
hash.Add(Sprite);
hash.Add(Pickup);
hash.Add(MixinState);
hash.Add(Metatype);
return hash.ToHashCode();
}
}

View File

@@ -5,7 +5,7 @@
[resource]
script = ExtResource("1_re512")
Damage = 0
Damage = 3
Luck = 0.05
AttackSpeed = 1.0
TelluricDamageBonus = 0.0
@@ -15,5 +15,7 @@ IgneousDamageBonus = 0.0
FerrumDamageBonus = 0.0
WeaponTags = []
Name = "Jiblett"
Description = ""
Description = "+3 ATK
A halberd for the tasteful."
Texture = ExtResource("1_ifm43")
SpawnRate = 0.5

View File

@@ -5,7 +5,7 @@
[resource]
script = ExtResource("1_kbje7")
Damage = 0
Damage = 9
Luck = 0.05
AttackSpeed = 1.0
TelluricDamageBonus = 0.0
@@ -15,5 +15,8 @@ IgneousDamageBonus = 0.0
FerrumDamageBonus = 0.0
WeaponTags = []
Name = "Kubel"
Description = ""
Description = "+9 ATK
A very powerful spear.
For every hit, you lose 5 HP."
Texture = ExtResource("1_kwtbu")
SpawnRate = 0.5

View File

@@ -15,5 +15,7 @@ IgneousDamageBonus = 0.0
FerrumDamageBonus = 0.0
WeaponTags = []
Name = "Love Judgement"
Description = "A mace only wieldable by the strong of heart."
Description = "+12 DEF
A mace only wieldable by the strong of heart."
Texture = ExtResource("1_ivlxj")
SpawnRate = 0.5

View File

@@ -15,5 +15,8 @@ IgneousDamageBonus = 0.0
FerrumDamageBonus = 0.0
WeaponTags = [3]
Name = "Palm of Heaven"
Description = "Very Powerful. Breaks upon leaving the floor."
Description = "+10 ATK
Very Powerful.
Breaks upon leaving the floor."
Texture = ExtResource("1_hi6xm")
SpawnRate = 0.5

View File

@@ -15,5 +15,7 @@ IgneousDamageBonus = 0.0
FerrumDamageBonus = 0.0
WeaponTags = [1]
Name = "Rondo"
Description = "An eastern blade outside of time and reproach."
Description = "+7 ATK
An eastern blade outside of time and reproach."
Texture = ExtResource("1_cvwbh")
SpawnRate = 0.5

View File

@@ -15,7 +15,8 @@ IgneousDamageBonus = 0.0
FerrumDamageBonus = 0.0
WeaponTags = []
Name = "Sealing Rod"
Description = "A wand fitted with charms said to cleanse and purify that which belongs to other worlds.
Description = "+2 ATK
A wand fitted with charms said to cleanse and purify that which belongs to other worlds.
It's unaligned nature has the power to balance all that it comes into contact with, should the wielder have the will."
Texture = ExtResource("1_wiylj")
SpawnRate = 0.5

View File

@@ -15,7 +15,9 @@ IgneousDamageBonus = 0.0
FerrumDamageBonus = 0.0
WeaponTags = [1]
Name = "Swan Sword Odette"
Description = "Ignores Affinity.
Description = "+12 ATK
Ignores Affinity.
The blade of a thousand faced heroine."
Texture = ExtResource("1_qc4eu")
SpawnRate = 0.5