Package megamek.common
Record Class DamageInfo
java.lang.Object
java.lang.Record
megamek.common.DamageInfo
- Record Components:
entity- the target entity that will suffer damagehit- the hit data for the location hitdamage- the amount of damage to applyammoExplosion- ammo explosion type damage is applied directly to the IS, hurts the pilot, causes auto-ejects, and can blow the unit to smithereensdamageType- The DamageType of the attack (mostly used by specialty armor handling).damageIS- Should the target location's internal structure be damaged directly?areaSatArty- Is the damage from an area saturating artillery attack / AE damage?throughFront- Is the damage coming through the hex the unit is facing? For Cowl, etc.underWater- Is the damage coming from an underwater attack?nukeS2S- is this a ship-to-ship nuke?
public record DamageInfo(Entity entity, HitData hit, int damage, boolean ammoExplosion, DamageType damageType, boolean damageIS, boolean areaSatArty, boolean throughFront, boolean underWater, boolean nukeS2S)
extends Record
Record class for passing damage application information to a Damage Manager's damageEntity() method.
This moves a lot of boilerplate and chained function call responsibility out of TWGameManager in preparation for replacing those overloaded functions with a single function, and having callers instantiate DamageInfo
-
Constructor Summary
ConstructorsConstructorDescriptionDamageInfo(Entity entity, HitData hit, int damage) DamageInfo(Entity entity, HitData hit, int damage, boolean ammoExplosion) DamageInfo(Entity entity, HitData hit, int damage, boolean ammoExplosion, DamageType bFrag, boolean damageIS) DamageInfo(Entity entity, HitData hit, int damage, boolean ammoExplosion, DamageType bFrag, boolean damageIS, boolean areaSatArty) DamageInfo(Entity entity, HitData hit, int damage, boolean ammoExplosion, DamageType bFrag, boolean damageIS, boolean areaSatArty, boolean throughFront) DamageInfo(Entity entity, HitData hit, int damage, boolean ammoExplosion, DamageType bFrag, boolean damageIS, boolean areaSatArty, boolean throughFront, boolean underWater) DamageInfo(Entity entity, HitData hit, int damage, boolean ammoExplosion, DamageType damageType, boolean damageIS, boolean areaSatArty, boolean throughFront, boolean underWater, boolean nukeS2S) Creates an instance of aDamageInforecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of theammoExplosionrecord component.booleanReturns the value of theareaSatArtyrecord component.intdamage()Returns the value of thedamagerecord component.booleandamageIS()Returns the value of thedamageISrecord component.Returns the value of thedamageTyperecord component.entity()Returns the value of theentityrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.hit()Returns the value of thehitrecord component.booleannukeS2S()Returns the value of thenukeS2Srecord component.booleanReturns the value of thethroughFrontrecord component.final StringtoString()Returns a string representation of this record class.booleanReturns the value of theunderWaterrecord component.
-
Constructor Details
-
DamageInfo
-
DamageInfo
-
DamageInfo
public DamageInfo(Entity entity, HitData hit, int damage, boolean ammoExplosion, DamageType bFrag, boolean damageIS) -
DamageInfo
public DamageInfo(Entity entity, HitData hit, int damage, boolean ammoExplosion, DamageType bFrag, boolean damageIS, boolean areaSatArty) -
DamageInfo
public DamageInfo(Entity entity, HitData hit, int damage, boolean ammoExplosion, DamageType bFrag, boolean damageIS, boolean areaSatArty, boolean throughFront) -
DamageInfo
public DamageInfo(Entity entity, HitData hit, int damage, boolean ammoExplosion, DamageType bFrag, boolean damageIS, boolean areaSatArty, boolean throughFront, boolean underWater) -
DamageInfo
public DamageInfo(Entity entity, HitData hit, int damage, boolean ammoExplosion, DamageType damageType, boolean damageIS, boolean areaSatArty, boolean throughFront, boolean underWater, boolean nukeS2S) Creates an instance of aDamageInforecord class.- Parameters:
entity- the value for theentityrecord componenthit- the value for thehitrecord componentdamage- the value for thedamagerecord componentammoExplosion- the value for theammoExplosionrecord componentdamageType- the value for thedamageTyperecord componentdamageIS- the value for thedamageISrecord componentareaSatArty- the value for theareaSatArtyrecord componentthroughFront- the value for thethroughFrontrecord componentunderWater- the value for theunderWaterrecord componentnukeS2S- the value for thenukeS2Srecord component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
entity
Returns the value of theentityrecord component.- Returns:
- the value of the
entityrecord component
-
hit
Returns the value of thehitrecord component.- Returns:
- the value of the
hitrecord component
-
damage
public int damage()Returns the value of thedamagerecord component.- Returns:
- the value of the
damagerecord component
-
ammoExplosion
public boolean ammoExplosion()Returns the value of theammoExplosionrecord component.- Returns:
- the value of the
ammoExplosionrecord component
-
damageType
Returns the value of thedamageTyperecord component.- Returns:
- the value of the
damageTyperecord component
-
damageIS
public boolean damageIS()Returns the value of thedamageISrecord component.- Returns:
- the value of the
damageISrecord component
-
areaSatArty
public boolean areaSatArty()Returns the value of theareaSatArtyrecord component.- Returns:
- the value of the
areaSatArtyrecord component
-
throughFront
public boolean throughFront()Returns the value of thethroughFrontrecord component.- Returns:
- the value of the
throughFrontrecord component
-
underWater
public boolean underWater()Returns the value of theunderWaterrecord component.- Returns:
- the value of the
underWaterrecord component
-
nukeS2S
public boolean nukeS2S()Returns the value of thenukeS2Srecord component.- Returns:
- the value of the
nukeS2Srecord component
-