| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298 |
- using UnityEngine;
- /// <summary>
- /// Forest Ambush - Bandits attacking from the woods
- /// High probability in forests, lower on roads
- /// </summary>
- [CreateAssetMenu(fileName = "Forest Ambush", menuName = "RPG/Travel Events/Specific/Forest Ambush")]
- public class ForestAmbushEvent : CombatTravelEvent
- {
- void OnEnable()
- {
- eventName = "Forest Ambush";
- eventDescription = "Bandits leap from the undergrowth to ambush your party!";
- eventType = EventType.Combat;
- rarity = EventRarity.Common;
- // Very likely in forests, unlikely on roads
- forestChance = 0.95f;
- plainsChance = 0.3f;
- mountainChance = 0.6f;
- roadChance = 0.15f; // Much safer on roads
- townChance = 0.05f;
- villageChance = 0.2f;
- minEnemies = 2;
- maxEnemies = 4;
- // TODO: Assign possibleEnemies array with EnemyCharacterData assets
- // Example: possibleEnemies = new EnemyCharacterData[] { forestBanditAsset, brigandAsset, outlawAsset };
- encounterDescriptions = new string[]
- {
- "Bandits emerge from behind the trees to surround your party!",
- "Your party walks into a carefully planned ambush by forest brigands!",
- "Outlaws drop from the canopy above, weapons drawn!",
- "A group of bandits blocks the forest path ahead!"
- };
- canOccurMultipleTimes = true;
- cooldownDays = 0.5f; // Can happen again after half a day
- }
- }
- /// <summary>
- /// Mountain Ambush - More dangerous encounter in treacherous terrain
- /// </summary>
- [CreateAssetMenu(fileName = "Mountain Ambush", menuName = "RPG/Travel Events/Specific/Mountain Ambush")]
- public class MountainAmbushEvent : CombatTravelEvent
- {
- void OnEnable()
- {
- eventName = "Mountain Ambush";
- eventDescription = "Mountain bandits use the rocky terrain to their advantage!";
- eventType = EventType.Combat;
- rarity = EventRarity.Common;
- // Most likely in mountains
- mountainChance = 0.9f;
- forestChance = 0.4f;
- plainsChance = 0.2f;
- roadChance = 0.1f;
- townChance = 0.02f;
- villageChance = 0.1f;
- minEnemies = 1;
- maxEnemies = 3;
- // TODO: Assign possibleEnemies array with EnemyCharacterData assets
- // Example: possibleEnemies = new EnemyCharacterData[] { mountainBanditAsset, highwaymanAsset, raiderAsset };
- encounterDescriptions = new string[]
- {
- "Mountain bandits rain arrows down from the cliffs above!",
- "Your party is caught in a narrow pass by armed raiders!",
- "Highwaymen emerge from rocky crevices to block your path!",
- "A rockslide reveals it was a trap - bandits attack!"
- };
- canOccurMultipleTimes = true;
- cooldownDays = 1f;
- }
- }
- /// <summary>
- /// Traveling Merchant - Friendly trader offering goods
- /// Much more likely on roads and near settlements
- /// </summary>
- [CreateAssetMenu(fileName = "Traveling Merchant", menuName = "RPG/Travel Events/Specific/Traveling Merchant")]
- public class TravelingMerchantEvent : TradingTravelEvent
- {
- void OnEnable()
- {
- eventName = "Traveling Merchant";
- eventDescription = "A friendly merchant offers to trade goods with your party.";
- eventType = EventType.Trading;
- rarity = EventRarity.Common;
- // Very likely on roads and near settlements
- roadChance = 0.85f;
- townChance = 0.6f;
- villageChance = 0.75f;
- bridgeChance = 0.7f; // Common at crossings
- ferryChance = 0.6f;
- // Less likely in wilderness
- forestChance = 0.25f;
- mountainChance = 0.15f;
- plainsChance = 0.4f;
- lakeChance = 0.3f;
- riverChance = 0.3f;
- merchantTypes = new string[] {
- "Traveling Merchant",
- "Caravan Trader",
- "Wandering Peddler",
- "Road Merchant"
- };
- canHaveRareItems = true;
- rareItemChance = 0.25f;
- priceModifier = 1.1f; // Slightly more expensive than town shops
- encounterDescriptions = new string[]
- {
- "A {merchantType} with a pack full of goods approaches your party.",
- "Your party encounters a {merchantType} resting beside the road.",
- "A {merchantType} calls out, offering to show you their wares.",
- "You come across a {merchantType} leading a pack animal loaded with goods."
- };
- canOccurMultipleTimes = true;
- cooldownDays = 0.25f; // Multiple merchants can be encountered
- }
- }
- /// <summary>
- /// Road Patrol - Guards or soldiers patrolling main roads
- /// Only occurs on roads, provides safety information
- /// </summary>
- [CreateAssetMenu(fileName = "Road Patrol", menuName = "RPG/Travel Events/Specific/Road Patrol")]
- public class RoadPatrolEvent : TravelEvent
- {
- [Header("Patrol Event Settings")]
- public string[] patrolTypes = { "City Guard Patrol", "Royal Guard", "Local Militia" };
- public bool providesInformation = true;
- public bool canRestoreHealth = true;
- public int healthRestored = 15;
- void OnEnable()
- {
- eventName = "Road Patrol";
- eventDescription = "A patrol of guards maintains order on the roads.";
- eventType = EventType.Social;
- rarity = EventRarity.Common;
- // Only on roads and near settlements
- roadChance = 0.9f;
- townChance = 0.8f;
- villageChance = 0.6f;
- bridgeChance = 0.5f;
- // Never in wilderness
- forestChance = 0f;
- mountainChance = 0f;
- plainsChance = 0.1f;
- lakeChance = 0f;
- riverChance = 0f;
- oceanChance = 0f;
- canOccurMultipleTimes = true;
- cooldownDays = 1f;
- }
- public override EventResult ExecuteEvent(TravelEventContext context)
- {
- string patrolType = patrolTypes[Random.Range(0, patrolTypes.Length)];
- string message = $"Your party encounters a {patrolType} maintaining security on the road.";
- if (canRestoreHealth && Random.value < 0.4f)
- {
- message += $" They provide aid, restoring {healthRestored} health to your party.";
- return new EventResult(message) { healthChange = healthRestored };
- }
- else if (providesInformation)
- {
- string[] infoMessages = {
- " They warn you about bandit activity ahead.",
- " They share information about safe camping spots nearby.",
- " They mention a trading post further down the road.",
- " They advise taking the main road for safer travel."
- };
- message += infoMessages[Random.Range(0, infoMessages.Length)];
- }
- return new EventResult(message);
- }
- }
- /// <summary>
- /// Hidden Cache - Discovery of abandoned supplies
- /// More likely off main roads in remote areas
- /// </summary>
- [CreateAssetMenu(fileName = "Hidden Cache", menuName = "RPG/Travel Events/Specific/Hidden Cache")]
- public class HiddenCacheEvent : DiscoveryTravelEvent
- {
- void OnEnable()
- {
- eventName = "Hidden Cache";
- eventDescription = "Your party discovers a hidden stash of supplies.";
- eventType = EventType.Discovery;
- rarity = EventRarity.Uncommon;
- // More likely in remote areas
- forestChance = 0.8f;
- mountainChance = 0.9f;
- plainsChance = 0.5f;
- riverChance = 0.6f;
- // Less likely on main routes
- roadChance = 0.2f;
- townChance = 0.05f;
- villageChance = 0.1f;
- minGoldFound = 25;
- maxGoldFound = 150;
- canFindItems = true;
- discoveryDescriptions = new string[]
- {
- "Your party discovers a carefully hidden cache containing {amount} gold!",
- "While exploring off the beaten path, you find an old smuggler's stash with {amount} gold pieces.",
- "A party member notices disturbed earth that reveals a buried cache worth {amount} gold!",
- "Behind some rocks, your party uncovers an abandoned supply cache with {amount} gold."
- };
- canOccurMultipleTimes = true;
- cooldownDays = 2f; // Takes time for new caches to be found
- }
- }
- /// <summary>
- /// Wild Animal Encounter - Non-aggressive animal encounter
- /// Can be peaceful or turn into combat based on party actions
- /// </summary>
- [CreateAssetMenu(fileName = "Wild Animal Encounter", menuName = "RPG/Travel Events/Specific/Wild Animal Encounter")]
- public class WildAnimalEvent : TravelEvent
- {
- [Header("Animal Encounter Settings")]
- public string[] animalTypes = { "Wolf Pack", "Brown Bear", "Wild Boar", "Mountain Lion" };
- public float aggressionChance = 0.3f; // Chance the animal attacks
- void OnEnable()
- {
- eventName = "Wild Animal Encounter";
- eventDescription = "Your party encounters wild animals.";
- eventType = EventType.Mystery;
- rarity = EventRarity.Common;
- // More likely in natural areas
- forestChance = 0.9f;
- mountainChance = 0.8f;
- plainsChance = 0.6f;
- riverChance = 0.5f;
- lakeChance = 0.4f;
- // Very unlikely near civilization
- roadChance = 0.2f;
- townChance = 0.02f;
- villageChance = 0.1f;
- canOccurMultipleTimes = true;
- cooldownDays = 0.5f;
- }
- public override EventResult ExecuteEvent(TravelEventContext context)
- {
- string animalType = animalTypes[Random.Range(0, animalTypes.Length)];
- if (Random.value < aggressionChance)
- {
- // Animal attacks
- return EventResult.SimpleBattle(
- $"A {animalType} attacks your party!",
- 1,
- animalType
- );
- }
- else
- {
- // Peaceful encounter
- string[] peacefulMessages = {
- $"Your party spots a {animalType} in the distance. It notices you but moves away peacefully.",
- $"A {animalType} crosses your path but shows no aggression toward your party.",
- $"Your party carefully observes a {animalType} before it disappears into the wilderness."
- };
- return new EventResult(peacefulMessages[Random.Range(0, peacefulMessages.Length)]);
- }
- }
- }
|