private ArmorClass GetRacialArmorClassBonuses(ArmorClass armorClass, string creatureName, CreatureType creatureType) { var creatureBonuses = bonusSelector.SelectFor(TableNameConstants.TypeAndAmount.ArmorClassBonuses, creatureName); var creatureTypeBonuses = bonusSelector.SelectFor(TableNameConstants.TypeAndAmount.ArmorClassBonuses, creatureType.Name); var bonuses = creatureBonuses.Union(creatureTypeBonuses); foreach (var subtype in creatureType.SubTypes) { var subtypeBonuses = bonusSelector.SelectFor(TableNameConstants.TypeAndAmount.ArmorClassBonuses, subtype); bonuses = bonuses.Union(subtypeBonuses); } foreach (var bonus in bonuses) { armorClass.AddBonus(bonus.Target, bonus.Bonus, bonus.Condition); } return(armorClass); }
private Save GetRacialSavingThrowBonuses(Save save, string creatureName, CreatureType creatureType, string saveName) { var creatureBonuses = bonusSelector.SelectFor(TableNameConstants.TypeAndAmount.SaveBonuses, creatureName); var creatureTypeBonuses = bonusSelector.SelectFor(TableNameConstants.TypeAndAmount.SaveBonuses, creatureType.Name); var bonuses = creatureBonuses.Union(creatureTypeBonuses); foreach (var subtype in creatureType.SubTypes) { var subtypeBonuses = bonusSelector.SelectFor(TableNameConstants.TypeAndAmount.SaveBonuses, subtype); bonuses = bonuses.Union(subtypeBonuses); } foreach (var bonus in bonuses) { if (bonus.Target == GroupConstants.All || bonus.Target == saveName) { save.AddBonus(bonus.Bonus, bonus.Condition); } } return(save); }
public void SelectNoBonuses() { var bonuses = bonusSelector.SelectFor("table name", "source"); Assert.That(bonuses, Is.Empty); }
public IEnumerable <BonusSelection> SelectBonusesFor(string source) { var bonusSelections = bonusSelector.SelectFor(TableNameConstants.TypeAndAmount.SkillBonuses, source); return(bonusSelections); }