Ver Fonte

Using movementSpeed in BattleScene

Axel Nordh há 8 meses atrás
pai
commit
f612b90f65

+ 1 - 19
Assets/Resources/UI/BattleSceneUI/PostBattleLootScreen.uxml

@@ -1,59 +1,41 @@
 <ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
-    
-    <!-- Full Screen Overlay -->
+    <Style src="project://database/Assets/UI/BattleSceneUI/PostBattleLootScreen.uss?fileID=7433441132597879392&amp;guid=7e47da640c1bad6439fb34b904842245&amp;type=3#PostBattleLootScreen" />
     <ui:VisualElement name="LootScreenOverlay" class="loot-overlay">
-        <!-- Background Panel -->
         <ui:VisualElement name="LootScreenBackground" class="loot-background">
-            
-            <!-- Header Section -->
             <ui:VisualElement name="HeaderSection" class="header-section">
                 <ui:Label text="🏆 VICTORY! 🏆" display-tooltip-when-elided="true" name="VictoryTitle" class="victory-title" />
                 <ui:Label text="Collecting loot from defeated enemies..." display-tooltip-when-elided="true" name="VictorySubtitle" class="victory-subtitle" />
             </ui:VisualElement>
-            
-            <!-- Main Content Section -->
             <ui:VisualElement name="MainContent" class="main-content">
-                
-                <!-- Enemy Loot Section -->
                 <ui:VisualElement name="EnemyLootSection" class="enemy-loot-section">
                     <ui:Label text="Defeated Enemies" display-tooltip-when-elided="true" name="EnemyLootTitle" class="section-title" />
                     <ui:ScrollView name="EnemyLootContainer" class="enemy-loot-list" />
                 </ui:VisualElement>
-                
-                <!-- Total Rewards Section -->
                 <ui:VisualElement name="TotalRewardsSection" class="total-rewards-section">
                     <ui:Label text="Total Rewards" display-tooltip-when-elided="true" name="TotalRewardsTitle" class="section-title" />
-                    
-                    <!-- Currency Display -->
                     <ui:VisualElement name="CurrencyDisplay" class="currency-display">
                         <ui:VisualElement name="GoldDisplay" class="currency-item">
                             <ui:Label text="G" display-tooltip-when-elided="true" name="GoldIcon" class="currency-icon" />
                             <ui:Label text="0" display-tooltip-when-elided="true" name="GoldAmount" class="currency-amount" />
                             <ui:Label text="Gold" display-tooltip-when-elided="true" name="GoldLabel" class="currency-label" />
                         </ui:VisualElement>
-                        
                         <ui:VisualElement name="SilverDisplay" class="currency-item">
                             <ui:Label text="S" display-tooltip-when-elided="true" name="SilverIcon" class="currency-icon" />
                             <ui:Label text="0" display-tooltip-when-elided="true" name="SilverAmount" class="currency-amount" />
                             <ui:Label text="Silver" display-tooltip-when-elided="true" name="SilverLabel" class="currency-label" />
                         </ui:VisualElement>
-                        
                         <ui:VisualElement name="CopperDisplay" class="currency-item">
                             <ui:Label text="C" display-tooltip-when-elided="true" name="CopperIcon" class="currency-icon" />
                             <ui:Label text="0" display-tooltip-when-elided="true" name="CopperAmount" class="currency-amount" />
                             <ui:Label text="Copper" display-tooltip-when-elided="true" name="CopperLabel" class="currency-label" />
                         </ui:VisualElement>
                     </ui:VisualElement>
-                    
-                    <!-- Items Display -->
                     <ui:VisualElement name="ItemsDisplay" class="items-display">
                         <ui:Label text="Items Collected" display-tooltip-when-elided="true" name="ItemsTitle" class="items-title" />
                         <ui:ScrollView name="ItemsList" class="items-list" />
                     </ui:VisualElement>
                 </ui:VisualElement>
             </ui:VisualElement>
-            
-            <!-- Footer Section -->
             <ui:VisualElement name="FooterSection" class="footer-section">
                 <ui:Label text="Press SPACE to continue..." display-tooltip-when-elided="true" name="ContinuePrompt" class="continue-prompt" />
                 <ui:VisualElement name="ButtonContainer" class="button-container">

+ 26 - 0
Assets/Scripts/BattleScene/BattleSetup.cs

@@ -587,6 +587,19 @@ public class BattleSetup : MonoBehaviour
             if (agent != null)
             {
                 agent.enabled = true; // Re-enable NavMeshAgent
+
+                // Configure movement speed based on character's MovementSpeed stat
+                Character characterComponent = character.GetComponent<Character>();
+                if (characterComponent != null)
+                {
+                    // Convert character movement speed to NavMeshAgent speed
+                    // Base conversion: MovementSpeed 10 = 3.5 units/sec, scale from there
+                    agent.speed = (characterComponent.MovementSpeed / 10f) * 3.5f;
+                }
+                else
+                {
+                    agent.speed = 3.5f; // Default speed if no character component
+                }
             }
 
             // Add carry capacity system to player characters
@@ -602,6 +615,19 @@ public class BattleSetup : MonoBehaviour
             if (agent != null)
             {
                 agent.enabled = true; // Re-enable NavMeshAgent
+
+                // Configure movement speed based on character's MovementSpeed stat
+                Character characterComponent = character.GetComponent<Character>();
+                if (characterComponent != null)
+                {
+                    // Convert character movement speed to NavMeshAgent speed
+                    // Base conversion: MovementSpeed 10 = 3.5 units/sec, scale from there
+                    agent.speed = (characterComponent.MovementSpeed / 10f) * 3.5f;
+                }
+                else
+                {
+                    agent.speed = 3.5f; // Default speed if no character component
+                }
             }
 
             // Add carry capacity system to enemy characters too (for consistency)

+ 96 - 26
Assets/Scripts/BattleScene/BattleTestMode.cs

@@ -24,8 +24,8 @@ public class BattleTestMode : MonoBehaviour
     [Tooltip("Available weapon types for testing")]
     public string[] availableWeapons = { "Sword", "Bow", "Fists" };
 
-    [Tooltip("Player character names")]
-    public string[] playerNames = { "TestWarrior", "TestRanger", "TestMage", "TestRogue" };
+    [Tooltip("Player character names - Character 0: Fast (DEX:20→Speed:40), Character 1: Slow (DEX:4→Speed:25)")]
+    public string[] playerNames = { "FastRogue", "SlowTank", "TestMage", "TestRogue" };
 
     [Tooltip("Enemy character names")]
     public string[] enemyNames = { "TestSkeleton", "TestBandit", "TestOrc", "TestGoblin", "TestTroll", "TestSpider" };
@@ -33,6 +33,9 @@ public class BattleTestMode : MonoBehaviour
     [Header("Debug Settings")]
     public bool showDebugLogs = true;
 
+    [Tooltip("Force clear existing battle data and use test mode anyway")]
+    public bool forceClearExistingData = false;
+
     void Awake()
     {
         if (!enableTestMode)
@@ -42,6 +45,20 @@ public class BattleTestMode : MonoBehaviour
             return;
         }
 
+        if (showDebugLogs)
+        {
+            Debug.Log($"🧪 BattleTestMode: Current battle data - Players: {BattleSetupData.playerSelections.Count}, Enemies: {BattleSetupData.enemySelections.Count}");
+        }
+
+        // Force clear existing data if requested
+        if (forceClearExistingData)
+        {
+            if (showDebugLogs)
+                Debug.Log("🧪 BattleTestMode: Force clearing existing battle data");
+            BattleSetupData.playerSelections.Clear();
+            BattleSetupData.enemySelections.Clear();
+        }
+
         // Only activate test mode if there are no existing selections
         if (BattleSetupData.playerSelections.Count == 0 && BattleSetupData.enemySelections.Count == 0)
         {
@@ -50,13 +67,10 @@ public class BattleTestMode : MonoBehaviour
         else
         {
             if (showDebugLogs)
-                Debug.Log("🧪 BattleTestMode: Battle data already exists, skipping test mode");
+                Debug.Log($"🧪 BattleTestMode: Battle data already exists, skipping test mode. Players: {BattleSetupData.playerSelections.Count}, Enemies: {BattleSetupData.enemySelections.Count}");
         }
     }
 
-    /// <summary>
-    /// Create test battle data with predefined characters and enemies
-    /// </summary>
     void CreateTestBattleData()
     {
         if (showDebugLogs)
@@ -167,26 +181,8 @@ public class BattleTestMode : MonoBehaviour
             enemies = new List<CombatDataTransfer.EnemyCombatData>()
         };
 
-        // Create inventory data for each player
-        for (int i = 0; i < BattleSetupData.playerSelections.Count; i++)
-        {
-            var player = BattleSetupData.playerSelections[i];
-            var playerData = new CombatDataTransfer.TeamCharacterCombatData
-            {
-                characterName = player.characterName,
-                maxHealth = 20 + Random.Range(-5, 10),
-                currentHealth = 20 + Random.Range(-5, 10),
-                armorClass = 12,
-                equippedWeapon = player.weaponType,
-                strength = Random.Range(8, 16),
-                dexterity = Random.Range(8, 16),
-                constitution = Random.Range(8, 16),
-                wisdom = Random.Range(8, 16),
-                perception = Random.Range(8, 16),
-                miscItems = CreateBasicTestInventory(i)
-            };
-            sessionData.playerTeam.Add(playerData);
-        }
+        // Create specialized test characters with different movement speeds
+        CreateSpecializedTestCharacters(sessionData);
 
         // Create basic enemy data (no inventory needed for enemies)
         for (int i = 0; i < BattleSetupData.enemySelections.Count; i++)
@@ -211,6 +207,80 @@ public class BattleTestMode : MonoBehaviour
             Debug.Log($"🧪 Created basic inventory data for {sessionData.playerTeam.Count} players");
     }
 
+    /// <summary>
+    /// Create specialized test characters with different movement speeds and attributes
+    /// </summary>
+    void CreateSpecializedTestCharacters(CombatDataTransfer.CombatSessionData sessionData)
+    {
+        for (int i = 0; i < BattleSetupData.playerSelections.Count; i++)
+        {
+            var player = BattleSetupData.playerSelections[i];
+            CombatDataTransfer.TeamCharacterCombatData playerData;
+
+            // Create different character archetypes
+            switch (i)
+            {
+                case 0: // VERY Fast character - Extreme High Dexterity
+                    playerData = new CombatDataTransfer.TeamCharacterCombatData
+                    {
+                        characterName = player.characterName,
+                        maxHealth = 18,
+                        currentHealth = 18,
+                        armorClass = 13,
+                        equippedWeapon = player.weaponType,
+                        strength = 12,
+                        dexterity = 30, // Extreme High DEX = Very Fast movement (MovementSpeed = 30 + 20 = 50)
+                        constitution = 14,
+                        wisdom = 12,
+                        perception = 16,
+                        miscItems = CreateBasicTestInventory(i)
+                    };
+                    if (showDebugLogs)
+                        Debug.Log($"🧪 Created VERY FAST character: {player.characterName} - DEX:30 (Expected MovementSpeed: 50)");
+                    break;
+
+                case 1: // VERY Slow character - Extremely Low Dexterity
+                    playerData = new CombatDataTransfer.TeamCharacterCombatData
+                    {
+                        characterName = player.characterName,
+                        maxHealth = 25,
+                        currentHealth = 25,
+                        armorClass = 11,
+                        equippedWeapon = player.weaponType,
+                        strength = 16,
+                        dexterity = 1, // Very Low DEX = Slow movement (MovementSpeed = 30 + (-5) = 25)
+                        constitution = 16,
+                        wisdom = 14,
+                        perception = 10,
+                        miscItems = CreateBasicTestInventory(i)
+                    };
+                    if (showDebugLogs)
+                        Debug.Log($"🧪 Created VERY SLOW character: {player.characterName} - DEX:1 (Expected MovementSpeed: 25)");
+                    break;
+                default: // Balanced character for any additional characters
+                    playerData = new CombatDataTransfer.TeamCharacterCombatData
+                    {
+                        characterName = player.characterName,
+                        maxHealth = 22,
+                        currentHealth = 22,
+                        armorClass = 12,
+                        equippedWeapon = player.weaponType,
+                        strength = 14,
+                        dexterity = 14, // Average DEX = Average movement (MovementSpeed = 30 + 4*5 = 50)
+                        constitution = 14,
+                        wisdom = 12,
+                        perception = 12,
+                        miscItems = CreateBasicTestInventory(i)
+                    };
+                    if (showDebugLogs)
+                        Debug.Log($"🧪 Created BALANCED character: {player.characterName} - DEX:14 (Expected MovementSpeed: ~50)");
+                    break;
+            }
+
+            sessionData.playerTeam.Add(playerData);
+        }
+    }
+
     /// <summary>
     /// Create a basic test inventory with health potions and other items
     /// </summary>

