Permalink
Browse files

Balance and bug fixes for ECM jammer.

It used to get its range from the unit's sensor, rather
than the ECM stats. This has been fixed so that instead,
it gets its sensor range from its ECM range. Having two
separate effective ranges would be somewhat difficult
for technical reasons.

This reduces the effective range of the ECM jammer in the
late game quite a lot, since it no longer gets range
increases from sensor upgrades.

Also, ECM jammer stats changed slightly:
Build points from 100 -> 750
Build power from 20 -> 500
Weight from 100 -> 10000
  • Loading branch information...
perim committed Nov 12, 2017
1 parent 37a2a30 commit 0e78612aebdf738677bfb1d5986771667373e354
Showing with 18 additions and 11 deletions.
  1. +3 −3 data/mp/stats/ecm.json
  2. +2 −2 src/display.cpp
  3. +0 −5 src/droid.h
  4. +1 −1 src/oprint.cpp
  5. +12 −0 src/visibility.h
View
@@ -1,7 +1,7 @@
{
"ECM1TurretMk1": {
"buildPoints": 100,
"buildPower": 20,
"buildPoints": 750,
"buildPower": 500,
"designable": 1,
"droidType": "DROID_ECM",
"hitpoints": 200,
@@ -11,7 +11,7 @@
"name": "Jammer Turret",
"range": 1024,
"sensorModel": "gnmecm1.pie",
"weight": 100
"weight": 10000
},
"RepairCentre": {
"id": "RepairCentre",
View
@@ -1529,7 +1529,7 @@ static void printDroidClickInfo(DROID *psDroid)
console("%s - Hitpoints %d/%d - ID %d - experience %f, %s - order %s - action %s - sensor range %hu - ECM %u - pitch %.0f - frust %u",
droidGetName(psDroid), psDroid->body, psDroid->originalBody, psDroid->id,
psDroid->experience / 65536.f, getDroidLevelName(psDroid), getDroidOrderName(psDroid->order.type), getDroidActionName(psDroid->action),
droidSensorRange(psDroid), droidJammerPower(psDroid), UNDEG(psDroid->rot.pitch), psDroid->lastFrustratedTime);
droidSensorRange(psDroid), objJammerPower(psDroid), UNDEG(psDroid->rot.pitch), psDroid->lastFrustratedTime);
FeedbackOrderGiven();
}
else if (!psDroid->selected)
@@ -1555,7 +1555,7 @@ static void dealWithLMBDroid(DROID *psDroid, SELECTION_TYPE selection)
console("(Enemy!) %s - Hitpoints %d/%d - ID %d - experience %f, %s - order %s - action %s - sensor range %d - ECM %d - pitch %.0f",
droidGetName(psDroid), psDroid->body, psDroid->originalBody, psDroid->id,
psDroid->experience / 65536.f, getDroidLevelName(psDroid), getDroidOrderName(psDroid->order.type),
getDroidActionName(psDroid->action), droidSensorRange(psDroid), droidJammerPower(psDroid), UNDEG(psDroid->rot.pitch));
getDroidActionName(psDroid->action), droidSensorRange(psDroid), objJammerPower(psDroid), UNDEG(psDroid->rot.pitch));
FeedbackOrderGiven();
}
orderSelectedObjAdd(selectedPlayer, (BASE_OBJECT *)psDroid, ctrlShiftDown());
View
@@ -314,11 +314,6 @@ static inline int droidSensorRange(const DROID *psDroid)
return objSensorRange((const BASE_OBJECT *)psDroid);
}
static inline int droidJammerPower(const DROID *psDroid)
{
return objJammerPower((const BASE_OBJECT *)psDroid);
}
/*
* Component stat helper functions
*/
View
@@ -196,7 +196,7 @@ void printDroidInfo(const DROID *psDroid)
printBaseObjInfo((BASE_OBJECT *)psDroid);
CONPRINTF(ConsoleString, (ConsoleString, " wt %d bSpeed %d sRng %d ECM %d bdy %d\n",
psDroid->weight, psDroid->baseSpeed, droidSensorRange(psDroid), droidJammerPower(psDroid), psDroid->body));
psDroid->weight, psDroid->baseSpeed, droidSensorRange(psDroid), objJammerPower(psDroid), psDroid->body));
if (psDroid->asWeaps[0].nStat > 0)
{
View
@@ -74,14 +74,26 @@ static inline bool visObjInRange(BASE_OBJECT *psObj1, BASE_OBJECT *psObj2, SDWOR
return abs(xdiff) <= range && abs(ydiff) <= range && xdiff * xdiff + ydiff * ydiff <= range;
}
// If we have ECM, use this for range instead. Otherwise, the sensor's range will be used for
// jamming range, which we do not want. Rather limit ECM unit sensor range to jammer range.
static inline int objSensorRange(const BASE_OBJECT *psObj)
{
if (psObj->type == OBJ_DROID)
{
const int ecmrange = asECMStats[((DROID *)psObj)->asBits[COMP_ECM]].upgrade[psObj->player].range;
if (ecmrange > 0)
{
return ecmrange;
}
return asSensorStats[((DROID *)psObj)->asBits[COMP_SENSOR]].upgrade[psObj->player].range;
}
else if (psObj->type == OBJ_STRUCTURE)
{
const int ecmrange = ((STRUCTURE *)psObj)->pStructureType->pECM->upgrade[psObj->player].range;
if (ecmrange)
{
return ecmrange;
}
return ((STRUCTURE *)psObj)->pStructureType->pSensor->upgrade[psObj->player].range;
}
return 0;

1 comment on commit 0e78612

@vaut

This comment has been minimized.

Show comment
Hide comment
@vaut

vaut Nov 12, 2017

Contributor

Thanks.

Contributor

vaut commented on 0e78612 Nov 12, 2017

Thanks.

Please sign in to comment.