public static IList <string> GetLastNames(this EntityGateway <NameInformation> gateway) { return(gateway .Where(x => x.IsLastName) .SelectMany(x => x.Names) .ToList()); }
public static IList <string> GetLastNames(this EntityGateway <NameInformation> gateway, string race) { return(gateway .Where(x => x.IsLastName && x.MatchesRace(race)) .SelectMany(x => x.Names) .ToList()); }
public void Execute(Utility.ComponentContainer components) { for (int i = 0; i < domainCount; i++) { var currentDoms = components.GetAll <Domain>(); var domains = domainsGateway.Where(d => !currentDoms.Contains(d)); var domain = domains.ChooseOne(); components.Add(domain); } }
public IPotion Process() { var list = spellLists.Where(x => classes.Any(cls => x.Matches(cls))).ChooseOne(); var spellLevel = list.FilterByMaxLevel(maxSpellLevel).ChooseOne(); var spellName = spellLevel.Value.ChooseOne(); var spell = spells.Find(spellName); var value = 5000 * (spellLevel.Key) * (spellLevel.Key + spellLevel.Key - 1); var potion = new Potion(spell, value); return(potion); }
public Wand Process() { // choose from available spell Lists. var list = spellLists.Where(x => classes.Any(cls => x.Matches(cls))).ChooseOne(); var spellLevel = Randomly.Range(list.GetLowestSpellLevel(), list.GetHighestSpellLevel()); var spellName = list.GetAllSpells(spellLevel).ChooseOne(); var spell = spells.Find(spellName); var value = 75000 * (spellLevel) * (spellLevel + spellLevel - 1); var wand = new Wand(spell, 50, value); return(wand); }
public void ExecuteStep(CharacterSheet character) { var strategy = character.Strategy; var items = clothing.Where(x => character.Inventory.CoinPurse.CanAfford(x) && strategy.GetOptions <string>("clothes").Contains(x.Name) ); if (items.HasChoices()) { character.Inventory.Purchase(items.ChooseOne()); } }
private void ChooseParentOccupations(FamilyTree familyTree, BirthCircumstance birthCircumstance) { var availableOccupations = occupations.Where(x => x.MatchAnyTags(birthCircumstance.ParentProfessions)).ToList(); if (availableOccupations.Empty()) { availableOccupations.Add(Occupation.Unemployed()); } var fatherOccupation = availableOccupations.ChooseOne(); var motherOccupation = availableOccupations.ChooseOne(); familyTree.Father.Add(fatherOccupation); familyTree.Mother.Add(motherOccupation); }
public void Execute(Utility.ComponentContainer components) { var wizardCasting = components.Get <WizardCasting>(); var focusSchool = wizardCasting.FocusSchool; if (focusSchool.NoOppositionSchools) { return; } var opps = arcaneSchools.Where( x => x.Equals(focusSchool) == false && !x.NoOppositionSchools ).Choose(2); wizardCasting.SetOppositionSchools(opps); }
public void Execute(Utility.ComponentContainer components) { var mercies = components.Get <Mercies>(); if (mercies == null) { mercies = new Mercies(); components.Add(mercies); } var paladinLevel = components.Get <ClassLevel>(); var selected = mercyGateway.Where(x => x.Level <= paladinLevel.Level && !mercies.MercyList.Contains(x)).ChooseOne(); mercies.Add(selected); }
public void ExecuteStep(CharacterSheet character) { //TODO: Max prices should be specified by strategy //TODO: Very similiar to other purchasing routines just slightly different... var spend = System.Math.Min(20000, character.Inventory.CoinPurse.Value); while (spend > 0) { var items = gearGateway.Where(gear => character.Inventory.CoinPurse.CanAfford(gear)); if (items.HasChoices()) { var buy = items.ChooseOne(); character.Inventory.Purchase(buy); spend -= buy.Value; } else { spend = 0; } } }
public static IEnumerable <Weapon> SimpleWeapons(this EntityGateway <Weapon> gateway) { return(gateway.Where(x => x.Level == WeaponTrainingLevel.Simple)); }
public static IEnumerable <Weapon> FindByProficient(this EntityGateway <Weapon> gateway, IEnumerable <WeaponProficiency> proficiencies) { return(gateway.Where(x => proficiencies.IsProficient(x))); }
/// <summary> /// Finds the by armor types. /// </summary> /// <returns>The armors matching types.</returns> /// <param name="types">Types of armor.</param> public static IEnumerable <Armor> FindByArmorTypes(this EntityGateway <Armor> gateway, params ArmorType[] types) { return(gateway.Where(x => types.Contains(x.ArmorType))); }
/// <summary> /// Finds the type of the by armor. /// </summary> /// <returns>The armor by type.</returns> /// <param name="type">Type of armor.</param> public static IEnumerable <Armor> FindByArmorType(this EntityGateway <Armor> gateway, ArmorType type) { return(gateway.Where(x => x.ArmorType == type)); }
public static IEnumerable <Armor> FindByProficiency(this EntityGateway <Armor> gateway, IEnumerable <ArmorProficiency> proficiencies) { return(gateway.Where( x => proficiencies.IsProficient(x))); }