Skip to content

Commit

Permalink
Battle overhaul part 4.
Browse files Browse the repository at this point in the history
  • Loading branch information
KJeff01 committed Oct 19, 2020
1 parent 0eefc03 commit 0878a24
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 15 deletions.
2 changes: 1 addition & 1 deletion multiplay/skirmish/Cobra.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ const SENSOR_TECH = [
"R-Sys-CBSensor-Tower01",
"R-Sys-Sensor-WSTower",
"R-Sys-Sensor-UpLink",
"R-Wpn-LasSat",
];
const DEFENSE_UPGRADES = [
"R-Wpn-LasSat",
"R-Struc-Materials09",
"R-Defense-WallUpgrade12",
];
Expand Down
6 changes: 3 additions & 3 deletions multiplay/skirmish/cobra_includes/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ function lookForOil()
//Ok, most oils are already owned so go ahead and defend all derricks from now one
forceDerrickBuildDefense = true;
}
if (forceDerrickBuildDefense)
if (!highOilMap() && forceDerrickBuildDefense)
{
protectUnguardedDerricks();
}
Expand Down Expand Up @@ -610,7 +610,7 @@ function buildBaseStructures()
}
else
{
var haveAllies = playerAlliance(true).length > 0;
var haveAllies = (alliancesType === ALLIANCES_TEAMS) && (playerAlliance(true).length > 0);

if (getRealPower() < 500 && countAndBuild(structures.gen, 5))
{
Expand Down Expand Up @@ -923,7 +923,7 @@ function maintenance(group)
}
}

if (isNTW && (group !== constructGroupNTWExtra))
if (isNTW && (group === constructGroup))
{
modList = modList.reverse();
}
Expand Down
2 changes: 1 addition & 1 deletion multiplay/skirmish/cobra_includes/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ function eventAttacked(victim, attacker)
return;
}

if ((gameTime > 600000) || !highOilMap())
if ((gameTime > 900000) || !highOilMap())
{
startAttacking = true; //well, they want to play so...
}
Expand Down
42 changes: 36 additions & 6 deletions multiplay/skirmish/cobra_includes/research.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,44 @@ function initializeResearchLists()
empWeapons = updateResearchList(weaponStats.nexusTech.weapons);
}

function isPowerResearch(research)
{
const POWERS = [
"R-Struc-Power-Upgrade01",
"R-Struc-Power-Upgrade01b",
"R-Struc-Power-Upgrade01c",
"R-Struc-Power-Upgrade02",
"R-Struc-Power-Upgrade03",
"R-Struc-Power-Upgrade03a",
];

for (var i = 0, len = POWERS.length; i < len; ++i)
{
if (research === POWERS[i])
{
return true;
}
}

return false;
}

//This function aims to more cleanly discover available research topics
//with the given list provided. pursueResearch falls short in that it fails to
//acknowledge the availability of an item further into the list if a previous
//one is not completed... so lets help it a bit.
function evalResearch(lab, list)
{
var sufficientPower = getRealPower() > 2500;

for (var i = 0, a = list.length; i < a; ++i)
{
if (sufficientPower && isPowerResearch(list[i]))
{
//Don't research power upgrades if we have an absurd amount of power.
continue;
}

if (pursueResearch(lab, list[i]))
{
return true;
Expand Down Expand Up @@ -128,9 +158,9 @@ function research()
{
antiCyborgChance = 35;
}
if (antiCyborgChance > 0 && antiCyborgChance < 15)
if (antiCyborgChance > 0 && antiCyborgChance < 8)
{
antiCyborgChance = 15; //just in case...
antiCyborgChance = 8; //just in case...
}

for (var i = 0, a = labList.length; i < a; ++i)
Expand All @@ -155,7 +185,7 @@ function research()
found = pursueResearch(lab, "R-Vehicle-Body11");
if (!found && random(100) < (highOil ? 30 : 20))
found = evalResearch(lab, ESSENTIALS_2);
if (!found && ((getRealPower() > SUPER_LOW_POWER) || highOil) && (random(100) < 10))
if (!found && ((getRealPower() > SUPER_LOW_POWER) || highOil) && (random(100) < (getResearch("R-Struc-Research-Upgrade04").done ? 20 : 10)))
found = evalResearch(lab, ESSENTIALS_3);

if (!found && (getRealPower() > -SUPER_LOW_POWER) && (countEnemyVTOL() || componentAvailable("V-Tol")))
Expand Down Expand Up @@ -344,10 +374,10 @@ function research()
}
}

if (!found && !turnOffCyborgs && getResearch("R-Struc-Research-Upgrade04").done && random(100) < 25)
found = evalResearch(lab, cyborgWeaps);
if (!found && random(100) < 25)
if (!found && random(100) < 35)
found = evalResearch(lab, weaponTech);
if (!found && !turnOffCyborgs && getResearch("R-Struc-Research-Upgrade04").done && random(100) < 15)
found = evalResearch(lab, cyborgWeaps);
if (!found && random(100) < 60)
found = evalResearch(lab, extraTech);

Expand Down
8 changes: 4 additions & 4 deletions multiplay/skirmish/cobra_includes/tactics.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function repairDroid(droidID, force)
return false;
}

const SAFE_EXTREME_OIL_IGNORE_NUM = 70;
const SAFE_EXTREME_OIL_IGNORE_NUM = 80;

var forceRepairPercent = 50;
const EXPERIENCE_DIVISOR = 26;
Expand Down Expand Up @@ -632,15 +632,15 @@ function haveEnoughUnitsForFirstAttack()
{
var amountOfAttackers = groupSize(attackGroup) + groupSize(artilleryGroup) + groupSize(vtolGroup);
// These amounts of units will build up in base if unprovoked
startAttacking = amountOfAttackers >= (highOil ? 120 : MIN_ATTACK_DROIDS);
startAttacking = amountOfAttackers >= (highOil ? 120 : 20);
}

return startAttacking;
}

function baseShuffleDefensePattern()
{
if (gameTime < lastShuffleTime + 10000)
if (gameTime < lastShuffleTime + 20000)
{
return; //Prevent the dreadful jitter movement defense pattern.
}
Expand Down Expand Up @@ -671,7 +671,7 @@ function baseShuffleDefensePattern()
if (y <= 2) { y = 2; }
else if (y >= mapHeight - 2) { y = mapHeight - 2; }

orderDroidLoc(attackers[i], DORDER_MOVE, x, y);
orderDroidLoc(attackers[i], DORDER_SCOUT, x, y);
}

lastShuffleTime = gameTime;
Expand Down

0 comments on commit 0878a24

Please sign in to comment.