Skip to content

Commit

Permalink
Tweak some production/research stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
KJeff01 committed May 10, 2020
1 parent e0a4101 commit 68d69c6
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
5 changes: 2 additions & 3 deletions multiplay/skirmish/Cobra.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down
4 changes: 2 additions & 2 deletions multiplay/skirmish/cobra_includes/adaption.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
14 changes: 11 additions & 3 deletions multiplay/skirmish/cobra_includes/production.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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");
Expand Down
12 changes: 6 additions & 6 deletions multiplay/skirmish/cobra_includes/research.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
Expand All @@ -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))
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 68d69c6

Please sign in to comment.