Esempio n. 1
0
 private static bool AtMaxFight(GeoLevelController geoLevel, IGeoFactionMissionParticipant attacker)
 {
     try {
         if (geoLevel?.Map == null || IsAlienOrPP(attacker))
         {
             return(false);
         }
         foreach (GeoSite site in geoLevel.Map.AllSites)
         {
             if (!(site.ActiveMission is GeoHavenDefenseMission mission))
             {
                 continue;
             }
             if (Config.No_Attack_When_Sieged_Difficulty >= difficulty && IsAlien(mission.GetEnemyFaction()) && site.Owner == attacker)
             {
                 Verbo("{0} is being sieged by alien at {0}.", site.Name);
                 return(true);
             }
             if (Config.One_Global_Attack_Difficulty >= difficulty)
             {
                 Verbo("Global attack limit: {0} already under siege.", site.Name);
                 return(true); // Rokkie and Veteran limits to 1 faction war on globe
             }
             if (Config.One_Attack_Per_Faction_Difficulty >= difficulty && mission.GetEnemyFaction() == attacker)
             {
                 Verbo("Faction attack limit: {0} already sieging {1}.", attacker.GetPPName(), site.Name);
                 return(true); // Hero and Legend limits to 1 attack per faction
             }
         }
         return(false);
     } catch (Exception ex) { return(!Error(ex)); }
 }
Esempio n. 2
0
 private static void AfterLevelStart_StoreDiff(GeoLevelController __instance)
 {
     try {
         GameDifficultyLevelDef diff = __instance.CurrentDifficultyLevel;
         difficulty   = __instance.DynamicDifficultySystem.DifficultyLevels.ToList().IndexOf(diff);
         lastAttacker = null;
         Info("Attacker reset. Difficulty level is {0}.", difficulty); // 0 = Rookie, 1 = Veteran, 2 = Hero, 3 = Legend
     } catch (Exception ex) { Error(ex); }
 }
Esempio n. 3
0
 private static bool ShouldStopFight(GeoLevelController geoLevel, IGeoFactionMissionParticipant from)
 {
     try {
         if (Config.Stop_OneSided_War && lastAttacker != null && from == lastAttacker)
         {
             Verbo("One sided war; {0} has already attacked.", from.GetPPName());
             return(true);
         }
         return(AtMaxFight(geoLevel, from));
     } catch (Exception ex) { return(!Error(ex)); }
 }
Esempio n. 4
0
 private static bool Override_Attack(GeoFaction __instance, GeoVehicle vehicle, GeoSite site, GeoLevelController ____level)
 {
     try {
         Verbo("{0} wants to attack {1}.", vehicle.Name, site.Name);
         if (ShouldStopFight(____level, vehicle?.Owner))
         {
             Info("{0} attack prevented at {2}.", __instance.Name.Localize(), vehicle.Name, site.Name);
             return(false);
         }
         lastAttacker = vehicle.Owner;
         return(true);
     } catch (Exception ex) { return(Error(ex)); }
 }
Esempio n. 5
0
 private static bool CauseZoneDamage(IGeoFactionMissionParticipant attacker)
 {
     return(!IsPhoenixPt(attacker) &&
            (Config.Pandora_Attack_Zone && IsAlien(attacker)) ||
            (Config.Faction_Attack_Zone && !IsAlien(attacker)));
 }
Esempio n. 6
0
 private static bool IsAlienOrPP(IGeoFactionMissionParticipant f) => IsAlien(f) || IsPhoenixPt(f);
Esempio n. 7
0
 private static bool IsPhoenixPt(IGeoFactionMissionParticipant f) => f is GeoPhoenixFaction;
Esempio n. 8
0
 private static bool IsAlien(IGeoFactionMissionParticipant f) => f is GeoAlienFaction;