public override void ResolveReferences() { base.ResolveReferences(); if (Subfactions != null) { Subfaction SubFac = Subfactions.RandomElementByWeight((Subfaction sub2) => sub2.weight); this.label = SubFac.SubfactionLabel; this.fixedName = SubFac.SubfactionName; this.description = SubFac.SubfactionDescription; this.FactionColor1 = SubFac.SubfactionColor1; this.FactionColor2 = SubFac.SubfactionColor2; this.PreferredChaosGod = SubFac.SubfactionPreferredChaosGod; if (SubFac.SubfactionPawnGroupMakers != null) { this.pawnGroupMakers = SubFac.SubfactionPawnGroupMakers; } } }
public void GainPatron(ChaosGods forcedPatron, bool UseForcedPatron) { if (PawnAfflictionProps == null) { PawnAfflictionProps = new AfflictionProperty(); PawnAfflictionProps.Patron = ChaosGods.Undivided; } if (UseForcedPatron) { PawnAfflictionProps.Patron = forcedPatron; this.Patron = PawnAfflictionProps.Patron; } else { if (pawn.Faction.def.GetType() == typeof(FactionDefUniform)) { FactionDefUniform Facdef = this.pawn.Faction.def as FactionDefUniform; if (Facdef.PreferredChaosGod == ChaosGods.Undivided) { PawnAfflictionProps.Patron = ChaosGods.Undivided; } else { PawnAfflictionProps.Patron = Facdef.PreferredChaosGod; } } if (PawnAfflictionProps == null) { PawnAfflictionProps = new AfflictionProperty(); PawnAfflictionProps.Patron = ChaosGods.Undivided; } if (PawnAfflictionProps.Patron == ChaosGods.Undivided) { if (Rand.Range(0.1f, 1f) > 0.5f) { this.Patron = ChaosGods.Undivided; } else { this.Patron = (ChaosGods)Rand.RangeInclusive(1, 4); } } else { this.Patron = PawnAfflictionProps.Patron; } } patronInfo.PatronName = Patron.ToString(); GeneratePatronTraits(pawn); this.SoulTraits.Remove(DevotionTrait); DevotionTrait = new SoulTrait(CorruptionDefOfs.Devotion, Rand.RangeInclusive(0, 2)); this.SoulTraits.Add(DevotionTrait); if (pawn.story == null) { pawn.story = new Pawn_StoryTracker(pawn); } // Hediff chaosmark = HediffMaker.MakeHediff(ChaosMarkDef(this.patronInfo.PatronName), this.pawn,null); // this.pawn.health.hediffSet.AddHediffDirect(chaosmark); if (this.pawn.Drawer != null && this.pawn.story != null) { if (this.pawn.Drawer.renderer != null) { if (this.pawn.Drawer.renderer.graphics != null && this.pawn.apparel != null) { LongEventHandler.ExecuteWhenFinished(delegate { this.pawn.Drawer.renderer.graphics.ResolveApparelGraphics(); PortraitsCache.SetDirty(this.pawn); }); } } } this.NoPatron = false; }