Skip to content

Commit

Permalink
Fix new adaption mechanics and better plasma line research.
Browse files Browse the repository at this point in the history
  • Loading branch information
KJeff01 committed Jun 28, 2021
1 parent c010df7 commit 5b594d5
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 33 deletions.
5 changes: 1 addition & 4 deletions multiplay/skirmish/Cobra.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,8 @@ const TANK_BODY = [
"Body14SUP", // Dragon
"Body13SUP", // Wyvern
"Body10MBT", // Vengeance
"Body7ABT", // Retribution
"Body9REC", // Tiger
"Body12SUP", // Mantis
"Body6SUPP", // Panther
"Body11ABT", // Python
"Body8MBT", // Scorpion
"Body5REC", // Cobra
"Body1REC", // Viper
];
Expand All @@ -131,6 +127,7 @@ const SYSTEM_PROPULSION = [
const VTOL_BODY = [
"Body7ABT", // Retribution
"Body6SUPP", // Panther
"Body12SUP", // Mantis
"Body8MBT", // Scorpion
"Body5REC", // Cobra
"Body1REC", // Viper
Expand Down
28 changes: 17 additions & 11 deletions multiplay/skirmish/cobra_includes/adaption.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,23 @@ function playerBodySizeRatio(player)
var medium = 0;
var heavy = 0;
var attackers = enumDroid(player, DROID_WEAPON);
attackers.forEach(function(obj) {
if (obj.body === "Body1REC" || obj.body === "Body2SUP" || obj.body === "Body4ABT" || obj.body === "Body3MBT")
for (var i = 0, len = attackers.length; i < len; ++i)
{
var body = attackers[i].body;

if (body === "Body1REC" || body === "Body2SUP" || body === "Body4ABT" || body === "Body3MBT")
{
++small;
}
else if (obj.body === "Body5REC" || obj.body === "Body6SUPP" || obj.body === "Body8MBT" || obj.body === "Body7ABT")
else if (body === "Body5REC" || body === "Body6SUPP" || body === "Body8MBT" || body === "Body7ABT")
{
++medium;
}
else if (obj.body === "Body11ABT" || obj.body === "Body9REC" || obj.body === "Body13SUP" || obj.body === "Body14SUP" || obj.body ==="Body12SUP" || obj.body === "Body10MBT")
else if (body === "Body11ABT" || body === "Body9REC" || body === "Body13SUP" || body === "Body14SUP" || body ==="Body12SUP" || body === "Body10MBT")
{
++heavy;
}
});
}

return {
small: small / (attackers.length + 1),
Expand All @@ -148,24 +151,27 @@ function playerLandPropRatio(player)
var track = 0;
var hover = 0;
var attackers = enumDroid(player, DROID_WEAPON);
attackers.forEach(function(obj) {
if (obj.prop === "wheeled01")
for (var i = 0, len = attackers.length; i < len; ++i)
{
var prop = attackers[i].propulsion;

if (prop === "wheeled01")
{
++wheel;
}
else if (obj.prop === "HalfTrack")
else if (prop === "HalfTrack")
{
++halftrack;
}
else if (obj.prop === "tracked01")
else if (prop === "tracked01")
{
++track;
}
else if (obj.prop === "hover01")
else if (prop === "hover01")
{
++hover;
}
});
}

return {
wheel: wheel / (attackers.length + 1),
Expand Down
14 changes: 4 additions & 10 deletions multiplay/skirmish/cobra_includes/production.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ function useHover(weap)
{
return true;
}
if (Math.floor(propulsions.track * 100) >= 50 && random(100) < 50)
if (Math.floor(propulsions.track * 100) >= 50 && random(100) < 80)
{
return false;
}
Expand All @@ -308,7 +308,7 @@ function useHover(weap)

if ((NAME === "Flame1Mk1") || (NAME === "Flame2") || (NAME === "PlasmiteFlamer"))
{
useHover = (random(100) <= 60);
useHover = (random(100) <= 40);
break;
}

Expand Down Expand Up @@ -351,7 +351,7 @@ function pickPropulsion(weap)

var propulsions = playerLandPropRatio(getMostHarmfulPlayer());

if (Math.floor(propulsions.track * 100) <= 60 && random(100) < ((superLowOnProductionPower()) ? 85 : 60))
if (Math.floor(propulsions.track * 100) <= 55 && random(100) < ((superLowOnProductionPower()) ? 85 : 60))
{
tankProp.shift();
}
Expand All @@ -374,7 +374,7 @@ function pickTankBody()
}
else
{
body = (random(100) < ((superLowOnProductionPower()) ? 45 : 30)) ? VTOL_BODY : TANK_BODY;
body = (random(100) < 30) ? VTOL_BODY : TANK_BODY;
}

// If they go super big, we go super big
Expand Down Expand Up @@ -508,13 +508,7 @@ function buildVTOL(id)

if (fac !== null && isDefined(weap) && isDefined(weap2))
{
var sizeRatio = playerBodySizeRatio(getMostHarmfulPlayer());
var body = (random(100) < 60) ? VTOL_BODY : TANK_BODY;
// Don't waste too much power if they are small body rushing
if ((Math.floor(sizeRatio.small * 100) >= 40) && (random(100) < 40))
{
body = SYSTEM_BODY;
}

return buildDroid(fac, "VTOL unit", body, "V-Tol", "", "", weap, weap2);
}
Expand Down
14 changes: 7 additions & 7 deletions multiplay/skirmish/cobra_includes/research.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,19 +237,19 @@ function research()
}
}

if (!found && getResearch("R-Struc-Research-Upgrade06").done && random(100) < 8)
if (!found && getResearch("R-Struc-Research-Upgrade05").done && random(100) < 15)
{
found = evalResearch(lab, empWeapons);
found = pursueResearch(lab, extremeLaserTech);

if (!found)
found = pursueResearch(lab, extremeLaserTech);
if (!found && componentAvailable("PlasmaHeavy") && random(100) < 70)
found = evalResearch(lab, FLAMER);

if (componentAvailable("Laser4-PlasmaCannon"))
{
if (!found)
found = evalResearch(lab, empWeapons);
if (!found && random(100) < 80)
found = evalResearch(lab, extremeLaserExtra);
if (!found && componentAvailable("PlasmaHeavy"))
found = evalResearch(lab, FLAMER);
}
}

Expand Down Expand Up @@ -395,7 +395,7 @@ function research()

if (!found && random(100) < 40)
found = evalResearch(lab, weaponTech);
if (!found && !turnOffCyborgs && getResearch("R-Struc-Research-Upgrade04").done && random(100) < 20)
if (!found && !turnOffCyborgs && getResearch("R-Struc-Research-Upgrade04").done && random(100) < 30)
found = evalResearch(lab, cyborgWeaps);
if (!found && random(100) < 60)
found = evalResearch(lab, extraTech);
Expand Down
2 changes: 1 addition & 1 deletion multiplay/skirmish/cobra_rulesets/CobraStandard.js
Original file line number Diff line number Diff line change
Expand Up @@ -573,8 +573,8 @@ const weaponStats =
"R-Wpn-Cannon-Accuracy02",
"R-Wpn-Cannon-ROF06",
"R-Wpn-Cannon-Damage09",
"R-Wpn-Flamer-Damage09",
"R-Wpn-Flamer-ROF03",
"R-Wpn-Flamer-Damage09",
],
},
bombs:
Expand Down

0 comments on commit 5b594d5

Please sign in to comment.