WSF
WsfExplicitWeaponEffects Class Reference

#include <WsfExplicitWeaponEffects.hpp>

Inheritance diagram for WsfExplicitWeaponEffects:
Collaboration diagram for WsfExplicitWeaponEffects:

Public Member Functions

 WsfExplicitWeaponEffects (WsfScenario &aScenario)
 ~WsfExplicitWeaponEffects () override=default
WsfWeaponEffectsClone () const override
bool ProcessInput (UtInput &aInput) override
virtual double MaximumEffectiveRadiusSquared () const
 Access the miss radius squared beyond which the weapon has no effect.
virtual double MaximumEffectiveRadius () const
 Access the miss radius beyond which the weapon has no effect.
void SetMaxiumEffectiveRadius (double aRadius)
 Set the radius beyond which the weapon has no effect.
Public Member Functions inherited from WsfWeaponEffects
 WsfWeaponEffects (WsfScenario &aScenario)
 ~WsfWeaponEffects () override
virtual bool PreInitialize ()
bool ProcessInput (UtInput &aInput) override
virtual bool Initialize (double aSimTime, const WsfWeaponEngagement *aEngagementPtr)
UtScriptContext * GetScriptAccessibleContext () const override
Result GetTargetResult () const
Result GetIncidentalResult () const
Result GetTotalResult () const
bool UseLaunchPk () const
bool UseInterceptPk () const
double GetPkDegrade () const
 Return the current Pk degrade factor.
double GetPkConstraint () const
void SetInvincibleIndex (unsigned int aPlatformID)
 Set the ID of a platform which shall not be damaged. (Usually the launching entity.).
unsigned int GetInvincibleIndex () const
 Get the ID of a platform which will not be damaged.
void SetDamageRadius (double aDamageRadius)
 Set the maximum lethal damage radius for this effect.
double GetDamageRadius () const
 Return the maximum lethal damage radius for this effect.
double GetLaunchPk () const
 Get the Launch Pk.
double GetInterceptPk () const
 Get the Intercept Pk.
bool DrawEndgamePk ()
 Force a pk draw for an external platform target.
virtual double GetCEP () const
 Access the value for engagement Circular Error Probable (CEP).
void SetCEP (double aValue)
void SetPkDegrade (double aPkDegrade)
virtual double GetPkDrawn () const
 Access the Pk value drawn for the (intended) target hit assessment.
bool DebugEnabled () const
 Returns 'true' if debugging is enabled for this instance.
void SetDebugEnabled (bool aDebugEnabled)
 Enable or disable debugging for this instance.
unsigned int KilledPlatformCount () const
 Method returns the count of platforms killed during this engagement.
bool IsKilledPlatform (size_t aPlatformIndex) const
 Returns 'true' if the specified WSF platform index has been killed during this engagement.
WsfPk::TableGetPkTable ()
WsfScenarioGetScenario ()
virtual void ProcessEffectExplicit (double aSimTime)
virtual void ProcessEffectImplicit (double aSimTime)
virtual void Terminate (double aSimTime)
void Defeat ()
bool GetIncidentalDamageAllowed () const
void SetIncidentalDamageAllowed (bool aIncidentalDamageAllowed)
bool GetParentDamageAllowed () const
void SetParentDamageAllowed (bool aParentDamageAllowed)
Public Member Functions inherited from WsfObject
 WsfObject ()
 This is the constructor for the WsfObject class.
 ~WsfObject () override
 This is the destructor for the WsfObject class.
const char * GetScriptClassName () const override
const std::string & GetType () const
WsfStringId GetTypeId () const
 Get the string ID of the 'type' of the object.
void SetType (WsfStringId aType)
const std::string & GetBaseType () const
WsfStringId GetBaseTypeId () const
const TypeListGetTypeList () const
bool IsA_TypeOf (WsfStringId aType) const
WsfObjectoperator= (const WsfObject &aRhs)
 Assignment operator.
template<typename T>
void Serialize (T &aBuff)
 For XIO (de)serialization.
const std::string & GetName () const
WsfStringId GetNameId () const
void SetName (WsfStringId aName)

Protected Member Functions

 WsfExplicitWeaponEffects (const WsfExplicitWeaponEffects &aSrc)=default
void CalcInterceptPk (double aSimTime, WsfPlatform *aTargetPtr) override
void CalcPkParameters (WsfPlatform *aTargetPtr, double &aAzimuth, double &aElevation, double &aMissileSpeed, double &aTargetSpeed) override
bool IsVulnerable (WsfPlatform *aTargetPtr) override
double LastTestRadiusSquared () const
void CalcInterceptGeometry (WsfPlatform *aTargetPtr, double &aRangeRate, double &aApproachAngle)
Protected Member Functions inherited from WsfWeaponEffects
 WsfWeaponEffects (const WsfWeaponEffects &aSrc)
 Copy Constructor for Clone().
