# Enemy Character Creation System This system provides a streamlined workflow for creating new enemy characters in your RPG game, similar to the weapon creation system but specifically designed for enemies. ## Overview The enemy creation system consists of: - **EnemyCharacterData**: ScriptableObject assets that define enemy stats and behavior - **Enemy Creator Window**: Unity Editor window for managing enemy creation - **Auto-Generated Scripts**: Character classes automatically generated from the data ## How to Use ### Method 1: Unity Menu (Recommended) 1. Right-click in Project window 2. Go to **Create > RPG > Characters > Enemy** 3. Name your enemy data asset (e.g., "SkeletonWarrior") 4. Configure the enemy in the Inspector 5. Right-click the asset and select **RPG > Generate Enemy Character Script** ### Method 2: Enemy Creator Window 1. Go to **RPG > Characters > Enemy Creator Window** 2. Click "Create New Enemy Data Asset" or select existing one 3. Configure settings in the Inspector 4. Click "Generate Enemy Character Script" in the window ### Method 3: Batch Generation 1. Create multiple enemy data assets 2. Go to **RPG > Characters > Batch Generate All Enemy Scripts** 3. All enemy scripts will be generated at once ## Configuration Options ### Basic Info - **Enemy Name**: Display name (e.g., "Skeleton Warrior") - **Description**: Flavor text for the enemy - **Enemy Sprite**: 2D sprite representation ### Core Stats (Based on SkeletonCharacter.cs) - **Max Health**: Hit points (1-100) - **Attack**: Base attack value (1-30) - **Constitution**: Physical resilience (1-30) - **Dexterity**: Speed and agility (1-30) - **Wisdom**: Mental acuity (1-30) ### Combat Modifiers - **Init Modifier**: Initiative bonus/penalty (-10 to +10) - **Damage Modifier**: Damage bonus/penalty (-10 to +10) - **Spell Modifier**: Spell casting bonus/penalty (-10 to +10) - **Movement Speed**: Movement range (1-50) - **Armor Class**: Defense rating (1-30) ### Weapon Configuration - **Preferred Weapon Type**: Sword, Bow, Staff, Dagger, Axe, Mace - **Weapon Prefab**: Optional specific weapon prefab - **Arrow Prefab**: For ranged enemies ### AI & Behavior - **Aggressiveness**: How likely to attack vs defend (0-1) - **Threat Level**: For encounter balancing (1-10) ### Rewards - **Gold Reward**: Gold dropped when defeated - **Experience Reward**: XP awarded to player - **Drop Table**: Items that can be dropped ### Special Abilities - **Can Cast Spells**: Enable spell casting - **Has Ranged Attack**: Enable ranged attacks - **Can Fly**: Enable flight movement - **Regenerates Health**: Enable health regeneration - **Health Regen Per Turn**: Amount healed per turn ## Generated Scripts Generated enemy scripts include: - Complete character class inheriting from `Character` - Proper stat initialization based on your configuration - Weapon creation logic based on preferred weapon type - Reward and threat level methods - Comments indicating special abilities ### Example Generated Class ```csharp public class SkeletonWarriorCharacter : Character { protected override void InitializeStats() { MaxHealth = 10; CurrentHealth = MaxHealth; Attack = 8; // ... all other stats } public override Character Spawn(int count) { name = "Skeleton Warrior"; CharacterName = "Skeleton Warrior"; // Handle multiple spawns return this; } // Weapon creation and other methods... } ``` ## Integration with Travel Events The **spawn settings** (group size, biome preferences, encounter frequency) are now handled by the **Travel Event system** instead of individual enemy data. This provides better separation of concerns: - **Enemy Data**: Focuses on individual enemy stats, abilities, and rewards - **Travel Events**: Handles when, where, and how many enemies spawn ### Travel Event Configuration ```csharp // In your travel events public int minEnemies = 1; // Group size controlled here public int maxEnemies = 3; public float forestChance = 0.8f; // Biome preferences here public EnemyCharacterData[] possibleEnemies; // Reference to enemy data ``` Generated enemies can be easily used with the travel event system: ```csharp // In your travel events battleData.enemyType = "SkeletonWarrior"; battleData.enemyCount = 2; ``` ## File Locations - **Enemy Data Assets**: `Assets/Scripts/Characters/Enemies/` - **Generated Scripts**: `Assets/Scripts/Characters/Enemies/Generated/` - **Editor Scripts**: `Assets/Scripts/Editor/` ## Tips 1. **Start with Examples**: Use the provided SkeletonWarrior, GoblinScout, and ForestTroll as templates 2. **Consistent Naming**: Use clear, descriptive names for easy identification 3. **Balance Stats**: Consider threat level when setting stats and rewards 4. **Test Generated Scripts**: Always test generated enemies in battle scenarios 5. **Backup Data**: Keep your enemy data assets in version control ## Extending the System To add new features: 1. Add fields to `EnemyCharacterData.cs` 2. Update the `GenerateCharacterScript()` method 3. Modify the editor window if needed 4. Test with existing enemies ## Troubleshooting **Script won't generate**: Check that output folder exists and is writable **Compilation errors**: Ensure all referenced types (WeaponType, BiomeType) exist **Missing menu items**: Confirm editor scripts are in an Editor folder ## Examples Included - **SkeletonWarrior**: Ranged archer with moderate stats - **GoblinScout**: Fast, aggressive melee fighter - **ForestTroll**: Tanky regenerating boss-type enemy