Skip to content

Commit

Permalink
Fix bugs in Alpha campaign.
Browse files Browse the repository at this point in the history
-cam1-c: Move the scavDerrickBase cleanup further south to prevent an odd cleanup situation that likely results in one of those bases not eliminating correctly.

-cam1-ca: Changed it so that a player does not need to build more stuff if they already have a sufficient amount of structures on the plateau from the previous mission.

-cam1-d: Ignore wall like structures when looking at the total amount of defenses around the New Paradigm LZ.

-libcampaign: Check for shared base cleanup when destroying a base so that shared bases eliminate properly.
  • Loading branch information
KJeff01 committed Sep 16, 2017
1 parent d4d0688 commit 01b4e29
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
4 changes: 3 additions & 1 deletion data/base/script/campaign/cam1-d.js
Expand Up @@ -53,7 +53,9 @@ function sendNPTransporter()
{
//Check if the NP LZ is secure. If so, send a transport.
var tPos = getObject("NPTransportPos");
var nearbyDefense = enumRange(tPos.x, tPos.y, 8, NEW_PARADIGM, false);
var nearbyDefense = enumRange(tPos.x, tPos.y, 8, NEW_PARADIGM, false).filter(function(obj) {
return (obj.type === STRUCTURE && obj.stattype !== WALL);
});

if (nearbyDefense.length)
{
Expand Down
13 changes: 8 additions & 5 deletions data/base/script/campaign/cam1ca.js
Expand Up @@ -2,7 +2,6 @@
include("script/campaign/libcampaign.js");
include("script/campaign/templates.js");

var initialStructures;
const landingZoneList = [ "NPLZ1", "NPLZ2", "NPLZ3", "NPLZ4", "NPLZ5" ];
const landingZoneMessages = [ "C1CA_LZ1", "C1CA_LZ2", "C1CA_LZ3", "C1CA_LZ4", "C1CA_LZ5" ];
var baseEstablished;
Expand All @@ -19,7 +18,8 @@ function extraVictoryCondition()
{
if (baseEstablished) // if base is destroyed later, we don't care
return true;
if (camCountStructuresInArea("buildArea") >= initialStructures + 4)
//Now we check if there is stuff built here already from cam1-C.
if (camCountStructuresInArea("buildArea") >= 4)
{
baseEstablished = true;
hackRemoveMessage("C1CA_OBJ1", PROX_MSG, CAM_HUMAN_PLAYER);
Expand All @@ -41,14 +41,18 @@ function sendTransport()
{
// start with light forces
if (!camDef(lastHeavy))
{
lastHeavy = true;
}
// find an LZ that is not compromised
var list = [];
for (var i = 0; i < landingZoneList.length; ++i)
{
var lz = landingZoneList[i];
if (enumArea(lz, CAM_HUMAN_PLAYER, false).length === 0)
{
list[list.length] = { idx: i, label: lz };
}
}
if (list.length === 0)
{
Expand All @@ -67,13 +71,13 @@ function sendTransport()
if (lastHeavy)
{
lastHeavy = false;
queue('sendTransport', camChangeOnDiff(90000));
queue("sendTransport", camChangeOnDiff(90000));
with (camTemplates) templates = [ nppod, nphmg, npmrl, npsmc ];
}
else
{
lastHeavy = true;
queue('sendTransport', camChangeOnDiff(180000));
queue("sendTransport", camChangeOnDiff(180000));
with (camTemplates) templates = [ npsmct, npmor, npsmc, npmmct,
npmrl, nphmg, npsbb ];
}
Expand Down Expand Up @@ -101,7 +105,6 @@ function sendTransport()
function eventStartLevel()
{
totalTransportLoads = 0;
initialStructures = camCountStructuresInArea("buildArea");
baseEstablished = false;

camSetStandardWinLossConditions(CAM_VICTORY_STANDARD, "SUB_1_4AS", {
Expand Down
7 changes: 5 additions & 2 deletions data/base/script/campaign/libcampaign.js
Expand Up @@ -523,7 +523,7 @@ function camTraceOnce()
arguments);
}

//;; \subsection{isCheating}
//;; \subsection{isCheating()}
//;; Check if the player is in cheat mode.
function isCheating()
{
Expand Down Expand Up @@ -1170,7 +1170,10 @@ function __camCheckBaseEliminated(group)
var nonValidLeftovers = leftovers.filter(function(obj) {
return (obj.player !== CAM_HUMAN_PLAYER
&& obj.type === STRUCTURE
&& !__camIsValidLeftover(obj));
&& !__camIsValidLeftover(obj)
&& (!camDef(bi.player) ||
camPlayerMatchesFilter(obj.player, bi.player))
);
});
if (nonValidLeftovers.length)
{
Expand Down
2 changes: 1 addition & 1 deletion data/base/wrf/cam1/cam1c/labels.json
Expand Up @@ -38,7 +38,7 @@
"area_12": { "label": "AmbushForce", "pos1": [ 10944, 10816 ], "pos2": [ 11712, 11712 ]},
"object_8": { "label": "AmbushForceCommander", "id": 3276, "player": 1, "type": 0 },

"area_13": {"label": "ScavSouthDerrick", "pos1": [ 9920, 14272 ], "pos2": [ 11072, 16192 ]},
"area_13": {"label": "ScavSouthDerrick", "pos1": [ 9920, 14848 ], "pos2": [ 11072, 16192 ]},
"area_14": {"label": "ScavSouthEastHighground", "pos1": [ 11200, 11968 ], "pos2": [ 14912, 14784 ]},
"area_15": {"label": "ScavNorthBase", "pos1": [ 8000, 192 ], "pos2": [ 9664, 1600 ]},
"area_16": {"label": "ScavSouthPodPits", "pos1": [ 8384, 2624 ], "pos2": [ 10048, 4672 ]},
Expand Down

0 comments on commit 01b4e29

Please sign in to comment.