Change affinity

This commit is contained in:
2025-01-19 12:59:24 -08:00
parent f3a51de28a
commit 4910ff7770
20 changed files with 272 additions and 89 deletions

View File

@@ -4,16 +4,16 @@
<EnableDynamicLoading>true</EnableDynamicLoading> <EnableDynamicLoading>true</EnableDynamicLoading>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Chickensoft.AutoInject" Version="2.3.0" /> <PackageReference Include="Chickensoft.AutoInject" Version="2.5.0" />
<PackageReference Include="Chickensoft.GodotNodeInterfaces" Version="2.2.23" /> <PackageReference Include="Chickensoft.GodotNodeInterfaces" Version="2.4.0" />
<PackageReference Include="Chickensoft.Introspection.Generator" Version="1.7.0" /> <PackageReference Include="Chickensoft.Introspection.Generator" Version="2.2.0" />
<PackageReference Include="Chickensoft.LogicBlocks" Version="5.6.0" /> <PackageReference Include="Chickensoft.LogicBlocks" Version="5.15.0" />
<PackageReference Include="Chickensoft.LogicBlocks.DiagramGenerator" Version="5.6.0" /> <PackageReference Include="Chickensoft.LogicBlocks.DiagramGenerator" Version="5.15.0" />
<PackageReference Include="Chickensoft.SaveFileBuilder" Version="1.1.0" /> <PackageReference Include="Chickensoft.SaveFileBuilder" Version="1.1.0" />
<PackageReference Include="GodotSharp.SourceGenerators" Version="2.4.0" /> <PackageReference Include="GodotSharp.SourceGenerators" Version="2.5.0" />
<PackageReference Include="SSH.NET" Version="2024.1.0" /> <PackageReference Include="SSH.NET" Version="2024.2.0" />
<PackageReference Include="System.IO.Abstractions" Version="21.0.29" /> <PackageReference Include="System.IO.Abstractions" Version="21.2.1" />
<PackageReference Include="Zeroconf" Version="3.6.11" /> <PackageReference Include="Zeroconf" Version="3.7.16" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="src\items\weapons\models\" /> <Folder Include="src\items\weapons\models\" />

View File

