Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
Show First 20 Lines • Show All 95 Lines • ▼ Show 20 Lines | function TestFormationExiting(mode) | ||||
AddMock(unit, IID_Vision, { | AddMock(unit, IID_Vision, { | ||||
GetRange: function() { return 10; }, | GetRange: function() { return 10; }, | ||||
}); | }); | ||||
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; }, | ||||
}); | }); | ||||
unitAI.OnCreate(); | unitAI.OnCreate(); | ||||
▲ Show 20 Lines • Show All 140 Lines • ▼ Show 20 Lines | for (var i = 0; i < unitCount; i++) { | ||||
AddMock(unit + i, IID_Vision, { | AddMock(unit + i, IID_Vision, { | ||||
GetRange: function() { return 10; }, | GetRange: function() { return 10; }, | ||||
}); | }); | ||||
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; }, | ||||
}); | }); | ||||
unitAI.OnCreate(); | unitAI.OnCreate(); | ||||
unitAI.SetupRangeQuery(1); | unitAI.SetupRangeQuery(1); | ||||
▲ Show 20 Lines • Show All 60 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator