Skip to content
Snippets Groups Projects
Commit e0bd3134 authored by Arkerthan's avatar Arkerthan
Browse files

organFarm layout

parent dbfa725b
No related branches found
No related tags found
No related merge requests found
......@@ -36,6 +36,7 @@ App.Facilities = {
HGSuite: {}
};
App.Medicine = {};
App.Medicine.Organs = {};
App.RA = {};
App.SF = {};
App.Corporate = {};
......
/*
id (string) !!!--UNIQUE--!!!
name, tooltip (string)
cost (number)
growRequirement (slave) -> bool
time (number)
implantAction[] {
name (string)
requirement (slave) -> bool
errorMessage (slave) -> string
effect (slave) -> ()
surgeryType (string) --for surgery Degradation
autoImplant (bool)
autoErrorMessage (slave) -> string
}
dependencies[] (string) --organ ids
*/
App.Medicine.Organ = class {
/**
*
* @param {string} id
* @param {string} name
* @param {string} tooltip
* @param {number} cost
* @param {number} time
* @param {function(App.Entity.SlaveState):boolean} canGrow
* @param {string[]} dependencies
* @param {App.Data.OrganImplantAction[]} actions
*/
constructor(id, name, tooltip, cost, time, canGrow, dependencies, actions) {
this.id = id;
this.name = name;
this.tooltip = tooltip;
this.cost = cost;
this.time = time;
/** @type {function(App.Entity.SlaveState):boolean} */
this.canGrow = canGrow;
/** @type {string[]} */
this.dependencies = dependencies;
/** @type {App.Data.OrganImplantAction[]} */
this.implantActions = actions;
App.Medicine.Organs[id] = this;
}
};
/*
implantAction[] {
name (string)
requirement (slave) -> bool
errorMessage (slave) -> string
effect (slave) -> ()
surgeryType (string) --for surgery Degradation
autoImplant (bool)
autoErrorMessage (slave) -> string
}
*/
App.Medicine.OrganImplantAction = class {
/**
* @param {string} name
* @param {string} tooltip
* @param {number} healthImpact
* @param {string} surgeryType
* @param {boolean} autoImplant
* @param {function(App.Entity.SlaveState):boolean} canImplant
* @param {function(App.Entity.SlaveState):string} implantError
* @param {function(App.Entity.SlaveState)} implant
*/
constructor(name, tooltip, healthImpact, surgeryType, autoImplant, canImplant, implantError, implant) {
this.name = name;
this.tooltip = tooltip;
this.healthImpact = healthImpact;
this.surgeryType = surgeryType;
this.autoImplant = autoImplant;
/**
* True if this action can implant the organ
* @type {function(App.Entity.SlaveState):boolean}
*/
this.canImplant = canImplant;
/**
* Error message if the organ cannot be implanted.
* @type {function(App.Entity.SlaveState):string}
*/
this.implantError = implantError;
/**
* Implant the organ
* @type {function(App.Entity.SlaveState)}
*/
this.implant = implant;
}
/**
* Error message if the organ cannot be implanted automatically.
* @param {App.Entity.SlaveState} slave
* @returns {string}
*/
autoImplantError(slave) {
return this.implantError(slave);
}
};
App.Medicine.initOrganFarm = function initOrganFarm() {
new App.Medicine.Organ("penis", "Penis", "will add a prostate if one is not already present",
5000, 5, () => (V.seeDicks !== 0 || V.makeDicks === 1), [],
[
new App.Medicine.OrganImplantAction("Implant", "", 20, "addDick", true,
slave => (slave.dick <= 0),
() => "this slave already has a penis",
slave => {
if (slave.prostate === 0) {
slave.prostate = 1;
}
slave.dick = 2;
slave.clit = 0;
slave.foreskin = slave.dick;
})
]);
new App.Medicine.Organ("testicles", "Testicles", "will add a prostate if one is not already present; requires a penis for successful implantation",
5000, 10, () => (V.seeDicks !== 0 || V.makeDicks === 1), ["penis"],
[
new App.Medicine.OrganImplantAction("Implant", "", 20, "addBalls", true,
slave => (slave.balls <= 0 && slave.dick > 0),
slave => {
if (slave.dick === 0) {
return "This slave lacks the penis necessary to accept testicles.";
} else {
return "This slave already has testicles.";
}
},
slave => {
if (slave.prostate === 0) {
slave.prostate = 1;
}
slave.balls = 2;
slave.ballType = "human";
slave.scrotum = 2;
if (slave.pubertyAgeXY === 0) {
if (V.precociousPuberty === 1) {
if (slave.physicalAge >= V.potencyAge) {
slave.pubertyAgeXY = slave.physicalAge + 1;
}
} else {
if (slave.physicalAge >= V.potencyAge) {
slave.pubertyXY = 1;
}
}
}
}),
new App.Medicine.OrganImplantAction("Implant", "You can forgo standard procedure and implant testicles directly into $his abdomen.", 20, "addTesticles", false,
slave => (slave.dick === 0 && slave.balls <= 0 && slave.ballType !== "human"),
slave => ((slave.balls > 0) ? `This slave already has ${slave.ballType} testicles.` : ""),
slave => {
if (slave.prostate === 0) {
slave.prostate = 1;
}
slave.balls = 2;
slave.ballType = "human";
if (slave.pubertyAgeXY === 0) {
if (V.precociousPuberty === 1) {
if (slave.physicalAge >= V.potencyAge) {
slave.pubertyAgeXY = slave.physicalAge + 1;
}
} else {
if (slave.physicalAge >= V.potencyAge) {
slave.pubertyXY = 1;
}
}
}
}),
new App.Medicine.OrganImplantAction("Replace", "You can replace the existing testicles with a new pair.", 20, "addTesticles", false,
slave => (slave.balls > 0 && slave.ballType !== "human"),
slave => (slave.balls > 0 ? "This slave already has human testicles." : ""),
slave => {
slave.balls = 2;
slave.ballType = "human";
if (slave.pubertyAgeXY === 0) {
if (V.precociousPuberty === 1) {
if (slave.physicalAge >= V.potencyAge) {
slave.pubertyAgeXY = slave.physicalAge + 1;
}
} else {
if (slave.physicalAge >= V.potencyAge) {
slave.pubertyXY = 1;
}
}
}
})
]);
};
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