Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/tests/test_Attack.js
Engine.LoadHelperScript("DamageBonus.js"); | Engine.LoadHelperScript("DamageBonus.js"); | ||||
Engine.LoadHelperScript("Attacking.js"); | Engine.LoadHelperScript("Attacking.js"); | ||||
Engine.LoadHelperScript("Player.js"); | Engine.LoadHelperScript("Player.js"); | ||||
Engine.LoadHelperScript("ValueModification.js"); | Engine.LoadHelperScript("ValueModification.js"); | ||||
Engine.LoadComponentScript("interfaces/Attack.js"); | |||||
Engine.LoadComponentScript("interfaces/Auras.js"); | Engine.LoadComponentScript("interfaces/Auras.js"); | ||||
Engine.LoadComponentScript("interfaces/Capturable.js"); | Engine.LoadComponentScript("interfaces/Capturable.js"); | ||||
Engine.LoadComponentScript("interfaces/ModifiersManager.js"); | Engine.LoadComponentScript("interfaces/ModifiersManager.js"); | ||||
Engine.LoadComponentScript("interfaces/Formation.js"); | Engine.LoadComponentScript("interfaces/Formation.js"); | ||||
Engine.LoadComponentScript("interfaces/Health.js"); | Engine.LoadComponentScript("interfaces/Health.js"); | ||||
Engine.LoadComponentScript("interfaces/TechnologyManager.js"); | Engine.LoadComponentScript("interfaces/TechnologyManager.js"); | ||||
Engine.LoadComponentScript("Attack.js"); | Engine.LoadComponentScript("Attack.js"); | ||||
▲ Show 20 Lines • Show All 324 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
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); | testGetBestAttackAgainst("Structure", "Ranged", undefined, false); | ||||
function testPredictTimeToTarget(selfPosition, horizSpeed, targetPosition, targetVelocity) | function testPredictTimeToTarget(selfPosition, horizSpeed, targetPosition, targetVelocity) | ||||
Stan: Todo? | |||||
{ | { | ||||
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; | ||||
// Position of the target after that time. | // Position of the target after that time. | ||||
let targetPos = Vector3D.mult(targetVelocity, timeToTarget).add(targetPosition); | let targetPos = Vector3D.mult(targetVelocity, timeToTarget).add(targetPosition); | ||||
Show All 24 Lines |
Wildfire Games · Phabricator
Todo?