Skip to content

Commit

Permalink
Much better research and general battle performance.
Browse files Browse the repository at this point in the history
  • Loading branch information
KJeff01 committed Jun 25, 2019
1 parent 53dccb5 commit e6be9d9
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 37 deletions.
9 changes: 5 additions & 4 deletions multiplay/skirmish/Cobra.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,18 @@ const ESSENTIALS = [
"R-Sys-Engineering01",
"R-Defense-Tower01",
"R-Struc-PowerModuleMk1",
"R-Struc-Power-Upgrade03a",
"R-Struc-Research-Upgrade09",
"R-Sys-Autorepair-General",
"R-Struc-Research-Upgrade01",
];
const ESSENTIALS_2 = [
"R-Vehicle-Prop-Halftracks",
"R-Struc-RprFac-Upgrade01",
"R-Sys-Sensor-Upgrade01",
"R-Vehicle-Body11",
"R-Struc-Factory-Upgrade09",
"R-Struc-Power-Upgrade03a",
"R-Struc-Research-Upgrade09",
"R-Sys-Autorepair-General",
"R-Vehicle-Prop-Hover",
"R-Struc-Factory-Upgrade09",
];
const SYSTEM_UPGRADES = [
"R-Vehicle-Body12",
Expand Down
4 changes: 2 additions & 2 deletions multiplay/skirmish/cobra_includes/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ function returnDefense(type)
var bestDefense = "Emplacement-MortarEMP"; //default

//Choose a random electronic warfare defense if possible.
if (random(101) < ELECTRONIC_CHANCE)
if (random(100) < ELECTRONIC_CHANCE)
{
var avail = 0;
for (var i = 0, t = ELECTRONIC_DEFENSES.length; i < t; ++i)
Expand Down Expand Up @@ -627,7 +627,7 @@ function buildExtras()
}

var gens = countStruct(structures.gens);
if (getRealPower() > MIN_POWER && countStruct(structures.extras[0]) < 5 && countAndBuild(structures.extras[0], gens + 1))
if (getRealPower() > SUPER_LOW_POWER && countStruct(structures.extras[0]) < 5 && countAndBuild(structures.extras[0], gens + 1))
{
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions multiplay/skirmish/cobra_includes/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function eventStartLevel()

recycleForHover();
buildOrders(); //Start building right away.

setTimer("buildOrders", 300);
setTimer("produce", 400);
setTimer("checkAllForRepair", 600);
Expand Down Expand Up @@ -97,7 +97,7 @@ function eventStructureBuilt(structure, droid)
return ((obj.type === STRUCTURE) && (obj.stattype === DEFENSE));
});

if ((gameTime > 120000) && (random(101) < subPersonalities[personality].defensePriority))
if ((gameTime > 120000) && (random(100) < subPersonalities[personality].defensePriority))
{
protectUnguardedDerricks(droid);
}
Expand Down
12 changes: 6 additions & 6 deletions multiplay/skirmish/cobra_includes/production.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function chooseWeaponType(weaps)
{
var weaponType = weaps;

if (isDefined(weaps.fastFire) && (random(101) < 50))
if (isDefined(weaps.fastFire) && (random(100) < 50))
{
weaponType = weaps.fastFire;
}
Expand Down Expand Up @@ -139,7 +139,7 @@ function choosePersonalityWeapon(type)
weaponList = shuffleWeaponList(chooseWeaponType(weaps));

//on hard difficulty and above.
if (componentAvailable("tracked01") && (random(101) <= 1))
if (componentAvailable("tracked01") && (random(100) <= 1))
{
if((difficulty === HARD) || (difficulty === INSANE))
{
Expand Down Expand Up @@ -200,18 +200,18 @@ function useHover(weap)

if ((NAME === "Rocket-LtA-T") || (NAME === "Rocket-HvyA-T") || (NAME === "Missile-A-T"))
{
useHover = (random(101) <= 75);
useHover = (random(100) <= 75);
break;
}

if ((NAME === "Laser3BEAMMk1") || (NAME === "Laser2PULSEMk1") || (NAME === "HeavyLaser"))
{
useHover = (random(101) <= 55);
useHover = (random(100) <= 55);
break;
}
}

return (((useHover === true) || (random(101) <= 15)) && (weap[0] !== "Laser4-PlasmaCannon"));
return (((useHover === true) || (random(100) <= 15)) && (weap[0] !== "Laser4-PlasmaCannon"));
}

//Choose our ground propulsion. Non-hover units will have a preference for tracks.
Expand All @@ -229,7 +229,7 @@ function pickPropulsion(weap)
"wheeled01", // wheels
];

