Project MMO

Project MMO

10M Downloads

[1.19.2] Death XP Loss

SomewhatDamaged opened this issue ยท 2 comments

commented

Describe the bug
Setting "Loss on death" = 1.0 and "Lose Levels On Death" = true doesn't have the intended action of scrubbing all skills when the player dies.

Expected behavior
Setting "Loss on death" = 1.0 and "Lose Levels On Death" = true should mean you lose all your levels every time you die.

To Reproduce
Steps to reproduce the behavior:

  1. Create new game
  2. Give some XP
  3. Exit and add applicable settings
  4. Load up
  5. Die
  6. Still have levels

Screenshots
If applicable, add screenshots to help explain your problem.

Versions:

  • Minecraft: 1.19.2 (probably others that have the same code)
  • Loader: Forge-43.2.11
  • PMMO: 1.19.2-3.1.2

Additional context
| ||
|| |_

commented

Ah, I see the issue.

This code grabs the value, checks if it is 1.0 and, if so, sets lossRatio to 1.0

Otherwise it sets lossRatio to 1 - LOSS_ON_DEATH

double lossRatio = Config.LOSS_ON_DEATH.get() == 1.0
? 1.0
: 1 - Config.LOSS_ON_DEATH.get();

Then, since LOSE_LEVELS_ON_DEATH is true, the else block executes.

This sets the xp to losableXp * lossRatio and since lossRatio is 1.0, it literally sets the XP to the losableXp value.

finalXp = Double.valueOf(losableXp * lossRatio).longValue();

Perhaps an exception needs to be made explicitly for when loss is 1.0 ~ line 43?

Ultimately a rewrite of the function might be better. It seems to be doing too much with one variable lossRatio.

commented

https://youtu.be/axIFqKUewVo

I hope this helps. The "lose level on Death" option doesn't seem to be having any effect. I used the Configured mod because it's practical, but I've tried it in several ways, like editing pmmo-server directly, closing the game, editing with the game open, I've done everything and the effect is the same. It doesn't work as suggested that it would at least lose the current XP and go back one level down, in this case, the excavation level should have gone back to level 1. But what I really wanted was for everyone to go back to zero.