| 123 | } |
| 124 | |
| 125 | export async function generateCreature(contributions: number) { |
| 126 | const result = await generateObject({ |
| 127 | model: "google/gemini-2.5-flash", |
| 128 | schema: z.object({ |
| 129 | name: z.string(), |
| 130 | description: z.string(), |
| 131 | imagePrompt: z.string(), |
| 132 | powerLevel: z.number(), |
| 133 | }), |
| 134 | prompt: ` |
| 135 | Generate a fantasy creature based on a GitHub user's contributions. Use the following rules: |
| 136 | |
| 137 | Contributions: ${contributions} |
| 138 | |
| 139 | Contributions determine base tier / strength: |
| 140 | |
| 141 | Instead of using generic examples, select an appropriate creature from the D&D 5e Monster Manual based on Challenge Rating (CR). |
| 142 | - Pick a Monster Manual creature whose CR falls in the tier’s CR band. |
| 143 | - The visual power should clearly match the tier. |
| 144 | - You may add original cosmetic details (scars, armor style, aura, environment) to fit the fantasy vibe. |
| 145 | |
| 146 | Anti-repetition / randomness rules (CRITICAL): |
| 147 | - Do NOT default to the same "iconic" monster for the tier. |
| 148 | - Always pick a DIFFERENT Monster Manual creature each time you run this prompt, even if the inputs are identical. |
| 149 | - Before deciding, silently list 12 valid Monster Manual candidates in the tier's CR band, then choose ONE uniformly at random from that list. |
| 150 | - If you are unsure of a monster's CR, discard it and choose a different Monster Manual creature whose CR you are confident is within band. |
| 151 | - Prioritize variety across monster types: beasts, undead, fiends, constructs, humanoids, monstrosities, oozes, elementals, giants, etc. |
| 152 | |
| 153 | Contribution tier → suggested CR band: |
| 154 | - 0–49 contributions: CR 0 (harmless/vermin-tier) |
| 155 | - 50–150 contributions: CR 1/8–1/4 (minor threats) |
| 156 | - 151–300 contributions: CR 1/2–1 (trained/low-tier combatants) |
| 157 | - 301–750 contributions: CR 2–4 (dangerous but grounded threats) |
| 158 | - 751–1500 contributions: CR 5–7 (notable foes; clearly deadly) |
| 159 | - 1501–2500 contributions: CR 8–10 (heroic-level threats) |
| 160 | - 2501–4000 contributions: CR 11–13 (elite threats; battlefield-warping) |
| 161 | - 4001–5000 contributions: CR 14–17 (legendary threats; apex monsters) |
| 162 | - 5001+ contributions: CR 18–30 (mythic-scale; world-ending) |
| 163 | |
| 164 | Followers increase chance the creature is a commander / leader: |
| 165 | * 0–99 followers: Most creatures are solo or minor; very small chance of being a commander |
| 166 | * 100–499 followers: Moderate chance of being a squad leader, pack alpha, or small commander |
| 167 | * 500–999 followers: High chance of being a commander, captain, or elite leader |
| 168 | * 1000+ followers: Very high chance of being a legendary commander, general, or godlike leader |
| 169 | |
| 170 | Stars increase chance the creature has magical or supernatural abilities: |
| 171 | * 0–49 stars: Mostly natural abilities; minor magic possible |
| 172 | * 50–199 stars: Moderate chance of magical abilities (fire, ice, elemental skills) |
| 173 | * 200–499 stars: High chance of strong magical powers (arcane, necromancy, elemental mastery) |
| 174 | * 1000+ stars: Very high chance of unique, godlike magical abilities (reality-warping, ancient spells, legendary artifacts) |
| 175 | |
| 176 | Power level is a number between 1 and 10, based on the CR band. |
| 177 | |
| 178 | Visual Power Scaling Rules: |
| 179 | |
| 180 | Creature size, armor, weapons, wings, horns, glow, and environment must scale with tier |
| 181 | Weak creatures should: |
| 182 | - Look injured, starving, cursed, or malformed |