Пример #1
0
        public static void UpdateBoobitis(Pawn pawn)
        {
            var hediff = std.get_infection(pawn, std.boobitis);

            if (hediff == null ||
                !(hediff.Severity >= 0.20f) ||
                hediff.FullyImmune() ||
                !BreastSize_Helper.TryGetBreastSize(pawn, out var oldSize, out var oldBoobs) ||
                oldSize >= BreastSize_Helper.MaxSize ||
                !RollFor(hediff.Severity > 0.90f ? 1f : 5f))
            {
                return;
            }
            var chest    = Genital_Helper.get_breasts(pawn);
            var newSize  = oldSize + 1;
            var newBoobs = BreastSize_Helper.GetHediffDef(newSize);

            GenderHelper.ChangeSex(pawn, () =>
            {
                if (oldBoobs != null)
                {
                    pawn.health.RemoveHediff(oldBoobs);
                }
                pawn.health.AddHediff(newBoobs, chest);
            });

            var message = "RJW_BreastsHaveGrownFromBoobitis".Translate(pawn);

            Messages.Message(message, pawn, MessageTypeDefOf.SilentInput);
        }
        public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List <Thing> ingredients, Bill bill)
        {
            if (billDoer != null)
            {
                if (CheckSurgeryFail(billDoer, pawn, ingredients, part, bill))
                {
                    return;
                }
                TaleRecorder.RecordTale(TaleDefOf.DidSurgery, new object[]
                {
                    billDoer,
                    pawn
                });
            }

            var oldBoobs = pawn.health.hediffSet.hediffs.FirstOrDefault(hediff => hediff.def == bill.recipe.removesHediff);
            var newBoobs = bill.recipe.addsHediff;
            var newSize  = BreastSize_Helper.GetSize(newBoobs);

            GenderHelper.ChangeSex(pawn, () =>
            {
                BreastSize_Helper.HurtBreasts(pawn, part, 3 * (newSize - 1));
                if (pawn.health.hediffSet.PartIsMissing(part))
                {
                    return;
                }
                if (oldBoobs != null)
                {
                    pawn.health.RemoveHediff(oldBoobs);
                }
                pawn.health.AddHediff(newBoobs, part);
            });
        }
Пример #3
0
        public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List <Thing> ingredients, Bill bill)
        {
            GenderHelper.Sex before = GenderHelper.GetSex(pawn);

            base.ApplyOnPawn(pawn, part, billDoer, ingredients, bill);

            GenderHelper.Sex after = GenderHelper.GetSex(pawn);

            GenderHelper.ChangeSex(pawn, before, after);
        }
        public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List <Thing> ingredients, Bill bill)
        {
            if (billDoer != null)
            {
                if (CheckSurgeryFail(billDoer, pawn, ingredients, part, bill))
                {
                    return;
                }
                TaleRecorder.RecordTale(TaleDefOf.DidSurgery, new object[]
                {
                    billDoer,
                    pawn
                });
            }

            if (!BreastSize_Helper.TryGetBreastSize(pawn, out var oldSize))
            {
                throw new ApplicationException("Recipe_ShrinkBreasts could not find any breasts to shrink.");
            }

            var oldBoobs = pawn.health.hediffSet.GetFirstHediffOfDef(BreastSize_Helper.GetHediffDef(oldSize));
            var newSize  = oldSize - 1;
            var newBoobs = BreastSize_Helper.GetHediffDef(newSize);

            // I can't figure out how to spawn a stack of 2 meat.
            for (var i = 0; i < 2; i++)
            {
                GenSpawn.Spawn(pawn.RaceProps.meatDef, billDoer.Position, billDoer.Map);
            }

            GenderHelper.ChangeSex(pawn, () =>
            {
                BreastSize_Helper.HurtBreasts(pawn, part, 5);
                if (pawn.health.hediffSet.PartIsMissing(part))
                {
                    return;
                }
                pawn.health.RemoveHediff(oldBoobs);
                pawn.health.AddHediff(newBoobs, part);
            });
        }