using UnityEngine;

/// <summary>
/// Discovery events - finding treasures, resources, or hidden locations
/// </summary>
[CreateAssetMenu(fileName = "New Discovery Event", menuName = "RPG/Travel Events/Discovery Event")]
public class DiscoveryTravelEvent : TravelEvent
{
    [Header("Discovery Settings")]
    public int minGoldFound = 10;
    public int maxGoldFound = 100;
    public bool canFindItems = true;

    [Header("Discovery Descriptions")]
    [TextArea(2, 4)]
    public string[] discoveryDescriptions = {
        "Your party discovers a hidden cache containing {amount} gold!",
        "While exploring, you find an abandoned stash with {amount} gold pieces.",
        "A keen-eyed party member spots something valuable - {amount} gold!"
    };

    public override EventResult ExecuteEvent(TravelEventContext context)
    {
        int goldFound = Random.Range(minGoldFound, maxGoldFound + 1);
        string description = discoveryDescriptions[Random.Range(0, discoveryDescriptions.Length)];
        description = description.Replace("{amount}", goldFound.ToString());

        return new EventResult(description)
        {
            goldChange = goldFound
        };
    }

    void OnEnable()
    {
        eventType = EventType.Discovery;
        rarity = EventRarity.Uncommon;

        // More likely in remote areas
        forestChance = 0.7f;
        mountainChance = 0.8f;
        plainsChance = 0.4f;
        roadChance = 0.3f;
        townChance = 0.1f;
    }
}
