Skip to content
Snippets Groups Projects
saNanny.js 8.65 KiB
Newer Older
  • Learn to ignore specific revisions
  • DCoded's avatar
    DCoded committed
    /**
     * @param {App.Entity.SlaveState} slave
     * @returns {string}
     */
    window.saNanny = function saNanny(slave) {
    
    DCoded's avatar
    DCoded committed
    	"use strict";
    
    MouseOfLight's avatar
    MouseOfLight committed
    	const
    
    Skriv's avatar
    Skriv committed
    		{
    
    		// eslint-disable-next-line no-unused-vars
    
    Skriv's avatar
    Skriv committed
    			he, him, his, hers, himself, boy, He, His
    
    DCoded's avatar
    DCoded committed
    		} = getPronouns(slave),
    		child = V.nurseryBabies > 0 ? `ren` : ``;
    
    DCoded's avatar
    DCoded committed
    
    
    DCoded's avatar
    DCoded committed
    	let t = `works as a nanny. ${He} ${V.nurseryBabies ? `looks after the ${child} in ${V.nurseryName}, ensuring their needs are met and that they are being raised as ${V.nurseryBabies === 1 ? `a good future slave` : `good future slaves`}. ` : `keeps ${V.nurseryName} neat and tidy for the children it will one day support`}. `;
    
    DCoded's avatar
    DCoded committed
    
    
    DCoded's avatar
    DCoded committed
    	t += nannyEffort(slave);
    	t += nannyRelationship(slave);
    	t += nannyCareer(slave);
    	t += nannyEffort(slave);
    	t += nannyFetish(slave);
    	t += nannyEnergy(slave);
    	t += nannyVision(slave);
    	t += nannyVignettes(slave);
    	t += matronEffects(slave);
    
    dsoloha's avatar
    dsoloha committed
    
    	return t;
    
    
    DCoded's avatar
    DCoded committed
    	function nannyEffort(slave) {
    		let t = '';
    
    		t += ` ${He} is `;
    		if (slave.trust < -20) {
    
    Arkerthan's avatar
    Arkerthan committed
    			t += `frightened of punishment and works very hard, <span class="cash inc">reducing the upkeep</span> of ${V.nurseryName}${V.nurseryBabies ? ` and the children within` : ``}.`;
    
    DCoded's avatar
    DCoded committed
    		} else if (slave.devotion <= 20) {
    
    Arkerthan's avatar
    Arkerthan committed
    			t += `hesitant, requiring your other slaves to demand ${his} services, and only slightly <span class="cash inc">reduces upkeep</span> of your slaves.`;
    
    DCoded's avatar
    DCoded committed
    		} else if (slave.devotion <= 50) {
    
    Arkerthan's avatar
    Arkerthan committed
    			t += `obedient, offering your other slaves ${his} services, and moderately <span class="cash inc">reduces the upkeep</span> of your slaves.`;
    
    DCoded's avatar
    DCoded committed
    		} else if (slave.devotion <= 95) {
    
    Arkerthan's avatar
    Arkerthan committed
    			t += `devoted, happily giving your other slaves ${his} services, and <span class="cash inc">reduces the upkeep</span> of your slaves.`;
    
    DCoded's avatar
    DCoded committed
    		} else {
    
    Arkerthan's avatar
    Arkerthan committed
    			t += `so happy to serve your other slaves that ${he} often sees to their needs before they know they have them, and greatly <span class="cash inc">reduces the upkeep</span> of your slaves.`;
    
    DCoded's avatar
    DCoded committed
    		}
    
    		return t;
    
    Skriv's avatar
    Skriv committed
    	}
    
    DCoded's avatar
    DCoded committed
    
    
    DCoded's avatar
    DCoded committed
    	function nannyRelationship(slave) {
    		let t = '';
    
    DCoded's avatar
    DCoded committed
    		// TODO:
    		if (slave.relationship === -2) {
    			t += ` ${He} does ${his} best to look after the ${child} in ${his} care due to ${his} emotional bond to you.`;
    		} else if (slave.relationship === -3 && slave.devotion > 50) {
    			t += ` ${He} does ${his} very best to be the perfect caretaker, making ${him} an outstanding nanny.`;
    		}
    
    DCoded's avatar
    DCoded committed
    		return t;
    
    Skriv's avatar
    Skriv committed
    	}
    
    DCoded's avatar
    DCoded committed
    
    
    DCoded's avatar
    DCoded committed
    	function nannyCareer(slave) {
    		let t = '';
    
    DCoded's avatar
    DCoded committed
    
    
    DCoded's avatar
    DCoded committed
    		// TODO:
    		if (setup.servantCareers.includes(slave.career)) {
    			t += ` ${He} has experience with nannying from ${his} life before ${he} was a slave, making ${him} more effective.`;
    		} else if (slave.skill.servant >= V.masteredXP) {
    			t += ` ${He} has experience with nannying from working for you, making ${him} more effective.`;
    		} else {
    			slave.skill.servant += jsRandom(1, Math.ceil((slave.intelligence + slave.intelligenceImplant) / 15) + 8);
    		}
    
    		return t;
    	}
    
    DCoded's avatar
    DCoded committed
    	function nannyFetish(slave) {
    		let t = '';
    
    DCoded's avatar
    DCoded committed
    		// TODO:
    		if (slave.fetishStrength > 60) {
    			if (slave.fetish === "submissive" && slave.fetishKnown === 1) {
    				t += ` ${His} natural affinity for submission increases ${his} effectiveness.`;
    			} else if (slave.fetishKnown === 1 && slave.fetish === "dom") {
    				t += ` ${His} sexual appetite for domination reduces ${his} effectiveness.`;
    			}
    
    DCoded's avatar
    DCoded committed
    		}
    
    DCoded's avatar
    DCoded committed
    
    		return t;
    
    Skriv's avatar
    Skriv committed
    	}
    
    DCoded's avatar
    DCoded committed
    	function nannyEnergy(slave) {
    		let t = '';
    
    DCoded's avatar
    DCoded committed
    		// TODO:
    		if (slave.energy < 20) {
    			t += ` ${His} frigidity allows ${him} to ignore the intercourse all around ${him}, making ${him} very efficient.`;
    		} else if (slave.energy < 40) {
    			t += ` ${His} low sex drive keeps ${him} from becoming too distracted by the intercourse all around ${him}, making ${him} more efficient.`;
    		}
    
    DCoded's avatar
    DCoded committed
    		return t;
    
    Skriv's avatar
    Skriv committed
    	}
    
    DCoded's avatar
    DCoded committed
    	function nannyVision(slave) {
    		let t = '';
    
    DCoded's avatar
    DCoded committed
    		// TODO:
    		if (!canSeePerfectly(slave)) {
    			t += ` ${His} bad vision makes ${him} a worse nanny.`;
    		}
    
    DCoded's avatar
    DCoded committed
    		return t;
    
    Skriv's avatar
    Skriv committed
    	}
    
    DCoded's avatar
    DCoded committed
    	function nannyVignettes(slave) {
    		let t = '';
    
    		if (V.showVignettes === 1 && (slave.assignment === window.Job.NANNY)) {
    
    DCoded's avatar
    DCoded committed
    			const vignette = GetVignette(slave);
    			t += ` <u>This week</u> ${vignette.text} `;
    
    DCoded's avatar
    DCoded committed
    			vignetteCash(slave);
    			vignetteDevotion(slave);
    			vignetteTrust(slave);
    			vignetteHealth(slave);
    			vignetteRep(slave);
    		}
    
    DCoded's avatar
    DCoded committed
    		return t;
    
    DCoded's avatar
    DCoded committed
    	function vignetteCash(slave) {
    		const vignette = GetVignette(slave);
    		let t = '';
    
    		if (vignette.type === "cash") {
    			let modifier = FResult(slave);
    			if (vignette.effect > 0) {
    
    Arkerthan's avatar
    Arkerthan committed
    				t += `<span class="cash inc">making you an extra ${cashFormat(Math.trunc(modifier * vignette.effect))}.</span>`;
    
    				cashX(Math.trunc(modifier * vignette.effect), "slaveAssignmentNurseryVign", slave);
    
    DCoded's avatar
    DCoded committed
    			} else if (vignette.effect < 0) {
    
    Arkerthan's avatar
    Arkerthan committed
    				t += `<span class="cash dec">losing you ${cashFormat(Math.abs(Math.trunc(modifier * vignette.effect)))}.</span>`;
    
    				cashX(forceNeg(Math.trunc(modifier * vignette.effect)), "slaveAssignmentNurseryVign", slave);
    
    DCoded's avatar
    DCoded committed
    			} else {
    				t += `an incident without lasting effect.`;
    			}
    
    dsoloha's avatar
    dsoloha committed
    		}
    
    DCoded's avatar
    DCoded committed
    
    		return t;
    
    DCoded's avatar
    DCoded committed
    	function vignetteDevotion(slave) {
    		const vignette = GetVignette(slave);
    		let t = '';
    
    		if (vignette.type === "devotion") {
    			if (vignette.effect > 0) {
    				if (slave.devotion > 50) {
    
    					t += `<span class="devotion inc">increasing ${his} devotion to you.</span>`;
    
    DCoded's avatar
    DCoded committed
    				} else if (slave.devotion >= -20) {
    
    					t += `<span class="devotion inc">increasing ${his} acceptance of you.</span>`;
    
    DCoded's avatar
    DCoded committed
    				} else if (slave.devotion > -10) {
    
    					t += `<span class="devotion inc">reducing ${his} dislike of you.</span>`;
    
    DCoded's avatar
    DCoded committed
    				} else {
    
    					t += `<span class="devotion inc">reducing ${his} hatred of you.</span>`;
    
    DCoded's avatar
    DCoded committed
    				}
    			} else if (vignette.effect < 0) {
    				if (slave.devotion > 50) {
    
    					t += `<span class="devotion dec">reducing ${his} devotion to you.</span>`;
    
    DCoded's avatar
    DCoded committed
    				} else if (slave.devotion >= -20) {
    
    					t += `<span class="devotion dec">reducing ${his} acceptance of you.</span>`;
    
    DCoded's avatar
    DCoded committed
    				} else if (slave.devotion > -10) {
    
    					t += `<span class="devotion dec">increasing ${his} dislike of you.</span>`;
    
    DCoded's avatar
    DCoded committed
    				} else {
    
    					t += `<span class="devotion dec">increasing ${his} hatred of you.</span>`;
    
    DCoded's avatar
    DCoded committed
    				}
    
    Skriv's avatar
    Skriv committed
    			} else {
    
    DCoded's avatar
    DCoded committed
    				t += `an incident without lasting effect.`;
    
    Skriv's avatar
    Skriv committed
    			}
    
    DCoded's avatar
    DCoded committed
    			slave.devotion += (1 * vignette.effect);
    
    dsoloha's avatar
    dsoloha committed
    		}
    
    DCoded's avatar
    DCoded committed
    
    		return t;
    
    DCoded's avatar
    DCoded committed
    	function vignetteTrust(slave) {
    		const vignette = GetVignette(slave);
    		let t = '';
    
    		if (vignette.type === "trust") {
    			if (vignette.effect > 0) {
    				if (slave.trust > 20) {
    
    					t += `<span class="trust inc">increasing ${his} trust in you.</span>`;
    
    DCoded's avatar
    DCoded committed
    				} else if (slave.trust > -10) {
    
    					t += `<span class="trust inc">reducing ${his} fear of you.</span>`;
    
    DCoded's avatar
    DCoded committed
    				} else {
    
    					t += `<span class="trust inc">reducing ${his} terror of you.</span>`;
    
    DCoded's avatar
    DCoded committed
    				}
    			} else if (vignette.effect < 0) {
    				if (slave.trust > 20) {
    
    					t += `<span class="trust dec">reducing ${his} trust in you.</span>`;
    
    DCoded's avatar
    DCoded committed
    				} else if (slave.trust >= -20) {
    
    					t += `<span class="trust dec">increasing ${his} fear of you.</span>`;
    
    DCoded's avatar
    DCoded committed
    				} else {
    
    					t += `<span class="trust dec">increasing ${his} terror of you.</span>`;
    
    DCoded's avatar
    DCoded committed
    				}
    
    DCoded's avatar
    DCoded committed
    			} else {
    
    DCoded's avatar
    DCoded committed
    				t += `an incident without lasting effect.`;
    
    DCoded's avatar
    DCoded committed
    			}
    
    DCoded's avatar
    DCoded committed
    			slave.trust += (1 * vignette.effect);
    
    Skriv's avatar
    Skriv committed
    		}
    
    
    DCoded's avatar
    DCoded committed
    		return t;
    	}
    
    DCoded's avatar
    DCoded committed
    	function vignetteHealth(slave) {
    		const vignette = GetVignette(slave);
    		let t = '';
    
    DCoded's avatar
    DCoded committed
    		if (vignette.type === "health") {
    			if (vignette.effect > 0) {
    
    Arkerthan's avatar
    Arkerthan committed
    				t += `<span class="health inc">improving ${his} health.</span>`;
    
    DCoded's avatar
    DCoded committed
    			} else if (vignette.effect < 0) {
    
    Arkerthan's avatar
    Arkerthan committed
    				t += `<span class="health dec">affecting ${his} health.</span>`;
    
    DCoded's avatar
    DCoded committed
    			} else {
    				t += `an incident without lasting effect.`;
    			}
    			improveCondition(slave, 2 * vignette.effect);
    
    dsoloha's avatar
    dsoloha committed
    		}
    
    DCoded's avatar
    DCoded committed
    
    		return t;
    
    DCoded's avatar
    DCoded committed
    	function vignetteRep(slave) {
    		const vignette = GetVignette(slave);
    		let t = '';
    
    		if (vignette.type === "rep") {
    			let modifier = FResult(slave);
    			if (vignette.effect > 0) {
    
    Arkerthan's avatar
    Arkerthan committed
    				t += `<span class="reputation inc">gaining you a bit of reputation.</span>`;
    
    DCoded's avatar
    DCoded committed
    			} else if (vignette.effect < 0) {
    
    Arkerthan's avatar
    Arkerthan committed
    				t += `<span class="reputation dec">losing you a bit of reputation.</span>`;
    
    DCoded's avatar
    DCoded committed
    			} else {
    				t += `an incident without lasting effect.`;
    			}
    			repX((modifier * vignette.effect * 0.1), "vignette", slave);
    
    DCoded's avatar
    DCoded committed
    		return t;
    	}
    
    DCoded's avatar
    DCoded committed
    	function matronEffects(slave) {
    		let t = '';
    
    DCoded's avatar
    DCoded committed
    		if (V.Matron) {
    			t += `While there, ${he} benefits from ${V.Matron.slaveName}'s `;
    			if (V.Matron.physicalAge < 21) {
    				t += `youthful energy`;
    			} else {
    				t += `care`;
    
    DCoded's avatar
    DCoded committed
    			}
    
    DCoded's avatar
    DCoded committed
    			if (V.Matron.skill.oral) { // TODO: keep this? replace with something else?
    				t += ` and talented tongue`;
    
    DCoded's avatar
    DCoded committed
    			}
    
    DCoded's avatar
    DCoded committed
    			t += `. `;
    			/* TODO: farmer is often not set and makes no sense here. What should this be? LCD.
    				if (slave.devotion < V.FarmerDevotionThreshold) {
    					slave.devotion += V.FarmerDevotionBonus;
    				}
    				if (slave.devotion < V.FarmerTrustThreshold) {
    					slave.trust += V.FarmerTrustBonus;
    				}
    				if (slave.condition < 100) {
    					improveCondition(slave, V.FarmerHealthBonus);
    				}*/
    		}
    
    DCoded's avatar
    DCoded committed
    
    
    DCoded's avatar
    DCoded committed
    		return t;
    	}
    };