From 68d69c697f0caf1bfaf482bb59ae2a8edcee8fb7 Mon Sep 17 00:00:00 2001 From: KJeff01 Date: Sun, 10 May 2020 12:57:21 -0500 Subject: [PATCH] Tweak some production/research stuff. --- multiplay/skirmish/Cobra.js | 5 ++--- multiplay/skirmish/cobra_includes/adaption.js | 4 ++-- multiplay/skirmish/cobra_includes/production.js | 14 +++++++++++--- multiplay/skirmish/cobra_includes/research.js | 12 ++++++------ 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/multiplay/skirmish/Cobra.js b/multiplay/skirmish/Cobra.js index 356abf9..5f31923 100644 --- a/multiplay/skirmish/Cobra.js +++ b/multiplay/skirmish/Cobra.js @@ -262,10 +262,9 @@ var subPersonalities = "useLasers": true, "cyborgThreatPercentage": 0.10, "retreatScanRange": 12, - "resPath": "air", + "resPath": "generic", "res": [ - "R-Wpn-Laser01", - "R-Wpn-Mortar-Incenediary", + "R-Wpn-MG3Mk1", ], "canPlayBySelf": false, }, diff --git a/multiplay/skirmish/cobra_includes/adaption.js b/multiplay/skirmish/cobra_includes/adaption.js index 9bdacd8..00265fa 100644 --- a/multiplay/skirmish/cobra_includes/adaption.js +++ b/multiplay/skirmish/cobra_includes/adaption.js @@ -4,8 +4,8 @@ function switchOffMG() { var cyborgThreat = playerCyborgRatio(getMostHarmfulPlayer()) >= subPersonalities[personality].cyborgThreatPercentage; // Will keep using machineguns until the basic laser is available or if the personality - // doesn't have the first of its primary weapon line available. - if ((cyborgThreat || !componentAvailable(subPersonalities[personality].primaryWeapon.weapons[0].stat)) && !componentAvailable("Laser3BEAMMk1")) + // doesn't have the first of its primary weapon or artillery line available. + if ((cyborgThreat || !havePrimaryOrArtilleryWeapon()) && !componentAvailable("Laser3BEAMMk1")) { turnOffMG = false; } diff --git a/multiplay/skirmish/cobra_includes/production.js b/multiplay/skirmish/cobra_includes/production.js index d299a9b..39dc0e2 100644 --- a/multiplay/skirmish/cobra_includes/production.js +++ b/multiplay/skirmish/cobra_includes/production.js @@ -21,6 +21,14 @@ function isDesignable(item, body, prop) return (virDroid !== null); } +function havePrimaryOrArtilleryWeapon() +{ + var primary = componentAvailable(subPersonalities[personality].primaryWeapon.weapons[0].stat); + var artillery = componentAvailable(subPersonalities[personality].artillery.weapons[0].stat); + + return (primary || artillery); +} + //Pick a random weapon line. May return undefined for machineguns. function chooseRandomWeapon() { @@ -176,7 +184,7 @@ function choosePersonalityWeapon(type) } if (!skip && ((!turnOffMG && (random(100) < Math.floor(playerCyborgRatio(getMostHarmfulPlayer()) * 100))) || - !componentAvailable(subPersonalities[personality].primaryWeapon.weapons[0].stat))) + !havePrimaryOrArtilleryWeapon())) { weaponList = []; var generalAntiCyborgWeapons = weaponStats.machineguns.weapons; @@ -387,7 +395,7 @@ function buildCyborg(id, useEngineer) //Choose MG instead if enemy has enough cyborgs. if ((!turnOffMG && (random(100) < Math.floor(playerCyborgRatio(getMostHarmfulPlayer()) * 100))) || - !componentAvailable(subPersonalities[personality].primaryWeapon.weapons[0].stat)) + !havePrimaryOrArtilleryWeapon()) { weaponLine = weaponStats.machineguns; } @@ -541,7 +549,7 @@ function produce() if (buildTrucks && (attackerCountsGood(false) || (gameTime < 240000 && highOilMap()) || - !componentAvailable(subPersonalities[personality].primaryWeapon.weapons[0].stat) || + !havePrimaryOrArtilleryWeapon() || getMultiTechLevel() > 1)) { buildSys(FC.id, "Spade1Mk1"); diff --git a/multiplay/skirmish/cobra_includes/research.js b/multiplay/skirmish/cobra_includes/research.js index e2ee821..4209e4e 100644 --- a/multiplay/skirmish/cobra_includes/research.js +++ b/multiplay/skirmish/cobra_includes/research.js @@ -188,7 +188,7 @@ function research() { if (!found && random(100) < antiCyborgChance) found = evalResearch(lab, machinegunWeaponTech); - if (!found && useArti && random(100) < antiCyborgChance) + if (!found && random(100) < antiCyborgChance) found = evalResearch(lab, machinegunWeaponExtra); } if (useLasersForCyborgControl() && random(100) < antiCyborgChance) @@ -205,6 +205,8 @@ function research() found = evalResearch(lab, artilleryTech); if (!found && random(100) < 33) found = evalResearch(lab, extraTech); + if (!found && useArti && random(100) < 33) + found = evalResearch(lab, artillExtra); if (!found) found = evalResearch(lab, SYSTEM_UPGRADES); @@ -222,8 +224,6 @@ function research() if (!found) found = evalResearch(lab, SENSOR_TECH); - if (!found && useArti) - found = evalResearch(lab, artillExtra); if (!found && (random(100) < subPersonalities[personality].defensePriority)) @@ -293,7 +293,7 @@ function research() { if (!found && random(100) < antiCyborgChance) found = evalResearch(lab, machinegunWeaponTech); - if (!found && useArti && random(100) < antiCyborgChance) + if (!found && random(100) < antiCyborgChance) found = evalResearch(lab, machinegunWeaponExtra); } if (useLasersForCyborgControl() && random(100) < antiCyborgChance) @@ -327,7 +327,7 @@ function research() { if (!found && random(100) < antiCyborgChance) found = evalResearch(lab, machinegunWeaponTech); - if (!found && useArti && random(100) < antiCyborgChance) + if (!found && random(100) < antiCyborgChance) found = evalResearch(lab, machinegunWeaponExtra); } if (useLasersForCyborgControl() && random(100) < antiCyborgChance) @@ -421,7 +421,7 @@ function research() { if (!found && random(100) < antiCyborgChance) found = evalResearch(lab, machinegunWeaponTech); - if (!found && useArti && random(100) < antiCyborgChance) + if (!found && random(100) < antiCyborgChance) found = evalResearch(lab, machinegunWeaponExtra); } if (useLasersForCyborgControl() && random(100) < antiCyborgChance)