public static bool Prefix(TeamOverride __instance, Contract contract, DataManager dataManager,
                                  ref Contract ___contract, ref DataManager ___dataManager, ref string ___teamLeaderCastDefId, ref List <LanceOverride> ___lanceOverrideList, ref Faction ___faction)
        {
            ___contract    = contract;
            ___dataManager = dataManager;

            if (___teamLeaderCastDefId == CastDef.castDef_TeamLeader_Current)
            {
                ___teamLeaderCastDefId = CastDef.GetCombatCastDefIdFromFaction(___faction, contract.BattleTechGame.DataManager);
            }

            for (int i = 0; i < ___lanceOverrideList.Count; ++i)
            {
                LanceOverride lanceOverride = ___lanceOverrideList[i];
                lanceOverrides[lanceOverride.GetHashCode()] = __instance;
                IRBT14MadlibsFix.Logger.Log($"TO:RML setting teamOverride:[{__instance.GetHashCode()}] for lanceOverride:[{lanceOverride.GetHashCode()}]");
                lanceOverride.RunMadLibs(contract);
            }

            return(false);
        }
Exemple #2
0
        public override void Run(RunPayload payload)
        {
            Main.Logger.Log($"[AddLanceToAllyTeam] Adding lance to ally lance");
            ContractOverride contractOverride   = ((ContractOverridePayload)payload).ContractOverride;
            TeamOverride     teamOverride       = contractOverride.employerTeam;
            TeamOverride     targetTeamOverride = contractOverride.targetTeam;

            LanceOverride lanceOverride = SelectAppropriateLanceOverride("allies").Copy();

            lanceOverride.name = $"Lance_Ally_Force_{lanceGuid}";

            if (unitGuids.Count > 4)
            {
                for (int i = 4; i < unitGuids.Count; i++)
                {
                    UnitSpawnPointOverride unitSpawnOverride = lanceOverride.unitSpawnPointOverrideList[0].Copy();
                    lanceOverride.unitSpawnPointOverrideList.Add(unitSpawnOverride);
                }
            }

            for (int i = 0; i < lanceOverride.unitSpawnPointOverrideList.Count; i++)
            {
                string            unitGuid     = unitGuids[i];
                UnitSpawnPointRef unitSpawnRef = new UnitSpawnPointRef();
                unitSpawnRef.EncounterObjectGuid = unitGuid;
                lanceOverride.unitSpawnPointOverrideList[i].unitSpawnPoint = unitSpawnRef;
            }

            LanceSpawnerRef lanceSpawnerRef = new LanceSpawnerRef();

            lanceSpawnerRef.EncounterObjectGuid = lanceGuid;
            lanceOverride.lanceSpawner          = lanceSpawnerRef;

            lanceOverride.RunMadLibs(contractOverride.contract, teamOverride);

            teamOverride.lanceOverrideList.Add(lanceOverride);
        }
        public override void Run(RunPayload payload)
        {
            Main.Logger.Log($"[AddLanceToTargetTeam] Adding lance to target lance");
            ContractOverride contractOverride = ((ContractOverridePayload)payload).ContractOverride;
            TeamOverride     teamOverride     = contractOverride.targetTeam;

            LanceOverride lanceOverride = (manuallySpecifiedLance == null) ? SelectAppropriateLanceOverride("enemy").Copy() : manuallySpecifiedLance.Copy();

            lanceOverride.name = $"Lance_Enemy_OpposingForce_{lanceGuid}";

            if (unitGuids.Count > 4)
            {
                for (int i = 4; i < unitGuids.Count; i++)
                {
                    UnitSpawnPointOverride unitSpawnOverride = lanceOverride.unitSpawnPointOverrideList[0].Copy();
                    lanceOverride.unitSpawnPointOverrideList.Add(unitSpawnOverride);
                }
            }

            for (int i = 0; i < lanceOverride.unitSpawnPointOverrideList.Count; i++)
            {
                string            unitGuid     = unitGuids[i];
                UnitSpawnPointRef unitSpawnRef = new UnitSpawnPointRef();
                unitSpawnRef.EncounterObjectGuid = unitGuid;
                lanceOverride.unitSpawnPointOverrideList[i].unitSpawnPoint = unitSpawnRef;
            }

            LanceSpawnerRef lanceSpawnerRef = new LanceSpawnerRef();

            lanceSpawnerRef.EncounterObjectGuid = lanceGuid;
            lanceOverride.lanceSpawner          = lanceSpawnerRef;

            lanceOverride.RunMadLibs(contractOverride.contract, teamOverride);

            teamOverride.lanceOverrideList.Add(lanceOverride);
        }