@@ -4,8 +4,10 @@ namespace GameJamDungeon;
using Chickensoft.AutoInject; using Chickensoft.AutoInject;
using Chickensoft.GodotNodeInterfaces; using Chickensoft.GodotNodeInterfaces;
using Chickensoft.Introspection; using Chickensoft.Introspection;
using Chickensoft.SaveFileBuilder;
using GameJamDungeon.src.item_rescue; using GameJamDungeon.src.item_rescue;
using Godot; using Godot;
using System;
public interface IGame : IProvide<IGameRepo>, IProvide<IGameEventDepot>, IProvide<IGame>, INode3D public interface IGame : IProvide<IGameRepo>, IProvide<IGameEventDepot>, IProvide<IGame>, INode3D
{ {
@@ -24,6 +26,8 @@ public interface IGame : IProvide<IGameRepo>, IProvide<IGameEventDepot>, IProvid
public void HealVT(int amountToRaise); public void HealVT(int amountToRaise);
public void RaiseVT(int amountToRaise); public void RaiseVT(int amountToRaise);
public void DoubleEXP(TimeSpan lengthOfEffect);
} }
[Meta(typeof(IAutoNode))] [Meta(typeof(IAutoNode))]
@@ -66,6 +70,8 @@ public partial class Game : Node3D, IGame
[Node] public IPauseMenu PauseMenu { get; set; } = default!; [Node] public IPauseMenu PauseMenu { get; set; } = default!;
[Node] public InGameAudio InGameAudio { get; set; } = default!; [Node] public InGameAudio InGameAudio { get; set; } = default!;
[Node] public Timer DoubleEXPTimer { get; set; } = default!;
#endregion #endregion
public RescuedItemDatabase RescuedItems { get; set; } = default!; public RescuedItemDatabase RescuedItems { get; set; } = default!;
@@ -138,7 +144,7 @@ public partial class Game : Node3D, IGame
GameRepo.PlayerData.Inventory.PickedUpItem += Inventory_PickedUpItem; GameRepo.PlayerData.Inventory.PickedUpItem += Inventory_PickedUpItem;
GameRepo.PlayerData.Inventory.RaiseStatRequest += Inventory_RaiseStatRequest; GameRepo.PlayerData.Inventory.RaiseStatRequest += Inventory_RaiseStatRequest;
FloorClearMenu.GoToNextFloor += FloorClearMenu_GoToNextFloor; FloorClearMenu.GoToNextFloor += FloorClearMenu_GoToNextFloor;
FloorClearMenu.ReturnToHubWorld += ReturnToHubWorld; FloorClearMenu.SaveAndExit += FloorClearMenu_SaveAndExit;
FloorClearMenu.TransitionCompleted += FloorClearMenu_TransitionCompleted; FloorClearMenu.TransitionCompleted += FloorClearMenu_TransitionCompleted;
Player.InventoryButtonPressed += Player_InventoryButtonPressed; Player.InventoryButtonPressed += Player_InventoryButtonPressed;
@@ -147,11 +153,13 @@ public partial class Game : Node3D, IGame
GameEventDepot.EnemyDefeated += OnEnemyDefeated; GameEventDepot.EnemyDefeated += OnEnemyDefeated;
GameEventDepot.RestorativePickedUp += GameEventDepot_RestorativePickedUp; GameEventDepot.RestorativePickedUp += GameEventDepot_RestorativePickedUp;
DoubleEXPTimer.Timeout += DoubleEXPTimer_Timeout;
} }
private void Inventory_PickedUpItem(string pickedUpItemName) private void Inventory_PickedUpItem(string pickedUpItemName)
{ {
InGameUI.PlayerInfoUI.DisplayPickedUpMessage(pickedUpItemName); InGameUI.PlayerInfoUI.DisplayMessage($"{pickedUpItemName} picked up.");
} }
public void DropItem(IInventoryItem item) public void DropItem(IInventoryItem item)
@@ -174,7 +182,7 @@ public partial class Game : Node3D, IGame
private void OnEnemyDefeated(Vector3 vector, EnemyStatResource resource) private void OnEnemyDefeated(Vector3 vector, EnemyStatResource resource)
{ {
GameRepo.PlayerData.SetCurrentExp(GameRepo.PlayerData.CurrentExp.Value + resource.ExpFromDefeat); GameRepo.PlayerData.SetCurrentExp(GameRepo.PlayerData.CurrentExp.Value + (resource.ExpFromDefeat * GameRepo.EXPRate));
DropRestorative(vector); DropRestorative(vector);
} }
@@ -234,15 +242,15 @@ public partial class Game : Node3D, IGame
GameLogic.Input(new GameLogic.Input.GoToNextFloor()); GameLogic.Input(new GameLogic.Input.GoToNextFloor());
} }
private void ReturnToHubWorld() private void FloorClearMenu_SaveAndExit()
{ {
// Implement a return to overworld state // Save
// Don't carry over stats/equipment but we'll need to persist the overworld state
// Which may include rescued items and npc/questline state
GameLogic.Input(new GameLogic.Input.HideFloorClearMenu()); GameLogic.Input(new GameLogic.Input.HideFloorClearMenu());
GameLogic.Input(new GameLogic.Input.SaveGame());
} }
private void GameEventDepot_RestorativePickedUp(Restorative obj) => GameRepo.PlayerData.SetCurrentVT(GameRepo.PlayerData.CurrentVT.Value + obj.VTRestoreAmount); private void GameEventDepot_RestorativePickedUp(Restorative obj)
=> GameRepo.PlayerData.SetCurrentVT(GameRepo.PlayerData.CurrentVT.Value + obj.VTRestoreAmount);
private void Inventory_RaiseStatRequest(InventoryItemStats itemStats) private void Inventory_RaiseStatRequest(InventoryItemStats itemStats)
{ {
@@ -290,12 +298,25 @@ public partial class Game : Node3D, IGame
EmitSignal(SignalName.StatRaisedAlert, $"{raiseString}VT Restored."); EmitSignal(SignalName.StatRaisedAlert, $"{raiseString}VT Restored.");
} }
private void PlayerInventory_InventoryAtCapacity(string rejectedItem) public async void DoubleEXP(TimeSpan lengthOfEffect)
{ {
InGameUI.PlayerInfoUI.DisplayInventoryFullMessage(rejectedItem); InventoryMenu_CloseInventory();
InGameUI.PlayerInfoUI.DisplayMessage("Experience points temporarily doubled.");
DoubleEXPTimer.Start(lengthOfEffect.Seconds);
GameRepo.EXPRate = 2;
} }
private void OnInventoryAtCapacity(string rejectedItemName) => InGameUI.PlayerInfoUI.DisplayInventoryFullMessage(rejectedItemName); private void DoubleEXPTimer_Timeout()
{
DoubleEXPTimer.Stop();
GameRepo.EXPRate = 1;
InGameUI.PlayerInfoUI.DisplayMessage("Experience points effect wore off.");
}
private void PlayerInventory_InventoryAtCapacity(string rejectedItem)
{
InGameUI.PlayerInfoUI.DisplayMessage($"Could not pick up {rejectedItem}.");
}
private void InventoryMenu_CloseInventory() => GameLogic.Input(new GameLogic.Input.CloseInventory()); private void InventoryMenu_CloseInventory() => GameLogic.Input(new GameLogic.Input.CloseInventory());

View File

