namespace VoidScavengers.Game; /// /// Item definitions for Void Scavengers /// public static class ItemDatabase { public static readonly Dictionary Items = new() { // ===== Resources (1-99) ===== [1] = new ItemDef(1, "Scrap Metal", ItemType.Resource, 0, "Basic salvage material", 1, true), [2] = new ItemDef(2, "Energy Cell", ItemType.Resource, 0, "Charged power source", 2, true), [3] = new ItemDef(3, "Rare Alloy", ItemType.Resource, 0, "Precious refined metal", 5, true), // ===== Weapons (100-199) ===== [100] = new ItemDef(100, "Pulse Pistol", ItemType.Weapon, 15, "Basic sidearm", 10, false) { Damage = 10, FireRate = 4f, // shots per second ProjectileSpeed = 400f, Range = 300f, AmmoType = 0 // energy-based, no ammo needed }, [101] = new ItemDef(101, "Scatter Gun", ItemType.Weapon, 25, "Close-range devastation", 20, false) { Damage = 6, // per pellet, 5 pellets FireRate = 1.5f, ProjectileSpeed = 350f, Range = 150f, AmmoType = 0, PelletCount = 5, Spread = 0.4f }, [102] = new ItemDef(102, "Rail Rifle", ItemType.Weapon, 40, "Long-range precision", 35, false) { Damage = 45, FireRate = 0.8f, ProjectileSpeed = 800f, Range = 600f, AmmoType = 0 }, [103] = new ItemDef(103, "Plasma Launcher", ItemType.Weapon, 60, "Area damage weapon", 50, false) { Damage = 30, FireRate = 0.5f, ProjectileSpeed = 250f, Range = 400f, AmmoType = 0, ExplosionRadius = 50f }, // ===== Tools (200-299) ===== [200] = new ItemDef(200, "Mining Laser", ItemType.Tool, 15, "Harvests resources faster", 12, false) { HarvestMultiplier = 2.0f }, [201] = new ItemDef(201, "Scanner", ItemType.Tool, 20, "Reveals nearby resources and players", 15, false) { ScanRadius = 200f, ScanCooldown = 10f }, [202] = new ItemDef(202, "Portable Shield", ItemType.Tool, 35, "Deployable cover", 25, false) { ShieldHealth = 100, ShieldDuration = 15f }, // ===== Consumables (300-399) ===== [300] = new ItemDef(300, "Repair Kit", ItemType.Consumable, 10, "Restores 30 health", 8, true) { HealAmount = 30 }, [301] = new ItemDef(301, "Shield Booster", ItemType.Consumable, 15, "Temporary damage reduction", 12, true) { ShieldBoostDuration = 10f, DamageReduction = 0.3f }, [302] = new ItemDef(302, "Speed Stim", ItemType.Consumable, 12, "Temporary speed boost", 10, true) { SpeedBoostDuration = 8f, SpeedMultiplier = 1.5f }, // ===== Armor/Equipment (400-499) ===== [400] = new ItemDef(400, "Light Suit", ItemType.Armor, 20, "+20 max health", 15, false) { HealthBonus = 20, SpeedPenalty = 0f }, [401] = new ItemDef(401, "Heavy Suit", ItemType.Armor, 45, "+50 max health, slower", 35, false) { HealthBonus = 50, SpeedPenalty = 0.15f }, [402] = new ItemDef(402, "Thruster Pack", ItemType.Armor, 30, "Dash ability", 25, false) { DashDistance = 100f, DashCooldown = 5f } }; public static ItemDef? Get(int id) => Items.TryGetValue(id, out var item) ? item : null; } public sealed class ItemDef { public int Id { get; } public string Name { get; } public ItemType Type { get; } public int CraftCost { get; } // Total resource value to craft public string Description { get; } public int LootValue { get; } // Value when extracted public bool Stackable { get; } // Weapon stats public int Damage { get; init; } public float FireRate { get; init; } public float ProjectileSpeed { get; init; } public float Range { get; init; } public int AmmoType { get; init; } public int PelletCount { get; init; } = 1; public float Spread { get; init; } public float ExplosionRadius { get; init; } // Tool stats public float HarvestMultiplier { get; init; } = 1f; public float ScanRadius { get; init; } public float ScanCooldown { get; init; } public int ShieldHealth { get; init; } public float ShieldDuration { get; init; } // Consumable stats public int HealAmount { get; init; } public float ShieldBoostDuration { get; init; } public float DamageReduction { get; init; } public float SpeedBoostDuration { get; init; } public float SpeedMultiplier { get; init; } = 1f; // Armor stats public int HealthBonus { get; init; } public float SpeedPenalty { get; init; } public float DashDistance { get; init; } public float DashCooldown { get; init; } public ItemDef(int id, string name, ItemType type, int craftCost, string desc, int lootValue, bool stackable) { Id = id; Name = name; Type = type; CraftCost = craftCost; Description = desc; LootValue = lootValue; Stackable = stackable; } } public enum ItemType { Resource, Weapon, Tool, Consumable, Armor } /// /// Crafting recipes /// public static class RecipeDatabase { public static readonly Dictionary Recipes = new() { // Basic weapons [1] = new Recipe(1, 100, new[] { (1, 5), (2, 2) }), // Pulse Pistol: 5 scrap + 2 energy [2] = new Recipe(2, 101, new[] { (1, 8), (2, 3) }), // Scatter Gun: 8 scrap + 3 energy [3] = new Recipe(3, 102, new[] { (1, 10), (2, 5), (3, 2) }), // Rail Rifle: 10 scrap + 5 energy + 2 rare [4] = new Recipe(4, 103, new[] { (1, 15), (2, 8), (3, 4) }), // Plasma Launcher // Tools [10] = new Recipe(10, 200, new[] { (1, 6), (2, 3) }), // Mining Laser [11] = new Recipe(11, 201, new[] { (1, 8), (2, 4), (3, 1) }), // Scanner [12] = new Recipe(12, 202, new[] { (1, 12), (2, 6), (3, 2) }), // Portable Shield // Consumables [20] = new Recipe(20, 300, new[] { (1, 3), (2, 2) }), // Repair Kit [21] = new Recipe(21, 301, new[] { (1, 4), (2, 3) }), // Shield Booster [22] = new Recipe(22, 302, new[] { (1, 3), (2, 4) }), // Speed Stim // Armor [30] = new Recipe(30, 400, new[] { (1, 8), (3, 1) }), // Light Suit [31] = new Recipe(31, 401, new[] { (1, 15), (3, 3) }), // Heavy Suit [32] = new Recipe(32, 402, new[] { (1, 10), (2, 5), (3, 2) }), // Thruster Pack }; public static Recipe? Get(int id) => Recipes.TryGetValue(id, out var r) ? r : null; } public sealed class Recipe { public int Id { get; } public int ResultItemId { get; } public (int ItemId, int Quantity)[] Ingredients { get; } public Recipe(int id, int resultItemId, (int, int)[] ingredients) { Id = id; ResultItemId = resultItemId; Ingredients = ingredients; } public bool CanCraft(int scrap, int energy, int rare) { foreach (var (itemId, qty) in Ingredients) { int available = itemId switch { 1 => scrap, 2 => energy, 3 => rare, _ => 0 }; if (available < qty) return false; } return true; } public (int scrap, int energy, int rare) GetCost() { int s = 0, e = 0, r = 0; foreach (var (itemId, qty) in Ingredients) { switch (itemId) { case 1: s += qty; break; case 2: e += qty; break; case 3: r += qty; break; } } return (s, e, r); } }