Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/Attack.js
Show First 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | "<Melee>" + | ||||
"<PreferredClasses datatype=\"tokens\">Cavalry Infantry</PreferredClasses>" + | "<PreferredClasses datatype=\"tokens\">Cavalry Infantry</PreferredClasses>" + | ||||
"</Melee>" + | "</Melee>" + | ||||
"<Ranged>" + | "<Ranged>" + | ||||
"<Hack>0.0</Hack>" + | "<Hack>0.0</Hack>" + | ||||
"<Pierce>10.0</Pierce>" + | "<Pierce>10.0</Pierce>" + | ||||
"<Crush>0.0</Crush>" + | "<Crush>0.0</Crush>" + | ||||
"<MaxRange>44.0</MaxRange>" + | "<MaxRange>44.0</MaxRange>" + | ||||
"<MinRange>20.0</MinRange>" + | "<MinRange>20.0</MinRange>" + | ||||
"<ElevationBonus>15.0</ElevationBonus>" + | |||||
"<PrepareTime>800</PrepareTime>" + | "<PrepareTime>800</PrepareTime>" + | ||||
"<RepeatTime>1600</RepeatTime>" + | "<RepeatTime>1600</RepeatTime>" + | ||||
"<Delay>1000</Delay>" + | "<Delay>1000</Delay>" + | ||||
"<Bonuses>" + | "<Bonuses>" + | ||||
"<Bonus1>" + | "<Bonus1>" + | ||||
"<Classes>Cavalry</Classes>" + | "<Classes>Cavalry</Classes>" + | ||||
"<Multiplier>2</Multiplier>" + | "<Multiplier>2</Multiplier>" + | ||||
"</Bonus1>" + | "</Bonus1>" + | ||||
"</Bonuses>" + | "</Bonuses>" + | ||||
"<Projectile>" + | "<Projectile>" + | ||||
"<Speed>50.0</Speed>" + | "<Speed>50.0</Speed>" + | ||||
"<Spread>2.5</Spread>" + | "<Spread>2.5</Spread>" + | ||||
"<ActorName>props/units/weapons/rock_flaming.xml</ActorName>" + | "<ActorName>props/units/weapons/rock_flaming.xml</ActorName>" + | ||||
"<ImpactActorName>props/units/weapons/rock_explosion.xml</ImpactActorName>" + | "<ImpactActorName>props/units/weapons/rock_explosion.xml</ImpactActorName>" + | ||||
"<ImpactAnimationLifetime>0.1</ImpactAnimationLifetime>" + | "<ImpactAnimationLifetime>0.1</ImpactAnimationLifetime>" + | ||||
"<ElevationBonus>15.0</ElevationBonus>" + | |||||
"</Projectile>" + | "</Projectile>" + | ||||
"<RestrictedClasses datatype=\"tokens\">Champion</RestrictedClasses>" + | "<RestrictedClasses datatype=\"tokens\">Champion</RestrictedClasses>" + | ||||
"<Splash>" + | "<Splash>" + | ||||
"<Shape>Circular</Shape>" + | "<Shape>Circular</Shape>" + | ||||
"<Range>20</Range>" + | "<Range>20</Range>" + | ||||
"<FriendlyFire>false</FriendlyFire>" + | "<FriendlyFire>false</FriendlyFire>" + | ||||
"<Hack>0.0</Hack>" + | "<Hack>0.0</Hack>" + | ||||
"<Pierce>10.0</Pierce>" + | "<Pierce>10.0</Pierce>" + | ||||
Show All 29 Lines | Attack.prototype.Schema = | ||||
"<optional>" + | "<optional>" + | ||||
"<element name='Ranged'>" + | "<element name='Ranged'>" + | ||||
"<interleave>" + | "<interleave>" + | ||||
"<element name='Damage'>" + | "<element name='Damage'>" + | ||||
DamageTypes.BuildSchema("damage strength") + | DamageTypes.BuildSchema("damage strength") + | ||||
"</element>" + | "</element>" + | ||||
"<element name='MaxRange' a:help='Maximum attack range (in metres)'><ref name='nonNegativeDecimal'/></element>" + | "<element name='MaxRange' a:help='Maximum attack range (in metres)'><ref name='nonNegativeDecimal'/></element>" + | ||||
"<element name='MinRange' a:help='Minimum attack range (in metres)'><ref name='nonNegativeDecimal'/></element>" + | "<element name='MinRange' a:help='Minimum attack range (in metres)'><ref name='nonNegativeDecimal'/></element>" + | ||||
"<optional>"+ | "<optional>" + | ||||
"<element name='ElevationBonus' a:help='give an elevation advantage (in meters)'><ref name='nonNegativeDecimal'/></element>" + | |||||
"</optional>" + | |||||
"<optional>" + | |||||
"<element name='RangeOverlay'>" + | "<element name='RangeOverlay'>" + | ||||
"<interleave>" + | "<interleave>" + | ||||
"<element name='LineTexture'><text/></element>" + | "<element name='LineTexture'><text/></element>" + | ||||
"<element name='LineTextureMask'><text/></element>" + | "<element name='LineTextureMask'><text/></element>" + | ||||
"<element name='LineThickness'><ref name='nonNegativeDecimal'/></element>" + | "<element name='LineThickness'><ref name='nonNegativeDecimal'/></element>" + | ||||
"</interleave>" + | "</interleave>" + | ||||
"</element>" + | "</element>" + | ||||
"</optional>" + | "</optional>" + | ||||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | "<element name='Ranged'>" + | ||||
"<optional>" + | "<optional>" + | ||||
"<element name='ImpactActorName' a:help='actor of the projectile impact animation'>" + | "<element name='ImpactActorName' a:help='actor of the projectile impact animation'>" + | ||||
"<text/>" + | "<text/>" + | ||||
"</element>" + | "</element>" + | ||||
"<element name='ImpactAnimationLifetime' a:help='length of the projectile impact animation.'>" + | "<element name='ImpactAnimationLifetime' a:help='length of the projectile impact animation.'>" + | ||||
"<ref name='positiveDecimal'/>" + | "<ref name='positiveDecimal'/>" + | ||||
"</element>" + | "</element>" + | ||||
"</optional>" + | "</optional>" + | ||||
"<optional>"+ | |||||
"<element name='ElevationBonus' a:help='give an elevation advantage (in meters)'><ref name='nonNegativeDecimal'/></element>" + | |||||
"</optional>" + | |||||
"</interleave>" + | "</interleave>" + | ||||
"</element>" + | "</element>" + | ||||
Attack.prototype.statusEffectsSchema + | Attack.prototype.statusEffectsSchema + | ||||
Attack.prototype.bonusesSchema + | Attack.prototype.bonusesSchema + | ||||
Attack.prototype.preferredClassesSchema + | Attack.prototype.preferredClassesSchema + | ||||
Attack.prototype.restrictedClassesSchema + | Attack.prototype.restrictedClassesSchema + | ||||
"</interleave>" + | "</interleave>" + | ||||
"</element>" + | "</element>" + | ||||
▲ Show 20 Lines • Show All 265 Lines • ▼ Show 20 Lines | |||||
Attack.prototype.GetRange = function(type) | Attack.prototype.GetRange = function(type) | ||||
{ | { | ||||
let max = +this.template[type].MaxRange; | let max = +this.template[type].MaxRange; | ||||
max = ApplyValueModificationsToEntity("Attack/" + type + "/MaxRange", max, this.entity); | max = ApplyValueModificationsToEntity("Attack/" + type + "/MaxRange", max, this.entity); | ||||
let min = +(this.template[type].MinRange || 0); | let min = +(this.template[type].MinRange || 0); | ||||
min = ApplyValueModificationsToEntity("Attack/" + type + "/MinRange", min, this.entity); | min = ApplyValueModificationsToEntity("Attack/" + type + "/MinRange", min, this.entity); | ||||
let elevationBonus = +(this.template[type].ElevationBonus || 0); | let elevationBonus = "Projectile" in this.template[type] ? +(this.template[type].Projectile.ElevationBonus || 0): 0; | ||||
elevationBonus = ApplyValueModificationsToEntity("Attack/" + type + "/ElevationBonus", elevationBonus, this.entity); | elevationBonus = ApplyValueModificationsToEntity("Attack/" + type + "/Projectile/ElevationBonus", elevationBonus, this.entity); | ||||
return { "max": max, "min": min, "elevationBonus": elevationBonus }; | return { "max": max, "min": min, "elevationBonus": elevationBonus }; | ||||
}; | }; | ||||
Attack.prototype.GetBonusTemplate = function(type) | Attack.prototype.GetBonusTemplate = function(type) | ||||
{ | { | ||||
let template = this.template[type]; | let template = this.template[type]; | ||||
if (!template) | if (!template) | ||||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | if (type == "Ranged") | ||||
let impactActorName = ""; | let impactActorName = ""; | ||||
let impactAnimationLifetime = 0; | let impactAnimationLifetime = 0; | ||||
actorName = this.template[type].Projectile.ActorName || ""; | actorName = this.template[type].Projectile.ActorName || ""; | ||||
impactActorName = this.template[type].Projectile.ImpactActorName || ""; | impactActorName = this.template[type].Projectile.ImpactActorName || ""; | ||||
impactAnimationLifetime = this.template[type].Projectile.ImpactAnimationLifetime || 0; | impactAnimationLifetime = this.template[type].Projectile.ImpactAnimationLifetime || 0; | ||||
// TODO: Use unit rotation to implement x/z offsets. | // TODO: Use unit rotation to implement x/z offsets. | ||||
let deltaLaunchPoint = new Vector3D(0, this.template[type].Projectile.LaunchPoint["@y"], 0.0); | let deltaLaunchPoint = new Vector3D(0, this.template[type].Projectile.LaunchPoint["@y"], 0.0); | ||||
Silier: arent now origin and launchpoint basically the same? | |||||
Not Done Inline ActionsI would advocate to that, yeah. Just that the Origin doesn't need a projectile. Freagarach: I would advocate to that, yeah. Just that the `Origin` doesn't need a projectile. | |||||
Not Done Inline ActionsI think launchpoint can be both defined in the template and the mesh? Stan: I think launchpoint can be both defined in the template and the mesh? | |||||
let launchPoint = Vector3D.add(selfPosition, deltaLaunchPoint); | let launchPoint = Vector3D.add(selfPosition, deltaLaunchPoint); | ||||
let cmpVisual = Engine.QueryInterface(this.entity, IID_Visual); | let cmpVisual = Engine.QueryInterface(this.entity, IID_Visual); | ||||
if (cmpVisual) | if (cmpVisual) | ||||
{ | { | ||||
// if the projectile definition is missing from the template | // if the projectile definition is missing from the template | ||||
// then fallback to the projectile name and launchpoint in the visual actor | // then fallback to the projectile name and launchpoint in the visual actor | ||||
if (!actorName) | if (!actorName) | ||||
▲ Show 20 Lines • Show All 141 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
arent now origin and launchpoint basically the same?