@@ -1,13 +1,13 @@
[gd_scene load_steps=13 format=3 uid="uid://33ek675mfb5n"] [gd_scene load_steps=13 format=3 uid="uid://33ek675mfb5n"]
[ext_resource type="Script" path="res://src/game/Game.cs" id="1_ytcii"] [ext_resource type="Script" uid="uid://chftlu4proh3d" path="res://src/game/Game.cs" id="1_ytcii"]
[ext_resource type="Shader" path="res://src/app/App.gdshader" id="2_6ifxs"] [ext_resource type="Shader" uid="uid://dmjxo4k2rx1an" path="res://src/app/App.gdshader" id="2_6ifxs"]
[ext_resource type="PackedScene" uid="uid://by67pn7fdsg1m" path="res://src/map/Map.tscn" id="3_d8awv"] [ext_resource type="PackedScene" uid="uid://by67pn7fdsg1m" path="res://src/map/Map.tscn" id="3_d8awv"]
[ext_resource type="PackedScene" uid="uid://cfecvvav8kkp6" path="res://src/player/Player.tscn" id="3_kk6ly"] [ext_resource type="PackedScene" uid="uid://cfecvvav8kkp6" path="res://src/player/Player.tscn" id="3_kk6ly"]
[ext_resource type="PackedScene" uid="uid://b1muxus5qdbeu" path="res://src/ui/in_game_ui/InGameUI.tscn" id="5_lxtnp"] [ext_resource type="PackedScene" uid="uid://b1muxus5qdbeu" path="res://src/ui/in_game_ui/InGameUI.tscn" id="5_lxtnp"]
[ext_resource type="PackedScene" uid="uid://b16ejcwanod72" path="res://src/audio/InGameAudio.tscn" id="6_qc71l"] [ext_resource type="PackedScene" uid="uid://b16ejcwanod72" path="res://src/audio/InGameAudio.tscn" id="6_qc71l"]
[ext_resource type="Script" path="res://src/game/DialogueController.cs" id="10_58pbt"] [ext_resource type="Script" uid="uid://daphxl6vvsbjm" path="res://src/game/DialogueController.cs" id="10_58pbt"]
[ext_resource type="Script" path="res://src/ui/pause_menu/PauseMenu.cs" id="11_5ng8c"] [ext_resource type="Script" uid="uid://cbal5oeaha4nx" path="res://src/ui/pause_menu/PauseMenu.cs" id="11_5ng8c"]
[ext_resource type="PackedScene" uid="uid://pu6gp8de3ck4" path="res://src/ui/floor_clear/FloorClearMenu.tscn" id="11_rya1n"] [ext_resource type="PackedScene" uid="uid://pu6gp8de3ck4" path="res://src/ui/floor_clear/FloorClearMenu.tscn" id="11_rya1n"]
[ext_resource type="PackedScene" uid="uid://dbtfgrtgpr4qg" path="res://src/ui/death_menu/DeathMenu.tscn" id="11_wypid"] [ext_resource type="PackedScene" uid="uid://dbtfgrtgpr4qg" path="res://src/ui/death_menu/DeathMenu.tscn" id="11_wypid"]
[ext_resource type="PackedScene" uid="uid://blbqgw3wosc1w" path="res://src/ui/pause_menu/PauseMenu.tscn" id="12_yev8k"] [ext_resource type="PackedScene" uid="uid://blbqgw3wosc1w" path="res://src/ui/pause_menu/PauseMenu.tscn" id="12_yev8k"]
@@ -54,6 +54,12 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2.74459, 1.22144)
unique_name_in_owner = true unique_name_in_owner = true
process_mode = 1 process_mode = 1
[node name="StatusEffectTimers" type="Node" parent="SubViewportContainer/SubViewport/PauseContainer"]
[node name="DoubleEXPTimer" type="Timer" parent="SubViewportContainer/SubViewport/PauseContainer/StatusEffectTimers"]
unique_name_in_owner = true
wait_time = 30.0
[node name="InGameUI" parent="." instance=ExtResource("5_lxtnp")] [node name="InGameUI" parent="." instance=ExtResource("5_lxtnp")]
unique_name_in_owner = true unique_name_in_owner = true

View File

@@ -10,6 +10,8 @@
public readonly record struct GoToOverworld; public readonly record struct GoToOverworld;
public readonly record struct SaveGame;
public readonly record struct OpenInventory; public readonly record struct OpenInventory;
public readonly record struct CloseInventory; public readonly record struct CloseInventory;
@@ -32,6 +34,7 @@
public readonly record struct PauseMenuTransitioned; public readonly record struct PauseMenuTransitioned;
public readonly record struct AskForTeleport; public readonly record struct AskForTeleport;
public readonly record struct HideAskForTeleport; public readonly record struct HideAskForTeleport;
} }
} }

View File

@@ -26,6 +26,8 @@ public interface IGameRepo : IDisposable
public int MaxItemSize { get; } public int MaxItemSize { get; }
public int EXPRate { get; set; }
public int CurrentFloor { get; set; } public int CurrentFloor { get; set; }
} }
@@ -47,6 +49,8 @@ public class GameRepo : IGameRepo
public int MaxItemSize => 20; public int MaxItemSize => 20;
public int EXPRate { get; set; } = 1;
private bool _disposedValue; private bool _disposedValue;
public int CurrentFloor { get; set; } = 0; public int CurrentFloor { get; set; } = 0;

View File

