private string culturalToleranceToolTip(CulturalToleranceCategory cat) { switch (cat) { case (CulturalToleranceCategory.Neutral): { return("CulturalToleranceNeutralDesc".Translate(new object[] { SelPawn.NameStringShort })); } case (CulturalToleranceCategory.Xenophile): { return("CulturalToleranceXenophilelDesc".Translate(new object[] { SelPawn.NameStringShort })); } case (CulturalToleranceCategory.Xenophobe): { return("CulturalToleranceXenophobeDesc".Translate(new object[] { SelPawn.NameStringShort })); } default: { return(null); } } }
public override void PreOpen() { base.PreOpen(); if (SelPawn != null) { soul = SelPawn.needs.TryGetNeed<Need_Soul>(); this.SelPawnPatron = soul.patronInfo.PatronName; this.SelPawnSoulState = soul.CurCategory.ToString(); PatronColor = PatronInfo.PatronColor(SelPawnPatron); STraits = soul.SoulTraits; this.psykerPowerLevel = soul.PsykerPowerLevel.ToString(); this.culturalTolerance = soul.CulturalTolerance; } }
public override void PreOpen() { base.PreOpen(); this.SelPawn = this.SelThing as Pawn; if (SelPawn != null) { soul = SelPawn.needs.TryGetNeed <Need_Soul>(); this.SelPawnPatron = soul.patronInfo.PatronName; this.SelPawnSoulState = soul.CurCategory.ToString(); PatronColor = PatronInfo.PatronColor(SelPawnPatron); if (soul.SoulTraits.NullOrEmpty()) { Log.Message("NoSoulTraits"); } if (!soul.SoulTraits.NullOrEmpty()) { Log.Message(soul.SoulTraits.Count.ToString()); STraits = soul.SoulTraits; } this.psykerPowerLevel = soul.PsykerPowerLevel.ToString(); this.culturalTolerance = soul.CulturalTolerance; } }
public override void SetInitialLevel() { InitiatePsykerComp(); // try // { // AddPsykerPower(PsykerPowerDefOf.PsykerPower_Berserker); // AddPsykerPower(PsykerPowerDefOf.PsykerPower_WarpBolt); // AddPsykerPower(PsykerPowerDefOf.PsykerPower_Temptation); // AddPsykerPower(PsykerPowerDefOf.PsykerPower_Purgatus); // } // catch // { } ChaosFollowerPawnKindDef pdef = this.pawn.kindDef as ChaosFollowerPawnKindDef; if (pdef != null && pdef.AfflictionProperty != null) { PawnAfflictionProps = new AfflictionProperty(); this.PawnAfflictionProps = pdef.AfflictionProperty; int pllow = (int)this.PawnAfflictionProps.LowerPsykerPowerLimit; int plup = (int)this.PawnAfflictionProps.UpperAfflictionLimit; this.PsykerPowerLevel = (PsykerPowerLevel)Rand.RangeInclusive(pllow, plup); if (PawnAfflictionProps.IsImmune) { this.curLevelInt = 0.99f; this.DevotionTrait = new SoulTrait(CorruptionDefOfs.Devotion, PawnAfflictionProps.ImmuneDevotionDegree); this.IsImmune = true; } else if (this.PsykerPowerLevel == PsykerPowerLevel.Omega) { this.IsImmune = true; this.curLevelInt = Rand.Range(0.86f, 0.99f); this.NoPatron = true; } else { float afup = pdef.AfflictionProperty.UpperAfflictionLimit; float afdown = pdef.AfflictionProperty.LowerAfflictionLimit; this.curLevelInt = (Rand.Range(afup, afdown)); } if (PawnAfflictionProps.UseOtherFaith) { this.patronInfo.PatronName = PawnAfflictionProps.IsofFaith.ToString(); } this.CulturalTolerance = PawnAfflictionProps.PrimaryToleranceCategory; } else { PawnAfflictionProps = new AfflictionProperty(); this.PsykerPowerLevel = (PsykerPowerLevel)Rand.RangeInclusive(0, Enum.GetValues(typeof(PsykerPowerLevel)).Length - 1); this.CulturalTolerance = (CulturalToleranceCategory)Rand.RangeInclusive(0, 2); if (this.PsykerPowerLevel == PsykerPowerLevel.Omega) { this.IsImmune = true; this.curLevelInt = Rand.Range(0.86f, 0.99f); this.NoPatron = true; } else { this.curLevelInt = Rand.Range(0.01f, 0.99f); } } if (this.PawnAfflictionProps.CommmonPsykerPowers != null) { for (int i = 0; i < this.PawnAfflictionProps.CommmonPsykerPowers.Count; i++) { try { this.compPsyker.PowerManager.AddPsykerPower(this.PawnAfflictionProps.CommmonPsykerPowers[i]); } catch { } } } if (CorruptionDefOfs.Devotion.SDegreeDatas == null) { Log.Message("No stdata"); } if (this.SoulTraits.NullOrEmpty()) { if ((PawnAfflictionProps != null && PawnAfflictionProps.IsImmune)) { this.DevotionTrait = new SoulTrait(CorruptionDefOfs.Devotion, PawnAfflictionProps.ImmuneDevotionDegree); this.IsImmune = true; } else { this.DevotionTrait = new SoulTrait(CorruptionDefOfs.Devotion, Rand.RangeInclusive(-2, 2)); } this.SoulTraits.Insert(0, DevotionTrait); } if (PawnAfflictionProps.CommonSoulTrait != null && !this.SoulTraits.Any(x => x.SDef == PawnAfflictionProps.CommonSoulTrait)) { this.SoulTraits.Add(new SoulTrait(PawnAfflictionProps.CommonSoulTrait, 0)); } if (this.curLevelInt < 0.3f && NoPatron == true) { GainPatron(ChaosGods.Undivided, false); } if (NoPatron == false) { if (curLevelInt > 0.3f) { curLevelInt = 0.3f; } } if (this.PsykerPowerLevel == PsykerPowerLevel.Omega) { this.IsImmune = true; } }
public override void SetInitialLevel() { if (!SoulInitialized) { FieldInfo info = typeof(StatsReportUtility).GetField("cachedDrawEntries", BindingFlags.NonPublic | BindingFlags.Static); if (info != null) { List <StatDrawEntry> entries = info.GetValue(this.pawn) as List <StatDrawEntry>; if (!entries.NullOrEmpty()) { entries.Add(new StatDrawEntry(StatCategoryDefOf.BasicsPawn, "Patron", this.Patron.ToString(), 3)); entries.Add(new StatDrawEntry(StatCategoryDefOf.BasicsPawn, "CulturalToleranceStat".Translate(), this.Patron.ToString(), 2)); entries.Add(new StatDrawEntry(StatCategoryDefOf.BasicsPawn, "PurityOfSoulStat".Translate(), this.CurLevel.ToString(), 1)); } } // try // { // AddPsykerPower(PsykerPowerDefOf.PsykerPower_Berserker); // AddPsykerPower(PsykerPowerDefOf.PsykerPower_WarpBolt); // AddPsykerPower(PsykerPowerDefOf.PsykerPower_Temptation); // AddPsykerPower(PsykerPowerDefOf.PsykerPower_Purgatus); // } // catch // { } InitiatePsykerComp(); ChaosFollowerPawnKindDef pdef = this.pawn.kindDef as ChaosFollowerPawnKindDef; // Log.Message("Name is: " + this.pawn.Name.ToStringFull); if (pdef != null) { if (pdef.UseFixedGender) { this.pawn.gender = pdef.FixedGender; } if (pdef.AfflictionProperty != null) { PawnAfflictionProps = new AfflictionProperty(); this.PawnAfflictionProps = pdef.AfflictionProperty; int pllow = (int)this.PawnAfflictionProps.LowerPsykerPowerLimit; int plup = (int)this.PawnAfflictionProps.UpperAfflictionLimit; this.PsykerPowerLevel = (PsykerPowerLevel)Rand.RangeInclusive(pllow, plup); if (PawnAfflictionProps.IsImmune) { this.curLevelInt = 0.99f; this.DevotionTrait = new SoulTrait(C_SoulTraitDefOf.Devotion, PawnAfflictionProps.ImmuneDevotionDegree); this.IsImmune = true; } else if (this.PsykerPowerLevel == PsykerPowerLevel.Omega) { this.IsImmune = true; this.curLevelInt = Rand.Range(0.86f, 0.99f); this.NoPatron = true; } else { float afup = pdef.AfflictionProperty.UpperAfflictionLimit; float afdown = pdef.AfflictionProperty.LowerAfflictionLimit; this.curLevelInt = (Rand.Range(afup, afdown)); } if (PawnAfflictionProps.UseOtherFaith) { this.patronInfo.PatronName = PawnAfflictionProps.IsofFaith.ToString(); } this.CulturalTolerance = PawnAfflictionProps.PrimaryToleranceCategory; } } else { PawnAfflictionProps = new AfflictionProperty(); float pNum = Rand.GaussianAsymmetric(2.5f, 0.45f, 2); if (pNum < 0) { pNum = 0; } else if (pNum > 7) { pNum = 7; } this.PsykerPowerLevel = (PsykerPowerLevel)pNum; this.CulturalTolerance = (CulturalToleranceCategory)Rand.RangeInclusive(0, 2); if (this.PsykerPowerLevel == PsykerPowerLevel.Omega) { this.IsImmune = true; this.curLevelInt = Rand.Range(0.86f, 0.99f); this.NoPatron = true; } else { this.curLevelInt = Rand.Range(0.4f, 0.99f); } } if (this.PawnAfflictionProps.CommmonPsykerPowers != null) { for (int i = 0; i < this.PawnAfflictionProps.CommmonPsykerPowers.Count; i++) { try { this.compPsyker.psykerPowerManager.AddPsykerPower(this.PawnAfflictionProps.CommmonPsykerPowers[i]); } catch { } } } if (this.DevotionTrait == null) { if ((PawnAfflictionProps != null && PawnAfflictionProps.IsImmune)) { this.DevotionTrait = new SoulTrait(C_SoulTraitDefOf.Devotion, PawnAfflictionProps.ImmuneDevotionDegree); this.IsImmune = true; } else { this.DevotionTrait = new SoulTrait(C_SoulTraitDefOf.Devotion, Rand.RangeInclusive(-2, 2)); } } if (PawnAfflictionProps.CommonSoulTrait != null) { this.CommonSoulTrait = new SoulTrait(PawnAfflictionProps.CommonSoulTrait, 0); } if (this.curLevelInt < 0.3f && NoPatron == true) { GainPatron(ChaosGods.Undivided, false); } if (NoPatron == false) { if (curLevelInt > 0.3f) { curLevelInt = 0.3f; } } if (this.PsykerPowerLevel == PsykerPowerLevel.Omega) { this.IsImmune = true; } this.SoulInitialized = true; if (this.compPsyker.patronName != patronInfo.PatronName) { this.compPsyker.patronName = patronInfo.PatronName; PortraitsCache.SetDirty(this.pawn); } } }