Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/Attack.js
Show First 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | "<Ranged>" + | ||||
"<MaxRange>44.0</MaxRange>" + | "<MaxRange>44.0</MaxRange>" + | ||||
"<MinRange>20.0</MinRange>" + | "<MinRange>20.0</MinRange>" + | ||||
"<ElevationBonus>15.0</ElevationBonus>" + | "<ElevationBonus>15.0</ElevationBonus>" + | ||||
"<PrepareTime>800</PrepareTime>" + | "<PrepareTime>800</PrepareTime>" + | ||||
"<RepeatTime>1600</RepeatTime>" + | "<RepeatTime>1600</RepeatTime>" + | ||||
"<ProjectileSpeed>50.0</ProjectileSpeed>" + | "<ProjectileSpeed>50.0</ProjectileSpeed>" + | ||||
"<Spread>2.5</Spread>" + | "<Spread>2.5</Spread>" + | ||||
"<Delay>1000</Delay>" + | "<Delay>1000</Delay>" + | ||||
"<Continuous>" + | |||||
"<Interval>1000</Interval>" + | |||||
"<NumberOfIntervals>5</NumberOfIntervals>" + | |||||
"</Continuous>" + | |||||
"<Bonuses>" + | "<Bonuses>" + | ||||
"<Bonus1>" + | "<Bonus1>" + | ||||
"<Classes>Cavalry</Classes>" + | "<Classes>Cavalry</Classes>" + | ||||
"<Multiplier>2</Multiplier>" + | "<Multiplier>2</Multiplier>" + | ||||
"</Bonus1>" + | "</Bonus1>" + | ||||
"</Bonuses>" + | "</Bonuses>" + | ||||
"<Projectile>" + | "<Projectile>" + | ||||
"<ActorName>props/units/weapons/rock_flaming.xml</ActorName>" + | "<ActorName>props/units/weapons/rock_flaming.xml</ActorName>" + | ||||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | "<element name='Ranged'>" + | ||||
"<element name='ProjectileSpeed' a:help='Speed of projectiles (in metres per second)'>" + | "<element name='ProjectileSpeed' a:help='Speed of projectiles (in metres per second)'>" + | ||||
"<ref name='positiveDecimal'/>" + | "<ref name='positiveDecimal'/>" + | ||||
"</element>" + | "</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='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='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>" + | |||||
"<element name='Continuous' a:help='Damage caused to the target after hit for a given number of intervals.'>" + | |||||
"<interleave>" + | |||||
"<element name='Interval' a:help='Time between the damage is caused (in milliseconds).'><ref name='nonNegativeDecimal'/></element>" + | |||||
"<element name='NumberOfIntervals' a:help='Number of times the damage is caused.'><ref name='nonNegativeDecimal'/></element>" + | |||||
"</interleave>" + | |||||
"</element>" + | |||||
"</optional>" + | |||||
Attack.prototype.bonusesSchema + | Attack.prototype.bonusesSchema + | ||||
Attack.prototype.preferredClassesSchema + | Attack.prototype.preferredClassesSchema + | ||||
Attack.prototype.restrictedClassesSchema + | Attack.prototype.restrictedClassesSchema + | ||||
"<optional>" + | "<optional>" + | ||||
"<element name='Projectile'>" + | "<element name='Projectile'>" + | ||||
"<interleave>" + | "<interleave>" + | ||||
"<oneOrMore>" + | "<oneOrMore>" + | ||||
"<choice>" + | "<choice>" + | ||||
▲ Show 20 Lines • Show All 408 Lines • ▼ Show 20 Lines | let data = { | ||||
"target": target, | "target": target, | ||||
"strengths": this.GetAttackStrengths(type), | "strengths": this.GetAttackStrengths(type), | ||||
"position": realTargetPosition, | "position": realTargetPosition, | ||||
"direction": missileDirection, | "direction": missileDirection, | ||||
"projectileId": id, | "projectileId": id, | ||||
"bonus": this.GetBonusTemplate(type), | "bonus": this.GetBonusTemplate(type), | ||||
"isSplash": false, | "isSplash": false, | ||||
"attackerOwner": attackerOwner, | "attackerOwner": attackerOwner, | ||||
"attackImpactSound": attackImpactSound | "attackImpactSound": attackImpactSound, | ||||
"interval": this.template.Ranged.Continuous ? this.template.Ranged.Continuous.Interval : 0, | |||||
Silier: might want to change into function similar to GetAttackStrengths(type) or GetRange(type) to be… | |||||
"numberOfIntervals": this.template.Ranged.Continuous ? this.template.Ranged.Continuous.NumberOfIntervals : 0 | |||||
}; | }; | ||||
if (this.template.Ranged.Splash) | if (this.template.Ranged.Splash) | ||||
{ | { | ||||
data.friendlyFire = this.template.Ranged.Splash.FriendlyFire != "false"; | data.friendlyFire = this.template.Ranged.Splash.FriendlyFire != "false"; | ||||
data.radius = +this.template.Ranged.Splash.Range; | data.radius = +this.template.Ranged.Splash.Range; | ||||
data.shape = this.template.Ranged.Splash.Shape; | data.shape = this.template.Ranged.Splash.Shape; | ||||
data.isSplash = true; | data.isSplash = true; | ||||
data.splashStrengths = this.GetAttackStrengths(type + ".Splash"); | data.splashStrengths = this.GetAttackStrengths(type + ".Splash"); | ||||
▲ Show 20 Lines • Show All 106 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
might want to change into function similar to GetAttackStrengths(type) or GetRange(type) to be able apply bonuses from auras and so on
and to ensure it is number +this.template.Ranged.Continuous.Interval or +this.template[type].Continuous.Interval second looks nicer