if ((random(101) < 45) || (gameTime < TIME_FOR_HALF_TRACKS))
if ((random(100) < 45) || (gameTime < TIME_FOR_HALF_TRACKS))
{
tankProp.shift();
}
Expand Down
46 changes: 23 additions & 23 deletions multiplay/skirmish/cobra_includes/research.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ function research()
for (var i = 0, a = labList.length; i < a; ++i)
{
var lab = labList[i];
var found = !random(4) && evalResearch(lab, ESSENTIALS);
var found = evalResearch(lab, ESSENTIALS);

if (!found && forceHover)
found = pursueResearch(lab, "R-Vehicle-Prop-Hover");
if (!found)
found = evalResearch(lab, techlist);
if (!found && !random(4))
if (!found && random(100) < 25)
found = evalResearch(lab, ESSENTIALS_2);

if (!found && getRealPower() > MIN_POWER)
Expand All @@ -93,11 +93,11 @@ function research()

if (subPersonalities[personality].resPath === "generic")
{
if (!found && !random(3))
if (!found && random(100) < 33)
found = evalResearch(lab, extraTech);

//Use default AA until stormbringer.
if (!random(2) && countEnemyVTOL() && !isStructureAvailable("P0-AASite-Laser"))
if (random(100) < 50 && countEnemyVTOL() && !isStructureAvailable("P0-AASite-Laser"))
{
if (!found)
found = evalResearch(lab, antiAirTech);
Expand All @@ -107,17 +107,17 @@ function research()

if (!found && !turnOffCyborgs)
found = evalResearch(lab, cyborgWeaps);
if (!found && !random(2))
if (!found && random(100) < 50)
found = evalResearch(lab, weaponTech);
if (!found && useArti && !random(2))
if (!found && useArti && random(100) < 50)
found = evalResearch(lab, artilleryTech);

if (!found)
found = evalResearch(lab, SYSTEM_UPGRADES);
if (!found)
found = evalResearch(lab, LATE_EARLY_GAME_TECH);

if (!found && (random(101) < subPersonalities[personality].alloyPriority))
if (!found && (random(100) < subPersonalities[personality].alloyPriority))
{
if (!turnOffCyborgs && countStruct(CYBORG_FACTORY) && random(2))
found = evalResearch(lab, CYBORG_ARMOR);
Expand All @@ -131,7 +131,7 @@ function research()
found = evalResearch(lab, artillExtra);


if (!found && (random(101) < subPersonalities[personality].defensePriority))
if (!found && (random(100) < subPersonalities[personality].defensePriority))
{
found = evalResearch(lab, standardDefenseTech);
if (!found && useArti)
Expand All @@ -152,13 +152,13 @@ function research()
found = evalResearch(lab, secondaryWeaponTech);
}

if (!found && useVtol && (random(101) < subPersonalities[personality].vtolPriority))
if (!found && useVtol && (random(100) < subPersonalities[personality].vtolPriority))
found = evalResearch(lab, VTOL_RES);
}
else if (subPersonalities[personality].resPath === "defensive")
{
//Use default AA until stormbringer.
if (!random(2) && countEnemyVTOL() && !isStructureAvailable("P0-AASite-Laser"))
if (random(100) < 50 && countEnemyVTOL() && !isStructureAvailable("P0-AASite-Laser"))
{
if (!found)
found = evalResearch(lab, antiAirTech);
Expand All @@ -178,7 +178,7 @@ function research()
if (!found)
found = evalResearch(lab, LATE_EARLY_GAME_TECH);

if (!found && random(2) && useArti)
if (!found && random(100) < 50 && useArti)
found = evalResearch(lab, artillExtra);
if (!found)
found = evalResearch(lab, SYSTEM_UPGRADES);
Expand All @@ -198,7 +198,7 @@ function research()
found = evalResearch(lab, TANK_ARMOR);
}

if (!found && useVtol && (random(101) < subPersonalities[personality].vtolPriority))
if (!found && useVtol && (random(100) < subPersonalities[personality].vtolPriority))
found = evalResearch(lab, VTOL_RES);

if (!found)
Expand Down Expand Up @@ -227,9 +227,9 @@ function research()

if (!found && !turnOffCyborgs && random(2))
found = evalResearch(lab, cyborgWeaps);
if (!found && random(2))
if (!found && random(100) < 50)
found = evalResearch(lab, weaponTech);
if (!found && useArti && random(2))
if (!found && useArti && random(100) < 50)
found = evalResearch(lab, artilleryTech);

if (!found)
Expand All @@ -238,7 +238,7 @@ function research()
found = evalResearch(lab, LATE_EARLY_GAME_TECH);

//Use default AA until stormbringer.
if (!random(2) && countEnemyVTOL() && !isStructureAvailable("P0-AASite-Laser"))
if (random(100) < 50 && countEnemyVTOL() && !isStructureAvailable("P0-AASite-Laser"))
{
if (!found)
found = evalResearch(lab, antiAirTech);
Expand All @@ -251,10 +251,10 @@ function research()
if (!found && useArti)
found = evalResearch(lab, artilleryTech);

if (!found && useVtol && (random(101) < subPersonalities[personality].vtolPriority))
if (!found && useVtol && (random(100) < subPersonalities[personality].vtolPriority))
found = evalResearch(lab, VTOL_RES);

if (!found && (random(101) < 70))
if (!found && (random(100) < 70))
{
if (!turnOffCyborgs && countStruct(CYBORG_FACTORY) && random(2))
{
Expand All @@ -279,7 +279,7 @@ function research()
if (!found)
found = evalResearch(lab, SENSOR_TECH);

if (!found && ((random(101) < subPersonalities[personality].defensePriority)))
if (!found && ((random(100) < subPersonalities[personality].defensePriority)))
{
found = evalResearch(lab, standardDefenseTech);
if (!found && useArti)
Expand All @@ -293,13 +293,13 @@ function research()
if (!useVtol)
useVtol = true;

if (!found && !random(2))
if (!found && random(100) < 50)
found = evalResearch(lab, extraTech);
if (!found && useArti && !random(2))
if (!found && useArti && random(100) < 50)
found = evalResearch(lab, artilleryTech);

//Use default AA until stormbringer.
if (!random(2) && countEnemyVTOL() && !isStructureAvailable("P0-AASite-Laser"))
if (random(100) < 50 && countEnemyVTOL() && !isStructureAvailable("P0-AASite-Laser"))
{
if (!found)
found = evalResearch(lab, antiAirTech);
Expand All @@ -322,7 +322,7 @@ function research()
if (!found)
found = evalResearch(lab, SENSOR_TECH);

if (!found && (random(101) < subPersonalities[personality].alloyPriority))
if (!found && (random(100) < subPersonalities[personality].alloyPriority))
{
if (!turnOffCyborgs && countStruct(CYBORG_FACTORY) && random(2))
{
Expand All @@ -348,7 +348,7 @@ function research()
}


if (!found && (random(101) < subPersonalities[personality].defensePriority))
if (!found && (random(100) < subPersonalities[personality].defensePriority))
{
found = evalResearch(lab, standardDefenseTech);
if (!found && useArti)
Expand Down

0 comments on commit e6be9d9

Please sign in to comment.