SpottableSkeletonPatrol.cs 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. using UnityEngine;
  2. /// <summary>
  3. /// A spottable skeleton patrol event that appears as a red marker within perception range
  4. /// Players can choose to approach and engage or avoid the patrol
  5. /// </summary>
  6. [CreateAssetMenu(fileName = "SpottableSkeletonPatrol", menuName = "RPG/Travel Events/Spottable/Skeleton Patrol")]
  7. public class SpottableSkeletonPatrol : CombatTravelEvent
  8. {
  9. [Header("Spottable Event Settings")]
  10. [TextArea(2, 4)]
  11. public string[] spotDescription = {
  12. "You spot skeletal figures moving in the distance...",
  13. "A patrol of undead warriors can be seen ahead...",
  14. "Your keen eyes detect a group of skeleton warriors patrolling the area..."
  15. };
  16. void OnEnable()
  17. {
  18. // Configure as spottable event
  19. triggerType = EventTriggerType.Spottable;
  20. // Set up the event details
  21. eventName = "Skeleton Patrol";
  22. eventDescription = "A patrol of skeleton warriors guards this area. They haven't noticed you yet.";
  23. eventType = EventType.Combat;
  24. rarity = EventRarity.Common;
  25. // Configure combat settings
  26. minEnemies = 2;
  27. maxEnemies = 4;
  28. allowRunningAway = true;
  29. runAwaySuccessChance = 0.85f; // Higher chance since you can see them coming
  30. runAwayHealthPenalty = 2; // Lower penalty since you're prepared
  31. // Set terrain preferences (skeletons prefer ruins, forests, mountains)
  32. plainsChance = 0.4f;
  33. forestChance = 0.8f;
  34. mountainChance = 0.7f;
  35. roadChance = 0.3f; // Less likely on roads
  36. townChance = 0.1f; // Very unlikely in settlements
  37. villageChance = 0.2f;
  38. // Configure encounter descriptions
  39. encounterDescriptions = new string[]
  40. {
  41. "The skeleton patrol notices your approach and readies their weapons!",
  42. "The undead warriors turn toward you with hollow, glowing eyes!",
  43. "The skeleton patrol forms a battle line as you draw near!"
  44. };
  45. // Configure escape messages for spotted encounters
  46. successfulRunAwayMessages = new string[]
  47. {
  48. "Having spotted them first, your party easily retreats unnoticed!",
  49. "Your party backs away quietly before the patrol spots you!",
  50. "You successfully avoid the skeleton patrol by taking a different route!"
  51. };
  52. failedRunAwayMessages = new string[]
  53. {
  54. "The skeletons spot your retreat! You take {damage} damage as they give chase!",
  55. "Your withdrawal is noticed! The patrol pursues, dealing {damage} damage!",
  56. "The undead patrol catches up to your fleeing party for {damage} damage!"
  57. };
  58. }
  59. public override EventResult ExecuteEvent(TravelEventContext context)
  60. {
  61. // Override the base execution to provide special messaging for spottable events
  62. Debug.Log($"🔍 Executing spottable skeleton patrol at {context.currentPosition}");
  63. // Show spot description first
  64. string description = spotDescription[Random.Range(0, spotDescription.Length)];
  65. Debug.Log($"👁️ Spot description: {description}");
  66. // Then execute as normal combat event
  67. return base.ExecuteEvent(context);
  68. }
  69. /// <summary>
  70. /// Provides a description of what the team spotted
  71. /// </summary>
  72. public string GetSpotDescription()
  73. {
  74. return spotDescription[Random.Range(0, spotDescription.Length)];
  75. }
  76. }