@@ -383,12 +383,8 @@ public partial class InventoryMenu : Control, IInventoryMenu
GameRepo.PlayerData.Inventory.Equip(equipableItem); GameRepo.PlayerData.Inventory.Equip(equipableItem);
itemSlot.SetEquippedSelectedItemStyle(); itemSlot.SetEquippedSelectedItemStyle();
} }
SetProcessInput(false);
await HideUserActionPrompt(); RefreshUIAfterUserSelection();
await ShowInventoryInfo();
await ToSignal(GetTree().CreateTimer(1f), "timeout");
await RedrawInventory();
SetProcessInput(true);
} }
} }
@@ -398,14 +394,21 @@ public partial class InventoryMenu : Control, IInventoryMenu
if (currentItem is IEquipableItem) if (currentItem is IEquipableItem)
await EquipOrUnequipItem(); await EquipOrUnequipItem();
else if (currentItem is IUsableItem usableItem) else if (currentItem is IUsableItem usableItem)
{
usableItem.Use(); usableItem.Use();
GameRepo.PlayerData.Inventory.Remove(usableItem);
if (_currentIndex >= ItemSlots.Length - 1) if (currentItem is ConsumableItem consumableItem)
_currentIndex--; DestroyItem(consumableItem);
if (_currentIndex <= 0)
_currentIndex = 0; RefreshUIAfterUserSelection();
} }
private async void DestroyItem(IUsableItem usableItem)
{
GameRepo.PlayerData.Inventory.Remove(usableItem);
if (_currentIndex >= ItemSlots.Length - 1)
_currentIndex--;
if (_currentIndex <= 0)
_currentIndex = 0;
} }
private async void ThrowButtonPressed() private async void ThrowButtonPressed()
@@ -437,6 +440,16 @@ public partial class InventoryMenu : Control, IInventoryMenu
EmitSignal(SignalName.ClosedMenu); EmitSignal(SignalName.ClosedMenu);
} }
private async void RefreshUIAfterUserSelection()
{
SetProcessInput(false);
await HideUserActionPrompt();
await ShowInventoryInfo();
await RedrawInventory();
await ToSignal(GetTree().CreateTimer(1f), "timeout");
SetProcessInput(true);
}
private enum InventoryPageNumber private enum InventoryPageNumber
{ {
FirstPage, FirstPage,

View File

@@ -0,0 +1,78 @@
// Color range swap shader for Godot 4; Sprite3D version by Sithoid
// Based on 2D shader by nonunknown https://godotshaders.com/shader/color-range-swap/
// 3d lifehacks by Anonzs https://www.reddit.com/r/godot/comments/11dklv0/sprite3d_shader/
// Billboard projection by mrdunk https://ask.godotengine.org/152606/how-to-do-i-make-a-shader-a-billboard-face-the-player
shader_type spatial;
render_mode depth_draw_opaque, depth_prepass_alpha; // Prepass is needed to cast a shadow
// Set this parameter to your actual texture in script, e.g. with
// material_override.set_shader_parameter("sprite_texture", texture)
uniform sampler2D sprite_texture : source_color, filter_nearest;
// Hue on a HSV scale (0 to 1) that will be keyed out. Defaults are set to key out bright cyan
uniform float _min = 0.49;
uniform float _max = 0.5;
// Target color (RGBA) that will appear instead of the mask (it will respect brightness)
uniform vec4 color : source_color = vec4(0.59, 0.12, 0.32, 1.0); // Dark pink by default
uniform bool billboard = false; // Toggle billboard mode (set this in script)
vec3 rgb2hsv(vec3 c) {
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
float d = q.x - min(q.w, q.y);
float e = 1.0e-10;
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
}
// All components are in the range [0…1], including hue.
vec3 hsv2rgb(vec3 c) {
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}
// ===== nonunknown got those from: https://gamedev.stackexchange.com/a/75928
vec4 to_gray(vec4 tex) {
float avg = (tex.r + tex.g + tex.b) / 3.0;
return vec4(vec3(avg),tex.a);
}
vec4 to_color(vec4 gray, vec4 col) {
return gray * col;
}
// ===== end
// == Billboard projection by mrdunk
void vertex() {
if (billboard) {
mat4 modified_model_view = VIEW_MATRIX * mat4(
INV_VIEW_MATRIX[0],
INV_VIEW_MATRIX[1],
INV_VIEW_MATRIX[2],
MODEL_MATRIX[3]
);
MODELVIEW_MATRIX = modified_model_view;
}
}
// end ===
void fragment() {
vec4 tex = texture(sprite_texture, UV);
vec3 hsv = rgb2hsv(tex.rgb);
// the .r here represents HUE, .g is SATURATION, .b is LUMINANCE
if (hsv.r >= _min && hsv.r <= _max) {
tex = to_gray(tex);
tex = to_color(tex, color);
}
// To replace multiple colors, just copy this "if" statement
// and repeat it with different variables (such as _min1, _min2 and color2)
ALBEDO = tex.rgb;
ALPHA = tex.a;
}

View File

@@ -0,0 +1 @@
uid://b1n357imav0y6

View File

@@ -3,16 +3,17 @@ using Chickensoft.Introspection;
using GameJamDungeon; using GameJamDungeon;
using Godot; using Godot;
using System; using System;
using System.ComponentModel;
[Meta(typeof(IAutoNode))] [Meta(typeof(IAutoNode))]
public partial class ThrowableItem : Node3D, IUsableItem public partial class ThrowableItem : Node3D, IUsableItem
{ {
public override void _Notification(int what) => this.Notify(what); public override void _Notification(int what) => this.Notify(what);
[Dependency] public IGameRepo GameRepo => this.DependOn<IGameRepo>();
[Dependency] public IGame Game => this.DependOn<IGame>(); [Dependency] public IGame Game => this.DependOn<IGame>();
[Dependency] public IGameRepo GameRepo => this.DependOn<IGameRepo>();
public InventoryItemStats Info => ThrowableItemInfo; public InventoryItemStats Info => ThrowableItemInfo;
public int Count { get; } public int Count { get; }
@@ -26,10 +27,23 @@ public partial class ThrowableItem : Node3D, IUsableItem
[Node] public Area3D Pickup { get; set; } = default!; [Node] public Area3D Pickup { get; set; } = default!;
private ThrowableItemTag[] _affinityTypes;
private int _affinityIndex = 0;
public void OnResolved() public void OnResolved()
{ {
Sprite.Texture = ThrowableItemInfo.Texture; Sprite.Texture = ThrowableItemInfo.Texture;
Pickup.BodyEntered += OnEntered; Pickup.BodyEntered += OnEntered;
_affinityTypes =
[
ThrowableItemTag.InflictBaseDamage,
ThrowableItemTag.InflictHydricDamage,
ThrowableItemTag.InflictIgneousDamage,
ThrowableItemTag.InflictTelluricDamage,
ThrowableItemTag.InflictAeolicDamage,
ThrowableItemTag.InflictFerrumDamage
];
} }
public void Use() public void Use()
@@ -38,6 +52,24 @@ public partial class ThrowableItem : Node3D, IUsableItem
Game.HealHP(ThrowableItemInfo.HealHPAmount); Game.HealHP(ThrowableItemInfo.HealHPAmount);
if (ThrowableItemInfo.HealVTAmount > 0) if (ThrowableItemInfo.HealVTAmount > 0)
Game.HealVT(ThrowableItemInfo.HealVTAmount); Game.HealVT(ThrowableItemInfo.HealVTAmount);
if (ThrowableItemInfo.UsableItemTags.Contains(UsableItemTag.DoubleEXP))
Game.DoubleEXP(TimeSpan.FromSeconds(30));
if (ThrowableItemInfo.ThrowableItemTags.Contains(ThrowableItemTag.CanChangeAffinity))
ChangeAffinity();
}
private void ChangeAffinity()
{
ThrowableItemInfo.ThrowableItemTags.Remove(_affinityTypes[_affinityIndex]);
_affinityIndex = (_affinityIndex + 1) % (_affinityTypes.Length);
ThrowableItemInfo.ThrowableItemTags.Add(_affinityTypes[_affinityIndex]);
// TODO: Make this an inventory animation to cycle through elements.
ThrowableItemInfo.Description =
$"{GetDescription(_affinityTypes[_affinityIndex])} when thrown." +
$"{System.Environment.NewLine}Use item to change Affinity.";
} }
public void OnEntered(Node3D body) public void OnEntered(Node3D body)
@@ -46,4 +78,19 @@ public partial class ThrowableItem : Node3D, IUsableItem
if (isAdded) if (isAdded)
QueueFree(); QueueFree();
} }
private static string GetDescription(ThrowableItemTag enumValue)
{
var field = enumValue.GetType().GetField(enumValue.ToString());
if (field == null)
return enumValue.ToString();
var attributes = field.GetCustomAttributes(typeof(DescriptionAttribute), false);
if (Attribute.GetCustomAttribute(field, typeof(DescriptionAttribute)) is DescriptionAttribute attribute)
{
return attribute.Description;
}
return enumValue.ToString();
}
} }