WsfWeaponEffectsoperator= (const WsfWeaponEffects &aRhs)
virtual void ApplyEffectIncrement (double aSimTime, WsfPlatform *aOtherPlatformPtr, double aDamageAmount)
virtual void ApplyEffectTo (double aSimTime, WsfPlatform *aOtherPlatformPtr)
virtual void ApplyDamageResultToOtherPlatform (double aSimTime, WsfPlatform *aOtherPlatformPtr, double aDamage, Result aResult)
virtual void CalcLaunchPk (double aSimTime)
virtual void CalcPkDegradation (double aSimTime, WsfPlatform *aTargetPtr)
bool IsIntendedTargetValid ()
 This protected method assures that a specified target index does exist.
void AddToKilledPlatforms (unsigned int aKilledIndex)
double DrawUniformPk ()
 Draw a uniform value for Pk determination.
void ProcessEffectCommon (double aSimTime, WsfPlatform *aRefPlatformPtr)
bool Defeated () const
 Return a flag to indicate that this effect has been annulled by outside influences.
const WsfWeaponEngagementGetEngagement () const
 Return the Engagement that this effect was instantiated to support.
void SetUseLaunchPk ()
 Indicate that you wish to use the Launch Pk value (in lieu of the Intercept Pk value).
void SetUseInterceptPk ()
 Indicate that you wish to use the Intercept Pk value (in lieu of the Launch Pk value).
void SetLaunchPk (double aValue)
void SetInterceptPk (double aValue)
void SetPkDrawn (double aValue)
 Set the Pk value used in the intended target hit assessment.
void SetIncidentalResult (const WsfWeaponEffects::Result &aResult)
void SetTargetResult (const WsfWeaponEffects::Result &aResult)
void SetResult (const WsfWeaponEffects::Result &aResult, bool aIsIntended)
size_t KilledPlatform (size_t aIndex)
 Method returns an index of one of the platforms killed during this engagement.
const WsfWeaponEngagementGetEngagementPtr () const
WsfSimulationGetSimulation () const
WsfScriptContextGetScriptContext () const
 WsfObject (const WsfObject &aSrc)
 Copy constructor (for Clone()).

Additional Inherited Members

Public Types inherited from WsfWeaponEffects
enum  Result { cINVALID , cMISSED , cDAMAGED , cKILLED }
Public Types inherited from WsfObject
typedef std::vector< WsfStringIdTypeList
 The list of types returned by GetTypeList.
Static Public Member Functions inherited from WsfWeaponEffects
static WsfStringId GetWeaponEffectsType (WsfPlatform &aPlatform)
 Return the weapon effects type for the associated platform.
static std::string GetResultString (WsfWeaponEffects::Result aResult)
Static Public Attributes inherited from WsfWeaponEffects
static const char * cTYPE_KIND = "weapon_effect"
static const double cUNHARMED = 0.0
 Value indicating no damage to a player, the weapon had no effect.
static const double cMORTALLY_WOUNDED = 1.0

Detailed Description

A base class for explicit weapon effect determinations. Produces damage to platforms when a weapon detonates in proximity.

Constructor & Destructor Documentation

◆ WsfExplicitWeaponEffects() [1/2]

◆ ~WsfExplicitWeaponEffects()

WsfExplicitWeaponEffects::~WsfExplicitWeaponEffects ( )
overridedefault

◆ WsfExplicitWeaponEffects() [2/2]

WsfExplicitWeaponEffects::WsfExplicitWeaponEffects ( const WsfExplicitWeaponEffects & aSrc)
protecteddefault

Member Function Documentation

◆ CalcInterceptGeometry()

void WsfExplicitWeaponEffects::CalcInterceptGeometry ( WsfPlatform * aTargetPtr,
double & aRangeRate,
double & aApproachAngle )
protected

Utility method for use in derived classes. Calculates opening or closing speed and approach angle from true platform velocities. Does not calculate a miss distance, as the weapon_fuse does this. Since the method does not have actual locations, it cannot give them signs (approach - recede).

Parameters
aTargetPtrPlatform to consider as the target for this engagement.
aRangeRateCalculated relative speed for a hit-to-kill determination.
aApproachAngleCalculated impact angle. 0.0 = Grazing bump, 180 = head-on.

References CalcInterceptGeometry(), WsfWeaponEffects::GetEngagement(), and WsfWeaponEngagement::GetWeaponPlatform().

Referenced by CalcInterceptGeometry(), and WsfExoAtmosphericLethality::CalcInterceptPk().

◆ CalcInterceptPk()

void WsfExplicitWeaponEffects::CalcInterceptPk ( double aSimTime,
WsfPlatform * aTargetPtr )
overrideprotectedvirtual

Method to calculate the Intercept Pk, in response to engagement conditions at intercept. Will be called at the beginning of ProcessEffectExplicit().

