Hi guys, I'm back.
I'm looking to alter Player::getLostPercent(). Here's what I have so far ([Edit - Red] for my changes.)
I've commented out the altering of lossPercent if the player is promoted. Instead, I'd like a piece of code that manipulates lossPercent depending on the player's level.
The plaintext formula I wrote is:
I've written a debugging code in Lua to be able to print the newly desired death penalty. My code in Lua looks like this (multiplied then floor'd then divided to round to the thousandths place):
With this information, I'm asking if anybody would be able to help me translate that formula into the source code so players actually lose experience based on my formula, as I'm unfamiliar and do not understand C++ syntax well enough to do it myself.
I appreciate the time, even for reading this
Red
I'm looking to alter Player::getLostPercent(). Here's what I have so far ([Edit - Red] for my changes.)
Code:
double Player::getLostPercent() const
{
std::bitset<5> bitset(blessings);
const int32_t deathLosePercent = g_config.getNumber(ConfigManager::DEATH_LOSE_PERCENT);
if (deathLosePercent != -1) {
int32_t lossPercent = deathLosePercent;
if (isPromoted()) {
lossPercent -= 3;
}
lossPercent -= (int32_t)bitset.count();
return std::max<int32_t>(0, lossPercent) / (double)100;
} else {
double lossPercent;
if (level >= 25) {
double tmpLevel = level + (levelPercent / 100.);
lossPercent = (double)((tmpLevel + 50) * 50 * ((tmpLevel * tmpLevel) - (5 * tmpLevel) + 8)) / experience;
} else {
lossPercent = 10;
}
/* [Edit - Red]
if (isPromoted()) {
lossPercent *= 0.7;
}
*/
/* [Red - End] */
return lossPercent * pow(0.92, (int32_t)bitset.count()) / 100;
}
}
I've commented out the altering of lossPercent if the player is promoted. Instead, I'd like a piece of code that manipulates lossPercent depending on the player's level.
The plaintext formula I wrote is:
Code:
1 / (level + 159) * 112
I've written a debugging code in Lua to be able to print the newly desired death penalty. My code in Lua looks like this (multiplied then floor'd then divided to round to the thousandths place):
Code:
lossPercent = lossPercent * (math.floor(((1 / (level + 159)) * 112) * 1000) / 1000)
With this information, I'm asking if anybody would be able to help me translate that formula into the source code so players actually lose experience based on my formula, as I'm unfamiliar and do not understand C++ syntax well enough to do it myself.
I appreciate the time, even for reading this
Red