From 463d91d640f20f5a6ac3500515cad8748fbf9a6e Mon Sep 17 00:00:00 2001 From: Zenny Date: Sun, 31 May 2026 17:38:53 -0700 Subject: [PATCH] Set affinity icon in UI --- Zennysoft.Game.Ma/src/game/Game.cs | 2 + Zennysoft.Game.Ma/src/game/IGame.cs | 2 + Zennysoft.Game.Ma/src/player/Player.cs | 1189 +++++++++-------- .../src/ui/Affinity Icons/None.png | Bin 0 -> 880 bytes .../src/ui/Affinity Icons/None.png.import | 35 + .../src/ui/in_game_ui/InGameUI.cs | 72 +- .../src/ui/in_game_ui/InGameUI.tscn | 76 +- .../src/ui/player_ui/PlayerInfoUI.tscn | 3 +- 8 files changed, 758 insertions(+), 621 deletions(-) create mode 100644 Zennysoft.Game.Ma/src/ui/Affinity Icons/None.png create mode 100644 Zennysoft.Game.Ma/src/ui/Affinity Icons/None.png.import diff --git a/Zennysoft.Game.Ma/src/game/Game.cs b/Zennysoft.Game.Ma/src/game/Game.cs index 295bb0f6..bf62e3c7 100644 --- a/Zennysoft.Game.Ma/src/game/Game.cs +++ b/Zennysoft.Game.Ma/src/game/Game.cs @@ -404,6 +404,8 @@ public partial class Game : Node3D, IGame }); } + public void SetAffinity(ElementType elementType) => InGameUI.SetAffinity(elementType); + private void FloorClearMenu_Exit() { _player.Deactivate(); diff --git a/Zennysoft.Game.Ma/src/game/IGame.cs b/Zennysoft.Game.Ma/src/game/IGame.cs index f57ffbe3..97093f85 100644 --- a/Zennysoft.Game.Ma/src/game/IGame.cs +++ b/Zennysoft.Game.Ma/src/game/IGame.cs @@ -27,6 +27,8 @@ public interface IGame : IProvide, IProvide, IProvide public void ThrowItem(IBaseInventoryItem item); + public void SetAffinity(ElementType elementType); + public void FloorExitReached(); public void GameOver(); diff --git a/Zennysoft.Game.Ma/src/player/Player.cs b/Zennysoft.Game.Ma/src/player/Player.cs index 2c583812..9572cfa4 100644 --- a/Zennysoft.Game.Ma/src/player/Player.cs +++ b/Zennysoft.Game.Ma/src/player/Player.cs @@ -153,129 +153,129 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide public void Initialize() { - var container = new SimpleInjector.Container(); - container.Register(Lifestyle.Singleton); + var container = new SimpleInjector.Container(); + container.Register(Lifestyle.Singleton); - PlayerLogic = container.GetInstance(); - PlayerLogic.Set(this as IPlayer); - PlayerLogic.Set(Settings); + PlayerLogic = container.GetInstance(); + PlayerLogic.Set(this as IPlayer); + PlayerLogic.Set(Settings); - Inventory = new Inventory(); - Inventory.InventoryChanged += Inventory_InventoryChanged; - HealthComponent = new HealthComponent(InitialHP); - VTComponent = new VTComponent(InitialVT); - AttackComponent = new AttackComponent(InitialAttack); - DefenseComponent = new DefenseComponent(InitialDefense); - ExperiencePointsComponent = new ExperiencePointsComponent(); - LuckComponent = new LuckComponent(InitialLuck); - EquipmentComponent = new EquipmentComponent(); - StatusEffectComponent = new StatusEffectComponent(RustDuration); - SigilComponent = new SigilComponent(); + Inventory = new Inventory(); + Inventory.InventoryChanged += Inventory_InventoryChanged; + HealthComponent = new HealthComponent(InitialHP); + VTComponent = new VTComponent(InitialVT); + AttackComponent = new AttackComponent(InitialAttack); + DefenseComponent = new DefenseComponent(InitialDefense); + ExperiencePointsComponent = new ExperiencePointsComponent(); + LuckComponent = new LuckComponent(InitialLuck); + EquipmentComponent = new EquipmentComponent(); + StatusEffectComponent = new StatusEffectComponent(RustDuration); + SigilComponent = new SigilComponent(); - _itemReroller = new ItemReroller(ItemDatabase.Instance); - _playerEffectService = new PlayerEffectService(this); + _itemReroller = new ItemReroller(ItemDatabase.Instance); + _playerEffectService = new PlayerEffectService(this); - Settings = new PlayerLogic.Settings() { RotationSpeed = RotationSpeed, MoveSpeed = MoveSpeed, Acceleration = Acceleration }; + Settings = new PlayerLogic.Settings() { RotationSpeed = RotationSpeed, MoveSpeed = MoveSpeed, Acceleration = Acceleration }; - PlayerBinding = PlayerLogic.Bind(); + PlayerBinding = PlayerLogic.Bind(); - PlayerBinding - .Handle((in PlayerLogic.Output.ThrowItem output) => - { - }) - .Handle((in PlayerLogic.Output.Move output) => - { - Move(output.delta); - }); + PlayerBinding + .Handle((in PlayerLogic.Output.ThrowItem output) => + { + }) + .Handle((in PlayerLogic.Output.Move output) => + { + Move(output.delta); + }); - PlayerLogic.Start(); - this.Provide(); + PlayerLogic.Start(); + this.Provide(); } public void ResetPlayerData() { - PlayerFXAnimations.Play("RESET"); + PlayerFXAnimations.Play("RESET"); - Inventory.Items.Clear(); - HealthComponent.Reset(); - VTComponent.Reset(); - AttackComponent.Reset(); - DefenseComponent.Reset(); - ExperiencePointsComponent.Reset(); - LuckComponent.Reset(); - EquipmentComponent.Reset(); - SigilComponent.Reset(); + Inventory.Items.Clear(); + HealthComponent.Reset(); + VTComponent.Reset(); + AttackComponent.Reset(); + DefenseComponent.Reset(); + ExperiencePointsComponent.Reset(); + LuckComponent.Reset(); + EquipmentComponent.Reset(); + SigilComponent.Reset(); - HealthTimer.Timeout += OnHealthTimerTimeout; + HealthTimer.Timeout += OnHealthTimerTimeout; } #region Initialization public void OnReady() { - Hitbox.AreaEntered += Hitbox_AreaEntered; - CollisionDetector.AreaEntered += CollisionDetector_AreaEntered; - HealthComponent.CurrentHP.Changed += InverseHPToAttackPowerSync; - HealthComponent.HealthReachedZero += Die; - ExperiencePointsComponent.PlayerLevelUp += OnLevelUp; - ExperiencePointsComponent.PlayerLevelDown += OnLevelDown; - PlayerFXAnimations.AnimationFinished += PlayerFXAnimations_AnimationFinished; - HealthTimer.WaitTime = _healthTimerWaitTime; + Hitbox.AreaEntered += Hitbox_AreaEntered; + CollisionDetector.AreaEntered += CollisionDetector_AreaEntered; + HealthComponent.CurrentHP.Changed += InverseHPToAttackPowerSync; + HealthComponent.HealthReachedZero += Die; + ExperiencePointsComponent.PlayerLevelUp += OnLevelUp; + ExperiencePointsComponent.PlayerLevelDown += OnLevelDown; + PlayerFXAnimations.AnimationFinished += PlayerFXAnimations_AnimationFinished; + HealthTimer.WaitTime = _healthTimerWaitTime; - _projectileCooldownTimer = new Timer(); - AddChild(_projectileCooldownTimer); - _projectileCooldownTimer.WaitTime = 1.8f; - _projectileCooldownTimer.Timeout += ProjectileCooldown; + _projectileCooldownTimer = new Timer(); + AddChild(_projectileCooldownTimer); + _projectileCooldownTimer.WaitTime = 1.8f; + _projectileCooldownTimer.Timeout += ProjectileCooldown; - _immunityTimer = new Timer(); - AddChild(_immunityTimer); - _immunityTimer.WaitTime = _immunityTime; - _immunityTimer.Timeout += _immunityTimer_Timeout; + _immunityTimer = new Timer(); + AddChild(_immunityTimer); + _immunityTimer.WaitTime = _immunityTime; + _immunityTimer.Timeout += _immunityTimer_Timeout; - SetProcessInput(false); - SetPhysicsProcess(false); + SetProcessInput(false); + SetPhysicsProcess(false); } private void _immunityTimer_Timeout() { - BriefImmunity = false; - Barrier.FadeOut(); - SfxDatabase.Instance.Play(SoundEffect.Debuff); + BriefImmunity = false; + Barrier.FadeOut(); + SfxDatabase.Instance.Play(SoundEffect.Debuff); } #endregion public void Activate() { - SetProcessInput(true); - SetPhysicsProcess(true); - SetHealthTimerStatus(HealthTimerIsActive); - Hitbox.SetDeferred(Area3D.PropertyName.Monitoring, true); - Hitbox.SetDeferred(Area3D.PropertyName.Monitorable, true); + SetProcessInput(true); + SetPhysicsProcess(true); + SetHealthTimerStatus(HealthTimerIsActive); + Hitbox.SetDeferred(Area3D.PropertyName.Monitoring, true); + Hitbox.SetDeferred(Area3D.PropertyName.Monitorable, true); } public void Deactivate() { - Velocity = Vector3.Zero; - SetProcessInput(false); - SetPhysicsProcess(false); - SetHealthTimerStatus(false); - Hitbox.SetDeferred(Area3D.PropertyName.Monitoring, false); - Hitbox.SetDeferred(Area3D.PropertyName.Monitorable, false); + Velocity = Vector3.Zero; + SetProcessInput(false); + SetPhysicsProcess(false); + SetHealthTimerStatus(false); + Hitbox.SetDeferred(Area3D.PropertyName.Monitoring, false); + Hitbox.SetDeferred(Area3D.PropertyName.Monitorable, false); } public void SetHealthTimerStatus(bool isActive) { - if (isActive) - HealthTimer.Start(); - else - HealthTimer.Stop(); + if (isActive) + HealthTimer.Start(); + else + HealthTimer.Stop(); } public void ModifyHealthTimerSpeed(float newSpeed) { - HealthTimerSpeedModifier = newSpeed; - HealthTimer.Stop(); - HealthTimer.WaitTime = _healthTimerWaitTime * newSpeed; - HealthTimer.Start(); + HealthTimerSpeedModifier = newSpeed; + HealthTimer.Stop(); + HealthTimer.WaitTime = _healthTimerWaitTime * newSpeed; + HealthTimer.Start(); } public void ModifyHealthRecoveryAmount(int newAmount) @@ -285,39 +285,40 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide public void TeleportPlayer((Vector3 Rotation, Vector3 Position) newTransform) { - Rotation = newTransform.Rotation; - Position = newTransform.Position; - ResetPhysicsInterpolation(); + Rotation = newTransform.Rotation; + Position = newTransform.Position; + ResetPhysicsInterpolation(); } public void TakeDamage(AttackData damage) { - if (BriefImmunity) - return; + if (BriefImmunity) + return; - _camera3D.AddShake(1.0f); - TakeDamageAnimationPlayer.Play("take_damage"); - var defense = TotalDefense * SigilComponent.Sigil.DefenseModifier; - var damageReceived = DamageCalculator.CalculateDamage(damage, defense, EquipmentComponent.ElementalResistance); - HealthComponent.Damage(damageReceived, damage.ElementType); - SfxDatabase.Instance.Play(SoundEffect.TakeDamage); + _camera3D.AddShake(1.0f); + TakeDamageAnimationPlayer.Play("take_damage"); + var defense = TotalDefense * SigilComponent.Sigil.DefenseModifier; + var damageReceived = DamageCalculator.CalculateDamage(damage, defense, EquipmentComponent.ElementalResistance); + HealthComponent.Damage(damageReceived, damage.ElementType); + SfxDatabase.Instance.Play(SoundEffect.TakeDamage); - if (EquipmentComponent.EquippedArmor.Value.ArmorTag == ArmorTag.DegradeOnHit) - { - EquipmentComponent.EquippedArmor.Value.DecreaseArmorDefense(1); - EquipmentComponent.UpdateEquipment(EquipmentComponent.EquippedArmor.Value); - } + if (EquipmentComponent.EquippedArmor.Value.ArmorTag == ArmorTag.DegradeOnHit) + { + EquipmentComponent.EquippedArmor.Value.DecreaseArmorDefense(1); + EquipmentComponent.UpdateEquipment(EquipmentComponent.EquippedArmor.Value); + } } public void SetSigil(ISigil sigil) { - SigilComponent.Sigil = sigil; + SigilComponent.Sigil = sigil; + _game.SetAffinity(sigil.ElementType); } public void Knockback(float impulse) { - _knockbackStrength = impulse; - _knockbackDirection = GlobalBasis.Z.Normalized(); + _knockbackStrength = impulse; + _knockbackDirection = GlobalBasis.Z.Normalized(); } public void PlayJumpScareAnimation() => PlayerFXAnimations.Play("jump_scare"); @@ -333,363 +334,363 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide public void LevelUp() { - ExperiencePointsComponent.LevelUp(); + ExperiencePointsComponent.LevelUp(); } public void Die() { - PlayerFXAnimations.Play("death"); + PlayerFXAnimations.Play("death"); - if (AutoRevive) - return; + if (AutoRevive) + return; - HealthTimer.WaitTime = _healthTimerWaitTime; - HealthTimer.Timeout -= OnHealthTimerTimeout; - SetProcessInput(false); - SetPhysicsProcess(false); + HealthTimer.WaitTime = _healthTimerWaitTime; + HealthTimer.Timeout -= OnHealthTimerTimeout; + SetProcessInput(false); + SetPhysicsProcess(false); } public override void _Input(InputEvent @event) { - if (GetTree().Paused) - return; + if (GetTree().Paused) + return; - if (@event.IsActionPressed(GameInputs.Attack)) - Attack(); - if (@event.IsActionPressed(GameInputs.Sprint)) - _debugSprint = true; - else if (@event.IsActionReleased(GameInputs.Sprint)) - _debugSprint = false; + if (@event.IsActionPressed(GameInputs.Attack)) + Attack(); + if (@event.IsActionPressed(GameInputs.Sprint)) + _debugSprint = true; + else if (@event.IsActionReleased(GameInputs.Sprint)) + _debugSprint = false; } public void OnPhysicsProcess(double delta) { - PlayerLogic.Input(new PlayerLogic.Input.PhysicsTick(delta)); + PlayerLogic.Input(new PlayerLogic.Input.PhysicsTick(delta)); } public void Equip(IEquipableItem equipable) { - if (equipable.ItemTag == ItemTag.MysteryItem) - { - var rerolledItem = _itemReroller.RerollItem(equipable, Inventory); - Equip(rerolledItem); - return; - } + if (equipable.ItemTag == ItemTag.MysteryItem) + { + var rerolledItem = _itemReroller.RerollItem(equipable, Inventory); + Equip(rerolledItem); + return; + } - if (equipable is Weapon && EquipmentComponent.EquippedWeapon.Value != null && !EquipmentComponent.EquippedWeapon.Value.Glued) - Unequip(EquipmentComponent.EquippedWeapon.Value); - if (equipable is Armor && EquipmentComponent.EquippedArmor.Value != null && !EquipmentComponent.EquippedArmor.Value.Glued) - Unequip(EquipmentComponent.EquippedArmor.Value); - if (equipable is Accessory && EquipmentComponent.EquippedAccessory.Value != null && !EquipmentComponent.EquippedAccessory.Value.Glued) - Unequip(EquipmentComponent.EquippedAccessory.Value); - if (equipable is Ammo && EquipmentComponent.EquippedAmmo.Value != null && !EquipmentComponent.EquippedAmmo.Value.Glued) - Unequip(EquipmentComponent.EquippedAmmo.Value); + if (equipable is Weapon && EquipmentComponent.EquippedWeapon.Value != null && !EquipmentComponent.EquippedWeapon.Value.Glued) + Unequip(EquipmentComponent.EquippedWeapon.Value); + if (equipable is Armor && EquipmentComponent.EquippedArmor.Value != null && !EquipmentComponent.EquippedArmor.Value.Glued) + Unequip(EquipmentComponent.EquippedArmor.Value); + if (equipable is Accessory && EquipmentComponent.EquippedAccessory.Value != null && !EquipmentComponent.EquippedAccessory.Value.Glued) + Unequip(EquipmentComponent.EquippedAccessory.Value); + if (equipable is Ammo && EquipmentComponent.EquippedAmmo.Value != null && !EquipmentComponent.EquippedAmmo.Value.Glued) + Unequip(EquipmentComponent.EquippedAmmo.Value); - if (equipable.ItemTag == ItemTag.GlueOnEquip) - equipable.Glued = true; + if (equipable.ItemTag == ItemTag.GlueOnEquip) + equipable.Glued = true; - HealthComponent.RaiseMaximumHP(equipable.BonusHP, false); - VTComponent.RaiseMaximumVT(equipable.BonusVT, false); - LuckComponent.IncreaseLuck(equipable.BonusLuck); + HealthComponent.RaiseMaximumHP(equipable.BonusHP, false); + VTComponent.RaiseMaximumVT(equipable.BonusVT, false); + LuckComponent.IncreaseLuck(equipable.BonusLuck); - if (equipable is IAugmentableItem augmentable) - if (augmentable.Augment != null) - augmentable.Augment.AugmentType.Apply(); + if (equipable is IAugmentableItem augmentable) + if (augmentable.Augment != null) + augmentable.Augment.AugmentType.Apply(); - EquipmentComponent.Equip(equipable); + EquipmentComponent.Equip(equipable); - if (equipable is Weapon weapon) - { - if (weapon.WeaponTag == WeaponTag.KineticProjectile) - PersuaderCrosshair.Show(); - if (weapon.WeaponTag == WeaponTag.InverseHPAttackPower) - InverseHPToAttackPowerSync(HealthComponent.CurrentHP.Value); - } + if (equipable is Weapon weapon) + { + if (weapon.WeaponTag == WeaponTag.KineticProjectile) + PersuaderCrosshair.Show(); + if (weapon.WeaponTag == WeaponTag.InverseHPAttackPower) + InverseHPToAttackPowerSync(HealthComponent.CurrentHP.Value); + } - if (equipable is Accessory accessory) - { - if (accessory.AccessoryTag == AccessoryTag.BoostEXPGainRate) - ExperiencePointsComponent.ModifyExpGainRate(ExperiencePointsComponent.ExpGainRate.Value + 0.2f); - } - _game.NotifyInventory($"{equipable.ItemName} equipped."); + if (equipable is Accessory accessory) + { + if (accessory.AccessoryTag == AccessoryTag.BoostEXPGainRate) + ExperiencePointsComponent.ModifyExpGainRate(ExperiencePointsComponent.ExpGainRate.Value + 0.2f); + } + _game.NotifyInventory($"{equipable.ItemName} equipped."); } public void Unequip(IEquipableItem equipable) { - HealthComponent.SetMaximumHealth(HealthComponent.MaximumHP.Value - equipable.BonusHP); - VTComponent.SetMaximumVT(VTComponent.MaximumVT.Value - equipable.BonusVT); - LuckComponent.DecreaseLuck(equipable.BonusLuck); + HealthComponent.SetMaximumHealth(HealthComponent.MaximumHP.Value - equipable.BonusHP); + VTComponent.SetMaximumVT(VTComponent.MaximumVT.Value - equipable.BonusVT); + LuckComponent.DecreaseLuck(equipable.BonusLuck); - if (equipable is IAugmentableItem augmentItem && augmentItem.Augment != null) - augmentItem.Augment.AugmentType.Remove(); + if (equipable is IAugmentableItem augmentItem && augmentItem.Augment != null) + augmentItem.Augment.AugmentType.Remove(); - EquipmentComponent.Unequip(equipable); + EquipmentComponent.Unequip(equipable); - if (equipable is Weapon weapon) - { - if (weapon.WeaponTag == WeaponTag.KineticProjectile) - PersuaderCrosshair.Hide(); - } - if (equipable is Accessory accessory) - { - if (accessory.AccessoryTag == AccessoryTag.BoostEXPGainRate) - ExperiencePointsComponent.ModifyExpGainRate(ExperiencePointsComponent.ExpGainRate.Value - 0.2f); - } - _game.NotifyInventory($"{equipable.ItemName} unequipped."); + if (equipable is Weapon weapon) + { + if (weapon.WeaponTag == WeaponTag.KineticProjectile) + PersuaderCrosshair.Hide(); + } + if (equipable is Accessory accessory) + { + if (accessory.AccessoryTag == AccessoryTag.BoostEXPGainRate) + ExperiencePointsComponent.ModifyExpGainRate(ExperiencePointsComponent.ExpGainRate.Value - 0.2f); + } + _game.NotifyInventory($"{equipable.ItemName} unequipped."); } public void ApplyNewAugment(IAugmentItem jewel, IAugmentableItem augmentableItem) { - Inventory.Remove(jewel); + Inventory.Remove(jewel); - ApplyNewAugment((dynamic)augmentableItem, jewel as Jewel); + ApplyNewAugment((dynamic)augmentableItem, jewel as Jewel); - if (augmentableItem.Augment != null && augmentableItem is IEquipableItem equipable && EquipmentComponent.IsItemEquipped(equipable)) - augmentableItem.Augment.AugmentType.Apply(); + if (augmentableItem.Augment != null && augmentableItem is IEquipableItem equipable && EquipmentComponent.IsItemEquipped(equipable)) + augmentableItem.Augment.AugmentType.Apply(); - _game.NotifyInventory($"{((IBaseInventoryItem)augmentableItem).ItemName} augmented with {jewel.ItemName}."); + _game.NotifyInventory($"{((IBaseInventoryItem)augmentableItem).ItemName} augmented with {jewel.ItemName}."); } private void ApplyNewAugment(Weapon weapon, Jewel jewel) { - switch (jewel.Stats.JewelTag) - { - case JewelTags.AeolicElement: - weapon.Stats.WeaponElement = ElementType.Aeolic; - weapon.Augment = new Augment(JewelTags.AeolicElement, new BasicAugment(), jewel.ItemName, jewel.Stats.WeaponAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.HydricElement: - weapon.Stats.WeaponElement = ElementType.Hydric; - weapon.Augment = new Augment(JewelTags.HydricElement, new BasicAugment(), jewel.ItemName, jewel.Stats.WeaponAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.SlowVTReduction: - weapon.Augment = new Augment(JewelTags.SlowVTReduction, new SlowVTReductionAugment(this), jewel.ItemName, jewel.Stats.WeaponAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.HastenVT: - weapon.Augment = new Augment(JewelTags.HastenVT, new HastenVTAugment(this), jewel.ItemName, jewel.Stats.WeaponAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.ReviveUserOnce: - weapon.Augment = new Augment(JewelTags.ReviveUserOnce, new RevivePlayerAugment(this), jewel.ItemName, jewel.Stats.WeaponAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.IncreaseHPRecovery: - weapon.Augment = new Augment(JewelTags.IncreaseHPRecovery, new HPRecoverySpeedAugment(this), jewel.ItemName, jewel.Stats.WeaponAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.LowerEXPGain: - weapon.Augment = new Augment(JewelTags.LowerEXPGain, new LowerEXPRateAugment(this), jewel.ItemName, jewel.Stats.WeaponAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.ItemRescue: - if (!_game.RescuedItems.TryAdd(weapon)) - break; - if (EquipmentComponent.IsItemEquipped(weapon)) - Unequip(weapon); - Inventory.Remove(weapon); - SfxDatabase.Instance.Play(SoundEffect.Transfer); - break; - case JewelTags.Glue: - if (!EquipmentComponent.IsItemEquipped(weapon)) - break; - weapon.Glued = true; - weapon.Augment = new Augment(JewelTags.Glue, new BasicAugment(), jewel.ItemName, jewel.Stats.WeaponAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.TelluricElement: - weapon.Stats.WeaponElement = ElementType.Telluric; - weapon.Augment = new Augment(JewelTags.TelluricElement, new BasicAugment(), jewel.ItemName, jewel.Stats.WeaponAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.AutoIdentifyAllItems: - weapon.Augment = new Augment(JewelTags.AutoIdentifyAllItems, new IdentifyAllItemsAugment(this), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.IncreaseAtkDefLuck: - weapon.IncreaseAttack(jewel.Stats.BonusAttack); - weapon.IncreaseDefense(jewel.Stats.BonusDefense); - weapon.IncreaseLuck(jewel.Stats.BonusLuck); - weapon.Augment = new Augment(JewelTags.IncreaseAtkDefLuck, new BasicAugment(), jewel.ItemName, jewel.Stats.WeaponAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.IncreaseLuck: - weapon.IncreaseLuck(25); - weapon.Augment = new Augment(JewelTags.IncreaseLuck, new BasicAugment(), jewel.ItemName, jewel.Stats.WeaponAugmentDescription, jewel.GetTexture()); - break; - } - EquipmentComponent.UpdateEquipment(weapon); + switch (jewel.Stats.JewelTag) + { + case JewelTags.AeolicElement: + weapon.Stats.WeaponElement = ElementType.Aeolic; + weapon.Augment = new Augment(JewelTags.AeolicElement, new BasicAugment(), jewel.ItemName, jewel.Stats.WeaponAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.HydricElement: + weapon.Stats.WeaponElement = ElementType.Hydric; + weapon.Augment = new Augment(JewelTags.HydricElement, new BasicAugment(), jewel.ItemName, jewel.Stats.WeaponAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.SlowVTReduction: + weapon.Augment = new Augment(JewelTags.SlowVTReduction, new SlowVTReductionAugment(this), jewel.ItemName, jewel.Stats.WeaponAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.HastenVT: + weapon.Augment = new Augment(JewelTags.HastenVT, new HastenVTAugment(this), jewel.ItemName, jewel.Stats.WeaponAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.ReviveUserOnce: + weapon.Augment = new Augment(JewelTags.ReviveUserOnce, new RevivePlayerAugment(this), jewel.ItemName, jewel.Stats.WeaponAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.IncreaseHPRecovery: + weapon.Augment = new Augment(JewelTags.IncreaseHPRecovery, new HPRecoverySpeedAugment(this), jewel.ItemName, jewel.Stats.WeaponAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.LowerEXPGain: + weapon.Augment = new Augment(JewelTags.LowerEXPGain, new LowerEXPRateAugment(this), jewel.ItemName, jewel.Stats.WeaponAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.ItemRescue: + if (!_game.RescuedItems.TryAdd(weapon)) + break; + if (EquipmentComponent.IsItemEquipped(weapon)) + Unequip(weapon); + Inventory.Remove(weapon); + SfxDatabase.Instance.Play(SoundEffect.Transfer); + break; + case JewelTags.Glue: + if (!EquipmentComponent.IsItemEquipped(weapon)) + break; + weapon.Glued = true; + weapon.Augment = new Augment(JewelTags.Glue, new BasicAugment(), jewel.ItemName, jewel.Stats.WeaponAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.TelluricElement: + weapon.Stats.WeaponElement = ElementType.Telluric; + weapon.Augment = new Augment(JewelTags.TelluricElement, new BasicAugment(), jewel.ItemName, jewel.Stats.WeaponAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.AutoIdentifyAllItems: + weapon.Augment = new Augment(JewelTags.AutoIdentifyAllItems, new IdentifyAllItemsAugment(this), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.IncreaseAtkDefLuck: + weapon.IncreaseAttack(jewel.Stats.BonusAttack); + weapon.IncreaseDefense(jewel.Stats.BonusDefense); + weapon.IncreaseLuck(jewel.Stats.BonusLuck); + weapon.Augment = new Augment(JewelTags.IncreaseAtkDefLuck, new BasicAugment(), jewel.ItemName, jewel.Stats.WeaponAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.IncreaseLuck: + weapon.IncreaseLuck(25); + weapon.Augment = new Augment(JewelTags.IncreaseLuck, new BasicAugment(), jewel.ItemName, jewel.Stats.WeaponAugmentDescription, jewel.GetTexture()); + break; + } + EquipmentComponent.UpdateEquipment(weapon); } private void ApplyNewAugment(Armor armor, Jewel jewel) { - switch (jewel.Stats.JewelTag) - { - case JewelTags.AeolicElement: - armor.Stats.AeolicResistance += jewel.Stats.AeolicResistance; - armor.Augment = new Augment(JewelTags.AeolicElement, new BasicAugment(), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.HydricElement: - armor.Stats.HydricResistance += jewel.Stats.HydricResistance; - armor.Augment = new Augment(JewelTags.HydricElement, new BasicAugment(), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.SlowVTReduction: - armor.Augment = new Augment(JewelTags.SlowVTReduction, new SlowVTReductionAugment(this), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.HastenVT: - armor.Augment = new Augment(JewelTags.HastenVT, new HastenVTAugment(this), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.ReviveUserOnce: - armor.Augment = new Augment(JewelTags.ReviveUserOnce, new RevivePlayerAugment(this), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.IncreaseHPRecovery: - armor.Augment = new Augment(JewelTags.IncreaseHPRecovery, new HPRecoverySpeedAugment(this), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.LowerEXPGain: - armor.Augment = new Augment(JewelTags.LowerEXPGain, new LowerEXPRateAugment(this), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.ItemRescue: - if (!_game.RescuedItems.TryAdd(armor)) - break; - if (EquipmentComponent.IsItemEquipped(armor)) - Unequip(armor); - Inventory.Remove(armor); - SfxDatabase.Instance.Play(SoundEffect.Transfer); - break; - case JewelTags.Glue: - if (!EquipmentComponent.IsItemEquipped(armor)) - break; - armor.Glued = true; - armor.Augment = new Augment(JewelTags.Glue, new BasicAugment(), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.TelluricElement: - armor.Stats.TelluricResistance += jewel.Stats.TelluricResistance; - armor.Augment = new Augment(JewelTags.TelluricElement, new BasicAugment(), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.AutoIdentifyAllItems: - armor.Augment = new Augment(JewelTags.AutoIdentifyAllItems, new IdentifyAllItemsAugment(this), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.IncreaseAtkDefLuck: - armor.IncreaseAttack(jewel.Stats.BonusAttack); - armor.IncreaseDefense(jewel.Stats.BonusDefense); - armor.IncreaseLuck(jewel.Stats.BonusLuck); - armor.Augment = new Augment(JewelTags.IncreaseAtkDefLuck, new BasicAugment(), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.IncreaseLuck: - armor.IncreaseLuck(jewel.Stats.BonusLuck); - armor.Augment = new Augment(JewelTags.IncreaseLuck, new BasicAugment(), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); - break; - } - EquipmentComponent.UpdateEquipment(armor); + switch (jewel.Stats.JewelTag) + { + case JewelTags.AeolicElement: + armor.Stats.AeolicResistance += jewel.Stats.AeolicResistance; + armor.Augment = new Augment(JewelTags.AeolicElement, new BasicAugment(), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.HydricElement: + armor.Stats.HydricResistance += jewel.Stats.HydricResistance; + armor.Augment = new Augment(JewelTags.HydricElement, new BasicAugment(), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.SlowVTReduction: + armor.Augment = new Augment(JewelTags.SlowVTReduction, new SlowVTReductionAugment(this), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.HastenVT: + armor.Augment = new Augment(JewelTags.HastenVT, new HastenVTAugment(this), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.ReviveUserOnce: + armor.Augment = new Augment(JewelTags.ReviveUserOnce, new RevivePlayerAugment(this), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.IncreaseHPRecovery: + armor.Augment = new Augment(JewelTags.IncreaseHPRecovery, new HPRecoverySpeedAugment(this), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.LowerEXPGain: + armor.Augment = new Augment(JewelTags.LowerEXPGain, new LowerEXPRateAugment(this), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.ItemRescue: + if (!_game.RescuedItems.TryAdd(armor)) + break; + if (EquipmentComponent.IsItemEquipped(armor)) + Unequip(armor); + Inventory.Remove(armor); + SfxDatabase.Instance.Play(SoundEffect.Transfer); + break; + case JewelTags.Glue: + if (!EquipmentComponent.IsItemEquipped(armor)) + break; + armor.Glued = true; + armor.Augment = new Augment(JewelTags.Glue, new BasicAugment(), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.TelluricElement: + armor.Stats.TelluricResistance += jewel.Stats.TelluricResistance; + armor.Augment = new Augment(JewelTags.TelluricElement, new BasicAugment(), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.AutoIdentifyAllItems: + armor.Augment = new Augment(JewelTags.AutoIdentifyAllItems, new IdentifyAllItemsAugment(this), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.IncreaseAtkDefLuck: + armor.IncreaseAttack(jewel.Stats.BonusAttack); + armor.IncreaseDefense(jewel.Stats.BonusDefense); + armor.IncreaseLuck(jewel.Stats.BonusLuck); + armor.Augment = new Augment(JewelTags.IncreaseAtkDefLuck, new BasicAugment(), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.IncreaseLuck: + armor.IncreaseLuck(jewel.Stats.BonusLuck); + armor.Augment = new Augment(JewelTags.IncreaseLuck, new BasicAugment(), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); + break; + } + EquipmentComponent.UpdateEquipment(armor); } private void ApplyNewAugment(Accessory accessory, Jewel jewel) { - switch (jewel.Stats.JewelTag) - { - case JewelTags.AeolicElement: - accessory.Stats.AeolicResistance += jewel.Stats.AeolicResistance; - accessory.Augment = new Augment(JewelTags.AeolicElement, new BasicAugment(), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.HydricElement: - accessory.Stats.HydricResistance += jewel.Stats.HydricResistance; - accessory.Augment = new Augment(JewelTags.HydricElement, new BasicAugment(), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.SlowVTReduction: - accessory.Augment = new Augment(JewelTags.SlowVTReduction, new SlowVTReductionAugment(this), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.HastenVT: - accessory.Augment = new Augment(JewelTags.HastenVT, new HastenVTAugment(this), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.ReviveUserOnce: - accessory.Augment = new Augment(JewelTags.ReviveUserOnce, new RevivePlayerAugment(this), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.IncreaseHPRecovery: - accessory.Augment = new Augment(JewelTags.IncreaseHPRecovery, new HPRecoverySpeedAugment(this), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.LowerEXPGain: - accessory.Augment = new Augment(JewelTags.LowerEXPGain, new LowerEXPRateAugment(this), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.ItemRescue: - if (!_game.RescuedItems.TryAdd(accessory)) - break; - if (EquipmentComponent.IsItemEquipped(accessory)) - Unequip(accessory); - Inventory.Remove(accessory); - SfxDatabase.Instance.Play(SoundEffect.Transfer); - break; - case JewelTags.Glue: - if (!EquipmentComponent.IsItemEquipped(accessory)) - break; - accessory.Glued = true; - accessory.Augment = new Augment(JewelTags.Glue, new BasicAugment(), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.TelluricElement: - accessory.Stats.TelluricResistance += jewel.Stats.TelluricResistance; - accessory.Augment = new Augment(JewelTags.TelluricElement, new BasicAugment(), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.AutoIdentifyAllItems: - accessory.Augment = new Augment(JewelTags.AutoIdentifyAllItems, new IdentifyAllItemsAugment(this), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.IncreaseAtkDefLuck: - accessory.IncreaseAttack(jewel.Stats.BonusAttack); - accessory.IncreaseDefense(jewel.Stats.BonusDefense); - accessory.IncreaseLuck(jewel.Stats.BonusLuck); - accessory.Augment = new Augment(JewelTags.IncreaseAtkDefLuck, new BasicAugment(), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); - break; - case JewelTags.IncreaseLuck: - accessory.IncreaseLuck(jewel.Stats.BonusLuck); - accessory.Augment = new Augment(JewelTags.IncreaseLuck, new BasicAugment(), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); - break; - } - EquipmentComponent.UpdateEquipment(accessory); + switch (jewel.Stats.JewelTag) + { + case JewelTags.AeolicElement: + accessory.Stats.AeolicResistance += jewel.Stats.AeolicResistance; + accessory.Augment = new Augment(JewelTags.AeolicElement, new BasicAugment(), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.HydricElement: + accessory.Stats.HydricResistance += jewel.Stats.HydricResistance; + accessory.Augment = new Augment(JewelTags.HydricElement, new BasicAugment(), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.SlowVTReduction: + accessory.Augment = new Augment(JewelTags.SlowVTReduction, new SlowVTReductionAugment(this), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.HastenVT: + accessory.Augment = new Augment(JewelTags.HastenVT, new HastenVTAugment(this), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.ReviveUserOnce: + accessory.Augment = new Augment(JewelTags.ReviveUserOnce, new RevivePlayerAugment(this), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.IncreaseHPRecovery: + accessory.Augment = new Augment(JewelTags.IncreaseHPRecovery, new HPRecoverySpeedAugment(this), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.LowerEXPGain: + accessory.Augment = new Augment(JewelTags.LowerEXPGain, new LowerEXPRateAugment(this), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.ItemRescue: + if (!_game.RescuedItems.TryAdd(accessory)) + break; + if (EquipmentComponent.IsItemEquipped(accessory)) + Unequip(accessory); + Inventory.Remove(accessory); + SfxDatabase.Instance.Play(SoundEffect.Transfer); + break; + case JewelTags.Glue: + if (!EquipmentComponent.IsItemEquipped(accessory)) + break; + accessory.Glued = true; + accessory.Augment = new Augment(JewelTags.Glue, new BasicAugment(), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.TelluricElement: + accessory.Stats.TelluricResistance += jewel.Stats.TelluricResistance; + accessory.Augment = new Augment(JewelTags.TelluricElement, new BasicAugment(), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.AutoIdentifyAllItems: + accessory.Augment = new Augment(JewelTags.AutoIdentifyAllItems, new IdentifyAllItemsAugment(this), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.IncreaseAtkDefLuck: + accessory.IncreaseAttack(jewel.Stats.BonusAttack); + accessory.IncreaseDefense(jewel.Stats.BonusDefense); + accessory.IncreaseLuck(jewel.Stats.BonusLuck); + accessory.Augment = new Augment(JewelTags.IncreaseAtkDefLuck, new BasicAugment(), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); + break; + case JewelTags.IncreaseLuck: + accessory.IncreaseLuck(jewel.Stats.BonusLuck); + accessory.Augment = new Augment(JewelTags.IncreaseLuck, new BasicAugment(), jewel.ItemName, jewel.Stats.ArmorAugmentDescription, jewel.GetTexture()); + break; + } + EquipmentComponent.UpdateEquipment(accessory); } private void ProjectileCooldown() => _fired = false; private static Vector3 GlobalInputVector { - get - { - var rawInput = Godot.Input.GetVector(GameInputs.MoveLeft, GameInputs.MoveRight, GameInputs.MoveUp, GameInputs.MoveDown); - var input = new Vector3 - { - X = rawInput.X, - Z = rawInput.Y - }; - return input with { Y = 0f }; - } + get + { + var rawInput = Godot.Input.GetVector(GameInputs.MoveLeft, GameInputs.MoveRight, GameInputs.MoveUp, GameInputs.MoveDown); + var input = new Vector3 + { + X = rawInput.X, + Z = rawInput.Y + }; + return input with { Y = 0f }; + } } public void PlaySpellFX(SpellFXEnum spellEnum) { - SpellFXAnimations.Stop(); - SpellFXAnimations.Play(spellEnum.ToString()); + SpellFXAnimations.Stop(); + SpellFXAnimations.Play(spellEnum.ToString()); } private void OnLevelUp() { - BoostPlayerHPFromLevelUp(); + BoostPlayerHPFromLevelUp(); } private void OnLevelDown() { - LowerPlayerHPFromLevelDown(); + LowerPlayerHPFromLevelDown(); } private void BoostPlayerHPFromLevelUp() { - var rng = new RandomNumberGenerator(); - rng.Randomize(); - var hpIncrease = rng.RandiRange(3, 6); - HealthComponent.RaiseMaximumHP(hpIncrease); + var rng = new RandomNumberGenerator(); + rng.Randomize(); + var hpIncrease = rng.RandiRange(3, 6); + HealthComponent.RaiseMaximumHP(hpIncrease); } private void LowerPlayerHPFromLevelDown() { - var rng = new RandomNumberGenerator(); - rng.Randomize(); - var hpIncrease = rng.RandiRange(3, 6); - HealthComponent.LowerMaximumHP(hpIncrease); + var rng = new RandomNumberGenerator(); + rng.Randomize(); + var hpIncrease = rng.RandiRange(3, 6); + HealthComponent.LowerMaximumHP(hpIncrease); } public void EnactBriefImmunity() { - SfxDatabase.Instance.Play(SoundEffect.Buff); - BriefImmunity = true; - Barrier.FadeIn(); - _immunityTimer.Start(); + SfxDatabase.Instance.Play(SoundEffect.Buff); + BriefImmunity = true; + Barrier.FadeIn(); + _immunityTimer.Start(); } private static float LeftStrafeInputVector => Godot.Input.GetActionStrength(GameInputs.StrafeLeft); @@ -698,305 +699,305 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide private async void Attack() { - var weapon = EquipmentComponent.EquippedWeapon.Value as Weapon; - if (weapon.WeaponTag == WeaponTag.ElementalProjectile || weapon.WeaponTag == WeaponTag.KineticProjectile) - { - HandleProjectile(weapon); - return; - } - if (WeaponAnimations.IsPlaying()) - return; + var weapon = EquipmentComponent.EquippedWeapon.Value as Weapon; + if (weapon.WeaponTag == WeaponTag.ElementalProjectile || weapon.WeaponTag == WeaponTag.KineticProjectile) + { + HandleProjectile(weapon); + return; + } + if (WeaponAnimations.IsPlaying()) + return; - PlayAttackAnimation(); + PlayAttackAnimation(); - if (weapon.WeaponTag == WeaponTag.DegradeOnSwing) - _playerEffectService.Degrade(); - else if (weapon.WeaponTag == WeaponTag.SelfDamage) - _playerEffectService.TakeSelfDamage(5); + if (weapon.WeaponTag == WeaponTag.DegradeOnSwing) + _playerEffectService.Degrade(); + else if (weapon.WeaponTag == WeaponTag.SelfDamage) + _playerEffectService.TakeSelfDamage(5); } private void HandleProjectile(Weapon weapon) { - if (_fired) - return; + if (_fired) + return; - var ammo = EquipmentComponent.EquippedAmmo.Value as Ammo; - if (ammo.Count == null || ammo.Count?.Value <= 0) - return; + var ammo = EquipmentComponent.EquippedAmmo.Value as Ammo; + if (ammo.Count == null || ammo.Count?.Value <= 0) + return; - if (weapon.WeaponTag == WeaponTag.ElementalProjectile) - { - if (ammo.AmmoElement == ElementType.Aeolic) - _airReactorProjectileSystem.Fire(); - if (ammo.AmmoElement == ElementType.Igneous) - _fireReactorProjectileSystem.Fire(); - if (ammo.AmmoElement == ElementType.Hydric) - _waterReactorProjectileSystem.Fire(); - } + if (weapon.WeaponTag == WeaponTag.ElementalProjectile) + { + if (ammo.AmmoElement == ElementType.Aeolic) + _airReactorProjectileSystem.Fire(); + if (ammo.AmmoElement == ElementType.Igneous) + _fireReactorProjectileSystem.Fire(); + if (ammo.AmmoElement == ElementType.Hydric) + _waterReactorProjectileSystem.Fire(); + } - if (weapon.WeaponTag == WeaponTag.KineticProjectile) - { - PlayAttackAnimation(); - _kineticProjectileSystem.Fire(); - } + if (weapon.WeaponTag == WeaponTag.KineticProjectile) + { + PlayAttackAnimation(); + _kineticProjectileSystem.Fire(); + } - ammo.SetCount(ammo.Count.Value - 1); - EquipmentComponent.UpdateEquipment(ammo); - if (ammo.Count.Value <= 0) - { - EquipmentComponent.Unequip(ammo); - Inventory.Remove(ammo); - } + ammo.SetCount(ammo.Count.Value - 1); + EquipmentComponent.UpdateEquipment(ammo); + if (ammo.Count.Value <= 0) + { + EquipmentComponent.Unequip(ammo); + Inventory.Remove(ammo); + } - _fired = true; - _projectileCooldownTimer.Start(); + _fired = true; + _projectileCooldownTimer.Start(); } private void ThrowItem() { - var itemScene = GD.Load("res://src/items/throwable/ThrowableItem.tscn"); - var throwItem = itemScene.Instantiate(); - GetTree().Root.AddChildEx(throwItem); - throwItem.GlobalPosition = CurrentPosition; - throwItem.GlobalRotation = GlobalRotation; + var itemScene = GD.Load("res://src/items/throwable/ThrowableItem.tscn"); + var throwItem = itemScene.Instantiate(); + GetTree().Root.AddChildEx(throwItem); + throwItem.GlobalPosition = CurrentPosition; + throwItem.GlobalRotation = GlobalRotation; } private void PlayAttackAnimation() { - var weapon = (Weapon)EquipmentComponent.EquippedWeapon.Value; - SfxDatabase.Instance.Play(weapon.SoundEffect); - WeaponAnimations.SetSpeedScale((float)weapon.AttackSpeed); - var potentialAnimName = weapon.Stats.Name; - if (WeaponAnimations.HasAnimation(potentialAnimName)) - WeaponAnimations.Play(potentialAnimName); - else if (weapon.WeaponElement == ElementType.Aeolic) - WeaponAnimations.Play("Air Slash"); - else if (weapon.WeaponElement == ElementType.Hydric) - WeaponAnimations.Play("Water Slash"); - else if (weapon.WeaponElement == ElementType.Igneous) - WeaponAnimations.Play("Fire Slash"); - else if (weapon.WeaponElement == ElementType.Telluric) - WeaponAnimations.Play("Earth Slash"); - else if (string.IsNullOrWhiteSpace(potentialAnimName)) - WeaponAnimations.Play("Unarmed"); - else - WeaponAnimations.Play("Normal Slash"); + var weapon = (Weapon)EquipmentComponent.EquippedWeapon.Value; + SfxDatabase.Instance.Play(weapon.SoundEffect); + WeaponAnimations.SetSpeedScale((float)weapon.AttackSpeed); + var potentialAnimName = weapon.Stats.Name; + if (WeaponAnimations.HasAnimation(potentialAnimName)) + WeaponAnimations.Play(potentialAnimName); + else if (weapon.WeaponElement == ElementType.Aeolic) + WeaponAnimations.Play("Air Slash"); + else if (weapon.WeaponElement == ElementType.Hydric) + WeaponAnimations.Play("Water Slash"); + else if (weapon.WeaponElement == ElementType.Igneous) + WeaponAnimations.Play("Fire Slash"); + else if (weapon.WeaponElement == ElementType.Telluric) + WeaponAnimations.Play("Earth Slash"); + else if (string.IsNullOrWhiteSpace(potentialAnimName)) + WeaponAnimations.Play("Unarmed"); + else + WeaponAnimations.Play("Normal Slash"); } private void PlayerFXAnimations_AnimationFinished(StringName animName) { - if (animName == "death") - { - if (AutoRevive) - PlayerFXAnimations.PlayBackwards("revive"); - else - PlayerDied?.Invoke(); - } - if (animName == "revive") - { - Revive(); - } + if (animName == "death") + { + if (AutoRevive) + PlayerFXAnimations.PlayBackwards("revive"); + else + PlayerDied?.Invoke(); + } + if (animName == "revive") + { + Revive(); + } } private void Revive() { - HealthComponent.SetCurrentHealth(HealthComponent.MaximumHP.Value); - VTComponent.SetVT(VTComponent.MaximumVT.Value); - if (EquipmentComponent.EquippedAccessory.Value.Augment?.AugmentTag == JewelTags.ReviveUserOnce) - { - var itemToBreak = EquipmentComponent.EquippedAccessory.Value; - Unequip(EquipmentComponent.EquippedAccessory.Value); - Inventory.Remove(itemToBreak); - } - else if (EquipmentComponent.EquippedArmor.Value.Augment?.AugmentTag == JewelTags.ReviveUserOnce) - { - var itemToBreak = EquipmentComponent.EquippedArmor.Value; - Unequip(EquipmentComponent.EquippedArmor.Value); - Inventory.Remove(itemToBreak); - } - else if (EquipmentComponent.EquippedWeapon.Value.Augment?.AugmentTag == JewelTags.ReviveUserOnce) - { - var itemToBreak = EquipmentComponent.EquippedWeapon.Value; - Unequip(EquipmentComponent.EquippedWeapon.Value); - Inventory.Remove(itemToBreak); - } - else - PlayJumpScareAnimation(); + HealthComponent.SetCurrentHealth(HealthComponent.MaximumHP.Value); + VTComponent.SetVT(VTComponent.MaximumVT.Value); + if (EquipmentComponent.EquippedAccessory.Value.Augment?.AugmentTag == JewelTags.ReviveUserOnce) + { + var itemToBreak = EquipmentComponent.EquippedAccessory.Value; + Unequip(EquipmentComponent.EquippedAccessory.Value); + Inventory.Remove(itemToBreak); + } + else if (EquipmentComponent.EquippedArmor.Value.Augment?.AugmentTag == JewelTags.ReviveUserOnce) + { + var itemToBreak = EquipmentComponent.EquippedArmor.Value; + Unequip(EquipmentComponent.EquippedArmor.Value); + Inventory.Remove(itemToBreak); + } + else if (EquipmentComponent.EquippedWeapon.Value.Augment?.AugmentTag == JewelTags.ReviveUserOnce) + { + var itemToBreak = EquipmentComponent.EquippedWeapon.Value; + Unequip(EquipmentComponent.EquippedWeapon.Value); + Inventory.Remove(itemToBreak); + } + else + PlayJumpScareAnimation(); } private void InverseHPToAttackPowerSync(int obj) { - var weapon = (Weapon)EquipmentComponent.EquippedWeapon.Value; - if (weapon.WeaponTag == WeaponTag.InverseHPAttackPower) - { - var healthPercentage = (HealthComponent.CurrentHP.Value * 10) / HealthComponent.MaximumHP.Value; - weapon.SetAttack(10 - healthPercentage); - EquipmentComponent.Equip(weapon); - } + var weapon = (Weapon)EquipmentComponent.EquippedWeapon.Value; + if (weapon.WeaponTag == WeaponTag.InverseHPAttackPower) + { + var healthPercentage = (HealthComponent.CurrentHP.Value * 10) / HealthComponent.MaximumHP.Value; + weapon.SetAttack(10 - healthPercentage); + EquipmentComponent.Equip(weapon); + } } private void OnExitTree() { - PlayerLogic.Stop(); - PlayerBinding.Dispose(); - Hitbox.AreaEntered -= Hitbox_AreaEntered; - CollisionDetector.AreaEntered -= CollisionDetector_AreaEntered; - HealthTimer.Timeout -= OnHealthTimerTimeout; - HealthComponent.CurrentHP.Changed -= InverseHPToAttackPowerSync; - HealthComponent.HealthReachedZero -= Die; - ExperiencePointsComponent.PlayerLevelUp -= OnLevelUp; - PlayerFXAnimations.AnimationFinished -= PlayerFXAnimations_AnimationFinished; + PlayerLogic.Stop(); + PlayerBinding.Dispose(); + Hitbox.AreaEntered -= Hitbox_AreaEntered; + CollisionDetector.AreaEntered -= CollisionDetector_AreaEntered; + HealthTimer.Timeout -= OnHealthTimerTimeout; + HealthComponent.CurrentHP.Changed -= InverseHPToAttackPowerSync; + HealthComponent.HealthReachedZero -= Die; + ExperiencePointsComponent.PlayerLevelUp -= OnLevelUp; + PlayerFXAnimations.AnimationFinished -= PlayerFXAnimations_AnimationFinished; } private void Move(float delta) { - var rawInput = GlobalInputVector; - var strafeLeftInput = LeftStrafeInputVector; - var strafeRightInput = RightStrafeInputVector; + var rawInput = GlobalInputVector; + var strafeLeftInput = LeftStrafeInputVector; + var strafeRightInput = RightStrafeInputVector; - var transform = Transform; - transform.Basis = new Basis(Vector3.Up, Settings.RotationSpeed * -rawInput.X * delta) * transform.Basis; - var moveDirection = new Vector3(strafeRightInput - strafeLeftInput, 0, rawInput.Z).Normalized(); + var transform = Transform; + transform.Basis = new Basis(Vector3.Up, Settings.RotationSpeed * -rawInput.X * delta) * transform.Basis; + var moveDirection = new Vector3(strafeRightInput - strafeLeftInput, 0, rawInput.Z).Normalized(); - if (moveDirection.Length() > 0.25f) - { - var rng = new RandomNumberGenerator(); - rng.Randomize(); - WalkSFX.PitchScale = rng.RandfRange(0.5f, 1.5f); - if (!WalkSFX.Playing) - WalkSFX.Play(); - } - else if (WalkSFX.Playing) - WalkSFX.Stop(); + if (moveDirection.Length() > 0.25f) + { + var rng = new RandomNumberGenerator(); + rng.Randomize(); + WalkSFX.PitchScale = rng.RandfRange(0.5f, 1.5f); + if (!WalkSFX.Playing) + WalkSFX.Play(); + } + else if (WalkSFX.Playing) + WalkSFX.Stop(); - var velocity = (Basis * moveDirection * Settings.MoveSpeed * Settings.Acceleration); - if (_debugSprint) - velocity *= 2; - _knockbackStrength *= 0.9f; - Transform = Transform with { Basis = transform.Basis }; - Velocity = velocity + (_knockbackDirection * _knockbackStrength); + var velocity = (Basis * moveDirection * Settings.MoveSpeed * Settings.Acceleration); + if (_debugSprint) + velocity *= 2; + _knockbackStrength *= 0.9f; + Transform = Transform with { Basis = transform.Basis }; + Velocity = velocity + (_knockbackDirection * _knockbackStrength); - MoveAndSlide(); + MoveAndSlide(); } private void OnPlayerPositionUpdated(Vector3 globalPosition) => GlobalPosition = globalPosition; private void OnHealthTimerTimeout() { - if (VTComponent.CurrentVT.Value > 0) - { - if (((Accessory)EquipmentComponent.EquippedAccessory.Value).AccessoryTag == AccessoryTag.HalfVTConsumption) - _healthTimerActive = !_healthTimerActive; + if (VTComponent.CurrentVT.Value > 0) + { + if (((Accessory)EquipmentComponent.EquippedAccessory.Value).AccessoryTag == AccessoryTag.HalfVTConsumption) + _healthTimerActive = !_healthTimerActive; - HealthComponent.Heal(HealthTimerHPRate); + HealthComponent.Heal(HealthTimerHPRate); - if (_healthTimerActive) - VTComponent.Reduce(1); - } - else - HealthComponent.Damage(1, ElementType.None); + if (_healthTimerActive) + VTComponent.Reduce(1); + } + else + HealthComponent.Damage(1, ElementType.None); } private void Hitbox_AreaEntered(Area3D area) { - var target = area.GetOwner(); - if (target is IEnemy enemy) - HitEnemy(enemy); + var target = area.GetOwner(); + if (target is IEnemy enemy) + HitEnemy(enemy); } private void HitEnemy(IEnemy enemy) { - var weapon = EquipmentComponent.EquippedWeapon.Value as Weapon; - var isCriticalHit = BattleExtensions.IsCriticalHit(TotalLuck); - var totalDamage = TotalAttack; + var weapon = EquipmentComponent.EquippedWeapon.Value as Weapon; + var isCriticalHit = BattleExtensions.IsCriticalHit(TotalLuck); + var totalDamage = TotalAttack; - if (SigilComponent.Sigil.ElementType == weapon.WeaponElement) - totalDamage = Mathf.RoundToInt(totalDamage * 1.15f); + if (SigilComponent.Sigil.ElementType == weapon.WeaponElement) + totalDamage = Mathf.RoundToInt(totalDamage * 1.15f); - totalDamage = Mathf.RoundToInt(totalDamage * SigilComponent.Sigil.AttackModifier); + totalDamage = Mathf.RoundToInt(totalDamage * SigilComponent.Sigil.AttackModifier); - if (isCriticalHit) - { - totalDamage += (int)(totalDamage * 0.5f); - SfxDatabase.Instance.Play(SoundEffect.Crit); - } + if (isCriticalHit) + { + totalDamage += (int)(totalDamage * 0.5f); + SfxDatabase.Instance.Play(SoundEffect.Crit); + } - var baseAttack = new AttackData(totalDamage, weapon.WeaponElement, weapon.WeaponTag == WeaponTag.IgnoreDefense, weapon.WeaponTag == WeaponTag.IgnoreAffinity); + var baseAttack = new AttackData(totalDamage, weapon.WeaponElement, weapon.WeaponTag == WeaponTag.IgnoreDefense, weapon.WeaponTag == WeaponTag.IgnoreAffinity); - var damageDealt = DamageCalculator.CalculateDamage(baseAttack, enemy.DefenseComponent.CurrentDefense.Value, enemy.ElementalResistanceSet); - enemy.HealthComponent.Damage(damageDealt, weapon.WeaponElement); + var damageDealt = DamageCalculator.CalculateDamage(baseAttack, enemy.DefenseComponent.CurrentDefense.Value, enemy.ElementalResistanceSet); + enemy.HealthComponent.Damage(damageDealt, weapon.WeaponElement); - if (weapon.WeaponTag == WeaponTag.Knockback && enemy is IKnockbackable knockbackable) - knockbackable.Knockback(0.3f, -CurrentBasis.Z.Normalized()); - if (weapon.WeaponTag == WeaponTag.SelfDamage) - _playerEffectService.TakeSelfDamage(weapon.Stats.SelfDamage); - if (weapon.WeaponTag == WeaponTag.Instakill) - _playerEffectService.Instakill(enemy); - if (weapon.WeaponTag == WeaponTag.RustChanceSelfAndEnemy) - { - var rustChance = 0.15f; - var rng = new RandomNumberGenerator(); - rng.Randomize(); - if (rng.Randf() <= rustChance) - { - if (rng.Randf() >= 0.5f && ((Accessory)EquipmentComponent.EquippedAccessory.Value).AccessoryTag != AccessoryTag.StatusEffectImmunity) - StatusEffectComponent.Rust.OnNext(true); - else - enemy.StatusEffectComponent.Rust.OnNext(true); - } - } + if (weapon.WeaponTag == WeaponTag.Knockback && enemy is IKnockbackable knockbackable) + knockbackable.Knockback(0.3f, -CurrentBasis.Z.Normalized()); + if (weapon.WeaponTag == WeaponTag.SelfDamage) + _playerEffectService.TakeSelfDamage(weapon.Stats.SelfDamage); + if (weapon.WeaponTag == WeaponTag.Instakill) + _playerEffectService.Instakill(enemy); + if (weapon.WeaponTag == WeaponTag.RustChanceSelfAndEnemy) + { + var rustChance = 0.15f; + var rng = new RandomNumberGenerator(); + rng.Randomize(); + if (rng.Randf() <= rustChance) + { + if (rng.Randf() >= 0.5f && ((Accessory)EquipmentComponent.EquippedAccessory.Value).AccessoryTag != AccessoryTag.StatusEffectImmunity) + StatusEffectComponent.Rust.OnNext(true); + else + enemy.StatusEffectComponent.Rust.OnNext(true); + } + } } private async void CollisionDetector_AreaEntered(Area3D area) { - if (area.GetParent() is IBaseInventoryItem inventoryItem) - { - var isAdded = Inventory.PickUpItem(inventoryItem); - if (isAdded) - ((Node3D)inventoryItem).QueueFree(); - } - if (area.GetParent() is DroppedItem droppedItem) - { - var isAdded = Inventory.PickUpItem(droppedItem.Item); - if (isAdded) - droppedItem.QueueFree(); - } - if (area.GetParent() is ThrownItem thrownItem) - { - var isAdded = Inventory.PickUpItem(thrownItem.ItemThatIsThrown); - if (isAdded) - thrownItem.QueueFree(); - } - if (area.GetParent() is Restorative restorative) - { - await ToSignal(GetTree().CreateTimer(0.2f), "timeout"); - VTComponent.Restore(restorative.RestoreAmount); - SfxDatabase.Instance.Play(SoundEffect.HealVT); - restorative.QueueFree(); - } + if (area.GetParent() is IBaseInventoryItem inventoryItem) + { + var isAdded = Inventory.PickUpItem(inventoryItem); + if (isAdded) + ((Node3D)inventoryItem).QueueFree(); + } + if (area.GetParent() is DroppedItem droppedItem) + { + var isAdded = Inventory.PickUpItem(droppedItem.Item); + if (isAdded) + droppedItem.QueueFree(); + } + if (area.GetParent() is ThrownItem thrownItem) + { + var isAdded = Inventory.PickUpItem(thrownItem.ItemThatIsThrown); + if (isAdded) + thrownItem.QueueFree(); + } + if (area.GetParent() is Restorative restorative) + { + await ToSignal(GetTree().CreateTimer(0.2f), "timeout"); + VTComponent.Restore(restorative.RestoreAmount); + SfxDatabase.Instance.Play(SoundEffect.HealVT); + restorative.QueueFree(); + } } private bool PlayerIsHittingGeometry() { - var collisions = WallCheck.GetCollidingBodies(); - return collisions.Count > 0; + var collisions = WallCheck.GetCollidingBodies(); + return collisions.Count > 0; } private void WallCheck_BodyEntered(Node body) { - GD.Print("Hit wall"); - WeaponAnimations.Stop(); + GD.Print("Hit wall"); + WeaponAnimations.Stop(); } private void Inventory_InventoryChanged() { - if (AutoIdentifyItems) - { - foreach (var item in Inventory.Items.ToList()) - { - if (item.ItemTag == ItemTag.MysteryItem) - IdentifyItem(item); - } - } + if (AutoIdentifyItems) + { + foreach (var item in Inventory.Items.ToList()) + { + if (item.ItemTag == ItemTag.MysteryItem) + IdentifyItem(item); + } + } } } diff --git a/Zennysoft.Game.Ma/src/ui/Affinity Icons/None.png b/Zennysoft.Game.Ma/src/ui/Affinity Icons/None.png new file mode 100644 index 0000000000000000000000000000000000000000..983801f713ad4c94ae50df7a8e5fb6578e1a912b GIT binary patch literal 880 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K5893O0R7}x|G$6%U;1OBOz`!jG!i)^F=14Fw zFe`bwIEGZrd3(i>@qhxufenVdJ02X^Z#CiIMHk2QeLJuJY*_NYl;J}kqr;3*G#UaU cF9dF|{`$_G%g@o^49r3dp00i_>zopr08}{oQUCw| literal 0 HcmV?d00001 diff --git a/Zennysoft.Game.Ma/src/ui/Affinity Icons/None.png.import b/Zennysoft.Game.Ma/src/ui/Affinity Icons/None.png.import new file mode 100644 index 00000000..ccc4e5bd --- /dev/null +++ b/Zennysoft.Game.Ma/src/ui/Affinity Icons/None.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dhm6n6h40rm6s" +path.bptc="res://.godot/imported/None.png-a5cee11f73c49293b07fad00a9a44197.bptc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} + +[deps] + +source_file="res://src/ui/Affinity Icons/None.png" +dest_files=["res://.godot/imported/None.png-a5cee11f73c49293b07fad00a9a44197.bptc.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=true +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/Zennysoft.Game.Ma/src/ui/in_game_ui/InGameUI.cs b/Zennysoft.Game.Ma/src/ui/in_game_ui/InGameUI.cs index 6e8e9d31..5a8b943a 100644 --- a/Zennysoft.Game.Ma/src/ui/in_game_ui/InGameUI.cs +++ b/Zennysoft.Game.Ma/src/ui/in_game_ui/InGameUI.cs @@ -9,6 +9,8 @@ namespace Zennysoft.Game.Ma; public interface IInGameUI : IControl { void CloseInventory(); + + public void SetAffinity(ElementType elementType); } [Meta(typeof(IAutoNode))] @@ -30,6 +32,18 @@ public partial class InGameUI : Control, IInGameUI [Node] public DebugInfo DebugInfo { get; set; } = default!; + [Node] public TextureRect EolicImg { get; set; } = default!; + + [Node] public TextureRect FerrumImg { get; set; } = default!; + + [Node] public TextureRect HydricImg { get; set; } = default!; + + [Node] public TextureRect IgneousImg { get; set; } = default!; + + [Node] public TextureRect SanktaImg { get; set; } = default!; + + [Node] public TextureRect TelluricImg { get; set; } = default!; + [Dependency] private IGameRepo _gameRepo => this.DependOn(); public IInGameUILogic InGameUILogic { get; set; } = default!; @@ -38,29 +52,61 @@ public partial class InGameUI : Control, IInGameUI public void Setup() { - InGameUILogic = new InGameUILogic(); - InGameUILogic.Set(_gameRepo); + InGameUILogic = new InGameUILogic(); + InGameUILogic.Set(_gameRepo); } public void OnResolved() { - InGameUILogicBinding = InGameUILogic.Bind(); + InGameUILogicBinding = InGameUILogic.Bind(); - InGameUILogicBinding - .Handle((in InGameUILogic.Output.AnnounceMessageOnMainScreen output) => { InventoryMessageUI.DisplayMessage(output.Message); }) - .Handle((in InGameUILogic.Output.AnnounceMessageInInventory output) => { }) - .Handle((in InGameUILogic.Output.RemoveItemFromInventory output) => { }) - .Handle((in InGameUILogic.Output.ShowInventory _) => { InventoryMenu.Show(); InventoryMenu.SetProcessInput(true); }) - .Handle((in InGameUILogic.Output.HideInventory _) => { CloseInventory(); }); + InGameUILogicBinding + .Handle((in InGameUILogic.Output.AnnounceMessageOnMainScreen output) => { InventoryMessageUI.DisplayMessage(output.Message); }) + .Handle((in InGameUILogic.Output.AnnounceMessageInInventory output) => { }) + .Handle((in InGameUILogic.Output.RemoveItemFromInventory output) => { }) + .Handle((in InGameUILogic.Output.ShowInventory _) => { InventoryMenu.Show(); InventoryMenu.SetProcessInput(true); }) + .Handle((in InGameUILogic.Output.HideInventory _) => { CloseInventory(); }); - DebugInfo.Visible = DebugMenu.DebugOverlayVisible; + DebugInfo.Visible = DebugMenu.DebugOverlayVisible; - InGameUILogic.Start(); + InGameUILogic.Start(); + } + + public void SetAffinity(ElementType elementType) + { + EolicImg.Visible = false; + FerrumImg.Visible = false; + HydricImg.Visible = false; + IgneousImg.Visible = false; + SanktaImg.Visible = false; + TelluricImg.Visible = false; + + switch (elementType) + { + case ElementType.Aeolic: + EolicImg.Visible = true; + break; + case ElementType.Hydric: + HydricImg.Visible = true; + break; + case ElementType.Ferrum: + FerrumImg.Visible = true; + break; + case ElementType.Igneous: + IgneousImg.Visible = true; + break; + case ElementType.Telluric: + TelluricImg.Visible = true; + break; + case ElementType.Curse: + SanktaImg.Visible = true; + break; + } } public void CloseInventory() { - InventoryMenu.Hide(); - InventoryMenu.SetProcessInput(false); + InventoryMenu.Hide(); + InventoryMenu.SetProcessInput(false); } } diff --git a/Zennysoft.Game.Ma/src/ui/in_game_ui/InGameUI.tscn b/Zennysoft.Game.Ma/src/ui/in_game_ui/InGameUI.tscn index 8f164cd8..383b16d3 100644 --- a/Zennysoft.Game.Ma/src/ui/in_game_ui/InGameUI.tscn +++ b/Zennysoft.Game.Ma/src/ui/in_game_ui/InGameUI.tscn @@ -1,10 +1,11 @@ -[gd_scene load_steps=14 format=3 uid="uid://b8tclvmc7j7dl"] +[gd_scene load_steps=22 format=3 uid="uid://b8tclvmc7j7dl"] [ext_resource type="Script" uid="uid://dlq2mkhl4pe7a" path="res://src/ui/in_game_ui/InGameUI.cs" id="1_sc13i"] [ext_resource type="Texture2D" uid="uid://cijojm8gcjime" path="res://src/ui/rendered_assets/No Signal Screen.png" id="2_1e3dg"] [ext_resource type="PackedScene" uid="uid://bwbofurcvf3yh" path="res://src/minimap/Minimap.tscn" id="2_6sfje"] [ext_resource type="PackedScene" uid="uid://0eo47mewhlit" path="res://src/debug_info/DebugInfo.tscn" id="2_f0tui"] [ext_resource type="PackedScene" uid="uid://dxl8il8f13c2x" path="res://src/ui/player_ui/PlayerInfoUI.tscn" id="4_46s5l"] +[ext_resource type="Texture2D" uid="uid://b8fio74j577pj" path="res://src/ui/Affinity Icons/EOLIC.png" id="4_rqc8e"] [ext_resource type="PackedScene" uid="uid://bea2waybmgd6u" path="res://src/ui/teleport_prompt/UseTeleportPrompt.tscn" id="5_h1hgq"] [ext_resource type="PackedScene" uid="uid://x0f1ol50nnp3" path="res://src/ui/in_game_ui/InventoryMessageUI.tscn" id="6_y26qy"] [ext_resource type="PackedScene" uid="uid://8f3dk16nj0dn" path="res://src/menu/DebugMenu.tscn" id="7_llomk"] @@ -12,9 +13,17 @@ [ext_resource type="PackedScene" uid="uid://cbxw70qa7gifp" path="res://src/ui/inventory_menu/InventoryMenu.tscn" id="9_ur8ag"] [ext_resource type="PackedScene" uid="uid://dwa7o6hkkwjg1" path="res://src/ui/inventory_menu/ItemRescueMenu.tscn" id="10_higkc"] [ext_resource type="Texture2D" uid="uid://chqlapqsi0ga0" path="res://src/ui/Minimap Special Displays/maze floor.png" id="11_f0tui"] +[ext_resource type="Texture2D" uid="uid://dhm6n6h40rm6s" path="res://src/ui/Affinity Icons/None.png" id="11_k4h7r"] +[ext_resource type="Texture2D" uid="uid://bm877afagx7rv" path="res://src/ui/Affinity Icons/FERRUM.png" id="12_2of7j"] +[ext_resource type="Texture2D" uid="uid://b6wnipbpck5ea" path="res://src/ui/Affinity Icons/HYDRIC.png" id="13_4d2sw"] +[ext_resource type="Texture2D" uid="uid://buaj462dmtl6u" path="res://src/ui/Affinity Icons/IGNEOUS.png" id="14_4f3xk"] +[ext_resource type="Texture2D" uid="uid://ddlmguje21x8k" path="res://src/ui/Affinity Icons/SANKTA.png" id="15_rilgc"] +[ext_resource type="Texture2D" uid="uid://cr4g3ippdu2sk" path="res://src/ui/Affinity Icons/TELERIC.png" id="16_k3082"] [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_higkc"] +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_1e3dg"] + [node name="InGameUI" type="Control"] process_mode = 3 layout_mode = 3 @@ -25,7 +34,7 @@ grow_horizontal = 2 grow_vertical = 2 script = ExtResource("1_sc13i") -[node name="TextureRect" type="TextureRect" parent="."] +[node name="NoSignal" type="TextureRect" parent="."] layout_mode = 2 offset_left = 1498.0 offset_top = 346.0 @@ -117,9 +126,9 @@ theme_override_constants/margin_left = 15 theme_override_constants/margin_top = 0 [node name="MinimapZone" type="Panel" parent="Sidebar Container/MinimapContainer"] -visible = false layout_mode = 2 size_flags_vertical = 3 +theme_override_styles/panel = SubResource("StyleBoxEmpty_1e3dg") [node name="MiniMap" parent="Sidebar Container/MinimapContainer/MinimapZone" instance=ExtResource("2_6sfje")] unique_name_in_owner = true @@ -135,6 +144,57 @@ offset_top = 354.0 offset_right = 423.0 offset_bottom = 620.0 +[node name="Sigil" type="Control" parent="Sidebar Container"] +layout_mode = 2 + +[node name="SigilContainer" type="MarginContainer" parent="Sidebar Container/Sigil"] +layout_mode = 2 +offset_left = 330.0 +offset_top = 207.0 +offset_right = 586.0 +offset_bottom = 463.0 +scale = Vector2(0.4, 0.4) + +[node name="NoneImg" type="TextureRect" parent="Sidebar Container/Sigil/SigilContainer"] +layout_mode = 2 +texture = ExtResource("11_k4h7r") + +[node name="EolicImg" type="TextureRect" parent="Sidebar Container/Sigil/SigilContainer"] +unique_name_in_owner = true +visible = false +layout_mode = 2 +texture = ExtResource("4_rqc8e") + +[node name="FerrumImg" type="TextureRect" parent="Sidebar Container/Sigil/SigilContainer"] +unique_name_in_owner = true +visible = false +layout_mode = 2 +texture = ExtResource("12_2of7j") + +[node name="HydricImg" type="TextureRect" parent="Sidebar Container/Sigil/SigilContainer"] +unique_name_in_owner = true +visible = false +layout_mode = 2 +texture = ExtResource("13_4d2sw") + +[node name="IgneousImg" type="TextureRect" parent="Sidebar Container/Sigil/SigilContainer"] +unique_name_in_owner = true +visible = false +layout_mode = 2 +texture = ExtResource("14_4f3xk") + +[node name="SanktaImg" type="TextureRect" parent="Sidebar Container/Sigil/SigilContainer"] +unique_name_in_owner = true +visible = false +layout_mode = 2 +texture = ExtResource("15_rilgc") + +[node name="TelluricImg" type="TextureRect" parent="Sidebar Container/Sigil/SigilContainer"] +unique_name_in_owner = true +visible = false +layout_mode = 2 +texture = ExtResource("16_k3082") + [node name="Sidebar Texture" type="TextureRect" parent="Sidebar Container"] layout_mode = 2 texture = ExtResource("9_higkc") @@ -148,13 +208,3 @@ theme_override_constants/margin_top = 200 unique_name_in_owner = true layout_mode = 2 size_flags_vertical = 3 - -[node name="SigilContainer" type="MarginContainer" parent="Sidebar Container"] -layout_mode = 2 -theme_override_constants/margin_left = 50 -theme_override_constants/margin_top = 800 -theme_override_constants/margin_right = 175 -theme_override_constants/margin_bottom = 50 - -[node name="ReferenceRect" type="ReferenceRect" parent="Sidebar Container/SigilContainer"] -layout_mode = 2 diff --git a/Zennysoft.Game.Ma/src/ui/player_ui/PlayerInfoUI.tscn b/Zennysoft.Game.Ma/src/ui/player_ui/PlayerInfoUI.tscn index e7037b98..fb691634 100644 --- a/Zennysoft.Game.Ma/src/ui/player_ui/PlayerInfoUI.tscn +++ b/Zennysoft.Game.Ma/src/ui/player_ui/PlayerInfoUI.tscn @@ -85,6 +85,7 @@ layout_mode = 2 [node name="HPProgressBar" type="ProgressBar" parent="AspectRatio/PlayerInfo/HBoxContainer/VBox/HP Box/CenterContainer"] unique_name_in_owner = true +visible = false custom_minimum_size = Vector2(150, 12) layout_mode = 2 size_flags_horizontal = 3 @@ -118,6 +119,7 @@ layout_mode = 2 [node name="VTProgressBar" type="ProgressBar" parent="AspectRatio/PlayerInfo/HBoxContainer/VBox/VT Box/CenterContainer"] unique_name_in_owner = true +visible = false custom_minimum_size = Vector2(150, 12) layout_mode = 2 size_flags_vertical = 4 @@ -144,7 +146,6 @@ custom_minimum_size = Vector2(60, 0) layout_mode = 2 text = "1" label_settings = ExtResource("3_xdjh1") -horizontal_alignment = 1 [node name="EXP Box" type="HBoxContainer" parent="AspectRatio/PlayerInfo/HBoxContainer/VBox"] layout_mode = 2