protected override ThoughtState CurrentSocialStateInternal(Pawn p, Pawn otherPawn) { Need_Soul s1 = p.needs.TryGetNeed <Need_Soul>(); Need_Soul s2 = otherPawn.needs.TryGetNeed <Need_Soul>(); if (s1 != null && s2 != null) { if (s1.CulturalTolerance == CulturalToleranceCategory.Xenophobe) { if (p.kindDef.race != otherPawn.kindDef.race) { return(ThoughtState.ActiveAtStage(1)); } return(ThoughtState.ActiveAtStage(0)); } if (s1.CulturalTolerance == CulturalToleranceCategory.Xenophile) { if (p.kindDef.race != otherPawn.kindDef.race) { return(ThoughtState.ActiveAtStage(2)); } } } return(ThoughtState.Inactive); }
protected override ThoughtState CurrentStateInternal(Pawn p) { Need_Soul soul = p.needs.TryGetNeed <Need_Soul>(); if (soul != null && soul.CulturalTolerance != CulturalToleranceCategory.Neutral) { int peeps; int foreigners; this.AliensPresent(p, out peeps, out foreigners); if (soul.CulturalTolerance == CulturalToleranceCategory.Xenophobe) { if (foreigners > peeps) { return(ThoughtState.ActiveAtStage(2)); } else if (foreigners > 0) { return(ThoughtState.ActiveAtStage(1)); } return(ThoughtState.ActiveAtStage(0)); } if (soul.CulturalTolerance == CulturalToleranceCategory.Xenophile) { if (foreigners > 0) { return(ThoughtState.ActiveAtStage(4)); } return(ThoughtState.ActiveAtStage(3)); } } return(ThoughtState.Inactive); }
protected override ThoughtState CurrentSocialStateInternal(Pawn p, Pawn otherPawn) { bool flag = true; Need_Soul s1 = p.needs.TryGetNeed <Need_Soul>(); Need_Soul s2 = p.needs.TryGetNeed <Need_Soul>(); if (s2.NoPatron == true) { flag = false; } if (flag) { if (movingSermon(otherPawn)) { return(ThoughtState.ActiveAtStage(3)); } return(ThoughtState.ActiveAtStage(2)); } else { if (p.IsPrisonerOfColony) { return(ThoughtState.ActiveAtStage(1)); } return(ThoughtState.ActiveAtStage(0)); } }
public static void OpenPreacherSelectMenu(BuildingAltar altar) { List <FloatMenuOption> list = new List <FloatMenuOption>(); list.Add(new FloatMenuOption("(" + "NoneLower".Translate() + ")", delegate { altar.preacher = null; }, MenuOptionPriority.Default, null, null, 0f, null)); foreach (Pawn current in altar.Map.mapPawns.FreeColonistsSpawned) { if (!SermonUtility.IsPreacher(current)) { Need_Soul nsoul = current.needs.TryGetNeed <Need_Soul>(); if (nsoul == null) { nsoul = new Need_Soul(current); } SoulTrait strait = nsoul.DevotionTrait; string text1 = current.NameStringShort + " (" + strait.SoulCurrentData.label + ")"; Action action; Pawn localCol = current; action = delegate { altar.preacher = localCol; }; list.Add(new FloatMenuOption(text1, action, MenuOptionPriority.Default, null, null, 0f, null)); } } Find.WindowStack.Add(new FloatMenu(list)); }
public static MentalStateDef KhorneEffects(Pawn pawn, Need_Soul soul) { int num = Rand.RangeInclusive(1, 9); if (num > 6) { return(MentalStateDefOf.Berserk); } return(C_MentalStateDefOf.KhorneKillWeak); }
protected override IEnumerable <Toil> MakeNewToils() { Pawn Reader = this.pawn; Need_Soul soul = Reader.needs.TryGetNeed <Need_Soul>(); CompPsyker compPsyker = soul.compPsyker; yield return(Toils_Reserve.Reserve(TargetIndex.A, 1)); yield return(Toils_Goto.GotoCell(TargetIndex.A, PathEndMode.OnCell)); }
public void CheckForOwner() { CompEquippable tempcomp; Apparel tempthing; if (this.parent != null && !this.parent.Spawned && this.parent.holdingContainer == null) { // Log.Message("Begin Check"); if (this.parent is Apparel) { // Log.Message("Soul item is Apparel"); tempthing = this.parent as Apparel; this.Owner = tempthing.wearer; } else if ((tempcomp = this.parent.TryGetComp <CompEquippable>()) != null && tempcomp.PrimaryVerb.CasterPawn != null) { // Log.Message("IsGun"); this.Owner = tempcomp.PrimaryVerb.CasterPawn; } else if (this.parent.holdingContainer != null && this.parent.holdingContainer.owner is Pawn_CarryTracker) { Pawn_CarryTracker tracker = this.parent.holdingContainer.owner as Pawn_CarryTracker; this.Owner = tracker.pawn; } if ((this.Owner != null)) { if ((soul = this.Owner.needs.TryGetNeed <Need_Soul>()) != null) { this.CalculateSoulChanges(soul, SProps); } if (!PsykerPowerAdded) { CompPsyker compPsyker; if ((compPsyker = Owner.TryGetComp <CompPsyker>()) != null) { for (int i = 0; i < SProps.UnlockedPsykerPowers.Count; i++) { if (soul.PsykerPowerLevel >= SProps.UnlockedPsykerPowers[i].PowerLevel) { // Log.Message("Adding Power to: " + compPsyker.psyker + " : " + SProps.UnlockedPsykerPowers[i].defName); compPsyker.allpsykerPowers.Add(new PsykerPowerEntry(SProps.UnlockedPsykerPowers[i], true, this.parent.def)); } } compPsyker.UpdatePowers(); } PsykerPowerAdded = true; } } } if (this.parent.Spawned) { PsykerPowerAdded = false; } }
protected override ThoughtState CurrentSocialStateInternal(Pawn p, Pawn otherPawn) { bool flag = true; Need_Soul s1 = p.needs.TryGetNeed <Need_Soul>(); Need_Soul s2 = otherPawn.needs.TryGetNeed <Need_Soul>(); if (s2.NoPatron == false) { flag = false; } if (flag) { if (s1.DevotionTrait.SDegree == -2) { if (p.IsPrisonerOfColony) { return(ThoughtState.ActiveAtStage(4)); } return(ThoughtState.ActiveAtStage(3)); } else if (s1.DevotionTrait.SDegree == -1) { if (movingSermon(otherPawn)) { return(ThoughtState.ActiveAtStage(2)); } return(ThoughtState.ActiveAtStage(0)); } else { if (movingSermon(otherPawn)) { return(ThoughtState.ActiveAtStage(2)); } return(ThoughtState.ActiveAtStage(1)); } } else { if (p.IsPrisonerOfColony) { return(ThoughtState.ActiveAtStage(8)); } if (s1.DevotionTrait.SDegree > 0) { return(ThoughtState.ActiveAtStage(7)); } return(ThoughtState.ActiveAtStage(6)); } }
public override float VoluntaryJoinPriorityFor(Pawn p) { if (assignedPreachers.Contains(p)) { return(0f); } if (!this.IsInvited(p, spot)) { return(0f); } if (!PartyUtility.ShouldPawnKeepPartying(p)) { return(0f); } if (!this.lord.ownedPawns.Contains(p) && this.IsPartyAboutToEnd()) { return(0f); } Need_Soul soul = p.needs.TryGetNeed <Need_Soul>(); if (soul != null) { switch (soul.DevotionTrait.SDegree) { case -2: { return(0f); } case -1: { return(5f); } case 0: { return(20f); } case 1: { return(25f); } case 2: { return(30f); } } } return(20f); }
public void UpdatePsykerUnlocks(Need_Soul soul) { List <PsykerPowerDef> list = SProps.UnlockedPsykerPowers; for (int i = 0; i < list.Count; i++) { if (list[i].PowerLevel <= soul.PsykerPowerLevel) { this.parent.TryGetComp <CompPsyker>().PowerManager.AddPsykerPower(list[i]); } } }
public override void CompTick() { base.CompTick(); if (this.parent.GetComp <CompEquippable>().PrimaryVerb.CasterPawn == null && LastGainTick > Find.TickManager.TicksGame) { Pawn p = this.parent.GetComp <CompEquippable>().PrimaryVerb.CasterPawn; ChaosFollowerPawnKindDef pdef = p.kindDef as ChaosFollowerPawnKindDef; Need_Soul n_soul = p.needs.TryGetNeed <Need_Soul>(); var resistence = pdef.AfflictionProperty.ResolveFactor; n_soul.GainNeed(amount(cprops.Category, resistence)); LastGainTick = Find.TickManager.TicksGame + 120; } }
public void CheckForOwner() { CompEquippable tempcomp; Apparel tempthing; if (this.parent != null && !this.parent.Spawned) { // Log.Message("Begin Check"); if (this.parent is Apparel) { // Log.Message("Soul item is Apparel"); tempthing = this.parent as Apparel; this.Owner = tempthing.wearer; } else if ((tempcomp = this.parent.TryGetComp <CompEquippable>()) != null && tempcomp.PrimaryVerb.CasterPawn != null) { // Log.Message("IsGun"); this.Owner = tempcomp.PrimaryVerb.CasterPawn; } if ((this.Owner != null)) { if ((soul = this.Owner.needs.TryGetNeed <Need_Soul>()) != null) { this.CalculateSoulChanges(soul); } if (!PsykerPowerAdded) { CompPsyker compPsyker; if ((compPsyker = Owner.TryGetComp <CompPsyker>()) != null) { for (int i = 0; i < SProps.UnlockedPsykerPowers.Count; i++) { if (soul.PsykerPowerLevel <= SProps.UnlockedPsykerPowers[i].PowerLevel) { compPsyker.temporaryWeaponPowers.Add(new PsykerPower(Owner, SProps.UnlockedPsykerPowers[i])); } } compPsyker.UpdatePowers(); this.LastOwner = compPsyker; } PsykerPowerAdded = true; } } } if (this.parent.Spawned && this.LastOwner != null) { LastOwner.temporaryWeaponPowers.Clear(); LastOwner.UpdatePowers(); PsykerPowerAdded = false; } }
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 static void GenerateInitialHediffsPostFix(Pawn pawn, PawnGenerationRequest request) { if (pawn.needs != null) { Need_Soul soul = pawn.needs.TryGetNeed <Need_Soul>(); if (soul != null) { ChaosFollowerPawnKindDef pdef = pawn.kindDef as ChaosFollowerPawnKindDef; if (pdef != null) { soul.GenerateHediffsAndImplants(pdef); } } } }
protected override ThoughtState CurrentSocialStateInternal(Pawn p, Pawn otherPawn) { Need_Soul s1 = p.needs.TryGetNeed <Need_Soul>(); Need_Soul s2 = otherPawn.needs.TryGetNeed <Need_Soul>(); if (s1 != null && s2 != null) { if (s1.Patron == s2.Patron && s1.CurLevel > 0.3f && s2.CurLevel > 0.3f && s1.NoPatron && s2.NoPatron) { if ((s1.CurLevel - s2.CurLevel) > 0.3f) { return(ThoughtState.ActiveAtStage(0)); } if (s1.DevotionTrait.SDegree > 0 && s2.DevotionTrait.SDegree < 0) { return(ThoughtState.ActiveAtStage(1)); } if (s1.DevotionTrait.SDegree < 0 && s2.DevotionTrait.SDegree > 0) { return(ThoughtState.ActiveAtStage(3)); } if (s1.DevotionTrait.SDegree < 0 && s2.DevotionTrait.SDegree < 0) { return(ThoughtState.ActiveAtStage(4)); } return(ThoughtState.ActiveAtStage(0)); } if (s1.NoPatron && s2.NoPatron && s1.DevotionTrait.SDegree > 0) { return(ThoughtState.ActiveAtStage(5)); } if (s1.NoPatron && !s2.NoPatron) { return(ThoughtState.ActiveAtStage(6)); } if (!s1.NoPatron && s2.NoPatron) { return(ThoughtState.ActiveAtStage(7)); } if (!s1.NoPatron && !s2.NoPatron) { return(ThoughtState.ActiveAtStage(8)); } return(ThoughtState.Inactive); } return(ThoughtState.Inactive); }
public static bool TryGetChaosOverlayGraphics(Pawn pawn, out Graphic headgraphic, out Graphic bodygraphic) { if (pawn.needs != null && pawn.story != null && !pawn.kindDef.factionLeader && pawn.Drawer.renderer.graphics.AllResolved) { Need_Soul soul = pawn.needs.TryGetNeed <Need_Soul>(); if (soul != null && !soul.NoPatron && soul.patronInfo.PatronName != "Slaanesh") { headgraphic = AfflictionDrawerUtility.GetHeadGraphic(pawn, soul.patronInfo.PatronName); bodygraphic = AfflictionDrawerUtility.GetBodyOverlay(pawn.story.bodyType, soul.patronInfo.PatronName); return(true); } } headgraphic = null; bodygraphic = null; return(false); }
public static MentalStateDef SlaaneshEffects(Pawn pawn, Need_Soul soul) { int num = Rand.RangeInclusive(1, 9); if (num > 7) { return(C_MentalStateDefOf.LustViolent); } if (num > 5) { return(MentalStateDefOf.BingingDrugExtreme); } if (num > 3) { return(MentalStateDefOf.BingingDrugMajor); } return(C_MentalStateDefOf.BingingFood); }
private IEnumerable <Pawn> PotentialVictims(Map map) { return(map.mapPawns.FreeColonistsAndPrisoners.Where(delegate(Pawn p) { if (p.holdingContainer != null && p.holdingContainer.owner is Building_CryptosleepCasket) { return false; } Need_Soul soul = p.needs.TryGetNeed <Need_Soul>(); if (soul != null) { if (soul.CurLevel < 0.9f) { return true; } } return false; })); }
public static void DrawChaosOverlays(Pawn pawn) { if (pawn.needs != null && pawn.story != null && !pawn.kindDef.factionLeader && pawn.Drawer.renderer.graphics.AllResolved) { Need_Soul soul = pawn.needs.TryGetNeed <Need_Soul>(); if (soul != null && !soul.NoPatron && soul.patronInfo.PatronName != "Slaanesh") { ApparelGraphicRecord bodyOverlay; ApparelGraphicRecord headOverlay; ApparelGraphicRecord hairExtension; Corruption.AfflictionDrawerUtility.TryGetAfflictionDrawer(pawn, soul, soul.patronInfo.PatronName, pawn.story.BodyType, out bodyOverlay, out headOverlay, out hairExtension); pawn.Drawer.renderer.graphics.apparelGraphics.Insert(0, bodyOverlay); pawn.Drawer.renderer.graphics.apparelGraphics.Insert(1, headOverlay); if (pawn.Drawer.renderer.graphics.apparelGraphics.FindAll(x => x.sourceApparel.def.apparel.LastLayer == ApparelLayer.Overhead).Count == 1) { pawn.Drawer.renderer.graphics.apparelGraphics.Insert(2, hairExtension); } } } }
private static bool HasSoulTraitNullyfyingTraits(ThoughtDef def, Pawn p, out Need_Soul soul) { if (p.needs.TryGetNeed <Need_Soul>() == null) { HarmonyPatches.CreateNewSoul(p); } soul = p.needs.TryGetNeed <Need_Soul>(); List <SoulTrait> straitlist = soul.SoulTraits; foreach (SoulTrait strait in straitlist) { foreach (ThoughtDef tdef in strait.SDef.NullifiesThoughts) { if (tdef.defName == def.defName) { return(true); } } } return(false); }
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 void CalculateSoulChanges(Need_Soul nsoul) { float num; switch (SProps.Category) { case (SoulItemCategories.Neutral): { // Log.Message("NeutralItem"); sign = 0; break; } case (SoulItemCategories.Corruption): { // Log.Message("Corrupted Item"); sign = -1; break; } case (SoulItemCategories.Redemption): { // Log.Message("Redemptive Item"); sign = 0.5f; break; } default: { Log.Error("No Soul Item Category Found"); break; } } num = sign * this.SProps.GainRate * 0.2f / 14000; // Log.Message(num.ToString()); nsoul.GainNeed(num); }
public static bool TryGetAfflictionDrawer(Pawn pawn, Need_Soul soul, string patronName, BodyType bodyType, out ApparelGraphicRecord recBody, out ApparelGraphicRecord recHead, out ApparelGraphicRecord recHair) { if (bodyType == BodyType.Undefined) { Log.Error("Getting overlay graphic with undefined body type."); bodyType = BodyType.Male; } soul = pawn.needs.TryGetNeed <Need_Soul>(); Graphic headgraphic = AfflictionDrawerUtility.GetHeadGraphic(pawn, patronName); Graphic bodygraphic = AfflictionDrawerUtility.GetBodyOverlay(pawn.story.BodyType, patronName); string hairpath = pawn.Drawer.renderer.graphics.hairGraphic.path; Graphic oldhairgraphic = GraphicDatabase.Get <Graphic_Multi>(hairpath, ShaderDatabase.Cutout, Vector2.one, pawn.story.hairColor); Apparel temp1 = new Apparel(); Apparel temp2 = new Apparel(); Apparel temp3 = new Apparel(); temp1.def = CorruptionDefOfs.Overlay_Head; temp2.def = CorruptionDefOfs.Overlay_Hair; temp3.def = AfflictionDrawerUtility.GetOverlayDef(patronName); recHead = new ApparelGraphicRecord(headgraphic, temp1); recHair = new ApparelGraphicRecord(oldhairgraphic, temp2); recBody = new ApparelGraphicRecord(bodygraphic, temp3); return(true); }
protected override ThoughtState CurrentStateInternal(Pawn p) { Need_Soul soul = p.needs.TryGetNeed <Need_Soul>(); if (soul == null) { soul = new Need_Soul(p); } float factor = 1f; soul.GainNeed(factor * 0.00001f); PsychicDroneLevel psychicDroneLevel = PsychicDroneLevel.None; MapCondition_PsychicEmanation activeCondition = p.Map.mapConditionManager.GetActiveCondition <MapCondition_PsychicEmanation>(); if (activeCondition != null && activeCondition.def.droneLevel > psychicDroneLevel) { psychicDroneLevel = activeCondition.def.droneLevel; } else { return(ThoughtState.Inactive); } switch (psychicDroneLevel) { case PsychicDroneLevel.None: factor = 0f; return(false); case PsychicDroneLevel.BadLow: factor = 1f; break; case PsychicDroneLevel.BadMedium: factor = 1.3f; break; case PsychicDroneLevel.BadHigh: factor = 1.5f; break; case PsychicDroneLevel.BadExtreme: factor = 2f; break; default: return(ThoughtState.Inactive); } if (soul.NoPatron) { return(ThoughtState.ActiveAtStage(0)); } else if (soul.PsykerPowerLevel == PsykerPowerLevel.Omega) { return(ThoughtState.Inactive); } return(ThoughtState.ActiveAtStage(1)); }
public static bool ShouldAttendSermon(Pawn p, Pawn preacher) { if (!p.HostileTo(Faction.OfPlayer) && p != preacher) { if (!p.Drafted) { int num = 0; Need_Soul soul = p.needs.TryGetNeed <Need_Soul>(); switch (soul.DevotionTrait.SDegree) { case -2: { num = 0; break; } case -1: { num = 5; break; } case 0: { num = 10; break; } case 1: { num = 15; break; } case 2: { num = 20; break; } } if (p.CurJob.playerForced) { num = 0; if (soul.DevotionTrait.SDegree == 2) { num = 10; } } if (p.CurJob.def == C_JobDefOf.AttendSermon) { num = 0; } if (!SermonUtility.IsBestPreacher(p, preacher)) { num = 0; } if ((Rand.RangeInclusive(0, 15) + num) >= 20) { return(true); } } } return(false); }
public static ThoughtDef GetSermonThoughts(Pawn preacher, Pawn listener) { Need_Soul s1 = preacher.needs.TryGetNeed <Need_Soul>(); Need_Soul s2 = listener.needs.TryGetNeed <Need_Soul>(); bool flag1 = s1.NoPatron; bool flag2 = s2.NoPatron; if (flag1) { if (flag2) { if (s2.DevotionTrait.SDegree == -2) { if (listener.IsPrisonerOfColony) { return(SermonThoughtDefOf.AttendedSermonPureAtheistForced); } return(SermonThoughtDefOf.AttendedSermonPureAtheist); } else if (s1.DevotionTrait.SDegree == -1) { if (SermonUtility.movingSermon(preacher)) { return(SermonThoughtDefOf.AttendedSermonPureMoving); } return(SermonThoughtDefOf.AttendedSermonPureAgnostic); } else { if (movingSermon(preacher)) { return(SermonThoughtDefOf.AttendedSermonPureMoving); } return(SermonThoughtDefOf.AttendedSermonPureNice); } } else { if (listener.IsPrisonerOfColony) { return(SermonThoughtDefOf.AttendedSermonDarkPureForced); } s2.OpposingDevotees.Add(preacher); return(SermonThoughtDefOf.AttendedSermonDarkPure); } } else { if (flag2) { if (listener.IsPrisonerOfColony) { return(SermonThoughtDefOf.AttendedSermonPureHereticalForced); } if (movingSermon(preacher)) { s2.OpposingDevotees.Add(preacher); return(SermonThoughtDefOf.AttendedSermonPureHeretical); } s2.OpposingDevotees.Add(preacher); return(SermonThoughtDefOf.AttendedSermonPureUnholy); } else { if (movingSermon(preacher)) { return(SermonThoughtDefOf.AttendedSermonDarkGlorious); } return(SermonThoughtDefOf.AttendedSermonDarkGood); } } }