+ 64 - 18
Assets/Scripts/BattleScene/EnhancedBattleTestMode.cs

@@ -50,7 +50,7 @@ public class EnhancedBattleTestMode : MonoBehaviour
     public bool showDebugLogs = true;
 
     // Test character names
-    private readonly string[] playerNames = { "TestHero", "TestRanger", "TestMage", "TestRogue" };
+    private readonly string[] playerNames = { "FastRogue", "SlowTank", "TestMage", "TestRogue" };
     private readonly string[] enemyNames = { "TestSkeleton", "TestBandit", "TestOrc", "TestGoblin", "TestTroll", "TestSpider" };
 
     void Awake()
@@ -141,25 +141,71 @@ public class EnhancedBattleTestMode : MonoBehaviour
         string playerName = index < playerNames.Length ? playerNames[index] : $"TestPlayer{index + 1}";
         WeaponItem weapon = GetRandomTestWeapon();
 
-        var playerData = new CombatDataTransfer.TeamCharacterCombatData
+        CombatDataTransfer.TeamCharacterCombatData playerData;
+
+        // Create different character archetypes with varying movement speeds
+        switch (index)
         {
-            characterName = playerName,
-            maxHealth = basePlayerHealth + Random.Range(-5, 10),
-            armorClass = baseArmorClass + Random.Range(-1, 3),
-            equippedWeapon = weapon?.itemName ?? "Sword",
-            equippedWeaponItem = weapon,
-            // Add some variety to stats
-            strength = Random.Range(8, 16),
-            dexterity = Random.Range(8, 16),
-            constitution = Random.Range(8, 16),
-            wisdom = Random.Range(8, 16),
-            perception = Random.Range(8, 16),
-            // Add test inventory items
-            miscItems = CreateTestInventory(index)
-        };
+            case 0: // Fast character - Very High Dexterity (Movement Speed ~45)
+                playerData = new CombatDataTransfer.TeamCharacterCombatData
+                {
+                    characterName = playerName,
+                    maxHealth = 18,
+                    currentHealth = 18,
+                    armorClass = 13,
+                    equippedWeapon = weapon?.itemName ?? "Sword",
+                    equippedWeaponItem = weapon,
+                    strength = 12,
+                    dexterity = 25, // Very High DEX = Very Fast movement (MovementSpeed = 30 + 15 = 45)
+                    constitution = 14,
+                    wisdom = 12,
+                    perception = 16,
+                    miscItems = CreateTestInventory(index)
+                };
+                if (showDebugLogs)
+                    Debug.Log($"🧪 Created FAST character: {playerName} - DEX:25 (Expected MovementSpeed: 45)");
+                break;
 
-        // Set current health to max health
-        playerData.currentHealth = playerData.maxHealth;
+            case 1: // Slow character - Very Low Dexterity (Movement Speed ~15)
+                playerData = new CombatDataTransfer.TeamCharacterCombatData
+                {
+                    characterName = playerName,
+                    maxHealth = 25,
+                    currentHealth = 25,
+                    armorClass = 11,
+                    equippedWeapon = weapon?.itemName ?? "Sword",
+                    equippedWeaponItem = weapon,
+                    strength = 16,
+                    dexterity = 1, // Very Low DEX = Very Slow movement (MovementSpeed = 30 + (-10) = 20, but formula should give us ~15)
+                    constitution = 16,
+                    wisdom = 14,
+                    perception = 10,
+                    miscItems = CreateTestInventory(index)
+                };
+                if (showDebugLogs)
+                    Debug.Log($"🧪 Created SLOW character: {playerName} - DEX:1 (Expected MovementSpeed: ~15)");
+                break;
+
+            default: // Balanced character for any additional characters
+                playerData = new CombatDataTransfer.TeamCharacterCombatData
+                {
+                    characterName = playerName,
+                    maxHealth = 22,
+                    currentHealth = 22,
+                    armorClass = 12,
+                    equippedWeapon = weapon?.itemName ?? "Sword",
+                    equippedWeaponItem = weapon,
+                    strength = 14,
+                    dexterity = 14, // Average DEX = Average movement (MovementSpeed = 30 + 4*5 = 50)
+                    constitution = 14,
+                    wisdom = 12,
+                    perception = 12,
+                    miscItems = CreateTestInventory(index)
+                };
+                if (showDebugLogs)
+                    Debug.Log($"🧪 Created BALANCED character: {playerName} - DEX:14 (Expected MovementSpeed: 50)");
+                break;
+        }
 
         if (showDebugLogs)
             Debug.Log($"🧪 Created test player: {playerName} (HP: {playerData.maxHealth}, AC: {playerData.armorClass}, Weapon: {playerData.equippedWeapon})");

+ 78 - 0
Assets/Scripts/BattleScene/GameManager.cs

@@ -676,6 +676,22 @@ public class GameManager : MonoBehaviour
                 float stoppingDistance = attackRange <= 2 ? 0.2f : Mathf.Max(0.5f, attackRange - 1.0f);
                 agent.stoppingDistance = stoppingDistance;
 
+                // Configure movement speed based on character's MovementSpeed stat
+                if (character != null)
+                {
+                    // Convert character movement speed to NavMeshAgent speed (HALVED for better gameplay)
+                    // Base conversion: MovementSpeed 10 = 1.75 units/sec, scale from there
+                    agent.speed = (character.MovementSpeed / 10f) * 1.75f;
+
+                    // Set high acceleration to reach max speed quickly
+                    agent.acceleration = agent.speed * 3.0f; // Reach max speed in ~0.33 seconds
+                }
+                else
+                {
+                    agent.speed = 1.75f; // Default speed if no character component (halved)
+                    agent.acceleration = 5.25f; // Default acceleration (halved)
+                }
+
                 // 
                 agent.obstacleAvoidanceType = ObstacleAvoidanceType.HighQualityObstacleAvoidance;
                 agent.avoidancePriority = UnityEngine.Random.Range(0, 100);
@@ -704,6 +720,25 @@ public class GameManager : MonoBehaviour
             NavMeshAgent agent = playerGO.GetComponent<NavMeshAgent>();
             if (agent != null)
             {
+                // Configure movement speed for pure movement actions based on character's MovementSpeed stat
+                Character character = playerGO.GetComponent<Character>();
+                if (character != null)
+                {
+                    // Convert character movement speed to NavMeshAgent speed (HALVED for better gameplay)
+                    // Base conversion: MovementSpeed 10 = 1.75 units/sec, scale from there
+                    agent.speed = (character.MovementSpeed / 10f) * 1.75f;
+
+                    // Set high acceleration to reach max speed quickly
+                    agent.acceleration = agent.speed * 3.0f; // Reach max speed in ~0.33 seconds
+                    Debug.Log($"🚀 MOVEMENT DEBUG - {character.CharacterName}: MovementSpeed={character.MovementSpeed}, AgentSpeed={agent.speed:F1}, Acceleration={agent.acceleration:F1}, TimeScale={Time.timeScale}");
+                }
+                else
+                {
+                    agent.speed = 1.75f; // Default speed if no character component (halved)
+                    agent.acceleration = 5.25f; // Default acceleration (halved)
+                    Debug.Log($"🚀 MOVEMENT DEBUG - {playerGO.name}: DEFAULT AgentSpeed={agent.speed:F1}, Acceleration={agent.acceleration:F1}, TimeScale={Time.timeScale}");
+                }
+
                 agent.SetDestination(targetPosition);
                 agent.isStopped = false;
 
@@ -822,6 +857,22 @@ public class GameManager : MonoBehaviour
                 Character character = actor.GetComponent<Character>();
                 float attackRange = character != null ? character.GetAttackRange() : 2.0f;
 
+                // Configure movement speed based on character's MovementSpeed stat
+                if (character != null)
+                {
+                    // Convert character movement speed to NavMeshAgent speed (HALVED for better gameplay)
+                    // Base conversion: MovementSpeed 10 = 1.75 units/sec, scale from there
+                    agent.speed = (character.MovementSpeed / 10f) * 1.75f;
+
+                    // Set high acceleration to reach max speed quickly
+                    agent.acceleration = agent.speed * 3.0f; // Reach max speed in ~0.33 seconds
+                }
+                else
+                {
+                    agent.speed = 1.75f; // Default speed if no character component (halved)
+                    agent.acceleration = 5.25f; // Default acceleration (halved)
+                }
+
                 // Configure agent for proper pathfinding around obstacles
                 agent.obstacleAvoidanceType = ObstacleAvoidanceType.HighQualityObstacleAvoidance;
                 agent.avoidancePriority = UnityEngine.Random.Range(0, 100); // Random priority to avoid clustering
@@ -845,6 +896,23 @@ public class GameManager : MonoBehaviour
                 // For movement actions, use a small stopping distance to get closer
                 float arrivalRange = 1.2f;
 
+                // Configure movement speed based on character's MovementSpeed stat
+                Character character = actor.GetComponent<Character>();
+                if (character != null)
+                {
+                    // Convert character movement speed to NavMeshAgent speed (HALVED for better gameplay)
+                    // Base conversion: MovementSpeed 10 = 1.75 units/sec, scale from there
+                    agent.speed = (character.MovementSpeed / 10f) * 1.75f;
+
+                    // Set high acceleration to reach max speed quickly
+                    agent.acceleration = agent.speed * 3.0f; // Reach max speed in ~0.33 seconds
+                }
+                else
+                {
+                    agent.speed = 1.75f; // Default speed if no character component (halved)
+                    agent.acceleration = 5.25f; // Default acceleration (halved)
+                }
+
                 // Configure agent for proper pathfinding around obstacles
                 agent.obstacleAvoidanceType = ObstacleAvoidanceType.HighQualityObstacleAvoidance;
                 agent.avoidancePriority = UnityEngine.Random.Range(0, 100);
@@ -859,6 +927,8 @@ public class GameManager : MonoBehaviour
             }
         }
 
