* colors skin, eyes and hair based on genetic Color.
* Takes .override_*_Color into account.
*
* @param {App.Entity.SlaveState} slave
*/
globalThis.applyGeneticColor=function(slave){
if (slave.override_Eye_Color!==1){
resetEyeColor(slave,"both");
}
if (slave.override_H_Color!==1){
slave.hColor=getGeneticHairColor(slave);
}
if (slave.override_Arm_H_Color!==1){
slave.underArmHColor=getGeneticHairColor(slave);
}
if (slave.override_Pubic_H_Color!==1){
slave.pubicHColor=getGeneticHairColor(slave);
}
if (slave.override_Brow_H_Color!==1){
slave.eyebrowHColor=getGeneticHairColor(slave);
}
if (slave.override_Skin!==1){
if (!(slave.skin==="sun tanned"||slave.skin==="spray tanned")){
slave.skin=getGeneticSkinColor(slave);
}
}
};
/**
* @param {FC.GingeredSlave} slave
*/
globalThis.newSlave=function(slave){
if (getSlave(slave.ID)){
throw"Slave already exists";
}
// if the slave is gingered, remove the gingering proxy
if (slave.beforeGingering){
slave=slave.beforeGingering;
}
if (slave.override_Race!==1){
slave.origRace=slave.race;
}
applyGeneticColor(slave);
/* eslint-disable camelcase */
slave.override_Race=0;
slave.override_H_Color=0;
slave.override_Arm_H_Color=0;
slave.override_Pubic_H_Color=0;
slave.override_Brow_H_Color=0;
slave.override_Skin=0;
slave.override_Eye_Color=0;
/* eslint-enable camelcase */
// too tall to be a dwarf catch for event slaves
if (slave.geneticQuirks.dwarfism===2&&slave.geneticQuirks.gigantism!==2&&slave.height>165){
slave.geneticQuirks.dwarfism=1;
}
if (V.surnamesForbidden===1){
slave.slaveSurname=0;
}
if (slave.preg>0){
slave.pregWeek=slave.preg;
}else{
slave.pregWeek=0;
}
if (slave.clone!==0){
slave.canRecruit=0;
}
slave.sisters=0;
slave.daughters=0;
if (slave.mother===-1||slave.father===-1){
V.PC.daughters+=1;
}
if (areSisters(V.PC,slave)>0){
V.PC.sisters+=1;
}
for (letk=0;k<V.slaves.length;k++){
if (V.slaves[k].mother===slave.ID||V.slaves[k].father===slave.ID){
slave.daughters++;
}
if (slave.mother===V.slaves[k].ID||slave.father===V.slaves[k].ID){
V.slaves[k].daughters++;
}
if (areSisters(V.slaves[k],slave)>0){
slave.sisters++;
V.slaves[k].sisters++;
}
}
if (slave.genes==="XX"){
if (slave.pubertyXX===1){
if (slave.pubertyXY===1){
slave.hormoneBalance=20;
}else{
slave.hormoneBalance=60;
}
}else{
if (slave.pubertyXY===1){
slave.hormoneBalance=-20;
}else{
slave.hormoneBalance=20;
}
}
}elseif (slave.genes==="XY"){
if (slave.pubertyXX===1){
if (slave.pubertyXY===1){
slave.hormoneBalance=20;
}else{
slave.hormoneBalance=40;
}
}else{
if (slave.pubertyXY===1){
slave.hormoneBalance=-40;
}else{
slave.hormoneBalance=20;
}
}
}
if (slave.dick>0&&
slave.balls>0&&
slave.vagina<0&&
slave.anus===0&&
slave.genes==="XY"&&
slave.faceShape==="masculine"&&
slave.attrXY<=35&&
slave.boobs<400&&
slave.hormoneBalance<0){
V.REFeminizationCheckinIDs.push(slave.ID);
}
if (slave.actualAge>35&&slave.face<=10&&slave.faceImplant===0&&slave.energy<=60){
V.REMILFCheckinIDs.push(slave.ID);
}
if (slave.attrXY<=35&&slave.attrXX>65){
V.REOrientationCheckinIDs.push(slave.ID);
}
if (slave.face<-10){
V.REUglyCheckinIDs.push(slave.ID);
}
if (slave.anus<2){
V.REButtholeCheckinIDs.push(slave.ID);
}
if (slave.boobs<800){
V.REReductionCheckinIDs.push(slave.ID);
}
generatePronouns(slave);
SetBellySize(slave);
V.slaveIndices[slave.ID]=V.slaves.push(slave)-1;
if (slave.origin!=="$He was your slave, but you freed $him, which $he repaid by participating in a coup attempt against you. It failed, and $he is again your chattel."&&slave.ID!==V.boomerangSlave.ID){
V.genePool.push(clone(slave));
}else{
if (!V.genePool.some(s=>s.ID===slave.ID)){
V.genePool.push(slave);
}
}
/* special case for dulling intelligence via drugs in slave acquisition */
if (slave.dullIntelligence){
slave.intelligence=-100;
deleteslave.dullIntelligence;
}
if (slave.assignment){
assignJob(slave,slave.assignment);
}else{
slave.assignment=Job.CHOICE;
}
/** do not run the Rules Assistant before adding the new slave to the slaves list! **/
if (V.ui!=="start"&&V.universalRulesNewSlavesRA===1&&V.rulesAssistantAuto!==0){
if ((V.surnameOrder!==1&&["Cambodian","Chinese","Hungarian","Japanese","Korean","Mongolian","Taiwanese","Vietnamese"].includes(slave.nationality))||(V.surnameOrder===2)){
if ((V.surnameOrder!==1&&["Cambodian","Chinese","Hungarian","Japanese","Korean","Mongolian","Taiwanese","Vietnamese"].includes(slave.nationality))||(V.surnameOrder===2)){
if (V.policies.retirement.sex>0&&(slave.counter.oral+slave.counter.anal+slave.counter.vaginal+slave.counter.penetrative+slave.counter.mammary)>V.policies.retirement.sex){
returntrue;
}
if (V.policies.retirement.milk>0&&slave.counter.milk>V.policies.retirement.milk){
returntrue;
}
if (V.policies.retirement.cum>0&&slave.counter.cum>V.policies.retirement.cum){
returntrue;
}
if (V.policies.retirement.births>0&&slave.counter.births>V.policies.retirement.births){
returntrue;
}
if (V.policies.retirement.kills>0&&slave.counter.pitKills>V.policies.retirement.kills){
returntrue;
}
// no retirement for you
returnfalse;
};
/** marks some weeks of time passage for a slave, counting birthdays and invoking aging if game settings require it
* @param {App.Entity.SlaveState} slave
* @param {number} [weeks=1]
*/
globalThis.ageSlaveWeeks=function(slave,weeks=1){
if (V.seeAge!==0){// birthdays enabled
for (leti=0;i<weeks;++i){
slave.birthWeek++;
if (slave.birthWeek>=52){
slave.birthWeek=0;
if (V.seeAge===1){// actual aging enabled
ageSlave(slave);
}
}
}
}
};
/** advances the age of a slave by one year, incurring all aging side effects