/* ============================================================
   Wildlife Kingdom — js/data.js
   All game content: terrain, paths, fences, nature, 15 species,
   15 buildings, research tiers, missions, name pools, palettes.
   ============================================================ */
(function(){
'use strict';
const WK = window.WK;
const D = (WK.Data = {});

D.GRID = { COLS:46, ROWS:46 };
D.START_MONEY = 25000;
D.SPEEDS = [0,1,2,4];
D.CAPS = { guests:140, keepersMax:6 };

/* ---------------- ground / terrain ---------------- */
/* walk: humans passable · water: 0 none,1 shallow,2 deep */
D.GROUND = {
  grass:{ name:'Grass',   tier:1, cost:6,  colors:['#7cc653','#71ba48'], walk:1, water:0 },
  dirt: { name:'Dirt',    tier:1, cost:6,  colors:['#c99b62','#bd8f57'], walk:1, water:0 },
  sand: { name:'Sand',    tier:1, cost:8,  colors:['#eed9a0','#e5cd8d'], walk:1, water:0 },
  stone:{ name:'Stone',   tier:1, cost:8,  colors:['#bfc3bf','#b2b6b2'], walk:1, water:0 },
  water:{ name:'Shallow Water', tier:1, cost:22, colors:['#6ec6ea','#5cb8e0'], walk:0, water:1 },
  deep: { name:'Deep Water',    tier:2, cost:30, colors:['#3796cf','#2f89c0'], walk:0, water:2 },
  snow: { name:'Snow',    tier:2, cost:14, colors:['#eef3f6','#e0e9f0'], walk:1, water:0 },
  ice:  { name:'Ice',     tier:2, cost:18, colors:['#cfeaf6','#bcdef0'], walk:1, water:0 },
};

/* ---------------- paths ---------------- */
D.PATH = {
  gravel:{ name:'Gravel Path', tier:1, cost:10, base:'#d9c69d', dark:'#c4ad80' },
  wood:  { name:'Boardwalk',   tier:1, cost:16, base:'#cf9457', dark:'#b97f43' },
  stonep:{ name:'Stone Path',  tier:2, cost:22, base:'#d3d7da', dark:'#bcc0c4' },
};

/* ---------------- fences (tile edges) ----------------
   edge codes stored per tile: 0 none, 1 wood, 2 hedge, 3 gate */
D.FENCE = {
  1:{ name:'Wood Fence', tier:1, cost:12 },
  2:{ name:'Hedge',      tier:2, cost:18 },
  3:{ name:'Keeper Gate',tier:1, cost:40 },
};

/* ---------------- nature & decor ---------------- */
/* enrich: habitat enrichment value · block: blocks walking/placement */
D.NATURE = {
  tree:  { name:'Oak Tree',   tier:1, cost:30, enrich:1,   block:1 },
  bush:  { name:'Bush',       tier:1, cost:15, enrich:0.5, block:0 },
  flower:{ name:'Flower Bed', tier:1, cost:8,  enrich:0,   block:0 },
  rock:  { name:'Boulder',    tier:1, cost:20, enrich:1,   block:1 },
  palm:  { name:'Palm Tree',  tier:2, cost:35, enrich:1.2, block:1 },
  bamboo:{ name:'Bamboo',     tier:2, cost:28, enrich:1.5, block:1 },
  bench: { name:'Bench',      tier:1, cost:25, enrich:0,   block:1, seat:1 },
  bin:   { name:'Trash Bin',  tier:1, cost:10, enrich:0,   block:1 },
  lamp:  { name:'Lamp Post',  tier:1, cost:20, enrich:0,   block:1, light:1 },
};

/* ---------------- species ----------------
   biome: groundId -> weight · swim: may enter water tiles ·
   appeal: guest draw · upkeep: $/day · speed: tiles/sec        */
D.SPECIES = {
  deer:     { name:'Deer',       cost:800,  tier:1, appeal:2, minArea:10, biome:{grass:1, dirt:.85},            swim:0, enrichNeed:1, upkeep:8,  speed:1.0 },
  zebra:    { name:'Zebra',      cost:900,  tier:1, appeal:3, minArea:12, biome:{grass:1, sand:.6},             swim:0, enrichNeed:1, upkeep:10, speed:1.05 },
  monkey:   { name:'Monkey',     cost:1000, tier:1, appeal:3, minArea:10, biome:{grass:.8, dirt:1},             swim:0, enrichNeed:2, upkeep:9,  speed:1.35 },
  flamingo: { name:'Flamingo',   cost:1100, tier:1, appeal:3, minArea:10, biome:{water:.95, sand:1, deep:.5},   swim:1, enrichNeed:0, upkeep:9,  speed:0.75 },
  penguin:  { name:'Penguin',    cost:1400, tier:2, appeal:4, minArea:10, biome:{snow:1, ice:.95, water:.7, deep:.7}, swim:1, enrichNeed:1, upkeep:11, speed:0.8 },
  crocodile:{ name:'Crocodile',  cost:1600, tier:2, appeal:4, minArea:12, biome:{water:1, sand:.8, deep:.6},    swim:1, enrichNeed:1, upkeep:12, speed:0.55 },
  giraffe:  { name:'Giraffe',    cost:2000, tier:2, appeal:5, minArea:16, biome:{grass:1, sand:.5},             swim:0, enrichNeed:2, upkeep:14, speed:0.9 },
  lion:     { name:'Lion',       cost:2400, tier:2, appeal:5, minArea:16, biome:{grass:1, sand:.8},             swim:0, enrichNeed:2, upkeep:16, speed:1.0 },
  hippo:    { name:'Hippopotamus',cost:1800,tier:3, appeal:4, minArea:14, biome:{water:1, deep:.85, grass:.6},  swim:1, enrichNeed:0, upkeep:13, speed:0.6 },
  tiger:    { name:'Tiger',      cost:2600, tier:3, appeal:6, minArea:14, biome:{grass:.7, dirt:1},             swim:0, enrichNeed:3, upkeep:16, speed:1.1 },
  rhino:    { name:'Rhinoceros', cost:2800, tier:3, appeal:5, minArea:16, biome:{grass:.8, dirt:.8, sand:1},    swim:0, enrichNeed:1, upkeep:17, speed:0.8 },
  elephant: { name:'Elephant',   cost:3500, tier:3, appeal:7, minArea:20, biome:{grass:1, sand:.7, dirt:.5},    swim:0, enrichNeed:3, upkeep:20, speed:0.7 },
  gorilla:  { name:'Gorilla',    cost:3000, tier:4, appeal:6, minArea:12, biome:{grass:.7, dirt:1},             swim:0, enrichNeed:3, upkeep:18, speed:0.9 },
  polarbear:{ name:'Polar Bear', cost:3800, tier:4, appeal:6, minArea:16, biome:{snow:1, ice:.9, deep:1, water:.8}, swim:1, enrichNeed:2, upkeep:19, speed:0.85 },
  panda:    { name:'Giant Panda',cost:4200, tier:4, appeal:8, minArea:12, biome:{grass:.8, dirt:1},             swim:0, enrichNeed:4, upkeep:22, speed:0.7 },
};
D.SPECIES_LIST = Object.keys(D.SPECIES);

D.ANIMAL_NAMES = ['Mango','Pip','Biscuit','Clover','Noodle','Willow','Juno','Pepper','Maple','Tango','Olive','Bramble','Ziggy','Poppy','Rufus','Cinnamon','Echo','Marble','Sunny','Truffle','Basil','Peanut','Comet','Waffle','Hazel','Boomer','Petal','Snacks','Fig','Dot','Rascal','Muffin','Sprout','Bandit','Honey'];

/* ---------------- buildings ----------------
   w,h footprint in tiles · door faces NORTH (front tile is at y-1)
   joy: guest happiness on visit · income: avg guest spend ·
   staff: hires granted · rp: research points/min               */
const B = D.BUILDING = {};
B.hut        = { name:'Keeper Hut',     cost:600,  tier:1, w:2, h:2, wall:['#e8d9b8','#c9b28a','#b49a72'], roof:{style:'slant',color:'#a06a3c'}, staff:'keeper', joy:1, income:0, desc:'+1 keeper joins your staff.' };
B.restroom   = { name:'Restroom',       cost:500,  tier:1, w:1, h:1, wall:['#bfe3ef','#93c6dc','#7fb3cb'], roof:{style:'flat',color:'#5d90a8'},  joy:2, income:0, desc:'Guests need these after food & drink!' };
B.burger     = { name:'Burger Stand',   cost:700,  tier:1, w:2, h:2, wall:['#ffe9b0','#ecc678','#dab262'], roof:{style:'awning',color:'#e8624e'},joy:3, income:7,  desc:'Sells burgers. Tasty income.' };
B.icecream   = { name:'Ice Cream Stand',cost:650,  tier:1, w:2, h:2, wall:['#ffdff0','#f2bcd9','#e2aac6'], roof:{style:'cone',color:'#f08bb1'},  joy:3, income:6,  desc:'Cool treats on warm days.' };
B.gift       = { name:'Gift Shop',      cost:1200, tier:1, w:2, h:2, wall:['#dff0d0','#b8d9a0','#a2c789'], roof:{style:'awning',color:'#63b34c'},joy:4, income:12, desc:'Plush toys & souvenirs.' };
B.visitor    = { name:'Visitor Center', cost:1400, tier:1, w:3, h:2, wall:['#f2e3c4','#dcc394','#c8ac7c'], roof:{style:'gable',color:'#c96f4a'}, joy:3, income:0, desc:'A welcoming landmark.' };
B.staff      = { name:'Staff Room',     cost:800,  tier:1, w:2, h:2, wall:['#d8d3ca','#b8b2a5','#a29b8c'], roof:{style:'flat',color:'#8a8474'},  joy:0, income:0, boost:'staff', desc:'Staff work 20% faster.' };
B.research   = { name:'Research Center',cost:3000, tier:1, w:3, h:2, wall:['#d7e8f5','#adcbe4','#94b7d2'], roof:{style:'dome',color:'#7fa8cc'},  joy:1, income:0, rp:5, desc:'+5 research/min. Unlock new species & buildings.' };
B.entrance_s = { name:'Small Entrance', cost:800,  tier:1, w:2, h:1, wall:['#f5d9a0','#dfba76','#caa15c'], roof:{style:'archway',color:'#e07f26'}, entrance:1, joy:2, income:0, desc:'Guests arrive here. Front side must touch a path.' };
B.vet        = { name:'Vet Clinic',     cost:1600, tier:2, w:3, h:2, wall:['#ffffff','#e4ded4','#cfc7b9'], roof:{style:'gable',color:'#e86a6a'},  staff:'vet', joy:1, income:0, desc:'+1 vet heals sick animals.' };
B.entrance_g = { name:'Grand Entrance', cost:2600, tier:2, w:4, h:2, wall:['#f7ddb0','#e0bd82','#cba763'], roof:{style:'archway',color:'#c96f4a'}, entrance:1, joy:5, income:0, big:1, desc:'Impressive gate — more guests per day.' };
B.restaurant = { name:'Restaurant',     cost:2400, tier:2, w:3, h:3, wall:['#f6ddc0','#e0bd92','#cba674'], roof:{style:'awning',color:'#8a5fb0'}, joy:6, income:18, desc:'Sit-down dining, big spend.' };
B.aviary     = { name:'Aviary',         cost:2800, tier:2, w:3, h:3, wall:['#e6f2f7','#c2dbe8','#a9c8d8'], roof:{style:'mesh',color:'#9fb9c9'},  joy:8, income:3,  exhibit:1, desc:'Walk-around bird wonderland.' };
B.reptile    = { name:'Reptile House',  cost:3200, tier:3, w:3, h:2, wall:['#dfe8cf','#c0cfa6','#a8bb8c'], roof:{style:'rock',color:'#7f9166'},  joy:9, income:4,  exhibit:1, desc:'Slithery stars indoors.' };
B.aquarium   = { name:'Aquarium',       cost:4200, tier:3, w:4, h:3, wall:['#cfe9f5','#a3cede','#87bad0'], roof:{style:'wave',color:'#4f9fd0'},  joy:12,income:6,  exhibit:1, desc:'Undersea tunnel. Crowd favorite.' };
D.BUILDING_LIST = Object.keys(B);

/* ---------------- research tiers ---------------- */
D.RESEARCH_TIERS = [
  { tier:2, cost:25,  label:'Tier II — Savanna & Polar' },
  { tier:3, cost:60,  label:'Tier III — Giants & Reptiles' },
  { tier:4, cost:120, label:'Tier IV — Rare Icons' },
];

/* ---------------- missions (sequential) ---------------- */
D.MISSIONS = [
  { id:'paths',   label:'Lay 12 path tiles',           reward:300,  hint:'Paths category → Gravel Path. Guests can only walk on paths.', check:g=>g.stats.paths>=12 },
  { id:'fences',  label:'Place 20 fence pieces',       reward:300,  hint:'Fences category → drag along tile edges.', check:g=>g.stats.fences>=20 },
  { id:'habitat', label:'Build an enclosed habitat of 12+ tiles', reward:500, hint:'Fully surround an area with fence — no gaps!', check:g=>g.animals.length>0 || g.maxRegion>=12 },
  { id:'adopt1',  label:'Adopt your first animal',     reward:400,  hint:'Animals category → pick a species → click inside your habitat.', check:g=>g.stats.adopted>=1 },
  { id:'hut',     label:'Build a Keeper Hut',          reward:500,  hint:'Facilities → Keeper Hut hires a keeper who feeds animals.', check:g=>g.buildings.some(b=>b.type==='hut') },
  { id:'happy3',  label:'Keep 3 animals above 70% happiness', reward:800, hint:'Feed them and match their favorite terrain.', check:g=>g.animals.filter(a=>a.happiness>70).length>=3 },
  { id:'stars3',  label:'Reach a 3.0★ zoo rating',     reward:{cash:1000,rp:20}, hint:'More species, happy animals, restrooms & decor raise stars.', check:g=>g.rating>=3 },
  { id:'guests',  label:'Welcome 150 total guests',    reward:1200, hint:'Higher stars attract bigger crowds.', check:g=>g.stats.guestsTotal>=150 },
  { id:'res2',    label:'Unlock Research Tier II',     reward:800,  hint:'Research panel → unlock for 40 RP. A Research Center earns RP faster.', check:g=>g.researchTier>=2 },
  { id:'species5',label:'Care for 5 different species',reward:1500, hint:'Variety is the spice of zoos.', check:g=>g.speciesCount()>=5 },
  { id:'resto',   label:'Open a Restaurant',           reward:1000, hint:'Tier II building. Hungry guests spend well.', check:g=>g.buildings.some(b=>b.type==='restaurant') },
  { id:'stars4',  label:'Reach a 4.0★ zoo rating',     reward:{cash:2500,rp:40}, check:g=>g.rating>=4 },
  { id:'rev20k',  label:'Earn $20,000 total revenue',  reward:3000, hint:'Tickets, food and gifts all count.', check:g=>g.stats.revenueTotal>=20000 },
  { id:'species8',label:'Care for 8 different species',reward:4000, check:g=>g.speciesCount()>=8 },
  { id:'stars5',  label:'Reach 5.0★ — Wildlife Legend!', reward:{cash:10000,rp:60}, check:g=>g.rating>=4.95 },
];

/* ---------------- palette / brand ---------------- */
D.PAL = {
  grass1:'#7cc653', cream:'#fdf6e7', ink:'#43362a',
  orange:'#ff9d47', sky:'#69c3ef', gold:'#ffc93c', red:'#e85d5d',
};
D.NIGHT_SKY = '#2c3e66';

/* tool categories shown in bottom toolbar */
D.TOOLCATS = [
  { id:'ground',    label:'Ground' },
  { id:'paths',     label:'Paths' },
  { id:'fences',    label:'Fences' },
  { id:'nature',    label:'Nature' },
  { id:'animals',   label:'Animals' },
  { id:'facilities',label:'Zoo' },
];

/* starter layout seeds (relative to south-center) built by sim.newGame */
D.STARTER = { entranceW:3 };
})();
