diff --git a/src/SecExp/attackHandler.tw b/src/SecExp/attackHandler.tw index 8d98d5ba74bbfaed73290484b20fba640181a419..c44ea60921d8413f36d8293f8712905793a27bdc 100644 --- a/src/SecExp/attackHandler.tw +++ b/src/SecExp/attackHandler.tw @@ -191,7 +191,7 @@ <<set _mercMod -= 0.2>> <<set _SFMod -= 0.2>> <<set _enemyMod += 0.2>> - <<set $PC.majorInjury = 3>> + <<run healthDamage($PC, 60)>> <</if>> <<elseif $leadingTroops == "assistant">> <<if $rep < 10000 && $SecExp.core.authority < 10000>> diff --git a/src/SecExp/attackReport.tw b/src/SecExp/attackReport.tw index b4027ad62e29b7c06e50bfbd64adbc62691bafdc..f4daf424d3c64e5c3d7076359255799ef7e33b7d 100644 --- a/src/SecExp/attackReport.tw +++ b/src/SecExp/attackReport.tw @@ -854,7 +854,7 @@ <<if $gainedWarfare == 1>> Battlefield experience increased your understanding of warfare, making you a better commander. <</if>> - <<if $PC.majorInjury > 0>> + <<if $PC.health.shortDamage >= 60>> During the fighting @@.red;you were wounded.@@ Your medics assure you it's nothing life threatening, but you'll be weakened for a few weeks. <</if>> <<elseif $leadingTroops == "assistant">> diff --git a/src/SecExp/rebellionReport.tw b/src/SecExp/rebellionReport.tw index 9f8966f10d7131eacf36860e0177526c4d72e6f8..1133f964422842906a89b60c1c2dc47ffae30414 100644 --- a/src/SecExp/rebellionReport.tw +++ b/src/SecExp/rebellionReport.tw @@ -556,7 +556,7 @@ <</if>> <<if random(1,100) <= _woundChance>> A lucky shot managed to find its way to you, leaving a painful, but thankfully not lethal, wound. - <<set $PC.majorInjury = 3>> + <<run healthDamage($PC, 60)>> <<else>> Fortunately you managed to avoid injury. <</if>> @@ -725,7 +725,7 @@ <<set _woundChance *= random(1,2)>> <<if random(1,100) <= _woundChance>> A lucky shot managed to find its way to you, leaving a painful, but thankfully nonlethal, wound. - <<set $PC.majorInjury = 3>> + <<run healthDamage($PC, 60)>> <<else>> Fortunately you managed to avoid injury. <</if>> @@ -834,7 +834,7 @@ <<set _woundChance *= random(1,2)>> <<if random(1,100) <= _woundChance>> A lucky shot managed to find its way to you, leaving a painful, but thankfully nonlethal, wound. - <<set $PC.majorInjury = 3>> + <<run healthDamage($PC, 60)>> <<else>> Fortunately you managed to avoid injury. <</if>> diff --git a/src/endWeek/illness.js b/src/endWeek/illness.js index 7a63beed9ce0e5ab7e7a61e4653b177f00784699..475230e8966634d6b767f44e63b5713d2e6e8a9a 100644 --- a/src/endWeek/illness.js +++ b/src/endWeek/illness.js @@ -139,30 +139,60 @@ window.endWeekHealthDamage = function endWeekHealthDamage(slave) { // Run at the let chemToShort = 0; let shortToCondition = 0; let shortToLong = 0; - let tiredToCondition = 0; - - // dealing with carcinogens - // They decay naturally at a rate of 10%, but at as they decay cause short term damage - if (slave.chem > 0) { - if (slave.chem > 10) { - chemToShort += Math.max(Math.trunc(slave.chem * 0.1), 1); - } else if (slave.chem > jsRandom(0, 9)) { - chemToShort += 1; + let tiredToCondition = 0; + + // Checking if we are dealing with the player + // Player does not make use of most things slaves deal with, only short to long term damage + if (slave.ID !== -1) { + + // dealing with carcinogens + // They decay naturally at a rate of 10%, but at as they decay cause short term damage + if (slave.chem > 0) { + if (slave.chem > 10) { + chemToShort += Math.max(Math.trunc(slave.chem * 0.1), 1); + } else if (slave.chem > jsRandom(0, 9)) { + chemToShort += 1; + } + slave.chem -= chemToShort; + H.shortDamage += chemToShort * 2; } - slave.chem -= chemToShort; - H.shortDamage += chemToShort * 2; - } - // dealing with illness - if (H.illness > 0) { - H.shortDamage += Math.trunc(Math.pow(H.illness, 1.52) * 3 + 2); // 5, 10, 17, 26, 36 points of damage per respective level of illness + // dealing with illness + if (H.illness > 0) { + H.shortDamage += Math.trunc(Math.pow(H.illness, 1.52) * 3 + 2); // 5, 10, 17, 26, 36 points of damage per respective level of illness + } + + // Calculating tired changes + // Reducing condition for tired slaves + tired(slave); + if (H.tired > 100) { + tiredToCondition += Math.trunc((H.tired - 100) * 0.5) + normalRandInt(5, 0.5); + H.tired = 100; + } else if (H.tired > 80) { + tiredToCondition += normalRandInt(5, 0.5); + } else if (H.tired > 50) { + tiredToCondition += normalRandInt(2, 0.5); + } else { + H.tired = Math.max(H.tired, 0); + } + if (tiredToCondition > 0) { + H.condition -= tiredToCondition; + } + + // Long term damage due to age calculated on birthdays only + if (slave.birthWeek === 0 && slave.age > 29) { + H.longDamage += Math.trunc((slave.age - 25 + jsRandom(1, 15)) / 20); + } + + } else if (slave.condition < 100) { // The player gets an automatic 5 condition recovery each weak up to 100 + slave.condition = Math.min(slave.condition + 5, 100); } // recovering and transfering short term damage to condition and long term if (H.shortDamage > 0) { shortToCondition += Math.max(Math.trunc(H.shortDamage * 0.25), 1); // 25% of short term damage gets transfered H.shortDamage -= shortToCondition; - if (slave.curatives > 0) { // transferred damage is half if on preventatives/curatives + if (slave.curatives > 0 || slave.ID === -1) { // transferred damage is half if on preventatives/curatives or target is the player shortToCondition = Math.trunc(shortToCondition * 0.5); } H.condition -= shortToCondition; @@ -170,28 +200,6 @@ window.endWeekHealthDamage = function endWeekHealthDamage(slave) { // Run at the H.longDamage += shortToLong; } - // Calculating tired changes - // Reducing condition for tired slaves - tired(slave); - if (H.tired > 100) { - tiredToCondition += Math.trunc((H.tired - 100) * 0.5) + normalRandInt(5, 0.5); - H.tired = 100; - } else if (H.tired > 80) { - tiredToCondition += normalRandInt(5, 0.5); - } else if (H.tired > 50) { - tiredToCondition += normalRandInt(2, 0.5); - } else { - H.tired = Math.max(H.tired, 0); - } - if (tiredToCondition > 0) { - H.condition -= tiredToCondition; - } - - // Long term damage due to age calculated on birthdays only - if (slave.birthWeek === 0 && slave.age > 29) { - H.longDamage += Math.trunc((slave.age - 25 + jsRandom(1, 15)) / 20); - } - // Making sure condition doesn't get too high if (H.condition > 150) { H.condition -= Math.trunc(Math.pow(H.condition - 150, 0.5)); diff --git a/src/init/dummy.tw b/src/init/dummy.tw index 6f15512d8881663845a541c446511da843df65d6..f153afe43697edfe36b253418b46d70117edc366 100644 --- a/src/init/dummy.tw +++ b/src/init/dummy.tw @@ -27,7 +27,7 @@ $activeSlave.sexAmount, $activeSlave.sexQuality $activeSlave.fertKnown $activeSlave.cum $drugs, $harshCollars, $shoes, $bellyAccessories, $vaginalAccessories, $dickAccessories, $buttplugs -$PC.origRace, $PC.origSkin, $PC.majorInjury, $PC.criticalDamage +$PC.origRace, $PC.origSkin, $PC.criticalDamage $PC.eye.left.vision $PC.relationships.marriage, $PC.relationships.lovers, $PC.relationships.FWBs, $PC.relationships.BFFs, $PC.relationships.friends, $PC.relationships.likes, $PC.relationships.dislikes, $PC.relationships.hates, $PC.relationships.loathes, $PC.relationships.obsession $servantsQuartersSpots diff --git a/src/interaction/main/mainLinks.js b/src/interaction/main/mainLinks.js index c375f7ab6605d3831d8c0decea516e59361e127e..2512ab8cc9a8d4c8905af409a8de844ee85a72d1 100644 --- a/src/interaction/main/mainLinks.js +++ b/src/interaction/main/mainLinks.js @@ -4,7 +4,7 @@ App.UI.View.MainLinks = function() { const PA = Array.isArray(V.personalAttention) ? V.personalAttention.map(x => getSlave(x.ID)) : []; let r = ''; - if (V.PC.majorInjury === 1) { + if (V.PC.health.shortDamage >= 30) { r += `The injuries received in the recent battle prevent you from undertaking tiring efforts.`; } else { switch (V.personalAttention) { @@ -75,7 +75,7 @@ App.UI.View.MainLinks = function() { } } - if (V.PC.majorInjury !== 1) { + if (V.PC.health.shortDamage < 30) { r += ` <span id="managePA"><strong><<link "Change plans">><<goto "Personal Attention Select">><</link>></strong></span> <span class="cyan">[A]</span>`; } diff --git a/src/js/datatypeCleanupJS.js b/src/js/datatypeCleanupJS.js index e12b1c57f719edeeec4cac2b283946fb1e5a7871..0d496b04151cc968c6b9fb6923034fd7d556fe69 100644 --- a/src/js/datatypeCleanupJS.js +++ b/src/js/datatypeCleanupJS.js @@ -1695,7 +1695,21 @@ window.PCDatatypeCleanup = function PCDatatypeCleanup() { PC.muscles = Math.clamp(+PC.muscles, -100, 100) || 50; PC.hLength = Math.clamp(+PC.hLength, 0, 150) || 2; PC.voice = Math.clamp(+PC.voice, 1, 3) || 1; - PC.majorInjury = Math.max(+PC.majorInjury, 0) || 0; + PC.health.condition = Math.clamp(PC.health.condition, -100, 100) || 0; + if (PC.majorInjury !== undefined) { + if (PC.majorInjury > 0) { + PC.health.shortDamage = Math.max(PC.majorInjury * 20, 30); + } else { + PC.health.shortDamage = 0; + } + delete PC.majorInjury; + } else { + PC.health.shortDamage = Math.max(+PC.health.shortDamage, 0) || 0; + } + PC.health.longDamage = Math.max(+PC.health.longDamage, 0) || 0; + PC.health.illness = Math.max(+PC.health.illness, 0) || 0; + PC.health.tired = Math.clamp(+PC.health.tired, 0, 100) || 0; + PC.health.health = Math.clamp(PC.health.condition - PC.health.shortDamage - PC.health.longDamage, -100, 100) || 0; if (typeof PC.rules.living !== "string") { PC.rules.living = "normal"; } diff --git a/src/js/storyJS.js b/src/js/storyJS.js index b4977dce532fd3390862312c428a460f8f6f8de2..153139cd8a4fd7eb386d0fce1f660c0aa36f2098 100644 --- a/src/js/storyJS.js +++ b/src/js/storyJS.js @@ -429,7 +429,7 @@ window.overpowerCheck = function(slave, PC) { strength += (185-slave.height); strength -= (PC.belly/1000); strength += (PC.skill.warfare/3); - strength -= (State.variables.PC.majorInjury * 15); + strength -= (State.variables.PC.health.shortDamage); return strength; }; diff --git a/src/player/js/PlayerState.js b/src/player/js/PlayerState.js index 1f2f2b0c63b8d4d71c35f899f727041c33a03b4e..92ddbc6db0fb4ad4c7429ed45ae965608537741f 100644 --- a/src/player/js/PlayerState.js +++ b/src/player/js/PlayerState.js @@ -404,11 +404,6 @@ App.Entity.PlayerState = class PlayerState { * @type {number | string} */ this.minorInjury = 0; - /** - * you have a major injury (will replace the injured PC global) - * @type {number | string} - */ - this.majorInjury = 0; /** * you have a life-changing injury/malaise * @type {number | string} diff --git a/src/pregmod/sePlayerBirth.tw b/src/pregmod/sePlayerBirth.tw index b71e31ebbf868980bd611aec4c11d462de41ecf5..bdbca2f97e07e0a7ef7648e50f122478c5444e07 100644 --- a/src/pregmod/sePlayerBirth.tw +++ b/src/pregmod/sePlayerBirth.tw @@ -554,7 +554,7 @@ You arrange yourself to give birth, relaxing until your body urges you to begin <<if _wounded == 1>> Things didn't quite go as planned, leaving you @@.red;weak and wounded.@@ You'll need a couple weeks to recover from the ordeal before you're back on your feet. - <<set $PC.majorInjury = 2>> + <<run healthDamage($PC, 40)>> <</if>> <</if>> /*closes gaveBirth*/ diff --git a/src/uncategorized/persBusiness.tw b/src/uncategorized/persBusiness.tw index c54d799f36d83737603cf14c8742356e03b60c4c..3d7098c7efddeebf877aef640da75f8626719f1f 100644 --- a/src/uncategorized/persBusiness.tw +++ b/src/uncategorized/persBusiness.tw @@ -27,13 +27,13 @@ <<set $gameover = "debt">><<goto "Gameover">> <</if>> <</if>> -<<elseif $PC.majorInjury>> - <<if $PC.majorInjury > 0>> - <<set $PC.majorInjury-->> +<<elseif $PC.health.shortDamage >= 30>> + <<if $PC.health.shortDamage >= 30>> + <<run endWeekHealthDamage($PC)>> The injuries received in the recent battle prevents you from engaging in tiring endeavors. - <<if $PC.majorInjury > 1>> + <<if $PC.health.shortDamage >= 51>> Your trusted physician believes it will still take a few weeks to fully recover. - <<elseif $PC.majorInjury == 1>> + <<elseif $PC.health.shortDamage >= 39>> You are starting to feel better. It's very likely you will be back to full working order within the next week. <<else>> You have finally recovered from your injuries. @@ -421,7 +421,7 @@ /* <<set _X = 0>> */ /* <</if>> */ -<<if $PC.majorInjury == 0>> +<<if $PC.health.shortDamage < 30>> <<switch $personalAttention>> <<case "trading">> <<set _oldSkill = $PC.skill.trading>>