private static void AttackNow(Caravan caravan, EnemyCaravan enemyCaravan) { Pawn t = caravan.PawnsListForReading[0]; Map orGenerateMap = GetOrGenerateMapUtility.GetOrGenerateMap(enemyCaravan.Tile, null); string letterLabel = "LetterLabelCaravanEnteredEnemyBase".Translate(); string letterText = "LetterCaravanEnteredEnemyBase".Translate(caravan.Label, enemyCaravan.Label).CapitalizeFirst(); AffectRelationsOnAttacked(enemyCaravan, ref letterText); Find.TickManager.Notify_GeneratedPotentiallyHostileMap(); PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter(orGenerateMap.mapPawns.AllPawns, ref letterLabel, ref letterText, "LetterRelatedPawnsSettlement".Translate(Faction.OfPlayer.def.pawnsPlural), informEvenIfSeenBefore: true); Find.LetterStack.ReceiveLetter(letterLabel, letterText, LetterDefOf.NeutralEvent, t, enemyCaravan.Faction); CaravanEnterMapUtility.Enter(caravan, orGenerateMap, CaravanEnterMode.Edge, CaravanDropInventoryMode.DoNotDrop, draftColonists: true); }
public static void AffectRelationsOnAttacked(EnemyCaravan enemyCaravan, ref string letterText) { if (enemyCaravan.Faction == null || enemyCaravan.Faction == Faction.OfPlayer) { return; } FactionRelationKind playerRelationKind = enemyCaravan.Faction.PlayerRelationKind; if (!enemyCaravan.Faction.HostileTo(Faction.OfPlayer)) { enemyCaravan.Faction.TrySetRelationKind(Faction.OfPlayer, FactionRelationKind.Hostile, canSendLetter: false); } else if (enemyCaravan.Faction.TryAffectGoodwillWith(Faction.OfPlayer, -50, canSendMessage: false, canSendHostilityLetter: false)) { if (!letterText.NullOrEmpty()) { letterText += "\n\n"; } letterText = letterText + "RelationsWith".Translate(enemyCaravan.Faction.Name) + ": " + (-50).ToStringWithSign(); } enemyCaravan.Faction.TryAppendRelationKindChangedInfo(ref letterText, playerRelationKind, enemyCaravan.Faction.PlayerRelationKind); }
public static void Attack(Caravan caravan, EnemyCaravan enemyCaravan) { LongEventHandler.QueueLongEvent(() => AttackNow(caravan, enemyCaravan), "GeneratingMapForNewEncounter", false, null); }
public static IEnumerable <FloatMenuOption> GetFloatMenuOptions(Caravan caravan, EnemyCaravan enemyCaravan) { return(CaravanArrivalActionUtility.GetFloatMenuOptions(() => CanVisit(caravan, enemyCaravan), () => new CaravanArrivalAction_AttackEnemyCaravan(enemyCaravan), "VanillaFactionsExpanded.AttackEnemyCaravan".Translate(enemyCaravan.Label), caravan, enemyCaravan.Tile, enemyCaravan)); }
public static FloatMenuAcceptanceReport CanVisit(Caravan caravan, EnemyCaravan enemyCaravan) { return(enemyCaravan != null && enemyCaravan.Spawned); }
public CaravanArrivalAction_AttackEnemyCaravan(EnemyCaravan enemyCaravan) { this.enemyCaravan = enemyCaravan; }