Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/components/Attack.js
Show First 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | "<Ranged>" + | ||||
"</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>" + | ||||
"<FriendlyFire>false</FriendlyFire>" + | |||||
"</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>" + | ||||
"<Damage>" + | "<Damage>" + | ||||
"<Hack>0.0</Hack>" + | "<Hack>0.0</Hack>" + | ||||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | "<element name='Ranged'>" + | ||||
"<interleave>" + | "<interleave>" + | ||||
"<element name='Speed' a:help='Speed of projectiles (in meters per second).'>" + | "<element name='Speed' a:help='Speed of projectiles (in meters per second).'>" + | ||||
"<ref name='positiveDecimal'/>" + | "<ref name='positiveDecimal'/>" + | ||||
"</element>" + | "</element>" + | ||||
"<element name='Spread' a:help='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.'><ref name='nonNegativeDecimal'/></element>" + | "<element name='Spread' a:help='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.'><ref name='nonNegativeDecimal'/></element>" + | ||||
"<element name='Gravity' a:help='The gravity affecting the projectile. This affects the shape of the flight curve.'>" + | "<element name='Gravity' a:help='The gravity affecting the projectile. This affects the shape of the flight curve.'>" + | ||||
"<ref name='nonNegativeDecimal'/>" + | "<ref name='nonNegativeDecimal'/>" + | ||||
"</element>" + | "</element>" + | ||||
"<element name='FriendlyFire' a:help='Whether stray missiles can hurt non enemy units.'><data type='boolean'/></element>" + | |||||
"<optional>" + | "<optional>" + | ||||
"<element name='LaunchPoint' a:help='Delta from the unit position where to launch the projectile.'>" + | "<element name='LaunchPoint' a:help='Delta from the unit position where to launch the projectile.'>" + | ||||
"<attribute name='y'>" + | "<attribute name='y'>" + | ||||
"<data type='decimal'/>" + | "<data type='decimal'/>" + | ||||
"</attribute>" + | "</attribute>" + | ||||
"</element>" + | "</element>" + | ||||
"</optional>" + | "</optional>" + | ||||
"<optional>" + | "<optional>" + | ||||
▲ Show 20 Lines • Show All 250 Lines • ▼ Show 20 Lines | |||||
Attack.prototype.GetSplashData = function(type) | Attack.prototype.GetSplashData = function(type) | ||||
{ | { | ||||
if (!this.template[type].Splash) | if (!this.template[type].Splash) | ||||
return; | return; | ||||
return { | return { | ||||
"attackData": this.GetAttackEffectsData(type, true), | "attackData": this.GetAttackEffectsData(type, true), | ||||
"friendlyFire": this.template[type].Splash.FriendlyFire != "false", | "friendlyFire": this.template[type].Splash.FriendlyFire == "true", | ||||
"radius": ApplyValueModificationsToEntity("Attack/" + type + "/Splash/Range", +this.template[type].Splash.Range, this.entity), | "radius": ApplyValueModificationsToEntity("Attack/" + type + "/Splash/Range", +this.template[type].Splash.Range, this.entity), | ||||
"shape": this.template[type].Splash.Shape, | "shape": this.template[type].Splash.Shape, | ||||
}; | }; | ||||
}; | }; | ||||
Attack.prototype.GetRange = function(type) | Attack.prototype.GetRange = function(type) | ||||
{ | { | ||||
if (!type) | if (!type) | ||||
▲ Show 20 Lines • Show All 105 Lines • ▼ Show 20 Lines | let data = { | ||||
"target": target, | "target": target, | ||||
"attacker": this.entity, | "attacker": this.entity, | ||||
"attackerOwner": attackerOwner, | "attackerOwner": attackerOwner, | ||||
"position": realTargetPosition, | "position": realTargetPosition, | ||||
"direction": missileDirection, | "direction": missileDirection, | ||||
"projectileId": id, | "projectileId": id, | ||||
"attackImpactSound": attackImpactSound, | "attackImpactSound": attackImpactSound, | ||||
"splash": this.GetSplashData(type), | "splash": this.GetSplashData(type), | ||||
"friendlyFire": this.template[type].Projectile.FriendlyFire == "true", | |||||
}; | }; | ||||
cmpTimer.SetTimeout(SYSTEM_ENTITY, IID_DelayedDamage, "MissileHit", +this.template[type].Delay + timeToTarget * 1000, data); | cmpTimer.SetTimeout(SYSTEM_ENTITY, IID_DelayedDamage, "MissileHit", +this.template[type].Delay + timeToTarget * 1000, data); | ||||
} | } | ||||
else | else | ||||
Attacking.HandleAttackEffects(type, this.GetAttackEffectsData(type), target, this.entity, attackerOwner); | Attacking.HandleAttackEffects(type, this.GetAttackEffectsData(type), target, this.entity, attackerOwner); | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 63 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator