然后,以下代码可能是AI一次性出兵最大限制数量,按单位个数来算,而不是按人口数量。注意,我说的是可能,因为我测试次数不够,不确定准确效果是什么。如果后面有人看到,测试如果真的是这样,建议回复一下。不可能,绝对不可能,不会有人回复的。
//============================================================================== /* Military Manager
Create maintain plans for military unit lines. Control 'maintain' levels, buy upgrades. */ //============================================================================== rule militaryManager inactive minInterval 30 {
static bool init = false; // Flag to indicate vars, plans are initialized int i = 0; int proto = 0; int planID = -1;
if (init == false) { // Need to initialize, if we're allowed to. if (cvOkToTrainArmy == true) { init = true; if (cvNumArmyUnitTypes >= 0) gNumArmyUnitTypes = cvNumArmyUnitTypes; else gNumArmyUnitTypes = 3; gLandUnitPicker = initUnitPicker("Land military units", gNumArmyUnitTypes, 1, 30, -1, -1, 1, true);
// now the goal // wmj -- hard coded for now, but this should most likely ramp up as the ages progress aiSetMinArmySize(15);
gMainAttackGoal = createSimpleAttackGoal("AttackGoal", aiGetMostHatedPlayerID(), gLandUnitPicker, -1, cAge2, -1, gMainBase, false); aiPlanSetVariableInt(gMainAttackGoal, cGoalPlanReservePlanID, 0, gLandReservePlan); } }
if(gLandUnitPicker != -1) {
setUnitPickerPreference(gLandUnitPicker); // Update preferences in case btBiasEtc vars have changed, or cvPrimaryArmyUnit has changed.
if(kbGetAge() == cAge3)/*堡垒时代*/ { kbUnitPickSetMinimumNumberUnits(gLandUnitPicker, 1); //Min is really managed by scoring system. // An ally or trigger-spawned mission should 'go' even if it's very small. kbUnitPickSetMaximumNumberUnits(gLandUnitPicker, 550); } if(kbGetAge() == cAge4)/*工业时代*/ { kbUnitPickSetMinimumNumberUnits(gLandUnitPicker, 1); kbUnitPickSetMaximumNumberUnits(gLandUnitPicker, 700); } if(kbGetAge() == cAge5)/*帝王时代*/ { kbUnitPickSetMinimumNumberUnits(gLandUnitPicker, 1); kbUnitPickSetMaximumNumberUnits(gLandUnitPicker, 900); } }
switch(kbGetAge()) { case cAge1: { break; } case cAge2: { aiSetMinArmySize(8); // Now irrelevant? (Was used to determine when to launch attack, but attack goal and opp scoring now do this.) break; } case cAge3: { aiSetMinArmySize(15); break; } case cAge4: { aiSetMinArmySize(25); break; } case cAge5: { aiSetMinArmySize(30); break; } } }
这是默认值的结果,数了一下有86个单位,时代5上限90个 if(kbGetAge() == cAge3)/*堡垒时代*/ { kbUnitPickSetMinimumNumberUnits(gLandUnitPicker, 1); //Min is really managed by scoring system. // An ally or trigger-spawned mission should 'go' even if it's very small. kbUnitPickSetMaximumNumberUnits(gLandUnitPicker, 55); } if(kbGetAge() == cAge4)/*工业时代*/ { kbUnitPickSetMinimumNumberUnits(gLandUnitPicker, 1); kbUnitPickSetMaximumNumberUnits(gLandUnitPicker, 70); } if(kbGetAge() == cAge5)/*帝王时代*/ { kbUnitPickSetMinimumNumberUnits(gLandUnitPicker, 1); kbUnitPickSetMaximumNumberUnits(gLandUnitPicker, 90); }
然后下面是在后面加了个0;具体有多少个单位我不知道 if(kbGetAge() == cAge3)/*堡垒时代*/ { kbUnitPickSetMinimumNumberUnits(gLandUnitPicker, 1); //Min is really managed by scoring system. // An ally or trigger-spawned mission should 'go' even if it's very small. kbUnitPickSetMaximumNumberUnits(gLandUnitPicker, 550); } if(kbGetAge() == cAge4)/*工业时代*/ { kbUnitPickSetMinimumNumberUnits(gLandUnitPicker, 1); kbUnitPickSetMaximumNumberUnits(gLandUnitPicker, 700); } if(kbGetAge() == cAge5)/*帝王时代*/ { kbUnitPickSetMinimumNumberUnits(gLandUnitPicker, 1); kbUnitPickSetMaximumNumberUnits(gLandUnitPicker, 900); }
|