public void HandlePoopOverflow(Underwear underwear) { Animations.Write(RegressionMod.data.Poop_Overflow, this); float overflow = underwear.Messiness / underwear.containment; //100% -> -3, 50% -> -2, 0% -> -1 int speed = overflow >= 0.5 ? (overflow > 1.0 ? -3 : -2) : -1; Buff buff = new Buff(0, 0, 0, 0, 0, 0, 0, 0, 0, speed, 0, 0, 15, "", "") { description = string.Format("{0} {1} Speed.", (object)Strings.RandString(RegressionMod.data.Debuff_Messy_Pants), (object)speed), millisecondsDuration = 1080000, // 18 minutes glow = Color.Brown, sheetIndex = -1, which = 222 }; //If player already has wet overflow debuff remove and re-apply it if (Game1.buffsDisplay.hasBuff(buff.which)) { RemoveBuff(buff.which); } Game1.buffsDisplay.addOtherBuff(buff); }
public static void DrawUnderwearIcon(Underwear underwear, int x, int y) { if (underwear.CleanStatus == 1) { Game1.spriteBatch.Draw(Animations.sprites, new Microsoft.Xna.Framework.Rectangle(x, y, 64, 64), new Microsoft.Xna.Framework.Rectangle?(Animations.UnderwearRectangle(underwear, "drying", 16)), Microsoft.Xna.Framework.Color.White); } else { Game1.spriteBatch.Draw(Animations.sprites, new Microsoft.Xna.Framework.Rectangle(x, y, 64, 64), new Microsoft.Xna.Framework.Rectangle?(Animations.UnderwearRectangle(underwear, "clean", 16)), Microsoft.Xna.Framework.Color.White); int height1 = Math.Min((int)((double)underwear.Wetness / (double)underwear.absorbency * 16.0), 16); int height2 = Math.Min((int)((double)underwear.Messiness / (double)underwear.containment * 16.0), 16); if (height1 > 0 && height1 >= height2) { Game1.spriteBatch.Draw(Animations.sprites, new Microsoft.Xna.Framework.Rectangle(x, y + (64 - height1 * 4), 64, height1 * 4), new Microsoft.Xna.Framework.Rectangle?(Animations.UnderwearRectangle(underwear, "wet", height1)), Microsoft.Xna.Framework.Color.White); } if (height2 > 0) { Game1.spriteBatch.Draw(Animations.sprites, new Microsoft.Xna.Framework.Rectangle(x, y + (64 - height2 * 4), 64, height2 * 4), new Microsoft.Xna.Framework.Rectangle?(Animations.UnderwearRectangle(underwear, "messy", height2)), Microsoft.Xna.Framework.Color.White); } if (height1 > 0 && height1 < height2) { Game1.spriteBatch.Draw(Animations.sprites, new Microsoft.Xna.Framework.Rectangle(x, y + (64 - height1 * 4), 64, height1 * 4), new Microsoft.Xna.Framework.Rectangle?(Animations.UnderwearRectangle(underwear, "wet", height1)), Microsoft.Xna.Framework.Color.White); } if (Game1.getMouseX() >= x && Game1.getMouseX() <= x + 64 && Game1.getMouseY() >= y && Game1.getMouseY() <= y + 64) { string source = Strings.DescribeUnderwear(underwear, (string)null); string text = source.First <char>().ToString().ToUpper() + source.Substring(1); int width = Game1.tileSize * 6 + Game1.tileSize / 6; IClickableMenu.drawHoverText(Game1.spriteBatch, Game1.parseText(text, Game1.tinyFont, width), Game1.smallFont, 0, 0, -1, (string)null, -1, (string[])null, (Item)null, 0, -1, -1, -1, -1, 1f, (CraftingRecipe)null); } } }
//Gives debuff based on overflow amount public void HandlePeeOverflow(Underwear bottoms) { Animations.Write(RegressionMod.data.Pee_Overflow, this); //Scale the defense debuff based on amount of overflow (1->10) float overflow = (bottoms.Wetness / bottoms.absorbency) * 10f; int defense = -Math.Max( Math.Min((int)overflow, 10) //Percentage of overflow times 10 (wetness at double absorbancy is 10) , 1); Buff buff = new Buff(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, defense, 0, 15, "", "") { description = string.Format("{0} {1} Defense.", (object)Strings.RandString(RegressionMod.data.Debuff_Wet_Pants), (object)defense), millisecondsDuration = 1080000, // 18 minutes glow = bottoms.Messiness > 0.0 ? Color.Brown : Color.Yellow, sheetIndex = -1, which = 111 }; //If player already has wet overflow debuff remove and re-apply it if (Game1.buffsDisplay.hasBuff(buff.which)) { RemoveBuff(buff.which); } Game1.buffsDisplay.addOtherBuff(buff); }
//Called in the morning to make up for time passed over night public void HandleNight() { lastStamina = Game1.player.stamina; bottoms = new Underwear((int)UnderwearType.Bed); sleeping = true; if (bedtime <= 0) { return; } //Gets time slept in hours, at least 4 //time of day is in the morning ~600, bedtime is up to 2600 (2am) HandleTime((float)Math.Max(4, (Game1.timeOfDay + 2400 - bedtime) / 100)); }
//Switches to new underwear and returns old underwear public Underwear ChangeUnderwear(Underwear underwear) { Underwear oldUnderwear = this.underwear; this.underwear = underwear; //TODO: Make this take from clothes bottoms = new Underwear((int)UnderwearType.Pants); CleanPants(); //RegressionMod.monitor.Log(underwear.name, StardewModdingAPI.LogLevel.Debug); Animations.Say(RegressionMod.data.Change, this); return(oldUnderwear); }
public static Microsoft.Xna.Framework.Rectangle UnderwearRectangle(Underwear underwear, string type = null, int height = 16) { if (underwear.spriteIndex == -1) { throw new Exception("Invalid sprite index."); } int row = 0; switch (type) { case "clean": row = 0; break; case "wet": row = 16; break; case "messy": row = 32; break; case "drying": row = 48; break; default: switch (underwear.CleanStatus) { case 1: row = 48; break; case 2: if (underwear.Messiness > 0f) { row = 32; } else { row = 16; } break; } break; } return(new Microsoft.Xna.Framework.Rectangle(underwear.spriteIndex * 16, row + (16 - height), 16, height)); }
public void HandleMorning() { //Refresh food and water in easymode if (RegressionMod.config.Easymode) { food = maxFood; water = maxWater; } //If no wetting or messing don't wet pants at night if (!RegressionMod.config.Wetting && !RegressionMod.config.Messing) { peedToiletLastNight = 0; poopedToiletLastNight = 0; sleeping = false; bottoms = new Underwear((int)UnderwearType.Pants); } else { if (!RegressionMod.config.Easymode) { //Lower stamina regen if pants are soiled if (bottoms.Messiness > 0.0 || bottoms.Wetness > Body.glassOfWater) { beddingDryTime = Game1.timeOfDay + 1500; Game1.player.Stamina -= 100f; } else if (bottoms.Wetness > 0.0) { beddingDryTime = Game1.timeOfDay + 900; Game1.player.Stamina -= 50f; } else { beddingDryTime = 0; } } Animations.AnimateMorning(this); peedToiletLastNight = 0; poopedToiletLastNight = 0; sleeping = false; bottoms = new Underwear((int)UnderwearType.Pants); } }
public static string InsertVariables(string msg, Body body, Underwear underwear = null) { string str = msg; if (body != null) { underwear = body.underwear; } //RegressionMod.monitor.Log(underwear.name, StardewModdingAPI.LogLevel.Debug); if (underwear != null)//TODO: fix plural check { str = Strings.ReplaceOr(str.Replace("$UNDERWEAR_NAME$", underwear.name.ToLower()).Replace("$UNDERWEAR_PREFIX$", underwear.prefix.ToLower()).Replace("$UNDERWEAR_DESC$", underwear.description).Replace("$INSPECT_UNDERWEAR_NAME$", Strings.DescribeUnderwear(underwear, underwear.name.ToLower())).Replace("$INSPECT_UNDERWEAR_DESC$", Strings.DescribeUnderwear(underwear, underwear.description)), false /*!underwear.plural,*/, "#"); } if (body != null) { str = str.Replace("$PANTS_NAME$", body.bottoms.name.ToLower()).Replace("$PANTS_PREFIX$", body.bottoms.prefix.ToLower()).Replace("$PANTS_DESC$", body.bottoms.description).Replace("$BEDDING_DRYTIME$", Game1.getTimeOfDayString(body.beddingDryTime)); } return(Strings.ReplaceOr(str, (bool)Game1.player.isMale, "/").Replace("$FARMERNAME$", (string)Game1.player.name)); }
public static string DescribeUnderwear(Underwear underwear, string baseDescription = null) { string newDescription = baseDescription ?? underwear.description; //use u.description if baseDescription is null float wetPercent = underwear.Wetness / underwear.absorbency; float messyPercent = underwear.Messiness / underwear.containment; if ((double)wetPercent == 0.0 && (double)messyPercent == 0.0) { newDescription = underwear.CleanStatus == 0 ? RegressionMod.data.Underwear_Clean.Replace("$UNDERWEAR_DESC$", newDescription) : RegressionMod.data.Underwear_Drying.Replace("$UNDERWEAR_DESC$", newDescription); } else { if ((double)messyPercent > 0.0) { for (int index = 0; index < RegressionMod.data.Underwear_Messy.Length; ++index) { float num3 = (float)(((double)index + 1.0) / ((double)RegressionMod.data.Underwear_Messy.Length - 1.0)); if (index == RegressionMod.data.Underwear_Messy.Length - 1 || (double)messyPercent <= (double)num3) { newDescription = Strings.ReplaceOptional(RegressionMod.data.Underwear_Messy[index].Replace("$UNDERWEAR_DESC$", newDescription), (double)wetPercent > 0.0); break; } } } if ((double)wetPercent > 0.0) { for (int index = 0; index < RegressionMod.data.Underwear_Wet.Length; ++index) { float num3 = (float)(((double)index + 1.0) / ((double)RegressionMod.data.Underwear_Wet.Length - 1.0)); if (index == RegressionMod.data.Underwear_Wet.Length - 1 || (double)wetPercent <= (double)num3) { string input = RegressionMod.data.Underwear_Wet[index].Replace("$UNDERWEAR_DESC$", newDescription); Regex regex = new Regex("<([^>]*)>"); newDescription = (double)messyPercent != 0.0 ? regex.Replace(input, "$1") : regex.Replace(input, ""); break; } } } } return(underwear.prefix.ToLower() + " " + newDescription); }
public static void AnimateWashingUnderwear(Underwear underwear) { Animations.Write(Strings.InsertVariables(Strings.RandString(Animations.t.Washing_Underwear), (Body)null, underwear), (Body)null); }
public Underwear bottoms; //Need to make pants pull name/null from clothing //Constructor that starts with default underwear + pants public Body() { underwear = new Underwear((int)UnderwearType.DinosaurUndies); bottoms = new Underwear((int)UnderwearType.Pants); }