View File

@@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=3 uid="uid://1fl6s352e2ej"] [gd_scene load_steps=3 format=3 uid="uid://1fl6s352e2ej"]
[ext_resource type="Script" path="res://src/items/throwable/ThrowableItem.cs" id="1_nac2l"] [ext_resource type="Script" uid="uid://dj28ol2cpeiwm" path="res://src/items/throwable/ThrowableItem.cs" id="1_nac2l"]
[sub_resource type="BoxShape3D" id="BoxShape3D_03cqg"] [sub_resource type="BoxShape3D" id="BoxShape3D_03cqg"]
size = Vector3(0.778381, 0.929947, 0.731567) size = Vector3(0.778381, 0.929947, 0.731567)
@@ -20,6 +20,7 @@ shape = SubResource("BoxShape3D_03cqg")
[node name="Sprite" type="Sprite3D" parent="Pickup"] [node name="Sprite" type="Sprite3D" parent="Pickup"]
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(0.999973, 0.00489444, -0.00548299, -0.00488109, 0.999985, 0.00244357, 0.00549488, -0.00241672, 0.999982, 0, 0, 0)
pixel_size = 0.0005 pixel_size = 0.0005
billboard = 2 billboard = 2
shaded = true shaded = true

View File

@@ -7,4 +7,7 @@ public partial class ThrowableItemStats : InventoryItemStats
{ {
[Export] [Export]
public Godot.Collections.Array<ThrowableItemTag> ThrowableItemTags { get; set; } = new Godot.Collections.Array<ThrowableItemTag>(); public Godot.Collections.Array<ThrowableItemTag> ThrowableItemTags { get; set; } = new Godot.Collections.Array<ThrowableItemTag>();
[Export]
public Godot.Collections.Array<UsableItemTag> UsableItemTags { get; set; } = new Godot.Collections.Array<UsableItemTag>();
} }

View File

@@ -1,11 +1,21 @@
public enum ThrowableItemTag using System.ComponentModel;
public enum ThrowableItemTag
{ {
[Description("Inflicts basic damage")]
InflictBaseDamage,
[Description("Inflicts Telluric damage")]
InflictTelluricDamage, InflictTelluricDamage,
[Description("Inflicts Aeolic damage")]
InflictAeolicDamage, InflictAeolicDamage,
[Description("Inflicts Hydric damage")]
InflictHydricDamage, InflictHydricDamage,
[Description("Inflicts Igneous damage")]
InflictIgneousDamage, InflictIgneousDamage,
[Description("Inflicts Ferrum damage")]
InflictFerrumDamage, InflictFerrumDamage,
LowerTargetTo1HP, LowerTargetTo1HP,
CanChangeAffinity
} }
public enum UsableItemTag public enum UsableItemTag

View File

@@ -1,13 +1,15 @@
[gd_resource type="Resource" script_class="ThrowableItemStats" load_steps=3 format=3 uid="uid://bph8c6by4s047"] [gd_resource type="Resource" script_class="ThrowableItemStats" load_steps=3 format=3 uid="uid://bph8c6by4s047"]
[ext_resource type="Script" path="res://src/items/throwable/ThrowableItemStats.cs" id="1_ewck5"] [ext_resource type="Script" uid="uid://d3wlunkcuv2w2" path="res://src/items/throwable/ThrowableItemStats.cs" id="1_ewck5"]
[ext_resource type="Texture2D" uid="uid://mi70lolgtf3n" path="res://src/items/throwable/textures/GEOMANCER-DICE.png" id="1_jhits"] [ext_resource type="Texture2D" uid="uid://mi70lolgtf3n" path="res://src/items/throwable/textures/GEOMANCER-DICE.png" id="1_jhits"]
[resource] [resource]
script = ExtResource("1_ewck5") script = ExtResource("1_ewck5")
ThrowableItemTags = [] ThrowableItemTags = Array[int]([7])
UsableItemTags = Array[int]([])
Name = "Geomantic Dice" Name = "Geomantic Dice"
Description = "Inflicts Affinity damage when thrown." Description = "Inflicts base damage when thrown.
Use item to change Affinity."
Texture = ExtResource("1_jhits") Texture = ExtResource("1_jhits")
SpawnRate = 0.1 SpawnRate = 0.1
ThrowSpeed = 20.0 ThrowSpeed = 20.0

