protected override LordJob MakeLordJob(IncidentParms parms, Map map, List <Pawn> pawns, int raidSeed) { IntVec3 siegeSpot = RCellFinder.FindSiegePositionFrom_NewTemp(parms.spawnCenter.IsValid ? parms.spawnCenter : pawns[0].PositionHeld, map); float num = parms.points * Rand.Range(0.2f, 0.3f); if (num < 60f) { num = 60f; } return(new LordJob_Siege(parms.faction, siegeSpot, num)); }
public static IntVec3 FindClusterPosition(Map map, MechClusterSketch sketch, int maxTries = 100, float spawnCloseToColonyChance = 0f) { IntVec3 result = IntVec3.Invalid; float num = float.MinValue; if (Rand.Chance(spawnCloseToColonyChance)) { for (int i = 0; i < 20; i++) { if (!DropCellFinder.TryFindRaidDropCenterClose(out IntVec3 spot, map, canRoofPunch: true, allowIndoors: true, closeWalk: false, 40)) { break; } float clusterPositionScore = GetClusterPositionScore(spot, map, sketch); if (clusterPositionScore >= 100f || Mathf.Approximately(clusterPositionScore, 100f)) { return(spot); } if (clusterPositionScore > num) { result = spot; num = clusterPositionScore; } } } for (int j = 0; j < maxTries; j++) { IntVec3 intVec = CellFinderLoose.RandomCellWith((IntVec3 x) => x.Standable(map), map); if (!intVec.IsValid) { continue; } IntVec3 intVec2 = RCellFinder.FindSiegePositionFrom_NewTemp(intVec, map); if (intVec2.IsValid) { float clusterPositionScore2 = GetClusterPositionScore(intVec2, map, sketch); if (clusterPositionScore2 >= 100f || Mathf.Approximately(clusterPositionScore2, 100f)) { return(intVec2); } if (clusterPositionScore2 > num) { result = intVec; num = clusterPositionScore2; } } } if (!result.IsValid) { return(CellFinder.RandomCell(map)); } return(result); }
private static IntVec3 FindDropPodLocation(Map map, Predicate <IntVec3> validator) { for (int i = 0; i < 200; i++) { IntVec3 intVec = RCellFinder.FindSiegePositionFrom_NewTemp(DropCellFinder.FindRaidDropCenterDistant_NewTemp(map, allowRoofed: true), map, allowRoofed: true); if (validator(intVec)) { return(intVec); } } return(IntVec3.Invalid); }
protected override LordJob MakeLordJob(IncidentParms parms, Map map, List <Pawn> pawns, int raidSeed) { IntVec3 stageLoc = RCellFinder.FindSiegePositionFrom_NewTemp(parms.spawnCenter.IsValid ? parms.spawnCenter : pawns[0].PositionHeld, map); return(new LordJob_StageThenAttack(parms.faction, stageLoc, raidSeed)); }