Pocketmine-mp: Slowness Effect levels >= 7 do not reset FOV when removed

Created on 17 Nov 2017  路  5Comments  路  Source: pmmp/PocketMine-MP

Issue description

  • Expected result: FOV reverts back to normal after slowness effect is removed/expires.
  • Actual result: FOV does not revert back to normal until you rejoin. _This cannot be reproduced in vanilla_.

Steps to reproduce the issue

  1. /give slowness 1 100
  2. Your FOV wont revert back.

OS and versions

  • PocketMine-MP: 48a7627
  • PHP: 7.2RC6
  • Server OS: Ubuntu 14.04 LTS 64-bit
  • Game version: Win10

Plugins

  • Test on a clean server without plugins: Issue still exists
Gameplay Debugged To Do

Most helpful comment

The problem arises here: https://github.com/pmmp/PocketMine-MP/blob/master/src/pocketmine/entity/Effect.php#L474 - due to the dividend of the operation being zero. It's capped (is that the right word?) at zero when adding the effect and can't go below that.

In vanilla I think this is handled using attribute modifiers which effectively change the output value of an attribute, instead of modifying its base value directly. This is not implemented in PocketMine-MP.

Not sure how best to fix this - I don't think there's any real non-hacky way to do it.

All 5 comments

I remember having this issue on earlier versions(dating back to 0.15). Running fixed it for me.

The only way I can reproduce this is by using excessive amplifiers (>= 7) so that the player's speed decreases to zero. Is that what you're describing?

Yes. In vanilla, the speed does get put to zero when you use amplifier >= 7 but the FOV reverts back to normal once slowness goes away.

The problem arises here: https://github.com/pmmp/PocketMine-MP/blob/master/src/pocketmine/entity/Effect.php#L474 - due to the dividend of the operation being zero. It's capped (is that the right word?) at zero when adding the effect and can't go below that.

In vanilla I think this is handled using attribute modifiers which effectively change the output value of an attribute, instead of modifying its base value directly. This is not implemented in PocketMine-MP.

Not sure how best to fix this - I don't think there's any real non-hacky way to do it.

https://github.com/pmmp/PocketMine-MP/blob/2d3ce9e8b027161c9d8b4145c94a3813d1ab9497/src/pocketmine/entity/Effect.php#L361
this sets negative value if effectlevel is >=7
how about
$attr->setValue(max($attr->getMinValue(),$attr->getValue() / (1 - 0.15 * $instance->getEffectLevel())));

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dktapps picture dktapps  路  3Comments

SuperAdam47 picture SuperAdam47  路  3Comments

Ox531 picture Ox531  路  3Comments

Muqsit picture Muqsit  路  3Comments

nmo0ory picture nmo0ory  路  3Comments