public WeaponTraining(IObjectStore configuration) : base(configuration) { WeaponAttackBonus = new WeaponAttackModifier( () => { return(this.TotalValue); }, QualifyCheck ); WeaponDamageBonus = new WeaponDamageModifier( () => { return(this.TotalValue); }, QualifyCheck ); }
public void AllowCustomModifiersToAttackBonusForSpecificWeapons() { //This allows things like WeaponFocus feats var attackMod = new WeaponAttackModifier(1, x => { return(x.Name.EqualsIgnoreCase("Longsword")); }); var damageMod = new WeaponDamageModifier(2, x => { return(x.Group == WeaponGroup.HeavyBlades); }); smallStats.AddWeaponProficiency("simple"); smallStats.AddWeaponProficiency("martial"); smallStats.AddWeaponModifier(attackMod); smallStats.AddWeaponModifier(damageMod); inventory.AddGear(Longsword()); inventory.AddGear(Dagger()); //Longsword should have bonuses while dagger should not var lswordAttack = smallStats.GetWeaponAttacks().First(x => x.Name == "Longsword"); var dAttack = smallStats.GetWeaponAttacks().First(x => x.Name == "Dagger"); Assert.Equal(lswordAttack.AttackBonus.TotalValue, smallStats.MeleeAttackBonus.TotalValue + 1); Assert.Equal(lswordAttack.Damage.Modifier, 5); Assert.Equal(dAttack.AttackBonus.TotalValue, smallStats.MeleeAttackBonus.TotalValue); Assert.Equal(dAttack.Damage.Modifier, 3); }