RestTravelEvent.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using UnityEngine;
  2. /// <summary>
  3. /// Rest events - safe camping spots, inns, healing springs
  4. /// </summary>
  5. [CreateAssetMenu(fileName = "New Rest Event", menuName = "RPG/Travel Events/Rest Event")]
  6. public class RestTravelEvent : TravelEvent
  7. {
  8. [Header("Rest Settings")]
  9. public int healthRestored = 25;
  10. public bool restoresAllHealth = false;
  11. [Header("Rest Descriptions")]
  12. [TextArea(2, 4)]
  13. public string[] restDescriptions = {
  14. "Your party finds a peaceful grove perfect for resting and recovers {health} health.",
  15. "A natural spring provides refreshing water, restoring {health} health to your party.",
  16. "Your party discovers a safe camping spot and takes time to tend wounds, recovering {health} health."
  17. };
  18. public override EventResult ExecuteEvent(TravelEventContext context)
  19. {
  20. int actualHealing = restoresAllHealth ? 100 : healthRestored;
  21. string description = restDescriptions[Random.Range(0, restDescriptions.Length)];
  22. description = description.Replace("{health}", actualHealing.ToString());
  23. return new EventResult(description)
  24. {
  25. healthChange = actualHealing
  26. };
  27. }
  28. void OnEnable()
  29. {
  30. eventType = EventType.Rest;
  31. rarity = EventRarity.Common;
  32. // More likely in natural areas
  33. forestChance = 0.8f;
  34. riverChance = 0.9f;
  35. lakeChance = 0.9f;
  36. plainsChance = 0.6f;
  37. mountainChance = 0.5f;
  38. roadChance = 0.4f;
  39. townChance = 0.2f;
  40. }
  41. }