예제 #1
0
        /// <summary> Notify this faction that one of their pawns has been transformed. </summary>
        public static void Notify_MemberTransformed([NotNull] this Faction faction, [NotNull] Pawn member, [NotNull] Pawn animal, bool wasWorldPawn, [CanBeNull] Map map)
        {
            if (faction == null)
            {
                throw new ArgumentNullException(nameof(faction));
            }
            if (member == null)
            {
                throw new ArgumentNullException(nameof(member));
            }
            if (animal == null)
            {
                throw new ArgumentNullException(nameof(animal));
            }
            if (faction.IsPlayer)
            {
                return;
            }
            if (!member.IsPrisonerOfColony)
            {
                return;
            }
            if (!faction.CanChangeGoodwillFor(Faction.OfPlayer, TRANSFORMED_RELATIONSHIP_OFFSET))
            {
                return;
            }
            if (!wasWorldPawn &&
                !PawnGenerator.IsBeingGenerated(member) &&
                (Current.ProgramState == ProgramState.Playing && map != null) &&
                (map.IsPlayerHome && !faction.HostileTo(Faction.OfPlayer))) //check that mirrors that in Faction Notify_MemberDied
            {
                var reason = GOODWILL_LABEL.Translate(member.LabelShort.Named(MEMBER_LABEL)
                                                      , animal.def.LabelCap.Named(ANIMAL_SPECIES)
                                                      ); // the first arg will be the former pawn, the second the animal
                faction.TryAffectGoodwillWith(Faction.OfPlayer, TRANSFORMED_RELATIONSHIP_OFFSET, reason: reason);
            }

            if (member == faction.leader)
            {
                Notify_LeaderTransformed(faction, animal);
            }
        }
예제 #2
0
 static bool Prerequirments(Faction faction, Faction other, int goodwillChange)
 {
     if (!faction.CanChangeGoodwillFor(other, goodwillChange))
     {
         return(false);
     }
     if (faction.def.hidden || other.def.hidden)
     {
         return(false);
     }
     if (goodwillChange > 0f && faction.def.permanentEnemy)
     {
         return(false);
     }
     if (goodwillChange > 0f && ((faction.IsPlayer && SettlementUtility.IsPlayerAttackingAnySettlementOf(other)) || (other.IsPlayer && SettlementUtility.IsPlayerAttackingAnySettlementOf(faction))))
     {
         return(false);
     }
     return(true);
 }