示例#1
0
        private DamageResult ResolveWeaponAttack(WeaponSystem weapon, int range, ScreenRating screenRating, int evasion = 0, int otherDRM = 0, Constants.DamageType damageTypeModifier = Constants.DamageType.None, AttackSpecialProperties attackPropertiesModifier = AttackSpecialProperties.None)
        {
            AttackSpecialProperties effectiveAttackProperties = weapon.FinalizeAttackProperties(attackPropertiesModifier);

            // Weapons with a hight TrackRating can ignore Evasion, offsetting up to the full Evasion DRM
            int totalDRM = weapon.FinalizeEvasionDRM(evasion) + otherDRM;

            // Weapons can ignore certain kinds of shields but not others
            int totalScreenRating = weapon.FinalizeScreenValue(screenRating, effectiveAttackProperties);

            Constants.DamageType effectiveDamageType = weapon.FinalizeDamageType(weapon.GetDamageType(), damageTypeModifier, effectiveAttackProperties.HasFlag(AttackSpecialProperties.Overrides_Weapon_DamageType));

            // Roll dice here
            this.Logger.LogInformation($"Attack roll! {weapon.SystemName} -- range {range} | screen {screenRating.ToString()} | net DRM {totalDRM} | {effectiveDamageType.ToString()}-type damage | rating {weapon.Rating}");

            /* "Basic" weapon behavior is to shoot like a non-penetrating beam:
             * 1D per Rating, diminishing with range
             * 1 damage on a 4 unless screened
             * 1 damage on a 5, always
             * 2 damage on a 6, unless double-screened -- then 1
             */
            DamageResult damageMatrix = FullThrustDieRolls.RollFTDamage(this.DiceUtility, weapon.GetAttackDice(), totalDRM, totalScreenRating, effectiveDamageType.HasFlag(Constants.DamageType.Penetrating));

            return(damageMatrix);
        }