//------------------------------------------------------------------- // STANDARD INCLUDES: //------------------------------------------------------------------- //#include ..\..\..\externalobjects.cs //#include ..\..\..\playerAreas.cs //#include ..\..\..\terrainpicker.cs //#include ..\..\..\HuntingAreas.cs //#include ..\..\..\nuggetUtils.cs //#include ..\..\..\default_start_groupings.cs //#include ..\..\..\Utils_CommonTriggers.cs //#include ..\..\..\Utils_CivHandler.cs //#include ..\..\..\Utils_GameTuning.cs //#include ..\..\..\Utils_Helpers.cs //#include ..\..\..\Utils_Econ.cs //#include ..\..\..\Utils_TriggerConditionWrappers.cs //#include ..\..\..\Utils_TriggerEffectWrappers.cs //#include ..\..\Utils_Celeste.cs //------------------------------------------------------------------- // CUSTOM INCLUDES: //------------------------------------------------------------------- //#include ..\..\..\Utils_AttackHelpers.cs //#include ..\..\..\Utils_WaveAttack.cs //#include ..\..\..\Utils_CampAttack.cs //------------------------------------------------------------------- // SCRIPT START: //------------------------------------------------------------------- using System.Collections.Generic; public partial class RMScript : RandomMap { private bool _bIsRepeat; private bool _bIsElite; private bool _bIsLegendary; private int _mainPlayerId; private int _coopPlayerId; private bool _isMapCoop; private ExternalObjectSet _questCreatedContent; //--------------------------------------------------------------- // MAIN: //--------------------------------------------------------------- public override void Main() { //----------------------------------------------------------- // SETUP: //----------------------------------------------------------- UtilsGT_PreInit(); SetStatusText("", 0.01f); // see if this is a repeatable _bIsRepeat = VariableGet("IsREPEAT", false); // see if this is a elite _bIsElite = VariableGet("bIsELITE", false); // see if this is a legendary _bIsLegendary = VariableGet("IsLEGENDARY", false); // fetch variable from the mission var scenarioFile = VariableGet("scenarioFile", ""); if (string.IsNullOrEmpty(scenarioFile)) { // early out on invalid scenario SetStatusText("Failed to load. Invalid scenarioFile.", 1.0f); return; } // PreInitSetup(); // terrain and scenario creation GetTerrain("Greek Inland"); InitializeFromScenario(scenarioFile); SetSkipBeautify(true); // class and mission tool data spawns var questTargetClass = new Class("questTargets"); var nuggets = new Class("nuggets"); Constraint questTargetConstraint = new ClassDistanceConstraint("quest target constraint", questTargetClass, 30.0f); Constraint avoidNuggets = new ClassDistanceConstraint("avoidNuggets", nuggets, 5.0f); _questCreatedContent = PlaceExternalObjects(questTargetClass, 0.0f); // UtilsGT_Init(); // _mainPlayerId = VariableGet("MainPlayerID", -1); if (_mainPlayerId == -1) { Info("No MainPlayerID specified, defaulting to 1"); _mainPlayerId = 1; } _coopPlayerId = VariableGet("CoopPlayerID", -1); _isMapCoop = _coopPlayerId != -1 && IsPlayerHuman(_coopPlayerId); // PostInitSetup(); //----------------------------------------------------------- // WRAP UP: //----------------------------------------------------------- SetStatusText("Done.", 1.0f); } private void PreInitSetup() { // } private void PostInitSetup() { // report our settings if (_isMapCoop) Info("MAP SETTINGS: bIsREPEAT:[" + _bIsRepeat + "], bIsELITE:[" + _bIsElite + "], bIsLEGENDARY:[" + _bIsLegendary + "], region:[" + region + "], MainPlayerID:[" + _mainPlayerId + "], CoopPlayerID:[" + _coopPlayerId + "]"); else Info("MAP SETTINGS: bIsREPEAT:[" + _bIsRepeat + "], bIsELITE:[" + _bIsElite + "], bIsLEGENDARY:[" + _bIsLegendary + "], region:[" + region + "], MainPlayerID:[" + _mainPlayerId + "]"); CommonMapSetup(_bIsRepeat, _bIsElite, _bIsLegendary); // SetCustomUnitDifficulty(_bIsLegendary); // if (_bIsLegendary) { // for legendary only.... // force the generals to attack after time has passed, tie the econ to generals existing int GeneralsPlayerID = VariableGet("GeneralsPlayerID", 0); bool bEconNerf = VariableGet("bEconNerf", false); if (GeneralsPlayerID > 0) { float GeneralsTime = VariableGet("GeneralsTime", 2100.0f); GeneralsAttack(_questCreatedContent, GeneralsTime, bEconNerf, GeneralsPlayerID, 1); } } else { // for non-legendary only.... // set a quest var to be used by the scenario CreateTrigger("CYPRUS_NUGGET_CHECKER", true, true, false, 4, false, false); // set the quest var TriggerEffect_QuestVarSet("CYPRUS_NUGGET_DEFENDERS", 1); } } //--------------------------------------------------------------- private void SetCustomUnitDifficulty(bool isLegendary) { for (var i = 1; i < cNumberPlayers; i++) { if (IsPlayerHuman(i)) continue; // for legendary only, inflate the health and dps of the Guardtower if (isLegendary) { UtilsCT_ModifyUnitHealth(i, "Gn_Bldg_WinterGuardTower", 5000.0f, 0.0f); UtilsCT_ModifyUnitRangedDPS(i, "Gn_Bldg_WinterGuardTower", 0.0f, 0.5f, 0.5f, 0.5f); } if (isLegendary) return; //This is the list of units var guardianList = new List { "NPC_Winter_Unit_IceKing", "NPC_Winter_Unit_AbominableSnowmanFighter" }; float[] unitHp = {50.0f, 100.0f, 150.0f, 200.0f, 250.0f}; float[] unitMeleeDps = {0.18f, 0.18f, 0.27f, 0.55f, 0.7f}; float[] unitRangedDps = {0.15f, 0.15f, 0.27f, 0.55f, 0.7f}; //This is the Quest Var value to be measured against per every few Player Levels var varValue = 1; //This is the loop that will create the triggers that will affect the unit stats based on Quest Checks for (var tempIndex = _gtStartingPlayerLevel; tempIndex <= _gtMaxPlayerLevel; tempIndex += _gtLevelsPerTier) { CreateTrigger("P" + i + "_SetCustomUnitDifficulty_" + varValue, true, true); TriggerCondition_QuestVarCheck(_gtPlayerTier, ">=", varValue); var hp = Core_GetArrayValue(varValue, unitHp); var meleeDps = Core_GetArrayValue(varValue, unitMeleeDps); var rangedDps = Core_GetArrayValue(varValue, unitRangedDps); foreach (var strUnitType in guardianList) { //MODIFY HEALTH TriggerEffect_ModifyProtounit(i, strUnitType, ModifyProtoUnitFields.Hitpoints, hp); //MODIFY MELEE DPS VS. INF/ARC/CAV TriggerEffect_ModifyProtounit(i, strUnitType, ModifyProtoUnitFields.HandBonusVsAbstractInfantry, meleeDps); TriggerEffect_ModifyProtounit(i, strUnitType, ModifyProtoUnitFields.HandBonusVsAbstractCavalry, meleeDps); TriggerEffect_ModifyProtounit(i, strUnitType, ModifyProtoUnitFields.HandBonusVsAbstractArcher, meleeDps); //MODIFY RANGED DPS VS. INF/ARC/CAV TriggerEffect_ModifyProtounit(i, strUnitType, ModifyProtoUnitFields.RangedBonusVsAbstractInfantry, rangedDps); TriggerEffect_ModifyProtounit(i, strUnitType, ModifyProtoUnitFields.RangedBonusVsAbstractCavalry, rangedDps); TriggerEffect_ModifyProtounit(i, strUnitType, ModifyProtoUnitFields.RangedBonusVsAbstractArcher, rangedDps); } varValue++; } } } //--------------------------------------------------------------- private void GeneralsAttack(ExternalObjectSet objSet, float nDelay, bool bEconNerf, int nAttackerID, int nTEAM) { int nArmyID = CreateArmy(nAttackerID, "GENERALS_ATTACK"); foreach (var pair in objSet.ObjectList) { if (pair.Key == "iceking") { AddUnitsToArmy(nAttackerID, nArmyID, pair.Value.mID); } } string playerLoc01 = UtilsAH_ConvertAreaToTriggerString("Player1"); string playerLoc02 = UtilsAH_ConvertAreaToTriggerString("Player2"); int move02TriggerID = CreateTrigger("GENERALS_ATTACK_MOVE02", false, false); TriggerCondition_Timer(7.0f); TriggerEffect_ArmyMove(nAttackerID, nArmyID, playerLoc02, "true"); int move01TriggerID = CreateTrigger("GENERALS_ATTACK_MOVE01", false, false); TriggerCondition_Timer(7.0f); TriggerEffect_ArmyMove(nAttackerID, nArmyID, playerLoc01, "true", move02TriggerID); int loopTriggerID = CreateTrigger("GENERALS_ATTACK_LOOP", false, false, true); TriggerCondition_Timer(73.0f); TriggerEffect_FireEvent(move01TriggerID); CreateTrigger("GENERALS_ATTACK_START"); TriggerCondition_Timer(nDelay); TriggerEffect_FireEvent(loopTriggerID); TriggerEffect_FireEvent(move01TriggerID); TriggerEffect_QuestVarSet("GENERALS_ATTACK_STARTED", 1); if (bEconNerf) { for (int i = 1; i < cNumberPlayers; i++) { if (GetPlayerTeam(i) == nTEAM) { int econDisableTriggerID = UtilsCT_GrantResources(i, -100.0f, -100.0f, -100.0f, -100.0f, 10.0f); SwitchToTrigger(econDisableTriggerID); SetTriggerLoop(true); // add the player condition check by unit type and count TriggerCondition_PlayerUnitCount(nAttackerID, "CyprusGeneral", "<", 1); // make sure this can only happen when the attack has started TriggerCondition_QuestVarCheck("GENERALS_ATTACK_STARTED", ">", 0); } } } } }