diff --git a/docs/README-Pregnancy.md b/docs/README-Pregnancy.md index 1fd0e1c495c969a8bf44bc99f9673a721920c36c..c396da1586c1ebb6596812065f559918cb49a1ed 100644 --- a/docs/README-Pregnancy.md +++ b/docs/README-Pregnancy.md @@ -246,6 +246,20 @@ Removes specific birth id's from the `V.babyIntro`, used when the introduction o - `<<removeBabyIntro "pc" "Bailey" $recentBirthId>>` +#### talkedAboutPregnancy(mother, whoToCheck, existingId) + +Returns the number of times someone has talked about a pregnancy to the mother. + +- `<<if !talkedAboutPregnancy("pc","Alex")>>` +- `<<if talkedAboutPregnancy("pc","Alex") gte 5>>` + +#### setTalkedAboutPregnancy(mother, whoToIncrement, existingId) + +Increments then returns the number of times someone has talked about a pregnancy to the mother. This should normally only be used for current pregnancies. + +- `<<setTalkedAboutPregnancy "pc" "Alex">>` +- `<<setTalkedAboutPregnancy "Alex" "pc">>` + ## childrenStoryFunctions.js Usage ### setChildFirstWord(childId, word, playerAbsent = false) diff --git a/game/03-JavaScript/04-Pregnancy/storyFunctions.js b/game/03-JavaScript/04-Pregnancy/storyFunctions.js index b634233743ed2f32789dca7d3a9a6c9eb80030d7..e66cfb2ae518640ee0b308e6971128b6c413ff50 100644 --- a/game/03-JavaScript/04-Pregnancy/storyFunctions.js +++ b/game/03-JavaScript/04-Pregnancy/storyFunctions.js @@ -775,3 +775,69 @@ function removeBabyIntro(mother, introFor, birthId) { } } DefineMacro("removeBabyIntro", removeBabyIntro); + +/* Returns the total times a someone has talked about someone elses pregnancy */ +function talkedAboutPregnancy(mother, whoToCheck, existingId) { + const talkedAbout = V.pregnancyStats.talkedAboutPregnancy; + let birthId; + let whoToCheckConverted; + if (whoToCheck === "pc") { + whoToCheckConverted = whoToCheck; + } else if (V.NPCNameList.includes(whoToCheck)) { + whoToCheckConverted = V.NPCNameList.indexOf(whoToCheck); + } else { + return 0; + } + + if (existingId !== undefined && talkedAbout[mother + existingId] && talkedAbout[mother + existingId][whoToCheckConverted]) { + return talkedAbout[mother + existingId][whoToCheckConverted]; + } + + if (mother === "pc" && playerIsPregnant()) { + birthId = mother + getPregnancyObject().fetus[0].birthId; + } else if (C.npc[mother] && npcIsPregnant(mother)) { + birthId = mother + getPregnancyObject(mother).fetus[0].birthId; + } + + if (birthId && talkedAbout[birthId] && talkedAbout[birthId][whoToCheckConverted]) return talkedAbout[birthId][whoToCheckConverted]; + + return 0; +} +window.talkedAboutPregnancy = talkedAboutPregnancy; + +/* Increments the total times a someone has talked about someone elses pregnancy, should only be used for the players current pregnancy */ +function setTalkedAboutPregnancy(mother, whoToIncrement, existingId) { + const talkedAbout = V.pregnancyStats.talkedAboutPregnancy; + let birthId; + let whoToIncrementConverted; + if (whoToIncrement === "pc") { + whoToIncrementConverted = whoToIncrement; + } else if (V.NPCNameList.includes(whoToIncrement)) { + whoToIncrementConverted = V.NPCNameList.indexOf(whoToIncrement); + } else { + return 0; + } + + if (talkedAbout[mother + existingId]) { + birthId = mother + existingId; + } else if (mother === "pc") { + if (playerIsPregnant()) { + birthId = mother + getPregnancyObject().fetus[0].birthId; + } + } else if (C.npc[mother] && npcIsPregnant(mother)) { + birthId = mother + getPregnancyObject(mother).fetus[0].birthId; + } else { + return 0; + } + + if (birthId) { + if (!talkedAbout[birthId]) talkedAbout[birthId] = {}; + if (!talkedAbout[birthId][whoToIncrementConverted]) { + talkedAbout[birthId][whoToIncrementConverted] = 0; + } + talkedAbout[birthId][whoToIncrementConverted]++; + return talkedAbout[birthId][whoToIncrementConverted]; + } + return 0; +} +DefineMacro("setTalkedAboutPregnancy", setTalkedAboutPregnancy); diff --git a/game/04-Variables/pregnancyVar.twee b/game/04-Variables/pregnancyVar.twee index b3b0cd9cd15d79249285c57e49ddd9bf7ec24d17..de746f9fd04ab7b1959b4f9b5ef068833652d752 100644 --- a/game/04-Variables/pregnancyVar.twee +++ b/game/04-Variables/pregnancyVar.twee @@ -55,6 +55,13 @@ <<if $pregnancyStats.parasiteDoctorEvents is undefined>> <<set $pregnancyStats.parasiteDoctorEvents to 0>> <</if>> + <<if $pregnancyStats.talkedAboutPregnancy is undefined>> + /* + This will track when the player or npc has ever talked about specific pregnancy, the set should be during the pregnancy only + 'birthid:["pc","NPCNameIndex"]' + */ + <<set $pregnancyStats.talkedAboutPregnancy to {}>> + <</if>> <</widget>> <<widget "containersInit">> diff --git a/game/special-masturbation/effects.js b/game/special-masturbation/effects.js index 42c5eca53a3df6111bebee6f39c011cc31a60094..3ce095e84942ad0f854753aaef1487f09d49ba35 100644 --- a/game/special-masturbation/effects.js +++ b/game/special-masturbation/effects.js @@ -2251,15 +2251,15 @@ function masturbationeffectsArms( function fingersEffect(span, hymenIntact) { const fragment = document.createDocumentFragment(); if (V.fingersInVagina === V.vaginaFingerLimit - 1) { - fragment.append(span("It's a tight fit.", "purple")); fragment.append(" "); + fragment.append(span("It's a tight fit.", "purple")); } else if (V.fingersInVagina === V.vaginaFingerLimit) { if (hymenIntact) { - fragment.append(span("You can't fit any more without tearing your hymen.", "pink")); fragment.append(" "); + fragment.append(span("You can't fit any more without tearing your hymen.", "pink")); } else { - fragment.append(span("You've reached your limit.", "pink")); fragment.append(" "); + fragment.append(span("You've reached your limit.", "pink")); } } return fragment;