public WeaponAttack(OffenseStats offense, CharacterSize size, IWeaponAttackStatistics weapon) { this.offenseAbilities = offense; this.size = size; this.Weapon = weapon; this.Name = weapon.Name; this.Range = weapon.Range; this.DamageType = weapon.DamageType.ToString(); this.CriticalThreat = weapon.CriticalThreat; this.CriticalModifier = new BasicStat(string.Format("{0} Critical Modifier", weapon.Name), weapon.CriticalModifier); this.attackBonus = new BasicStat(string.Format("{0} Attack Bonus", weapon.Name), weapon.AttackModifier); this.attackBonus.AddModifier(new WeaponProficiencyAttackModifier(this.offenseAbilities, this.Weapon)); this.attackBonus.AddModifiers(MultipleAttackBonusModifier.GetConditionalMultipleAttackModifiers()); this.DamageModifier = new BasicStat(string.Format("{0} Damage Modifier", weapon.Name), 0); foreach (var weaponModifier in offense.WeaponModifiers) { if (weaponModifier.WeaponQualifies(weapon)) { weaponModifier.ApplyModifier(this); } } }
public static IEnumerable <ConditionalStatModifier> GetConditionalMultipleAttackModifiers() { if (multipleAttackList == null) { multipleAttackList = new List <ConditionalStatModifier>(); for (int i = 1; i < attacksToSupport; i++) { var mod = new MultipleAttackBonusModifier(i); var cond = new ConditionalStatModifier(mod, "attack {0}".Formatted(i)); multipleAttackList.Add(cond); } } return(multipleAttackList); }