DiscoveryTravelEvent.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using UnityEngine;
  2. /// <summary>
  3. /// Discovery events - finding treasures, resources, or hidden locations
  4. /// </summary>
  5. [CreateAssetMenu(fileName = "New Discovery Event", menuName = "RPG/Travel Events/Discovery Event")]
  6. public class DiscoveryTravelEvent : TravelEvent
  7. {
  8. [Header("Discovery Settings")]
  9. public int minGoldFound = 10;
  10. public int maxGoldFound = 100;
  11. public bool canFindItems = true;
  12. [Header("Discovery Descriptions")]
  13. [TextArea(2, 4)]
  14. public string[] discoveryDescriptions = {
  15. "Your party discovers a hidden cache containing {amount} gold!",
  16. "While exploring, you find an abandoned stash with {amount} gold pieces.",
  17. "A keen-eyed party member spots something valuable - {amount} gold!"
  18. };
  19. public override EventResult ExecuteEvent(TravelEventContext context)
  20. {
  21. int goldFound = Random.Range(minGoldFound, maxGoldFound + 1);
  22. string description = discoveryDescriptions[Random.Range(0, discoveryDescriptions.Length)];
  23. description = description.Replace("{amount}", goldFound.ToString());
  24. return new EventResult(description)
  25. {
  26. goldChange = goldFound
  27. };
  28. }
  29. void OnEnable()
  30. {
  31. eventType = EventType.Discovery;
  32. rarity = EventRarity.Uncommon;
  33. // More likely in remote areas
  34. forestChance = 0.7f;
  35. mountainChance = 0.8f;
  36. plainsChance = 0.4f;
  37. roadChance = 0.3f;
  38. townChance = 0.1f;
  39. }
  40. }