+        Debug.Log($"🏃 MOVEMENT PHASE START - TimeScale={Time.timeScale}, ActiveMovements={activeMovements.Count}, Duration={movementDuration}");
+
         while (elapsedTime < movementDuration && Time.timeScale > 0 && activeMovements.Count > 0)
         {
             var agentsToRemove = new List<NavMeshAgent>();
@@ -877,6 +947,14 @@ public class GameManager : MonoBehaviour
 
                 float distanceToTarget = Vector3.Distance(agent.transform.position, target.transform.position);
 
+                // Debug velocity and speed every 10 frames to avoid spam
+                if (Time.frameCount % 10 == 0)
+                {
+                    Character character = agent.GetComponent<Character>();
+                    string charName = character != null ? character.CharacterName : agent.gameObject.name;
+                    Debug.Log($"🏃‍♂️ VELOCITY - {charName}: Speed={agent.speed:F1}, Velocity={agent.velocity.magnitude:F2}, Distance={distanceToTarget:F1}");
+                }
+
                 if (distanceToTarget <= attackRange)
                 {
                     agent.isStopped = true;

+ 370 - 16
Assets/Scripts/BattleScene/PlayerDecisionController .cs

@@ -1,6 +1,9 @@
+using System.Collections;
 using System.Collections.Generic;
 using Unity.VisualScripting;
 using UnityEngine;
+using UnityEngine.UIElements;
+using UnityEngine.AI;
 
 public class PlayerDecisionController : MonoBehaviour
 {
@@ -22,6 +25,13 @@ public class PlayerDecisionController : MonoBehaviour
     private bool isEnabled = true;
     private List<TargetingLine> activeActionLines = new List<TargetingLine>();
 
+    [Header("Character Stats UI")]
+    public VisualTreeAsset characterStatsUXML;
+    public StyleSheet characterStatsUSS;
+    private UIDocument uiDocument;
+    private VisualElement statsPanel;
+    private bool isStatsPanelVisible = false;
+
     void Awake()
     {
         mainCamera = Camera.main;
@@ -34,9 +44,24 @@ public class PlayerDecisionController : MonoBehaviour
 
     void Start()
     {
-
         InitializePlayerCharacters();
+        SetupCharacterStatsUI();
+
+        // Wait a moment for battle setup to complete, then refresh stats display
+        StartCoroutine(RefreshStatsAfterSetup());
+    }
 
+    private IEnumerator RefreshStatsAfterSetup()
+    {
+        // Wait for battle setup to complete
+        yield return new WaitForSeconds(0.5f);
+
+        // Refresh stats display if panel is visible and character is selected
+        if (isStatsPanelVisible && selectedCharacter != null)
+        {
+            Debug.Log("🔄 Refreshing stats after battle setup completion");
+            UpdateCharacterStatsDisplay(selectedCharacter);
+        }
     }
 
     void Update()
@@ -78,6 +103,12 @@ public class PlayerDecisionController : MonoBehaviour
     {
         if (!isEnabled) return;
 
+        // Toggle character stats panel with 'C' key
+        if (Input.GetKeyDown(KeyCode.C))
+        {
+            ToggleStatsPanel();
+        }
+
         if (Input.GetMouseButtonDown(0)) // Left click
         {
             HandleLeftClickDown();
@@ -102,10 +133,10 @@ public class PlayerDecisionController : MonoBehaviour
     private bool IsInMoveTargetingMode()
     {
         if (selectedCharacter == null) return false;
-        
+
         var actionData = selectedCharacter.GetEnhancedActionData<EnhancedCharacterActionData>();
-        return actionData != null && 
-               actionData.actionType == BattleActionType.Move && 
+        return actionData != null &&
+               actionData.actionType == BattleActionType.Move &&
                actionData.state == ActionDecisionState.NoAction;
     }
 
@@ -120,9 +151,12 @@ public class PlayerDecisionController : MonoBehaviour
             selectedCharacter = clickedCharacter;
             isDragging = true;
             dragStartPosition = clickedCharacter.transform.position;
-            
+
             Debug.Log($"🖱️ Starting drag from character {clickedCharacter.CharacterName}");
 
+            // Update character stats display if panel is visible
+            UpdateCharacterStatsDisplay(clickedCharacter);
+
             // Clear any existing action lines before starting new targeting
             ClearActionLineForCharacter(clickedCharacter);
 
@@ -168,7 +202,7 @@ public class PlayerDecisionController : MonoBehaviour
     {
         Vector3 mouseWorldPos = GetMouseWorldPosition();
         GameObject enemyAtMouse = GetEnemyAtPosition(mouseWorldPos);
-        
+
         // Handle different cases based on current state
         if (isDragging && selectedCharacter != null)
         {
@@ -181,22 +215,22 @@ public class PlayerDecisionController : MonoBehaviour
                 selectedCharacter.SetVisualState(selectedCharacter.actionData.state);
                 Debug.Log($"⚔️ Attack target set for {selectedCharacter.CharacterName}");
             }
- else
+            else
             {
                 // Check if user actually dragged (minimum distance threshold) OR if we're in action wheel move mode
                 float dragDistance = Vector3.Distance(dragStartPosition, mouseWorldPos);
                 const float minDragDistance = 0.5f; // Minimum distance to consider it a drag vs click
-                
+
                 bool isActionWheelMove = IsInMoveTargetingMode();
                 bool isDragMove = dragDistance > minDragDistance;
-                
+
                 if (isActionWheelMove || isDragMove)
                 {
                     // Move target selected
                     selectedCharacter.actionData.SetMoveTarget(mouseWorldPos);
                     UpdateEnhancedActionData(selectedCharacter, BattleActionType.Move, null, mouseWorldPos);
                     selectedCharacter.SetVisualState(selectedCharacter.actionData.state);
-                    
+
                     if (isActionWheelMove)
                     {
                         Debug.Log($"👟 Move target set for {selectedCharacter.CharacterName} (action wheel mode)");
@@ -277,7 +311,6 @@ public class PlayerDecisionController : MonoBehaviour
         // Raycast against a ground plane or existing colliders
         if (Physics.Raycast(ray, out hit, 200f))
         {
-            Debug.Log($"🌍 Mouse world position: {hit.point} (hit: {hit.collider.gameObject.name})");
             return hit.point;
         }
 
@@ -286,11 +319,9 @@ public class PlayerDecisionController : MonoBehaviour
         if (groundPlane.Raycast(ray, out float distance))
         {
             Vector3 position = ray.GetPoint(distance);
-            Debug.Log($"🌍 Mouse world position (fallback plane): {position}");
             return position;
         }
 
-        Debug.Log($"❌ Could not determine mouse world position");
         return Vector3.zero;
     }
 
@@ -330,7 +361,7 @@ public class PlayerDecisionController : MonoBehaviour
             Debug.Log($"🎯 Enemy detected: {hit.collider.gameObject.name} on layer {hit.collider.gameObject.layer}");
             return hit.collider.gameObject;
         }
-        
+
         // Debug: Check what we're hitting without layer mask
         if (Physics.Raycast(ray, out hit, 200f))
         {
@@ -340,7 +371,7 @@ public class PlayerDecisionController : MonoBehaviour
         {
             Debug.Log($"❌ No raycast hit detected at mouse position");
         }
-        
+
         return null;
     }
 
@@ -536,6 +567,12 @@ public class PlayerDecisionController : MonoBehaviour
         selectedCharacter = character;
         dragStartPosition = character.transform.position;
 
+        // Update character stats display if panel is visible
+        if (isStatsPanelVisible && selectedCharacter != null)
+        {
+            UpdateCharacterStatsDisplay(selectedCharacter);
+        }
+
         // Store the action type for later reference
         var enhancedData = character.GetEnhancedActionData<EnhancedCharacterActionData>();
         if (enhancedData == null)
@@ -548,7 +585,7 @@ public class PlayerDecisionController : MonoBehaviour
 
         // Start targeting mode - user needs to click to set target
         isDragging = true;
-        
+
         // Clear any existing action lines before starting new targeting
         ClearActionLineForCharacter(character);
 
@@ -575,4 +612,321 @@ public class PlayerDecisionController : MonoBehaviour
             Debug.Log("❌ Targeting cancelled");
         }
     }
+
+    #region Character Stats UI
+
+    private void SetupCharacterStatsUI()
+    {
+        // Get or create UIDocument component
+        uiDocument = GetComponent<UIDocument>();
+        if (uiDocument == null)
+        {
+            uiDocument = gameObject.AddComponent<UIDocument>();
+        }
+
+        // Set PanelSettings to mainSettings
+        if (uiDocument.panelSettings == null)
+        {
+            SetupPanelSettings(uiDocument);
+        }
+
+        // Try to load UXML asset
+        if (characterStatsUXML != null)
+        {
+            uiDocument.visualTreeAsset = characterStatsUXML;
+            Debug.Log("✓ Character Stats UI: UXML asset applied");
+        }
+
+        // Check if we have content from UXML or need to create programmatically
+        bool hasValidContent = uiDocument.rootVisualElement != null &&
+                              uiDocument.rootVisualElement.childCount > 0 &&
+                              uiDocument.rootVisualElement.Q("character-stats-container") != null;
+
+        // Create UI structure programmatically only if UXML not found or invalid
+        if (characterStatsUXML == null || !hasValidContent)
+        {
+            CreateCharacterStatsPanelProgrammatically();
+        }
+
+        // Get the stats panel
+        statsPanel = uiDocument.rootVisualElement.Q("character-stats-container");
+
+        if (statsPanel == null)
+        {
+            Debug.LogWarning("Stats panel not found, creating fallback");
+            CreateCharacterStatsPanelProgrammatically();
+            statsPanel = uiDocument.rootVisualElement.Q("character-stats-container");
+        }
+
+        // Apply stylesheet if available and not already applied
+        if (characterStatsUSS != null && !uiDocument.rootVisualElement.styleSheets.Contains(characterStatsUSS))
+        {
+            uiDocument.rootVisualElement.styleSheets.Add(characterStatsUSS);
+            Debug.Log("✓ Character Stats UI: USS stylesheet applied");
+        }
+
+        // Hide panel initially
+        if (statsPanel != null)
+        {
+            statsPanel.style.display = DisplayStyle.None;
+        }
+
+        Debug.Log("Character Stats UI setup complete");
+    }
+
+    private void CreateCharacterStatsPanelProgrammatically()
+    {
+        var root = uiDocument.rootVisualElement;
+        root.Clear();
+
+        // Create main container
+        var container = new VisualElement();
+        container.name = "character-stats-container";
+        container.style.position = Position.Absolute;
+        container.style.top = 10;
+        container.style.right = 10;
+        container.style.width = 280;
+        container.style.backgroundColor = new Color(0, 0, 0, 0.8f);
+        container.style.borderTopColor = container.style.borderBottomColor =
+        container.style.borderLeftColor = container.style.borderRightColor = new Color(1, 1, 1, 0.3f);
+        container.style.borderTopWidth = container.style.borderBottomWidth =
+        container.style.borderLeftWidth = container.style.borderRightWidth = 1;
+        container.style.borderTopLeftRadius = container.style.borderTopRightRadius =
+        container.style.borderBottomLeftRadius = container.style.borderBottomRightRadius = 5;
+        container.style.paddingTop = container.style.paddingBottom =
+        container.style.paddingLeft = container.style.paddingRight = 10;
+        container.style.color = Color.white;
+
+        // Title
+        var title = new Label("Character Stats");
+        title.name = "title-label";
+        title.style.fontSize = 16;
+        title.style.color = new Color(1f, 0.84f, 0f); // Gold
+        title.style.marginBottom = 10;
+        title.style.unityFontStyleAndWeight = FontStyle.Bold;
+        title.style.unityTextAlign = TextAnchor.MiddleCenter;
+        container.Add(title);
+
+        // Character info section
+        var charInfo = new VisualElement();
+        charInfo.name = "character-info";
+        var charName = new Label("Character Name");
+        charName.name = "character-name";
+        charName.style.fontSize = 14;
+        charName.style.color = new Color(0.56f, 0.93f, 0.56f); // Light green
+        charName.style.unityFontStyleAndWeight = FontStyle.Bold;
+        var charLevel = new Label("Level 1");
+        charLevel.name = "character-level";
+        charLevel.style.fontSize = 11;
+        charLevel.style.color = new Color(0.87f, 0.63f, 0.87f); // Plum
+        charLevel.style.marginBottom = 5;
+        charInfo.Add(charName);
+        charInfo.Add(charLevel);
+        container.Add(charInfo);
+
+        // Attributes section
+        var attrSection = CreateStatsSection("Attributes", new string[]
+        {
+            "str-stat:STR: 10",
+            "dex-stat:DEX: 10",
+            "con-stat:CON: 10",
+            "wis-stat:WIS: 10",
+            "per-stat:PER: 10"
+        });
+        container.Add(attrSection);
+
+        // Combat section
+        var combatSection = CreateStatsSection("Combat Stats", new string[]
+        {
+            "health-stat:Health: 100/100",
+            "attack-stat:Attack: 15",
+            "ac-stat:AC: 12",
+            "movement-stat:Movement: 10"
+        });
+        container.Add(combatSection);
+
+        // Debug section
+        var debugSection = CreateStatsSection("Debug Info", new string[]
+        {
+            "agent-speed-stat:Agent Speed: 3.5"
+        });
+        container.Add(debugSection);
+
+        // Controls
+        var controls = new VisualElement();
+        var helpText = new Label("Press 'C' to toggle stats panel");
+        helpText.style.fontSize = 10;
+        helpText.style.color = new Color(0.8f, 0.8f, 0.8f);
+        helpText.style.unityTextAlign = TextAnchor.MiddleCenter;
+        helpText.style.marginTop = 5;
+        controls.Add(helpText);
+        container.Add(controls);
+
+        root.Add(container);
+    }
+
+    private VisualElement CreateStatsSection(string title, string[] stats)
+    {
+        var section = new VisualElement();
+        section.style.marginBottom = 8;
+
+        var header = new Label(title);
+        header.style.fontSize = 12;
+        header.style.color = new Color(0.53f, 0.81f, 0.92f); // Sky blue
+        header.style.marginBottom = 4;
+        header.style.unityFontStyleAndWeight = FontStyle.Bold;
+        section.Add(header);
+
+        foreach (string stat in stats)
+        {
+            string[] parts = stat.Split(':');
+            var label = new Label(parts.Length > 1 ? parts[1] : stat);
+            if (parts.Length > 1) label.name = parts[0];
+            label.style.fontSize = 11;
+            label.style.color = Color.white;
+            label.style.marginLeft = 5;
+            label.style.marginBottom = 2;
+            section.Add(label);
+        }
+
+        return section;
+    }
+
+    // New method to force refresh stats display
+    public void RefreshCharacterStatsDisplay()
+    {
+        if (selectedCharacter != null && isStatsPanelVisible)
+        {
+            Debug.Log("🔄 Force refreshing character stats display");
+            UpdateCharacterStatsDisplay(selectedCharacter);
+        }
+    }
+
+    private void ToggleStatsPanel()
+    {
+        if (statsPanel == null) return;
+
+        isStatsPanelVisible = !isStatsPanelVisible;
+        statsPanel.style.display = isStatsPanelVisible ? DisplayStyle.Flex : DisplayStyle.None;
+
+        Debug.Log($"📊 Character stats panel: {(isStatsPanelVisible ? "Shown" : "Hidden")}");
+
+        // Update display when showing panel
+        if (isStatsPanelVisible && selectedCharacter != null)
+        {
+            UpdateCharacterStatsDisplay(selectedCharacter);
+        }
+    }
+
+    private void UpdateCharacterStatsDisplay(Character character)
+    {
+        if (statsPanel == null || !isStatsPanelVisible) return;
+
+        Debug.Log($"🔄 Updating stats display for {character.CharacterName}");
+        Debug.Log($"   Character component reference: {character.GetInstanceID()}");
+        Debug.Log($"   Character object name: {character.gameObject.name}");
+        Debug.Log($"   Character stats: STR:{character.Strength} DEX:{character.Dexterity} CON:{character.Constitution} WIS:{character.Wisdom} PER:{character.Perception}");
+        Debug.Log($"   Movement Speed: {character.MovementSpeed}");
+
+        // Update character info
+        var nameLabel = statsPanel.Q<Label>("character-name");
+        var levelLabel = statsPanel.Q<Label>("character-level");
+
+        if (nameLabel != null) nameLabel.text = character.CharacterName;
+        if (levelLabel != null) levelLabel.text = $"Level {character.Level}";
+
+        // Update attributes
+        UpdateStatLabel("str-stat", $"STR: {character.Strength}");
+        UpdateStatLabel("dex-stat", $"DEX: {character.Dexterity}");
+        UpdateStatLabel("con-stat", $"CON: {character.Constitution}");
+        UpdateStatLabel("wis-stat", $"WIS: {character.Wisdom}");
+        UpdateStatLabel("per-stat", $"PER: {character.Perception}");
+
+        // Update combat stats
+        UpdateStatLabel("health-stat", $"Health: {character.CurrentHealth}/{character.MaxHealth}");
+        UpdateStatLabel("attack-stat", $"Attack: {character.Attack}");
+        UpdateStatLabel("ac-stat", $"AC: {character.ArmorClass}");
+        UpdateStatLabel("movement-stat", $"Movement: {character.MovementSpeed}");
+
+        // Update debug info - get NavMeshAgent speed
+        var agent = character.GetComponent<NavMeshAgent>();
+        float agentSpeed = agent != null ? agent.speed : 0f;
+        UpdateStatLabel("agent-speed-stat", $"Agent Speed: {agentSpeed:F1}");
+
+        Debug.Log($"📊 Updated stats display for {character.CharacterName}");
+    }
+    private void UpdateStatLabel(string elementName, string text)
+    {
+        var label = statsPanel.Q<Label>(elementName);
+        if (label != null) label.text = text;
+    }
+
+    /// <summary>
+    /// Setup PanelSettings with multiple fallback methods
+    /// </summary>
+    private void SetupPanelSettings(UIDocument uiDoc)
+    {
+        // Try Resources first (original approach)
+        var mainSettings = Resources.Load<PanelSettings>("MainSettings");
+        if (mainSettings != null)
+        {
+            uiDoc.panelSettings = mainSettings;
+            Debug.Log("✓ Character Stats UI: Applied MainSettings from Resources");
+            return;
+        }
+
+        // Try to find and reuse existing panel settings from other UI
+        var existingUI = GameObject.Find("TravelUI")?.GetComponent<UIDocument>();
+        if (existingUI?.panelSettings != null)
+        {
+            uiDoc.panelSettings = existingUI.panelSettings;
+            Debug.Log("✓ Character Stats UI: Panel Settings assigned from TravelUI");
+            return;
+        }
+
+        // Try to find from MainTeamSelectScript
+        var mainTeamSelect = FindFirstObjectByType<MainTeamSelectScript>();
+        if (mainTeamSelect != null)
+        {
+            var mainUIDoc = mainTeamSelect.GetComponent<UIDocument>();
+            if (mainUIDoc?.panelSettings != null)
+            {
+                uiDoc.panelSettings = mainUIDoc.panelSettings;
+                Debug.Log("✓ Character Stats UI: Panel Settings assigned from MainTeamSelectScript");
+                return;
+            }
+        }
+
+        // Try to find any UIDocument in the scene with PanelSettings
+        var allUIDocuments = FindObjectsByType<UIDocument>(FindObjectsSortMode.None);
+        foreach (var doc in allUIDocuments)
+        {
+            if (doc.panelSettings != null && doc != uiDoc)
+            {
+                uiDoc.panelSettings = doc.panelSettings;
+                Debug.Log($"✓ Character Stats UI: Panel Settings assigned from {doc.gameObject.name}");
+                return;
+            }
+        }
+
+#if UNITY_EDITOR
+        // If still no panel settings, try to find any PanelSettings asset using Editor API
+        var panelSettingsGuids = UnityEditor.AssetDatabase.FindAssets("t:PanelSettings");
+        if (panelSettingsGuids.Length > 0)
+        {
+            var path = UnityEditor.AssetDatabase.GUIDToAssetPath(panelSettingsGuids[0]);
+            var settings = UnityEditor.AssetDatabase.LoadAssetAtPath<UnityEngine.UIElements.PanelSettings>(path);
+            if (settings != null)
+            {
+                uiDoc.panelSettings = settings;
+                Debug.Log($"✓ Character Stats UI: Panel Settings auto-assigned: {settings.name}");
+                return;
+            }
+        }
+#endif
+
+        Debug.LogWarning("⚠️ Could not assign Panel Settings to Character Stats UI. You may need to assign it manually.");
+    }
+
+    #endregion
 }

+ 23 - 13
Assets/Scripts/Characters/HumanCharacter.cs

@@ -6,20 +6,30 @@ public class HumanCharacter : Character
     public GameObject arrowPrefab; // Assign the arrow prefab in the inspector
     protected override void InitializeStats()
     {
-        MaxHealth = 20;
-        CurrentHealth = MaxHealth;
-        Attack = 8;
-        Strength = 10;          // Default strength
-        Constitution = 5;
-        Dexterity = 3;
-        Wisdom = 2;
-        Perception = 10;        // Default perception
+        // Only set default stats if they haven't been set by combat data
+        if (Strength == 0) // Assume if Strength is 0, no combat data has been applied
+        {
+            MaxHealth = 20;
+            CurrentHealth = MaxHealth;
+            Attack = 8;
+            Strength = 10;          // Default strength
+            Constitution = 5;
+            Dexterity = 3;
+            Wisdom = 2;
+            Perception = 10;        // Default perception
+
+            InitModifier = -2;
+            DamageModifier = 0;
+            SpellModifier = 0;
+            MovementSpeed = 10;
+            ArmorClass = 10;
 
-        InitModifier = -2;
-        DamageModifier = 0;
-        SpellModifier = 0;
-        MovementSpeed = 10;
-        ArmorClass = 10;
+            Debug.Log($"🔧 Applied default stats to {CharacterName}");
+        }
+        else
+        {
+            Debug.Log($"🔧 Skipping default stats for {CharacterName} - combat data already applied (STR:{Strength})");
+        }
     }
 
     public override Weapon GetWeapon()

+ 110 - 3
Assets/Scripts/Events/TravelEventSystem.cs

@@ -410,9 +410,8 @@ public class TravelEventSystem : MonoBehaviour
     {
         if (result.goldChange != 0)
         {
-            // Apply gold change to team resources
-            // This would integrate with your resource system
-            Debug.Log($"💰 Gold changed by {result.goldChange}");
+            // Distribute gold to team members equally
+            DistributeGoldToTeam(result.goldChange);
         }
 
         if (result.healthChange != 0)
@@ -597,4 +596,112 @@ public class TravelEventSystem : MonoBehaviour
             Mathf.RoundToInt(worldPos.z)
         );
     }
+
+    #region Gold Distribution System
+
+    /// <summary>
+    /// Distribute gold equally among all team members
+    /// </summary>
+    private void DistributeGoldToTeam(int totalGold)
+    {
+        if (totalGold <= 0)
+        {
+            Debug.LogWarning("Attempted to distribute non-positive gold amount");
+            return;
+        }
+
+        // Get team size from PlayerPrefs
+        int teamSize = PlayerPrefs.GetInt("TeamSize", 0);
+        if (teamSize <= 0)
+        {
+            Debug.LogWarning("No team members found to distribute gold to");
+            return;
+        }
+
+        // Calculate gold per member and remainder
+        int goldPerMember = totalGold / teamSize;
+        int remainderGold = totalGold % teamSize;
+
+        Debug.Log($"💰 Distributing {totalGold} gold among {teamSize} team members ({goldPerMember} each, {remainderGold} remainder)");
+
+        // Distribute gold to each team member
+        for (int i = 0; i < teamSize; i++)
+        {
+            var character = LoadCharacterFromPlayerPrefs(i);
+            if (character != null)
+            {
+                // Add base gold to each member
+                character.gold += goldPerMember;
+
+                // Give remainder gold to first few members
+                if (i < remainderGold)
+                {
+                    character.gold += 1;
+                }
+
+                // Handle currency conversion (100 copper = 1 silver, 100 silver = 1 gold)
+                ConvertCurrency(character);
+
+                SaveCharacterToPlayerPrefs(character, i);
+
+                Debug.Log($"💰 {character.name}: +{goldPerMember + (i < remainderGold ? 1 : 0)} gold (Total: {character.gold}g {character.silver}s {character.copper}c)");
+            }
+        }
+
+        Debug.Log($"✅ Gold distribution complete: {totalGold} gold distributed to team");
+    }
+
+    /// <summary>
+    /// Load character data from PlayerPrefs
+    /// </summary>
+    private TeamCharacter LoadCharacterFromPlayerPrefs(int index)
+    {
+        string charName = PlayerPrefs.GetString($"Character{index}_Name", "");
+        if (string.IsNullOrEmpty(charName))
+            return null;
+
+        var character = new TeamCharacter();
+        character.name = charName;
+        character.gold = PlayerPrefs.GetInt($"Character{index}_Gold", 0);
+        character.silver = PlayerPrefs.GetInt($"Character{index}_Silver", 0);
+        character.copper = PlayerPrefs.GetInt($"Character{index}_Copper", 0);
+
+        return character;
+    }
+
+    /// <summary>
+    /// Save character data to PlayerPrefs
+    /// </summary>
+    private void SaveCharacterToPlayerPrefs(TeamCharacter character, int index)
+    {
+        PlayerPrefs.SetString($"Character{index}_Name", character.name);
+        PlayerPrefs.SetInt($"Character{index}_Gold", character.gold);
+        PlayerPrefs.SetInt($"Character{index}_Silver", character.silver);
+        PlayerPrefs.SetInt($"Character{index}_Copper", character.copper);
+        PlayerPrefs.Save();
+    }
+
+    /// <summary>
+    /// Convert currency (100 copper = 1 silver, 100 silver = 1 gold)
+    /// </summary>
+    private void ConvertCurrency(TeamCharacter character)
+    {
+        // Convert copper to silver
+        if (character.copper >= 100)
+        {
+            int newSilver = character.copper / 100;
+            character.silver += newSilver;
+            character.copper %= 100;
+        }
+
+        // Convert silver to gold
+        if (character.silver >= 100)
+        {
+            int newGold = character.silver / 100;
+            character.gold += newGold;
+            character.silver %= 100;
+        }
+    }
+
+    #endregion
 }

+ 1 - 1
Assets/Scripts/Events/TravelEventUI.cs

@@ -156,7 +156,7 @@ public class TravelEventUI : MonoBehaviour
         }
 
         // Handle other event-specific inputs
-        if (currentMessage.requiresPlayerInput)
+        if (currentMessage != null && currentMessage.requiresPlayerInput)
         {
             // TODO: Handle specific event choices (Accept/Decline trade, etc.)
         }

+ 23 - 23
Assets/Scripts/Utilities/CombatIntegrationTest.cs

@@ -21,7 +21,7 @@ public class CombatIntegrationTest : MonoBehaviour
     public string testEnemyType = "Test Bandit";
 
     [Header("Test Controls")]
-    [Tooltip("Enable this to run test combat on Start")]
+    [Tooltip("Enable this to run test combat on Start - Creates FastRogue (DEX:20) and SlowTank (DEX:4)")]
     public bool runTestOnStart = false;
 
     void Start()
@@ -63,22 +63,22 @@ public class CombatIntegrationTest : MonoBehaviour
     }
 
     /// <summary>
-    /// Create test team data
+    /// Create test team data with varied movement speeds
     /// </summary>
     private List<TeamCharacter> CreateTestTeam()
     {
         List<TeamCharacter> team = new List<TeamCharacter>();
 
-        // Create a test warrior
-        var warrior = new TeamCharacter
+        // Create a FAST character - Very High Dexterity
+        var fastRogue = new TeamCharacter
         {
-            name = "Test Warrior",
+            name = "FastRogue",
             isMale = true,
-            strength = 16,
-            dexterity = 12,
+            strength = 12,
+            dexterity = 25, // Very High DEX = Very Fast movement (MovementSpeed = 30 + 15 = 45)
             constitution = 14,
-            wisdom = 10,
-            perception = 11,
+            wisdom = 12,
+            perception = 16,
             gold = 50,
             silver = 25,
             copper = 10,
@@ -87,29 +87,29 @@ public class CombatIntegrationTest : MonoBehaviour
             weapons = new List<string> { "Sword", "Bow" },
             armor = new List<string> { "Leather Armor" }
         };
-        team.Add(warrior);
+        team.Add(fastRogue);
 
-        // Create a test archer
-        var archer = new TeamCharacter
+        // Create a SLOW character - Very Low Dexterity
+        var slowTank = new TeamCharacter
         {
-            name = "Test Archer",
+            name = "SlowTank",
             isMale = false,
-            strength = 12,
-            dexterity = 16,
-            constitution = 12,
+            strength = 16,
+            dexterity = 1, // Very Low DEX = Very Slow movement (MovementSpeed = 30 + (-10) = 20, but formula should give us ~15)
+            constitution = 16,
             wisdom = 14,
-            perception = 15,
+            perception = 10,
             gold = 45,
             silver = 30,
             copper = 5,
-            equippedWeapon = "Bow",
-            equippedArmor = "",
-            weapons = new List<string> { "Bow", "Dagger" },
-            armor = new List<string>()
+            equippedWeapon = "Sword",
+            equippedArmor = "Plate Armor",
+            weapons = new List<string> { "Sword", "Mace" },
+            armor = new List<string> { "Plate Armor" }
         };
-        team.Add(archer);
+        team.Add(slowTank);
 
-        Debug.Log($"🏷️ Created test team with {team.Count} members");
+        Debug.Log($"🏷️ Created test team with {team.Count} members - FastRogue (DEX:25) and SlowTank (DEX:1)");
         return team;
     }
 

+ 0 - 24
Assets/UI/AttributeManagementElements.uxml

@@ -1,24 +0,0 @@
-<!-- Add these elements to your CharacterSheet.uxml file -->
-
-<!-- Attribute Management Section (add this after your existing attribute fields) -->
-<ui:VisualElement name="AttributeManagementSection" style="margin-top: 10px; padding: 10px; border-width: 1px; border-color: rgb(128, 128, 128); border-radius: 5px;">
-    <ui:Label text="Attribute Management" display-tooltip-when-elided="true" name="AttributeManagementTitle" style="font-size: 14px; -unity-font-style: bold; margin-bottom: 5px;"/>
-    
-    <!-- Current Mode and Points Display -->
-    <ui:VisualElement name="StatusRow" style="flex-direction: row; justify-content: space-between; margin-bottom: 10px;">
-        <ui:Label text="Mode: Point Buy" display-tooltip-when-elided="true" name="CreationModeLabel" style="font-size: 12px;"/>
-        <ui:Label text="Available Points: 27" display-tooltip-when-elided="true" name="AvailablePointsLabel" style="font-size: 12px; color: rgb(0, 200, 0);"/>
-    </ui:VisualElement>
-    
-    <!-- Buttons Row -->
-    <ui:VisualElement name="ButtonsRow" style="flex-direction: row; justify-content: space-between;">
-        <ui:Button text="Randomize (2-18)" display-tooltip-when-elided="true" name="RandomizeAttributesButton" tooltip="Roll random stats between 2-18. Cannot be changed afterwards!" style="flex-grow: 1; margin-right: 5px; background-color: rgb(200, 100, 100);"/>
-        <ui:Button text="Reset to Point Buy" display-tooltip-when-elided="true" name="ResetToPointBuyButton" tooltip="Reset all stats to 10 and use 27-point buy system" style="flex-grow: 1; margin-left: 5px; background-color: rgb(100, 150, 200);"/>
-    </ui:VisualElement>
-    
-    <!-- Point Cost Reference -->
-    <ui:Label text="Point Costs: 8=0pts, 9=1pt, 10=2pts, 11=3pts, 12=4pts, 13=5pts, 14=7pts, 15=9pts, 16=12pts, 17=16pts, 18=21pts" 
-              display-tooltip-when-elided="true" 
-              name="PointCostReference" 
-              style="font-size: 10px; color: rgb(180, 180, 180); margin-top: 5px; white-space: normal;"/>
-</ui:VisualElement>

+ 0 - 65
Assets/UI/AttributeManagementStyles.uss

@@ -1,65 +0,0 @@
-/* Add these styles to your MainTeamSelectUSS.uss file or create a new one */
-
-/* Attribute Management Section Styling */
-#AttributeManagementSection {
-    background-color: rgba(50, 50, 50, 0.8);
-    border-color: rgba(200, 200, 200, 0.3);
-    margin: 10px 0px;
-}
-
-#AttributeManagementTitle {
-    color: rgb(255, 255, 255);
-    -unity-text-align: upper-center;
-}
-
-#CreationModeLabel {
-    color: rgb(255, 220, 100);
-    -unity-font-style: bold;
-}
-
-#AvailablePointsLabel {
-    color: rgb(100, 255, 100);
-    -unity-font-style: bold;
-}
-
-#RandomizeAttributesButton {
-    background-color: rgb(180, 80, 80);
-    color: rgb(255, 255, 255);
-    border-width: 1px;
-    border-color: rgb(220, 100, 100);
-    border-radius: 3px;
-}
-
-#RandomizeAttributesButton:hover {
-    background-color: rgb(200, 100, 100);
-}
-
-#ResetToPointBuyButton {
-    background-color: rgb(80, 120, 180);
-    color: rgb(255, 255, 255);
-    border-width: 1px;
-    border-color: rgb(100, 140, 200);
-    border-radius: 3px;
-}
-
-#ResetToPointBuyButton:hover {
-    background-color: rgb(100, 140, 200);
-}
-
-#PointCostReference {
-    color: rgba(255, 255, 255, 0.7);
-    background-color: rgba(0, 0, 0, 0.3);
-    padding: 5px;
-    border-radius: 3px;
-    -unity-text-align: upper-center;
-}
-
-/* Disabled stat fields when randomized */
-.unity-integer-field:disabled {
-    opacity: 0.5;
-}
-
-.unity-integer-field:disabled .unity-base-field__input {
-    background-color: rgba(100, 100, 100, 0.3);
-    color: rgba(255, 255, 255, 0.5);
-}

