public async Task <IActionResult> AddAdventure([FromBody] Adventures adventure) { _context.Adventures.Add(adventure); await _context.SaveChangesAsync(); return(CreatedAtAction("AddAdventure", new { id = adventure.adventureId }, adventure)); }
public async Task <IActionResult> UpdateAdventure([FromBody] Adventures adventure) { try { var selectedAdventure = _context.Adventures.FirstOrDefault(f => f.adventureId == adventure.adventureId); selectedAdventure.adventureName = adventure.adventureName; selectedAdventure.adventureDescription = adventure.adventureDescription; // selectedAssignment.ChapterID = assignment.ChapterID; await _context.SaveChangesAsync(); return(CreatedAtAction("UpdateAdventure", selectedAdventure)); } catch (Exception ex) { Console.WriteLine(ex); return(null); } }
public AdventureListViewModel() { Adventures.Add(new Adventure()); }
public void setLifeEvents() { int randomNumber = 0; while (lifeEvents.Count < numberOfLifeEvents) { randomNumber = DiceRoll.roll(1, 100); if (1 <= randomNumber && randomNumber <= 10) { Tragedies tragedies = new Tragedies(parents, siblings); lifeEvents.Add($"You suffered a tragedy. {tragedies.Roll()}"); } else if (11 <= randomNumber && randomNumber <= 20) { Boons boons = new Boons(); lifeEvents.Add($"You gained a bit of good fortune. {boons.Roll()}"); equipment.Add(boons.GetItem()); } else if (21 <= randomNumber && randomNumber <= 30) { Individual individual = Individual.generateIndividual(); if (lifeEvents.Contains("You fell in love or got married")) { lifeEvents.Add($"You had a child.\n{individual.getString()}"); } else { lifeEvents.Add($"You fell in love or got married.\n{individual.getString()}"); } } else if (31 <= randomNumber && randomNumber <= 40) { Individual adventurer = Individual.generateIndividual(); adventurer.relationship = "Hostile"; adventurer.setLivingStatus(); lifeEvents.Add($"You made an enemy of an adventurer. You are {(DiceRoll.roll(1, 6) % 2 == 0 ? "to blame" : "blameless")} for the rift between you two. " + $"Work with your DM to determine this hostile character’s identity and the danger this enemy poses to you.\n{adventurer.getString()}"); } else if (41 <= randomNumber && randomNumber <= 50) { Individual adventurer = Individual.generateIndividual(); adventurer.relationship = "Friendly"; adventurer.setLivingStatus(); lifeEvents.Add($"You made a friend of an adventurer. Work with your DM to add more detail to this friendly character and establish how your friendship began.\n{adventurer.getString()}"); } else if (51 <= randomNumber && randomNumber <= 70) { lifeEvents.Add("You spent time working in a job related to your background. Start the game with an extra 2d6 gp."); } else if (71 <= randomNumber && randomNumber <= 75) { Individual individual = Individual.generateIndividual(); lifeEvents.Add($"You met someone important. Work out additional details with your DM as needed to fit this character into your backstory.\n{individual.getString()}"); } else if (76 <= randomNumber && randomNumber <= 80) { Adventures adventures = new Adventures(); lifeEvents.Add($"You went on an adventure. {adventures.Roll()} Work with your DM to determine the nature of the adventure and the creatures you encountered."); equipment.Add(adventures.GetItem()); } else if (81 <= randomNumber && randomNumber <= 85) { SupernaturalEvents supernaturalEvents = new SupernaturalEvents(); lifeEvents.Add($"You had a supernatural experience. {supernaturalEvents.Roll()}"); } else if (86 <= randomNumber && randomNumber <= 90) { Wars wars = new Wars(); lifeEvents.Add($"You fought in a battle. {wars.Roll()} Work with your DM to come up with the reason for the battle and the factions involved. It might have been a small conflict between your community and a band of orcs, or it could have been a major battle in a larger war."); } else if (91 <= randomNumber && randomNumber <= 95) { Crimes crimes = new Crimes(); Punishments punishments = new Punishments(); lifeEvents.Add($"You committed a crime or were wrong accused of doing so, the nature of which was was {crimes.Roll()}. {punishments.Roll()}"); } else if (96 <= randomNumber && randomNumber <= 99) { lifeEvents.Add($"You encountered something magical. {new ArcaneMatters().Roll()}"); } else if (randomNumber == 100) { WeirdStuff weirdStuff = new WeirdStuff(); lifeEvents.Add($"Something truly strange happened to you. {weirdStuff.Roll()}"); } } }