Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/Attack.js
Show First 20 Lines • Show All 132 Lines • ▼ Show 20 Lines | "<element name='Ranged'>" + | ||||
"<element name='RepeatTime' a:help='Time between attacks (in milliseconds). The attack animation will be stretched to match this time'>" + | "<element name='RepeatTime' a:help='Time between attacks (in milliseconds). The attack animation will be stretched to match this time'>" + | ||||
"<data type='positiveInteger'/>" + | "<data type='positiveInteger'/>" + | ||||
"</element>" + | "</element>" + | ||||
"<element name='Delay' a:help='Delay of the damage in milliseconds'><ref name='nonNegativeDecimal'/></element>" + | "<element name='Delay' a:help='Delay of the damage in milliseconds'><ref name='nonNegativeDecimal'/></element>" + | ||||
"<optional>" + | "<optional>" + | ||||
"<element name='Splash'>" + | "<element name='Splash'>" + | ||||
"<interleave>" + | "<interleave>" + | ||||
"<element name='Shape' a:help='Shape of the splash damage, can be circular or linear'><text/></element>" + | "<element name='Shape' a:help='Shape of the splash damage, can be circular or linear'><text/></element>" + | ||||
"<optional>" + | |||||
"<element name='MinRange' a:help='Size of the inner area not affected by the splash'><ref name='nonNegativeDecimal'/></element>" + | |||||
"</optional>" + | |||||
"<element name='Range' a:help='Size of the area affected by the splash'><ref name='nonNegativeDecimal'/></element>" + | "<element name='Range' a:help='Size of the area affected by the splash'><ref name='nonNegativeDecimal'/></element>" + | ||||
"<element name='FriendlyFire' a:help='Whether the splash damage can hurt non enemy units'><data type='boolean'/></element>" + | "<element name='FriendlyFire' a:help='Whether the splash damage can hurt non enemy units'><data type='boolean'/></element>" + | ||||
Attacking.BuildAttackEffectsSchema() + | Attacking.BuildAttackEffectsSchema() + | ||||
"</interleave>" + | "</interleave>" + | ||||
"</element>" + | "</element>" + | ||||
"</optional>" + | "</optional>" + | ||||
"<element name='Projectile'>" + | "<element name='Projectile'>" + | ||||
"<interleave>" + | "<interleave>" + | ||||
▲ Show 20 Lines • Show All 266 Lines • ▼ Show 20 Lines | |||||
Attack.prototype.GetSplashDamage = function(type) | Attack.prototype.GetSplashDamage = function(type) | ||||
{ | { | ||||
if (!this.template[type].Splash) | if (!this.template[type].Splash) | ||||
return false; | return false; | ||||
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 != "false", | ||||
"shape": this.template[type].Splash.Shape, | "shape": this.template[type].Splash.Shape, | ||||
wraitii: meh for inconsistency here | |||||
}; | }; | ||||
}; | }; | ||||
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); | ||||
▲ Show 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | let data = { | ||||
"position": realTargetPosition, | "position": realTargetPosition, | ||||
"direction": missileDirection, | "direction": missileDirection, | ||||
"projectileId": id, | "projectileId": id, | ||||
"attackImpactSound": attackImpactSound | "attackImpactSound": attackImpactSound | ||||
}; | }; | ||||
if (this.template[type].Splash) | if (this.template[type].Splash) | ||||
data.splash = { | data.splash = { | ||||
"friendlyFire": this.template[type].Splash.FriendlyFire != "false", | "friendlyFire": this.template[type].Splash.FriendlyFire != "false", | ||||
"radius": +this.template[type].Splash.Range, | "minRange": +(this.template[type].Splash.MinRange || 0), | ||||
"maxRange": +this.template[type].Splash.Range, | |||||
"shape": this.template[type].Splash.Shape, | "shape": this.template[type].Splash.Shape, | ||||
"attackData": this.GetAttackEffectsData(type, true), | "attackData": this.GetAttackEffectsData(type, 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 64 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
meh for inconsistency here