private bool FeatSelectionCanBeSelectedAgain(FeatSelection featSelection) { var isEmpty = string.IsNullOrEmpty(featSelection.FocusType); return((!isEmpty && !featFocusGenerator.FocusTypeIsPreset(featSelection.FocusType)) || featSelection.CanBeTakenMultipleTimes); }
private FeatSelection SelectFeat(KeyValuePair <string, IEnumerable <string> > dataKVP) { var featSelection = new FeatSelection(); featSelection.Feat = dataKVP.Key; var data = dataKVP.Value.ToArray(); featSelection.RequiredBaseAttack = Convert.ToInt32(data[DataIndexConstants.FeatData.BaseAttackRequirementIndex]); featSelection.FocusType = data[DataIndexConstants.FeatData.FocusTypeIndex]; featSelection.Frequency.Quantity = Convert.ToInt32(data[DataIndexConstants.FeatData.FrequencyQuantityIndex]); featSelection.Frequency.TimePeriod = data[DataIndexConstants.FeatData.FrequencyTimePeriodIndex]; featSelection.Power = Convert.ToInt32(data[DataIndexConstants.FeatData.PowerIndex]); featSelection.MinimumCasterLevel = Convert.ToInt32(data[DataIndexConstants.FeatData.MinimumCasterLevelIndex]); featSelection.RequiredHands = Convert.ToInt32(data[DataIndexConstants.FeatData.RequiredHandQuantityIndex]); featSelection.RequiredNaturalWeapons = Convert.ToInt32(data[DataIndexConstants.FeatData.RequiredNaturalWeaponQuantityIndex]); featSelection.RequiresNaturalArmor = Convert.ToBoolean(data[DataIndexConstants.FeatData.RequiresNaturalArmorIndex]); featSelection.RequiresSpecialAttack = Convert.ToBoolean(data[DataIndexConstants.FeatData.RequiresSpecialAttackIndex]); featSelection.RequiresSpellLikeAbility = Convert.ToBoolean(data[DataIndexConstants.FeatData.RequiresSpellLikeAbilityIndex]); featSelection.RequiresEquipment = Convert.ToBoolean(data[DataIndexConstants.FeatData.RequiresEquipmentIndex]); featSelection.RequiredFeats = GetRequiredFeats(featSelection.Feat); featSelection.RequiredSkills = GetRequiredSkills(featSelection.Feat); featSelection.RequiredAbilities = GetRequiredAbilities(featSelection.Feat); featSelection.RequiredSpeeds = GetRequiredSpeeds(featSelection.Feat); featSelection.RequiredSizes = GetRequiredSizes(featSelection.Feat); var featsTakenMultipleTimes = collectionsSelector.SelectFrom(TableNameConstants.Collection.FeatGroups, GroupConstants.TakenMultipleTimes); featSelection.CanBeTakenMultipleTimes = featsTakenMultipleTimes.Contains(featSelection.Feat); return(featSelection); }
private bool FeatsWithFociMatch(Feat feat, FeatSelection featSelection) { return(feat.Frequency.TimePeriod == string.Empty && feat.Name == featSelection.Feat && feat.Power == featSelection.Power && feat.Foci.Any() && !string.IsNullOrEmpty(featSelection.FocusType)); }
private void AddFeatSelections(int quantity) { for (var i = 0; i < quantity; i++) { var selection = new FeatSelection(); selection.Feat = $"feat{i + 1}"; featSelections.Add(selection); } }
public void Setup() { selection = new FeatSelection(); feats = new List <Feat>(); abilities = new Dictionary <string, Ability>(); skills = new List <Skill>(); attacks = new List <Attack>(); speeds = new Dictionary <string, Measurement>(); abilities["ability"] = new Ability("ability"); speeds["speed"] = new Measurement("mph"); }
public void AllDataFromFeatSelectionIsCopiedToFeat() { var selection = new FeatSelection(); selection.Feat = "additional feat"; selection.FocusType = "focus type"; selection.Frequency.Quantity = 9266; selection.Frequency.TimePeriod = "frequency time period"; selection.Power = 12345; featSelections.Add(selection); mockFeatFocusGenerator.SetupSequence(g => g.GenerateFrom("additional feat", "focus type", skills, featSelections[0].RequiredFeats, It.IsAny <IEnumerable <Feat> >(), 90210, abilities, attacks)) .Returns("focus").Returns("wrong focus"); var feats = featsGenerator.GenerateFeats(hitPoints, 9266, abilities, skills, attacks, specialQualities, 90210, speeds, 600, 1337, "size", false); var feat = feats.Single(); Assert.That(feat.Foci.Single(), Is.EqualTo("focus")); Assert.That(feat.Frequency.Quantity, Is.EqualTo(9266)); Assert.That(feat.Frequency.TimePeriod, Is.EqualTo("frequency time period")); Assert.That(feat.Name, Is.EqualTo("additional feat")); Assert.That(feat.Power, Is.EqualTo(12345)); }