Index: binaries/data/mods/public/simulation/components/Damage.js
===================================================================
--- binaries/data/mods/public/simulation/components/Damage.js
+++ binaries/data/mods/public/simulation/components/Damage.js
@@ -80,7 +80,7 @@
let playersToDamage = [];
let numPlayers = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager).GetNumPlayers();
for (let i = 0; i < numPlayers; ++i)
- playersToDamage.push(i)
+ playersToDamage.push(i);
return playersToDamage;
}
@@ -170,7 +170,7 @@
* @param {Object} data.strengths - data of the form { 'hack': number, 'pierce': number, 'crush': number }.
* @param {string} data.type - the type of damage.
* @param {number} data.attackerOwner - the player id of the attacker.
- * @param {Vector3D} data.direction - the unit vector defining the direction.
+ * @param {Vector3D} [data.direction] - the unit vector defining the direction.
* @param {number[]} data.playersToDamage - the array of player id's to damage.
*/
Damage.prototype.CauseSplashDamage = function(data)
Index: binaries/data/mods/public/simulation/components/DeathDamage.js
===================================================================
--- binaries/data/mods/public/simulation/components/DeathDamage.js
+++ binaries/data/mods/public/simulation/components/DeathDamage.js
@@ -1,23 +1,5 @@
function DeathDamage() {}
-DeathDamage.prototype.bonusesSchema =
- "" +
- "" +
- "" +
- "" +
- "" +
- "" +
- "" +
- "" +
- "" +
- "" +
- "" +
- "" +
- "" +
- "" +
- "" +
- "";
-
DeathDamage.prototype.Schema =
"When a unit or building is destroyed, it inflicts damage to nearby units." +
"" +
@@ -28,13 +10,12 @@
"10.0" +
"50.0" +
"" +
- "" +
+ "" +
"" +
"" +
"" +
"" +
- "" +
- DeathDamage.prototype.bonusesSchema;
+ "";
DeathDamage.prototype.Init = function()
{
Index: binaries/data/mods/public/simulation/components/tests/test_Attack.js
===================================================================
--- binaries/data/mods/public/simulation/components/tests/test_Attack.js
+++ binaries/data/mods/public/simulation/components/tests/test_Attack.js
@@ -82,7 +82,13 @@
"FriendlyFire": "false",
"Hack": 0.0,
"Pierce": 15.0,
- "Crush": 35.0
+ "Crush": 35.0,
+ "Bonuses": {
+ "BonusCav": {
+ "Classes": "Cavalry",
+ "Multiplier": 2
+ }
+ }
}
},
"Capture" : {
@@ -135,6 +141,12 @@
"pierce": 10,
"crush": 0
});
+
+ TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackStrengths("Ranged.Splash"), {
+ "hack": 0.0,
+ "pierce": 15.0,
+ "crush": 35.0
+ });
TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetTimers("Ranged"), {
"prepare": 300,
@@ -153,6 +165,7 @@
attackComponentTest(className, true, (attacker, cmpAttack, defender) => {
TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackBonus("Melee", defender), className == "Cavalry" ? 2 : 1);
TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackBonus("Ranged", defender), 1);
+ TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackBonus("Ranged.Splash", defender), className == "Cavalry" ? 2 : 1);
TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackBonus("Capture", defender), 1);
TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackBonus("Slaughter", defender), 1);
});
@@ -234,6 +247,7 @@
function testPredictTimeToTarget(selfPosition, horizSpeed, targetPosition, targetVelocity)
{
+ ResetState();
let cmpAttack = ConstructComponent(1, "Attack", {});
let timeToTarget = cmpAttack.PredictTimeToTarget(selfPosition, horizSpeed, targetPosition, targetVelocity);
if (timeToTarget === false)