Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buffed repair speed for wheels, hover and cyborgs #3705

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions data/mp/stats/propulsion.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"turnSpeed": 225,
"type": "Legged",
"usageClass": "Cyborg",
"weight": 50
"weight": 50,
"repairFactor": 125
},
"HalfTrack": {
"buildPoints": 75,
Expand Down Expand Up @@ -107,7 +108,8 @@
"skidDeceleration": 120,
"speed": 300,
"type": "Hover",
"weight": 200
"weight": 200,
"repairFactor": 150
},
"tracked01": {
"buildPoints": 125,
Expand All @@ -133,6 +135,7 @@
"skidDeceleration": 350,
"speed": 175,
"type": "Wheeled",
"weight": 300
"weight": 300,
"repairFactor": 200
}
}
7 changes: 7 additions & 0 deletions lib/framework/math_ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ static inline WZ_DECL_CONST T clip(T x, T min, T max)
return x < min ? min : x > max ? max : x;
}

template <typename T>
static inline WZ_DECL_CONST T idiv_round(T numerator, T denominator)
{
return ((numerator < 0) == (denominator < 0))
? ((numerator + denominator / 2) / denominator)
: ((numerator - denominator / 2) / denominator);
}

/*!
* Clips x to boundaries
Expand Down
2 changes: 2 additions & 0 deletions src/droid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1343,6 +1343,8 @@ static bool droidUpdateDroidRepairBase(DROID *psRepairDroid, DROID *psDroidToRep

int iPointsToAdd = gameTimeAdjustedAverage(iRepairRateNumerator, iRepairRateDenominator);

iPointsToAdd = idiv_round<int>(iPointsToAdd * psDroidToRepair->getPropulsionStats()->repairFactor, 100);

psDroidToRepair->body = clip<UDWORD>(psDroidToRepair->body + iPointsToAdd, 0, psDroidToRepair->originalBody);

/* add plasma repair effect whilst being repaired */
Expand Down
1 change: 1 addition & 0 deletions src/stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,7 @@ bool loadPropulsionStats(WzConfig &ini)
psStats->acceleration = ini.value("acceleration", 250).toInt();
ASSERT(psStats->acceleration != 0, "\"%s\".\"acceleration\" is 0", psStats->id.toUtf8().c_str());
psStats->deceleration = ini.value("deceleration", 800).toInt();
psStats->repairFactor = ini.value("repairFactor", 100).toInt();
psStats->skidDeceleration = ini.value("skidDeceleration", 600).toInt();
psStats->pIMD = nullptr;
psStats->pIMD = statsGetIMD(ini, psStats, "model");
Expand Down
1 change: 1 addition & 0 deletions src/statsdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ struct PROPULSION_STATS : public COMPONENT_STATS
unsigned skidDeceleration = 0;
unsigned deceleration = 0;
unsigned acceleration = 0;
unsigned repairFactor = 0;

struct UPGRADE : COMPONENT_STATS::UPGRADE
{
Expand Down
Loading