-- Item definitions
INSERT IGNORE INTO item_definitions (id, name, item_type, slot, armor, stat_strength, weapon_speed_ms, is_tradable) VALUES
('rusty_sword', 'Rusty Sword', 'gear', 'weapon', 0, 2, 3000, 1),
('leather_helm', 'Leather Helm', 'gear', 'helmet', 5, 0, 0, 1),
('leather_mail', 'Leather Mail', 'gear', 'mail', 10, 1, 0, 1),
('health_potion', 'Health Potion', 'consumable', 'none', 0, 0, 0, 1),
('mana_potion', 'Mana Potion', 'consumable', 'none', 0, 0, 0, 1),
('gear_insurance', 'Gear Insurance', 'insurance', 'none', 0, 0, 0, 1);

-- Shop listings for Hammerfall
INSERT IGNORE INTO shop_listings (town_id, item_definition_id, price) VALUES
('hammerfall', 'rusty_sword', 50),
('hammerfall', 'leather_helm', 30),
('hammerfall', 'leather_mail', 75),
('hammerfall', 'health_potion', 15),
('hammerfall', 'mana_potion', 15),
('hammerfall', 'gear_insurance', 200);

-- Monsters in hammerfall_world
INSERT IGNORE INTO monster_definitions (id, name, zone_id, hp, damage, armor, xp_reward, gold_min, gold_max, respawn_seconds, spawn_x, spawn_y) VALUES
('goblin_1', 'Goblin', 'hammerfall_world', 30, 5, 2, 15, 2, 8, 45, 20, 20),
('goblin_2', 'Goblin', 'hammerfall_world', 30, 5, 2, 15, 2, 8, 45, 30, 28),
('wolf_1', 'Dire Wolf', 'hammerfall_world', 50, 8, 5, 25, 5, 15, 90, 15, 35);

INSERT IGNORE INTO loot_tables (monster_id, item_definition_id, drop_chance) VALUES
('goblin_1', 'health_potion', 0.3000),
('goblin_2', 'rusty_sword', 0.0500),
('wolf_1', 'leather_mail', 0.1000);

-- Shrines for killer curse reduction
INSERT IGNORE INTO shrines (id, zone_id, tile_x, tile_y) VALUES
('shrine_1', 'hammerfall_world', 5, 5),
('shrine_2', 'hammerfall_world', 45, 5),
('shrine_3', 'hammerfall_world', 5, 45),
('shrine_4', 'hammerfall_world', 45, 45),
('shrine_5', 'hammerfall_world', 25, 5),
('shrine_6', 'hammerfall_world', 5, 25),
('shrine_7', 'hammerfall_world', 45, 25);

-- Boss
INSERT IGNORE INTO boss_encounters (id, zone_id, name, hp, tile_x, tile_y) VALUES
('chaos_guardian', 'hammerfall_world', 'Chaos Guardian', 500, 40, 40);

-- Quest
INSERT IGNORE INTO quests (id, title, description, quest_type) VALUES
('first_blood', 'First Blood', 'Slay your first monster in the wild.', 'kill');

-- Generate floor tiles for hammerfall_world (50x50)
-- Stored procedurally in seed script logic; insert border walls
INSERT IGNORE INTO zone_tiles (zone_id, x, y, tile_type, is_blocked, sprite_key)
SELECT 'hammerfall_world', x, y, 'wall', 1, 'wall_stone'
FROM (
    SELECT a.n AS x, b.n AS y
    FROM (SELECT 0 n UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9
          UNION SELECT 10 UNION SELECT 11 UNION SELECT 12 UNION SELECT 13 UNION SELECT 14 UNION SELECT 15 UNION SELECT 16 UNION SELECT 17 UNION SELECT 18 UNION SELECT 19
          UNION SELECT 20 UNION SELECT 21 UNION SELECT 22 UNION SELECT 23 UNION SELECT 24 UNION SELECT 25 UNION SELECT 26 UNION SELECT 27 UNION SELECT 28 UNION SELECT 29
          UNION SELECT 30 UNION SELECT 31 UNION SELECT 32 UNION SELECT 33 UNION SELECT 34 UNION SELECT 35 UNION SELECT 36 UNION SELECT 37 UNION SELECT 38 UNION SELECT 39
          UNION SELECT 40 UNION SELECT 41 UNION SELECT 42 UNION SELECT 43 UNION SELECT 44 UNION SELECT 45 UNION SELECT 46 UNION SELECT 47 UNION SELECT 48 UNION SELECT 49) a
    CROSS JOIN (SELECT 0 n UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9
          UNION SELECT 10 UNION SELECT 11 UNION SELECT 12 UNION SELECT 13 UNION SELECT 14 UNION SELECT 15 UNION SELECT 16 UNION SELECT 17 UNION SELECT 18 UNION SELECT 19
          UNION SELECT 20 UNION SELECT 21 UNION SELECT 22 UNION SELECT 23 UNION SELECT 24 UNION SELECT 25 UNION SELECT 26 UNION SELECT 27 UNION SELECT 28 UNION SELECT 29
          UNION SELECT 30 UNION SELECT 31 UNION SELECT 32 UNION SELECT 33 UNION SELECT 34 UNION SELECT 35 UNION SELECT 36 UNION SELECT 37 UNION SELECT 38 UNION SELECT 39
          UNION SELECT 40 UNION SELECT 41 UNION SELECT 42 UNION SELECT 43 UNION SELECT 44 UNION SELECT 45 UNION SELECT 46 UNION SELECT 47 UNION SELECT 48 UNION SELECT 49) b
) coords
WHERE x = 0 OR y = 0 OR x = 49 OR y = 49;
