Differential D3816 Diff 17044 ps/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
Show First 20 Lines • Show All 143 Lines • ▼ Show 20 Lines | function TestFormationExiting(mode) | ||||
}); | }); | ||||
AddMock(playerEntity, IID_Player, { | AddMock(playerEntity, IID_Player, { | ||||
"IsAlly": function() { return false; }, | "IsAlly": function() { return false; }, | ||||
"IsEnemy": function() { return true; }, | "IsEnemy": function() { return true; }, | ||||
"GetEnemies": function() { return [2]; }, | "GetEnemies": function() { return [2]; }, | ||||
}); | }); | ||||
AddMock(SYSTEM_ENTITY, IID_ObstructionManager, { | |||||
"IsInTargetRange": () => true, | |||||
"IsInPointRange": () => true | |||||
}); | |||||
var unitAI = ConstructComponent(unit, "UnitAI", { "FormationController": "false", "DefaultStance": "aggressive" }); | var unitAI = ConstructComponent(unit, "UnitAI", { "FormationController": "false", "DefaultStance": "aggressive" }); | ||||
AddMock(unit, IID_Identity, { | AddMock(unit, IID_Identity, { | ||||
"GetClassesList": function() { return []; }, | "GetClassesList": function() { return []; }, | ||||
}); | }); | ||||
AddMock(unit, IID_Ownership, { | AddMock(unit, IID_Ownership, { | ||||
"GetOwner": function() { return 1; }, | "GetOwner": function() { return 1; }, | ||||
Show All 24 Lines | function TestFormationExiting(mode) | ||||
AddMock(unit, IID_Attack, { | AddMock(unit, IID_Attack, { | ||||
"GetRange": function() { return { "max": 10, "min": 0 }; }, | "GetRange": function() { return { "max": 10, "min": 0 }; }, | ||||
"GetFullAttackRange": function() { return { "max": 40, "min": 0 }; }, | "GetFullAttackRange": function() { return { "max": 40, "min": 0 }; }, | ||||
"GetBestAttackAgainst": function(t) { return "melee"; }, | "GetBestAttackAgainst": function(t) { return "melee"; }, | ||||
"GetPreference": function(t) { return 0; }, | "GetPreference": function(t) { return 0; }, | ||||
"GetTimers": function() { return { "prepare": 500, "repeat": 1000 }; }, | "GetTimers": function() { return { "prepare": 500, "repeat": 1000 }; }, | ||||
"CanAttack": function(v) { return true; }, | "CanAttack": function(v) { return true; }, | ||||
"CompareEntitiesByPreference": function(a, b) { return 0; }, | "CompareEntitiesByPreference": function(a, b) { return 0; }, | ||||
"IsTargetInRange": () => true, | |||||
"StartAttacking": () => true | |||||
}); | }); | ||||
unitAI.OnCreate(); | unitAI.OnCreate(); | ||||
unitAI.SetupAttackRangeQuery(1); | unitAI.SetupAttackRangeQuery(1); | ||||
if (mode == 1) | if (mode == 1) | ||||
▲ Show 20 Lines • Show All 160 Lines • ▼ Show 20 Lines | for (var i = 0; i < unitCount; i++) | ||||
AddMock(unit + i, IID_Attack, { | AddMock(unit + i, IID_Attack, { | ||||
"GetRange": function() { return { "max": 10, "min": 0 }; }, | "GetRange": function() { return { "max": 10, "min": 0 }; }, | ||||
"GetFullAttackRange": function() { return { "max": 40, "min": 0 }; }, | "GetFullAttackRange": function() { return { "max": 40, "min": 0 }; }, | ||||
"GetBestAttackAgainst": function(t) { return "melee"; }, | "GetBestAttackAgainst": function(t) { return "melee"; }, | ||||
"GetTimers": function() { return { "prepare": 500, "repeat": 1000 }; }, | "GetTimers": function() { return { "prepare": 500, "repeat": 1000 }; }, | ||||
"CanAttack": function(v) { return true; }, | "CanAttack": function(v) { return true; }, | ||||
"CompareEntitiesByPreference": function(a, b) { return 0; }, | "CompareEntitiesByPreference": function(a, b) { return 0; }, | ||||
"IsTargetInRange": () => true, | |||||
"StartAttacking": () => true, | |||||
"StopAttacking": () => {} | |||||
}); | }); | ||||
unitAI.OnCreate(); | unitAI.OnCreate(); | ||||
unitAI.SetupAttackRangeQuery(1); | unitAI.SetupAttackRangeQuery(1); | ||||
unitAIs.push(unitAI); | unitAIs.push(unitAI); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 147 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator