Пример #1
0
        // Token: 0x06000001 RID: 1 RVA: 0x00002050 File Offset: 0x00000250
        internal static void GenerateMincho(Pawn pawn, Hediff hediff)
        {
            PawnGenerationRequest pawnGenerationRequest = new PawnGenerationRequest(
                MinchoDefOf.Mincho_Colonist,
                Faction.OfPlayer,
                (PawnGenerationContext)2,
                -1,
                false,
                false,
                false,
                false,
                false,
                false,
                0f,
                false,
                false,
                false,
                false,
                false,
                false,
                false,
                false,
                0,
                null,
                0, null, null, null, null, null, pawn.ageTracker.AgeBiologicalYearsFloat, pawn.ageTracker.AgeChronologicalYearsFloat, null, 0, null, null, null);

            for (int i = 0; i < 9; i++)
            {
                IntVec3 intVec = pawn.Position + GenRadial.RadialPattern[i];
                bool    flag   = GenGrid.InBounds(intVec, pawn.Map) && GridsUtility.GetRoom(pawn.Position, pawn.Map, (RegionType)6) == GridsUtility.GetRoom(intVec, pawn.Map, (RegionType)6);
                if (flag)
                {
                    FilthMaker.TryMakeFilth(pawn.Position, pawn.Map, MinchoDefOf.Mincho_Filth_BloodDef, GenText.LabelIndefinite(pawn), Rand.RangeInclusive(0, 4));
                }
            }
            Pawn pawn2 = PawnGenerator.GeneratePawn(pawnGenerationRequest);

            pawn2.Name = pawn.Name;



            if (pawn.IsColonist == true | pawn.IsColonistPlayerControlled == true)
            {
                foreach (KeyValuePair <string, Backstory> asd1 in BackstoryDatabase.allBackstories)
                {
                    if (asd1.Value.untranslatedTitle == "The first Mincho")
                    {
                        pawn2.story.childhood = asd1.Value;
                        break;
                    }
                    if (asd1.Value.untranslatedTitleFemale == "The first Mincho")
                    {
                        pawn2.story.childhood = asd1.Value;
                        break;
                    }
                }

                foreach (Pawn asd1 in pawn.relations.RelatedPawns)
                {
                    foreach (DirectPawnRelation asd2 in asd1.relations.DirectRelations)
                    {
                        asd1.relations.RemoveDirectRelation(asd2);
                    }
                    foreach (DirectPawnRelation asd2 in pawn.relations.DirectRelations)
                    {
                        pawn2.relations.AddDirectRelation(asd2.def, asd1);
                    }
                }


                //pawn2.story.childhood = BackstoryDatabase.allBackstories.ToList<KeyValuePair<string, Backstory>>().Find((KeyValuePair<string, Backstory> x) => x.Value.untranslatedTitle == "The first Mincho").Value;
                pawn2.skills.skills = pawn.skills.skills;
                foreach (Trait asd1 in pawn.story.traits.allTraits)
                {
                    if (asd1.def.ToString() == "Nudist")
                    {
                        pawn.story.traits.allTraits.Remove(asd1);
                    }
                }
                pawn2.story.traits.allTraits = pawn.story.traits.allTraits;
            }
            else
            {
                foreach (KeyValuePair <string, Backstory> asd1 in BackstoryDatabase.allBackstories)
                {
                    if (asd1.Value.untranslatedTitle == "Mincho poultice")
                    {
                        pawn2.story.childhood = asd1.Value;
                        break;
                    }
                    if (asd1.Value.untranslatedTitleFemale == "Mincho poultice")
                    {
                        pawn2.story.childhood = asd1.Value;
                        break;
                    }
                }
                //pawn2.story.childhood = BackstoryDatabase.allBackstories.ToList<KeyValuePair<string, Backstory>>().Find((KeyValuePair<string, Backstory> x) => x.Value.untranslatedTitle == "Mincho poultice").Value;
                pawn2.skills.skills = pawn.skills.skills;
                foreach (Trait asd1 in pawn.story.traits.allTraits)
                {
                    if (asd1.def.ToString() == "Nudist")
                    {
                        pawn.story.traits.allTraits.Remove(asd1);
                    }
                    foreach (TraitDegreeData asd2 in asd1.def.degreeDatas)
                    {
                        if (asd2.untranslatedLabel == "Nudist")
                        {
                            pawn.story.traits.allTraits.Remove(asd1);
                        }
                    }
                }
                pawn2.story.traits.allTraits = pawn.story.traits.allTraits;
            }
            pawn2.story.adulthood = null;


            /*
             * if (pawn.Faction != null)
             * {
             *      pawn.Faction.TryAffectGoodwillWith(Faction.OfPlayer, -40, true, true, TranslatorFormattedStringExtensions.Translate("MinchoTransform", pawn.Name.ToStringShort), null);
             * }
             */

            //pawn.health.RemoveHediff(hediff);
            Map map = pawn.Map;

            pawn.Kill(null);

            CompRottable comp = pawn.Corpse.GetComp <CompRottable>();

            if (comp != null)
            {
                comp.RotProgress = (float)(comp.TicksUntilRotAtCurrentTemp * 2);
            }


            //Messages.Message(TranslatorFormattedStringExtensions.Translate("MinchoTransform", pawn.Name.ToStringShort), MessageTypeDefOf.NegativeHealthEvent, true);
            pawn2.apparel.DestroyAll(0);
            GenSpawn.Spawn(pawn2, pawn.Position, map, 0);
            //SoundStarter.PlayOneShot(MinchoDefOf.Pawn_Mincho_Death, SoundInfo.InMap(pawn, 0));
            MinchoGenerator.MakeWildMan(pawn2, pawn);
            Find.TickManager.Pause();
        }
Пример #2
0
 private static void CreateMinchoFilth(Pawn pawn)
 {
     for (int i = 0; i < 9; i++)
     {
         IntVec3 Pos = pawn.Position + GenRadial.RadialPattern[i];
         bool    canPlaceFilthToPos = GenGrid.InBounds(Pos, pawn.Map) && GridsUtility.GetRoom(pawn.Position, pawn.Map, (RegionType)6) == GridsUtility.GetRoom(Pos, pawn.Map, (RegionType)6);
         if (canPlaceFilthToPos)
         {
             FilthMaker.TryMakeFilth(pawn.Position, pawn.Map, MinchoWitchDefOf.Mincho_Filth_BloodDef, GenText.LabelIndefinite(pawn), Rand.RangeInclusive(0, 4));
         }
     }
 }