コード例 #1
0
        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);
            });
        }
コード例 #2
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);
        }
コード例 #3
0
        public override IEnumerable <BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipeDef)
        {
            var chest = Genital_Helper.get_breasts(pawn);

            if (Genital_Helper.breasts_blocked(pawn))
            {
                yield break;
            }

            if (BreastSize_Helper.TryGetBreastSize(pawn, out var size) &&
                size > BreastSize_Helper.GetSize(Genital_Helper.flat_breasts))
            {
                yield return(chest);
            }
        }
コード例 #4
0
        public override IEnumerable <BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipeDef)
        {
            var chest = Genital_Helper.get_breasts(pawn);

            if (pawn.health.hediffSet.PartIsMissing(chest) ||
                Genital_Helper.breasts_blocked(pawn))
            {
                yield break;
            }

            var old = recipeDef.removesHediff;

            if (old == null ? BreastSize_Helper.HasNipplesOnly(pawn, chest) : pawn.health.hediffSet.HasHediff(old, chest))
            {
                yield return(chest);
            }
        }
コード例 #5
0
        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);
            });
        }