Skip to content

Commit

Permalink
More beacon stuff.
Browse files Browse the repository at this point in the history
Allow personality to decide beacon help amounts.
  • Loading branch information
KJeff01 committed Aug 26, 2020
1 parent cab959b commit daa805c
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 4 deletions.
15 changes: 15 additions & 0 deletions multiplay/skirmish/Cobra.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ var subPersonalities =
"R-Wpn-Cannon-ROF02",
],
"canPlayBySelf": true,
"beaconArmyPercentage": 60,
"beaconArtilleryPercentage": 40,
"beaconVtolPercentage": 60,
},
AR:
{
Expand All @@ -190,6 +193,9 @@ var subPersonalities =
"R-Wpn-Flamer-ROF01",
],
"canPlayBySelf": false,
"beaconArmyPercentage": 60,
"beaconArtilleryPercentage": 40,
"beaconVtolPercentage": 60,
},
AB:
{
Expand All @@ -209,6 +215,9 @@ var subPersonalities =
"R-Wpn-Rocket02-MRL",
],
"canPlayBySelf": true,
"beaconArmyPercentage": 50,
"beaconArtilleryPercentage": 40,
"beaconVtolPercentage": 50,
},
AM:
{
Expand All @@ -228,6 +237,9 @@ var subPersonalities =
"R-Wpn-MG2Mk1",
],
"canPlayBySelf": true,
"beaconArmyPercentage": 50,
"beaconArtilleryPercentage": 50,
"beaconVtolPercentage": 40,
},
AA:
{
Expand All @@ -250,6 +262,9 @@ var subPersonalities =
"R-Wpn-Mortar-Damage03",
],
"canPlayBySelf": false,
"beaconArmyPercentage": 40,
"beaconArtilleryPercentage": 40,
"beaconVtolPercentage": 70,
},
};

Expand Down
4 changes: 2 additions & 2 deletions multiplay/skirmish/cobra_includes/production.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function chooseRandomVTOLWeapon()
weaps = weaponStats.rockets_AA;
}
//Rare chance to make a bunker buster VTOL if we are a rocket personality.
if ((random(100) < 5) && personalityIsRocketMain() && (playerStructureUnitRatio(getMostHarmfulPlayer()) >= 0.20))
if ((random(100) < 5) && personalityIsRocketMain() && (playerStructureUnitRatio(getMostHarmfulPlayer()) >= 0.08))
{
weaps = weaponStats.rockets_AS;
}
Expand Down Expand Up @@ -195,7 +195,7 @@ function choosePersonalityWeapon(type)
}

// Allow small chance for Bunker Busters if main weapons lines are rockets.
if (!skip && ((random(100) < 8) && personalityIsRocketMain() && (playerStructureUnitRatio(getMostHarmfulPlayer()) >= 0.15)))
if (!skip && ((random(100) < 7) && personalityIsRocketMain() && (playerStructureUnitRatio(getMostHarmfulPlayer()) >= 0.10)))
{
weaponList = [];
skip = true;
Expand Down
39 changes: 37 additions & 2 deletions multiplay/skirmish/cobra_includes/tactics.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,47 @@ function artilleryTactics()
if (isDefined(obj))
{
var tempObj = getObject(obj.typeInfo, obj.playerInfo, obj.idInfo);

if (SENS_LEN)
{
orderDroidObj(sensors[0], DORDER_OBSERVE, tempObj);
}

for (var i = 0; i < ARTI_LEN; ++i)
{
//Send artillery to help at beacon, if possible
if ((beacon.endTime > gameTime) && (i < Math.floor(ARTI_LEN * subPersonalities[personality].beaconArtilleryPercentage)))
{
if (!beacon.wasVtol || (beacon.wasVtol && ARTILLERY_UNITS[i].weapons[0].canHitAir))
{
//Attack something in this area, if possible.
var xRand = (random(100) < 50) ? random(15) : -random(15);
var yRand = (random(100) < 50) ? random(15) : -random(15);
var xPos = beacon.x + xRand;
var yPos = beacon.y + yRand;

if (xPos < 2)
{
xPos = 2;
}
else if (xPos > mapWidth - 2)
{
xPos = mapWidth - 2;
}
if (yPos < 2)
{
yPos = 2;
}
else if (yPos > mapHeight - 2)
{
yPos = mapHeight - 2;
}

orderDroidLoc(ARTILLERY_UNITS[i], DORDER_SCOUT, xPos, yPos);
continue;
}
}

attackThisObject(ARTILLERY_UNITS[i].id, obj);
}
}
Expand Down Expand Up @@ -268,7 +303,7 @@ function groundTactics()
var id = UNITS[i].id;

//Send most of army to beacon explicitly
if ((beacon.endTime > gameTime) && (i < Math.floor(UNITS.length * 0.6)))
if ((beacon.endTime > gameTime) && (i < Math.floor(UNITS.length * subPersonalities[personality].beaconArmyPercentage)))
{
if (!beacon.wasVtol || (beacon.wasVtol && UNITS[i].weapons[0].canHitAir))
{
Expand Down Expand Up @@ -432,7 +467,7 @@ function vtolTactics()
var id = vtols[i].id;

if ((beacon.endTime > gameTime) &&
(i < Math.floor(LEN * 0.6)) &&
(i < Math.floor(LEN * subPersonalities[personality].beaconVtolPercentage)) &&
(!beacon.wasVtol || (beacon.wasVtol && vtols[i].weapons[0].canHitAir)))
{
var pos = {x: vtols[i].x, y: vtols[i].y};
Expand Down

0 comments on commit daa805c

Please sign in to comment.