View File

@@ -1,13 +1,17 @@
[gd_resource type="Resource" script_class="ThrowableItemStats" load_steps=3 format=3 uid="uid://qqg0gdcb8fwg"] [gd_resource type="Resource" script_class="ThrowableItemStats" load_steps=3 format=3 uid="uid://qqg0gdcb8fwg"]
[ext_resource type="Texture2D" uid="uid://dhfn51smm818x" path="res://src/items/throwable/textures/spell sign - luck.PNG" id="1_3605p"] [ext_resource type="Texture2D" uid="uid://dhfn51smm818x" path="res://src/items/throwable/textures/spell sign - luck.PNG" id="1_3605p"]
[ext_resource type="Script" path="res://src/items/throwable/ThrowableItemStats.cs" id="1_s3pq7"] [ext_resource type="Script" uid="uid://d3wlunkcuv2w2" path="res://src/items/throwable/ThrowableItemStats.cs" id="1_s3pq7"]
[resource] [resource]
script = ExtResource("1_s3pq7") script = ExtResource("1_s3pq7")
Damage = 0 ThrowableItemTags = Array[int]([])
ThrowableItemTags = [] UsableItemTags = Array[int]([0])
Name = "Spell Sign: Knowledge" Name = "Spell Sign: Knowledge"
Description = "Doubles experience points earned. Effect is temporary." Description = "Doubles experience points earned. Effect is temporary."
Texture = ExtResource("1_3605p") Texture = ExtResource("1_3605p")
SpawnRate = 0.1 SpawnRate = 0.1
ThrowSpeed = 12.0
HealHPAmount = 0
HealVTAmount = 0
ThrowDamage = 5

View File

@@ -1,8 +1,10 @@
[gd_scene load_steps=7 format=3 uid="uid://dl6h1djc27ddl"] [gd_scene load_steps=9 format=3 uid="uid://dl6h1djc27ddl"]
[ext_resource type="Script" uid="uid://cuhfkyh3d7noa" path="res://src/map/dungeon/code/Overworld.cs" id="1_2ce63"] [ext_resource type="Script" uid="uid://cuhfkyh3d7noa" path="res://src/map/dungeon/code/Overworld.cs" id="1_2ce63"]
[ext_resource type="PackedScene" uid="uid://duis2vhf5ojy3" path="res://src/item_rescue/ItemRescue.tscn" id="2_4ixnb"] [ext_resource type="PackedScene" uid="uid://duis2vhf5ojy3" path="res://src/item_rescue/ItemRescue.tscn" id="2_4ixnb"]
[ext_resource type="PackedScene" uid="uid://tc5kdfoggrng" path="res://src/item_rescue/RescuedItems.tscn" id="3_tbcl3"] [ext_resource type="PackedScene" uid="uid://tc5kdfoggrng" path="res://src/item_rescue/RescuedItems.tscn" id="3_tbcl3"]
[ext_resource type="PackedScene" uid="uid://1fl6s352e2ej" path="res://src/items/throwable/ThrowableItem.tscn" id="4_wibf0"]
[ext_resource type="Resource" uid="uid://bph8c6by4s047" path="res://src/items/throwable/resources/GeomanticDice.tres" id="5_wibf0"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_pb22g"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_pb22g"]
@@ -56,4 +58,8 @@ collision_mask = 3
[node name="CollisionShape3D" type="CollisionShape3D" parent="Spawn Rescued Items/Area3D"] [node name="CollisionShape3D" type="CollisionShape3D" parent="Spawn Rescued Items/Area3D"]
shape = SubResource("SphereShape3D_tbcl3") shape = SubResource("SphereShape3D_tbcl3")
[node name="ThrowableItem" parent="." instance=ExtResource("4_wibf0")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, 0)
ThrowableItemInfo = ExtResource("5_wibf0")
[connection signal="body_entered" from="Spawn Rescued Items/Area3D" to="Rescued Items" method="OnSpawnItemsEntered"] [connection signal="body_entered" from="Spawn Rescued Items/Area3D" to="Rescued Items" method="OnSpawnItemsEntered"]

View File

@@ -1,8 +1,8 @@
[gd_scene load_steps=49 format=3 uid="uid://cfecvvav8kkp6"] [gd_scene load_steps=49 format=3 uid="uid://cfecvvav8kkp6"]
[ext_resource type="Script" path="res://src/player/Player.cs" id="1_xcol5"] [ext_resource type="Script" uid="uid://yxmiqy7i0t7r" path="res://src/player/Player.cs" id="1_xcol5"]
[ext_resource type="Script" path="res://src/hitbox/Hitbox.cs" id="2_lb3qc"] [ext_resource type="Script" uid="uid://6edayafleq8y" path="res://src/hitbox/Hitbox.cs" id="2_lb3qc"]
[ext_resource type="Script" path="res://src/player/PlayerStatResource.cs" id="2_xq68d"] [ext_resource type="Script" uid="uid://s6ku2kyc4rbk" path="res://src/player/PlayerStatResource.cs" id="2_xq68d"]
[ext_resource type="Resource" uid="uid://b7xr0l4a8g1gk" path="res://src/items/weapons/resources/SealingRod.tres" id="3_ebyyx"] [ext_resource type="Resource" uid="uid://b7xr0l4a8g1gk" path="res://src/items/weapons/resources/SealingRod.tres" id="3_ebyyx"]
[ext_resource type="Resource" uid="uid://ce2vfa2t3io67" path="res://src/items/armor/resources/AtonersAdornments.tres" id="4_bj1ma"] [ext_resource type="Resource" uid="uid://ce2vfa2t3io67" path="res://src/items/armor/resources/AtonersAdornments.tres" id="4_bj1ma"]
[ext_resource type="Texture2D" uid="uid://c6r3dhnkuw22w" path="res://src/vfx/hit_effects/FIRE_STRIKE_1.0.png" id="5_wr6lo"] [ext_resource type="Texture2D" uid="uid://c6r3dhnkuw22w" path="res://src/vfx/hit_effects/FIRE_STRIKE_1.0.png" id="5_wr6lo"]

