File size: 26,154 Bytes
409063d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
import random
from typing import Dict, List, Any, Optional

# ===== DATA BANKS =====

RACES = ["Human", "Elf", "Dwarf", "Halfling", "Dragonborn", "Gnome", "Half-Elf", "Half-Orc", "Tiefling"]
CLASSES = ["Fighter", "Wizard", "Rogue", "Cleric", "Ranger", "Paladin", "Barbarian", "Bard", "Druid", "Monk", "Sorcerer", "Warlock"]
ALIGNMENTS = ["Lawful Good", "Neutral Good", "Chaotic Good", "Lawful Neutral", "True Neutral", "Chaotic Neutral", "Lawful Evil", "Neutral Evil", "Chaotic Evil"]
BACKGROUNDS = ["Acolyte", "Criminal", "Folk Hero", "Noble", "Sage", "Soldier", "Charlatan", "Entertainer", "Guild Artisan", "Hermit", "Outlander", "Sailor"]

PERSONALITY_TRAITS = [
    "I always have a plan for what to do when things go wrong",
    "I am always calm, no matter what the situation", 
    "I would rather make a new friend than a new enemy",
    "I have a strong sense of fair play and always try to find the most equitable solution",
    "I'm confident in my own abilities and do what I can to instill confidence in others"
]

IDEALS = [
    "Respect. People deserve to be treated with dignity and respect",
    "Fairness. No one should get preferential treatment before the law",
    "Freedom. Chains are meant to be broken, as are those who would forge them",
    "Might. The strongest are meant to rule",
    "Sincerity. There's no good in pretending to be something I'm not"
]

BONDS = [
    "I would die to recover an ancient relic that was stolen from my temple",
    "Someone I loved died because of a mistake I made",
    "I owe my life to the priest who took me in when my parents died",
    "Everything I do is for the common people",
    "I will face any challenge to win the approval of my family"
]

FLAWS = [
    "I turn tail and run when things look bad",
    "I have a 'tell' that reveals when I'm lying",
    "I can't keep a secret to save my life",
    "I'm too greedy for my own good",
    "I can't resist a pretty face"
]

OCCUPATIONS = [
    "Merchant", "Guard", "Innkeeper", "Blacksmith", "Priest", "Noble", "Farmer", 
    "Scholar", "Thief", "Soldier", "Alchemist", "Baker", "Carpenter", "Hunter"
]

MOTIVATIONS = [
    "Seeking wealth and power", "Protecting their family", "Serving their god", "Pursuing knowledge",
    "Seeking revenge", "Finding love", "Escaping their past", "Gaining recognition"
]

SECRETS = [
    "Is actually a spy for a rival faction", "Has a hidden magical talent", "Is fleeing from a dark past",
    "Is secretly in love with someone inappropriate", "Has a gambling addiction", "Is being blackmailed"
]

ITEM_TYPES = {
    "Weapon": ["Sword", "Axe", "Bow", "Dagger", "Mace", "Spear", "Crossbow", "Warhammer"],
    "Armor": ["Chain Mail", "Plate Armor", "Leather Armor", "Scale Mail", "Hide Armor"],
    "Shield": ["Round Shield", "Tower Shield", "Buckler", "Kite Shield"],
    "Accessory": ["Ring", "Amulet", "Cloak", "Belt", "Bracers", "Crown", "Boots"],
    "Consumable": ["Potion", "Scroll", "Oil", "Poison", "Bomb", "Elixir"],
    "Tool": ["Lockpicks", "Rope", "Lantern", "Compass", "Spyglass", "Hammer"],
    "Treasure": ["Gem", "Coins", "Art Object", "Jewelry", "Statue", "Book"]
}

MAGICAL_PROPERTIES = [
    "+1 to attack and damage rolls", "Resistance to fire damage", "Advantage on stealth checks",
    "Cast a spell once per day", "Glows in the presence of evil", "Never breaks or dulls",
    "Returns when thrown", "Speaks telepathically", "Changes color based on emotion"
]

