//============================================================================== /* C:\work\Spartan\main\age4\age4-dev\age4w\ai\CORE\Age2_BarracksRush_Hardcore.xs This file is auto-generated. Edits will be lost when the file is regenerated. */ //============================================================================== include "aiHeader.xs"; // Gets global vars, function forward declarations include "aiUtil.xs"; // Misc. shared AI utility functions include "aiEcon.xs"; // All of the AI's econ functionality include "aiMilitary.xs"; // All of the AI's military functionality include "aiNavy.xs"; // All of the AI's naval functionality include "aiEventHandlers.xs"; // Event handler methods for the AI include "aiMain.xs"; // The bulk of the AI include "Celeste\aiCad39Skirmish.xs"; // Skirmish Hall specific functionality //============================================================================== /* preInit() This function is called in main() before any of the normal initialization happens. Use it to override default values of variables as needed for personality or scenario effects. */ //============================================================================== void preInit(void) { btDifficultyLevel=3; // check for default selection if(aiGetArcherBias() == 555) { aiEcho("THIS WAS CHOSEN BY DEFAULT"); } aiEcho("preInit() BALANCED starting."); getDataFromBiases(); setDefaultAIVariables(); } rule balancedFocusBiases active minInterval 3 { float temp = (gRandomInfantryBias - 25); btBiasInf = temp / 100.0; temp = (gRandomCavalryBias - 25); btBiasCav = temp / 100.0; temp = (gRandomRangedBias - 25); btBiasArcher = temp / 100.0; temp = (gRandomSiegeBias - 25); btBiasArt = temp / 100.0; aiEcho("Biases: Inf - " + btBiasInf + ", Cav - " + btBiasCav + ", Arch - " + btBiasArcher + ", Siege - " + btBiasArt); setUnitPickerPreference(gLandUnitPicker); xsDisableSelf(); } //============================================================================== /* postInit() This function is called in main() after the normal initialization is complete. Use it to override settings and decisions made by the startup logic. */ //============================================================================== void postInit(void) { aiEcho("postInit() starting."); skirmishPostInit(); } //============================================================================== // rule autoExploreEnemyBases // // Cheat and show the AI where all of the enemy bases are. //============================================================================== rule autoExploreEnemyBases active minInterval 5 { float totalTime = xsGetTime() / 1000.0; static bool revealed = false; if (btRevealEnemyBases == false) { xsDisableSelf(); return; } if (totalTime >= cTimeToRevealEnemyBases) { if (revealed == false) { Vector pos = aiCheatReveal(); if (xsVectorIsValid(pos)) { findEnemyBase(pos); } revealed = true; } else { aiCheatUnreveal(); xsDisableSelf(); } } } //============================================================================== // setupBuildingInfo() // // Called when we age up--setup the buildings we want for the current age. This // controls the forecast values and what the AI attempts to build automatically. // Some things (like farms and dropsites) are built elsewhere, even though // they're listed in here (for forecast info) //============================================================================== void setupBuildingInfo() { initializeAndClearBuildingArrays(); setUpBalancedBuildOrder(); } //============================================================================== // setUnitPickerPreference() // // Updates the unit picker biases. //============================================================================== void setUnitPickerPreference(int upID = -1) { // Add the main unit lines if (upID < 0) return; setBalancedUnitPreference(upID); kbUnitPickSetPreferenceFactor(upID, cUnitTypeAbstractInfantry, 0.5 + (btBiasInf / 2.0)); kbUnitPickSetPreferenceFactor(upID, cUnitTypeAbstractArtillery, 0.5 + (btBiasArt / 2.0)); kbUnitPickSetPreferenceFactor(upID, cUnitTypeAbstractCavalry, 0.5 + (btBiasCav / 2.0)); kbUnitPickSetPreferenceFactor(upID, cUnitTypeAbstractArcher, 0.5 + (btBiasArcher / 2.0)); }