+ 57 - 0
Assets/UI/BattleSceneUI/CharacterStatsPanel.uss

@@ -0,0 +1,57 @@
+.stats-container {
+    position: absolute;
+    top: 10px;
+    right: 10px;
+    width: 280px;
+    background-color: rgba(0, 0, 0, 0.8);
+    border-color: rgba(255, 255, 255, 0.3);
+    border-width: 1px;
+    border-radius: 5px;
+    padding: 10px;
+    color: white;
+}
+
+.title-label {
+    font-size: 16px;
+    color: #FFD700;
+    margin-bottom: 10px;
+    -unity-font-style: bold;
+    -unity-text-align: middle-center;
+}
+
+.section {
+    margin-bottom: 8px;
+}
+
+.section-header {
+    font-size: 12px;
+    color: #87CEEB;
+    margin-bottom: 4px;
+    -unity-font-style: bold;
+}
+
+.character-name {
+    font-size: 14px;
+    color: #90EE90;
+    -unity-font-style: bold;
+}
+
+.character-level {
+    font-size: 11px;
+    color: #DDA0DD;
+    margin-bottom: 5px;
+}
+
+.stat-label {
+    font-size: 11px;
+    color: white;
+    margin-left: 5px;
+    margin-bottom: 2px;
+}
+
+.help-text {
+    font-size: 10px;
+    color: #CCCCCC;
+    -unity-text-align: middle-center;
+    margin-top: 5px;
+}

