using UnityEngine;

/// <summary>
/// Rest events - safe camping spots, inns, healing springs
/// </summary>
[CreateAssetMenu(fileName = "New Rest Event", menuName = "RPG/Travel Events/Rest Event")]
public class RestTravelEvent : TravelEvent
{
    [Header("Rest Settings")]
    public int healthRestored = 25;
    public bool restoresAllHealth = false;

    [Header("Rest Descriptions")]
    [TextArea(2, 4)]
    public string[] restDescriptions = {
        "Your party finds a peaceful grove perfect for resting and recovers {health} health.",
        "A natural spring provides refreshing water, restoring {health} health to your party.",
        "Your party discovers a safe camping spot and takes time to tend wounds, recovering {health} health."
    };

    public override EventResult ExecuteEvent(TravelEventContext context)
    {
        int actualHealing = restoresAllHealth ? 100 : healthRestored;
        string description = restDescriptions[Random.Range(0, restDescriptions.Length)];
        description = description.Replace("{health}", actualHealing.ToString());

        return new EventResult(description)
        {
            healthChange = actualHealing
        };
    }

    void OnEnable()
    {
        eventType = EventType.Rest;
        rarity = EventRarity.Common;

        // More likely in natural areas
        forestChance = 0.8f;
        riverChance = 0.9f;
        lakeChance = 0.9f;
        plainsChance = 0.6f;
        mountainChance = 0.5f;
        roadChance = 0.4f;
        townChance = 0.2f;
    }
}