LOCATION_TYPES = {
    "City": ["Metropolis", "Trading Hub", "Capital", "Port City", "Fortress City"],
    "Village": ["Farming Village", "Mining Town", "Fishing Village", "Trading Post"],
    "Dungeon": ["Ancient Tomb", "Underground Lair", "Ruined Tower", "Cave System"],
    "Castle": ["Royal Castle", "Fortress", "Ruined Keep", "Wizard's Tower"],
    "Forest": ["Ancient Woods", "Dark Forest", "Enchanted Grove", "Sacred Grove"],
    "Temple": ["Cathedral", "Shrine", "Monastery", "Sacred Site"],
    "Tavern": ["Roadside Inn", "City Tavern", "Adventurer's Rest", "Noble's Club"]
}

FACTION_TYPES = {
    "Guild": ["Merchant Guild", "Thieves Guild", "Artisan Guild", "Adventurer's Guild"],
    "Religious Order": ["Temple", "Monastery", "Cult", "Holy Order"],
    "Military": ["Army", "Guard", "Mercenaries", "Knights"],
    "Criminal": ["Thieves", "Smugglers", "Assassins", "Pirates"],
    "Political": ["Royal Court", "City Council", "Rebels", "Loyalists"],
    "Academic": ["University", "Research Group", "Library", "School"]
}

DEITY_DOMAINS = {
    "War": ["Battle", "Strategy", "Conquest", "Honor"],
    "Knowledge": ["Wisdom", "Learning", "Magic", "Secrets"],
    "Life": ["Healing", "Growth", "Birth", "Protection"],
    "Death": ["Endings", "Judgment", "Undeath", "Graves"],
    "Nature": ["Animals", "Plants", "Seasons", "Weather"],
    "Light": ["Sun", "Dawn", "Hope", "Renewal"],
    "Trickery": ["Deception", "Theft", "Luck", "Mischief"]
}

# ===== MAIN GENERATION FUNCTIONS =====

def generate_character(name: str = "", race: str = "Random", char_class: str = "Random", 
                      level: int = 5, alignment: str = "Random") -> Dict[str, Any]:
    """Generate a complete D&D character"""
    
    if not name:
        name = generate_fantasy_name()
    if race == "Random":
        race = random.choice(RACES)
    if char_class == "Random":
        char_class = random.choice(CLASSES)
    if alignment == "Random":
        alignment = random.choice(ALIGNMENTS)
    
    background = random.choice(BACKGROUNDS)
    personality = random.choice(PERSONALITY_TRAITS)
    ideal = random.choice(IDEALS)
    bond = random.choice(BONDS)
    flaw = random.choice(FLAWS)
    appearance = generate_appearance(race)
    equipment = generate_class_equipment(char_class, level)
    backstory = generate_backstory(name, race, char_class, background)
    hooks = generate_adventure_hooks(name, background)
    
    return {
        "name": name,
        "race": race,
        "character_class": char_class,
        "level": level,
        "alignment": alignment,
        "background": background,
        "personality": personality,
        "ideal": ideal,
        "bond": bond,
        "flaw": flaw,
        "appearance": appearance,
        "equipment": equipment,
        "backstory": backstory,
        "hooks": hooks
    }

def generate_npc(name: str = "", race: str = "Random", occupation: str = "Random",
                location: str = "", relationship: str = "Neutral") -> Dict[str, Any]:
    """Generate a detailed NPC"""
    
    if not name:
        name = generate_fantasy_name()
    if race == "Random":
        race = random.choice(RACES)
    if occupation == "Random":
        occupation = random.choice(OCCUPATIONS)
    
    alignment = random.choice(ALIGNMENTS)
    personality = random.choice(PERSONALITY_TRAITS)
    appearance = generate_appearance(race)
    motivation = random.choice(MOTIVATIONS)
    secret = random.choice(SECRETS)
    relationships = generate_relationships(name, occupation)
    
    return {
        "name": name,
        "race": race,
        "occupation": occupation,
        "alignment": alignment,
        "personality": personality,
        "appearance": appearance,
        "motivation": motivation,
        "secret": secret,
        "relationships": relationships,
        "location": location or "Unknown",
        "relationship_to_party": relationship
    }

