// Token: 0x06002ADC RID: 10972 RVA: 0x001433C0 File Offset: 0x001417C0 public override void DoEffect(Pawn user) { bool selected = Find.Selector.SelectedObjects.Contains(user); // base.DoEffect(user); Hediff hediff; Comp_Yautja _Yautja = user.TryGetComp <Comp_Yautja>(); Hediff blooded = user.health.hediffSet.GetFirstHediffOfDef(YautjaDefOf.RRY_Hediff_BloodedUM); BodyPartRecord part = user.health.hediffSet.GetFirstHediffOfDef(YautjaDefOf.RRY_Hediff_BloodedUM).Part; HediffDef marked = _Yautja.MarkedhediffDef; if (YautjaBloodedUtility.Marked(user, out hediff)) { user.health.RemoveHediff(hediff); } user.health.RemoveHediff(blooded); user.health.AddHediff(marked, part); ThingDef thingDef = null; foreach (var item in corpse.InnerPawn.health.hediffSet.GetNotMissingParts()) { if (Rand.Chance(corpse.InnerPawn.health.hediffSet.GetPartHealth(item) / 3) && item.def == XenomorphDefOf.RRY_Xeno_TailSpike && !corpse.InnerPawn.health.hediffSet.PartIsMissing(item)) { partRecord = item; thingDef = XenomorphDefOf.RRY_Xenomorph_TailSpike; corpse.InnerPawn.health.AddHediff(HediffMaker.MakeHediff(HediffDefOf.MissingBodyPart, corpse.InnerPawn, this.partRecord)); GenSpawn.Spawn(ThingMaker.MakeThing(thingDef), user.Position, user.Map); } if (Rand.Chance(corpse.InnerPawn.health.hediffSet.GetPartHealth(item) / 3) && item.def == XenomorphDefOf.RRY_Xeno_Shell && !corpse.InnerPawn.health.hediffSet.PartIsMissing(item)) { partRecord = item; thingDef = XenomorphDefOf.RRY_Xenomorph_HeadShell; corpse.InnerPawn.health.AddHediff(HediffMaker.MakeHediff(HediffDefOf.MissingBodyPart, corpse.InnerPawn, this.partRecord)); GenSpawn.Spawn(ThingMaker.MakeThing(thingDef), user.Position, user.Map); } } if (user.story.adulthood.identifier == null || user.story.adulthood.identifier == "Yautja_YoungBlood") { AlienRace.BackstoryDef backstoryDef = DefDatabase <AlienRace.BackstoryDef> .GetNamed("Yautja_Blooded"); #if DEBUG if (selected) { Log.Message(string.Format("changing {0}", user.story.adulthood.identifier)); } #endif user.story.adulthood = backstoryDef.backstory; #if DEBUG if (selected) { Log.Message(string.Format("to {0}", user.story.adulthood.identifier)); } #endif } }
public override void DoEffect(Pawn user) { // base.DoEffect(user); if (user.Markable(out Comp_Markable Markable)) { BodyPartRecord part = Markable.partRecord; if (user.Marked(out Hediff marked, out Hediff blooded)) { // Log.Message(string.Format("Removing hediff {0}", marked)); user.health.RemoveHediff(marked); } if (blooded != null) { user.health.RemoveHediff(blooded); // Log.Message(string.Format("Removing hediff {0}", marked)); } corpse = (Corpse)this.parent; marked = HediffMaker.MakeHediff(Markable.markDataKillNew.MarkDef, user, part);// user.health.hediffSet.GetFirstHediffOfDef(markedDef); HediffComp_HunterMark marked_Yautja = marked.TryGetComp <HediffComp_HunterMark>(); Markable.Mark = corpse.InnerPawn; user.health.AddHediff(marked, part); ThingDef thingDef = null; foreach (var item in corpse.InnerPawn.health.hediffSet.GetNotMissingParts()) { TrophyPartDefExtension trophyDef = null; if (item.def.HasModExtension <TrophyPartDefExtension>()) { trophyDef = item.def.GetModExtension <TrophyPartDefExtension>(); } if (trophyDef != null) { float basechance = trophyDef.TrophyChance; ThingDef trophy = trophyDef.TrophyDef ?? item.def.spawnThingOnRemoved; if (trophyDef.PartHealthModifier) { basechance = basechance * corpse.InnerPawn.health.hediffSet.GetPartHealth(item); } if (trophy != null) { if (Rand.Chance(basechance)) { partRecord = item; thingDef = trophy; corpse.InnerPawn.health.AddHediff(HediffMaker.MakeHediff(HediffDefOf.MissingBodyPart, corpse.InnerPawn, this.partRecord)); GenSpawn.Spawn(ThingMaker.MakeThing(thingDef), user.Position, user.Map); } } } } if (user.story.adulthood.identifier == null || user.story.adulthood.identifier == "RRY_Yautja_YoungBlood") { if (marked.def == HMSDefOf.HMS_Hediff_BloodedMXenomorph) { AlienRace.BackstoryDef backstoryDef = DefDatabase <AlienRace.BackstoryDef> .GetNamed("RRY_Yautja_Blooded"); user.story.adulthood = backstoryDef.backstory; } } Markable.markDataKill = Markable.markDataKillNew; if (this.parent.IsForbidden(user)) { this.parent.SetForbidden(false); } if (user.Markable(out Comp_Markable markable)) { markable.markcorpse = null; markable.Mark = null; } } }
public override void DoEffect(Pawn user) { bool selected = Find.Selector.SelectedObjects.Contains(user); // base.DoEffect(user); Comp_Yautja _Yautja = user.TryGetComp <Comp_Yautja>(); Hediff blooded = user.health.hediffSet.GetFirstHediffOfDef(YautjaDefOf.RRY_Hediff_BloodedUM); BodyPartRecord part = user.health.hediffSet.GetFirstHediffOfDef(YautjaDefOf.RRY_Hediff_BloodedUM).Part; HediffDef markedDef = _Yautja.MarkedhediffDef; if (YautjaBloodedUtility.Marked(user, out Hediff hediff)) { user.health.RemoveHediff(hediff); } user.health.RemoveHediff(blooded); Hediff marked = HediffMaker.MakeHediff(markedDef, user, part);// user.health.hediffSet.GetFirstHediffOfDef(markedDef); HediffComp_MarkedYautja marked_Yautja = marked.TryGetComp <HediffComp_MarkedYautja>(); corpse = (Corpse)this.parent; marked_Yautja.BodySize = corpse.InnerPawn.BodySize; marked_Yautja.combatPower = corpse.InnerPawn.kindDef.combatPower; marked_Yautja.corpse = corpse; marked_Yautja.MarkHedifflabel = corpse.InnerPawn.KindLabel; marked_Yautja.pawn = corpse.InnerPawn; marked_Yautja.pawnKindDef = corpse.InnerPawn.kindDef; marked_Yautja.predator = corpse.InnerPawn.kindDef.RaceProps.predator; marked_Yautja.props = new HediffCompProperties_MarkedYautja { pawn = corpse.InnerPawn, corpse = corpse, MarkedhediffDef = markedDef, MarkHedifflabel = corpse.InnerPawn.KindLabel, predator = corpse.InnerPawn.kindDef.RaceProps.predator, BodySize = corpse.InnerPawn.BodySize, combatPower = corpse.InnerPawn.kindDef.combatPower }; Log.Message(string.Format(" 11 ")); user.health.AddHediff(markedDef, part); Log.Message(string.Format(" 12 ")); ThingDef thingDef = null; Log.Message(string.Format(" 13 ")); foreach (var item in corpse.InnerPawn.health.hediffSet.GetNotMissingParts()) { if (Rand.Chance(corpse.InnerPawn.health.hediffSet.GetPartHealth(item) / 3) && item.def == XenomorphDefOf.RRY_Xeno_TailSpike && !corpse.InnerPawn.health.hediffSet.PartIsMissing(item)) { partRecord = item; thingDef = XenomorphDefOf.RRY_Xenomorph_TailSpike; corpse.InnerPawn.health.AddHediff(HediffMaker.MakeHediff(HediffDefOf.MissingBodyPart, corpse.InnerPawn, this.partRecord)); GenSpawn.Spawn(ThingMaker.MakeThing(thingDef), user.Position, user.Map); } if (Rand.Chance(corpse.InnerPawn.health.hediffSet.GetPartHealth(item) / 3) && item.def == XenomorphDefOf.RRY_Xeno_Shell && !corpse.InnerPawn.health.hediffSet.PartIsMissing(item)) { partRecord = item; thingDef = XenomorphDefOf.RRY_Xenomorph_HeadShell; corpse.InnerPawn.health.AddHediff(HediffMaker.MakeHediff(HediffDefOf.MissingBodyPart, corpse.InnerPawn, this.partRecord)); GenSpawn.Spawn(ThingMaker.MakeThing(thingDef), user.Position, user.Map); } } if (user.story.adulthood.identifier == null || user.story.adulthood.identifier == "RRY_Yautja_YoungBlood") { if (marked.def == YautjaDefOf.RRY_Hediff_BloodedMXenomorph) { AlienRace.BackstoryDef backstoryDef = DefDatabase <AlienRace.BackstoryDef> .GetNamed("RRY_Yautja_Blooded"); #if DEBUG // if (selected) Log.Message(string.Format("changing {0}", user.story.adulthood.identifier)); #endif user.story.adulthood = backstoryDef.backstory; #if DEBUG // if (selected) Log.Message(string.Format("to {0}", user.story.adulthood.identifier)); #endif } } }
public static void Postfix(PawnGenerationRequest request, ref Pawn __result) { Comp_Yautja _Yautja = __result.TryGetComp <Comp_Yautja>(); if (_Yautja != null) { Backstory pawnStoryC = __result.story.childhood; Backstory pawnStoryA = __result.story.adulthood ?? null; AlienRace.BackstoryDef bsDefUnblooded = DefDatabase <AlienRace.BackstoryDef> .GetNamed("RRY_Yautja_YoungBlood"); AlienRace.BackstoryDef bsDefBlooded = DefDatabase <AlienRace.BackstoryDef> .GetNamed("RRY_Yautja_Blooded"); AlienRace.BackstoryDef bsDefBadbloodA = DefDatabase <AlienRace.BackstoryDef> .GetNamed("RRY_Yautja_BadBloodA"); AlienRace.BackstoryDef bsDefBadblooBd = DefDatabase <AlienRace.BackstoryDef> .GetNamed("RRY_Yautja_BadBloodB"); HediffDef unbloodedDef = YautjaDefOf.HMS_Hediff_Unblooded; HediffDef unmarkedDef = YautjaDefOf.HMS_Hediff_BloodedUM; HediffDef markedDef = YautjaDefOf.HMS_Hediff_BloodedM; bool hasunblooded = __result.health.hediffSet.HasHediff(unbloodedDef); bool hasbloodedUM = __result.health.hediffSet.HasHediff(unmarkedDef); bool hasbloodedM = __result.health.hediffSet.hediffs.Any <Hediff>(x => x.def.defName.StartsWith(markedDef.defName)); if (!hasunblooded && !hasbloodedUM && !hasbloodedM) { HediffDef hediffDef; if (pawnStoryA != null) { if (pawnStoryA != bsDefUnblooded.backstory && __result.kindDef.race == YautjaDefOf.RRY_Alien_Yautja) { hediffDef = _Yautja.Props.bloodedDefs.RandomElement(); if (hediffDef != null) { /* * PawnKindDef pawnKindDef = YautjaBloodedUtility.RandomMarked(hediffDef); * if (_Yautja != null) * { * _Yautja.MarkHedifflabel = pawnKindDef.LabelCap; * _Yautja.MarkedhediffDef = hediffDef; * _Yautja.predator = pawnKindDef.RaceProps.predator; * _Yautja.BodySize = pawnKindDef.RaceProps.baseBodySize; * _Yautja.combatPower = pawnKindDef.combatPower; * // Log.Message(string.Format("{0}: {1}", hediffDef.stages[0].label, pawnKindDef.LabelCap)); * } */ } } else { hediffDef = unbloodedDef; } } else { hediffDef = unbloodedDef; } foreach (var item in __result.RaceProps.body.AllParts) { if (item.def == BodyPartDefOf.Head) { __result.health.AddHediff(hediffDef, item); } } } else { // Log.Message(string.Format("new pawn has hasunblooded:{0}, hasbloodedUM:{1}, hasbloodedM:{2}", hasunblooded, hasbloodedUM, hasbloodedM)); } } if (__result.kindDef.race == YautjaDefOf.RRY_Alien_Yautja) { if (request.Faction.leader == null && request.Faction != Faction.OfPlayerSilentFail && request.KindDef.race == YautjaDefOf.RRY_Alien_Yautja) { Rand.PushState(); bool upgradeWeapon = Rand.Chance(0.5f); Rand.PopState(); if (__result.equipment.Primary != null && upgradeWeapon) { __result.equipment.Primary.TryGetQuality(out QualityCategory weaponQuality); if (weaponQuality != QualityCategory.Legendary) { Thing Weapon = __result.equipment.Primary; CompQuality Weapon_Quality = Weapon.TryGetComp <CompQuality>(); if (Weapon_Quality != null) { Weapon_Quality.SetQuality(QualityCategory.Legendary, ArtGenerationContext.Outsider); } } } else if (__result.apparel.WornApparelCount > 0 && !upgradeWeapon) { foreach (var item in __result.apparel.WornApparel) { item.TryGetQuality(out QualityCategory gearQuality); float upgradeChance = 0.5f; Rand.PushState(); bool upgradeGear = Rand.Chance(upgradeChance); Rand.PopState(); if (gearQuality != QualityCategory.Legendary) { CompQuality Gear_Quality = item.TryGetComp <CompQuality>(); if (Gear_Quality != null) { if (upgradeGear) { Gear_Quality.SetQuality(QualityCategory.Legendary, ArtGenerationContext.Outsider); break; } } } } } } } }