From 7cd068eaacb53fa100436abef690be93ea0b0557 Mon Sep 17 00:00:00 2001 From: x <okp57855@psoxs.com> Date: Thu, 7 Feb 2019 12:59:19 +1300 Subject: [PATCH] add Part II --- devNotes/Useful JS Function Documentation.txt | 6 +- src/SecExp/SecExp.js | 828 +++++++++++++- src/SecExp/SecExpBackwardCompatibility.tw | 1017 ----------------- src/SecExp/secInit.tw | 351 ------ src/SpecialForce/SpecialForce.js | 16 - src/init/storyInit.tw | 2 +- src/js/utilJS.js | 24 + src/uncategorized/BackwardsCompatibility.tw | 2 +- src/uncategorized/options.tw | 6 +- 9 files changed, 853 insertions(+), 1399 deletions(-) delete mode 100644 src/SecExp/SecExpBackwardCompatibility.tw delete mode 100644 src/SecExp/secInit.tw diff --git a/devNotes/Useful JS Function Documentation.txt b/devNotes/Useful JS Function Documentation.txt index 98e7c10df6a..cb4a6092865 100644 --- a/devNotes/Useful JS Function Documentation.txt +++ b/devNotes/Useful JS Function Documentation.txt @@ -344,4 +344,8 @@ UtilJS [script] ordinalSuffix(i) - takes a value as an input and then appends the appropriate suffix. e.g.$Day === 1 "today is the <<print ordinalSuffix($Day)>> of the month" would print "today is the 1st of the month" - removeDuplicates() - Takes an array and returns a new array without duplicate entries \ No newline at end of file + removeDuplicates() - Takes an array and returns a new array without duplicate entries + + HSM() - outputs a value based off of the PC's hacking skill. + + ndefJS() and defJS() - quick JS ports of sugarcube's def and ndef respectively. \ No newline at end of file diff --git a/src/SecExp/SecExp.js b/src/SecExp/SecExp.js index ee6b302ccb7..edfdd112b1f 100644 --- a/src/SecExp/SecExp.js +++ b/src/SecExp/SecExp.js @@ -1,22 +1,832 @@ window.SecExpUnitUpgradeCosts = function(Unit) { "use strict"; - const V = State.variables, T = State.temporary; T.cost={}; let r = ``; + const V = State.variables, T = State.temporary, UpgradeCost={equip:250,secBots:250}; T.cost={}; let r = ``; T.cost.overall=0; T.cost.size=0; T.cost.equip=0; T.cost.commissars=0; T.cost.cyber=0; T.cost.medics=0; T.cost.sf=0; if (Unit === V.secBots) { if (V.secBots.maxTroops < 80) { T.cost.size += 5000; } else if (V.SF.Toggle && V.SF.Active >= 1 && V.secBots.maxTroops < 100 && V.SFSupportLevel >= 1) { - T.cost.size += 5000 + 10 * V.secBotsUpgradeCost * V.secBots.equip; + T.cost.size += 5000 + 10 * UpgradeCost.secBots * V.secBots.equip; } - if (V.secBots.equip < 3) T.cost.equip += V.secBotsUpgradeCost * V.secBots.maxTroops + 1000; + if (V.secBots.equip < 3) T.cost.equip += UpgradeCost.secBots * V.secBots.maxTroops + 1000; } else { if (Unit[V.targetIndex].maxTroops < 50) { - T.cost.size += 5000 + 10 * V.equipUpgradeCost * (Unit[V.targetIndex].equip + Unit[V.targetIndex].commissars + Unit[V.targetIndex].cyber + Unit[V.targetIndex].SF); + T.cost.size += 5000 + 10 * UpgradeCost.equip * (Unit[V.targetIndex].equip + Unit[V.targetIndex].commissars + Unit[V.targetIndex].cyber + Unit[V.targetIndex].SF); } - if (Unit[V.targetIndex].equip < 3) T.cost.equip += V.equipUpgradeCost * Unit[V.targetIndex].maxTroops + 1000; - if (Unit[V.targetIndex].commissars < 2) T.cost.commissars += V.equipUpgradeCost * Unit[V.targetIndex].maxTroops + 1000; - if (Unit[V.targetIndex].cyber < 1 && (V.prostheticsUpgrade >= 2 || V.researchLab.advCombatPLimb == 1) ) T.cost.cyber += V.equipUpgradeCost * Unit[V.targetIndex].maxTroops + 2000; - if (Unit[V.targetIndex].medics < 1) T.cost.medics += V.equipUpgradeCost * Unit[V.targetIndex].maxTroops + 1000; - if (Unit[V.targetIndex].SF < 1 && V.SF.Toggle && V.SF.Active >= 1) T.cost.sf += V.equipUpgradeCost * Unit[V.targetIndex].maxTroops + 5000; + if (Unit[V.targetIndex].equip < 3) T.cost.equip += UpgradeCost.equip * Unit[V.targetIndex].maxTroops + 1000; + if (Unit[V.targetIndex].commissars < 2) T.cost.commissars += UpgradeCost.equip * Unit[V.targetIndex].maxTroops + 1000; + if (Unit[V.targetIndex].cyber < 1 && (V.prostheticsUpgrade >= 2 || V.researchLab.advCombatPLimb == 1) ) T.cost.cyber += UpgradeCost.equip * Unit[V.targetIndex].maxTroops + 2000; + if (Unit[V.targetIndex].medics < 1) T.cost.medics += UpgradeCost.equip * Unit[V.targetIndex].maxTroops + 1000; + if (Unit[V.targetIndex].SF < 1 && V.SF.Toggle && V.SF.Active >= 1) T.cost.sf += UpgradeCost.equip * Unit[V.targetIndex].maxTroops + 5000; } T.cost.overall += T.cost.size+T.cost.equip+T.cost.commissars+T.cost.cyber+T.cost.medics+T.cost.sf; +}; + +window.SecBC = function() { + "use strict"; + const V = State.variables, T = State.temporary; let r = ``; + + //base stats + if (ndefJS(V.authority)) V.authority = 0; + if (ndefJS(V.security)) V.security = 30; + if (ndefJS(V.secRestPoint)) V.secRestPoint = 40; + if (ndefJS(V.crime)) V.crime = 30; + if (ndefJS(V.crimeCap)) V.crimeCap = 100; + if (ndefJS(V.readiness)) V.readiness = 1; + if (ndefJS(V.recon)) V.recon = 0; + if (ndefJS(V.maxUnits)) V.maxUnits = 6; + if (ndefJS(V.trade)) V.trade = 0; r += `<<calcInitialTrade>>`; + if (ndefJS(V.activeUnits)) V.activeUnits = 0; + if (ndefJS(V.attackType)) V.attackType = "none"; + if (ndefJS(V.attackThisWeek)) V.attackThisWeek = 0; + if (ndefJS(V.lastAttackWeeks)) V.lastAttackWeeks = 0; + V.lastRebellionWeeks = Number(V.lastRebellionWeeks) || 0; + if (ndefJS(V.hasFoughtOnce)) V.hasFoughtOnce = 0; + if (ndefJS(V.hasFoughtMajorBattleOnce)) V.hasFoughtMajorBattleOnce = 0; + if (ndefJS(V.hasRebelledOnce)) V.hasRebelledOnce = 0; + if (ndefJS(V.majorBattle)) V.majorBattle = 0; + if (ndefJS(V.PCvictoryStreak)) V.PCvictoryStreak = 0; + if (ndefJS(V.PClossStreak)) V.PClossStreak = 0; + if (ndefJS(V.oldFlux)) V.oldFlux = 0; + if (ndefJS(V.wasToggledBefore)) V.wasToggledBefore = 0; + if (ndefJS(V.showBattleStatistics)) V.showBattleStatistics = 0; + if (ndefJS(V.forceBattle)) V.forceBattle = 0; + if (ndefJS(V.forceMajorBattle)) V.forceMajorBattle = 0; + if (ndefJS(V.foughtThisWeek)) V.foughtThisWeek = 0; + if (ndefJS(V.battlesEnabled)) V.battlesEnabled = 1; + if (ndefJS(V.battlesEnabledOceanic)) V.battlesEnabledOceanic = 0; + if (ndefJS(V.majorBattlesEnabled)) V.majorBattlesEnabled = 1; + if (ndefJS(V.majorBattleGameOver)) V.majorBattleGameOver = 1; + if (ndefJS(V.rebellionsEnabled)) V.rebellionsEnabled = 1; + if (ndefJS(V.forceRebellion)) V.forceRebellion = 0; + if (ndefJS(V.rebellionGameOver)) V.rebellionGameOver = 1; + if (ndefJS(V.allowPrestigeFromBattles)) V.allowPrestigeFromBattles = 1; + if (ndefJS(V.battleFrequency)) V.battleFrequency = 1; + if (ndefJS(V.rebellionSpeed)) V.rebellionSpeed = 1; + if (ndefJS(V.majorBattleMult)) V.majorBattleMult = 1; + + //edicts + if (ndefJS(V.edictsUpkeep)) V.edictsUpkeep = 0; + if (ndefJS(V.edictsAuthUpkeep)) V.edictsAuthUpkeep = 0; + if (ndefJS(V.alternativeRents)) V.alternativeRents = 0; + if (ndefJS(V.enslavementRights)) V.enslavementRights = 0; + if (ndefJS(V.securityExemption)) V.securityExemption = 0; + if (ndefJS(V.sellData)) V.sellData = 0; + if (ndefJS(V.propCampaignBoost)) V.propCampaignBoost = 0; + if (ndefJS(V.slaveWatch)) V.slaveWatch = 0; + if (ndefJS(V.subsidyChurch)) V.subsidyChurch = 0; + if (ndefJS(V.limitImmigration)) V.limitImmigration = 0; + if (ndefJS(V.openBorders)) V.openBorders = 0; + if (ndefJS(V.limitSubhumans)) V.limitSubhumans = 0; + if (ndefJS(V.slavesOfficers)) V.slavesOfficers = 0; + if (ndefJS(V.martialSchool)) V.martialSchool = 0; + if (ndefJS(V.discountMercenaries)) V.discountMercenaries = 0; + if (ndefJS(V.militiaFounded)) V.militiaFounded = 0; + if (ndefJS(V.recruitVolunteers)) V.recruitVolunteers = 0; + if (ndefJS(V.militaryService)) V.militaryService = 0; + if (ndefJS(V.militarizedSociety)) V.militarizedSociety = 0; + if (ndefJS(V.militaryExemption)) V.militaryExemption = 0; + if (ndefJS(V.lowerRquirements)) V.lowerRquirements = 0; + if (ndefJS(V.noSubhumansInArmy)) V.noSubhumansInArmy = 0; + if (ndefJS(V.pregExemption)) V.pregExemption = 0; + if (ndefJS(V.eliteOfficers)) V.eliteOfficers = 0; + if (ndefJS(V.liveTargets)) V.liveTargets = 0; + if (ndefJS(V.legionTradition)) V.legionTradition = 0; + if (ndefJS(V.eagleWarriors)) V.eagleWarriors = 0; + if (ndefJS(V.ronin)) V.ronin = 0; + if (ndefJS(V.sunTzu)) V.sunTzu = 0; + if (ndefJS(V.mamluks)) V.mamluks = 0; + if (ndefJS(V.pharaonTradition)) V.pharaonTradition = 0; + if (ndefJS(V.weaponsLaw)) V.weaponsLaw = 3; + if (ndefJS(V.soldierWages)) V.soldierWages = 1; + if (ndefJS(V.militiaSoldierPrivilege)) V.militiaSoldierPrivilege = 0; + if (ndefJS(V.slaveSoldierPrivilege)) V.slaveSoldierPrivilege = 0; + if (ndefJS(V.mercSoldierPrivilege)) V.mercSoldierPrivilege = 0; + if (ndefJS(V.tradeLegalAid)) V.tradeLegalAid = 0; + if (ndefJS(V.taxTrade)) V.taxTrade = 0; + + //proclamations + if (ndefJS(V.proclamationsCooldown)) V.proclamationsCooldown = 0; + if (ndefJS(V.proclamationCurrency)) V.proclamationCurrency = "authority"; + if (ndefJS(V.proclamationType)) V.proclamationType = "none"; + + //buildings + if (ndefJS(V.secHQ)) V.secHQ = 0; + if (ndefJS(V.secBarracks)) V.secBarracks = 0; + if (ndefJS(V.secBarracksUpgrades)) V.secBarracksUpgrades = { + size: 0, + luxury: 0, + training: 0, + loyaltyMod:0}; + if (ndefJS(V.secBarracksUpgrades.loyaltyMod)) V.secBarracksUpgrades.loyaltyMod = 0; + if (ndefJS(V.secMenials)) V.secMenials = V.secHelots || 0; delete V.secHelots; + if (ndefJS(V.reqMenials)) V.reqMenials = V.reqHelots || 20; delete V.reqHelots; + if (ndefJS(V.secUpgrades)) V.secUpgrades = { + nanoCams: 0, + cyberBots: 0, + eyeScan: 0, + cryptoAnalyzer: 0, + coldstorage: 0}; + if (ndefJS(V.crimeUpgrades)) V.crimeUpgrades = { + autoTrial: 0, + autoArchive: 0, + worldProfiler: 0, + advForensic: 0}; + if (ndefJS(V.intelUpgrades)) V.intelUpgrades = { + sensors: 0, + radar: 0, + signalIntercept: 0}; + if (ndefJS(V.readinessUpgrades)) V.readinessUpgrades = { + earlyWarn: 0, + rapidPlatforms: 0, + pathways: 0, + rapidVehicles: 0}; + if (ndefJS(V.propHub)) V.propHub = 0; + if (ndefJS(V.propCampaign)) V.propCampaign = 0; + if (ndefJS(V.propFocus)) V.propFocus = "none"; + if (ndefJS(V.miniTruth)) V.miniTruth = 0; + if (ndefJS(V.fakeNews)) V.fakeNews = 0; + if (ndefJS(V.controlLeaks)) V.controlLeaks = 0; + if (ndefJS(V.secretService)) V.secretService = 0; + if (ndefJS(V.blackOps)) V.blackOps = 0; + if (ndefJS(V.marketInfiltration)) V.marketInfiltration = 0; + if (ndefJS(V.propHubUpkeep)) V.propHubUpkeep = V.facilityCost * 5; + if (ndefJS(V.secHQUpkeep)) V.secHQUpkeep = V.facilityCost * 5; + if (ndefJS(V.secBarracksUpkeep)) V.secBarracksUpkeep = V.facilityCost * 5; + if (ndefJS(V.upgradeUpkeep)) V.upgradeUpkeep = 50; + if (ndefJS(V.riotCenter)) V.riotCenter = 0; + if (ndefJS(V.riotUpkeep)) V.riotUpkeep = V.facilityCost * 5; + if (ndefJS(V.riotUpgrades)) V.riotUpgrades = { + freeMedia: 0, + rapidUnit: 0, + rapidUnitSpeed: 0}; + if (ndefJS(V.fort)) V.fort = { + reactor: 0, + waterway: 0, + assistant: 0}; + if (ndefJS(V.sentUnitCooldown)) V.sentUnitCooldown=0; + if (ndefJS(V.advancedRiotEquip)) V.advancedRiotEquip=0; + if (ndefJS(V.brainImplant)) V.brainImplant = -1; + if (ndefJS(V.brainImplantProject)) V.brainImplantProject=0; + if (defJS(V.weapHelots)) V.weapMenials = V.weapHelots || 0; delete V.weapHelots; + if (ndefJS(V.weapManu)) V.weapManu = 0; + if (ndefJS(V.weapProductivity)) V.weapProductivity = 1; + if (ndefJS(V.weapLab)) V.weapLab = 1; + if (ndefJS(V.baseUpgradeTime)) V.baseUpgradeTime = 10; + if (ndefJS(V.weapUpgrades)) V.weapUpgrades = []; + if (ndefJS(V.currentUpgrade)) { V.currentUpgrade = { + ID: 0, + name: " ", + unit: 0, + type: 0, + time: 0, + value: 0}; + } else { + if (ndefJS(V.currentUpgrade.ID)) { + if (V.currentUpgrade.name == "magnetic based ballistic weaponry") { + V.currentUpgrade.ID=0; + } else if (V.currentUpgrade.name == "ceramo-metallic alloys") { + V.currentUpgrade.ID = 1; + } else if (V.currentUpgrade.name == "rapid action stimulants") { + V.currentUpgrade.ID = 2; + } else if (V.currentUpgrade.name == "fast response neural stimulant") { + V.currentUpgrade.ID = 3; + } else if (V.currentUpgrade.name == "universal cyber enhancements") { + V.currentUpgrade.ID = 4; + } else if (V.currentUpgrade.name == "remote neural links") { + V.currentUpgrade.ID = 5; + } else if (V.currentUpgrade.name == "combined training regimens with the special force") { + V.currentUpgrade.ID = 6; + } else if (V.currentUpgrade.name == "a variant of the stimulant cocktail that the special force created") { + V.currentUpgrade.ID = 7; + } else if (V.currentUpgrade.name == "a mesh network based off the custom network of the special force") { + V.currentUpgrade.ID = 8; + } else if (V.currentUpgrade.name == "dynamic battle aware AI") { + V.currentUpgrade.ID = -1; + } else if (V.currentUpgrade.name == "adaptive armored frames") { + V.currentUpgrade.ID = -2; + } else if (V.currentUpgrade.name == "advanced synthetic alloys") { + V.currentUpgrade.ID = -3; + } + } + } + if (ndefJS(V.droneUpgrades)) { V.droneUpgrades = { + attack: 0, + defense: 0, + hp:0}; } else if (ndefJS(V.droneUpgrades)) { V.droneUpgrades = { + attack: 0, + defense: 0, + hp:0}; + } else { + if (isInt(V.droneUpgrades)) { + V.droneUpgrades = { + attack: 0, + defense: 0, + hp:0}; + } + } + if (ndefJS(V.droneUpgrades.attack) || !isInt(V.droneUpgrades.attack)) { + V.droneUpgrades.attack=0; + } + if (ndefJS(V.droneUpgrades.defense) || !isInt(V.droneUpgrades.defense)) { + V.droneUpgrades.defense=0; + } + if (ndefJS(V.droneUpgrades.hp) || !isInt(V.droneUpgrades.hp)) { + V.droneUpgrades.hp=0; + } + if (ndefJS(V.humanUpgrade)) { V.humanUpgrade = { + attack: 0, + defense: 0, + hp:0, + morale: 0}; } else if (ndefJS(V.humanUpgrade)) { V.humanUpgrade = { + attack: 0, + defense: 0, + hp:0, + morale: 0}; + } else { + if (isInt(V.humanUpgrade)) { + V.humanUpgrade = { + attack: 0, + defense: 0, + hp:0, + morale: 0}; + } + if (ndefJS(V.humanUpgrade.attack) || !isInt(V.humanUpgrade.attack)) V.humanUpgrade.attack=0; + if (ndefJS(V.humanUpgrade.defense) || !isInt(V.humanUpgrade.defense)) V.humanUpgrade.defense=0; + if (ndefJS(V.humanUpgrade.hp) || !isInt(V.humanUpgrade.hp)) V.humanUpgrade.hp=0; + if (ndefJS(V.humanUpgrade.morale) || !isInt(V.humanUpgrade.morale)) V.humanUpgrade.morale=0; + } + if (ndefJS(V.sellTo)) V.sellTo = { + citizen: 1, + raiders: 1, + oldWorld: 1, + FC: 1}; + if (ndefJS(V.completedUpgrades)) V.completedUpgrades = []; + if (ndefJS(V.transportHub)) V.transportHub=0; + if (ndefJS(V.airport)) V.airport = 1; + if (ndefJS(V.railway)) V.railway = 1; + if (ndefJS(V.docks)) V.docks = 1; + if (ndefJS(V.hubSecurity)) V.hubSecurity = 1; + + //events + if (ndefJS(V.smilingManProgress)) V.smilingManProgress=0; + if (ndefJS(V.investedFunds)) V.investedFunds=0; + if (ndefJS(V.relationshipLM)) V.relationshipLM=0; + if (ndefJS(V.captureRoute)) V.captureRoute=0; + if (ndefJS(V.collaborationRoute)) V.collaborationRoute=0; + if (ndefJS(V.smilingManWeek)) V.smilingManWeek=0; + if (ndefJS(V.globalCrisisWeeks)) V.globalCrisisWeeks=0; + if (ndefJS(V.smilingManFate)) V.smilingManFate = 4; + + //rebellions + if (ndefJS(V.tension)) V.tension=0; + if (ndefJS(V.slaveProgress)) V.slaveProgress=0; + if (ndefJS(V.citizenProgress)) V.citizenProgress=0; + if (ndefJS(V.slaveRebellionEventFires)) V.slaveRebellionEventFires=0; + if (ndefJS(V.citizenRebellionEventFires)) V.citizenRebellionEventFires=0; + if (ndefJS(V.slaveRebellion)) V.slaveRebellion=0; + if (ndefJS(V.citizenRebellion)) V.citizenRebellion=0; + if (ndefJS(V.rebellingUnits)) V.rebellingUnits = []; + if (ndefJS(V.notInvolved)) V.notInvolved=0; + if (ndefJS(V.engageRule)) V.engageRule=0; + if (ndefJS(V.irregulars)) V.irregulars=0; + if (ndefJS(V.rebellingMilitia)) V.rebellingMilitia=0; + if (ndefJS(V.rebellingSlaves)) V.rebellingSlaves=0; + if (ndefJS(V.rebellingMercs)) V.rebellingMercs=0; + if (ndefJS(V.repairTime)) V.repairTime = 3; + if (ndefJS(V.arcRepairTime)) V.arcRepairTime=0; + if (ndefJS(V.rebelDefeatAftermath)) V.rebelDefeatAftermath=0; + if (ndefJS(V.garrison)) { V.garrison = { + penthouse: 0, + reactor: 0, + assistant: 0, + waterway: 0, + reactorTime: 0, + assistantTime: 0, + waterwayTime: 0}; + } else { + if (ndefJS(V.garrison.penthouse)) V.garrison.penthouse=0; + if (ndefJS(V.garrison.reactor)) V.garrison.reactor=0; + if (ndefJS(V.garrison.assistant)) V.garrison.assistant=0; + if (ndefJS(V.garrison.waterway)) V.garrison.waterway=0; + if (ndefJS(V.garrison.reactorTime)) V.garrison.reactorTime=0; + if (ndefJS(V.garrison.assistantTime)) V.garrison.assistantTime=0; + if (ndefJS(V.garrison.waterwayTime)) V.garrison.waterwayTime=0; + } + if (ndefJS(V.rebellionsCount)) V.rebellionsCount=0; + if (ndefJS(V.PCrebWon)) V.PCrebWon=0; + if (ndefJS(V.PCrebLoss)) V.PCrebLoss=0; + + //armed forces stats + if (ndefJS(V.difficulty)) V.difficulty = 1; + if (ndefJS(V.targetUnit)) V.targetUnit=0; + if (ndefJS(V.targetIndex)) V.targetIndex=0; + if (ndefJS(V.secBotsCost)) V.secBotsCost = 500; + if (defJS(V.secBotsUpgradeCost)) delete V.secBotsUpgradeCost; + if (defJS(V.equipUpgradeCost)) delete V.equipUpgradeCost; + if (ndefJS(V.maxTroops)) V.maxTroops = 30; + if (ndefJS(V.militiaFounded)) V.militiaFounded=0; + if (ndefJS(V.militiaRecruitment)) V.militiaRecruitment=0; + if (ndefJS(V.militiaTotalManpower)) V.militiaTotalManpower=0; + if (ndefJS(V.militiaFreeManpower)) V.militiaFreeManpower=0; + if (ndefJS(V.militiaEmployedManpower)) V.militiaEmployedManpower=0; + if (ndefJS(V.militiaTotalCasualties)) V.militiaTotalCasualties=0; + if (ndefJS(V.slavesOfficers)) V.slavesOfficers=0; + if (ndefJS(V.slavesEmployedManpower)) V.slavesEmployedManpower=0; + if (ndefJS(V.slavesTotalCasualties)) V.slavesTotalCasualties=0; + if (ndefJS(V.slavesMaxTroops)) V.slavesMaxTroops = 30; + if (ndefJS(V.mercTotalManpower)) V.mercTotalManpower=0; + if (ndefJS(V.mercFreeManpower)) V.mercFreeManpower=0; + if (ndefJS(V.mercEmployedManpower)) V.mercEmployedManpower=0; + if (ndefJS(V.mercTotalCasualties)) V.mercTotalCasualties=0; + if (ndefJS(V.militiaLoyalty)) V.militiaLoyalty=0; + if (ndefJS(V.slaveArmyLoyalty)) V.slaveArmyLoyalty=0; + if (ndefJS(V.mercLoyalty)) V.mercLoyalty=0; + if (ndefJS(V.soldierUpkeep)) V.soldierUpkeep = 10; + if (ndefJS(V.createdSlavesUnits)) V.createdSlavesUnits=0; + if (ndefJS(V.createdMilitiaUnits)) V.createdMilitiaUnits=0; + if (ndefJS(V.createdMercUnits)) V.createdMercUnits=0; + + //battle relevant vars + if (ndefJS(V.troopCount)) V.troopCount=0; + if (ndefJS(V.slaveVictories)) V.slaveVictories = []; + if (ndefJS(V.slaveIncreasedPrestige)) V.slaveIncreasedPrestige=0; + if (ndefJS(V.totalKills)) V.totalKills=0; + if (ndefJS(V.battlesCount)) V.battlesCount=0; + if (ndefJS(V.majorBattlesCount)) V.majorBattlesCount=0; + if (ndefJS(V.chosenTactic)) V.chosenTactic = "none"; + if (ndefJS(V.leadingTroops)) V.leadingTroops = "none"; + if (ndefJS(V.attackTroops)) V.attackTroops=0; + if (ndefJS(V.attackEquip)) V.attackEquip=0; + if (ndefJS(V.deployableUnits)) V.deployableUnits=0; + if (ndefJS(V.deployedUnits)) V.deployedUnits=0; + if (ndefJS(V.deployingBots)) V.deployingBots=0; + if (ndefJS(V.deployingMilitia)) V.deployingMilitia=0; + if (ndefJS(V.deployingSlaves)) V.deployingSlaves=0; + if (ndefJS(V.deployingMercs)) V.deployingMercs=0; + if (ndefJS(V.battleTerrain)) V.battleTerrain = "none"; + if (ndefJS(V.maxTurns)) V.maxTurns = 10; + if (ndefJS(V.battleResult)) V.battleResult = 4; //sets V.battleResult value outside accepted range (-3,3)) V.to avoid evaluation problems + if (ndefJS(V.losses)) V.losses=0; + if (ndefJS(V.enemyLosses)) V.enemyLosses=0; + if (ndefJS(V.battleTurns)) V.battleTurns=0; + if (ndefJS(V.bribeCost)) V.bribeCost=0; + if (ndefJS(V.tacticsSuccessful)) V.tacticsSuccessful=0; + if (ndefJS(V.leaderWounded)) V.leaderWounded=0; //0=no wound, 1=mute, 2=blind, 3=amputee, 4=health + if (ndefJS(V.gainedCombat)) V.gainedCombat=0; + if (ndefJS(V.gainedWarfare)) V.gainedWarfare=0; + if (ndefJS(V.PCWounded)) V.PCWounded=0; + if (ndefJS(V.PCWoundCooldown)) V.PCWoundCooldown=0; + if (ndefJS(V.expectedEquip)) V.expectedEquip=0; + if (ndefJS(V.estimatedMen)) V.estimatedMen=0; + if (ndefJS(V.SFIntervention)) V.SFIntervention=0; + if (ndefJS(V.carriableSoldiers)) V.carriableSoldiers=0; + if (ndefJS(V.SFatk)) V.SFatk=0; + if (ndefJS(V.SFdef)) V.SFdef=0; + if (ndefJS(V.SFhp)) V.SFhp=0; + if (ndefJS(V.rebellingID)) V.rebellingID = []; + if (ndefJS(V.saveValid)) V.saveValid=0; + if (ndefJS(V.lastSelection)) V.lastSelection = []; + + //statistics + if (ndefJS(V.baseBribePerAttacker)) V.baseBribePerAttacker = 5; + if (ndefJS(V.equipMod)) V.equipMod = 0.15; + if (ndefJS(V.secBotsBaseAttack)) V.secBotsBaseAttack = 7 + V.droneUpgrades.attack; + if (ndefJS(V.secBotsBaseDefense)) V.secBotsBaseDefense = 3 + V.droneUpgrades.defense; + if (ndefJS(V.secBotsMorale)) V.secBotsMorale = 200; + if (ndefJS(V.secBotsBaseHp)) V.secBotsBaseHp = 3 + V.droneUpgrades.hp; + if (ndefJS(V.militiaBaseAttack)) V.militiaBaseAttack = 7 + V.humanUpgrade.attack; + if (ndefJS(V.militiaBaseDefense)) V.militiaBaseDefense = 5 + V.humanUpgrade.defense; + if (ndefJS(V.militiaBaseMorale)) V.militiaBaseMorale = 140 + V.humanUpgrade.morale; + if (ndefJS(V.militiaBaseHp)) V.militiaBaseHp = 3 + V.humanUpgrade.hp; + if (ndefJS(V.slaveBaseAttack)) V.slaveBaseAttack = 8 + V.humanUpgrade.attack; + if (ndefJS(V.slaveBaseDefense)) V.slaveBaseDefense = 3 + V.humanUpgrade.defense; + if (ndefJS(V.slaveBaseMorale)) V.slaveBaseMorale = 110 + V.humanUpgrade.morale; + if (ndefJS(V.slaveBaseHp)) V.slaveBaseHp = 3 + V.humanUpgrade.hp; + if (ndefJS(V.mercBaseAttack)) V.mercBaseAttack = 8 + V.humanUpgrade.attack; + if (ndefJS(V.mercBaseDefense)) V.mercBaseDefense = 4 + V.humanUpgrade.defense; + if (ndefJS(V.mercBaseMorale)) V.mercBaseMorale = 125 + V.humanUpgrade.morale; + if (ndefJS(V.mercBaseHp)) V.mercBaseHp = 4 + V.humanUpgrade.hp; + if (ndefJS(V.SFBaseAttack)) V.SFBaseAttack = 8 + V.humanUpgrade.attack; + if (ndefJS(V.SFBaseDefense)) V.SFBaseDefense = 4 + V.humanUpgrade.defense; + if (ndefJS(V.SFBaseMorale)) V.SFBaseMorale = 140 + V.humanUpgrade.morale; + if (ndefJS(V.SFBaseHp)) V.SFBaseHp = 4 + V.humanUpgrade.hp; + + if (ndefJS(V.raBaseAttack)) V.raBaseAttack = 7; + if (ndefJS(V.raBaseDefense)) V.raBaseDefense = 2; + if (ndefJS(V.raBaseMorale)) V.raBaseMorale = 100; + if (ndefJS(V.raBaseHp)) V.raBaseHp = 2; + if (ndefJS(V.fcBaseAttack)) V.fcBaseAttack = 6; + if (ndefJS(V.fcBaseDefense)) V.fcBaseDefense = 4; + if (ndefJS(V.fcBaseMorale)) V.fcBaseMorale = 130; + if (ndefJS(V.fcBaseHp)) V.fcBaseHp = 3; + if (ndefJS(V.owBaseAttack)) V.owBaseAttack = 8; + if (ndefJS(V.owBaseDefense)) V.owBaseDefense = 4; + if (ndefJS(V.owBaseMorale)) V.owBaseMorale = 110; + if (ndefJS(V.owBaseHp)) V.owBaseHp = 2; + if (ndefJS(V.ffBaseAttack)) V.ffBaseAttack = 9; + if (ndefJS(V.ffBaseDefense)) V.ffBaseDefense = 2; + if (ndefJS(V.ffBaseMorale)) V.ffBaseMorale = 160; + if (ndefJS(V.ffBaseHp)) V.ffBaseHp = 2; + + //units + if (ndefJS(V.secBots)) { + if (V.arcologyUpgrade.drones === 0) { + V.secBots = { + active: 0, + ID: -1, + isDeployed: 0, + troops: 0, + maxTroops: 0, + equip: 0}; + } else if (V.arcologyUpgrade.drones === 1) { + V.secBots = { + active: 1, + ID: -1, + isDeployed: 0, + troops: 30, + maxTroops: 30, + equip: 0}; + } + } + if (ndefJS(V.militiaUnits)) V.militiaUnits = []; + if (ndefJS(V.slaveUnits)) V.slaveUnits = []; + if (ndefJS(V.mercUnits)) V.mercUnits = []; + + //SFanon additions + if (ndefJS(V.SFSupportLevel)) V.SFSupportLevel=0; + if (ndefJS(V.SFSupportUpkeep)) V.SFSupportUpkeep=0; + if (ndefJS(V.secUpgrades.coldstorage)) V.secUpgrades.coldstorage=0; + if (ndefJS(V.SFGear)) V.SFGear=0; + if (ndefJS(V.SavedLeader)) V.SavedLeader = V.leadingTroops; + if (ndefJS(V.SavedSFI)) V.SavedSFI = V.SFIntervention; + + //recalculation widgets + r += `<<fixBrokenUnits>>`; + r += `<<fixBrokenStats>>`; + r += `<<fixBrokenFS>>`; + r += `<<recalcSecRestPoint>>`; + r += `<<recalcCrimeCap>>`; + r += `<<recalcReqMenials>>`; + r += `<<recalcManpower>>`; + r += `<<recalcEdictsUpkeep>>`; + r += `<<recalcBaseStats>>`; + r += `<<recalcUnits>>`; + + V.wasToggledBefore = 1; + r += `<br>Missing Security Expansion variables set. All done!`; + return r; +}; + +window.SecInit = function() { + "use strict"; + const V = State.variables, T = State.temporary; let r = ``; + + //base vars + V.authority = 0; + V.security = 30; + V.secRestPoint = 30; + V.crime = 30; + V.crimeCap = 100; + V.readiness = 1; + V.recon = 0; + V.maxUnits = 6; + V.trade = 0; + V.activeUnits = 0; + V.attackType = "none"; + V.attackThisWeek = 0; + V.lastAttackWeeks = 0; + V.lastRebellionWeeks = 0; + V.hasFoughtOnce = 0; + V.hasFoughtMajorBattleOnce = 0; + V.hasRebelledOnce = 0; + V.majorBattle = 0; + V.PCvictoryStreak = 0; + V.PCvictories = 0; + V.PClossStreak = 0; + V.PClosses = 0; + V.oldFlux = 0; + V.showBattleStatistics = 0; + V.forceBattle = 0; + V.forceMajorBattle = 0; + V.foughtThisWeek = 0; + V.battlesEnabled = 1; + V.battlesEnabledOceanic = 0; + V.majorBattlesEnabled = 1; + V.majorBattleGameOver = 1; + V.rebellionsEnabled = 1; + V.forceRebellion = 0; + V.rebellionGameOver = 1; + V.allowPrestigeFromBattles = 1; + V.battleFrequency = 1; + V.rebellionSpeed = 1; + V.majorBattleMult = 1; + + //edicts + V.edictsUpkeep = 0; + V.edictsAuthUpkeep = 0; + V.alternativeRents = 0; + V.enslavementRights = 0; + V.securityExemption = 0; + V.sellData = 0; + V.propCampaignBoost = 0; + V.slaveWatch = 0; + V.subsidyChurch = 0; + V.limitImmigration = 0; + V.openBorders = 0; + V.limitSubhumans = 0; + V.slavesOfficers = 0; + V.martialSchool = 0; + V.discountMercenaries = 0; + V.militiaFounded = 0; + V.recruitVolunteers = 0; + V.militaryService = 0; + V.militarizedSociety = 0; + V.militaryExemption = 0; + V.lowerRquirements = 0; + V.noSubhumansInArmy = 0; + V.pregExemption = 0; + V.eliteOfficers = 0; + V.liveTargets = 0; + V.legionTradition = 0; + V.eagleWarriors = 0; + V.ronin = 0; + V.sunTzu = 0; + V.mamluks = 0; + V.pharaonTradition = 0; + V.weaponsLaw = 3; + V.soldierWages = 1; + V.militiaSoldierPrivilege = 0; + V.slaveSoldierPrivilege = 0; + V.mercSoldierPrivilege = 0; + V.tradeLegalAid = 0; + V.taxTrade = 0; + + //proclamations + V.proclamationsCooldown = 0; + V.proclamationCurrency = "authority"; + V.proclamationType = "none"; + + //buildings + V.upgradeUpkeep = 40; + V.secHQ = 0; + V.secHQUpkeep = V.facilityCost * 5; + V.secBarracks = 0; + V.secBarracksUpkeep = V.facilityCost * 5; + V.secBarracksUpgrades ={ + size: 0, + luxury: 0, + training: 0, + loyaltyMod: 0}; + V.secMenials = 0; + V.reqMenials = 20; + V.secUpgrades = { + nanoCams: 0, + cyberBots: 0, + eyeScan: 0, + cryptoAnalyzer: 0, + coldstorage: 0}; + V.crimeUpgrades = { + autoTrial: 0, + autoArchive: 0, + worldProfiler: 0, + advForensic: 0}; + V.intelUpgrades = { + sensors: 0, + radar: 0, + signalIntercept: 0}; + V.readinessUpgrades = { + earlyWarn: 0, + rapidPlatforms: 0, + pathways: 0, + rapidVehicles: 0}; + V.propHub = 0; + V.propHubUpkeep = V.facilityCost * 5; + V.propCampaign = 0; + V.propFocus = "none"; + V.miniTruth = 0; + V.fakeNews = 0; + V.controlLeaks = 0; + V.secretService = 0; + V.blackOps = 0; + V.marketInfiltration = 0; + V.riotCenter = 0; + V.riotUpkeep = V.facilityCost * 5; + V.riotUpgrades = { + freeMedia: 0, + rapidUnit: 0, + rapidUnitSpeed: 0}; + V.fort = { + reactor: 0, + waterway: 0, + assistant:0}; + V.sentUnitCooldown = 0; + V.advancedRiotEquip = 0; + V.brainImplant = -1; + V.brainImplantProject = 0; + V.weapManu = 0; + V.weapMenials = 0; + V.weapProductivity = 1; + V.weapLab = 1; + V.baseUpgradeTime = 10; + V.currentUpgrade = { + name: " ", + unit: 0, + type: 0, + time: 0}; + V.droneUpgrades = { + attack: 0, + defense: 0, + hp:0}; + V.humanUpgrade = { + attack: 0, + defense: 0, + hp:0, + morale: 0}; + V.sellTo = { + citizen: 1, + raiders: 1, + oldWorld: 1, + FC: 1}; + V.completedUpgrades = []; + V.transportHub = 0; + V.airport = 0; + V.railway = 0; + V.docks = 0; + V.hubSecurity = 1; + + //events + V.smilingManProgress = 0; + V.investedFunds = 0; + V.relationshipLM = 0; + V.captureRoute = 0; + V.collaborationRoute = 0; + V.smilingManWeek = 0; + V.globalCrisisWeeks = 0; + V.smilingManFate = 4; + + //rebellions + V.tension = 0; + V.slaveProgress = 0; + V.citizenProgress = 0; + V.slaveRebellionEventFires = 0; + V.citizenRebellionEventFires = 0; + V.slaveRebellion = 0; + V.citizenRebellion = 0; + V.rebellingUnits = []; + V.notInvolved = 0; + V.irregulars = 0; + V.engageRule = 0; + V.rebellingMilitia = 0; + V.rebellingSlaves = 0; + V.rebellingMercs = 0; + V.repairTime = 3; + V.arcRepairTime = 0; + V.rebelDefeatAftermath = 0; + V.garrison = { + penthouse: 0, + reactor: 0, + assistant: 0, + waterway: 0, + reactorTime: 0, + assistantTime: 0, + waterwayTime: 0 }; + V.rebellionsCount = 0; + V.PCrebWon = 0; + V.PCrebLoss = 0; + + + //armed forces stats + V.difficulty = 1; + V.targetUnit = 0; + V.targetIndex = 0; + V.secBotsCost = 500; + V.maxTroops = 30; + V.militiaTotalManpower = 0; + V.militiaFreeManpower = 0; + V.militiaEmployedManpower = 0; + V.militiaTotalCasualties = 0; + V.slavesOfficers = 0; + V.slavesEmployedManpower = 0; + V.slavesTotalCasualties = 0; + V.mercTotalManpower = 0; + V.mercEmployedManpower = 0; + V.mercTotalCasualties = 0; + V.mercLoyalty = 0; + V.soldierUpkeep = 10; + V.createdSlavesUnits = 0; + V.createdMilitiaUnits = 0; + V.createdMercUnits = 0; + V.mercFreeManpower = 0; + if (V.wasToggledBefore == 0) { + if (V.mercenaries == 1) { + V.mercFreeManpower = random(5,20); + } else if (V.mercenaries > 1) { + V.mercFreeManpower = random(10,30); + } + } + + //battle relevant variables + V.troopCount = 0; + V.slaveVictories = []; + V.slaveIncreasedPrestige = 0; + V.totalKills = 0; + V.battlesCount = 0; + V.majorBattlesCount = 0; + V.chosenTactic = "none"; + V.leadingTroops = "none"; + V.attackTroops = 0; + V.attackEquip = 0; + V.deployableUnits = 0; + V.deployedUnits = 0; + V.deployingBots = 0; + V.deployingMilitia = 0; + V.deployingSlaves = 0; + V.deployingMercs = 0; + V.battleTerrain = "none"; + V.maxTurns = 10; + V.battleResult = 4; //sets V.battleResult value outside accepted range (-3,3) to avoid evaluation problems + V.losses = 0; + V.enemyLosses = 0; + V.battleTurns = 0; + V.bribeCost = 0; + V.tacticsSuccessful = 0; + V.leaderWounded = 0; + V.woundType = 0; //0=no wound, 1=mute, 2=blind, 3=amputee, 4<=health + V.gainedCombat = 0; + V.gainedWarfare = 0; + V.PCWounded = 0; + V.PCWoundCooldown = 0; + V.expectedEquip = 0; + V.estimatedMen = 0; + V.SFIntervention = 0; + V.carriableSoldiers = 0; + V.SFatk = 0; + V.SFdef = 0; + V.SFhp = 0; + V.rebellingID = []; + V.saveValid = 0; + V.lastSelection = []; + + //statistics + V.baseBribePerAttacker = 5; + V.equipMod = 0.15; + V.secBotsBaseAttack = 7; + V.secBotsBaseDefense = 3; + V.secBotsMorale = 200; + V.secBotsBaseHp = 3; + V.militiaBaseAttack = 7; + V.militiaBaseDefense = 5; + V.militiaBaseMorale = 140; + V.militiaBaseHp = 3; + V.slaveBaseAttack = 8; + V.slaveBaseDefense = 3; + V.slaveBaseMorale = 110; + V.slaveBaseHp = 3; + V.mercBaseAttack = 8; + V.mercBaseDefense = 4; + V.mercBaseMorale = 125; + V.mercBaseHp = 4; + V.SFBaseAttack = 8; + V.SFBaseDefense = 4; + V.SFBaseMorale = 140; + V.SFBaseHp = 4; + + V.raBaseAttack = 7; + V.raBaseDefense = 2; + V.raBaseMorale = 100; + V.raBaseHp = 2; + V.fcBaseAttack = 6; + V.fcBaseDefense = 4; + V.fcBaseMorale = 130; + V.fcBaseHp = 3; + V.owBaseAttack = 8; + V.owBaseDefense = 4; + V.owBaseMorale = 110; + V.owBaseHp = 2; + V.ffBaseAttack = 9; + V.ffBaseDefense = 2; + V.ffBaseMorale = 160; + V.ffBaseHp = 2; + + V.secBots = { + active: 0, + ID: -1, + isDeployed: 0, + troops: 0, + maxTroops: 0, + equip: 0} ; + V.militiaUnits = []; + V.slaveUnits = []; + V.mercUnits = []; + + //SFanon additions + V.SFSupportLevel = 0; + V.SFSupportUpkeep = 0; + V.SFGear = 0; + V.SavedLeader = "none"; + V.SavedSFI = 0; + + //helper widgets + r += `<<calcInitialTrade>>`; + return r; }; \ No newline at end of file diff --git a/src/SecExp/SecExpBackwardCompatibility.tw b/src/SecExp/SecExpBackwardCompatibility.tw deleted file mode 100644 index 3ec837428ca..00000000000 --- a/src/SecExp/SecExpBackwardCompatibility.tw +++ /dev/null @@ -1,1017 +0,0 @@ -:: SecExpBackwardCompatibility [nobr] - -<<set $nextButton = "Continue", $nextLink = "Main", $returnTo = "Main">> - -/* base stats */ -<<if ndef $authority>> - <<set $authority = 0>> -<</if>> -<<if ndef $security>> - <<set $security = 30>> -<</if>> -<<if ndef $secRestPoint>> - <<set $secRestPoint = 40>> -<</if>> -<<if ndef $crime>> - <<set $crime = 30>> -<</if>> -<<if ndef $crimeCap>> - <<set $crimeCap = 100>> -<</if>> -<<if ndef $readiness>> - <<set $readiness = 1>> -<</if>> -<<if ndef $recon>> - <<set $recon = 0>> -<</if>> -<<if ndef $maxUnits>> - <<set $maxUnits = 6>> -<</if>> -<<if ndef $trade>> - <<set $trade = 0>> - <<calcInitialTrade>> -<</if>> -<<if ndef $activeUnits>> - <<set $activeUnits = 0>> -<</if>> -<<if ndef $attackType>> - <<set $attackType = "none">> -<</if>> -<<if ndef $attackThisWeek>> - <<set $attackThisWeek = 0>> -<</if>> -<<if ndef $lastAttackWeeks>> - <<set $lastAttackWeeks = 0>> -<</if>> -<<set $lastRebellionWeeks = Number($lastRebellionWeeks) || 0>> -<<if ndef $hasFoughtOnce>> - <<set $hasFoughtOnce = 0>> -<</if>> -<<if ndef $hasFoughtMajorBattleOnce>> - <<set $hasFoughtMajorBattleOnce = 0>> -<</if>> -<<if ndef $hasRebelledOnce>> - <<set $hasRebelledOnce = 0>> -<</if>> -<<if ndef $majorBattle>> - <<set $majorBattle = 0>> -<</if>> -<<if ndef $PCvictoryStreak>> - <<set $PCvictoryStreak = 0>> -<</if>> -<<if ndef $PClossStreak>> - <<set $PClossStreak = 0>> -<</if>> -<<if ndef $oldFlux>> - <<set $oldFlux = 0>> -<</if>> -<<if ndef $wasToggledBefore>> - <<set $wasToggledBefore = 0>> -<</if>> -<<if ndef $showBattleStatistics>> - <<set $showBattleStatistics = 0>> -<</if>> -<<if ndef $forceBattle>> - <<set $forceBattle = 0>> -<</if>> -<<if ndef $forceMajorBattle>> - <<set $forceMajorBattle = 0>> -<</if>> -<<if ndef $foughtThisWeek>> - <<set $foughtThisWeek = 0>> -<</if>> -<<if ndef $battlesEnabled>> - <<set $battlesEnabled = 1>> -<</if>> -<<if ndef $battlesEnabledOceanic>> - <<set $battlesEnabledOceanic = 0>> -<</if>> -<<if ndef $majorBattlesEnabled>> - <<set $majorBattlesEnabled = 1>> -<</if>> -<<if ndef $majorBattleGameOver>> - <<set $majorBattleGameOver = 1>> -<</if>> -<<if ndef $rebellionsEnabled>> - <<set $rebellionsEnabled = 1>> -<</if>> -<<if ndef $forceRebellion>> - <<set $forceRebellion = 0>> -<</if>> -<<if ndef $rebellionGameOver>> - <<set $rebellionGameOver = 1>> -<</if>> -<<if ndef $allowPrestigeFromBattles>> - <<set $allowPrestigeFromBattles = 1>> -<</if>> -<<if ndef $battleFrequency>> - <<set $battleFrequency = 1>> -<</if>> -<<if ndef $rebellionSpeed>> - <<set $rebellionSpeed = 1>> -<</if>> -<<if ndef $majorBattleMult>> - <<set $majorBattleMult = 1>> -<</if>> - -/* edicts */ -<<if ndef $edictsUpkeep>> - <<set $edictsUpkeep = 0>> -<</if>> -<<if ndef $edictsAuthUpkeep>> - <<set $edictsAuthUpkeep = 0>> -<</if>> -<<if ndef $alternativeRents>> - <<set $alternativeRents = 0>> -<</if>> -<<if ndef $enslavementRights>> - <<set $enslavementRights = 0>> -<</if>> -<<if ndef $securityExemption>> - <<set $securityExemption = 0>> -<</if>> -<<if ndef $sellData>> - <<set $sellData = 0>> -<</if>> -<<if ndef $propCampaignBoost>> - <<set $propCampaignBoost = 0>> -<</if>> -<<if ndef $slaveWatch>> - <<set $slaveWatch = 0>> -<</if>> -<<if ndef $subsidyChurch>> - <<set $subsidyChurch = 0>> -<</if>> -<<if ndef $limitImmigration>> - <<set $limitImmigration = 0>> -<</if>> -<<if ndef $openBorders>> - <<set $openBorders = 0>> -<</if>> -<<if ndef $limitSubhumans>> - <<set $limitSubhumans = 0>> -<</if>> -<<if ndef $slavesOfficers>> - <<set $slavesOfficers = 0>> -<</if>> -<<if ndef $martialSchool>> - <<set $martialSchool = 0>> -<</if>> -<<if ndef $discountMercenaries>> - <<set $discountMercenaries = 0>> -<</if>> -<<if ndef $militiaFounded>> - <<set $militiaFounded = 0>> -<</if>> -<<if ndef $recruitVolunteers>> - <<set $recruitVolunteers = 0>> -<</if>> -<<if ndef $militaryService>> - <<set $militaryService = 0>> -<</if>> -<<if ndef $militarizedSociety>> - <<set $militarizedSociety = 0>> -<</if>> -<<if ndef $militaryExemption>> - <<set $militaryExemption = 0>> -<</if>> -<<if ndef $lowerRquirements>> - <<set $lowerRquirements = 0>> -<</if>> -<<if ndef $noSubhumansInArmy>> - <<set $noSubhumansInArmy = 0>> -<</if>> -<<if ndef $pregExemption>> - <<set $pregExemption = 0>> -<</if>> -<<if ndef $eliteOfficers>> - <<set $eliteOfficers = 0>> -<</if>> -<<if ndef $liveTargets>> - <<set $liveTargets = 0>> -<</if>> -<<if ndef $legionTradition>> - <<set $legionTradition = 0>> -<</if>> -<<if ndef $eagleWarriors>> - <<set $eagleWarriors = 0>> -<</if>> -<<if ndef $ronin>> - <<set $ronin = 0>> -<</if>> -<<if ndef $sunTzu>> - <<set $sunTzu = 0>> -<</if>> -<<if ndef $mamluks>> - <<set $mamluks = 0>> -<</if>> -<<if ndef $pharaonTradition>> - <<set $pharaonTradition = 0>> -<</if>> -<<if ndef $weaponsLaw>> - <<set $weaponsLaw = 3>> -<</if>> -<<if ndef $soldierWages>> - <<set $soldierWages = 1>> -<</if>> -<<if ndef $militiaSoldierPrivilege>> - <<set $militiaSoldierPrivilege = 0>> -<</if>> -<<if ndef $slaveSoldierPrivilege>> - <<set $slaveSoldierPrivilege = 0>> -<</if>> -<<if ndef $mercSoldierPrivilege>> - <<set $mercSoldierPrivilege = 0>> -<</if>> -<<if ndef $tradeLegalAid>> - <<set $tradeLegalAid = 0>> -<</if>> -<<if ndef $taxTrade>> - <<set $taxTrade = 0>> -<</if>> - -/* proclamations */ -<<if ndef $proclamationsCooldown>> - <<set $proclamationsCooldown = 0>> -<</if>> -<<if ndef $proclamationCurrency>> - <<set $proclamationCurrency = "authority">> -<</if>> -<<if ndef $proclamationType>> - <<set $proclamationType = "none">> -<</if>> - -/* buildings */ -<<if ndef $secHQ>> - <<set $secHQ = 0>> -<</if>> -<<if ndef $secBarracks>> - <<set $secBarracks = 0>> -<</if>> -<<if ndef $secBarracksUpgrades>> - <<set $secBarracksUpgrades ={ - size: 0, - luxury: 0, - training: 0, - loyaltyMod:0 }>> -<</if>> -<<if ndef $secBarracksUpgrades.loyaltyMod>> - <<set $secBarracksUpgrades.loyaltyMod = 0>> -<</if>> -<<if ndef $secMenials>> - <<set $secMenials = $secHelots || 0>> - <<unset $secHelots>> -<</if>> -<<if ndef $reqMenials>> - <<set $reqMenials = $reqHelots || 20>> - <<unset $reqHelots>> -<</if>> -<<if ndef $secUpgrades >> - <<set $secUpgrades = { - nanoCams: 0, - cyberBots: 0, - eyeScan: 0, - cryptoAnalyzer: 0, - coldstorage: 0}>> -<</if>> -<<if ndef $crimeUpgrades>> - <<set $crimeUpgrades = { - autoTrial: 0, - autoArchive: 0, - worldProfiler: 0, - advForensic: 0}>> -<</if>> -<<if ndef $intelUpgrades>> - <<set $intelUpgrades = { - sensors: 0, - radar: 0, - signalIntercept: 0}>> -<</if>> -<<if ndef $readinessUpgrades>> - <<set $readinessUpgrades = { - earlyWarn: 0, - rapidPlatforms: 0, - pathways: 0, - rapidVehicles: 0}>> -<</if>> -<<if ndef $propHub>> - <<set $propHub = 0>> -<</if>> -<<if ndef $propCampaign>> - <<set $propCampaign = 0>> -<</if>> -<<if ndef $propFocus>> - <<set $propFocus = "none">> -<</if>> -<<if ndef $miniTruth>> - <<set $miniTruth = 0>> -<</if>> -<<if ndef $fakeNews>> - <<set $fakeNews = 0>> -<</if>> -<<if ndef $controlLeaks>> - <<set $controlLeaks = 0>> -<</if>> -<<if ndef $secretService>> - <<set $secretService = 0>> -<</if>> -<<if ndef $blackOps>> - <<set $blackOps = 0>> -<</if>> -<<if ndef $marketInfiltration>> - <<set $marketInfiltration = 0>> -<</if>> -<<if ndef $propHubUpkeep>> - <<set $propHubUpkeep = $facilityCost * 5>> -<</if>> -<<if ndef $secHQUpkeep>> - <<set $secHQUpkeep = $facilityCost * 5>> -<</if>> -<<if ndef $secBarracksUpkeep>> - <<set $secBarracksUpkeep = $facilityCost * 5>> -<</if>> -<<if ndef $upgradeUpkeep>> - <<set $upgradeUpkeep = 50>> -<</if>> -<<if ndef $riotCenter>> - <<set $riotCenter = 0>> -<</if>> -<<if ndef $riotUpkeep>> - <<set $riotUpkeep = $facilityCost * 5>> -<</if>> -<<if ndef $riotUpgrades>> - <<set $riotUpgrades = { - freeMedia: 0, - rapidUnit: 0, - rapidUnitSpeed: 0}>> -<</if>> -<<if ndef $fort>> - <<set $fort = { - reactor: 0, - waterway: 0, - assistant: 0}>> -<</if>> -<<if ndef $sentUnitCooldown>> - <<set $sentUnitCooldown = 0>> -<</if>> -<<if ndef $advancedRiotEquip>> - <<set $advancedRiotEquip = 0>> -<</if>> -<<if ndef $brainImplant>> - <<set $brainImplant = -1>> -<</if>> -<<if ndef $brainImplantProject>> - <<set $brainImplantProject = 0>> -<</if>> -<<if def $weapHelots>> - <<set $weapMenials = $weapHelots || 0>> - <<unset $weapHelots>> -<</if>> -<<if ndef $weapManu>> - <<set $weapManu = 0>> -<</if>> -<<if ndef $weapProductivity>> - <<set $weapProductivity = 1>> -<</if>> -<<if ndef $weapLab>> - <<set $weapLab = 1>> -<</if>> -<<if ndef $baseUpgradeTime>> - <<set $baseUpgradeTime = 10>> -<</if>> -<<if ndef $weapUpgrades>> - <<set $weapUpgrades = []>> -<</if>> -<<if ndef $currentUpgrade>> - <<set $currentUpgrade = { - ID: 0, - name: " ", - unit: 0, - type: 0, - time: 0, - value: 0}>> -<<else>> - <<if ndef $currentUpgrade.ID>> - <<if $currentUpgrade.name == "magnetic based ballistic weaponry">> - <<set $currentUpgrade.ID = 0>> - <<elseif $currentUpgrade.name == "ceramo-metallic alloys">> - <<set $currentUpgrade.ID = 1>> - <<elseif $currentUpgrade.name == "rapid action stimulants">> - <<set $currentUpgrade.ID = 2>> - <<elseif $currentUpgrade.name == "fast response neural stimulant">> - <<set $currentUpgrade.ID = 3>> - <<elseif $currentUpgrade.name == "universal cyber enhancements">> - <<set $currentUpgrade.ID = 4>> - <<elseif $currentUpgrade.name == "remote neural links">> - <<set $currentUpgrade.ID = 5>> - <<elseif $currentUpgrade.name == "combined training regimens with the special force">> - <<set $currentUpgrade.ID = 6>> - <<elseif $currentUpgrade.name == "a variant of the stimulant cocktail that the special force created">> - <<set $currentUpgrade.ID = 7>> - <<elseif $currentUpgrade.name == "a mesh network based off the custom network of the special force">> - <<set $currentUpgrade.ID = 8>> - <<elseif $currentUpgrade.name == "dynamic battle aware AI">> - <<set $currentUpgrade.ID = -1>> - <<elseif $currentUpgrade.name == "adaptive armored frames">> - <<set $currentUpgrade.ID = -2>> - <<elseif $currentUpgrade.name == "advanced synthetic alloys">> - <<set $currentUpgrade.ID = -3>> - <</if>> - <</if>> -<</if>> -<<if ndef $droneUpgrades>> - <<set $droneUpgrades = { - attack: 0, - defense: 0, - hp:0}>> -<<elseif $droneUpgrades == null>> - <<set $droneUpgrades = { - attack: 0, - defense: 0, - hp:0}>> -<<else>> - <<if isInt($droneUpgrades)>> - <<unset $droneUpgrades>> - <<set $droneUpgrades = { - attack: 0, - defense: 0, - hp:0}>> - <</if>> - <<if ndef $droneUpgrades.attack || !isInt($droneUpgrades.attack)>> - <<set $droneUpgrades.attack = 0>> - <</if>> - <<if ndef $droneUpgrades.defense || !isInt($droneUpgrades.defense)>> - <<set $droneUpgrades.defense = 0>> - <</if>> - <<if ndef $droneUpgrades.hp || !isInt($droneUpgrades.hp)>> - <<set $droneUpgrades.hp = 0>> - <</if>> -<</if>> -<<if ndef $humanUpgrade>> - <<set $humanUpgrade = { - attack: 0, - defense: 0, - hp:0, - morale: 0}>> -<<elseif $humanUpgrade == null>> - <<set $humanUpgrade = { - attack: 0, - defense: 0, - hp:0, - morale: 0}>> -<<else>> - <<if isInt($humanUpgrade)>> - <<unset $humanUpgrade>> - <<set $humanUpgrade = { - attack: 0, - defense: 0, - hp:0, - morale: 0}>> - <</if>> - <<if ndef $humanUpgrade.attack || !isInt($humanUpgrade.attack)>> - <<set $humanUpgrade.attack = 0>> - <</if>> - <<if ndef $humanUpgrade.defense || !isInt($humanUpgrade.defense)>> - <<set $humanUpgrade.defense = 0>> - <</if>> - <<if ndef $humanUpgrade.hp || !isInt($humanUpgrade.hp)>> - <<set $humanUpgrade.hp = 0>> - <</if>> - <<if ndef $humanUpgrade.morale || !isInt($humanUpgrade.morale)>> - <<set $humanUpgrade.morale = 0>> - <</if>> -<</if>> -<<if ndef $sellTo>> - <<set $sellTo = { - citizen: 1, - raiders: 1, - oldWorld: 1, - FC: 1}>> -<</if>> -<<if ndef $completedUpgrades>> - <<set $completedUpgrades = []>> -<</if>> -<<if ndef $transportHub>> - <<set $transportHub = 0>> -<</if>> -<<if ndef $airport>> - <<set $airport = 1>> -<</if>> -<<if ndef $railway>> - <<set $railway = 1>> -<</if>> -<<if ndef $docks>> - <<set $docks = 1>> -<</if>> -<<if ndef $hubSecurity>> - <<set $hubSecurity = 1>> -<</if>> - -/* events */ -<<if ndef $smilingManProgress>> - <<set $smilingManProgress = 0>> -<</if>> -<<if ndef $investedFunds>> - <<set $investedFunds = 0>> -<</if>> -<<if ndef $relationshipLM>> - <<set $relationshipLM = 0>> -<</if>> -<<if ndef $captureRoute>> - <<set $captureRoute = 0>> -<</if>> -<<if ndef $collaborationRoute>> - <<set $collaborationRoute = 0>> -<</if>> -<<if ndef $smilingManWeek>> - <<set $smilingManWeek = 0>> -<</if>> -<<if ndef $globalCrisisWeeks>> - <<set $globalCrisisWeeks = 0>> -<</if>> -<<if ndef $smilingManFate>> - <<set $smilingManFate = 4>> -<</if>> - -/* rebellions */ -<<if ndef $tension>> - <<set $tension = 0>> -<</if>> -<<if ndef $slaveProgress>> - <<set $slaveProgress = 0>> -<</if>> -<<if ndef $citizenProgress>> - <<set $citizenProgress = 0>> -<</if>> -<<if ndef $slaveRebellionEventFires>> - <<set $slaveRebellionEventFires = 0>> -<</if>> -<<if ndef $citizenRebellionEventFires>> - <<set $citizenRebellionEventFires = 0>> -<</if>> -<<if ndef $slaveRebellion>> - <<set $slaveRebellion = 0>> -<</if>> -<<if ndef $citizenRebellion>> - <<set $citizenRebellion = 0>> -<</if>> -<<if ndef $rebellingUnits>> - <<set $rebellingUnits = []>> -<</if>> -<<if ndef $notInvolved>> - <<set $notInvolved = 0>> -<</if>> -<<if ndef $engageRule>> - <<set $engageRule = 0>> -<</if>> -<<if ndef $irregulars>> - <<set $irregulars = 0>> -<</if>> -<<if ndef $rebellingMilitia>> - <<set $rebellingMilitia = 0>> -<</if>> -<<if ndef $rebellingSlaves>> - <<set $rebellingSlaves = 0>> -<</if>> -<<if ndef $rebellingMercs>> - <<set $rebellingMercs = 0>> -<</if>> -<<if ndef $repairTime>> - <<set $repairTime = 3>> -<</if>> -<<if ndef $arcRepairTime>> - <<set $arcRepairTime = 0>> -<</if>> -<<if ndef $rebelDefeatAftermath>> - <<set $rebelDefeatAftermath = 0>> -<</if>> -<<if ndef $garrison>> - <<set $garrison = { - penthouse: 0, - reactor: 0, - assistant: 0, - waterway: 0, - reactorTime: 0, - assistantTime: 0, - waterwayTime: 0}>> -<<else>> - <<if ndef $garrison.penthouse>> - <<set $garrison.penthouse = 0>> - <</if>> - <<if ndef $garrison.reactor>> - <<set $garrison.reactor = 0>> - <</if>> - <<if ndef $garrison.assistant>> - <<set $garrison.assistant = 0>> - <</if>> - <<if ndef $garrison.waterway>> - <<set $garrison.waterway = 0>> - <</if>> - <<if ndef $garrison.reactorTime>> - <<set $garrison.reactorTime = 0>> - <</if>> - <<if ndef $garrison.assistantTime>> - <<set $garrison.assistantTime = 0>> - <</if>> - <<if ndef $garrison.waterwayTime>> - <<set $garrison.waterwayTime = 0>> - <</if>> -<</if>> -<<if ndef $rebellionsCount>> - <<set $rebellionsCount = 0>> -<</if>> -<<if ndef $PCrebWon>> - <<set $PCrebWon = 0>> -<</if>> -<<if ndef $PCrebLoss>> - <<set $PCrebLoss = 0>> -<</if>> - -/* armed forces stats */ -<<if ndef $difficulty>> - <<set $difficulty = 1>> -<</if>> -<<if ndef $targetUnit>> - <<set $targetUnit = 0>> -<</if>> -<<if ndef $targetIndex>> - <<set $targetIndex = 0>> -<</if>> -<<if ndef $secBotsCost>> - <<set $secBotsCost = 500>> -<</if>> -<<if ndef $secBotsUpgradeCost>> - <<set $secBotsUpgradeCost = 250>> -<</if>> -<<if ndef $equipUpgradeCost>> - <<set $equipUpgradeCost = 250>> -<</if>> -<<if ndef $maxTroops>> - <<set $maxTroops = 30>> -<</if>> -<<if ndef $militiaFounded>> - <<set $militiaFounded = 0>> -<</if>> -<<if ndef $militiaRecruitment>> - <<set $militiaRecruitment = 0>> -<</if>> -<<if ndef $militiaTotalManpower>> - <<set $militiaTotalManpower = 0>> -<</if>> -<<if ndef $militiaFreeManpower>> - <<set $militiaFreeManpower = 0>> -<</if>> -<<if ndef $militiaEmployedManpower>> - <<set $militiaEmployedManpower = 0>> -<</if>> -<<if ndef $militiaTotalCasualties>> - <<set $militiaTotalCasualties = 0>> -<</if>> -<<if ndef $slavesOfficers>> - <<set $slavesOfficers = 0>> -<</if>> -<<if ndef $slavesEmployedManpower>> - <<set $slavesEmployedManpower = 0>> -<</if>> -<<if ndef $slavesTotalCasualties>> - <<set $slavesTotalCasualties = 0>> -<</if>> -<<if ndef $slavesMaxTroops>> - <<set $slavesMaxTroops = 30>> -<</if>> -<<if ndef $mercTotalManpower>> - <<set $mercTotalManpower = 0>> -<</if>> -<<if ndef $mercFreeManpower>> - <<set $mercFreeManpower = 0>> -<</if>> -<<if ndef mercEmployedManpower>> - <<set $mercEmployedManpower = 0>> -<</if>> -<<if ndef $mercTotalCasualties>> - <<set $mercTotalCasualties = 0>> -<</if>> -<<if ndef $militiaLoyalty>> - <<set $militiaLoyalty = 0>> -<</if>> -<<if ndef $slaveArmyLoyalty>> - <<set $slaveArmyLoyalty = 0>> -<</if>> -<<if ndef $mercLoyalty>> - <<set $mercLoyalty = 0>> -<</if>> -<<if ndef $soldierUpkeep>> - <<set $soldierUpkeep = 10>> -<</if>> -<<if ndef $createdSlavesUnits>> - <<set $createdSlavesUnits = 0>> -<</if>> -<<if ndef $createdMilitiaUnits>> - <<set $createdMilitiaUnits = 0>> -<</if>> -<<if ndef $createdMercUnits>> - <<set $createdMercUnits = 0>> -<</if>> - -/* battle relevant vars */ -<<if ndef $troopCount>> - <<set $troopCount = 0>> -<</if>> -<<if ndef $slaveVictories>> - <<set $slaveVictories = []>> -<</if>> -<<if ndef $slaveIncreasedPrestige>> - <<set $slaveIncreasedPrestige = 0>> -<</if>> -<<if ndef $totalKills>> - <<set $totalKills = 0>> -<</if>> -<<if ndef $battlesCount>> - <<set $battlesCount = 0>> -<</if>> -<<if ndef $majorBattlesCount>> - <<set $majorBattlesCount = 0>> -<</if>> -<<if ndef $chosenTactic>> - <<set $chosenTactic = "none">> -<</if>> -<<if ndef $leadingTroops>> - <<set $leadingTroops = "none">> -<</if>> -<<if ndef $attackTroops>> - <<set $attackTroops = 0>> -<</if>> -<<if ndef $attackEquip>> - <<set $attackEquip = 0>> -<</if>> -<<if ndef $deployableUnits>> - <<set $deployableUnits = 0>> -<</if>> -<<if ndef $deployedUnits>> - <<set $deployedUnits = 0>> -<</if>> -<<if ndef $deployingBots>> - <<set $deployingBots = 0>> -<</if>> -<<if ndef $deployingMilitia>> - <<set $deployingMilitia = 0>> -<</if>> -<<if ndef $deployingSlaves>> - <<set $deployingSlaves = 0>> -<</if>> -<<if ndef $deployingMercs>> - <<set $deployingMercs = 0>> -<</if>> -<<if ndef $battleTerrain>> - <<set $battleTerrain = "none">> -<</if>> -<<if ndef $maxTurns>> - <<set $maxTurns = 10>> -<</if>> -<<if ndef $battleResult>> - <<set $battleResult = 4>> /* sets $battleResult value outside accepted range (-3,3) to avoid evaluation problems */ -<</if>> -<<if ndef $losses>> - <<set $losses = 0>> -<</if>> -<<if ndef $enemyLosses>> - <<set $enemyLosses = 0>> -<</if>> -<<if ndef $battleTurns>> - <<set $battleTurns = 0>> -<</if>> -<<if ndef $bribeCost>> - <<set $bribeCost = 0>> -<</if>> -<<if ndef $tacticsSuccessful>> - <<set $tacticsSuccessful = 0>> -<</if>> -<<if ndef $leaderWounded>> - <<set $leaderWounded = 0>> /* 0=no wound, 1=mute, 2=blind, 3=amputee, 4=health */ -<</if>> -<<if ndef $gainedCombat>> - <<set $gainedCombat = 0>> -<</if>> -<<if ndef $gainedWarfare>> - <<set $gainedWarfare = 0>> -<</if>> -<<if ndef $PCWounded>> - <<set $PCWounded = 0>> -<</if>> -<<if ndef $PCWoundCooldown>> - <<set $PCWoundCooldown = 0>> -<</if>> -<<if ndef $expectedEquip>> - <<set $expectedEquip = 0>> -<</if>> -<<if ndef $estimatedMen>> - <<set $estimatedMen = 0>> -<</if>> -<<if ndef $SFIntervention>> - <<set $SFIntervention = 0>> -<</if>> -<<if ndef $carriableSoldiers>> - <<set $carriableSoldiers = 0>> -<</if>> -<<if ndef $SFatk>> - <<set $SFatk = 0>> -<</if>> -<<if ndef $SFdef>> - <<set $SFdef = 0>> -<</if>> -<<if ndef $SFhp>> - <<set $SFhp = 0>> -<</if>> -<<if ndef $rebellingID>> - <<set $rebellingID = []>> -<</if>> -<<if ndef $saveValid>> - <<set $saveValid = 0>> -<</if>> -<<if ndef $lastSelection>> - <<set $lastSelection = []>> -<</if>> - -/* statistics */ -<<if ndef $baseBribePerAttacker>> - <<set $baseBribePerAttacker = 5>> -<</if>> -<<if ndef $equipMod>> - <<set $equipMod = 0.15>> -<</if>> -<<if ndef $secBotsBaseAttack>> - <<set $secBotsBaseAttack = 7 + $droneUpgrades.attack>> -<</if>> -<<if ndef $secBotsBaseDefense>> - <<set $secBotsBaseDefense = 3 + $droneUpgrades.defense>> -<</if>> -<<if ndef $secBotsMorale>> - <<set $secBotsMorale = 200>> -<</if>> -<<if ndef $secBotsBaseHp>> - <<set $secBotsBaseHp = 3 + $droneUpgrades.hp>> -<</if>> -<<if ndef $militiaBaseAttack>> - <<set $militiaBaseAttack = 7 + $humanUpgrade.attack>> -<</if>> -<<if ndef $militiaBaseDefense>> - <<set $militiaBaseDefense = 5 + $humanUpgrade.defense>> -<</if>> -<<if ndef $militiaBaseMorale>> - <<set $militiaBaseMorale = 140 + $humanUpgrade.morale>> -<</if>> -<<if ndef $militiaBaseHp>> - <<set $militiaBaseHp = 3 + $humanUpgrade.hp>> -<</if>> -<<if ndef $slaveBaseAttack>> - <<set $slaveBaseAttack = 8 + $humanUpgrade.attack>> -<</if>> -<<if ndef $slaveBaseDefense>> - <<set $slaveBaseDefense = 3 + $humanUpgrade.defense>> -<</if>> -<<if ndef $slaveBaseMorale>> - <<set $slaveBaseMorale = 110 + $humanUpgrade.morale>> -<</if>> -<<if ndef $slaveBaseHp>> - <<set $slaveBaseHp = 3 + $humanUpgrade.hp>> -<</if>> -<<if ndef $mercBaseAttack>> - <<set $mercBaseAttack = 8 + $humanUpgrade.attack>> -<</if>> -<<if ndef $mercBaseDefense>> - <<set $mercBaseDefense = 4 + $humanUpgrade.defense>> -<</if>> -<<if ndef $mercBaseMorale>> - <<set $mercBaseMorale = 125 + $humanUpgrade.morale>> -<</if>> -<<if ndef $mercBaseHp>> - <<set $mercBaseHp = 4 + $humanUpgrade.hp>> -<</if>> -<<if ndef $SFBaseAttack>> - <<set $SFBaseAttack = 8 + $humanUpgrade.attack>> -<</if>> -<<if ndef $SFBaseDefense>> - <<set $SFBaseDefense = 4 + $humanUpgrade.defense>> -<</if>> -<<if ndef $SFBaseMorale>> - <<set $SFBaseMorale = 140 + $humanUpgrade.morale>> -<</if>> -<<if ndef $SFBaseHp>> - <<set $SFBaseHp = 4 + $humanUpgrade.hp>> -<</if>> - -<<if ndef $raBaseAttack>> - <<set $raBaseAttack = 7>> -<</if>> -<<if ndef $raBaseDefense>> - <<set $raBaseDefense = 2>> -<</if>> -<<if ndef $raBaseMorale>> - <<set $raBaseMorale = 100>> -<</if>> -<<if ndef $raBaseHp>> - <<set $raBaseHp = 2>> -<</if>> -<<if ndef $fcBaseAttack>> - <<set $fcBaseAttack = 6>> -<</if>> -<<if ndef $fcBaseDefense>> - <<set $fcBaseDefense = 4>> -<</if>> -<<if ndef $fcBaseMorale>> - <<set $fcBaseMorale = 130>> -<</if>> -<<if ndef $fcBaseHp>> - <<set $fcBaseHp = 3>> -<</if>> -<<if ndef $owBaseAttack>> - <<set $owBaseAttack = 8>> -<</if>> -<<if ndef $owBaseDefense>> - <<set $owBaseDefense = 4>> -<</if>> -<<if ndef $owBaseMorale>> - <<set $owBaseMorale = 110>> -<</if>> -<<if ndef $owBaseHp>> - <<set $owBaseHp = 2>> -<</if>> -<<if ndef $ffBaseAttack>> - <<set $ffBaseAttack = 9>> -<</if>> -<<if ndef $ffBaseDefense>> - <<set $ffBaseDefense = 2>> -<</if>> -<<if ndef $ffBaseMorale>> - <<set $ffBaseMorale = 160>> -<</if>> -<<if ndef $ffBaseHp>> - <<set $ffBaseHp = 2>> -<</if>> - -/* units */ -<<if ndef $secBots>> - <<if $arcologyUpgrade.drones == 0>> - <<set $secBots = { - active: 0, - ID: -1, - isDeployed: 0, - troops: 0, - maxTroops: 0, - equip: 0} >> - <<elseif $arcologyUpgrade.drones == 1>> - <<set $secBots = { - active: 1, - ID: -1, - isDeployed: 0, - troops: 30, - maxTroops: 30, - equip: 0} >> - <</if>> -<</if>> - -<<if ndef $militiaUnits>> - <<set $militiaUnits = []>> -<</if>> -<<if ndef $slaveUnits>> - <<set $slaveUnits = []>> -<</if>> -<<if ndef $mercUnits>> - <<set $mercUnits = []>> -<</if>> - -/* SFanon additions */ -<<if ndef $SFSupportLevel>> - <<set $SFSupportLevel = 0>> -<</if>> -<<if ndef $SFSupportUpkeep>> - <<set $SFSupportUpkeep = 0>> -<</if>> -<<if ndef $secUpgrades.coldstorage>> - <<set $secUpgrades.coldstorage = 0>> -<</if>> -<<if ndef $SFGear>> - <<set $SFGear = 0>> -<</if>> -<<if ndef $SavedLeader>> - <<set $SavedLeader = $leadingTroops>> -<</if>> -<<if ndef $SavedSFI>> - <<set $SavedSFI = $SFIntervention>> -<</if>> - -/* recalculation widgets */ -<<fixBrokenUnits>> -<<fixBrokenStats>> -<<fixBrokenFS>> -<<recalcSecRestPoint>> -<<recalcCrimeCap>> -<<recalcReqMenials>> -<<recalcManpower>> -<<recalcEdictsUpkeep>> -<<recalcBaseStats>> -<<recalcUnits>> - -<<set $wasToggledBefore = 1>> - -<br>Missing Security Expansion variables set. All done! \ No newline at end of file diff --git a/src/SecExp/secInit.tw b/src/SecExp/secInit.tw deleted file mode 100644 index 4d9d98f715e..00000000000 --- a/src/SecExp/secInit.tw +++ /dev/null @@ -1,351 +0,0 @@ -:: secInit [nobr] - -/* base vars */ -<<set $authority = 0>> -<<set $security = 30>> -<<set $secRestPoint = 30>> -<<set $crime = 30>> -<<set $crimeCap = 100>> -<<set $readiness = 1>> -<<set $recon = 0>> -<<set $maxUnits = 6>> -<<set $trade = 0>> -<<set $activeUnits = 0>> -<<set $attackType = "none">> -<<set $attackThisWeek = 0>> -<<set $lastAttackWeeks = 0>> -<<set $lastRebellionWeeks = 0>> -<<set $hasFoughtOnce = 0>> -<<set $hasFoughtMajorBattleOnce = 0>> -<<set $hasRebelledOnce = 0>> -<<set $majorBattle = 0>> -<<set $PCvictoryStreak = 0>> -<<set $PCvictories = 0>> -<<set $PClossStreak = 0>> -<<set $PClosses = 0>> -<<set $oldFlux = 0>> -<<set $showBattleStatistics = 0>> -<<set $forceBattle = 0>> -<<set $forceMajorBattle = 0>> -<<set $foughtThisWeek = 0>> -<<set $battlesEnabled = 1>> -<<set $battlesEnabledOceanic = 0>> -<<set $majorBattlesEnabled = 1>> -<<set $majorBattleGameOver = 1>> -<<set $rebellionsEnabled = 1>> -<<set $forceRebellion = 0>> -<<set $rebellionGameOver = 1>> -<<set $allowPrestigeFromBattles = 1>> -<<set $battleFrequency = 1>> -<<set $rebellionSpeed = 1>> -<<set $majorBattleMult = 1>> - -/* edicts */ -<<set $edictsUpkeep = 0>> -<<set $edictsAuthUpkeep = 0>> -<<set $alternativeRents = 0>> -<<set $enslavementRights = 0>> -<<set $securityExemption = 0>> -<<set $sellData = 0>> -<<set $propCampaignBoost = 0>> -<<set $slaveWatch = 0>> -<<set $subsidyChurch = 0>> -<<set $limitImmigration = 0>> -<<set $openBorders = 0>> -<<set $limitSubhumans = 0>> -<<set $slavesOfficers = 0>> -<<set $martialSchool = 0>> -<<set $discountMercenaries = 0>> -<<set $militiaFounded = 0>> -<<set $recruitVolunteers = 0>> -<<set $militaryService = 0>> -<<set $militarizedSociety = 0>> -<<set $militaryExemption = 0>> -<<set $lowerRquirements = 0>> -<<set $noSubhumansInArmy = 0>> -<<set $pregExemption = 0>> -<<set $eliteOfficers = 0>> -<<set $liveTargets = 0>> -<<set $legionTradition = 0>> -<<set $eagleWarriors = 0>> -<<set $ronin = 0>> -<<set $sunTzu = 0>> -<<set $mamluks = 0>> -<<set $pharaonTradition = 0>> -<<set $weaponsLaw = 3>> -<<set $soldierWages = 1>> -<<set $militiaSoldierPrivilege = 0>> -<<set $slaveSoldierPrivilege = 0>> -<<set $mercSoldierPrivilege = 0>> -<<set $tradeLegalAid = 0>> -<<set $taxTrade = 0>> - -/* proclamations */ -<<set $proclamationsCooldown = 0>> -<<set $proclamationCurrency = "authority">> -<<set $proclamationType = "none">> - -/* buildings */ -<<set $upgradeUpkeep = 40>> -<<set $secHQ = 0>> -<<set $secHQUpkeep = $facilityCost * 5>> -<<set $secBarracks = 0>> -<<set $secBarracksUpkeep = $facilityCost * 5>> -<<set $secBarracksUpgrades ={ - size: 0, - luxury: 0, - training: 0, - loyaltyMod: 0}>> -<<set $secMenials = 0>> -<<set $reqMenials = 20>> -<<set $secUpgrades = { - nanoCams: 0, - cyberBots: 0, - eyeScan: 0, - cryptoAnalyzer: 0, - coldstorage: 0}>> -<<set $crimeUpgrades = { - autoTrial: 0, - autoArchive: 0, - worldProfiler: 0, - advForensic: 0}>> -<<set $intelUpgrades = { - sensors: 0, - radar: 0, - signalIntercept: 0}>> -<<set $readinessUpgrades = { - earlyWarn: 0, - rapidPlatforms: 0, - pathways: 0, - rapidVehicles: 0}>> -<<set $propHub = 0>> -<<set $propHubUpkeep = $facilityCost * 5>> -<<set $propCampaign = 0>> -<<set $propFocus = "none">> -<<set $miniTruth = 0>> -<<set $fakeNews = 0>> -<<set $controlLeaks = 0>> -<<set $secretService = 0>> -<<set $blackOps = 0>> -<<set $marketInfiltration = 0>> -<<set $riotCenter = 0>> -<<set $riotUpkeep = $facilityCost * 5>> -<<set $riotUpgrades = { - freeMedia: 0, - rapidUnit: 0, - rapidUnitSpeed: 0}>> -<<set $fort = { - reactor: 0, - waterway: 0, - assistant:0}>> -<<set $sentUnitCooldown = 0>> -<<set $advancedRiotEquip = 0>> -<<set $brainImplant = -1>> -<<set $brainImplantProject = 0>> -<<set $weapManu = 0>> -<<set $weapMenials = 0>> -<<set $weapProductivity = 1>> -<<set $weapLab = 1>> -<<set $baseUpgradeTime = 10>> -<<set $currentUpgrade = { - name: " ", - unit: 0, - type: 0, - time: 0}>> -<<set $droneUpgrades = { - attack: 0, - defense: 0, - hp:0}>> -<<set $humanUpgrade = { - attack: 0, - defense: 0, - hp:0, - morale: 0}>> -<<set $sellTo = { - citizen: 1, - raiders: 1, - oldWorld: 1, - FC: 1}>> -<<set $completedUpgrades = []>> -<<set $transportHub = 0>> -<<set $airport = 0>> -<<set $railway = 0>> -<<set $docks = 0>> -<<set $hubSecurity = 1>> - -/* events */ -<<set $smilingManProgress = 0>> -<<set $investedFunds = 0>> -<<set $relationshipLM = 0>> -<<set $captureRoute = 0>> -<<set $collaborationRoute = 0>> -<<set $smilingManWeek = 0>> -<<set $globalCrisisWeeks = 0>> -<<set $smilingManFate = 4>> - -/* rebellions */ -<<set $tension = 0>> -<<set $slaveProgress = 0>> -<<set $citizenProgress = 0>> -<<set $slaveRebellionEventFires = 0>> -<<set $citizenRebellionEventFires = 0>> -<<set $slaveRebellion = 0>> -<<set $citizenRebellion = 0>> -<<set $rebellingUnits = []>> -<<set $notInvolved = 0>> -<<set $irregulars = 0>> -<<set $engageRule = 0>> -<<set $rebellingMilitia = 0>> -<<set $rebellingSlaves = 0>> -<<set $rebellingMercs = 0>> -<<set $repairTime = 3>> -<<set $arcRepairTime = 0>> -<<set $rebelDefeatAftermath = 0>> -<<set $garrison = { - penthouse: 0, - reactor: 0, - assistant: 0, - waterway: 0, - reactorTime: 0, - assistantTime: 0, - waterwayTime: 0 }>> -<<set $rebellionsCount = 0>> -<<set $PCrebWon = 0>> -<<set $PCrebLoss = 0>> - - -/* armed forces stats */ -<<set $difficulty = 1>> -<<set $targetUnit = 0>> -<<set $targetIndex = 0>> -<<set $secBotsCost = 500>> -<<set $secBotsUpgradeCost = 250>> -<<set $equipUpgradeCost = 250>> -<<set $maxTroops = 30>> -<<set $militiaTotalManpower = 0>> -<<set $militiaFreeManpower = 0>> -<<set $militiaEmployedManpower = 0>> -<<set $militiaTotalCasualties = 0>> -<<set $slavesOfficers = 0>> -<<set $slavesEmployedManpower = 0>> -<<set $slavesTotalCasualties = 0>> -<<set $mercTotalManpower = 0>> -<<set $mercEmployedManpower = 0>> -<<set $mercTotalCasualties = 0>> -<<set $mercLoyalty = 0>> -<<set $soldierUpkeep = 10>> -<<set $createdSlavesUnits = 0>> -<<set $createdMilitiaUnits = 0>> -<<set $createdMercUnits = 0>> -<<set $mercFreeManpower = 0>> -<<if $wasToggledBefore == 0>> - <<if $mercenaries == 1>> - <<set $mercFreeManpower = random(5,20)>> - <<elseif $mercenaries > 1>> - <<set $mercFreeManpower = random(10,30)>> - <</if>> -<</if>> - -/* battle relevant variables */ -<<set $troopCount = 0>> -<<set $slaveVictories = []>> -<<set $slaveIncreasedPrestige = 0>> -<<set $totalKills = 0>> -<<set $battlesCount = 0>> -<<set $majorBattlesCount = 0>> -<<set $chosenTactic = "none">> -<<set $leadingTroops = "none">> -<<set $attackTroops = 0>> -<<set $attackEquip = 0>> -<<set $deployableUnits = 0>> -<<set $deployedUnits = 0>> -<<set $deployingBots = 0>> -<<set $deployingMilitia = 0>> -<<set $deployingSlaves = 0>> -<<set $deployingMercs = 0>> -<<set $battleTerrain = "none">> -<<set $maxTurns = 10>> -<<set $battleResult = 4>> /* sets $battleResult value outside accepted range (-3,3) to avoid evaluation problems */ -<<set $losses = 0>> -<<set $enemyLosses = 0>> -<<set $battleTurns = 0>> -<<set $bribeCost = 0>> -<<set $tacticsSuccessful = 0>> -<<set $leaderWounded = 0>> -<<set $woundType = 0>> /* 0=no wound, 1=mute, 2=blind, 3=amputee, 4<=health */ -<<set $gainedCombat = 0>> -<<set $gainedWarfare = 0>> -<<set $PCWounded = 0>> -<<set $PCWoundCooldown = 0>> -<<set $expectedEquip = 0>> -<<set $estimatedMen = 0>> -<<set $SFIntervention = 0>> -<<set $carriableSoldiers = 0>> -<<set $SFatk = 0>> -<<set $SFdef = 0>> -<<set $SFhp = 0>> -<<set $rebellingID = []>> -<<set $saveValid = 0>> -<<set $lastSelection = []>> - -/* statistics */ -<<set $baseBribePerAttacker = 5>> -<<set $equipMod = 0.15>> -<<set $secBotsBaseAttack = 7>> -<<set $secBotsBaseDefense = 3>> -<<set $secBotsMorale = 200>> -<<set $secBotsBaseHp = 3>> -<<set $militiaBaseAttack = 7>> -<<set $militiaBaseDefense = 5>> -<<set $militiaBaseMorale = 140>> -<<set $militiaBaseHp = 3>> -<<set $slaveBaseAttack = 8>> -<<set $slaveBaseDefense = 3>> -<<set $slaveBaseMorale = 110>> -<<set $slaveBaseHp = 3>> -<<set $mercBaseAttack = 8>> -<<set $mercBaseDefense = 4>> -<<set $mercBaseMorale = 125>> -<<set $mercBaseHp = 4>> -<<set $SFBaseAttack = 8>> -<<set $SFBaseDefense = 4>> -<<set $SFBaseMorale = 140>> -<<set $SFBaseHp = 4>> - -<<set $raBaseAttack = 7>> -<<set $raBaseDefense = 2>> -<<set $raBaseMorale = 100>> -<<set $raBaseHp = 2>> -<<set $fcBaseAttack = 6>> -<<set $fcBaseDefense = 4>> -<<set $fcBaseMorale = 130>> -<<set $fcBaseHp = 3>> -<<set $owBaseAttack = 8>> -<<set $owBaseDefense = 4>> -<<set $owBaseMorale = 110>> -<<set $owBaseHp = 2>> -<<set $ffBaseAttack = 9>> -<<set $ffBaseDefense = 2>> -<<set $ffBaseMorale = 160>> -<<set $ffBaseHp = 2>> - -<<set $secBots = { - active: 0, - ID: -1, - isDeployed: 0, - troops: 0, - maxTroops: 0, - equip: 0} >> -<<set $militiaUnits = []>> -<<set $slaveUnits = []>> -<<set $mercUnits = []>> - -/* SFanon additions */ -<<set $SFSupportLevel = 0>> -<<set $SFSupportUpkeep = 0>> -<<set $SFGear = 0>> -<<set $SavedLeader = "none">> -<<set $SavedSFI = 0>> - -/* helper widgets */ -<<calcInitialTrade>> \ No newline at end of file diff --git a/src/SpecialForce/SpecialForce.js b/src/SpecialForce/SpecialForce.js index 7893882dee7..18c59345202 100644 --- a/src/SpecialForce/SpecialForce.js +++ b/src/SpecialForce/SpecialForce.js @@ -23,22 +23,6 @@ window.TroopDec = function() { else {return `near capacity, and ${commom} often barter their personal loot, whether it be monetary or human, for the choicest bunks`;} }; -window.HSM = function() { - const V = State.variables; - if (V.PC.hacking <= -100) {return 1.5;} - else if (V.PC.hacking <= -75) {return 1.35;} - else if (V.PC.hacking <= -50) {return 1.25;} - else if (V.PC.hacking <= -25) {return 1.15;} - else if (V.PC.hacking < 0) {return 1.10;} - else if (V.PC.hacking === 0) {return 1;} - else if (V.PC.hacking <= 10) {return 0.97;} - else if (V.PC.hacking <= 25) {return 0.95;} - else if (V.PC.hacking <= 50) {return 0.90;} - else if (V.PC.hacking <= 75) {return 0.85;} - else if (V.PC.hacking <= 100) {return 0.80;} - else {return 0.75;} -}; - window.Count = function() { const V = State.variables, T = State.temporary, C = Math.clamp, S = V.SF.Squad, E = V.economy; T.SFF = V.SF.Facility.Active; diff --git a/src/init/storyInit.tw b/src/init/storyInit.tw index f48636c0d32..eb8baaf95f0 100644 --- a/src/init/storyInit.tw +++ b/src/init/storyInit.tw @@ -1487,7 +1487,7 @@ erectileImplant: 0 <<set $econWeatherDamage = 0>> <<set $disasterResponse = 0>> -<<include "secInit">> +<<= secIni())>> <<set $postSexCleanUp = 1>> diff --git a/src/js/utilJS.js b/src/js/utilJS.js index b39be0d3b56..bbeb6a8e005 100644 --- a/src/js/utilJS.js +++ b/src/js/utilJS.js @@ -1257,3 +1257,27 @@ window.originPronounReplace = function(slave) { return r; } }; + +window.HSM = function() { + const V = State.variables; + if (V.PC.hacking <= -100) {return 1.5;} + else if (V.PC.hacking <= -75) {return 1.35;} + else if (V.PC.hacking <= -50) {return 1.25;} + else if (V.PC.hacking <= -25) {return 1.15;} + else if (V.PC.hacking < 0) {return 1.10;} + else if (V.PC.hacking === 0) {return 1;} + else if (V.PC.hacking <= 10) {return 0.97;} + else if (V.PC.hacking <= 25) {return 0.95;} + else if (V.PC.hacking <= 50) {return 0.90;} + else if (V.PC.hacking <= 75) {return 0.85;} + else if (V.PC.hacking <= 100) {return 0.80;} + else {return 0.75;} +}; + +window.ndefJS = function(input) { + if (input === undefined || input === null) { return true; } else { return false } +}; + +window.defJS = function(input) { + if (input !== undefined) { return true; } else { return false } +}; \ No newline at end of file diff --git a/src/uncategorized/BackwardsCompatibility.tw b/src/uncategorized/BackwardsCompatibility.tw index 263690b8900..0360e8a4e70 100644 --- a/src/uncategorized/BackwardsCompatibility.tw +++ b/src/uncategorized/BackwardsCompatibility.tw @@ -3387,7 +3387,7 @@ Done! /* Sec Exp */ <<if $secExp == 1>> <br> - <<include "SecExpBackwardCompatibility">> + <<= SecBC()>> <<else>> <<set $crime = 0, $security = 0>> <</if>> diff --git a/src/uncategorized/options.tw b/src/uncategorized/options.tw index b234f8b9251..0abb2bb1eb3 100644 --- a/src/uncategorized/options.tw +++ b/src/uncategorized/options.tw @@ -7,7 +7,7 @@ This save was created using FC version $ver build $releaseID. <br> [[Apply Backwards Compatibility Update|Backwards Compatibility]] <<if $secExp == 1>> - <br> [[Apply Security Expansion mod backwards compatibility |SecExpBackwardCompatibility]] + <br> <<link "Apply Security Expansion mod backwards compatibility">> <<run SecBC()>> <</link>> <</if>> <br> @@ -486,7 +486,7 @@ Assignment performance vignettes on the end week report are The Security Expansion mod is @@.red;DISABLED@@. <<link "Enable">> <<set $secExp = 1>> - <<include "SecExpBackwardCompatibility">> + <<= SecBC()>> <<if $wasToggledBefore == 0>> <<set $wasToggledBefore = 1>> <</if>> @@ -497,7 +497,7 @@ Assignment performance vignettes on the end week report are The Security Expansion mod is @@.red;DISABLED@@. <<link "Enable">> <<set $secExp = 1>> - <<include "SecExpBackwardCompatibility">> + <<= SecBC()>> <<if $wasToggledBefore == 0>> <<set $wasToggledBefore = 1>> <</if>> -- GitLab