def generate_item(name: str = "", item_type: str = "Random", rarity: str = "Random",
                 magical: bool = True, cursed: bool = False) -> Dict[str, Any]:
    """Generate a magical or mundane item"""
    
    if item_type == "Random":
        item_type = random.choice(list(ITEM_TYPES.keys()))
    
    if not name:
        base_item = random.choice(ITEM_TYPES[item_type])
        name = generate_item_name(base_item, magical)
    
    if rarity == "Random":
        rarity = random.choice(["Common", "Uncommon", "Rare", "Very Rare", "Legendary"])
    
    description = generate_item_description(name, item_type, magical)
    properties = []
    
    if magical:
        num_properties = {"Common": 1, "Uncommon": 1, "Rare": 2, "Very Rare": 3, "Legendary": 4}.get(rarity, 1)
        properties = random.sample(MAGICAL_PROPERTIES, min(num_properties, len(MAGICAL_PROPERTIES)))
    
    if cursed:
        properties.append(generate_curse())
    
    base_values = {"Common": 50, "Uncommon": 500, "Rare": 5000, "Very Rare": 50000, "Legendary": 500000}
    value = f"{base_values.get(rarity, 50):,} gp"
    
    requirements = "Attunement" if rarity in ["Rare", "Very Rare", "Legendary"] and magical else "None"
    
    return {
        "name": name,
        "item_type": item_type,
        "rarity": rarity,
        "description": description,
        "properties": properties,
        "value": value,
        "requirements": requirements,
        "magical": magical,
        "cursed": cursed
    }

def generate_location(name: str = "", loc_type: str = "Random", size: str = "Medium",
                     danger_level: str = "Moderate", theme: str = "Standard Fantasy") -> Dict[str, Any]:
    """Generate a detailed location"""
    
    if loc_type == "Random":
        loc_type = random.choice(list(LOCATION_TYPES.keys()))
    
    if not name:
        subtype = random.choice(LOCATION_TYPES[loc_type])
        name = generate_location_name(subtype)
    
    description = generate_location_description(name, loc_type, size, theme)
    inhabitants = generate_inhabitants(loc_type, size)
    features = generate_location_features(loc_type)
    dangers = generate_location_dangers(danger_level)
    treasures = generate_location_treasures(danger_level)
    atmosphere = generate_atmosphere(loc_type, theme)
    
    return {
        "name": name,
        "location_type": loc_type,
        "size": size,
        "danger_level": danger_level,
        "theme": theme,
        "description": description,
        "inhabitants": inhabitants,
        "features": features,
        "dangers": dangers,
        "treasures": treasures,
        "atmosphere": atmosphere
    }

def generate_faction(name: str = "", faction_type: str = "Random", alignment: str = "Random",
                    size: str = "Medium", influence: str = "Regional") -> Dict[str, Any]:
    """Generate a detailed faction"""
    
    if faction_type == "Random":
        faction_type = random.choice(list(FACTION_TYPES.keys()))
    
    if not name:
        subtype = random.choice(FACTION_TYPES[faction_type])
        name = generate_faction_name(subtype)
    
    if alignment == "Random":
        alignment = random.choice(ALIGNMENTS)
    
    goals = generate_faction_goals(faction_type)
    methods = generate_faction_methods(alignment)
    resources = generate_faction_resources(size)
    enemies = generate_faction_enemies(faction_type)
    allies = generate_faction_allies(faction_type)
    headquarters = generate_faction_headquarters(faction_type)
    
    return {
        "name": name,
        "faction_type": faction_type,
        "alignment": alignment,
        "size": size,
        "influence": influence,
        "goals": goals,
        "methods": methods,
        "resources": resources,
        "enemies": enemies,
        "allies": allies,
        "headquarters": headquarters
    }

def generate_deity(name: str = "", domain: str = "Random", alignment: str = "Random",
                  pantheon: str = "Generic Fantasy", power_level: str = "Intermediate") -> Dict[str, Any]:
    """Generate a detailed deity"""
    
    if domain == "Random":
        domain = random.choice(list(DEITY_DOMAINS.keys()))
    
    if not name:
        name = generate_deity_name(domain, pantheon)
    
    if alignment == "Random":
        alignment = random.choice(ALIGNMENTS)
    
    appearance = generate_deity_appearance(domain, alignment)
    personality = generate_deity_personality(domain)
    portfolio = random.sample(DEITY_DOMAINS[domain], min(3, len(DEITY_DOMAINS[domain])))
    worshippers = generate_deity_worshippers(domain)
    temples = generate_deity_temples(power_level)
    holy_symbol = generate_holy_symbol(domain)
    
    return {
        "name": name,
        "domain": domain,
        "alignment": alignment,
        "pantheon": pantheon,
        "power_level": power_level,
        "appearance": appearance,
        "personality": personality,
        "portfolio": portfolio,
        "worshippers": worshippers,
        "temples": temples,
        "holy_symbol": holy_symbol
    }

def generate_scenario(title: str = "", scenario_type: str = "Random", level: str = "Medium",
                     duration: str = "Medium (2-3 hours)", setting: str = "Mixed") -> Dict[str, Any]:
    """Generate a detailed scenario/adventure"""
    
    scenario_types = ["Combat Encounter", "Social Encounter", "Exploration", "Mystery", 
                      "Heist", "Rescue", "Dungeon Crawl", "Political Intrigue"]
    
    if scenario_type == "Random":
        scenario_type = random.choice(scenario_types)
    
    if not title:
        title = generate_scenario_title(scenario_type)
    
    description = generate_scenario_description(title, scenario_type, setting)
    objective = generate_scenario_objective(scenario_type)
    complications = generate_scenario_complications(level)
    npcs_involved = generate_scenario_npcs(scenario_type)
    locations = generate_scenario_locations(setting)
    rewards = generate_scenario_rewards(level)
    hooks = generate_scenario_hooks(scenario_type, title)
    
    return {
        "title": title,
        "scenario_type": scenario_type,
        "difficulty_level": level,
        "duration": duration,
        "setting": setting,
        "description": description,
        "objective": objective,
        "complications": complications,
        "npcs_involved": npcs_involved,
        "locations": locations,
        "rewards": rewards,
        "hooks": hooks
    }

# ===== HELPER FUNCTIONS =====

def generate_fantasy_name() -> str:
    """Generate a random fantasy name"""
    prefixes = ["Ar", "El", "Gal", "Mor", "Sil", "Tha", "Val", "Zar"]
    middles = ["and", "eth", "dor", "wen", "ion", "las", "mir", "nal"]
    suffixes = ["iel", "wen", "dil", "las", "mir", "nal", "oth", "ril"]
    
    return random.choice(prefixes) + random.choice(middles) + random.choice(suffixes)

def generate_appearance(race: str) -> str:
    """Generate physical appearance based on race"""
    appearances = {
        "Human": "tall and sturdy with kind eyes",
        "Elf": "tall and graceful with ethereal beauty",
        "Dwarf": "short and stocky with a braided beard",
        "Halfling": "small and cheerful with curly hair",
        "Dragonborn": "scaled skin with draconic features",
        "Tiefling": "demonic horns with exotic features"
    }
    
    return appearances.get(race, "distinctive appearance")

def generate_class_equipment(char_class: str, level: int) -> List[str]:
    """Generate equipment based on class"""
    base_equipment = {
        "Fighter": ["Sword", "Shield", "Armor"],
        "Wizard": ["Spellbook", "Staff", "Robes"],
        "Rogue": ["Daggers", "Thieves' Tools", "Leather Armor"],
        "Cleric": ["Mace", "Shield", "Holy Symbol"],
        "Ranger": ["Bow", "Arrows", "Survival Gear"]
    }
    
    equipment = base_equipment.get(char_class, ["Basic Gear"])
    
    if level > 5:
        equipment.append("Magic Item")
    
    return equipment

def generate_backstory(name: str, race: str, char_class: str, background: str) -> str:
    """Generate character backstory"""
    return f"{name} grew up as a {background.lower()} among the {race.lower()} people, drawn to the path of the {char_class.lower()}."

def generate_adventure_hooks(name: str, background: str) -> List[str]:
    """Generate adventure hooks"""
    return [
        f"{name}'s {background.lower()} background connects to this adventure",
        f"An old contact needs {name}'s help",
        f"The character's past comes back to haunt them"
    ]

def generate_item_name(base_item: str, magical: bool) -> str:
    """Generate item names"""
    if not magical:
        return base_item
    
    prefixes = ["Enchanted", "Mystic", "Ancient", "Blessed", "Legendary"]
    return f"{random.choice(prefixes)} {base_item}"

def generate_curse() -> str:
    """Generate item curse"""
    curses = [
        "Compels the wielder to attack allies",
        "Drains health slowly",
        "Causes the wielder to speak in riddles",
        "Makes the wielder tell the truth"
    ]
    return random.choice(curses)

def generate_item_description(name: str, item_type: str, magical: bool) -> str:
    """Generate item descriptions"""
    base = f"A well-crafted {item_type.lower()}"
    if magical:
        return f"{base} emanating with magical energy"
    return f"{base} of excellent quality"

def generate_location_name(subtype: str) -> str:
    """Generate location names"""
    prefixes = ["Ancient", "Lost", "Hidden", "Sacred", "Golden"]
    return f"{random.choice(prefixes)} {subtype}"

def generate_location_description(name: str, loc_type: str, size: str, theme: str) -> str:
    """Generate location descriptions"""
    return f"A {size.lower()} {loc_type.lower()} with {theme.lower()} characteristics"

def generate_inhabitants(loc_type: str, size: str) -> List[str]:
    """Generate location inhabitants"""
    base_inhabitants = {
        "City": ["Merchants", "Guards", "Nobles"],
        "Village": ["Farmers", "Blacksmith", "Elder"],
        "Dungeon": ["Monsters", "Undead", "Bandits"]
    }
    return base_inhabitants.get(loc_type, ["Various Creatures"])

def generate_location_features(loc_type: str) -> List[str]:
    """Generate location features"""
    return ["Notable landmark", "Gathering place", "Hidden area"]

def generate_location_dangers(danger_level: str) -> List[str]:
    """Generate location dangers"""
    dangers = {
        "Safe": ["Pickpockets", "Overpriced goods"],
        "Low": ["Wild animals", "Natural hazards"],
        "Moderate": ["Monsters", "Traps"],
        "High": ["Deadly creatures", "Curses"],
        "Extreme": ["Ancient evils", "Reality distortions"]
    }
    return dangers.get(danger_level, ["Unknown threats"])

def generate_location_treasures(danger_level: str) -> List[str]:
    """Generate location treasures"""
    treasures = {
        "Safe": ["Copper coins", "Common items"],
        "Moderate": ["Gold coins", "Rare items"],
        "Extreme": ["Legendary items", "Artifacts"]
    }
    return treasures.get(danger_level, ["Hidden treasures"])

def generate_atmosphere(loc_type: str, theme: str) -> str:
    """Generate atmospheric description"""
    return f"The air is thick with {random.choice(['mystery', 'tension', 'magic'])}"

def generate_relationships(name: str, occupation: str) -> List[str]:
    """Generate NPC relationships"""
    return [
        f"Knows the local {random.choice(['merchant', 'guard', 'priest'])}",
        f"Has connections to {random.choice(['traders', 'criminals', 'officials'])}",
        f"Family ties to nearby communities"
    ]

# Faction functions
def generate_faction_name(subtype: str) -> str:
    """Generate faction names"""
    prefixes = ["Order of the", "Brotherhood of", "Guild of"]
    themes = ["Silver Dawn", "Golden Eagle", "Iron Fist"]
    return f"{random.choice(prefixes)} {random.choice(themes)}"

def generate_faction_goals(faction_type: str) -> List[str]:
    """Generate faction goals"""
    goals = {
        "Guild": ["Increase profits", "Expand influence"],
        "Military": ["Defend territory", "Maintain order"],
        "Criminal": ["Control trade", "Eliminate rivals"]
    }
    return goals.get(faction_type, ["Gain power", "Protect interests"])

def generate_faction_methods(alignment: str) -> List[str]:
    """Generate faction methods"""
    if "Good" in alignment:
        return ["Diplomacy", "Charity", "Cooperation"]
    elif "Evil" in alignment:
        return ["Intimidation", "Corruption", "Violence"]
    else:
        return ["Politics", "Economics", "Information"]

def generate_faction_resources(size: str) -> List[str]:
    """Generate faction resources"""
    resources = {
        "Small": ["Limited funds", "Few contacts"],
        "Medium": ["Moderate wealth", "Local connections"],
        "Large": ["Significant wealth", "Regional network"],
        "Massive": ["Vast fortune", "International contacts"]
    }
    return resources.get(size, ["Basic resources"])

def generate_faction_enemies(faction_type: str) -> List[str]:
    """Generate faction enemies"""
    return [f"Rival {faction_type.lower()} groups", "Government opposition", "Ancient enemies"]

def generate_faction_allies(faction_type: str) -> List[str]:
    """Generate faction allies"""
    return [f"Friendly {faction_type.lower()} groups", "Sympathetic nobles", "Mercenary companies"]

def generate_faction_headquarters(faction_type: str) -> str:
    """Generate faction headquarters"""
    headquarters = {
        "Guild": "Guild Hall",
        "Military": "Fortress", 
        "Criminal": "Hidden Safehouse",
        "Religious Order": "Temple"
    }
    return headquarters.get(faction_type, "Secure Location")

# Deity functions
def generate_deity_name(domain: str, pantheon: str) -> str:
    """Generate deity names"""
    names = {
        "War": ["Valorian", "Marticus", "Bellona"],
        "Knowledge": ["Athenis", "Scholaris", "Wisdomia"],
        "Life": ["Vitalis", "Celestine", "Healara"]
    }
    return random.choice(names.get(domain, ["Divinus", "Godara", "Sanctus"]))

def generate_deity_appearance(domain: str, alignment: str) -> str:
    """Generate deity appearance"""
    appearances = {
        "War": "battle-scarred warrior in ornate armor",
        "Knowledge": "wise figure surrounded by floating books",
        "Life": "radiant being with healing aura"
    }
    return appearances.get(domain, "divine otherworldly presence")

def generate_deity_personality(domain: str) -> str:
    """Generate deity personality"""
    personalities = {
        "War": "Strategic and honorable, values courage",
        "Knowledge": "Wise and patient, values learning",
        "Life": "Nurturing and protective, values growth"
    }
    return personalities.get(domain, "Mysterious and powerful")

def generate_deity_worshippers(domain: str) -> List[str]:
    """Generate deity worshippers"""
    worshippers = {
        "War": ["Soldiers", "Warriors", "Generals"],
        "Knowledge": ["Scholars", "Wizards", "Students"],
        "Life": ["Healers", "Farmers", "Clerics"]
    }
    return worshippers.get(domain, ["Various followers"])