+ 32 - 0
Assets/UI/BattleSceneUI/CharacterStatsPanel.uxml

@@ -0,0 +1,32 @@
+<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
+    <Style src="project://database/Assets/UI/BattleSceneUI/CharacterStatsPanel.uss?fileID=7433441132597879392&amp;guid=ceae46cfb65e6ca4a90cd2bd0eee0513&amp;type=3#CharacterStatsPanel" />
+    <ui:VisualElement name="character-stats-container" class="stats-container">
+        <ui:Label text="Character Stats" display-tooltip-when-elided="true" name="title-label" class="title-label" />
+        <ui:VisualElement name="character-info" class="section">
+            <ui:Label text="Character Name" display-tooltip-when-elided="true" name="character-name" class="character-name" />
+            <ui:Label text="Level 1" display-tooltip-when-elided="true" name="character-level" class="character-level" />
+        </ui:VisualElement>
+        <ui:VisualElement name="attributes-section" class="section">
+            <ui:Label text="Attributes" display-tooltip-when-elided="true" class="section-header" />
+            <ui:Label text="STR: 10" display-tooltip-when-elided="true" name="str-stat" class="stat-label" />
+            <ui:Label text="DEX: 10" display-tooltip-when-elided="true" name="dex-stat" class="stat-label" />
+            <ui:Label text="CON: 10" display-tooltip-when-elided="true" name="con-stat" class="stat-label" />
+            <ui:Label text="WIS: 10" display-tooltip-when-elided="true" name="wis-stat" class="stat-label" />
+            <ui:Label text="PER: 10" display-tooltip-when-elided="true" name="per-stat" class="stat-label" />
+        </ui:VisualElement>
+        <ui:VisualElement name="combat-section" class="section">
+            <ui:Label text="Combat Stats" display-tooltip-when-elided="true" class="section-header" />
+            <ui:Label text="Health: 100/100" display-tooltip-when-elided="true" name="health-stat" class="stat-label" />
+            <ui:Label text="Attack: 15" display-tooltip-when-elided="true" name="attack-stat" class="stat-label" />
+            <ui:Label text="AC: 12" display-tooltip-when-elided="true" name="ac-stat" class="stat-label" />
+            <ui:Label text="Movement: 10" display-tooltip-when-elided="true" name="movement-stat" class="stat-label" />
+        </ui:VisualElement>
+        <ui:VisualElement name="debug-section" class="section">
+            <ui:Label text="Debug Info" display-tooltip-when-elided="true" class="section-header" />
+            <ui:Label text="Agent Speed: 3.5" display-tooltip-when-elided="true" name="agent-speed-stat" class="stat-label" />
+        </ui:VisualElement>
+        <ui:VisualElement name="controls-section" class="section">
+            <ui:Label text="Press &apos;C&apos; to toggle stats panel" display-tooltip-when-elided="true" class="help-text" />
+        </ui:VisualElement>
+    </ui:VisualElement>
+</ui:UXML>

+ 1 - 19
Assets/UI/BattleSceneUI/GameOverScreen.uxml

@@ -1,25 +1,15 @@
 <ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
-    
-    <!-- Full Screen Overlay -->
+    <Style src="project://database/Assets/UI/BattleSceneUI/GameOverScreen.uss?fileID=7433441132597879392&amp;guid=2edcc85eae26b2e4184f01c26422de8d&amp;type=3#GameOverScreen" />
     <ui:VisualElement name="GameOverOverlay" class="gameover-overlay">
-        <!-- Background Panel -->
         <ui:VisualElement name="GameOverBackground" class="gameover-background">
-            
-            <!-- Header Section -->
             <ui:VisualElement name="HeaderSection" class="header-section">
                 <ui:Label text="GAME OVER" display-tooltip-when-elided="true" name="GameOverTitle" class="gameover-title" />
                 <ui:Label text="All heroes have fallen..." display-tooltip-when-elided="true" name="GameOverSubtitle" class="gameover-subtitle" />
             </ui:VisualElement>
-            
-            <!-- Main Content Section -->
             <ui:VisualElement name="MainContent" class="main-content">
-                
-                <!-- Statistics Section -->
                 <ui:VisualElement name="StatisticsSection" class="statistics-section">
                     <ui:Label text="Journey Statistics" display-tooltip-when-elided="true" name="StatisticsTitle" class="section-title" />
                     <ui:ScrollView name="StatisticsList" class="statistics-list">
-                        
-                        <!-- Time & Travel Stats -->
                         <ui:VisualElement name="TimeSection" class="stats-category">
                             <ui:Label text="Time &amp; Travel" display-tooltip-when-elided="true" name="TimeSectionTitle" class="category-title" />
                             <ui:VisualElement name="TimeStats" class="stat-group">
@@ -41,8 +31,6 @@
                                 </ui:VisualElement>
                             </ui:VisualElement>
                         </ui:VisualElement>
-                        
-                        <!-- Combat Stats -->
                         <ui:VisualElement name="CombatSection" class="stats-category">
                             <ui:Label text="Combat" display-tooltip-when-elided="true" name="CombatSectionTitle" class="category-title" />
                             <ui:VisualElement name="CombatStats" class="stat-group">
@@ -76,8 +64,6 @@
                                 </ui:VisualElement>
                             </ui:VisualElement>
                         </ui:VisualElement>
-                        
-                        <!-- Social & Quests Stats -->
                         <ui:VisualElement name="SocialSection" class="stats-category">
                             <ui:Label text="Social &amp; Quests" display-tooltip-when-elided="true" name="SocialSectionTitle" class="category-title" />
                             <ui:VisualElement name="SocialStats" class="stat-group">
@@ -117,8 +103,6 @@
                         </ui:VisualElement>
                     </ui:ScrollView>
                 </ui:VisualElement>
-                
-                <!-- Final Assessment Section -->
                 <ui:VisualElement name="AssessmentSection" class="assessment-section">
                     <ui:Label text="Final Assessment" display-tooltip-when-elided="true" name="AssessmentTitle" class="section-title" />
                     <ui:VisualElement name="AssessmentContent" class="assessment-content">
@@ -126,8 +110,6 @@
                     </ui:VisualElement>
                 </ui:VisualElement>
             </ui:VisualElement>
-            
-            <!-- Footer Section -->
             <ui:VisualElement name="FooterSection" class="footer-section">
                 <ui:VisualElement name="ButtonContainer" class="button-container">
                     <ui:Button text="Restart Game" display-tooltip-when-elided="true" name="RestartButton" class="action-button restart-button" />

+ 1 - 19
Assets/UI/BattleSceneUI/PostBattleLootScreen.uxml

@@ -1,59 +1,41 @@
 <ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
-    
-    <!-- Full Screen Overlay -->
+    <Style src="project://database/Assets/UI/BattleSceneUI/PostBattleLootScreen.uss?fileID=7433441132597879392&amp;guid=7e47da640c1bad6439fb34b904842245&amp;type=3#PostBattleLootScreen" />
     <ui:VisualElement name="LootScreenOverlay" class="loot-overlay">
-        <!-- Background Panel -->
         <ui:VisualElement name="LootScreenBackground" class="loot-background">
-            
-            <!-- Header Section -->
             <ui:VisualElement name="HeaderSection" class="header-section">
                 <ui:Label text="🏆 VICTORY! 🏆" display-tooltip-when-elided="true" name="VictoryTitle" class="victory-title" />
                 <ui:Label text="Collecting loot from defeated enemies..." display-tooltip-when-elided="true" name="VictorySubtitle" class="victory-subtitle" />
             </ui:VisualElement>
-            
-            <!-- Main Content Section -->
             <ui:VisualElement name="MainContent" class="main-content">
-                
-                <!-- Enemy Loot Section -->
                 <ui:VisualElement name="EnemyLootSection" class="enemy-loot-section">
                     <ui:Label text="Defeated Enemies" display-tooltip-when-elided="true" name="EnemyLootTitle" class="section-title" />
                     <ui:ScrollView name="EnemyLootContainer" class="enemy-loot-list" />
                 </ui:VisualElement>
-                
-                <!-- Total Rewards Section -->
                 <ui:VisualElement name="TotalRewardsSection" class="total-rewards-section">
                     <ui:Label text="Total Rewards" display-tooltip-when-elided="true" name="TotalRewardsTitle" class="section-title" />
-                    
-                    <!-- Currency Display -->
                     <ui:VisualElement name="CurrencyDisplay" class="currency-display">
                         <ui:VisualElement name="GoldDisplay" class="currency-item">
                             <ui:Label text="G" display-tooltip-when-elided="true" name="GoldIcon" class="currency-icon" />
                             <ui:Label text="0" display-tooltip-when-elided="true" name="GoldAmount" class="currency-amount" />
                             <ui:Label text="Gold" display-tooltip-when-elided="true" name="GoldLabel" class="currency-label" />
                         </ui:VisualElement>
-                        
                         <ui:VisualElement name="SilverDisplay" class="currency-item">
                             <ui:Label text="S" display-tooltip-when-elided="true" name="SilverIcon" class="currency-icon" />
                             <ui:Label text="0" display-tooltip-when-elided="true" name="SilverAmount" class="currency-amount" />
                             <ui:Label text="Silver" display-tooltip-when-elided="true" name="SilverLabel" class="currency-label" />
                         </ui:VisualElement>
-                        
                         <ui:VisualElement name="CopperDisplay" class="currency-item">
                             <ui:Label text="C" display-tooltip-when-elided="true" name="CopperIcon" class="currency-icon" />
                             <ui:Label text="0" display-tooltip-when-elided="true" name="CopperAmount" class="currency-amount" />
                             <ui:Label text="Copper" display-tooltip-when-elided="true" name="CopperLabel" class="currency-label" />
                         </ui:VisualElement>
                     </ui:VisualElement>