Parameters
aSimTimesimulated time for the weapon effect.
aTargetPtrTarget under consideration for damage.

Reimplemented from WsfWeaponEffects.

Reimplemented in WsfGraduatedLethality, WsfMobilityAndFirepowerLethality, and WsfTabulatedLethality.

References CalcPkParameters(), WsfWeaponEffects::DebugEnabled(), WsfWeaponEffects::GetPkTable(), WsfObject::GetTypeId(), WsfPk::Table::LookUp(), and WsfWeaponEffects::SetInterceptPk().

◆ CalcPkParameters()

void WsfExplicitWeaponEffects::CalcPkParameters ( WsfPlatform * aTargetPtr,
double & aAzimuth,
double & aElevation,
double & aMissileSpeed,
double & aTargetSpeed )
overrideprotectedvirtual

Capture the geometry values needed to do a Pk table lookup.

Parameters
aTargetPtrPointer to the target to be evaluated for geometry.
aAzimuthMissile-body-relative azimuth to the target.
aElevationMissile-body-relative elevation to the target.
aMissileSpeedMissile speed.
aTargetSpeedTarget speed.

Reimplemented from WsfWeaponEffects.

References WsfWeaponEffects::GetEngagement(), WsfWeaponEngagement::GetTargetLocationWCS(), WsfWeaponEngagement::GetWeaponLocationWCS(), and WsfWeaponEngagement::GetWeaponPlatform().

Referenced by CalcInterceptPk().

◆ Clone()

WsfWeaponEffects * WsfExplicitWeaponEffects::Clone ( ) const
overridevirtual

Create a clone of the object.

Returns
A pointer to the new object.

Implements WsfWeaponEffects.

Reimplemented in WsfGraduatedLethality, WsfMobilityAndFirepowerLethality, WsfSphericalLethality, and WsfTabulatedLethality.

References WsfExplicitWeaponEffects(), and WsfWeaponEffects::WsfWeaponEffects().

◆ IsVulnerable()

bool WsfExplicitWeaponEffects::IsVulnerable ( WsfPlatform * aTargetPtr)
overrideprotectedvirtual

In addition to the base class checks, this also excludes platforms that are outside of the lethal radius.

Reimplemented from WsfWeaponEffects.

References WsfWeaponEffects::GetEngagement(), WsfWeaponEngagement::GetMissDistance(), WsfWeaponEngagement::GetWeaponPlatform(), and WsfWeaponEffects::IsVulnerable().

◆ LastTestRadiusSquared()

double WsfExplicitWeaponEffects::LastTestRadiusSquared ( ) const
inlineprotected

Get the miss radius squared for the most recent test. (Used in derived classes to prevent having to do the offset calculation a second time.)

Referenced by WsfSphericalLethality::ApplyEffectTo(), and WsfGraduatedLethality::CalcInterceptPk().

◆ MaximumEffectiveRadius()

double WsfExplicitWeaponEffects::MaximumEffectiveRadius ( ) const
virtual

Access the miss radius beyond which the weapon has no effect.

Get the radius beyond which the weapon has no lethal effect.

Referenced by WsfSphericalLethality::ApplyEffectTo(), WsfGraduatedLethality::PreInitialize(), WsfSphericalLethality::PreInitialize(), and ~WsfExplicitWeaponEffects().

◆ MaximumEffectiveRadiusSquared()

double WsfExplicitWeaponEffects::MaximumEffectiveRadiusSquared ( ) const
virtual

Access the miss radius squared beyond which the weapon has no effect.

Get the radius squared beyond which the weapon has no lethal effect.

Referenced by ~WsfExplicitWeaponEffects().

◆ ProcessInput()

bool WsfExplicitWeaponEffects::ProcessInput ( UtInput & aInput)
overridevirtual

Method will read a data stream, and initialize any data required by the object prior to first use. The type loader must call this method on each object after the data stream input is read.

Reimplemented from WsfObject.

Reimplemented in WsfGraduatedLethality, WsfMobilityAndFirepowerLethality, WsfSphericalLethality, and WsfTabulatedLethality.

References WsfWeaponEffects::ProcessInput().

Referenced by WsfCarltonLethality::ProcessInput(), WsfExoAtmosphericLethality::ProcessInput(), WsfGraduatedLethality::ProcessInput(), WsfMobilityAndFirepowerLethality::ProcessInput(), WsfSphericalLethality::ProcessInput(), and WsfTabulatedLethality::ProcessInput().

◆ SetMaxiumEffectiveRadius()

void WsfExplicitWeaponEffects::SetMaxiumEffectiveRadius ( double aRadius)
inline

Set the radius beyond which the weapon has no effect.

Referenced by WsfGraduatedLethality::PreInitialize().


The documentation for this class was generated from the following files:
Copyrights Multiple, All Rights Reserved