public WeaponTraining(IObjectStore configuration) : base(configuration) { WeaponAttackBonus = new WeaponAttackModifier( () => { return(this.TotalValue); }, QualifyCheck ); WeaponDamageBonus = new WeaponDamageModifier( () => { return(this.TotalValue); }, QualifyCheck ); }
public override void Initialize(ComponentContainer components) { base.Initialize(components); var offense = components.Get <OffenseStats>(); var possibileWeapons = GetWeapons().FindByProficient(offense.WeaponProficiencies).CreateFlatTable(); WeaponName = possibileWeapons.ChooseRandomly().Name; this.Name = "{0} ({1})".Formatted(this.Name, this.WeaponName); this.AttackModifier = new WeaponAttackModifier( 1, x => { return(x.Name == WeaponName); } ); offense.AddWeaponModifier(this.AttackModifier); }
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); }