Fraser commited on
Commit
8e9e5e5
·
1 Parent(s): 381170a

rm excess fields

Browse files
src/lib/components/MonsterGenerator/MonsterGenerator.svelte CHANGED
@@ -320,22 +320,15 @@ Focus on: colors, body shape, eyes, limbs, mouth, and key visual features. Omit
320
  const loreMatch = state.monsterConcept.match(/## Monster Lore\s*\n([\s\S]*?)(?=##|$)/);
321
  const monsterLore = loreMatch ? loreMatch[1].trim() : '';
322
 
323
- // Update stats prompt to include the tier
324
- const statsPrompt = `Convert the following monster concept into a JSON object with stats:
325
  "${state.monsterConcept}"
326
 
327
- The monster's name is: ${monsterName}
328
- The monster's tier is: ${tier}
329
- Use this as the description: "${monsterLore}"
330
-
331
  The output should be formatted as a JSON instance that conforms to the JSON schema below.
332
 
333
  \`\`\`json
334
  {
335
  "properties": {
336
- "name": {"type": "string", "description": "The monster's unique name"},
337
- "description": {"type": "string", "description": "The monster's lore/backstory"},
338
- "tier": {"type": "string", "enum": ["low", "medium", "high", "legendary"], "description": "The monster's tier based on rarity"},
339
  "HP": {"type": "integer", "minimum": 0, "maximum": 100, "description": "Health/vitality stat (0=fragile, 100=incredibly tanky)"},
340
  "defence": {"type": "integer", "minimum": 0, "maximum": 100, "description": "Defensive/armor stat (0=paper thin, 100=impenetrable fortress)"},
341
  "attack": {"type": "integer", "minimum": 0, "maximum": 100, "description": "Physical attack power (0=harmless, 100=devastating force)"},
@@ -350,14 +343,10 @@ The output should be formatted as a JSON instance that conforms to the JSON sche
350
  "specialActionName": {"type": "string", "description": "Name of the monster's ultimate move (one use per battle)"},
351
  "specialActionDescription": {"type": "string", "description": "Describe this powerful finishing move and its dramatic effects in battle"}
352
  },
353
- "required": ["name", "description", "tier", "HP", "defence", "attack", "speed", "specialPassiveTraitDescription", "attackActionName", "attackActionDescription", "buffActionName", "buffActionDescription", "debuffActionName", "debuffActionDescription", "specialActionName", "specialActionDescription"]
354
  }
355
  \`\`\`
356
 
357
- Remember to set:
358
- - name to "${monsterName}"
359
- - description to "${monsterLore}"
360
- - tier to "${tier}"
361
  Base the HP, defence, attack, and speed stats on the tier level:
362
  - low: stats should be 10-40
363
  - medium: stats should be 30-60
@@ -407,7 +396,7 @@ Write your response within \`\`\`json\`\`\``;
407
  const parsedStats = JSON.parse(cleanJson.trim());
408
 
409
  // Remove any extra fields not in our schema
410
- const allowedFields = ['name', 'description', 'tier', 'HP', 'defence', 'attack', 'speed',
411
  'specialPassiveTraitDescription', 'attackActionName', 'attackActionDescription',
412
  'buffActionName', 'buffActionDescription', 'debuffActionName', 'debuffActionDescription',
413
  'specialActionName', 'specialActionDescription', 'boostActionName', 'boostActionDescription',
@@ -419,6 +408,11 @@ Write your response within \`\`\`json\`\`\``;
419
  }
420
  }
421
 
 
 
 
 
 
422
  // Ensure numeric fields are actually numbers
423
  const numericFields = ['HP', 'defence', 'attack', 'speed'];
424
 
 
320
  const loreMatch = state.monsterConcept.match(/## Monster Lore\s*\n([\s\S]*?)(?=##|$)/);
321
  const monsterLore = loreMatch ? loreMatch[1].trim() : '';
322
 
323
+ // Create stats prompt - only ask for battle-related stats
324
+ const statsPrompt = `Based on this monster concept, generate a JSON object with battle stats and abilities:
325
  "${state.monsterConcept}"
326
 
 
 
 
 
327
  The output should be formatted as a JSON instance that conforms to the JSON schema below.
328
 
329
  \`\`\`json
330
  {
331
  "properties": {
 
 
 
332
  "HP": {"type": "integer", "minimum": 0, "maximum": 100, "description": "Health/vitality stat (0=fragile, 100=incredibly tanky)"},
333
  "defence": {"type": "integer", "minimum": 0, "maximum": 100, "description": "Defensive/armor stat (0=paper thin, 100=impenetrable fortress)"},
334
  "attack": {"type": "integer", "minimum": 0, "maximum": 100, "description": "Physical attack power (0=harmless, 100=devastating force)"},
 
343
  "specialActionName": {"type": "string", "description": "Name of the monster's ultimate move (one use per battle)"},
344
  "specialActionDescription": {"type": "string", "description": "Describe this powerful finishing move and its dramatic effects in battle"}
345
  },
346
+ "required": ["HP", "defence", "attack", "speed", "specialPassiveTraitDescription", "attackActionName", "attackActionDescription", "buffActionName", "buffActionDescription", "debuffActionName", "debuffActionDescription", "specialActionName", "specialActionDescription"]
347
  }
348
  \`\`\`
349
 
 
 
 
 
350
  Base the HP, defence, attack, and speed stats on the tier level:
351
  - low: stats should be 10-40
352
  - medium: stats should be 30-60
 
396
  const parsedStats = JSON.parse(cleanJson.trim());
397
 
398
  // Remove any extra fields not in our schema
399
+ const allowedFields = ['HP', 'defence', 'attack', 'speed',
400
  'specialPassiveTraitDescription', 'attackActionName', 'attackActionDescription',
401
  'buffActionName', 'buffActionDescription', 'debuffActionName', 'debuffActionDescription',
402
  'specialActionName', 'specialActionDescription', 'boostActionName', 'boostActionDescription',
 
408
  }
409
  }
410
 
411
+ // Add the name, description, and tier that we already extracted
412
+ parsedStats.name = monsterName;
413
+ parsedStats.description = monsterLore;
414
+ parsedStats.tier = tier;
415
+
416
  // Ensure numeric fields are actually numbers
417
  const numericFields = ['HP', 'defence', 'attack', 'speed'];
418