def generate_deity_temples(power_level: str) -> str:
    """Generate deity temples"""
    temples = {
        "Lesser": "Small local shrines",
        "Intermediate": "Regional temples with clergy",
        "Greater": "Grand cathedrals and pilgrimage sites"
    }
    return temples.get(power_level, "Modest temples")

def generate_holy_symbol(domain: str) -> str:
    """Generate holy symbols"""
    symbols = {
        "War": "Crossed swords",
        "Knowledge": "Open book with eye",
        "Life": "Tree of life"
    }
    return symbols.get(domain, "Sacred emblem")

# Scenario functions
def generate_scenario_title(scenario_type: str) -> str:
    """Generate scenario titles"""
    titles = {
        "Combat Encounter": ["The Bandit Ambush", "Goblin Raid", "Dragon's Lair"],
        "Social Encounter": ["The Noble's Feast", "Tavern Negotiations", "Court Intrigue"],
        "Mystery": ["The Missing Merchant", "Murder at the Inn", "The Cursed Artifact"]
    }
    return random.choice(titles.get(scenario_type, ["The Unknown Adventure"]))

def generate_scenario_description(title: str, scenario_type: str, setting: str) -> str:
    """Generate scenario descriptions"""
    return f"In this {scenario_type.lower()}, the party must deal with {title.lower()} in a {setting.lower()} environment"

def generate_scenario_objective(scenario_type: str) -> str:
    """Generate scenario objectives"""
    objectives = {
        "Combat Encounter": "Defeat the hostile creatures",
        "Social Encounter": "Navigate complex social dynamics",
        "Mystery": "Solve the central mystery"
    }
    return objectives.get(scenario_type, "Complete the adventure successfully")

def generate_scenario_complications(level: str) -> List[str]:
    """Generate scenario complications"""
    complications = {
        "Easy": ["Minor obstacles", "Simple challenges"],
        "Medium": ["Competing factions", "Hidden enemies"],
        "Hard": ["Powerful adversaries", "Complex puzzles"],
        "Deadly": ["Overwhelming odds", "Reality-threatening consequences"]
    }
    return complications.get(level, ["Unexpected challenges"])

def generate_scenario_npcs(scenario_type: str) -> List[str]:
    """Generate scenario NPCs"""
    npcs = {
        "Combat Encounter": ["Enemy Leader", "Local Guard"],
        "Social Encounter": ["Influential Noble", "Wise Elder"],
        "Mystery": ["Prime Suspect", "Key Witness"]
    }
    return npcs.get(scenario_type, ["Important NPC"])

def generate_scenario_locations(setting: str) -> List[str]:
    """Generate scenario locations"""
    locations = {
        "Urban": ["City Square", "Noble District", "Marketplace"],
        "Wilderness": ["Forest Clearing", "Mountain Pass", "Cave"],
        "Mixed": ["Village Center", "Roadside Inn", "Ancient Shrine"]
    }
    return locations.get(setting, ["Notable Location"])

def generate_scenario_rewards(level: str) -> List[str]:
    """Generate scenario rewards"""
    rewards = {
        "Easy": ["50-100 gold", "Common magic item"],
        "Medium": ["200-500 gold", "Uncommon magic item"],
        "Hard": ["1000+ gold", "Rare magic item"],
        "Deadly": ["5000+ gold", "Very rare magic item"]
    }
    return rewards.get(level, ["Appropriate treasure"])

def generate_scenario_hooks(scenario_type: str, title: str) -> List[str]:
    """Generate scenario hooks"""
    return [
        f"A messenger arrives seeking help with {title.lower()}",
        f"The party overhears rumors about {title.lower()}",
        f"An old contact asks for help investigating {title.lower()}"
    ]