Attack¶
Examples¶
Example¶
<Attack>
<Melee>
<AttackName>
Spear
</AttackName>
<Damage>
<Hack>
10.0
</Hack>
<Pierce>
0.0
</Pierce>
<Crush>
5.0
</Crush>
</Damage>
<MaxRange>
4.0
</MaxRange>
<RepeatTime>
1000
</RepeatTime>
<Bonuses>
<Bonus1>
<Civ>
pers
</Civ>
<Classes>
Infantry
</Classes>
<Multiplier>
1.5
</Multiplier>
</Bonus1>
<BonusCavMelee>
<Classes>
Cavalry Melee
</Classes>
<Multiplier>
1.5
</Multiplier>
</BonusCavMelee>
</Bonuses>
<RestrictedClasses datatype="tokens">
Champion
</RestrictedClasses>
<PreferredClasses datatype="tokens">
Cavalry Infantry
</PreferredClasses>
</Melee>
<Ranged>
<AttackName>
Bow
</AttackName>
<Damage>
<Hack>
0.0
</Hack>
<Pierce>
10.0
</Pierce>
<Crush>
0.0
</Crush>
</Damage>
<MaxRange>
44.0
</MaxRange>
<MinRange>
20.0
</MinRange>
<Origin>
<X>
0
</X>
<Y>
10.0
</Y>
<Z>
0
</Z>
</Origin>
<PrepareTime>
800
</PrepareTime>
<RepeatTime>
1600
</RepeatTime>
<EffectDelay>
1000
</EffectDelay>
<Bonuses>
<Bonus1>
<Classes>
Cavalry
</Classes>
<Multiplier>
2
</Multiplier>
</Bonus1>
</Bonuses>
<Projectile>
<Speed>
50.0
</Speed>
<Spread>
2.5
</Spread>
<ActorName>
props/units/weapons/rock_flaming.xml
</ActorName>
<ImpactActorName>
props/units/weapons/rock_explosion.xml
</ImpactActorName>
<ImpactAnimationLifetime>
0.1
</ImpactAnimationLifetime>
<FriendlyFire>
false
</FriendlyFire>
</Projectile>
<RestrictedClasses datatype="tokens">
Champion
</RestrictedClasses>
<Splash>
<Shape>
Circular
</Shape>
<Range>
20
</Range>
<FriendlyFire>
false
</FriendlyFire>
<Damage>
<Hack>
0.0
</Hack>
<Pierce>
10.0
</Pierce>
<Crush>
0.0
</Crush>
</Damage>
</Splash>
</Ranged>
<Slaughter>
<Damage>
<Hack>
1000.0
</Hack>
<Pierce>
0.0
</Pierce>
<Crush>
0.0
</Crush>
</Damage>
<RepeatTime>
1000
</RepeatTime>
<MaxRange>
4.0
</MaxRange>
</Slaughter>
</Attack>
XML Elements¶
The following elements can be used within this component:
Attack¶
{AttackType}¶
Currently one of Melee, Ranged, Capture or Slaughter.
Path: Attack/{AttackType}
AttackName¶
Name of the attack, to be displayed in the GUI.
Path: Attack/{AttackType}/AttackName
Damage¶
Path: Attack/{AttackType}/Damage
{DamageType}¶
One or more elements describing damage types
Type: non-negative decimal
Path: Attack/{AttackType}/Damage/{DamageType}
Capture¶
Capture points value
Type: non-negative decimal
Path: Attack/{AttackType}/Capture
ApplyStatus¶
Effects like poisoning or burning a unit.
Path: Attack/{AttackType}/ApplyStatus
{ApplyStatusType}¶
The name must have a matching JSON file in data/status_effects.
Path: Attack/{AttackType}/ApplyStatus/{ApplyStatusType}
Duration¶
The duration of the status while the effect occurs.
Type: non-negative decimal
Path: Attack/{AttackType}/ApplyStatus/{ApplyStatusType}/Duration
Interval¶
Interval between the occurrences of the effect.
Type: non-negative decimal
Path: Attack/{AttackType}/ApplyStatus/{ApplyStatusType}/Interval
Damage¶
Path: Attack/{AttackType}/ApplyStatus/{ApplyStatusType}/Damage
{DamageType}¶
One or more elements describing damage types
Type: non-negative decimal
Path: Attack/{AttackType}/ApplyStatus/{ApplyStatusType}/Damage/{DamageType}
Capture¶
Capture points value
Type: non-negative decimal
Path: Attack/{AttackType}/ApplyStatus/{ApplyStatusType}/Capture
Modifiers¶
List of modifiers.
Path: Attack/{AttackType}/ApplyStatus/{ApplyStatusType}/Modifiers
Paths¶
Space separated value paths to modify.
Type: text
Path: Attack/{AttackType}/ApplyStatus/{ApplyStatusType}/Modifiers/Paths
Affects¶
An array of classes to affect.
Type: text
Path: Attack/{AttackType}/ApplyStatus/{ApplyStatusType}/Modifiers/Affects
Add¶
Type: decimal (e.g. -10.0 or 0.0 or 2.5)
Path: Attack/{AttackType}/ApplyStatus/{ApplyStatusType}/Modifiers/Add
Multiply¶
Type: decimal (e.g. -10.0 or 0.0 or 2.5)
Path: Attack/{AttackType}/ApplyStatus/{ApplyStatusType}/Modifiers/Multiply
Replace¶
Type: text
Path: Attack/{AttackType}/ApplyStatus/{ApplyStatusType}/Modifiers/Replace
Stackability¶
Defines how this status effect stacks, i.e. how subsequent status effects of the same kind are handled. Choices are: “Ignore”, which means a new one is ignored, “Extend”, which means the duration of a new one is added to the already active status effect, “Replace”, which means the currently active status effect is removed and the new one is put in place and “Stack”, which means that the status effect can be added multiple times.
Path: Attack/{AttackType}/ApplyStatus/{ApplyStatusType}/Stackability
Bonuses¶
Path: Attack/{AttackType}/Bonuses
Civ¶
If an entity has this civ then the bonus is applied
Type: text
Path: Attack/{AttackType}/Bonuses/Civ
Classes¶
If an entity has all these classes then the bonus is applied
Type: text
Path: Attack/{AttackType}/Bonuses/Classes
Multiplier¶
The effect strength is multiplied by this
Type: non-negative decimal
Path: Attack/{AttackType}/Bonuses/Multiplier
MaxRange¶
Maximum attack range (in meters)
Type: non-negative decimal
Path: Attack/{AttackType}/MaxRange
MinRange¶
Minimum attack range (in meters). Defaults to 0.
Type: non-negative decimal
Path: Attack/{AttackType}/MinRange
Origin¶
The offset from which the attack occurs, relative to the entity position. Defaults to {0,0,0}.
Path: Attack/{AttackType}/Origin
X¶
Type: non-negative decimal
Path: Attack/{AttackType}/Origin/X
Y¶
Type: non-negative decimal
Path: Attack/{AttackType}/Origin/Y
Z¶
Type: non-negative decimal
Path: Attack/{AttackType}/Origin/Z
RangeOverlay¶
Path: Attack/{AttackType}/RangeOverlay
LineTexture¶
Type: text
Path: Attack/{AttackType}/RangeOverlay/LineTexture
LineTextureMask¶
Type: text
Path: Attack/{AttackType}/RangeOverlay/LineTextureMask
LineThickness¶
Type: non-negative decimal
Path: Attack/{AttackType}/RangeOverlay/LineThickness
PrepareTime¶
Time from the start of the attack command until the attack actually occurs (in milliseconds). This value relative to RepeatTime should closely match the "event" point in the actor's attack animation. Defaults to 0.
Type: non-negative integer (e.g. 0 or 5)
Path: Attack/{AttackType}/PrepareTime
RepeatTime¶
Time between attacks (in milliseconds). The attack animation will be stretched to match this time
Type: positive integer (e.g. 1 or 5)
Path: Attack/{AttackType}/RepeatTime
EffectDelay¶
Delay of applying the effects, in milliseconds after the attack has landed. Defaults to 0.
Type: non-negative decimal
Path: Attack/{AttackType}/EffectDelay
Splash¶
Path: Attack/{AttackType}/Splash
Shape¶
Shape of the splash damage, can be circular or linear
Type: text
Path: Attack/{AttackType}/Splash/Shape
Range¶
Size of the area affected by the splash
Type: non-negative decimal
Path: Attack/{AttackType}/Splash/Range
FriendlyFire¶
Whether the splash damage can hurt non enemy units
Type: boolean (true or false)
Path: Attack/{AttackType}/Splash/FriendlyFire
Damage¶
Path: Attack/{AttackType}/Splash/Damage
{DamageType}¶
One or more elements describing damage types
Type: non-negative decimal
Path: Attack/{AttackType}/Splash/Damage/{DamageType}
Capture¶
Capture points value
Type: non-negative decimal
Path: Attack/{AttackType}/Splash/Capture
ApplyStatus¶
Effects like poisoning or burning a unit.
Path: Attack/{AttackType}/Splash/ApplyStatus
{ApplyStatusType}¶
The name must have a matching JSON file in data/status_effects.
Path: Attack/{AttackType}/Splash/ApplyStatus/{ApplyStatusType}
Duration¶
The duration of the status while the effect occurs.
Type: non-negative decimal
Path: Attack/{AttackType}/Splash/ApplyStatus/{ApplyStatusType}/Duration
Interval¶
Interval between the occurrences of the effect.
Type: non-negative decimal
Path: Attack/{AttackType}/Splash/ApplyStatus/{ApplyStatusType}/Interval
Damage¶
Path: Attack/{AttackType}/Splash/ApplyStatus/{ApplyStatusType}/Damage
{DamageType}¶
One or more elements describing damage types
Type: non-negative decimal
Path: Attack/{AttackType}/Splash/ApplyStatus/{ApplyStatusType}/Damage/{DamageType}
Capture¶
Capture points value
Type: non-negative decimal
Path: Attack/{AttackType}/Splash/ApplyStatus/{ApplyStatusType}/Capture
Modifiers¶
List of modifiers.
Path: Attack/{AttackType}/Splash/ApplyStatus/{ApplyStatusType}/Modifiers
Paths¶
Space separated value paths to modify.
Type: text
Path: Attack/{AttackType}/Splash/ApplyStatus/{ApplyStatusType}/Modifiers/Paths
Affects¶
An array of classes to affect.
Type: text
Path: Attack/{AttackType}/Splash/ApplyStatus/{ApplyStatusType}/Modifiers/Affects
Add¶
Type: decimal (e.g. -10.0 or 0.0 or 2.5)
Path: Attack/{AttackType}/Splash/ApplyStatus/{ApplyStatusType}/Modifiers/Add
Multiply¶
Type: decimal (e.g. -10.0 or 0.0 or 2.5)
Path: Attack/{AttackType}/Splash/ApplyStatus/{ApplyStatusType}/Modifiers/Multiply
Replace¶
Type: text
Path: Attack/{AttackType}/Splash/ApplyStatus/{ApplyStatusType}/Modifiers/Replace
Stackability¶
Defines how this status effect stacks, i.e. how subsequent status effects of the same kind are handled. Choices are: “Ignore”, which means a new one is ignored, “Extend”, which means the duration of a new one is added to the already active status effect, “Replace”, which means the currently active status effect is removed and the new one is put in place and “Stack”, which means that the status effect can be added multiple times.
Path: Attack/{AttackType}/Splash/ApplyStatus/{ApplyStatusType}/Stackability
Bonuses¶
Path: Attack/{AttackType}/Splash/Bonuses
Civ¶
If an entity has this civ then the bonus is applied
Type: text
Path: Attack/{AttackType}/Splash/Bonuses/Civ
Classes¶
If an entity has all these classes then the bonus is applied
Type: text
Path: Attack/{AttackType}/Splash/Bonuses/Classes
Multiplier¶
The effect strength is multiplied by this
Type: non-negative decimal
Path: Attack/{AttackType}/Splash/Bonuses/Multiplier
Projectile¶
Path: Attack/{AttackType}/Projectile
Speed¶
Speed of projectiles (in meters per second).
Type: positive decimal
Path: Attack/{AttackType}/Projectile/Speed
Spread¶
Standard deviation of the bivariate normal distribution of hits at 100 meters. A disk at 100 meters from the attacker with this radius (2x this radius, 3x this radius) is expected to include the landing points of 39.3% (86.5%, 98.9%) of the rounds.
Type: non-negative decimal
Path: Attack/{AttackType}/Projectile/Spread
Gravity¶
The gravity affecting the projectile. This affects the shape of the flight curve.
Type: non-negative decimal
Path: Attack/{AttackType}/Projectile/Gravity
FriendlyFire¶
Whether stray missiles can hurt non enemy units.
Type: boolean (true or false)
Path: Attack/{AttackType}/Projectile/FriendlyFire
LaunchPoint¶
Delta from the unit position where to launch the projectile.
Path: Attack/{AttackType}/Projectile/LaunchPoint
ActorName¶
actor of the projectile animation.
Type: text
Path: Attack/{AttackType}/Projectile/ActorName
ImpactActorName¶
actor of the projectile impact animation
Type: text
Path: Attack/{AttackType}/Projectile/ImpactActorName
ImpactAnimationLifetime¶
length of the projectile impact animation.
Type: positive decimal
Path: Attack/{AttackType}/Projectile/ImpactAnimationLifetime
PreferredClasses¶
Space delimited list of classes preferred for attacking. If an entity has any of these classes, it is preferred. The classes are in descending order of preference
Type: text
Path: Attack/{AttackType}/PreferredClasses
RestrictedClasses¶
Space delimited list of classes that cannot be attacked by this entity. If target entity has any of these classes, it cannot be attacked
Type: text
Path: Attack/{AttackType}/RestrictedClasses
RELAX NG Grammar¶
<define name="component.Attack">
<element name="Attack">
<interleave>
<oneOrMore>
<element>
<anyName/>
<interleave>
<element name="AttackName">
<optional>
<attribute name="context"/>
</optional>
<optional>
<attribute name="comment"/>
</optional>
<text/>
</element>
<oneOrMore>
<choice>
<element name="Damage">
<oneOrMore>
<element>
<anyName/>
<ref name="nonNegativeDecimal"/>
</element>
</oneOrMore>
</element>
<element name="Capture">
<ref name="nonNegativeDecimal"/>
</element>
<element name="ApplyStatus">
<oneOrMore>
<element>
<anyName/>
<interleave>
<optional>
<element name="Duration">
<ref name="nonNegativeDecimal"/>
</element>
</optional>
<optional>
<interleave>
<element name="Interval">
<ref name="nonNegativeDecimal"/>
</element>
<oneOrMore>
<choice>
<element name="Damage">
<oneOrMore>
<element>
<anyName/>
<ref name="nonNegativeDecimal"/>
</element>
</oneOrMore>
</element>
<element name="Capture">
<ref name="nonNegativeDecimal"/>
</element>
</choice>
</oneOrMore>
</interleave>
</optional>
<optional>
<element name="Modifiers">
<oneOrMore>
<element>
<anyName/>
<interleave>
<element name="Paths">
<attribute name="datatype">
<value>
</value>
</attribute>
<text/>
</element>
<element name="Affects">
<attribute name="datatype">
<value>
</value>
</attribute>
<text/>
</element>
<choice>
<element name="Add">
<data type="decimal"/>
</element>
<element name="Multiply">
<data type="decimal"/>
</element>
<element name="Replace"/>
</choice>
</interleave>
</element>
</oneOrMore>
</element>
</optional>
<element name="Stackability">
<choice>
<value>
</value>
<value>
</value>
<value>
</value>
<value>
</value>
</choice>
</element>
</interleave>
</element>
</oneOrMore>
</element>
</choice>
</oneOrMore>
<optional>
<element name="Bonuses">
<zeroOrMore>
<element>
<anyName/>
<interleave>
<optional>
<element name="Civ"/>
</optional>
<element name="Classes"/>
<element name="Multiplier">
<ref name="nonNegativeDecimal"/>
</element>
</interleave>
</element>
</zeroOrMore>
</element>
</optional>
<element name="MaxRange">
<ref name="nonNegativeDecimal"/>
</element>
<optional>
<element name="MinRange">
<ref name="nonNegativeDecimal"/>
</element>
</optional>
<optional>
<element name="Origin">
<interleave>
<element name="X">
<ref name="nonNegativeDecimal"/>
</element>
<element name="Y">
<ref name="nonNegativeDecimal"/>
</element>
<element name="Z">
<ref name="nonNegativeDecimal"/>
</element>
</interleave>
</element>
</optional>
<optional>
<element name="RangeOverlay">
<interleave>
<element name="LineTexture"/>
<element name="LineTextureMask"/>
<element name="LineThickness">
<ref name="nonNegativeDecimal"/>
</element>
</interleave>
</element>
</optional>
<optional>
<element name="PrepareTime">
<data type="nonNegativeInteger"/>
</element>
</optional>
<element name="RepeatTime">
<data type="positiveInteger"/>
</element>
<optional>
<element name="EffectDelay">
<ref name="nonNegativeDecimal"/>
</element>
</optional>
<optional>
<element name="Splash">
<interleave>
<element name="Shape"/>
<element name="Range">
<ref name="nonNegativeDecimal"/>
</element>
<element name="FriendlyFire">
<data type="boolean"/>
</element>
<oneOrMore>
<choice>
<element name="Damage">
<oneOrMore>
<element>
<anyName/>
<ref name="nonNegativeDecimal"/>
</element>
</oneOrMore>
</element>
<element name="Capture">
<ref name="nonNegativeDecimal"/>
</element>
<element name="ApplyStatus">
<oneOrMore>
<element>
<anyName/>
<interleave>
<optional>
<element name="Duration">
<ref name="nonNegativeDecimal"/>
</element>
</optional>
<optional>
<interleave>
<element name="Interval">
<ref name="nonNegativeDecimal"/>
</element>
<oneOrMore>
<choice>
<element name="Damage">
<oneOrMore>
<element>
<anyName/>
<ref name="nonNegativeDecimal"/>
</element>
</oneOrMore>
</element>
<element name="Capture">
<ref name="nonNegativeDecimal"/>
</element>
</choice>
</oneOrMore>
</interleave>
</optional>
<optional>
<element name="Modifiers">
<oneOrMore>
<element>
<anyName/>
<interleave>
<element name="Paths">
<attribute name="datatype">
<value>
</value>
</attribute>
<text/>
</element>
<element name="Affects">
<attribute name="datatype">
<value>
</value>
</attribute>
<text/>
</element>
<choice>
<element name="Add">
<data type="decimal"/>
</element>
<element name="Multiply">
<data type="decimal"/>
</element>
<element name="Replace"/>
</choice>
</interleave>
</element>
</oneOrMore>
</element>
</optional>
<element name="Stackability">
<choice>
<value>
</value>
<value>
</value>
<value>
</value>
<value>
</value>
</choice>
</element>
</interleave>
</element>
</oneOrMore>
</element>
</choice>
</oneOrMore>
<optional>
<element name="Bonuses">
<zeroOrMore>
<element>
<anyName/>
<interleave>
<optional>
<element name="Civ"/>
</optional>
<element name="Classes"/>
<element name="Multiplier">
<ref name="nonNegativeDecimal"/>
</element>
</interleave>
</element>
</zeroOrMore>
</element>
</optional>
</interleave>
</element>
</optional>
<optional>
<element name="Projectile">
<interleave>
<element name="Speed">
<ref name="positiveDecimal"/>
</element>
<element name="Spread">
<ref name="nonNegativeDecimal"/>
</element>
<element name="Gravity">
<ref name="nonNegativeDecimal"/>
</element>
<element name="FriendlyFire">
<data type="boolean"/>
</element>
<optional>
<element name="LaunchPoint">
<attribute name="y">
<data type="decimal"/>
</attribute>
</element>
</optional>
<optional>
<element name="ActorName"/>
</optional>
<optional>
<element name="ImpactActorName"/>
<element name="ImpactAnimationLifetime">
<ref name="positiveDecimal"/>
</element>
</optional>
</interleave>
</element>
</optional>
<optional>
<element name="PreferredClasses">
<attribute name="datatype">
<value>
</value>
</attribute>
<text/>
</element>
</optional>
<optional>
<element name="RestrictedClasses">
<attribute name="datatype">
<value>
</value>
</attribute>
<text/>
</element>
</optional>
</interleave>
</element>
</oneOrMore>
</interleave>
</element>
</define>