Пример #1
0
        private bool CheckWeaponAgainstOtherProficienciesAsIfMartial(IWeaponAttackStatistics weapon)
        {
            var martialize    = new ExoticToMartialWeaponDecorator(weapon);
            var proficiencies = components.GetAll <WeaponProficiency>().Exclude(this);

            return(proficiencies.IsProficient(martialize));
        }
Пример #2
0
        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);
                }
            }
        }
Пример #3
0
        public virtual bool IsProficient(IWeaponAttackStatistics weapon)
        {
            bool passes = false;

            foreach (var prof in proficiencyList)
            {
                WeaponTrainingLevel trainingLevel;
                if (System.Enum.TryParse <WeaponTrainingLevel>(prof, true, out trainingLevel))
                {
                    passes = weapon.Level == trainingLevel;
                }
                else if (prof.Contains("\""))
                {
                    var result = Regex.Match(prof, "[\\w\\s]+");
                    passes = weapon.ProficiencyName.ContainsIgnoreCase(result.Value);
                }
                else
                {
                    passes = weapon.ProficiencyName.EqualsIgnoreCase(prof);
                }

                if (passes)
                {
                    return(true);
                }
            }
            return(false);
        }
Пример #4
0
 public WeaponProficiencyAttackModifier(OffenseStats offenseAbilities, IWeaponAttackStatistics weapon)
     : base(weapon.Name + " Proficiency Modifier",
            "proficiency penalty")
 {
     this.offenseAbilities = offenseAbilities;
     this.weapon           = weapon;
     this.Calculation      = () => { return(this.offenseAbilities.IsProficient(weapon) ? 0 : -4); };
 }
Пример #5
0
 public MeleeAttack(OffenseStats offenseAbilities,
                    AbilityScore strength,
                    CharacterSize size,
                    IWeaponAttackStatistics weapon) : base(offenseAbilities, size, weapon)
 {
     this.strength = strength;
     AttackBonus.AddModifier(new StatisticStatModifier("Melee Attack Bonus", offenseAbilities.MeleeAttackBonus));
     DamageModifier.AddModifier(this.strength.UniversalStatModifier);
     this.AttackType = AttackTypes.Melee;
 }
Пример #6
0
 public override bool IsProficient(IWeaponAttackStatistics weapon)
 {
     if (weapon.Level == WeaponTrainingLevel.Exotic)
     {
         foreach (var prof in proficiencyList)
         {
             if (weapon.Name.SearchFor(prof))
             {
                 return(CheckWeaponAgainstOtherProficienciesAsIfMartial(weapon));
             }
         }
     }
     return(false);
 }
Пример #7
0
 /// <summary>
 /// Determines whether this instance is proficient the specified weapon.
 /// </summary>
 /// <returns><c>true</c> if this instance is proficient in the specified weapon; otherwise, <c>false</c>.</returns>
 /// <param name="weapon">Weapon to check.</param>
 public bool IsProficient(IWeaponAttackStatistics weapon)
 {
     return(this.WeaponProficiencies.IsProficient(weapon));
 }
Пример #8
0
 private bool Qualifies(IWeaponAttackStatistics weapon)
 {
     return(weapon.ProficiencyName.EqualsIgnoreCase(this.Weapon.ProficiencyName));
 }
Пример #9
0
 private bool QualifyCheck(IWeaponAttackStatistics weapon)
 {
     return(weapon.Group == this.Group);
 }
Пример #10
0
 /// <summary>
 /// Determines if is proficient the specified proficiencies wpn.
 /// </summary>
 /// <returns><c>true</c> if is proficient the specified proficiencies wpn; otherwise, <c>false</c>.</returns>
 /// <param name="proficiencies">Proficiencies to validate against.</param>
 /// <param name="weapon">Weapon to validate proficiency.</param>
 public static bool IsProficient(this IEnumerable <WeaponProficiency> proficiencies, IWeaponAttackStatistics weapon)
 {
     return(proficiencies.Any(x => x.IsProficient(weapon)));
 }
Пример #11
0
 public ExoticToMartialWeaponDecorator(IWeaponAttackStatistics reference) : base(reference)
 {
 }
Пример #12
0
 public WeaponAttackStatisticDecorator(IWeaponAttackStatistics reference)
 {
     this.reference = reference;
 }