-
Notifications
You must be signed in to change notification settings - Fork 70
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
Weakness effect not working as expected. #742
Comments
Hmm not sure if it's directly related to the weakness effect but there definitely seems something strange going on in those logs that needs to be investigated. This is possibly related to #707. P.S. Regarding the |
It could be that it's trying to take the damage from the sword and, because of how the minecraft weakness potion works, it's retrieving the current player damage? That being 0 or below. https://www.youtube.com/watch?v=My5da2RkfOI Wooden/golden sword and hand - Damage canceled, not even trying to do damage. |
OCM deliberately sets weakness at level 0 so that originally weaker weapons that have been set to a higher damage in the config can still get through - and then calculates what the damage with weakness should be. Maybe this mechanism is not working quite as intended under certain circumstances. |
I only tested on Paper 1.20.4 to suit my needs, but the main issue I found is that OCM setting the weakness amplification to -1 results in weakness 256 being applied, I suppose because modern Minecraft doesn't allow negative amplifiers. All of my OCM changes can be seen in this commit. Some of those changes were to allow for other levels of weakness to be applied, as OCM clamps the amplifier to vanilla restrictions, which may not be relevant to everyone. These changes are paired with the following event handler in a different Paper plugin: @EventHandler
public void onPrePlayerAttackEntity(PrePlayerAttackEntityEvent e) {
if(!e.getPlayer().hasPotionEffect(PotionEffectType.WEAKNESS)
|| !(e.getAttacked() instanceof Player victim)
) {
return;
}
victim.damage(1D, e.getPlayer());
} This fixes the issue that attacks with zero damage do not fire entity damage events. |
We apply an amplifier of -1 which translated to a potion level of 0 in the game, giving no weakness. This was tested and working up to at least Spigot 1.19. It's possible we might need a different approach entirely, but what you suggest in your code breaks the whole idea of setting the value to -1. If the weakness effect is actually applied by the game, we might miss some attacks that did not get through the damage immunity because the 1.9 base damage for a weapon is lower than what is configured by the plugin (to follow 1.8), and compounded with the weakness effect this means the DamageEvent is straight up never called in those circumstances. |
Information
Server Log
config.yml
Problem Description
Weakness working weird, it makes that the player does little to no damage with a netherite sword with no enchantments or Sharpness V, even if the player is using Strength II
To Reproduce
Steps to reproduce the behavior:
Expected Behaviour
Only reducing some damage pre armor reduction calculation.
Actual Behaviour
Reduces damage pre calculation, I think it's the base damage fault here.
If you need any screenshot or video tell me, but I think it's very easy to reproduce, I'm using the default config.
I tried to change the base weakness values, but I got weirder results.
The text was updated successfully, but these errors were encountered: