Differential D2134 Diff 9170 ps/trunk/binaries/data/mods/public/simulation/components/tests/test_Attack.js
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/components/tests/test_Attack.js
Show First 20 Lines • Show All 262 Lines • ▼ Show 20 Lines | for (let ac of allowCapturing) | ||||
TS_ASSERT_EQUALS(cmpAttack.GetBestAttackAgainst(defender, ac), bestAllyAttack); | TS_ASSERT_EQUALS(cmpAttack.GetBestAttackAgainst(defender, ac), bestAllyAttack); | ||||
}); | }); | ||||
} | } | ||||
testGetBestAttackAgainst("FemaleCitizen", "Melee", undefined); | testGetBestAttackAgainst("FemaleCitizen", "Melee", undefined); | ||||
testGetBestAttackAgainst("Archer", "Ranged", undefined); | testGetBestAttackAgainst("Archer", "Ranged", undefined); | ||||
testGetBestAttackAgainst("Domestic", "Slaughter", "Slaughter"); | testGetBestAttackAgainst("Domestic", "Slaughter", "Slaughter"); | ||||
testGetBestAttackAgainst("Structure", "Capture", "Capture", true); | testGetBestAttackAgainst("Structure", "Capture", "Capture", true); | ||||
testGetBestAttackAgainst("Structure", "Ranged", undefined, false); | |||||
function testPredictTimeToTarget(selfPosition, horizSpeed, targetPosition, targetVelocity) | function testPredictTimeToTarget(selfPosition, horizSpeed, targetPosition, targetVelocity) | ||||
{ | { | ||||
ResetState(); | ResetState(); | ||||
let cmpAttack = ConstructComponent(1, "Attack", {}); | let cmpAttack = ConstructComponent(1, "Attack", {}); | ||||
let timeToTarget = cmpAttack.PredictTimeToTarget(selfPosition, horizSpeed, targetPosition, targetVelocity); | let timeToTarget = cmpAttack.PredictTimeToTarget(selfPosition, horizSpeed, targetPosition, targetVelocity); | ||||
if (timeToTarget === false) | if (timeToTarget === false) | ||||
return; | return; | ||||
Show All 26 Lines |
Wildfire Games · Phabricator