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); }
public AttackData(WeaponSystem weapon, GameUnitFireAllocation allocation, AttackSpecialProperties specialProperties = AttackSpecialProperties.None) { this.Weapon = weapon; this.DamageType = weapon.GetDamageType(); this.SpecialProperties = specialProperties; this.BonusDice = 0; this.TrackRating = weapon.GetTrackRating(); }
public virtual AttackSpecialProperties FinalizeAttackProperties(AttackSpecialProperties attackPropertiesModifier = AttackSpecialProperties.None) { if (attackPropertiesModifier.HasFlag(AttackSpecialProperties.Overrides_Weapon_Properties)) { return(attackPropertiesModifier); } else { return(this.GetAttackProperties() & attackPropertiesModifier); } }
public virtual int FinalizeScreenValue(ScreenRating screen, AttackSpecialProperties effectiveAttackProperties = AttackSpecialProperties.None) { if (effectiveAttackProperties.HasFlag(AttackSpecialProperties.Ignores_Advanced_Screens)) { return(0); // Ignores any screens } if (!screen.Advanced && effectiveAttackProperties.HasFlag(AttackSpecialProperties.Ignores_Standard_Screens)) { return(0); // Ignores standard screens } // else return(screen.Value); }