예제 #1
0
        public static bool CallForAid_Replacement_Patch(Map map, Faction faction)
        {
            Faction ofPlayer       = Faction.OfPlayer;
            int     goodwillChange = -25;
            bool    canSendMessage = false;
            string  reason         = "GoodwillChangedReason_RequestedMilitaryAid".Translate();

            faction.TryAffectGoodwillWith(ofPlayer, goodwillChange, canSendMessage, true, reason);
            IncidentParms incidentParms = new IncidentParms();

            incidentParms.target  = map;
            incidentParms.faction = faction;
            incidentParms.raidArrivalModeForQuickMilitaryAid = true;
            incidentParms.points = DiplomacyTuning.RequestedMilitaryAidPointsRange.RandomInRange;
            faction.lastMilitaryAidRequestTick = Find.TickManager.TicksGame;
            RimWar.Planet.Settlement rwdTown = WorldUtility.GetClosestRimWarSettlementOfFaction(faction, map.Tile, 40);
            if (rwdTown != null)
            {
                RimWarData rwd = WorldUtility.GetRimWarDataForFaction(faction);
                int        pts = Mathf.RoundToInt(rwdTown.RimWarPoints / 2);
                if (rwd.CanLaunch)
                {
                    WorldUtility.CreateLaunchedWarband(pts, rwd, rwdTown, rwdTown.Tile, map.Tile, WorldObjectDefOf.Settlement);
                }
                else
                {
                    WorldUtility.CreateWarband(pts, rwd, rwdTown, rwdTown.Tile, map.Tile, WorldObjectDefOf.Settlement);
                }
                rwdTown.RimWarPoints = pts;
                return(false);
            }
            return(true);
        }
예제 #2
0
 public static void AttackNow_SettlementReinforcement_Postfix(SettlementUtility __instance, Caravan caravan, RimWorld.Planet.Settlement settlement)
 {
     RimWar.Planet.Settlement rwSettlement = WorldUtility.GetRimWarSettlementAtTile(settlement.Tile);
     if (rwSettlement != null && rwSettlement.RimWarPoints > 1050)
     {
         WorldUtility.CreateWarband((rwSettlement.RimWarPoints - 1000), WorldUtility.GetRimWarDataForFaction(rwSettlement.Faction), rwSettlement, rwSettlement.Tile, rwSettlement.Tile, WorldObjectDefOf.Settlement);
     }
 }
예제 #3
0
 public static bool IncidentQueueAdd_Replacement_Prefix(IncidentQueue __instance, IncidentDef def, int fireTick, IncidentParms parms = null, int retryDurationTicks = 0)
 {
     if (def == IncidentDefOf.TraderCaravanArrival && fireTick == (Find.TickManager.TicksGame + 120000))
     {
         RimWar.Planet.Settlement rwdTown = WorldUtility.GetClosestRimWarSettlementOfFaction(parms.faction, parms.target.Tile, 40);
         if (rwdTown != null)
         {
             WorldUtility.CreateTrader(Mathf.RoundToInt(rwdTown.RimWarPoints / 2), WorldUtility.GetRimWarDataForFaction(rwdTown.Faction), rwdTown, rwdTown.Tile, parms.target.Tile, WorldObjectDefOf.Settlement);
             rwdTown.RimWarPoints = Mathf.RoundToInt(rwdTown.RimWarPoints / 2);
             return(false);
         }
     }
     return(true);
 }