public override void Run() { Penalty = new Penalty(); Penalty.RemoveFromParty(_companion); const int theftChance = 54; var roll = Dice.Roll("1d100"); if (roll <= theftChance) { Description += "\n\nThey stole some supplies too!"; } const int foodChance = 51; if (roll <= foodChance) { Penalty.AddPartyLoss(PartySupplyTypes.Food, Party.Food >= 10 ? 10 : Party.Food); } const int goldChance = 5; if (roll <= goldChance) { Penalty.AddPartyLoss(PartySupplyTypes.Gold, Party.Gold >= 70 ? 70 : Party.Gold); } const int potionChance = 10; if (roll <= potionChance) { Penalty.AddPartyLoss(PartySupplyTypes.Gold, Party.HealthPotions >= 2 ? 2 : Party.HealthPotions); } var fullResultDescription = new List <string> { Description + "\n" }; var travelManager = Object.FindObjectOfType <TravelManager>(); travelManager.ApplyEncounterPenalty(Penalty); var eventMediator = Object.FindObjectOfType <EventMediator>(); eventMediator.Broadcast(GlobalHelper.EncounterResult, this, fullResultDescription); }
public override void Run() { Options = new Dictionary <string, Option>(); string optionTitle; string optionResultText; var sacrifice = Party.GetRandomCompanion(); if (Party.HealthPotions > 0) { optionTitle = "Offer them a health potion"; optionResultText = "Not quite cough syrup, but close enough!\n\n"; const int sacChance = 13; var roll = Dice.Roll("1d100"); var optionOnePenalty = new Penalty(); optionOnePenalty.AddPartyLoss(PartySupplyTypes.HealthPotions, 1); var optionOneReward = new Reward(); if (roll <= sacChance) { optionResultText += "\"Still gonna take one of you as a sacrifice though.\"\n\n"; optionResultText += $"{sacrifice.Name} vanishes in a flash of fire and black smoke! Seva shrugs.\n\n\"Okay, see ya.\""; optionOnePenalty.RemoveFromParty(sacrifice); optionOnePenalty.EveryoneLoss(Party, EntityStatTypes.CurrentMorale, 5); optionOneReward.EveryoneGain(Party, EntityAttributeTypes.Physique, 1); optionOneReward.EveryoneGain(Party, EntitySkillTypes.Endurance, 1); } else { var chosen = Party.GetRandomCompanion(); optionResultText += $"Seva points at {chosen.FirstName()}.\n\n\"You seem cool. Here.\"\n\n{chosen.FirstName()} glows red briefly and Seva vanishes."; optionOneReward.AddEntityGain(chosen, EntityAttributeTypes.Physique, 1); optionOneReward.AddEntityGain(chosen, EntitySkillTypes.Endurance, 1); //todo maybe change their skin color to red idk } var optionOne = new Option(optionTitle, optionResultText, optionOneReward, optionOnePenalty, EncounterType.Normal); Options.Add(optionTitle, optionOne); } optionTitle = "PANIC!"; optionResultText = $"Everyone screams and scatters in all directions! Seva alternates between screaming and coughing before pointing at {sacrifice.FirstName()}. {sacrifice.FirstName()} stops in their tracks, glows red briefly, then vanishes in a flash of fire and black smoke! Seva shrugs.\n\n\"Okay, see ya.\""; var optionTwoPenalty = new Penalty(); optionTwoPenalty.RemoveFromParty(sacrifice); var optionTwo = new Option(optionTitle, optionResultText, null, optionTwoPenalty, EncounterType.Normal); Options.Add(optionTitle, optionTwo); SubscribeToOptionSelectedEvent(); var eventMediator = Object.FindObjectOfType <EventMediator>(); eventMediator.Broadcast(GlobalHelper.FourOptionEncounter, this); }
public override void Run() //todo possible continuity { var chosen = Party.GetRandomCompanion(); Description = $"The party is setting up camp when a group of traveling lizardmen approach. They would like to {chosen.FirstName()} as food.\n\nThey offer 125 gold!"; Options = new Dictionary <string, Option>(); var optionTitle = "Agree for 125 gold"; var optionResultText = $"You turn {chosen.Name} over to the lizardmen. Your companions are horrified!"; var optionOnePenalty = new Penalty(); optionOnePenalty.RemoveFromParty(chosen); optionOnePenalty.EveryoneLoss(Party, EntityStatTypes.CurrentMorale, 15); var optionOneReward = new Reward(); optionOneReward.AddPartyGain(PartySupplyTypes.Gold, 125); optionOneReward.EveryoneGain(Party, EntityStatTypes.CurrentEnergy, 10); var optionOne = new Option(optionTitle, optionResultText, optionOneReward, optionOnePenalty, EncounterType.Camping); Options.Add(optionTitle, optionOne); optionTitle = "Counter with 200 gold"; const int success = 33; var roll = Dice.Roll("1d100"); var optionTwoPenalty = new Penalty(); var optionTwoReward = new Reward(); if (roll <= success) { optionResultText = $"They discuss the price briefly and agree. You turn {chosen.Name} over to the lizardmen. Your companions are horrified!"; optionTwoPenalty.RemoveFromParty(chosen); optionTwoPenalty.EveryoneLoss(Party, EntityStatTypes.CurrentMorale, 15); optionTwoReward.AddPartyGain(PartySupplyTypes.Gold, 200); optionTwoReward.EveryoneGain(Party, EntityStatTypes.CurrentEnergy, 10); } else { optionResultText = $"They decline and continue on their way hungry and disappointed. Your companions are horrified! {chosen.FirstName()} is especially angry that you tried to sell them like a piece of beef!"; var chosenMorale = chosen.Stats.CurrentMorale; if (chosenMorale - 20 < 0) { optionResultText += "They stomp off and don't come back!"; optionTwoPenalty.RemoveFromParty(chosen); } optionTwoPenalty.EveryoneLoss(Party, EntityStatTypes.CurrentMorale, 15); optionTwoReward.EveryoneGain(Party, EntityStatTypes.CurrentEnergy, 10); } var optionTwo = new Option(optionTitle, optionResultText, optionTwoReward, optionTwoPenalty, EncounterType.Camping); Options.Add(optionTitle, optionTwo); optionTitle = "Uhh no"; optionResultText = $"The lizardmen continue on their way hungry and disappointed. {chosen.FirstName()} is looking themselves up and down trying to figure out why they were picked. They can't decide if they should be worried or flattered."; var optionThreeReward = new Reward(); optionThreeReward.EveryoneGain(Party, EntityStatTypes.CurrentEnergy, 10); var optionThree = new Option(optionTitle, optionResultText, optionThreeReward, null, EncounterType.Camping); Options.Add(optionTitle, optionThree); SubscribeToOptionSelectedEvent(); var eventMediator = Object.FindObjectOfType <EventMediator>(); eventMediator.Broadcast(GlobalHelper.FourOptionEncounter, this); }