:: SA stay confined [script]

window.saStayConfined = function saStayConfined(slave) {

	var pronouns = getPronouns(slave)
	var he = pronouns.pronoun, him = pronouns.object, his = pronouns.possessive, hers = pronouns.possessivePronoun, himself = pronouns.objectReflexive, boy = pronouns.noun
	var He = capFirstChar(he), His = capFirstChar(his)
	var V = State.variables

	var t = ""

	if (slave.fetish != "mindbroken") {
		if (slave.devotion < -50) {
			t += `is kept in solitary confinement whenever ${he} is not being forced to do something else. ${He} still hates ${his} place in the world, but being forced to rely on slave life as ${his} only human contact <span class='hotpink'>grinds down ${his} resistance.</span>`
			slave.devotion += 2
		} else if (slave.devotion <= 20) {
			t += `is kept in solitary confinement whenever ${he} is not being forced to do something else. With nothing to do but look forward to the next time ${he}'s let out to serve, <span class='hotpink'>${he} begins to rely on servitude.</span>`
			slave.devotion += 1
		} else if (slave.devotion <= 50) {
			t += `accepts solitary confinement whenever ${he} is not being forced to do something else. Since ${he} is obedient, the mental torture neither breaks ${him} further nor causes ${him} to hate you.`
		} else {
			t += `accepts solitary confinement whenever ${he} is not being forced to do something else. ${He} spends ${his} time wondering hopelessly how ${he} has failed you, <span class='mediumorchid'>damaging ${his} devotion to you.</span>`
			slave.devotion -= 2
		}

		if (slave.trust < -50) {
			t += ` ${He} is so terrified of you that this confinement does not make ${him} fear you any more.`
		} else if (slave.trust < -20) {
			t += ` ${He} is already afraid of you, but this confinement makes ${him} <span class='gold'>fear you even more.</span>`
			slave.trust -= 2
		} else if (slave.trust <= 20) {
			t += ` This confinement makes ${him} <span class='gold'>fear your power</span> over ${him}.`
			slave.trust -= 4
		} else {
			t += ` This confinement makes ${him} <span class='gold'>trust you less,</span> and fear you more.`
			slave.trust -= 5
		}

		if (slave.assignment == "be confined in the cellblock") {
			if ((slave.hears == -1 && slave.earwear != "hearing aids") || (slave.hears == 0 && slave.earwear == "muffling ear plugs") || (slave.hears == -2)) {
				t += ` ${His} hearing impairment spares ${him} the sounds of ${his} peers getting punished, lightening the impact of ${his} imprisonment.`
			}
		}

		t += ` The stress of confinement <span class='red'>damages ${his} health.</span>`
		slave.health -= 10
	} else {
		t += `is oblivious to ${his} confinement.`
	}

	if (slave.sentence == 0 && (slave.devotion > 20 || (slave.devotion >= -20 && slave.trust < -20) || (slave.devotion >= -50 && slave.trust < -50) || slave.fetish == "mindbroken")) {
		if (slave.fetish == "mindbroken") {
			t += ` ${His} broken mind hinges entirely on other's guidance,`
		} else {
			t += ` ${He} is now willing to <span class='hotpink'>do as ${he}'s told,</span>`
		}
		t += ` so <span class='yellow'>${his} assignment has defaulted to rest.</span>`
		if (slave.assignment == "be confined in the cellblock") {
			State.temporary.brokenSlaves++
			State.temporary.DL--
			State.temporary.dI--
		}
		removeJob(slave, slave.assignment)
	}

	return t
}