-                    
-                    <!-- Items Display -->
                     <ui:VisualElement name="ItemsDisplay" class="items-display">
                         <ui:Label text="Items Collected" display-tooltip-when-elided="true" name="ItemsTitle" class="items-title" />
                         <ui:ScrollView name="ItemsList" class="items-list" />
                     </ui:VisualElement>
                 </ui:VisualElement>
             </ui:VisualElement>
-            
-            <!-- Footer Section -->
             <ui:VisualElement name="FooterSection" class="footer-section">
                 <ui:Label text="Press SPACE to continue..." display-tooltip-when-elided="true" name="ContinuePrompt" class="continue-prompt" />
                 <ui:VisualElement name="ButtonContainer" class="button-container">

+ 1 - 0
Assets/UI/MapLegend.uxml

@@ -1,4 +1,5 @@
 <ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False">
+    <Style src="project://database/Assets/UI/MapLegend.uss?fileID=7433441132597879392&amp;guid=bd9bd858f48084843ae4d8b28c85678d&amp;type=3#MapLegend" />
     <ui:VisualElement name="MapLegend" class="legend-container">
         <ui:Label text="Map Legend" class="legend-title" />
         <ui:VisualElement class="legend-items">

+ 0 - 0
BATTLE_SCENE_IMPROVEMENTS_SUMMARY.md


+ 125 - 0
BATTLE_SYSTEM_FIXES_IMPLEMENTATION.md

@@ -0,0 +1,125 @@
+# Battle System Improvements - Implementation Guide
+
+## Overview
+This document outlines the fixes and improvements made to address the reported issues with gold distribution, null reference errors, and movement speed visibility.
+
+## Issues Fixed
+
+### 1. ✅ Gold Distribution from Discovery Events
+
+**Problem**: Discovery events were not adding gold to team members' totals.
+
+**Root Cause**: The `TravelEventSystem.ApplyResourceChanges()` method was only logging gold changes instead of actually distributing them.
+
+**Solution Implemented**:
+- Added `DistributeGoldToTeam()` method that:
+  - Retrieves team size from PlayerPrefs
+  - Distributes gold equally among all team members
+  - Handles remainder gold (gives extra to first few characters)
+  - Includes automatic currency conversion (100 copper = 1 silver, 100 silver = 1 gold)
+  - Saves updated character data back to PlayerPrefs
+
+**Files Modified**:
+- `Assets/Scripts/Events/TravelEventSystem.cs` - Added gold distribution system
+
+### 2. ✅ TravelEventUI Null Reference Error
+
+**Problem**: NullReferenceException in TravelEventUI.HandleInput() method.
+
+**Solution Implemented**:
+- Added additional null safety check in `HandleInput()` method
+- Changed from `currentMessage.requiresPlayerInput` to `currentMessage != null && currentMessage.requiresPlayerInput`
+- Provides double protection against race conditions
+
+**Files Modified**:
+- `Assets/Scripts/Events/TravelEventUI.cs` - Enhanced null safety
+
+### 3. ✅ Character Stats UI System
+
+**Problem**: No way to view character stats (including movement speed) in battle scene.
+
+**Solution Implemented**:
+- Created comprehensive character stats UI system in `PlayerDecisionController`
+- **Key Binding**: Press **'C' key** to toggle stats panel (avoiding conflict with Tab key used by enemy selection)
+- Features:
+  - Shows base attributes (STR, DEX, CON, WIS, PER)
+  - Displays combat stats (Health, Attack, AC, Movement Speed)
+  - Shows NavMeshAgent speed for debugging movement differences
+  - Updates when clicking on characters
+  - Clean dark-themed UI with organized sections
+
+**Files Created**:
+- `Assets/UI/BattleSceneUI/CharacterStatsPanel.uxml` - UI layout
+- `Assets/UI/BattleSceneUI/CharacterStatsPanel.uss` - UI styling
+
+**Files Modified**:
+- `Assets/Scripts/BattleScene/PlayerDecisionController .cs` - Added UI system
+
+## Key Binding Changes
+
+Since the Tab key was already used for enemy selection mode switching, the character stats panel uses:
+- **'C' Key**: Toggle character stats panel visibility
+- **Tab Key**: Continue to switch enemy selection modes (List UI vs Direct Targeting)
+
+## How to Use
+
+### Gold Distribution Testing
+1. Create/trigger discovery events during travel
+2. Check team member gold values in character selection or shop
+3. Verify gold is distributed equally among team members
+
+### Character Stats Panel
+1. Enter battle scene
+2. Press 'C' to toggle the stats panel
+3. Click on different characters to view their stats
+4. Compare MovementSpeed values and NavMeshAgent speeds
+
+### Movement Speed Verification
+- Characters with higher DEX should have higher MovementSpeed values
+- NavMeshAgent speed = (MovementSpeed / 10) * 3.5
+- Example: MovementSpeed 15 → Agent Speed 5.25 units/sec
+
+## Technical Implementation Details
+
+### Gold Distribution Logic
+```csharp
+// Gold distributed equally with remainder handling
+int goldPerMember = totalGold / teamSize;
+int remainderGold = totalGold % teamSize;
+// First few characters get remainder gold
+```
+
+### Character Stats UI Integration
+- Uses Unity UI Toolkit (UIElements) for modern UI
+- Programmatic fallback if UXML/USS files not found
+- Real-time updates when character selection changes
+- NavMeshAgent integration for movement speed debugging
+
+### Movement Speed System
+- Base formula: `agent.speed = (character.MovementSpeed / 10f) * 3.5f`
+- Configured in `BattleSetup.cs` (already working)
+- Now visible through character stats display
+
+## Future Enhancements
+
+1. **Health Distribution**: Extend resource system to handle health from rest events
+2. **Stats Panel Customization**: Add toggle for debug information
+3. **Movement Speed Indicators**: Visual indicators during character movement
+4. **Expanded Currency System**: Support for equipment costs and rewards
+
+## Testing Checklist
+
+- [ ] Discovery events add gold to team members
+- [ ] No null reference errors in TravelEventUI
+- [ ] Character stats panel shows/hides with 'C' key
+- [ ] Stats update when clicking different characters
+- [ ] Movement speed differences visible in stats panel
+- [ ] NavMeshAgent speeds match calculated values
+- [ ] Tab key still works for enemy selection modes
+
+## Compatibility Notes
+
+- All changes maintain backward compatibility
+- No breaking changes to existing systems
+- Character stats UI gracefully handles missing components
+- Gold distribution works with existing PlayerPrefs save system

+ 71 - 0
CHARACTER_STATS_ENHANCED_PANELSETTINGS_FIX.md

@@ -0,0 +1,71 @@
+# Character Stats Panel - Enhanced PanelSettings Fix
+
+## Issue Resolved
+The warning "⚠️ MainSettings PanelSettings not found in Resources" has been fixed with a robust, multi-fallback approach for finding and assigning PanelSettings.
+
+## Enhanced Solution
+
+### Multiple Fallback Methods
+Instead of relying only on Resources.Load, the system now tries multiple approaches in order:
+
+1. **Resources Folder** (Original): `Resources.Load<PanelSettings>("MainSettings")`
+2. **TravelUI Component**: Reuses PanelSettings from existing TravelUI GameObject
+3. **MainTeamSelectScript**: Copies PanelSettings from MainTeamSelectScript UIDocument
+4. **Any UIDocument in Scene**: Finds any other UIDocument with valid PanelSettings
+5. **Editor Asset Search**: Uses AssetDatabase to find any PanelSettings asset in the project
+
+### Code Implementation
+```csharp
+private void SetupPanelSettings(UIDocument uiDoc)
+{
+    // Try Resources first
+    var mainSettings = Resources.Load<PanelSettings>("MainSettings");
+    if (mainSettings != null)
+    {
+        uiDoc.panelSettings = mainSettings;
+        return;
+    }
+
+    // Try existing UI components...
+    // [Multiple fallback methods]
+    
+    // Editor fallback
+    #if UNITY_EDITOR
+    var panelSettingsGuids = UnityEditor.AssetDatabase.FindAssets("t:PanelSettings");
+    // [Asset search and assignment]
+    #endif
+}
+```
+
+## Benefits
+
+- ✅ **Guaranteed Success**: At least one method should find valid PanelSettings
+- ✅ **Automatic Detection**: No manual setup required
+- ✅ **Scene Consistency**: Reuses existing PanelSettings from other UI
+- ✅ **Debug Information**: Clear logging shows which method succeeded
+- ✅ **Editor Fallback**: Finds any PanelSettings asset in the project
+
+## Expected Results
+
+After this fix, you should see one of these success messages instead of the warning:
+
+- `✓ Character Stats UI: Applied MainSettings from Resources`
+- `✓ Character Stats UI: Panel Settings assigned from TravelUI`
+- `✓ Character Stats UI: Panel Settings assigned from MainTeamSelectScript`
+- `✓ Character Stats UI: Panel Settings assigned from [GameObject name]`
+- `✓ Character Stats UI: Panel Settings auto-assigned: [Asset name]`
+
+## What This Fixes
+
+1. **UIDocument Inspector**: The "Panel Settings" field should no longer show "None (Panel Settings)"
+2. **Rendering Consistency**: Character stats panel will use the same rendering settings as other UI
+3. **Warning Elimination**: No more PanelSettings warnings in the console
+4. **Automatic Setup**: Works in any scene with existing UI components
+
+## Testing
+
+1. **In Battle Scene**: Press 'C' to open character stats panel
+2. **Check Inspector**: Select the PlayerDecisionController GameObject and verify UIDocument has PanelSettings assigned
+3. **Console Log**: Look for success message indicating which PanelSettings source was used
+
+The character stats panel should now render properly with consistent UI settings!

+ 68 - 0
CHARACTER_STATS_PANELSETTINGS_FIX.md

@@ -0,0 +1,68 @@
+# Character Stats Panel - PanelSettings Fix
+
+## Issue Identified
+When the character stats UI was created programmatically, it wasn't using the existing MainSettings PanelSettings that are used by other UI elements in the project.
+
+## Solution Implemented
+
+### 1. ✅ PanelSettings Assignment
+Added code to automatically load and assign the MainSettings PanelSettings when creating the UIDocument component:
+
+```csharp
+// Set PanelSettings to mainSettings
+if (uiDocument.panelSettings == null)
+{
+    var mainSettings = Resources.Load<PanelSettings>("MainSettings");
+    if (mainSettings != null)
+    {
+        uiDocument.panelSettings = mainSettings;
+        Debug.Log("✓ Character Stats UI: Applied MainSettings PanelSettings");
+    }
+}
+```
+
+### 2. ✅ UXML Preservation 
+Modified the UI creation logic to preserve your manually edited UXML file instead of clearing and recreating it:
+
+- **Smart Detection**: Checks if valid UXML content exists before falling back to programmatic creation
+- **No Clearing**: Avoids clearing the rootVisualElement when UXML is successfully loaded
+- **Fallback Safety**: Still creates UI programmatically if UXML is missing or invalid
+
+### 3. ✅ Stylesheet Handling
+Improved stylesheet application to avoid duplication:
+
+```csharp
+// Apply stylesheet if available and not already applied
+if (characterStatsUSS != null && !uiDocument.rootVisualElement.styleSheets.Contains(characterStatsUSS))
+{
+    uiDocument.rootVisualElement.styleSheets.Add(characterStatsUSS);
+}
+```
+
+## How It Works Now
+
+1. **UIDocument Creation**: Creates UIDocument component if missing
+2. **PanelSettings**: Automatically loads and applies MainSettings from Resources
+3. **UXML Loading**: Applies your UXML file if available
+4. **Content Validation**: Checks if the UXML loaded successfully
+5. **Programmatic Fallback**: Only creates UI programmatically if UXML fails
+6. **Stylesheet Application**: Adds USS styles without duplication
+7. **Panel Setup**: Configures the stats panel and hides it initially
+
+## Benefits
+
+- ✅ **Consistent Rendering**: Uses same PanelSettings as other UI elements
+- ✅ **Preserves Manual Edits**: Your UXML modifications are kept
+- ✅ **Automatic Fallback**: Still works if UXML/USS files are missing
+- ✅ **No Duplication**: Prevents duplicate stylesheets
+- ✅ **Debug Logging**: Clear feedback about what's being applied
+
+## Testing
+
+The character stats panel should now:
+1. Use the same rendering settings as other UI elements
+2. Display your UXML layout correctly
+3. Apply the USS styles from your file
+4. Work consistently across different scenes
+
+Press 'C' in the battle scene to test the character stats panel with the proper PanelSettings applied.

+ 79 - 0
TEST_CHARACTER_MOVEMENT_SPEEDS.md

@@ -0,0 +1,79 @@
+# Test Character Movement Speeds Guide
+
+## Overview
+Modified both `BattleTestMode.cs` and `EnhancedBattleTestMode.cs` to create two test characters with distinctly different movement speeds when no actual battle data exists.
+
+**IMPORTANT**: The system uses `EnhancedBattleTestMode.cs` as the primary test mode, so both files were updated to ensure consistency.
+
+## Character Archetypes
+
+### Character 0: FastRogue (Very High Speed)
+- **Name**: FastRogue
+- **Dexterity**: 30
+- **Expected Movement Speed**: 50
+- **Expected Agent Speed**: 17.5
+- **Calculation**: `30 + (int)(Ceil((30-10)/5.0) * 5) = 30 + 20 = 50`
+- **Build**: Lightning-fast character focused on extreme speed
+- **Stats**:
+  - STR: 12, DEX: 30, CON: 14, WIS: 12, PER: 16
+  - Health: 18, AC: 13
+
+### Character 1: SlowTank (Low Speed)
+- **Name**: SlowTank  
+- **Dexterity**: 1
+- **Expected Movement Speed**: 25
+- **Expected Agent Speed**: 8.75
+- **Calculation**: `30 + (int)(Ceil((1-10)/5.0) * 5) = 30 + (-5) = 25`
+- **Build**: Heavy, tanky character focused on durability
+- **Stats**:
+  - STR: 16, DEX: 1, CON: 16, WIS: 14, PER: 10
+  - Health: 25, AC: 11
+
+## Movement Speed Formula
+```csharp
+MovementSpeed = 30 + (int)(Mathf.Ceil((Dexterity - 10) / 5.0f) * 5)
+```
+
+## Speed Difference
+- **FastRogue**: 50 movement speed, 17.5 agent speed
+- **SlowTank**: 25 movement speed, 8.75 agent speed  
+- **Difference**: 25 movement speed units (100% speed difference)
+- **Agent Speed Difference**: 2x faster (17.5 vs 8.75)
+
+## How to Test
+1. Load a battle scene with test mode enabled
+2. Ensure no existing battle data (BattleSetupData should be empty)
+3. Press 'C' to open character stats panel
+4. Click on each character to see their different movement speeds
+5. Watch the actual movement differences when giving move commands
+
+## Technical Details
+- Modified `CreateBasicInventoryData()` method in `BattleTestMode.cs`
+- Modified `CreateTestPlayerData()` method in `EnhancedBattleTestMode.cs` 
+- Modified `CreateTestTeam()` method in `CombatIntegrationTest.cs` (likely the active system)
+- Added `CreateSpecializedTestCharacters()` method for character-specific stat creation
+- Replaced random stat generation with deliberate archetype-based stats
+- Movement speed is automatically calculated by the Character class based on Dexterity
+
+## Troubleshooting
+If characters still show identical stats:
+1. Check that all three test systems are updated: `BattleTestMode`, `EnhancedBattleTestMode`, and `CombatIntegrationTest`
+2. **Most likely cause**: `CombatIntegrationTest` component has `runTestOnStart = true` and is overriding other test modes
+3. Enable `forceClearExistingData` in BattleTestMode component
+4. Check console logs for test mode activation messages
+5. Ensure no existing combat session data is overriding test data
+
+## Root Cause Analysis
+The issue was caused by multiple factors:
+1. **`CombatIntegrationTest`** component creating "Test Warrior" and "Test Archer" characters
+2. **`HumanCharacter.InitializeStats()`** overriding combat data with hardcoded default values
+
+### The Problem Sequence:
+1. `BattleTestMode` correctly creates specialized characters with DEX:20 and DEX:4
+2. `ApplyStatsFromCombatData` correctly sets the character stats 
+3. `Character.Start()` calls `InitializeStats()`
+4. `HumanCharacter.InitializeStats()` overwrites ALL stats with defaults (STR:10, DEX:3, CON:5, etc.)
+5. UI displays the hardcoded default values instead of the intended test values
+
+### The Solution:
+Modified `HumanCharacter.InitializeStats()` to only apply default stats if combat data hasn't already been applied (checking if Strength == 0).

+ 6 - 6
UserSettings/EditorUserSettings.asset

@@ -15,22 +15,22 @@ EditorUserSettings:
       value: 5655020755505a0d5e0a5577457b0a44154f1a7f2a7e70697e284b30e4b2623b
       flags: 0
     RecentlyUsedSceneGuid-2:
-      value: 5309060006570d5f0c580e2715270c44144e1c722a7d20612c2d4b37b1b4643a
+      value: 51020c5550545a0354575e7b47270744174e4b787e2b77687b7e1b37e7e4366d
       flags: 0
     RecentlyUsedSceneGuid-3:
-      value: 5a08575f5207595a0f5d59741173094444164f7d7d2a23317c7a4465bbe1646d
+      value: 510500025d560a0c095d092111730d44464f4b78757b72357a701c31b7b16368
       flags: 0
     RecentlyUsedSceneGuid-4:
-      value: 51020c5550545a0354575e7b47270744174e4b787e2b77687b7e1b37e7e4366d
+      value: 54030700010708095d0d5b7643260c44464f1e29797022342c2a1b67b1b03760
       flags: 0
     RecentlyUsedSceneGuid-5:
-      value: 510500025d560a0c095d092111730d44464f4b78757b72357a701c31b7b16368
+      value: 5a090503000558580f0d557342700844144f4d7c7b7d74692c281e63b0e2623c
       flags: 0
     RecentlyUsedSceneGuid-6:
-      value: 54030700010708095d0d5b7643260c44464f1e29797022342c2a1b67b1b03760
+      value: 5309060006570d5f0c580e2715270c44144e1c722a7d20612c2d4b37b1b4643a
       flags: 0
     RecentlyUsedSceneGuid-7:
-      value: 5a090503000558580f0d557342700844144f4d7c7b7d74692c281e63b0e2623c
+      value: 5a08575f5207595a0f5d59741173094444164f7d7d2a23317c7a4465bbe1646d
       flags: 0
     vcSharedLogLevel:
       value: 0d5e400f0650

+ 13 - 13
UserSettings/Layouts/default-6000.dwlt

@@ -74,7 +74,7 @@ MonoBehaviour:
   m_MinSize: {x: 200, y: 50}
   m_MaxSize: {x: 16192, y: 8096}
   vertical: 0
-  controlID: 124
+  controlID: 125
   draggingID: 0
 --- !u!114 &4
 MonoBehaviour:
@@ -198,7 +198,7 @@ MonoBehaviour:
   m_MinSize: {x: 400, y: 100}
   m_MaxSize: {x: 32384, y: 16192}
   vertical: 0
-  controlID: 160
+  controlID: 161
   draggingID: 0
 --- !u!114 &9
 MonoBehaviour:
@@ -224,7 +224,7 @@ MonoBehaviour:
   m_MinSize: {x: 300, y: 100}
   m_MaxSize: {x: 24288, y: 16192}
   vertical: 1
-  controlID: 48
+  controlID: 124
   draggingID: 0
 --- !u!114 &10
 MonoBehaviour:
@@ -576,7 +576,7 @@ MonoBehaviour:
       scrollPos: {x: 0, y: 0}
       m_SelectedIDs: 
       m_LastClickedID: 0
-      m_ExpandedIDs: 3c6cb9fe86dcc1fecee1c1feeaeac1fe68f4c1fec2f5c1fe7cf8c1fe7ef8c1fee052cafee252cafedcacd2fedeacd2fe3807dbfe3a07dbfe2261e3fe2461e3fe9abeebfe9cbeebfed6cd04ffd8cd04ff5e8515ff608515ff9e3d26ffa03d26ff3a9c2eff3c9c2eff28563fff2a563ffff8b947fffab947ff241450ff7c7158ff7e7158fff2cb60fff4cb60ff80ead5ff1ef0d5ffb2aee6ff1afbfffff4ffffffd2c80000d4c9000038cc000044cd00000cd000000ed1000074d300004ad500009cd8000070d9000072da000074db000074dc000078dd000034de0000
+      m_ExpandedIDs: 1afbffff
       m_RenameOverlay:
         m_UserAcceptedRename: 0
         m_Name: 
@@ -1260,9 +1260,9 @@ MonoBehaviour:
     speed: 2
     m_Value: {x: 0.31192487, y: 0.67680126, z: -0.39066193, w: 0.54039305}
   m_Size:
-    m_Target: 10
+    m_Target: 10.45
     speed: 2
-    m_Value: 10
+    m_Value: 10.45
   m_Ortho:
     m_Target: 0
     speed: 2
@@ -1412,7 +1412,7 @@ MonoBehaviour:
     m_SkipHidden: 0
     m_SearchArea: 1
     m_Folders:
-    - Assets/Scenes
+    - Assets/Scripts/Debug
     m_Globs: []
     m_ProductIds: 
     m_AnyWithAssetOrigin: 0
@@ -1422,16 +1422,16 @@ MonoBehaviour:
   m_ViewMode: 1
   m_StartGridSize: 67
   m_LastFolders:
-  - Assets/Scenes
+  - Assets/Scripts/Debug
   m_LastFoldersGridSize: 67
   m_LastProjectPath: C:\Users\Axel-PC\RPG-RougeLiteBatteler
   m_LockTracker:
     m_IsLocked: 0
   m_FolderTreeState:
-    scrollPos: {x: 0, y: 11}
-    m_SelectedIDs: d6b60000
-    m_LastClickedID: 46806
-    m_ExpandedIDs: 00000000c4b40000c6b40000c8b40000cab40000ccb40000
+    scrollPos: {x: 0, y: 7}
+    m_SelectedIDs: 34b70000
+    m_LastClickedID: 46900
+    m_ExpandedIDs: 00000000e2b40000e4b40000e6b40000e8b40000eab40000
     m_RenameOverlay:
       m_UserAcceptedRename: 0
       m_Name: 
@@ -1460,7 +1460,7 @@ MonoBehaviour:
     scrollPos: {x: 0, y: 0}
     m_SelectedIDs: 
     m_LastClickedID: 0
-    m_ExpandedIDs: 00000000c4b40000c6b40000c8b40000cab40000ccb40000
+    m_ExpandedIDs: 00000000e2b40000e4b40000e6b40000e8b40000eab40000
     m_RenameOverlay:
       m_UserAcceptedRename: 0
       m_Name: