public override string ActivateLevelTwoUltimate(Dungeon dungeon) { if (IsExhausted) { return("Your hero is exhausted and cannot use the ultimate ability in this dungeon delve. "); } if (Experience < 5) { return("Your hero is still an Occultist and cannot use the Command Dead ultimate. Try saying Animate Dead instead. "); } // check how many skeletons we have int skeletonCount = dungeon.DungeonDice.Count(d => d.DungeonDieType == DungeonDieType.Skeleton); if (skeletonCount < 1) { return("There are no skeletons in this level. Use Command Dead when you encounter skeletons. "); } // skeletons are present let's remove up to two and add up to two fighters to our party int skeletonsToTransform = skeletonCount > 2 ? 2 : skeletonCount; string plural = skeletonsToTransform == 2 ? "s" : ""; for (int i = 0; i < skeletonsToTransform; i++) { dungeon.DungeonDice.RemoveFirst(d => d.DungeonDieType == DungeonDieType.Skeleton); PartyDie fighter = new PartyDie(); fighter.Companion = CompanionType.Fighter; fighter.IsFromMonster = true; PartyDice.Insert(0, fighter); } IsExhausted = true; return($"You cast Command Dead and transformed {skeletonsToTransform} skeleton{plural} into fighter{plural}. If not used, {skeletonsToTransform} fighter{plural} will be discarded when you complete the level. "); }
public void UsePartyDie(CompanionType companion) { // TODO: Consider using this method everywhere Dice need to be moved from party to graveyard // first check if we have a companion that was transformed from a monster bool companionFromEnemyRemoved = PartyDice.RemoveFirst(d => d.IsFromMonster && d.Companion == companion); if (companionFromEnemyRemoved) { return; } // now let's check if we have a companion that was from hero ability or treasure bool companionFromTreasureRemoved = PartyDice.RemoveFirst(d => d.IsFromTreasureOrHeroAbility && d.Companion == companion); if (companionFromTreasureRemoved) { return; } // player didnt have a companion of this type that came from treasure, let's remove a normal die var partyDie = PartyDice.First(d => d.Companion == companion); PartyDice.Remove(partyDie); Graveyard++; }
public override string RollPartyDice(Dungeon dungeon, int partySize = 7) { // roll party dice to create your party // transform scrolls to champions for this hero string message = $"Rolling the party dice. {SoundManager.DiceRollSound(true)} Your party consists of: "; int scrollCount = 0; for (int i = 0; i < partySize; i++) { PartyDie die = new PartyDie(); if (die.Companion == CompanionType.Scroll) { die.Companion = CompanionType.Champion; scrollCount++; } PartyDice.Add(die); } message += $"{GetPartyAsString()}. "; if (scrollCount == 1) { message += "One scroll was transformed to a champion. "; } else if (scrollCount > 1) { message += $"{scrollCount} scrolls were transformed to champions. "; } return(message); }
public override string ActivateLevelOneUltimate(Dungeon dungeon) { if (IsExhausted) { return("Your hero is exhausted and cannot use the ultimate ability in this dungeon delve. "); } if (Experience > 4) { return("You are a Necromancer now. To use your new ultimate ability say Command Dead. "); } // check if skeleton exists var skeleton = dungeon.DungeonDice.FirstOrDefault(d => d.DungeonDieType == DungeonDieType.Skeleton); if (skeleton == null) { return("There are no skeletons in this level. Use Animate Dead when you encounter skeletons. "); } // skeleton detected let's remove it and add a fighter to our party dungeon.DungeonDice.Remove(skeleton); PartyDie fighter = new PartyDie(); fighter.Companion = CompanionType.Fighter; fighter.IsFromMonster = true; PartyDice.Insert(0, fighter); IsExhausted = true; return("You cast Animate Dead and transformed a skeleton into a fighter. This fighter will be discarded when you complete a level. "); }
public override string ActivateLevelOneUltimate(Dungeon dungeon) { if (IsExhausted) { return("Your hero is exhausted and cannot use the ultimate ability in this dungeon delve. "); } if (IsLeveledUp) { return("You are a Chieftain now. To use your new ultimate ability say Pull Rank. "); } // check if goblin exists var goblin = dungeon.DungeonDice.FirstOrDefault(d => d.DungeonDieType == DungeonDieType.Goblin); if (goblin == null) { return("There are no goblins in this level. Use Plea For Help when you encounter goblins. "); } // goblin detected let's remove it and add a fighter to our party dungeon.DungeonDice.Remove(goblin); PartyDie thief = new PartyDie(); thief.Companion = CompanionType.Thief; thief.IsFromMonster = true; PartyDice.Insert(0, thief); IsExhausted = true; return("You Plea For Help and transformed a goblin into a thief. This thief will be discarded when you complete a level. "); }
public List <DungeonDieType> UseCompanionToAttack(string companion) { var partyDie = PartyDice.First(d => d.Name == companion); // add this companion to the graveyard and remove from party UsePartyDie(partyDie.Companion); return(partyDie.TargetList); }
public override string TransformCompanion(CompanionType companion) { if (companion == CompanionType.Scroll) { return($"You don't need to transform a scroll into a scroll. Try saying transform scroll to champion instead. "); } PartyDice.First(d => d.Companion == CompanionType.Scroll).Companion = companion; return($"You transformed a scroll into a {companion}. "); }
public bool IsCompanionInParty(string companionName, bool includeScroll = false) { // checks if the companion is present in the party if (includeScroll) { return(PartyDice.Any(d => d.Name == companionName)); } // don't include scrolls return(PartyDice.Any(d => d.Companion != CompanionType.Scroll && d.Name == companionName)); }
public string GetPartyAsString() { string message = ""; var groups = PartyDice.GroupBy(g => g.Name).OrderByDescending(g => g.Count()).Select(g => new { Key = g.Key, Count = g.Count() }); int companionCount = 0; string companionName = ""; if (groups.Count() == 1) { companionCount = groups.First().Count; companionName = groups.First().Key; if (companionCount > 1) { companionName = companionName == "thief" ? "thieves" : $"{companionName}s"; } message = $"{companionCount} {companionName}"; } else if (groups.Count() == 2) { List <string> formattedGroups = new List <string>(); foreach (var item in groups) { companionCount = item.Count; companionName = item.Key; if (companionCount > 1) { companionName = companionName == "thief" ? "thieves" : $"{companionName}s"; } formattedGroups.Add($"{companionCount} {companionName}"); } message = $"{formattedGroups[0]} and {formattedGroups[1]}"; } else if (groups.Count() > 2) { for (int i = 0; i < groups.Count(); i++) { companionCount = groups.ElementAt(i).Count; companionName = groups.ElementAt(i).Key; if (companionCount > 1) { companionName = companionName == "thief" ? "thieves" : $"{companionName}s"; } message += (i == groups.Count() - 1) ? $"and {companionCount} {companionName}" : $"{companionCount} {companionName}, "; } } else { message = "no companions"; } return(message); }
public virtual string RollPartyDice(Dungeon dungeon, int partySize = 7) { // roll party dice to create your party // use the size to determine the size of party as some heroes may have a larger party string message = $"Rolling the party dice.{SoundManager.DiceRollSound(true)} Your party consists of: "; for (int i = 0; i < partySize; i++) { PartyDie die = new PartyDie(); PartyDice.Add(die); } message += $"{GetPartyAsString()}. "; return(message); }
public override string TransformCompanion(CompanionType companion) { if (companion != CompanionType.Thief && companion != CompanionType.Mage) { return($"You cannot transform a {companion}. Try saying transform thief or transform mage instead. "); } if (companion == CompanionType.Thief) { PartyDice.First(d => d.Companion == companion).Companion = CompanionType.Mage; return("You transformed a thief into a mage. "); } PartyDice.First(d => d.Companion == companion).Companion = CompanionType.Thief; return("You transformed a mage into a thief. "); }
public string AcquireSingleTreasureItem(CompanionType companion, TreasureItem item) { // acquire a single treasure item // first remove companion from party and add to graveyard var companionDie = PartyDice.First(d => d.Companion == companion); UsePartyDie(companion); // now add treasure Inventory.Add(item); string message = $"You used a {companionDie.Name} to open a chest and received {item.TreasureType.GetDescription()}. "; return(message); }
public override string TransformCompanion(CompanionType companion) { if (companion != CompanionType.Cleric && companion != CompanionType.Mage) { return($"You cannot transform a {companion}. Try saying transform cleric or transform mage instead. "); } if (companion == CompanionType.Cleric) { PartyDice.First(d => d.Companion == companion).Companion = CompanionType.Mage; return("You transformed a cleric into a mage. "); } PartyDice.First(d => d.Companion == companion).Companion = CompanionType.Cleric; return("You transformed a mage into a cleric. "); }
public override string RollPartyDice(Dungeon dungeon, int partySize = 7) { // this hero plays with 5 party dice and starts with 5 champions string message = "Your party consists of: "; for (int i = 0; i < 5; i++) { PartyDie die = new PartyDie(); die.Companion = CompanionType.Champion; PartyDice.Add(die); } message += $"{GetPartyAsString()}. "; return(message); }
public override string ActivateLevelTwoUltimate() { if (IsExhausted) { return("Your hero is exhausted and cannot use the ultimate ability in this dungeon delve. "); } if (!IsLeveledUp) { return("Your hero is still an Alchemist and cannot use the Transformation Potion ultimate. Try saying Healing Salve instead. "); } // check if graveyard is empty if (Graveyard < 1) { return("There are no party dice in the graveyard. Use Transformation Potion when you have at least one party die in the graveyard. "); } // we have dice in the graveyard, check if we can revive two or just one int reviveCount = Graveyard == 1 ? 1 : 2; string message = ""; if (reviveCount == 1) { PartyDie die = new PartyDie(); PartyDice.Add(die); message = $"You used a Transformation Potion and added one {die.Companion} to your party. "; } else { // we need to revive two party dice Graveyard -= reviveCount; PartyDie dieOne = new PartyDie(); PartyDie dieTwo = new PartyDie(); PartyDice.Add(dieOne); PartyDice.Add(dieTwo); message = "You used a Transformation Potion and added "; if (dieOne.Companion == dieTwo.Companion) { message += dieOne.Companion == CompanionType.Thief ? "two thieves to your party. " : $"two {dieOne.Companion}s to your party. "; } else { message += $"one {dieOne.Companion}, and one {dieTwo.Companion} to your party. "; } } IsExhausted = true; return(message); }
/// <summary> /// Rolls one die that currently has the specified companion. /// </summary> /// <param name="companion"></param> /// <returns></returns> public string RollPartyDie(CompanionType companion) { string message = ""; var die = PartyDice.FirstOrDefault(d => d.Companion == companion); if (die == null) { message = $"You do not have a {companion} in your party.Choose another companion to roll. "; } else { die.Roll(); message = $"You rolled your {companion} and now got a {die.Companion} in your party. "; } return(message); }
public string ReviveCompanion(CompanionType companion) { // move a party die from graveyard to party dice then set the companion value Graveyard--; var partyDie = new PartyDie(); partyDie.Companion = companion; PartyDice.Add(partyDie); RevivalsRemaining--; if (RevivalsRemaining > 0) { return($"You added a {companion} to your party. Say revive to revive another companion. "); } // no more revivals return($"You added a {companion} to your party. "); }
public string RemoveMonsterCompanions() { // removes companions that were transfromed from monsters using a hero ability if (!PartyDice.Any(d => d.IsFromMonster)) { return(""); // no companions from monsters } // we have companions from monsters let's grab them List <PartyDie> companionsToRemove = PartyDice.Where(d => d.IsFromMonster).ToList(); PartyDice.RemoveAll(d => d.IsFromMonster); if (companionsToRemove.Count == 1) { return($"A {companionsToRemove[0].Companion} was discarded from your party. "); } // we have two that we need to remove return($"Two{companionsToRemove[0].Companion} companions were discarded from your party. "); }
public string DefeatDragon(TreasureItem treasureItem, Dungeon dungeon) { // player defeated dragon, let's remove the dice selection and move companions to graveyard string selectedCompanions = string.Join(", ", PartyDice.Where(d => d.IsSelected).Select(d => d.Name).ToList()); int companionCount = PartyDice.Count(d => d.IsSelected); for (int i = 0; i < companionCount; i++) { UsePartyDie(PartyDice.First(d => d.IsSelected).Companion); } Inventory.Add(treasureItem); string message = $"{SoundManager.DragonDeathSound(true)} <amazon:emotion name=\"excited\" intensity=\"medium\">You used your {selectedCompanions}, to defeat the dragon. You acquired {treasureItem.TreasureType.GetDescription()}. "; message += GainExperiencePoints(1, dungeon); message += "</amazon:emotion>"; return(message); }
public string UseCompanionTreasure(TreasureItem treasure) { // we used a treasure item, remove it from inventory Inventory.Remove(treasure); string message = ""; PartyDie partyDie = new PartyDie(); partyDie.IsFromTreasureOrHeroAbility = true; switch (treasure.TreasureType) { case TreasureType.VorpalSword: message = "You used your vorpal sword and added a fighter to your party. "; partyDie.Companion = CompanionType.Fighter; break; case TreasureType.Talisman: message = "You used your talisman and added a cleric to your party. "; partyDie.Companion = CompanionType.Cleric; break; case TreasureType.ScepterOfPower: message = "You used your scepter of power and added a mage to your party. "; partyDie.Companion = CompanionType.Mage; break; case TreasureType.ThievesTools: message = "You used your thieves tools and added a thief to your party. "; partyDie.Companion = CompanionType.Thief; break; case TreasureType.Scroll: message = "You used your scroll treasure item and added a scroll to your party. "; partyDie.Companion = CompanionType.Scroll; break; } // insert the new companion in the beginning of the party dice PartyDice.Insert(0, partyDie); return(message); }
public override string ActivateLevelOneUltimate() { if (IsExhausted) { return("Your hero is exhausted and cannot use the ultimate ability in this dungeon delve. "); } if (IsLeveledUp) { return("You are a Thaumaturge now. To use your new ultimate ability say Transformation Potion. "); } // check if graveyard is empty if (Graveyard < 1) { return("There are no party dice in the graveyard. Use Healing Salve when you have at least one party die in the graveyard. "); } // we have dice in the graveyard, let's add it to our party PartyDie die = new PartyDie(); PartyDice.Add(die); Graveyard--; IsExhausted = true; return($"You cast Healing Salve and added one {die.Companion} to your party. "); }
public override string ActivateLevelOneUltimate(CompanionType?companion = null, Dungeon dungeon = null) { if (IsExhausted) { return("Your hero is exhausted and cannot use the ultimate ability in this dungeon delve. "); } if (Experience > 4) { return("You are a Battlemage now. To use your new ultimate ability say Arcane Fury. "); } // lets check if valid companion is provided if (companion == null || companion.Value != CompanionType.Fighter && companion.Value != CompanionType.Mage) { return("Invalid action. To use your hero as a fighter say arcane blade fighter. To use your hero as a mage, say arcane blade mage. "); } PartyDie die = new PartyDie(); die.Companion = companion.Value; die.IsFromTreasureOrHeroAbility = true; PartyDice.Insert(0, die); IsExhausted = true; return($"You used your Arcane Blade. Your hero has been added to your party as a {companion.Value}. "); }
public override string ActivateLevelTwoUltimate(Dungeon dungeon) { if (IsExhausted) { return("Your hero is exhausted and cannot use the ultimate ability in this dungeon delve. "); } if (!IsLeveledUp) { return("Your hero is still a Half-Goblin and cannot use the Pull Rank ultimate. Try saying Plea For Help instead. "); } // check how many goblins we have int goblinCount = dungeon.DungeonDice.Count(d => d.DungeonDieType == DungeonDieType.Goblin); if (goblinCount < 1) { return("There are no goblins in this level. Use Pull Rank when you encounter goblins. "); } // goblins are present let's remove up to two and add up to two thieves to our party int goblinsToTransform = goblinCount > 2 ? 2 : goblinCount; string plural = goblinsToTransform == 2 ? "s" : ""; string pluralThief = goblinsToTransform == 2 ? "thieves" : "a thief"; for (int i = 0; i < goblinsToTransform; i++) { dungeon.DungeonDice.RemoveFirst(d => d.DungeonDieType == DungeonDieType.Goblin); PartyDie thief = new PartyDie(); thief.Companion = CompanionType.Thief; thief.IsFromMonster = true; PartyDice.Insert(0, thief); } IsExhausted = true; return($"You Pull Rank and transformed {goblinsToTransform} goblin{plural} into {pluralThief}, which will be discarded when you complete this level. "); }
public override string ActivateLevelOneUltimate(CompanionType?companion = null, Dungeon dungeon = null) { if (IsExhausted) { return("Your hero is exhausted and cannot use the ultimate ability in this dungeon delve. "); } if (IsLeveledUp) { return("You are a Paladin now. To use your new ultimate ability say Divine Intervention. "); } // lets check if valid companion is provided if (companion == null || companion.Value != CompanionType.Fighter && companion.Value != CompanionType.Cleric) { return("Invalid action. To use your hero as a fighter say Holy Strike fighter. To use your hero as a cleric, say Holy Strike cleric. "); } PartyDie die = new PartyDie(); die.Companion = companion.Value; die.IsFromTreasureOrHeroAbility = true; PartyDice.Insert(0, die); IsExhausted = true; return($"You used Holy Strike. Your hero has been added to your party as a {companion.Value}. "); }
public void ClearParty() { PartyDice.Clear(); Graveyard = 0; }