static void Main(string[] args) { // Stuff I did with leaper was just to test Only thing that should break anything in right now is.. // re-naming the Leaper.Name or Leaper.Wallet // Anything in CreateHosts.cs // Host.cs // NameYear.cs is fragile. // Tried to give a decent example of what I put together here. // wallet/costs aren't completely functional right now, but you need > then cost per day * number of days var myLeaper = new Leaper("Keith", 500); var name = myLeaper.Name; var wallet = myLeaper.Wallet; var hostList = new CreateHosts(); var year = 1999; Console.WriteLine($"NAME: {name}"); Console.WriteLine($"YOUR YEAR {year}"); Console.WriteLine($"YOUR WALLET {wallet}"); // list // year + wallet conditional var getAllJumpable = hostList.GetAllJumpableHosts(year, wallet); Console.WriteLine($"HOSTS IN YOUR YEAR THAT YOU CAN AFFORD TO JUMP TO"); hostList.DisplayMenu(getAllJumpable); Console.WriteLine("ENTER ID OF HOST TO JUMP TO"); var resp = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("ENTER THE AMOUNT OF DAYS TO STAY"); var daysResp = Convert.ToInt32(Console.ReadLine()); // void // Changes actual host // This is what we should use to jump to a host hostList.JumpToHost(year, wallet, daysResp, resp, myLeaper); }
public void JumpToHost(int year, int cashOnHand, int amountOfDays, int id, Leaper leaper) { var checkIfJumpable = GetAllJumpableHosts(year, cashOnHand); foreach (var host in checkIfJumpable) { var selectedHost = host; var name = selectedHost.Name; var age = selectedHost.Age; var time = selectedHost.Year; var price = selectedHost.CostPerDay * amountOfDays; if (cashOnHand < price) { Console.WriteLine($"Sorry {leaper.Name} you only have {leaper.Wallet} in order to jump to {name} for {amountOfDays} days"); Console.WriteLine($"You would need {price}..."); break; } if (cashOnHand >= price && host.MyId == id) { leaper.GetHostInfo(host); selectedHost.BeingUsed = true; selectedHost.UsedBy = leaper; selectedHost.PastUsers.Add(leaper); leaper.Wallet -= price; Console.WriteLine(); Console.WriteLine($"Congrats {leaper.Name}! You have Successfully Jumped to {name}!"); Console.WriteLine(); Console.WriteLine($"{name} is {age} years old, and lives in {time}"); Console.WriteLine(); Console.WriteLine($"This leap has cost you ${price}, you now have ${leaper.Wallet} left"); Console.WriteLine(); } } }
private void OnEnable() { GameObject leaper = Instantiate(_leaperPrefab, _spawnPoint.position, Quaternion.identity); _leaper = leaper.GetComponent <Leaper>(); _leaper.transform.SetParent(_spawnPoint.transform.parent); OnLeaperSpawn?.Invoke(_leaper); _leaper.OnLeaperDeath += OnLeaperDeath; }
static void Main(string[] args) { var story = new Story(); story.GetIntro(); var hostList = new CreateHosts(story.YearBorn, story.CurrentYear); var myLeaper = new Leaper(story.Name, 100); var name = myLeaper.Name; var wallet = myLeaper.Wallet; var year = story.YearBorn; Console.WriteLine($"NAME: {name}"); Console.WriteLine($"YOUR YEAR {year}"); Console.WriteLine($"YOUR WALLET {wallet}"); while (true) { // list // year + wallet conditional var getAllJumpable = hostList.GetAllJumpableHosts(story.YearBorn, wallet); Console.WriteLine($"HOSTS IN YOUR YEAR THAT YOU CAN AFFORD TO JUMP TO"); hostList.DisplayMenu(getAllJumpable); Console.WriteLine("ENTER ID OF HOST TO JUMP TO"); var resp = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("ENTER THE AMOUNT OF DAYS TO STAY"); var daysResp = Convert.ToInt32(Console.ReadLine()); var eventDescriptions = new EventList(); eventDescriptions.PrintNames(); Console.WriteLine($"Which event would like to jump into?"); var response = Console.ReadLine(); var selectedEvent = eventDescriptions.GetEvent(int.Parse(response)); Console.WriteLine($"You selected {selectedEvent.Name}"); var myEvent = new Event(selectedEvent.Name, selectedEvent.Year, selectedEvent.Location, selectedEvent.Reward); myEvent.Complete(); //// void // Changes actual host // This is what we should use to jump to a host hostList.JumpToHost(year, wallet, daysResp, resp, myLeaper); } //if (myEvent.IsPutRight == true) //{ // eventDescriptions.Remove(myEvent); // eventDescriptions.PrintNames(); //} }
static void Main(string[] args) { var eventCollection = new List <Event>(); var hostCollection = new List <Host>(); var HostA = new Host("Elvis Presley", 1954); var EventA = new Event("Memphis, TN", 1954, HostA, 1); eventCollection.Add(EventA); //hostCollection.Add(HostA); var HostB = new Host("Eddie Elroy", 1962); var EventB = new Event("Homestead, FL", 1962, HostB, 2); eventCollection.Add(EventB); //hostCollection.Add(HostB); var HostC = new Host("Kenny Sharp", 1957); var EventC = new Event("St.Louis, Missouri", 1957, HostC, 3); eventCollection.Add(EventC); //hostCollection.Add(HostC); Console.WriteLine("Hello, Welcome to Quantum Leap!"); Console.WriteLine("Please Enter your name!"); var nameResp = Console.ReadLine(); var userJumper = new Leaper(nameResp); var userName = userJumper.Name; Console.WriteLine($"Welcome {userName}! You are now a Quantum Leaper"); Console.WriteLine(" You have been tasked to travel back in Time to correct mistakes that have happened"); Console.WriteLine("You will shortly see a list of Events that need to be corrected."); foreach (var Event in eventCollection) { Event.GetMenuInfo(); } }
private void Start() { parent = transform.parent.GetComponent <Leaper>(); }
Monster CreateRandomMonster(Vector2 location) { Monster monster = null; if (Game1.isDarkOut() && CanHazMonster(Settings.Monsters.Bat)) { monster = new Bat(new Vector2()); } else if (Game1.isDarkOut() && CanHazMonster(Settings.Monsters.Ghost)) { monster = new Ghost(new Vector2()); } else if (CanHazMonster(Settings.Monsters.BigSlime)) { monster = new BigSlime(new Vector2(), GetSlimeLevel()); } else if (CanHazMonster(Settings.Monsters.Grub)) { monster = new Grub(new Vector2(), true); } else if (CanHazMonster(Settings.Monsters.Fly)) { monster = new Fly(new Vector2(), true); } else if (CanHazMonster(Settings.Monsters.Brute)) { monster = new ShadowBrute(new Vector2()); } else if (CanHazMonster(Settings.Monsters.Golem)) { monster = new RockGolem(new Vector2(), deepWoods.GetCombatLevel()); } else if (CanHazMonster(Settings.Monsters.RockCrab)) { monster = new RockCrab(new Vector2(), GetRockCrabType()); } else if (CanHazMonster(Settings.Monsters.Bug)) { monster = new Bug(new Vector2(), 121); monster.isHardModeMonster.Value = true; } else if (CanHazMonster(Settings.Monsters.ArmoredBug)) { monster = new Bug(new Vector2(), 121); monster.isHardModeMonster.Value = true; } else if (Game1.isDarkOut() && CanHazMonster(Settings.Monsters.PutridGhost)) { monster = new Ghost(new Vector2(), "Putrid Ghost"); } else if (Game1.isDarkOut() && CanHazMonster(Settings.Monsters.DustSprite)) { monster = new DustSpirit(new Vector2()); new Leaper(); } else if (Game1.isDarkOut() && CanHazMonster(Settings.Monsters.Spider)) { monster = new Leaper(new Vector2()); } else { foreach (var modMonster in DeepWoodsAPI.ToShuffledList(ModEntry.GetAPI().Monsters)) { // Item1 is a mod provided function that returns true if the mod wants to spawn a custom monster at this location. // Item2 is a mod provided function that returns the custom monster. if (modMonster.Item1(deepWoods, location)) { monster = modMonster.Item2(); break; } } } // No other monster was selected and no mod provided a monster, default to green slime if (monster == null) { monster = new GreenSlime(new Vector2(), GetSlimeLevel()); } if (!Settings.Monsters.DisableBuffedMonsters && deepWoods.level.Value >= Settings.Level.MinLevelForBuffedMonsters && !this.random.CheckChance(Settings.Monsters.ChanceForUnbuffedMonster)) { BuffMonster(monster); } if (!Settings.Monsters.DisableDangerousMonsters && deepWoods.level.Value >= Settings.Level.MinLevelForDangerousMonsters && !this.random.CheckChance(Settings.Monsters.ChanceForNonDangerousMonster)) { monster.isHardModeMonster.Value = true; } monster.faceDirection(this.random.GetRandomValue(0, 4)); return(monster); }
static void Main(string[] args) { // Initialize Event Repository and create events var eventRepository = new EventRepository(); var leaperRepository = new LeaperRepository(); var myLeaper = new Leaper(); leaperRepository.AddLeaper(myLeaper); var event1 = new Event { Location = "Moon Landing", Date = new DateTime(2069, 07, 20), Host = "Buzz Aldrin", IsPutRight = false, }; eventRepository.AddEvent(event1); var event2 = new Event { Location = "Assassination of Franz Ferdinand", Date = new DateTime(1914, 06, 28), Host = "Gavrilo Princip", IsPutRight = false, }; eventRepository.AddEvent(event2); var event3 = new Event { Location = "Attack on Pearl Harbor", Date = new DateTime(1941, 12, 7), Host = "Franklin D. Roosevelt", IsPutRight = false, }; eventRepository.AddEvent(event3); var event4 = new Event { Location = "Assassination of J.F.K.", Date = new DateTime(1967, 08, 20), Host = "Jackie Onassis Kennedy", IsPutRight = false, }; eventRepository.AddEvent(event4); var event5 = new Event { Location = "Signing of the Treaty of Versailles", Date = new DateTime(1919, 06, 28), Host = "Woodrow Wilson", IsPutRight = false, }; eventRepository.AddEvent(event5); var event6 = new Event { Location = "Bombing of Hiroshima", Date = new DateTime(1945, 08, 06), Host = "Major General Curtis Lemay", IsPutRight = false, }; eventRepository.AddEvent(event6); var event7 = new Event { Location = "Boston Tea Party", Date = new DateTime(1773, 12, 16), Host = "Samuel Adams", IsPutRight = false, }; eventRepository.AddEvent(event7); var event8 = new Event { Location = "Day Frito-Lay stops making Doritos 3D", Date = new DateTime(2092, 02, 16), Host = "Someone who really freakin' loves Doritos 3D", IsPutRight = false, }; eventRepository.AddEvent(event8); var event9 = new Event { Location = "Fall of the Berlin Wall", Date = new DateTime(1989, 11, 09), Host = "Mikhail Gorbachev", IsPutRight = false, }; eventRepository.AddEvent(event9); var event10 = new Event { Location = "Chernobyl Disaster", Date = new DateTime(1986, 04, 26), Host = "Anatoly Dyatlov", IsPutRight = false, }; eventRepository.AddEvent(event10); // Creates a Dictionary and adds each event to it Dictionary <int, Event> eventDictionary = new Dictionary <int, Event>(); var allEvents = eventRepository.GetAllEvents(); for (var i = 0; i < allEvents.Count; i++) { eventDictionary.Add(i, eventRepository.GetAllEvents()[i]); } // Checks if the leaper has leaped yet // If they have and leap again the "would you like to leap" prompt is skipped int leapCount = 0; void LeapPrompt() { var budget = new Budget(); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine((leapCount == 0 ? " After theorizing that time travel could happen within your own lifetime,\n" + " you stepped into the Quantum Leap accelerator, and vanished.\n " + "When you awoke you found yourself trapped in the past,\n" + " facing a mirror image that was not your own.\n" + " Now driven by an unknown force to change history for the better\n" + " you are guided by AI (a Hologram that only you can see and hear).\n AI asks in a robotic voice... \n " : null)); Console.ForegroundColor = ConsoleColor.White; int windowWidth = Console.WindowWidth; int size = windowWidth; Console.WriteLine(); Console.WriteLine("".PadLeft(size, '=').PadRight(size, '=')); Console.WriteLine(); Console.WriteLine("Press enter to continue..."); Console.ReadKey(); Console.Clear(); Console.WriteLine((leapCount == 0 ? $"Welcome, traveller. Would you like to take a leap? (y/n)" : null)); Console.WriteLine(); string answer = (leapCount == 0 ? Console.ReadLine().ToUpper() : "Y"); while (true) { if (answer == "N") { Console.Clear(); Console.WriteLine(); Console.WriteLine("FINE! BE BORING!"); Console.WriteLine(); Environment.Exit(0); break; } if (answer == "Y") { if (myLeaper.Name == null) { Console.Clear(); Console.WriteLine(); Console.WriteLine("You are very brave to attempt such a feat. What's your name?"); Console.WriteLine(); var nameResponse = Console.ReadLine(); Console.Clear(); myLeaper.Name = nameResponse; } // Loops through the dictionary and prints each event, also adds 1 to each Key so // that they don't start with 0 // Filter out current event if user has already made a leap // Removes event permanently if (myLeaper.CurrentEventObj != null) { var currentEventToRemove = eventDictionary.First(x => x.Value == myLeaper.CurrentEventObj).Key; eventDictionary.Remove(currentEventToRemove); } foreach (var singleEvent in eventDictionary) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(); Console.WriteLine($"{singleEvent.Key + 1} Location: {singleEvent.Value.Location}"); Console.WriteLine($"Date: {singleEvent.Value.Date}"); Console.WriteLine($"Host: {singleEvent.Value.Host}"); Console.WriteLine($"Made Right? {singleEvent.Value.IsPutRight}"); // Doesn't let current event write to the console when making a new leap //Console.ForegroundColor = ConsoleColor.Yellow; //Console.WriteLine(); //Console.WriteLine((singleEvent.Value == myLeaper.CurrentEventObj ? null : $"{singleEvent.Key + 1} Location: {singleEvent.Value.Location}")); //Console.WriteLine((singleEvent.Value == myLeaper.CurrentEventObj ? null : $"Date: {singleEvent.Value.Date}")); //Console.WriteLine((singleEvent.Value == myLeaper.CurrentEventObj ? null : $"Host: {singleEvent.Value.Host}")); //Console.WriteLine((singleEvent.Value == myLeaper.CurrentEventObj ? null : $"Made Right? {singleEvent.Value.IsPutRight}")); } Console.ForegroundColor = ConsoleColor.White; // Expects the user to enter the number associated with the event // and subtracts 1 to match dictionary's index Console.WriteLine(); Console.WriteLine($"Please select the leap you would like to complete, {myLeaper.Name}."); Console.WriteLine(); int chosenLeapIndex = int.Parse(Console.ReadLine()); Console.Clear(); var chosenLeap = eventDictionary[chosenLeapIndex - 1]; // Returns the number of days between today and the chosen leap var attemptedLeap = eventRepository.DaysBetweenEvents(eventRepository.StartingDate(), chosenLeap.Date); // Uses TimeSpan, that's where .Days comes from Console.WriteLine(); Console.WriteLine($"Days to leap: {Math.Abs(attemptedLeap.Days)}"); // Prints cost to leap between two dates Console.WriteLine(); Console.WriteLine($"Cost to leap: ${budget.TotalLeapCost(attemptedLeap)}"); // Checks budget Console.WriteLine(); budget.checkBalance(budget.TotalLeapCost(attemptedLeap), chosenLeap); Console.WriteLine(); leaperRepository.TakeTheLeap(chosenLeap, myLeaper); Console.WriteLine(); Console.WriteLine($"You are now inhabiting the body of {myLeaper.CurrentEventObj.Host}."); Console.WriteLine(); Console.WriteLine("You arrived just in time to make this situation right."); var futureDateToChange = eventRepository.UpdateEvent(chosenLeap.Date); Console.WriteLine(); Console.WriteLine($"However, your actions have also changed the {futureDateToChange.Location}."); Console.WriteLine(); Console.WriteLine("Take heed. Every action you take throughout time can change the course of history."); break; } Console.WriteLine(); Console.WriteLine("Please reply with y or n"); answer = Console.ReadLine().ToUpper(); } } void Prompter() { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(); Console.WriteLine("1. Make another leap"); Console.WriteLine("2. See leap history"); Console.WriteLine("3. End Journey"); Console.WriteLine(); int resp = int.Parse(Console.ReadLine()); Console.Clear(); ExecuteProgram(resp); } void ExecuteProgram(int response) { if (response == 1) { LeapPrompt(); Prompter(); } else if (response == 2) { Console.ForegroundColor = ConsoleColor.Blue; leaperRepository.GetLeapHistory(myLeaper); Prompter(); } else if (response == 3) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Adios!"); return; } } LeapPrompt(); leapCount++; Console.WriteLine(); int windowWidth1 = Console.WindowWidth; int size1 = windowWidth1; Console.WriteLine(); Console.WriteLine("".PadLeft(size1, '=').PadRight(size1, '=')); Console.WriteLine(); Prompter(); }
public ActionResult UpdateLeaperBudget(Leaper leaper) { var updatedLeaper = _leaperRepository.UpdateBudget(leaper); return(Ok(updatedLeaper)); }
private void OnLeaperSpawn(Leaper leaper) { leaper.OnLeaperDeath += OnLeaperDeath; }
/// <summary>Generates a monster and places it on the specified map and tile.</summary> /// <param name="monsterType">The monster type's name and an optional dictionary of monster-specific settings.</param> /// <param name="location">The GameLocation where the monster should be spawned.</param> /// <param name="tile">The x/y coordinates of the tile where the monster should be spawned.</param> /// <param name="areaID">The UniqueAreaID of the related SpawnArea. Required for log messages.</param> /// <returns>Returns the monster's ID value, or null if the spawn process failed.</returns> public static int?SpawnMonster(MonsterType monsterType, GameLocation location, Vector2 tile, string areaID = "") { Monster monster = null; //an instatiated monster, to be spawned into the world later Color?color = null; //the monster's color (used by specific monster types) if (monsterType.Settings != null) //if settings were provided { if (monsterType.Settings.ContainsKey("Color")) //if this setting was provided { string[] colorText = ((string)monsterType.Settings["Color"]).Trim().Split(' '); //split the setting string into strings for each number List <int> colorNumbers = new List <int>(); foreach (string text in colorText) //for each string { int num = Convert.ToInt32(text); //convert it to a number if (num < 0) { num = 0; } //minimum 0 else if (num > 255) { num = 255; } //maximum 255 colorNumbers.Add(num); //add it to the list } //convert strings into RGBA values int r = Convert.ToInt32(colorNumbers[0]); int g = Convert.ToInt32(colorNumbers[1]); int b = Convert.ToInt32(colorNumbers[2]); int a; if (colorNumbers.Count > 3) //if the setting included an "A" value { a = Convert.ToInt32(colorNumbers[3]); } else //if the setting did not include an "A" value { a = 255; //default to no transparency } color = new Color(r, g, b, a); //set the color } else if (monsterType.Settings.ContainsKey("MinColor") && monsterType.Settings.ContainsKey("MaxColor")) //if color wasn't provided, but mincolor & maxcolor were { string[] minColorText = ((string)monsterType.Settings["MinColor"]).Trim().Split(' '); //split the setting string into strings for each number List <int> minColorNumbers = new List <int>(); foreach (string text in minColorText) //for each string { int num = Convert.ToInt32(text); //convert it to a number if (num < 0) { num = 0; } //minimum 0 else if (num > 255) { num = 255; } //maximum 255 minColorNumbers.Add(num); //add it to the list } string[] maxColorText = ((string)monsterType.Settings["MaxColor"]).Trim().Split(' '); //split the setting string into strings for each number List <int> maxColorNumbers = new List <int>(); foreach (string text in maxColorText) //for each string { int num = Convert.ToInt32(text); //convert it to a number if (num < 0) { num = 0; } //minimum 0 else if (num > 255) { num = 255; } //maximum 255 maxColorNumbers.Add(num); //convert to number } for (int x = 0; x < minColorNumbers.Count && x < maxColorNumbers.Count; x++) //for each pair of values { if (minColorNumbers[x] > maxColorNumbers[x]) //if min > max { //swap min and max int temp = minColorNumbers[x]; minColorNumbers[x] = maxColorNumbers[x]; maxColorNumbers[x] = temp; } } //pick random RGBA values between min and max int r = RNG.Next(minColorNumbers[0], maxColorNumbers[0] + 1); int g = RNG.Next(minColorNumbers[1], maxColorNumbers[1] + 1); int b = RNG.Next(minColorNumbers[2], maxColorNumbers[2] + 1); int a; if (minColorNumbers.Count > 3 && maxColorNumbers.Count > 3) //if both settings included an "A" value { a = RNG.Next(minColorNumbers[3], maxColorNumbers[3] + 1); } else //if one/both of the settings did not include an "A" value { a = 255; //default to no transparency } color = new Color(r, g, b, a); //set the color } } //set fields that affect some monster types in different ways bool seesPlayers = false; //whether the monster automatically "sees" players at spawn int facingDirection = 2; //the direction the monster should be facing at spawn bool rangedAttacks = true; //whether the monster is allowed to use its ranged attacks (if any) if (monsterType.Settings != null) //if settings were provided { if (monsterType.Settings.ContainsKey("SeesPlayersAtSpawn")) //if this setting was provided { seesPlayers = (bool)monsterType.Settings["SeesPlayersAtSpawn"]; //use it } if (monsterType.Settings.ContainsKey("FacingDirection")) //if this setting was provided { string directionString = (string)monsterType.Settings["FacingDirection"]; //get it switch (directionString.Trim().ToLower()) { //get an integer representing the direction case "up": facingDirection = 0; break; case "right": facingDirection = 1; break; case "down": facingDirection = 2; break; case "left": facingDirection = 3; break; } } if (monsterType.Settings.ContainsKey("RangedAttacks")) //if this setting was provided { rangedAttacks = (bool)monsterType.Settings["RangedAttacks"]; //use it } } //create a new monster based on the provided name & apply type-specific settings switch (monsterType.MonsterName.ToLower()) //avoid most casing issues by making this lower-case { case "bat": monster = new BatFTM(tile, 0); break; case "frostbat": case "frost bat": monster = new BatFTM(tile, 40); break; case "lavabat": case "lava bat": monster = new BatFTM(tile, 80); break; case "iridiumbat": case "iridium bat": monster = new BatFTM(tile, 171); break; case "doll": case "curseddoll": case "cursed doll": monster = new BatFTM(tile, -666); break; case "skull": case "hauntedskull": case "haunted skull": monster = new BatFTM(tile, 77377); break; case "magmasprite": case "magma sprite": monster = new BatFTM(tile, -555); break; case "magmasparker": case "magma sparker": monster = new BatFTM(tile, -556); break; case "bigslime": case "big slime": case "biggreenslime": case "big green slime": monster = new BigSlimeFTM(tile, 0); if (color.HasValue) //if color was provided { ((BigSlimeFTM)monster).c.Value = color.Value; //set its color after creation } if (seesPlayers) { monster.IsWalkingTowardPlayer = true; } break; case "bigblueslime": case "big blue slime": case "bigfrostjelly": case "big frost jelly": monster = new BigSlimeFTM(tile, 40); if (color.HasValue) //if color was provided { ((BigSlimeFTM)monster).c.Value = color.Value; //set its color after creation } if (seesPlayers) { monster.IsWalkingTowardPlayer = true; } break; case "bigredslime": case "big red slime": case "bigredsludge": case "big red sludge": monster = new BigSlimeFTM(tile, 80); if (color.HasValue) //if color was provided { ((BigSlimeFTM)monster).c.Value = color.Value; //set its color after creation } if (seesPlayers) { monster.IsWalkingTowardPlayer = true; } break; case "bigpurpleslime": case "big purple slime": case "bigpurplesludge": case "big purple sludge": monster = new BigSlimeFTM(tile, 121); if (color.HasValue) //if color was provided { ((BigSlimeFTM)monster).c.Value = color.Value; //set its color after creation } if (seesPlayers) //if the "SeesPlayersAtSpawn" setting is true { monster.IsWalkingTowardPlayer = true; } break; case "bluesquid": case "blue squid": monster = new BlueSquid(tile); break; case "bug": monster = new Bug(tile, 0); break; case "armoredbug": case "armored bug": monster = new Bug(tile, 121); break; case "dino": case "dinomonster": case "dino monster": case "pepper": case "pepperrex": case "pepper rex": case "rex": monster = new DinoMonster(tile); if (!rangedAttacks) { DinoMonster dino = monster as DinoMonster; dino.timeUntilNextAttack = int.MaxValue; dino.nextFireTime = int.MaxValue; } break; case "duggy": monster = new DuggyFTM(tile); break; case "magmaduggy": case "magma duggy": monster = new DuggyFTM(tile, true); break; case "dust": case "sprite": case "dustsprite": case "dust sprite": case "spirit": case "dustspirit": case "dust spirit": monster = new DustSpiritFTM(tile); break; case "dwarvishsentry": case "dwarvish sentry": case "dwarvish": case "sentry": monster = new DwarvishSentry(tile); for (int x = Game1.delayedActions.Count - 1; x >= 0; x--) //check each existing DelayedAction (from last to first) { if (Game1.delayedActions[x].stringData == "DwarvishSentry") //if this action seems to be playing this monster's sound effect { Game1.delayedActions.Remove(Game1.delayedActions[x]); //remove the action (preventing this monster's global sound effect after creation) break; //skip the rest of the actions } } break; case "ghost": monster = new GhostFTM(tile); break; case "carbonghost": case "carbon ghost": monster = new GhostFTM(tile, "Carbon Ghost"); break; case "putridghost": case "putrid ghost": monster = new GhostFTM(tile, "Putrid Ghost"); break; case "slime": case "greenslime": case "green slime": monster = new GreenSlime(tile, 0); if (color.HasValue) //if color was also provided { ((GreenSlime)monster).color.Value = color.Value; //set its color after creation } break; case "blueslime": case "blue slime": case "frostjelly": case "frost jelly": monster = new GreenSlime(tile, 40); if (color.HasValue) //if color was also provided { ((GreenSlime)monster).color.Value = color.Value; //set its color after creation } break; case "redslime": case "red slime": case "redsludge": case "red sludge": monster = new GreenSlime(tile, 80); if (color.HasValue) //if color was also provided { ((GreenSlime)monster).color.Value = color.Value; //set its color after creation } break; case "purpleslime": case "purple slime": case "purplesludge": case "purple sludge": monster = new GreenSlime(tile, 121); if (color.HasValue) //if color was also provided { ((GreenSlime)monster).color.Value = color.Value; //set its color after creation } break; case "tigerslime": case "tiger slime": monster = new GreenSlime(tile, 0); //create any "normal" slime ((GreenSlime)monster).makeTigerSlime(); //convert it into a tiger slime if (color.HasValue) //if color was also provided { ((GreenSlime)monster).color.Value = color.Value; //set its color after creation } break; case "prismaticslime": case "prismatic slime": monster = new GreenSlime(tile, 0); //create any "normal" slime ((GreenSlime)monster).makePrismatic(); //convert it into a prismatic slime if (color.HasValue) //if color was also provided { ((GreenSlime)monster).color.Value = color.Value; //set its color after creation } break; case "grub": case "cavegrub": case "cave grub": monster = new GrubFTM(tile, false); break; case "fly": case "cavefly": case "cave fly": monster = new FlyFTM(tile, false); break; case "mutantgrub": case "mutant grub": monster = new GrubFTM(tile, true); break; case "mutantfly": case "mutant fly": monster = new FlyFTM(tile, true); break; case "metalhead": case "metal head": monster = new MetalHead(tile, 0); if (color.HasValue) //if color was provided { ((MetalHead)monster).c.Value = color.Value; //set its color after creation } break; case "hothead": case "hot head": monster = new HotHead(tile); if (color.HasValue) //if color was provided { ((HotHead)monster).c.Value = color.Value; //set its color after creation } break; case "lavalurk": case "lava lurk": monster = new LavaLurkFTM(tile, rangedAttacks); break; case "leaper": monster = new Leaper(tile); break; case "mummy": monster = new MummyFTM(tile); break; case "rockcrab": case "rock crab": monster = new RockCrab(tile); break; case "lavacrab": case "lava crab": monster = new LavaCrab(tile); break; case "iridiumcrab": case "iridium crab": monster = new RockCrab(tile, "Iridium Crab"); break; case "falsemagmacap": case "false magma cap": case "magmacap": case "magma cap": monster = new RockCrab(tile, "False Magma Cap"); monster.HideShadow = true; //hide shadow, making them look more like "real" magma caps break; case "stickbug": case "stick bug": monster = new RockCrab(tile); (monster as RockCrab).makeStickBug(); break; case "rockgolem": case "rock golem": case "stonegolem": case "stone golem": monster = new RockGolemFTM(tile); break; case "wildernessgolem": case "wilderness golem": monster = new RockGolemFTM(tile, Game1.player.CombatLevel); break; case "serpent": monster = new SerpentFTM(tile); break; case "royalserpent": case "royal serpent": monster = new SerpentFTM(tile, "Royal Serpent"); break; case "brute": case "shadowbrute": case "shadow brute": monster = new ShadowBrute(tile); break; case "shaman": case "shadowshaman": case "shadow shaman": monster = new ShadowShaman(tile); if (!rangedAttacks) { Helper.Reflection.GetField <int>(monster, "coolDown", false)?.SetValue(int.MaxValue); //set spell cooldown to max } break; case "sniper": case "shadowsniper": case "shadow sniper": monster = new Shooter(tile); if (!rangedAttacks) { (monster as Shooter).nextShot = float.MaxValue; //set shot cooldown to max } break; case "skeleton": monster = new SkeletonFTM(tile, false, rangedAttacks); if (seesPlayers) { Helper.Reflection.GetField <bool>(monster, "spottedPlayer", false)?.SetValue(true); //set "spotted player" field to true monster.IsWalkingTowardPlayer = true; } break; case "skeletonmage": case "skeleton mage": monster = new SkeletonFTM(tile, true, rangedAttacks); if (seesPlayers) { Helper.Reflection.GetField <bool>(monster, "spottedPlayer", false)?.SetValue(true); //set "spotted player" field to true monster.IsWalkingTowardPlayer = true; } break; case "spiker": monster = new Spiker(tile, facingDirection); break; case "squidkid": case "squid kid": monster = new SquidKidFTM(tile); if (!rangedAttacks) { Helper.Reflection.GetField <int>(monster, "lastFireball", false)?.SetValue(int.MaxValue); //set fireball cooldown to max } break; default: //if the name doesn't match any directly known monster types //check MTF monster types if (MonstersTheFrameworkAPI.IsKnownMonsterType(monsterType.MonsterName, true)) //if this is a known (and previously validated) monster type from MTF { monster = MonstersTheFrameworkAPI.CreateMonster(monsterType.MonsterName); //create it through the MTF interface break; } //handle the name as a custom Type Type externalType = GetTypeFromName(monsterType.MonsterName, typeof(Monster)); //find a monster subclass with a matching name monster = (Monster)Activator.CreateInstance(externalType, tile); //create a monster with the Vector2 constructor break; } if (monster == null) { Monitor.Log($"The monster to be spawned (\"{monsterType.MonsterName}\") doesn't match any known monster types. Make sure that name isn't misspelled in your config file.", LogLevel.Info); return(null); } int?ID = MonsterTracker.AddMonster(monster); //generate an ID for this monster if (!ID.HasValue) { Monitor.Log("A new monster ID could not be generated. This is may be due to coding issue; please report it to this mod's developer. This monster won't be spawned.", LogLevel.Warn); return(null); } monster.id = ID.Value; //assign the ID to this monster monster.MaxHealth = monster.Health; //some monster types set Health on creation and expect MaxHealth to be updated like this ApplyMonsterSettings(monster, monsterType.Settings, areaID); //adjust the monster based on any other provided optional settings //spawn the completed monster at the target location Monitor.VerboseLog($"Spawning monster. Type: {monsterType.MonsterName}. Location: {tile.X},{tile.Y} ({location.Name})."); monster.currentLocation = location; monster.setTileLocation(tile); location.addCharacter(monster); return(monster.id); }
public IEnumerable <Leap> GetLeapHistory(Leaper currentLeaper) { var filteredList = _listOfLeaps.Where(x => x.Leaper.Id == currentLeaper.Id); return(filteredList); }
private Leap CreateALeap(Leaper currentLeaper, HostRepository hostRepository, EventRepository eventRepository) { var createdLeap = new Leap(currentLeaper, hostRepository.GetRandomHost(), eventRepository.GetRandomEvent()); return(createdLeap); }
public void TakeALeap(Leaper currentLeaper, HostRepository hostRepository, EventRepository eventRepository) { var newLeap = CreateALeap(currentLeaper, hostRepository, eventRepository); _listOfLeaps.Add(newLeap); }
static void Main(string[] args) { var budget = new Budget(); var eventRepository = new EventRepository(); eventRepository.PopulateEvents(); var hostRepository = new HostRepository(); hostRepository.CreateSeedDataHosts(); var currentLeaper = new Leaper("Zack Taylor"); var leapRepository = new LeapRepository(); var action = ""; do { Console.WriteLine("What do you want to do? [leap/fund/get history/exit]"); action = Console.ReadLine(); // leap if (action == "leap") { if (budget.CheckBudget()) { leapRepository.TakeALeap(currentLeaper, hostRepository, eventRepository); var newLeapComplete = leapRepository.ReturnLastLeap(); Console.WriteLine($"Leap complete. You were hosted by " + $"{newLeapComplete.Host.Name} and you went to {newLeapComplete.Event.Location}."); } else { Console.WriteLine($"You need to add funds."); } } // fund if (action == "fund") { budget.AddFunds(); Console.WriteLine("You added $5000 to your budget"); } // get history if (action == "get history") { var leapHistory = leapRepository.GetLeapHistory(currentLeaper); int leapCounter = 1; foreach (var leap in leapHistory) { Console.WriteLine(leapCounter); Console.WriteLine($"Location: {leap.Event.Location}"); Console.WriteLine($"Date: {leap.Event.Date.ToString("MM/dd/yyyy")}"); Console.WriteLine($"Leaper: {leap.Leaper.Name}"); Console.WriteLine($"Host: {leap.Host.Name}"); Console.WriteLine(""); leapCounter++; } } } while (action != "exit"); }
public ActionResult UpdateLeaper(Leaper leaperToUpdate) { var updatedLeaper = _leaperRepository.UpdateLeaper(leaperToUpdate); return(Ok(updatedLeaper)); }