protected override void ModifyPawnPostGenerate(Pawn pawn, bool redressed)
 {
     if (pawn.story != null && pawn.story.traits != null)
     {
         if (!pawn.story.traits.HasTrait(this.trait) || pawn.story.traits.DegreeOfTrait(this.trait) != this.degree)
         {
             if (pawn.story.traits.HasTrait(this.trait))
             {
                 pawn.story.traits.allTraits.RemoveAll((Trait tr) => tr.def == this.trait);
             }
             else
             {
                 IEnumerable <Trait> source = from tr in pawn.story.traits.allTraits
                                              where !tr.ScenForced && !ScenPart_ForcedTrait.PawnHasTraitForcedByBackstory(pawn, tr.def)
                                              select tr;
                 if (source.Any <Trait>())
                 {
                     Trait trait = (from tr in source
                                    where tr.def.conflictingTraits.Contains(this.trait)
                                    select tr).FirstOrDefault <Trait>();
                     if (trait != null)
                     {
                         pawn.story.traits.allTraits.Remove(trait);
                     }
                     else
                     {
                         pawn.story.traits.allTraits.Remove(source.RandomElement <Trait>());
                     }
                 }
             }
             pawn.story.traits.GainTrait(new Trait(this.trait, this.degree, true));
         }
     }
 }
Exemplo n.º 2
0
        public override bool CanCoexistWith(ScenPart other)
        {
            ScenPart_ForcedTrait scenPart_ForcedTrait = other as ScenPart_ForcedTrait;

            if (scenPart_ForcedTrait != null && trait == scenPart_ForcedTrait.trait && context.OverlapsWith(scenPart_ForcedTrait.context))
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 3
0
        public override bool CanCoexistWith(ScenPart other)
        {
            ScenPart_ForcedTrait scenPart_ForcedTrait = other as ScenPart_ForcedTrait;

            return(scenPart_ForcedTrait == null || this.trait != scenPart_ForcedTrait.trait || !this.context.OverlapsWith(scenPart_ForcedTrait.context));
        }