Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 public static void Attack(Caravan caravan, EnemyCaravan enemyCaravan)
 {
     LongEventHandler.QueueLongEvent(() => AttackNow(caravan, enemyCaravan), "GeneratingMapForNewEncounter", false, null);
 }
Exemplo n.º 4
0
 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));
 }
Exemplo n.º 5
0
 public static FloatMenuAcceptanceReport CanVisit(Caravan caravan, EnemyCaravan enemyCaravan)
 {
     return(enemyCaravan != null && enemyCaravan.Spawned);
 }
Exemplo n.º 6
0
 public CaravanArrivalAction_AttackEnemyCaravan(EnemyCaravan enemyCaravan)
 {
     this.enemyCaravan = enemyCaravan;
 }