diff --git a/src/events/nonRandom/mercs/pRaidResult.js b/src/events/nonRandom/mercs/pRaidResult.js index 6ab82ec8a0db5ef4fb340016efd29f75a1d1720c..a0503b03e76be7a7f8ba38527b0c0c845f3b8070 100644 --- a/src/events/nonRandom/mercs/pRaidResult.js +++ b/src/events/nonRandom/mercs/pRaidResult.js @@ -1,77 +1,95 @@ - :: P raid result [nobr] +App.Events.PRaidResult = class PRaidResult extends App.Events.BaseEvent { + eventPrerequisites() { + return [ + () => V.eventResults.raid === 1, + ]; + } - V.nextButton = "Continue", V.nextLink = "Random Nonindividual Event"; + execute(node) { + let r = []; + + V.nextButton = "Continue"; + V.nextLink = "Random Nonindividual Event"; V.eventResults.raid = 0; + App.Events.addParagraph(node, [`As your VTOL craft carries you and your mercenaries out towards an area ideal for a quick raid on the refugee bands, the sensors begin to reveal that there are actually many more bands than you originally suspected. The single aircraft does not carry enough mercenaries to target more than one group, or have the cargo capacity to haul more than one back to the arcology before they disperse. Your mercenary commander makes a selection based on your instructions.`]); - As your VTOL craft carries you and your mercenaries out towards an area ideal for a quick raid on the refugee bands, the sensors begin to reveal that there are actually many more bands than you originally suspected. The single aircraft does not carry enough mercenaries to target more than one group, or have the cargo capacity to haul more than one back to the arcology before they disperse. Your mercenary commander makes a selection based on your instructions. - <br><br> - Out ahead of the main body of refugees there is a small knot moving quickly and in good order, carrying weapons. Farther back, there is a larger group separated from the main body who could be easily isolated. And finally, it seems a group of sick and injured refugees have clustered around a tent where there must be medical assistance of some kind. - <br><br> + App.Events.addParagraph(node, [`Out ahead of the main body of refugees there is a small knot moving quickly and in good order, carrying weapons. Farther back, there is a larger group separated from the main body who could be easily isolated. And finally, it seems a group of sick and injured refugees have clustered around a tent where there must be medical assistance of some kind.`]); - _newSlaves = []; + const _newSlaves = []; if (V.eventResults.raidTarget === 1) { r.push(`Under orders to target resistance, your mercenaries target the leading group. They even manage to direct a little small arms fire at the VTOL craft as it circles them, dropping mercenaries and plying its nonlethal weapons, but they are of course rapidly defeated. Your share is two slaves in good physical condition, who prove to have been survivors of the defeated attack on the arcology. The mercenaries find after a data search that one of the prisoners whose part of their share was a minor leader in the anti-Free Cities movement. After a quick consultation over their radios, the mercenaries decide that a summary execution out here would be too quick for the wretch, and bring their prize back to the arcology for more thorough punishment. Between the successful raid and the capture of this public enemy, <span class="green">the citizens are quite impressed by you.</span>`); repX(2500, "event"); - <<for _prr = 0; _prr < 3; _prr++>> + for (let _prr = 0; _prr < 3; _prr++) { if (V.seeDicks > 0) { - _slave = GenerateNewSlave("XY"); + const _slave = GenerateNewSlave("XY"); _slave.origin = "${He} is an enslaved refugee who participated in the defeated attack on your arcology."; _newSlaves.push(_slave); } else { - _slave = GenerateNewSlave("XX"); + const _slave = GenerateNewSlave("XX"); _slave.origin = "${He} is an enslaved refugee who participated in the defeated attack on your arcology."; _newSlaves.push(_slave); } - <</for>> + } } else if (V.eventResults.raidTarget === 2) { r.push(`Under orders to target civilians, your mercenaries head for the isolated group. When the VTOL descends to circle around the large group of refugees, it becomes obvious that it won't even be necessary to expend nonlethal ammunition. A few of the refugees throw themselves down in bitterness, but most just subside into the catatonia of helplessness. They stand quiescent as they are searched, tagged, and loaded onto the VTOL like the wretched human refuse they are. The successful raid <span class="green">is the talk of the Free City.</span>`); repX(1000, "event"); - <<for _prr = 0; _prr < 4; _prr++>> - _slave = GenerateNewSlave(); - _slave.origin = "${He} is an enslaved refugee."; + for (let _prr = 0; _prr < 4; _prr++) { + const _slave = GenerateNewSlave(); + _slave.origin = "$He is an enslaved refugee."; _newSlaves.push(_slave); - <</for>> + } } else { - _nurseGender = V.seeDicks === 100 ? 100 : 0; - r.push(`/* nurse gender is female unless seeDicks is 100 */setNonlocalPronouns V.seeDicksUnder orders to target the largest possible group of people, your mercenaries head for the sick and injured. As the VTOL settles, it becomes apparent that most of the injuries are from combat, almost certainly in the defeat at ${V.arcologies[0].name}. The tent proves to contain a harassed nurse, almost without medical supplies and at the end of${ _hisU} rope. When _heU sees the mercenaries push through the tent flap, _heU heaves a sigh of mixed defeat and relief and wordlessly offers _hisU wrists. The mercenaries give you a larger share of the other slaves in return for _himU: they tell you in confidence that _heU'll be a medical asset to them as well as the usual amusement. The successful raid <span class="green">is the talk of the Free City.</span>`); + const { + heU, hisU, himU + } = getNonlocalPronouns(V.seeDicks === 100 ? 100 : 0).appendSuffix("U"); /* nurse gender is female unless seeDicks is 100 */ + r.push(`Under orders to target the largest possible group of people, your mercenaries head for the sick and injured. As the VTOL settles, it becomes apparent that most of the injuries are from combat, almost certainly in the defeat at ${V.arcologies[0].name}. The tent proves to contain a harassed nurse, almost without medical supplies and at the end of ${hisU} rope. When ${heU} sees the mercenaries push through the tent flap, ${heU} heaves a sigh of mixed defeat and relief and wordlessly offers ${hisU} wrists. The mercenaries give you a larger share of the other slaves in return for ${himU}: they tell you in confidence that ${heU}'ll be a medical asset to them as well as the usual amusement. The successful raid <span class="green">is the talk of the Free City.</span>`); V.eventResults.slaveMedic = 1; repX(1000, "event"); - <<for _prr = 0; _prr < 5; _prr++>> - _slave = GenerateNewSlave(); - _slave.origin = "${He} is an enslaved refugee who was wounded in the defeated attack on your arcology."; + for (let _prr = 0; _prr < 5; _prr++) { + const _slave = GenerateNewSlave(); + _slave.origin = "$He is an enslaved refugee who was wounded in the defeated attack on your arcology."; setHealth(_slave, jsRandom(-50, 40), normalRandInt(20, 3), normalRandInt(15, 3), Math.max(normalRandInt(0, 1), 0), jsRandom(40, 80)); _newSlaves.push(_slave); - <</for>> + } } - <br><br> + App.Events.addParagraph(node, r); + + const choices = []; + choices.push(new App.Events.Result(`Sell your prisoners immediately`, sell)); + choices.push(new App.Events.Result(`Give your prisoners to citizens injured in the recent invasion`, give)); + choices.push(new App.Events.Result(`Enslave all of the refugees`, enslave)); + App.Events.addResponses(node, choices); - <span id="result"> - <<link "Sell your prisoners immediately">> - <<replace "#result">> - <<for _prr = 0; _prr < _newSlaves.length; _prr++>> - _slaveCost = slaveCost(_newSlaves[_prr]); + function sell() { + for (const slave of _newSlaves) { + const _slaveCost = slaveCost(slave); cashX(_slaveCost, "slaveTransfer"); - <</for>> - r.push(`Prisoners sold./replace>> - <</link>> - <br> - <<link "Give your prisoners to citizens injured in the recent invasion">> - <<replace "#result">> - <<for _prr = 0; _prr < _newSlaves.length; _prr++>> - _slaveCost = slaveCost(_newSlaves[_prr]); - repX(Math.trunc(_slaveCost/10), "event"); - <</for>> - r.push(`Prisoners <span class="green">given away.</span>`); - <</replace>> - <</link>> - <br> - <<link "Enslave all of the refugees">> - <<replace "#result">> - <<for _prr = 0; _prr < _newSlaves.length; _prr++>> - newSlave(_newSlaves[_prr]); - r.push(`/* skip New Slave Intro */`); - <</forYou simply enslave all of the refugees yourself. They would have been worse off had you not intervened.`); - <</replace>> - <</link>> - </span> \ No newline at end of file + } + return `Prisoners sold.`; + } + + function give() { + const frag = new DocumentFragment(); + let r = []; + for (const slave of _newSlaves) { + const _slaveCost = slaveCost(slave); + repX(Math.trunc(_slaveCost / 10), "event"); + } + r.push(`Prisoners <span class= "reputation inc"> given away.</span>`); + App.Events.addParagraph(frag, r); + return frag; + } + + function enslave() { + const frag = new DocumentFragment(); + let r = []; + for (const slave of _newSlaves) { + newSlave(slave); + } + r.push(`You simply enslave all of the refugees yourself. They would have been worse off had you not intervened.`); + App.Events.addParagraph(frag, r); + return frag; + } + } +}; diff --git a/src/events/nonRandomEvent.js b/src/events/nonRandomEvent.js index cfc792730f5cd1a9ef669b210a6c47b5dbdc9c21..4be62aeaea83963a60bf09b2dadae2b9ac7bfd41 100644 --- a/src/events/nonRandomEvent.js +++ b/src/events/nonRandomEvent.js @@ -104,6 +104,7 @@ App.Events.getNonrandomEvents = function() { new App.Events.PEPitFight(), new App.Events.PMercsHelpCorp(), new App.Events.PMercenaryRomeo(), + new App.Events.PRaidResult(), ]; }; @@ -290,8 +291,6 @@ globalThis.nonRandomEvent = function() { setTimeout(() => Engine.play("RE The Siren Strikes Back"), Engine.minDomActionDelay); } else if (V.eventResults.snatch === 1) { setTimeout(() => Engine.play("P snatch and grab result"), Engine.minDomActionDelay); - } else if (V.eventResults.raid === 1) { - setTimeout(() => Engine.play("P raid result"), Engine.minDomActionDelay); } else if (V.eventResults.slaveMedic > 0) { setTimeout(() => Engine.play("P slave medic"), Engine.minDomActionDelay); } else if ((effectiveWeek >= 37) && (V.arcologies[0].FSNeoImperialistLaw1 === 1) && (V.arcologies[0].FSNeoImperialistLaw2 === 1) && V.poorKnight !== 1 && effectiveWeek >= V.imperialEventWeek + 3) {