View File

@@ -8,7 +8,7 @@ public interface IFloorClearMenu : IControl
{ {
event FloorClearMenu.GoToNextFloorEventHandler GoToNextFloor; event FloorClearMenu.GoToNextFloorEventHandler GoToNextFloor;
event FloorClearMenu.ReturnToHubWorldEventHandler ReturnToHubWorld; event FloorClearMenu.SaveAndExitEventHandler SaveAndExit;
event FloorClearMenu.TransitionCompletedEventHandler TransitionCompleted; event FloorClearMenu.TransitionCompletedEventHandler TransitionCompleted;
@@ -29,7 +29,7 @@ public partial class FloorClearMenu : Control, IFloorClearMenu
[Node] public Button ContinueButton { get; set; } = default!; [Node] public Button ContinueButton { get; set; } = default!;
[Node] public Button ReturnToHubButton { get; set; } = default!; [Node] public Button SaveAndExitButton { get; set; } = default!;
public void FadeIn() => AnimationPlayer.Play("fade_in"); public void FadeIn() => AnimationPlayer.Play("fade_in");
@@ -40,26 +40,26 @@ public partial class FloorClearMenu : Control, IFloorClearMenu
[Signal] [Signal]
public delegate void GoToNextFloorEventHandler(); public delegate void GoToNextFloorEventHandler();
[Signal] [Signal]
public delegate void ReturnToHubWorldEventHandler(); public delegate void SaveAndExitEventHandler();
public void OnResolved() public void OnResolved()
{ {
AnimationPlayer.AnimationFinished += AnimationPlayer_AnimationFinished; AnimationPlayer.AnimationFinished += AnimationPlayer_AnimationFinished;
ContinueButton.Pressed += ContinueButton_Pressed; ContinueButton.Pressed += ContinueButton_Pressed;
ReturnToHubButton.Pressed += ReturnToHubButton_Pressed; SaveAndExitButton.Pressed += SaveAndExitButton_Pressed;
} }
private void ReturnToHubButton_Pressed() private void SaveAndExitButton_Pressed()
{ {
ContinueButton.Disabled = true; ContinueButton.Disabled = true;
ReturnToHubButton.Disabled = true; SaveAndExitButton.Disabled = true;
EmitSignal(SignalName.ReturnToHubWorld); EmitSignal(SignalName.SaveAndExit);
} }
private void ContinueButton_Pressed() private void ContinueButton_Pressed()
{ {
ContinueButton.Disabled = true; ContinueButton.Disabled = true;
ReturnToHubButton.Disabled = true; SaveAndExitButton.Disabled = true;
EmitSignal(SignalName.GoToNextFloor); EmitSignal(SignalName.GoToNextFloor);
} }
@@ -68,7 +68,7 @@ public partial class FloorClearMenu : Control, IFloorClearMenu
if (animName == "fade_in") if (animName == "fade_in")
{ {
ContinueButton.Disabled = false; ContinueButton.Disabled = false;
ReturnToHubButton.Disabled = false; SaveAndExitButton.Disabled = false;
ContinueButton.CallDeferred(MethodName.GrabFocus); ContinueButton.CallDeferred(MethodName.GrabFocus);
} }
if (animName == "fade_out") if (animName == "fade_out")

View File

@@ -1,6 +1,6 @@
[gd_scene load_steps=11 format=3 uid="uid://pu6gp8de3ck4"] [gd_scene load_steps=11 format=3 uid="uid://pu6gp8de3ck4"]
[ext_resource type="Script" path="res://src/ui/floor_clear/FloorClearMenu.cs" id="1_q65kq"] [ext_resource type="Script" uid="uid://yytomatekupe" path="res://src/ui/floor_clear/FloorClearMenu.cs" id="1_q65kq"]
[ext_resource type="FontFile" uid="uid://cm8j5vcdop5x0" path="res://src/ui/fonts/Mrs-Eaves-OT-Roman_31443.ttf" id="2_xk0dh"] [ext_resource type="FontFile" uid="uid://cm8j5vcdop5x0" path="res://src/ui/fonts/Mrs-Eaves-OT-Roman_31443.ttf" id="2_xk0dh"]
[sub_resource type="Animation" id="Animation_nc1gg"] [sub_resource type="Animation" id="Animation_nc1gg"]
@@ -52,9 +52,9 @@ tracks/0/keys = {
[sub_resource type="AnimationLibrary" id="AnimationLibrary_opfbx"] [sub_resource type="AnimationLibrary" id="AnimationLibrary_opfbx"]
_data = { _data = {
"RESET": SubResource("Animation_nc1gg"), &"RESET": SubResource("Animation_nc1gg"),
"fade_in": SubResource("Animation_p616x"), &"fade_in": SubResource("Animation_p616x"),
"fade_out": SubResource("Animation_dhyvw") &"fade_out": SubResource("Animation_dhyvw")
} }
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_phrcj"] [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_phrcj"]
@@ -79,7 +79,7 @@ script = ExtResource("1_q65kq")
unique_name_in_owner = true unique_name_in_owner = true
root_node = NodePath("../..") root_node = NodePath("../..")
libraries = { libraries = {
"": SubResource("AnimationLibrary_opfbx") &"": SubResource("AnimationLibrary_opfbx")
} }
[node name="BG" type="ColorRect" parent="."] [node name="BG" type="ColorRect" parent="."]
@@ -109,9 +109,9 @@ layout_mode = 2
focus_neighbor_left = NodePath(".") focus_neighbor_left = NodePath(".")
focus_neighbor_top = NodePath(".") focus_neighbor_top = NodePath(".")
focus_neighbor_right = NodePath(".") focus_neighbor_right = NodePath(".")
focus_neighbor_bottom = NodePath("../ReturnToHubButton") focus_neighbor_bottom = NodePath("../SaveAndExitButton")
theme_override_colors/font_focus_color = Color(1, 0.94902, 0, 1)
theme_override_colors/font_color = Color(0.737255, 0.705882, 0.690196, 1) theme_override_colors/font_color = Color(0.737255, 0.705882, 0.690196, 1)
theme_override_colors/font_focus_color = Color(1, 0.94902, 0, 1)
theme_override_fonts/font = ExtResource("2_xk0dh") theme_override_fonts/font = ExtResource("2_xk0dh")
theme_override_font_sizes/font_size = 36 theme_override_font_sizes/font_size = 36
theme_override_styles/focus = SubResource("StyleBoxEmpty_phrcj") theme_override_styles/focus = SubResource("StyleBoxEmpty_phrcj")
@@ -120,7 +120,7 @@ button_mask = 0
text = "Continue" text = "Continue"
flat = true flat = true
[node name="ReturnToHubButton" type="Button" parent="CenterContainer/VBoxContainer"] [node name="SaveAndExitButton" type="Button" parent="CenterContainer/VBoxContainer"]
unique_name_in_owner = true unique_name_in_owner = true
custom_minimum_size = Vector2(200, 50) custom_minimum_size = Vector2(200, 50)
layout_mode = 2 layout_mode = 2
@@ -128,12 +128,12 @@ focus_neighbor_left = NodePath(".")
focus_neighbor_top = NodePath("../ContinueButton") focus_neighbor_top = NodePath("../ContinueButton")
focus_neighbor_right = NodePath(".") focus_neighbor_right = NodePath(".")
focus_neighbor_bottom = NodePath(".") focus_neighbor_bottom = NodePath(".")
theme_override_colors/font_focus_color = Color(1, 0.94902, 0, 1)
theme_override_colors/font_color = Color(0.737255, 0.705882, 0.690196, 1) theme_override_colors/font_color = Color(0.737255, 0.705882, 0.690196, 1)
theme_override_colors/font_focus_color = Color(1, 0.94902, 0, 1)
theme_override_fonts/font = ExtResource("2_xk0dh") theme_override_fonts/font = ExtResource("2_xk0dh")
theme_override_font_sizes/font_size = 36 theme_override_font_sizes/font_size = 36
theme_override_styles/focus = SubResource("StyleBoxEmpty_cyd1c") theme_override_styles/focus = SubResource("StyleBoxEmpty_cyd1c")
theme_override_styles/normal = SubResource("StyleBoxEmpty_4bdva") theme_override_styles/normal = SubResource("StyleBoxEmpty_4bdva")
button_mask = 0 button_mask = 0
text = "Return To Overworld" text = "Save and Exit"
flat = true flat = true

View File

@@ -15,10 +15,6 @@ public interface IInGameUI : IControl
public void HideMiniMap(); public void HideMiniMap();
public void ShowInventoryFullMessage(string rejectedItemName);
public void ShowPickedUpItemMessage(string pickedUpItem);
event InGameUI.MinimapButtonReleasedEventHandler MinimapButtonReleased; event InGameUI.MinimapButtonReleasedEventHandler MinimapButtonReleased;
} }
@@ -47,16 +43,6 @@ public partial class InGameUI : Control, IInGameUI
} }
} }
public void ShowInventoryFullMessage(string rejectedItemName)
{
PlayerInfoUI.DisplayInventoryFullMessage(rejectedItemName);
}
public void ShowPickedUpItemMessage(string pickedUp)
{
PlayerInfoUI.DisplayPickedUpMessage(pickedUp);
}
public void HideInventoryScreen() public void HideInventoryScreen()
{ {
InventoryMenu.Hide(); InventoryMenu.Hide();

View File

@@ -7,9 +7,7 @@ namespace GameJamDungeon;
public interface IPlayerInfoUI : IControl public interface IPlayerInfoUI : IControl
{ {
public void DisplayInventoryFullMessage(string rejectedItemName); public void DisplayMessage(string message);
public void DisplayPickedUpMessage(string pickedUpItem);
} }
[Meta(typeof(IAutoNode))] [Meta(typeof(IAutoNode))]
@@ -80,9 +78,9 @@ public partial class PlayerInfoUI : Control, IPlayerInfoUI
}; };
} }
public async void DisplayPickedUpMessage(string pickedUpItem) public async void DisplayMessage(string message)
{ {
var newLabel = new Label() { Text = $"{pickedUpItem} picked up.", LabelSettings = _labelSettings }; var newLabel = new Label() { Text = message, LabelSettings = _labelSettings };
PlayerInfo.AddChild(newLabel); PlayerInfo.AddChild(newLabel);
GetTree().CreateTimer(3f).Timeout += () => GetTree().CreateTimer(3f).Timeout += () =>