Dungeon simulation changes

This commit is contained in:
dingo
2025-12-28 21:25:34 -05:00
parent c1a8d1a98f
commit 2c8e336828
6 changed files with 2917 additions and 3 deletions
+1
View File
@@ -38,6 +38,7 @@ public sealed class GameDbContext : DbContext
public DbSet<TileDefinition> TileDefinitions => Set<TileDefinition>();
public DbSet<RoomTemplate> RoomTemplates => Set<RoomTemplate>();
public DbSet<DungeonTemplate> DungeonTemplates => Set<DungeonTemplate>();
public DbSet<DungeonObjectDefinition> DungeonObjects => Set<DungeonObjectDefinition>();
public DbSet<DungeonBeltItem> DungeonBeltItems => Set<DungeonBeltItem>();
public DbSet<DeathChest> DeathChests => Set<DeathChest>();
+132 -1
View File
@@ -80,7 +80,7 @@ public class TileDefinition
/// <summary>Tile type for game logic</summary>
public TileType Type { get; set; } = TileType.Floor;
/// <summary>Tags for filtering/selection (e.g., "stone,cracked,corner_nw")</summary>
/// <summary>Tags for filtering/selection (e.g., "stone,cracked,corner_nw,biome:cave")</summary>
[MaxLength(256)]
public string? Tags { get; set; }
@@ -99,6 +99,19 @@ public class TileDefinition
/// <summary>Z-index within the layer</summary>
public int ZIndex { get; set; } = 0;
/// <summary>Whether this tile is animated</summary>
public bool IsAnimated { get; set; } = false;
/// <summary>Number of animation frames (consecutive frames starting at FrameIndex)</summary>
public int AnimationFrameCount { get; set; } = 1;
/// <summary>Animation speed in frames per second</summary>
public float AnimationFps { get; set; } = 8.0f;
/// <summary>Biome this tile belongs to (e.g., "cave", "dungeon", "forest")</summary>
[MaxLength(32)]
public string? Biome { get; set; }
public bool IsEnabled { get; set; } = true;
}
@@ -312,3 +325,121 @@ public class ConnectionPoint
/// <summary>Width of the connection (for wider hallways)</summary>
public int Width { get; set; } = 1;
}
/// <summary>
/// Definition of a dungeon object (interactable, obstacle, container)
/// </summary>
[Table("dungeon_objects")]
public class DungeonObjectDefinition
{
[Key]
public int Id { get; set; }
/// <summary>Name of this object</summary>
[Required, MaxLength(64)]
public string Name { get; set; } = "";
/// <summary>Description</summary>
[MaxLength(512)]
public string? Description { get; set; }
/// <summary>Object type</summary>
public DungeonObjectType Type { get; set; } = DungeonObjectType.Decoration;
/// <summary>Sprite path on CDN</summary>
[MaxLength(256)]
public string? SpritePath { get; set; }
/// <summary>Sprite ID for shared sprites</summary>
public int? SpriteId { get; set; }
/// <summary>Alternative sprite when interacted (e.g., opened chest)</summary>
[MaxLength(256)]
public string? InteractedSpritePath { get; set; }
/// <summary>Whether this object blocks movement</summary>
public bool BlocksMovement { get; set; } = false;
/// <summary>Whether this object blocks projectiles</summary>
public bool BlocksProjectiles { get; set; } = false;
/// <summary>Whether this object blocks line of sight</summary>
public bool BlocksLineOfSight { get; set; } = false;
/// <summary>Whether this object can be interacted with</summary>
public bool IsInteractable { get; set; } = false;
/// <summary>Whether this object can be destroyed</summary>
public bool IsDestructible { get; set; } = false;
/// <summary>Health if destructible (0 = instant destroy)</summary>
public int Health { get; set; } = 0;
/// <summary>Interaction type (what happens when player interacts)</summary>
public ObjectInteractionType InteractionType { get; set; } = ObjectInteractionType.None;
/// <summary>Loot table ID for containers</summary>
public int? LootTableId { get; set; }
/// <summary>Tags for filtering/categorization</summary>
[MaxLength(256)]
public string? Tags { get; set; }
/// <summary>Biome this object belongs to</summary>
[MaxLength(32)]
public string? Biome { get; set; }
/// <summary>Size in tiles (width)</summary>
public int Width { get; set; } = 1;
/// <summary>Size in tiles (height)</summary>
public int Height { get; set; } = 1;
/// <summary>Z-index for rendering order</summary>
public int ZIndex { get; set; } = 0;
/// <summary>Whether this object is animated</summary>
public bool IsAnimated { get; set; } = false;
/// <summary>Animation frame count</summary>
public int AnimationFrameCount { get; set; } = 1;
/// <summary>Animation FPS</summary>
public float AnimationFps { get; set; } = 8.0f;
public bool IsEnabled { get; set; } = true;
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
}
/// <summary>
/// Types of dungeon objects
/// </summary>
public enum DungeonObjectType
{
Decoration = 0, // Visual only, no collision
Obstacle = 1, // Blocks movement
Container = 2, // Can be opened for loot (chest, barrel, etc.)
Interactable = 3, // Triggers an action (lever, button, etc.)
Destructible = 4, // Can be destroyed (crate, pot, etc.)
Door = 5, // Openable door
Trap = 6, // Damages player
Shrine = 7, // Gives buff/heals
Vendor = 8 // Shop NPC placeholder
}
/// <summary>
/// Types of object interactions
/// </summary>
public enum ObjectInteractionType
{
None = 0,
OpenContainer = 1, // Opens loot UI
Toggle = 2, // Toggle on/off state
Trigger = 3, // Triggers an event
Teleport = 4, // Teleports player
Heal = 5, // Heals player
Buff = 6, // Gives buff
Dialogue = 7, // Shows dialogue
Shop = 8 // Opens shop UI
}