Skip to content
Snippets Groups Projects
Commit 0ae0edde authored by lowercasedonkey's avatar lowercasedonkey
Browse files

fork start cleanup

parent 5e6d0033
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@
App.UI.SlaveInteract.cheatEditSlave = function(slave) {
const el = new DocumentFragment();
const r = [];
const { His } = getPronouns(slave);
const {His} = getPronouns(slave);
const tempSlave = clone(slave);
......@@ -11,7 +11,7 @@ App.UI.SlaveInteract.cheatEditSlave = function(slave) {
App.UI.DOM.appendNewElement("div", el, App.UI.DOM.link(
"Apply cheat edits",
() => {
App.StartingGirls.cleanup(tempSlave);
cleanup(tempSlave);
V.slaves[V.slaveIndices[slave.ID]] = tempSlave;
},
[],
......@@ -67,4 +67,84 @@ App.UI.SlaveInteract.cheatEditSlave = function(slave) {
el.append(App.UI.tabBar.makeTab('finalize', makeSpanIded("content-finalize", App.StartingGirls.finalize(slave))));
return el;
/** Make sure user-entered values aren't crazy for starting girls
* @param {App.Entity.SlaveState} slave
*/
function cleanup(slave) {
slave.actualAge = Math.clamp(slave.actualAge, V.minimumSlaveAge, V.retirementAge - 1) || 18;
slave.physicalAge = slave.actualAge;
slave.visualAge = slave.actualAge;
slave.ovaryAge = slave.actualAge;
slave.birthWeek = Math.clamp(slave.birthWeek, 0, 51) || 0;
slave.devotion = Math.clamp(slave.devotion, -100, 100) || 0;
slave.trust = Math.clamp(slave.trust, -100, 100) || 0;
if (slave.indenture >= 0) {
slave.indenture = Math.clamp(slave.indenture, 26, 208) || 26;
}
slave.height = Math.clamp(slave.height, 85, 274) || 140;
slave.boobs = Math.clamp(Math.trunc(slave.boobs / 50) * 50, 0, 50000) || 200;
slave.hLength = Math.clamp(slave.hLength, 0, 500) || 40;
resetEyeColor(slave, "both");
slave.origRace = slave.race;
if (slave.balls === 0) {
slave.scrotum = 0;
}
if (slave.vagina === -1) {
slave.vaginaLube = 0;
}
if (slave.preg > 0) {
if (slave.pregSource !== -1) {
slave.pregSource = 0;
}
}
if (slave.ovaries === 0) {
slave.preg = 0;
slave.pregType = 0;
slave.pregSource = 0;
slave.pregWeek = 0;
slave.pregKnown = 0;
slave.belly = 0;
slave.bellyPreg = 0;
}
if (slave.analArea < slave.anus) {
slave.analArea = slave.anus;
}
slave.father = Number(slave.father) || 0;
slave.mother = Number(slave.mother) || 0;
if (slave.counter.birthsTotal > 0) {
if (slave.pubertyXX < 1) {
slave.counter.birthsTotal = 0;
}
slave.counter.birthsTotal = Math.clamp(slave.counter.birthsTotal, 0, ((slave.actualAge - slave.pubertyAgeXX) * 50));
}
if (slave.slaveName === "") {
slave.slaveName = "Nameless";
}
if (slave.slaveSurname === "") {
slave.slaveSurname = 0;
}
if ((slave.anus > 2 && slave.skill.anal <= 10) || (slave.anus === 0 && slave.skill.anal > 30)) {
slave.skill.anal = 15;
}
if (slave.vagina < 0) {
slave.skill.vaginal = 0;
} else if ((slave.vagina > 2 && slave.skill.vaginal <= 10) || (slave.vagina === 0 && slave.skill.vaginal > 30)) {
slave.skill.vaginal = 15;
}
slave.prestige = Math.clamp(slave.prestige, 0, 3) || 0;
if (slave.prestige === 0) {
slave.prestigeDesc = 0;
} else if (slave.prestigeDesc === 0) {
slave.prestigeDesc = "";
}
}
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment