Giter Site home page Giter Site logo

Comments (85)

kernitus avatar kernitus commented on May 20, 2024

I just went through the 1.9 changelog and found several things that changed I hadn't noticed. Quite a few potions changed, so I'll be adding that to the to do list along with other unnoticed changes to combat.

from bukkitoldcombatmechanics.

Ferocimo avatar Ferocimo commented on May 20, 2024

Bumping this, do you think you will soon be able to do what we suggested in this topic ? (I'm co-founder of Blamo27' server, we're still waiting for this enhancement to be done x) )

from bukkitoldcombatmechanics.

kernitus avatar kernitus commented on May 20, 2024

I currently do not have time to implement this, but if you really want this done you could help by doing the research and finding exactly what potions changed and how.

from bukkitoldcombatmechanics.

Ferocimo avatar Ferocimo commented on May 20, 2024

Okay.

DIFFERENCES IN POTIONS FROM 1.8 TO LATEST VERSIONS

=====NORMAL POTIONS=====
-DURATION-
Regeneration I extended now lasts 1:30m instead of 2m in previous versions of the game.
Poison I extended now lasts 1:30m instead of 2m in previous versions of the game.
-EFFECT-
Strength I now adds +3 attack damage instead of +130%.
Strength II now adds +6 attack damage instead of +260%.

=====SPLASH POTIONS=====
-DURATION-
Every splash potion that previously lasted 0:33 seconds now last 0:45 seconds (poison and regeneration).
Every splash potion that previously lasted 2m15s now last 3 minutes (speed, fire res, night vision, strength, jump boost, water breathing, invisibility).
Every splash potion that previously lasted 1m07s now last 1m30s (weakness and slowness).

Every extended splash potion that previously lasted 6 minutes now last 8 minutes (speed, fire res, night vision, strength, jump boost, water breathing, invisibility).
Every extended splash potion that previously lasted 3 minutes now last 4 minutes (weakness and slowness).

Every splash potion II that previously lasted 0:16 seconds now last 0:22 seconds (poison and regeneration).
Every splash potion II that previously lasted 1m07s now last 1m30s (speed, strength, jump boost).
-EFFECT-
Strength I now adds +3 attack damage instead of +130%.
Strength II now adds +6 attack damage instead of +260%.

Also they added lingering potions but since this is a new feature you don't have to touch the values of those.

Please note that, as far as we are concerned, we ONLY CARE ABOUT THE STRENGTH POTION. All other changes are not absolutely crucial, but this one is. The change made with the strengh potion is is a key difference, because previously, the fact that it was a percentage means that the higher the damages of your sword, the higher the additionnal damages given by the potion. Now it's always 3 or 6 additionnal damages. This completely changes the damages dealt in end-game fights (with protection IV armors etc, where the strength potion is a must-have). In fact, because of this change, the fights in the latest versions of the game are entirely different that what they were in previous versions, because players deal far, far less damages without the old percentages given by the strength potions. This makes the very purpose of OldCombatMechanics -to recreate the way players used to fight in previous versions- an unachieved goal.

So, if you don't have time to work on all the changes made on these potions, we would greatly appreciate if you could focus specifically on the strength potion, in order to release an update which would allow us to recreate the way the old strength potion worked.
Thank you for your time.

from bukkitoldcombatmechanics.

kernitus avatar kernitus commented on May 20, 2024

Alright, thank you for doing the research.
I'll make the strength potion the priority, will implement it as soon as I have time.

from bukkitoldcombatmechanics.

Rida94 avatar Rida94 commented on May 20, 2024

Just found this which used to do a similar feature
https://www.spigotmc.org/resources/legacypotions.17698/
source code:
https://github.com/MinelinkNetwork/LegacyStrength

from bukkitoldcombatmechanics.

kernitus avatar kernitus commented on May 20, 2024

Ok, I'm having a look at this. It starts getting complicated as critical hits (150% damage) are applied after potion effects but before enchantments.

from bukkitoldcombatmechanics.

Blamo27 avatar Blamo27 commented on May 20, 2024

@gvlfm78 @rayzr522 Any update ?

from bukkitoldcombatmechanics.

kernitus avatar kernitus commented on May 20, 2024

@Blamo27 I was actually working on this but then had to stop as I ran out of time. I should, although, have some time to work on this in the next few weeks. Ping me again if I forget

from bukkitoldcombatmechanics.

Blamo27 avatar Blamo27 commented on May 20, 2024

@gvlfm78 Okey thanks :)

from bukkitoldcombatmechanics.

Blamo27 avatar Blamo27 commented on May 20, 2024

@gvlfm78 So, any progress...?

from bukkitoldcombatmechanics.

kernitus avatar kernitus commented on May 20, 2024

Well, I had started working on this and produced some code but I found this feature to be a lot more complicated than I thought it would be. Currently, I am entering exam season, so I definitely won't have time to work on it. However, as soon as those are over this will be one of the main priorities for this plugin, along with long-needed bug-fixes.

from bukkitoldcombatmechanics.

Ferocimo avatar Ferocimo commented on May 20, 2024

Okay, please don't forget to let us know when you'll have this fixed, good luck for your finals !

from bukkitoldcombatmechanics.

Blamo27 avatar Blamo27 commented on May 20, 2024

@gvlfm78 ping ? 😢

from bukkitoldcombatmechanics.

kernitus avatar kernitus commented on May 20, 2024

@Blamo27 Ah sorry man I forgot about this. Pleased ping me again in three days and I'll try to work on it

from bukkitoldcombatmechanics.

rayzr522 avatar rayzr522 commented on May 20, 2024

If you forget, I'll make sure to remind him ;p

from bukkitoldcombatmechanics.

Blamo27 avatar Blamo27 commented on May 20, 2024

@gvlfm78 Ping ! 🏓

from bukkitoldcombatmechanics.

Blamo27 avatar Blamo27 commented on May 20, 2024

@gvlfm78 timeout 1 200 000 ms ⚠️

from bukkitoldcombatmechanics.

kernitus avatar kernitus commented on May 20, 2024

I'll try to have a look at this tomorrow.

from bukkitoldcombatmechanics.

Blamo27 avatar Blamo27 commented on May 20, 2024

@gvlfm78 Okey

from bukkitoldcombatmechanics.

Blamo27 avatar Blamo27 commented on May 20, 2024

@gvlfm78 some news about the fix ?

from bukkitoldcombatmechanics.

kernitus avatar kernitus commented on May 20, 2024

@Blamo27 alright so I have been working on this and have most of the code ready, however you need to wait about a week until I get back and I can finish it off

from bukkitoldcombatmechanics.

Blamo27 avatar Blamo27 commented on May 20, 2024

@gvlfm78 thanks 😄

from bukkitoldcombatmechanics.

Blamo27 avatar Blamo27 commented on May 20, 2024

@gvlfm78 Some news ?

from bukkitoldcombatmechanics.

kernitus avatar kernitus commented on May 20, 2024

@Blamo27 I have been working on this today. I have gotten configurable potion-effect durations to work for all potions in test version 55 if you want to test it. I still need to finish the work on the 1.8 effects.

from bukkitoldcombatmechanics.

Blamo27 avatar Blamo27 commented on May 20, 2024

@gvlfm78 Thanks, I'll test this

from bukkitoldcombatmechanics.

kernitus avatar kernitus commented on May 20, 2024

Well in the meantime @Blamo27 I have completed this module adding configurable strength and weakness potion effects. In order to do so and retain compatibility with the old tool damage module I had to rewrite both to use a custom event system, also to avoid performing the calculations twice. You can try this new build here.

from bukkitoldcombatmechanics.

Blamo27 avatar Blamo27 commented on May 20, 2024

@gvlfm78 Jenkins down ?

from bukkitoldcombatmechanics.

kernitus avatar kernitus commented on May 20, 2024

@Blamo27 Seems to be working fine for me..

from bukkitoldcombatmechanics.

Blamo27 avatar Blamo27 commented on May 20, 2024

@gvlfm78 Yep it was down for few hours, it's working fine now
I downloaded the latest build but still not tested

I will test this soon, thank you 👍

from bukkitoldcombatmechanics.

Ferocimo avatar Ferocimo commented on May 20, 2024

@gvlfm78 @rayzr522 Testing done : for now, we found two main issues.

1- With the "old effects for potions" module enabled, drinking potions no longer gives the empty bottle it should give.

2- Drinking from a stack of potions drinks the whole stack. This is mainly a problem for the use of Mobarena, with several classes giving players stacks of potions.

We had to disable the module for now because of these bugs, so we don't know yet if there's more. We'll be sure to let you know if we find anything else.

from bukkitoldcombatmechanics.

kernitus avatar kernitus commented on May 20, 2024

@Ferocimo are players normally given empty bottles when they drink a potion from the stack during Mobarena?

from bukkitoldcombatmechanics.

kernitus avatar kernitus commented on May 20, 2024

@Ferocimo @Blamo27 Those issues should now be fixed in test build 58, together with issue #220 and #225. Please try the new build.

from bukkitoldcombatmechanics.

Ferocimo avatar Ferocimo commented on May 20, 2024

Yes they normally gain empty bottles even in mobarena.

We're going to update and test, we'll keep you updated.

from bukkitoldcombatmechanics.

Ferocimo avatar Ferocimo commented on May 20, 2024

Okay these two issues are fixed, thanks, we'll do some more testing later to see if everything works fine.

from bukkitoldcombatmechanics.

Ferocimo avatar Ferocimo commented on May 20, 2024

@gvlfm78 Testing done, duration module doesn't work. Potions APPEAR to last, for instance, 1 minute 30 seconds, but really they last 1 minute 8 seconds (this is just an example, it's the case for many different potions).

from bukkitoldcombatmechanics.

kernitus avatar kernitus commented on May 20, 2024

@Ferocimo So do you mean the effect disappears before the countdown reaches 0?

from bukkitoldcombatmechanics.

Ferocimo avatar Ferocimo commented on May 20, 2024

@gvlfm78 No the countdown starts at 1 minute 8 seconds, even though it's written "(1:30)" in potion lore.

from bukkitoldcombatmechanics.

kernitus avatar kernitus commented on May 20, 2024

@Ferocimo But that's how it's supposed to work, if you go back to your original comment above it says:

Every splash potion II that previously lasted 1m07s now last 1m30s (speed, strength, jump boost).

So the potion in 1.9 should last 1:30 seconds, but instead I made it last 1m8s as it was in 1.8.

from bukkitoldcombatmechanics.

Ferocimo avatar Ferocimo commented on May 20, 2024

@gvlfm78 Yes, every SPLASH potion ! :p
I'm talking about drinkable potions : those lasted, have always lasted, and therefore should still last, 1:30 minute.

from bukkitoldcombatmechanics.

kernitus avatar kernitus commented on May 20, 2024

@Ferocimo What potion in particular did you drink?

from bukkitoldcombatmechanics.

Ferocimo avatar Ferocimo commented on May 20, 2024

@gvlfm78 Strength potion II. Should lasts 1:30.

from bukkitoldcombatmechanics.

Ferocimo avatar Ferocimo commented on May 20, 2024

It is also the case with Jump boost II and Speed II (1:30), they only last 1:07 instad of 1:30.
Moreover, here are the duration issues I spotted so far, besides the ones detailed previously :
Slowness I (4:00) lasts only 3:00 when drinkable,
Slowness I (1:30) lasts only 1:07 when drinkable, when prior to 1.9 it lasted 2:00,
Poison II (0:21) lasts only 0:17 when drinkable,
Water Breathing (8:00) lasts only 6:00 when drinkable,
Regeneration I (1:30) lasts only 1:30 when drinkable, when prior to 1.9 it lasted 2:00,
Poison I (1:30) lasts only 1:30 when drinkable, when prior to 1.9 it lasted 2:00.

I only tested drinkable potion so far, we'll see for the rest later.

from bukkitoldcombatmechanics.

kernitus avatar kernitus commented on May 20, 2024

@Ferocimo Well, it seems I forgot to add in a check for drinkable potions so it was always applying the splash potion times... Please try this test build and see if the times are now correct

from bukkitoldcombatmechanics.

Ferocimo avatar Ferocimo commented on May 20, 2024

@gvlfm78 It doesn't seem to have changed anything I'm affraid... Isues mentionned in my previous post are still there.

from bukkitoldcombatmechanics.

Ferocimo avatar Ferocimo commented on May 20, 2024

(note : when performing /version oldCombatMechanics, it just show that we have 1.7.0, is it the correct one ? Because we downloaded the latest version on http://ci.rayzr.tech/job/OldCombatMechanics/ since the link you gave was dead)

from bukkitoldcombatmechanics.

Ferocimo avatar Ferocimo commented on May 20, 2024

@gvlfm78 Any news ?

from bukkitoldcombatmechanics.

I-Al-Istannen avatar I-Al-Istannen commented on May 20, 2024

Can you try this build? @Blamo27
OCM.zip

It is a dramatic change:

@@ -61,7 +61,7 @@ public class ModuleOldPotionEffects extends Module {
         if(isExcludedPotion(potionType)) return;
         event.setCancelled(true);
 
-        int duration = getPotionDuration(potionData, true);
+        int duration = getPotionDuration(potionData, false);
 
         PotionEffectType pet = potionType.getEffectType();

from bukkitoldcombatmechanics.

Blamo27 avatar Blamo27 commented on May 20, 2024

@I-Al-Istannen Can you do a commit please ?
To auto build / compile the jar ?

from bukkitoldcombatmechanics.

I-Al-Istannen avatar I-Al-Istannen commented on May 20, 2024

I do not have write access to the repository, so I can't. You'd either have to wait for @gvlfm78 or @rayzr522 to make that change themselves (or merge a PR if I make one) or you trust me.
Or you build it yourself from my fork here. You can see the diff to the current master in this repo if you click compare:
grafik
I can not influence that diff, it is from github themselves. You can build it by cloning/downloading it and running mvn package when inside the directory.

from bukkitoldcombatmechanics.

kernitus avatar kernitus commented on May 20, 2024

@I-Al-Istannen if you make a PR I'll merge it immediately, unfortunately I can't edit the code right now

from bukkitoldcombatmechanics.

I-Al-Istannen avatar I-Al-Istannen commented on May 20, 2024

@gvlfm78 Done

from bukkitoldcombatmechanics.

Ferocimo avatar Ferocimo commented on May 20, 2024

From what I've seen so far it seems to work well. Will update if not. Thank you.

from bukkitoldcombatmechanics.

Ferocimo avatar Ferocimo commented on May 20, 2024

@gvlfm78 @I-Al-Istannen
Ok so, duration seems to be okay but strength effect is far, far too high. You can 3 shots a player with Protection 4 diamond armor.
I don't quite understand how your module works though, regarding strength effect : how to use it to recreate pre 1.9 effect ?

Module config says :

# EFFECTS
# If 'multiplier' is true value is multiplied by base tool damage, otherwise added
# Strength potion
# 1.9: I = +3; II = +6;    1.8: I = +130%; II = +260%
strength:
  modifier: 2.3
  multiplier: true
# Weakness potion
# 1.9 value: -4   1.8 value: -0.5
weakness:
  modifier: -4.0
  multiplier: false

from bukkitoldcombatmechanics.

kernitus avatar kernitus commented on May 20, 2024

@Ferocimo It's already set to recreate a pre-1.9 effect, as I was instructed in the information comment you posted a while ago. You said in 1.8 a strength I potion's effect was +130% of the damage, which means multiplying the damage by 2.3. Unless you meant 130% of the original damage, which would be +30% and thus a damage multiplier of 1.3.

from bukkitoldcombatmechanics.

Ferocimo avatar Ferocimo commented on May 20, 2024

@gvlfm78
It was indeed written +130%, like this :
https://www.digminecraft.com/brewing_recipes/images/completed_potion_strength.png

So, from a logical point of view you are right, it is a multiplier of 2.3. However, practically speaking, your multiplier seems far too high. Maybe it wasn't really "+130%" like the game said, but +30% ?

I did several tests and found that, to my feeling and the feeling of several "1.8 pvp" players, the closest experience ressembling pre 1.9 strength potions you get is with a multiplier of 0.6. I know that technically speaking it should DECREASE the damage upon drinking the potion, but it does not. Don't ask me why...

from bukkitoldcombatmechanics.

I-Al-Istannen avatar I-Al-Istannen commented on May 20, 2024

Maybe because strength increments the generic.attackDamage by 1.3 * currentValue (so + 130%) and then armor, protection and everything is factored in after that?
I haven't looked to in-depth at where you apply those modifications, but I hope you also do it after adding strength modifiers.

Did not look like that from a swift look, but I could have very easily missed something.

@gvlfm78

from bukkitoldcombatmechanics.

kernitus avatar kernitus commented on May 20, 2024

The module acts on EntityDamageEvent's getDamage(), which is the 'raw damage', as opposed to getFinalDamage(), which is defined in the docs as "the amount of damage caused by the event after all damage reduction is applied" and thus the armour effects should be calculated after the plugin has intervened. The order of intervention is:

  • base damage
  • weakness modifier
  • strength modifier
  • critical hit multiplier
  • enchantments
    it is then set back using setDamage() and Bukkit should be handling the damage reduction (armour, blocking etc.).

In fact, @Ferocimo , you can enable debug mode in the config and you should get a very detailed breakdown of what the module is doing at each step.

from bukkitoldcombatmechanics.

Ferocimo avatar Ferocimo commented on May 20, 2024

@gvlfm78 I'm not sure what you're asking, do you want me to test it in debug mode and post the results ?

from bukkitoldcombatmechanics.

kernitus avatar kernitus commented on May 20, 2024

@Ferocimo essentially, yes

from bukkitoldcombatmechanics.

Ferocimo avatar Ferocimo commented on May 20, 2024

@gvlfm78 Sorry for the delay :

[21:22:36] [Client thread/INFO]: [CHAT] [DEBUG] Raw damage: 19.5
[21:22:36] [Client thread/INFO]: [CHAT] [DEBUG] Mob: 0.0 Sharpness: 0.0
[21:22:36] [Client thread/INFO]: [CHAT] [DEBUG] No ench damage: 19.5
[21:22:36] [Client thread/INFO]: [CHAT] [DEBUG] Critical hit detected
[21:22:36] [Client thread/INFO]: [CHAT] [DEBUG] Strength Modifier: 6.0
[21:22:36] [Client thread/INFO]: [CHAT] [DEBUG] Weakness Modifier: 0.0
[21:22:36] [Client thread/INFO]: [CHAT] [DEBUG] Base tool damage: 7.0
[21:22:36] [Client thread/INFO]: [CHAT] [DEBUG][ModuleOldToolDamage] Old tool damage: 7.0 New tool damage: 7.0
[21:22:36] [Client thread/INFO]: [CHAT] [DEBUG][ModuleOldToolDamage] Old sharpness damage: 0.0 New: 0.0
[21:22:36] [Client thread/INFO]: [CHAT] [DEBUG][ModuleOldPotionEffects] Old strength modifier: 6.0 New: 0.6
[21:22:36] [Client thread/INFO]: [CHAT] [DEBUG][EntityDamageByEntityListener] Base: 7.0
[21:22:36] [Client thread/INFO]: [CHAT] [DEBUG][EntityDamageByEntityListener] Weak: 0.0
[21:22:36] [Client thread/INFO]: [CHAT] [DEBUG][EntityDamageByEntityListener] Strength: 1.2
[21:22:36] [Client thread/INFO]: [CHAT] [DEBUG][EntityDamageByEntityListener] Crit: 1.5
[21:22:36] [Client thread/INFO]: [CHAT] [DEBUG][EntityDamageByEntityListener] Mob 0.0 Sharp: 0.0
[21:22:36] [Client thread/INFO]: [CHAT] [DEBUG][EntityDamageByEntityListener] New Damage: 12.600000000000001

from bukkitoldcombatmechanics.

kernitus avatar kernitus commented on May 20, 2024

@Ferocimo Can you do that without a critical hit?

from bukkitoldcombatmechanics.

Ferocimo avatar Ferocimo commented on May 20, 2024

@gvlfm78

[13:47:00] [Client thread/INFO]: [CHAT] [DEBUG] Raw damage: 13.0
[13:47:00] [Client thread/INFO]: [CHAT] [DEBUG] Mob: 0.0 Sharpness: 0.0
[13:47:00] [Client thread/INFO]: [CHAT] [DEBUG] No ench damage: 13.0
[13:47:00] [Client thread/INFO]: [CHAT] [DEBUG] Strength Modifier: 6.0
[13:47:00] [Client thread/INFO]: [CHAT] [DEBUG] Weakness Modifier: 0.0
[13:47:00] [Client thread/INFO]: [CHAT] [DEBUG] Base tool damage: 7.0
[13:47:00] [Client thread/INFO]: [CHAT] [DEBUG][ModuleOldToolDamage] Old tool damage: 7.0 New tool damage: 7.0
[13:47:00] [Client thread/INFO]: [CHAT] [DEBUG][ModuleOldToolDamage] Old sharpness damage: 0.0 New: 0.0
[13:47:00] [Client thread/INFO]: [CHAT] [DEBUG][ModuleOldPotionEffects] Old strength modifier: 6.0 New: 0.6
[13:47:00] [Client thread/INFO]: [CHAT] [DEBUG][EntityDamageByEntityListener] Base: 7.0
[13:47:00] [Client thread/INFO]: [CHAT] [DEBUG][EntityDamageByEntityListener] Weak: 0.0
[13:47:00] [Client thread/INFO]: [CHAT] [DEBUG][EntityDamageByEntityListener] Strength: 1.2
[13:47:00] [Client thread/INFO]: [CHAT] [DEBUG][EntityDamageByEntityListener] Crit: 1.0
[13:47:00] [Client thread/INFO]: [CHAT] [DEBUG][EntityDamageByEntityListener] Mob 0.0 Sharp: 0.0
[13:47:00] [Client thread/INFO]: [CHAT] [DEBUG][EntityDamageByEntityListener] New Damage: 8.4

from bukkitoldcombatmechanics.

kernitus avatar kernitus commented on May 20, 2024

@Ferocimo What weapon are you using? What Strength potion are you using? Are you attacking an entity that has some protection on?

from bukkitoldcombatmechanics.

Ferocimo avatar Ferocimo commented on May 20, 2024

@gvlfm78
Diamond sword with strength II against a player that has a diamond armor.

from bukkitoldcombatmechanics.

kernitus avatar kernitus commented on May 20, 2024

@Ferocimo Did you set the strength modifier to 'multiplier' and 0.6? Because if so, the calculations are correct, giving you base damage * strength modifier * strength level = 7 * 0.6 * 2 = 8.4

from bukkitoldcombatmechanics.

Ferocimo avatar Ferocimo commented on May 20, 2024

@gvlfm78 Yes they are correct, that's not the issue : the thing is, it appears that 0.6 approximatively gives the correct damage that was dealt prior to 1.9. I don't know why, I know that Minecraft said Strength II increased damage by +260%, but some other factors must have certainly had an effect, and we missed them.
Long story short : you can't trust only the numbers written in the description of pre-1.9 potion, apparently.

from bukkitoldcombatmechanics.

kernitus avatar kernitus commented on May 20, 2024

@Ferocimo Well, how do you know it 'approximatively gives the correct damage that was dealt prior to 1.9'? Do you have any data for the old values?

from bukkitoldcombatmechanics.

Ferocimo avatar Ferocimo commented on May 20, 2024

@gvlfm78 Unfortunately no. It's just my personnal experience as a former PVP player, and the feedback of many of our old players. However, it is absolutely certain it is NOT +260% raw damage, because it's litterally two-shots a full protection 4 player.

What I suspect (for what it's worth since I do not have extensive knowledge on coding), is that Minecraft strength effect was a modifier for the "final" damage inflicted (after taking into account the armor and enchantments reductions). For instance, a player uses a diamond sword, deals 7 damage. The opponent actually takes, let's say, 2 damage points, because of his protection. Strength effect would be applied on these 2 points, making it 5.2 damages with Strength 2 +260%.
Now, if I understand it correctly, what your module is doing is increasing the raw damage inflicted (which makes sense, but maybe not in the "Minecraft logic"...). So the "7 damages" dealt to the player becomes a 18.2 damges dealt -> with armor reduction that would become, in the previous example where armor prevented 5 damage points, 13.2 damages actually inflicted. Which is 6.6 hearts taken a way in one shot. That's a lot.
But, I don't know, I'm not the expert, I'm just guessing from what I see.

from bukkitoldcombatmechanics.

kernitus avatar kernitus commented on May 20, 2024

@Ferocimo Well I just tested it by making a quick plugin that reports the damage done during an attack (like the debug text with the potions module) and running it in 1.8. It shows a base item damage for diamond sword of 8, and damage with strength I as 18.4 and damage with strength II as 28.8. This test was done on a spider (thus no armour), which would have lessened the effect significantly. The plugin (as with the potion debug text) reports the damage before armour damage reduction is applied. I'm going improve this damage debug plugin tomorrow and upload it here for you to test it better in a 1.8 setting.

from bukkitoldcombatmechanics.

kernitus avatar kernitus commented on May 20, 2024

@Ferocimo Well.. Here we go... This is the tiny plugin I made which simply reports the damage before and after the armour reduction is applied (so you can test this more):
DamageDebug.zip

I then ran tests with a diamond sword on another player in 1.8, 1.9 without OCM, and 1.9 with OCM. The results are contained in this spreadsheet:
Strength Combat Damages.zip

There does indeed seem to be a difference between 1.8 and 1.9 with OCM, especially with Strength II. Now I need to determine why that is the case, if it's because of some modules not playing nicely together, some calculations gone wrong, or whatever this sentence means for the setDamage() method: For compatibility this also recalculates the modifiers and scales them by the difference between the modifier for the previous damage value and the new one.

I invite you to perform some tests yourself and compare with the spreadsheet to see if you can gather more useful data.

from bukkitoldcombatmechanics.

Ferocimo avatar Ferocimo commented on May 20, 2024

@gvlfm78 Excuse me I had no time to test this lately, we opened our server and have massive amount of issues to fix. I will get back to this one as soon as possible.

from bukkitoldcombatmechanics.

kernitus avatar kernitus commented on May 20, 2024

@Ferocimo have you had a look at it?

from bukkitoldcombatmechanics.

Ferocimo avatar Ferocimo commented on May 20, 2024

@gvlfm78 Well I did, but I don't know exactly what data you're looking for ? You already demonstrated the difference, locating where it comes from isn't really in my domain of expertise, since it would require me to actually test with different "bits" of your code activated or something...

from bukkitoldcombatmechanics.

Ferocimo avatar Ferocimo commented on May 20, 2024

There is something odd however.
We have these results on a near-vanilla server :
https://i.imgur.com/qT1pAFT.png
As you can see, strength I seems to REDUCE damage dealt...

from bukkitoldcombatmechanics.

kernitus avatar kernitus commented on May 20, 2024

Well @Ferocimo I'm back onto working on this and found a few things:

  • I was getting the same awkward results as you in a test server with just DamageDebug installed, then I realised it was the weapon cooldown that was causing the damage to decrease
  • I loaded DamageDebug into a 1.8 server and found that almost all weapons did 1 more damage than we set them to, because in 1.8 the tooltip damage was added to the base 'hand damage' of 1, which is no longer the case in 1.9 (the values have now been adjusted)
  • I found the strength modifier was not correctly scaling with the potion level (Strength II multiplied by 4.6 instead of 3.6) making it deal a lot more damage than it should have. (Also now fixed)

Lastly, I found the armour damage reduction to be less with OCM than it should have been, which is the issue I am currently working on and likely to be quite a big one.

from bukkitoldcombatmechanics.

kernitus avatar kernitus commented on May 20, 2024

Ok so after investigating for a while and looking at the Armour Wiki Page I found that indeed, increasing armour toughness to an arbitrarily large number should make 1.9 armour act like 1.8 armour.

However, I then found why this wasn't working, it states on the Attribute page that armour toughness has a maximum limit of 20.0, and indeed I get the same final damage values with 9999 and 20 toughness.

Thus, the options remaining would be to either find a way to change this maximum limit or have OCM calculate armour reduction too. Paging @rayzr522 and @I-Al-Istannen if they happen to know how to implement the first option (possibly through NBT), otherwise I'll just go with the second one.

from bukkitoldcombatmechanics.

I-Al-Istannen avatar I-Al-Istannen commented on May 20, 2024

@gvlfm78
In the client code:

public static float getDamageAfterAbsorb(float damage, float totalArmor, float toughnessAttribute) {
    float f = 2.0F + toughnessAttribute / 4.0F;
    // clamp(value, min, max)
    float f1 = MathHelper.clamp(totalArmor - damage / f, totalArmor * 0.2F, 20.0F);
    return damage * (1.0F - f1 / 25.0F);
}

And in the spigot 1.13.1 jar:

public class CombatMath {
    public static float getDamageAfterAbsorb(float damage, float totalArmor, float toughnessAttribute) {
        float clamped = MathHelper.a(totalArmor - damage / (2.0f + toughnessAttribute / 4.0f), totalArmor * 0.2f, 20.0f);
        return damage * (1.0f -  / 25.0f);
    }
}

Looks like your only chance to change the limit is to instrument that static method at runtime (or the calculating method of LivingEnttiy (protected float applyArmorModifier(final DamageSource damagesource, float f) {) using it), which is not quite ideal.

So to sum it up, as the clamping is done in code and not controlled by any attribute it looks like we are out of luck sadly.

from bukkitoldcombatmechanics.

kernitus avatar kernitus commented on May 20, 2024

So it's properly hard-coded... At this point I'll have to have OCM perform the armour damage reduction calculations to make them accurate...

@I-Al-Istannen thank you for looking through the client code... Is there anywhere the actual formula for the armour damage reduction? Because the one given on the Minecraft wiki doesn't actually match the results, I suspect there is some rounding going on 🤔

from bukkitoldcombatmechanics.

I-Al-Istannen avatar I-Al-Istannen commented on May 20, 2024

Have fun...

Code in here

/**
 * Deals damage to the entity. If its a EntityPlayer then will take damage from the armor first and then health
 * second with the reduced value. Args: damageAmount
 */
protected void damageEntity(DamageSource damageSrc, float damageAmount) {
    if (!this.isEntityInvulnerable(damageSrc)) {
        if (!damageSrc.isUnblockable() && this.isBlocking() && damageAmount > 0.0F) {
            damageAmount = (1.0F + damageAmount) * 0.5F;
        }

        damageAmount = this.applyArmorCalculations(damageSrc, damageAmount);
        damageAmount = this.applyPotionDamageCalculations(damageSrc, damageAmount);
        float f = damageAmount;
        damageAmount = Math.max(damageAmount - this.getAbsorptionAmount(), 0.0F);
        this.setAbsorptionAmount(this.getAbsorptionAmount() - (f - damageAmount));

        if (damageAmount != 0.0F) {
            this.addExhaustion(damageSrc.getHungerDamage());
            float f1 = this.getHealth();
            this.setHealth(this.getHealth() - damageAmount);
            this.getCombatTracker().trackDamage(damageSrc, f1, damageAmount);

            if (damageAmount < 3.4028235E37F) {
                this.addStat(StatList.damageTakenStat, Math.round(damageAmount * 10.0F));
            }
        }
    }
}

/**
 * Reduces damage, depending on armor
 */
protected float applyArmorCalculations(DamageSource source, float damage) {
    if (!source.isUnblockable()) {
        int i = 25 - this.getTotalArmorValue();
        float f = damage * (float)i;
        this.damageArmor(damage);
        damage = f / 25.0F;
    }

    return damage;
}


/**
 * Reduces damage, depending on potions
 */
protected float applyPotionDamageCalculations(DamageSource source, float damage) {
    if (source.isDamageAbsolute()) {
        return damage;
    }
    else {
        if (this.isPotionActive(Potion.resistance) && source != DamageSource.outOfWorld) {
            int i = (this.getActivePotionEffect(Potion.resistance).getAmplifier() + 1) * 5;
            int j = 25 - i;
            float f = damage * (float)j;
            damage = f / 25.0F;
        }

        if (damage <= 0.0F) {
            return 0.0F;
        }
        else {
            int k = EnchantmentHelper.getEnchantmentModifierDamage(this.getInventory(), source);

            if (k > 20) {
                k = 20;
            }

            if (k > 0 && k <= 20) {
                int l = 25 - k;
                float f1 = damage * (float)l;
                damage = f1 / 25.0F;
            }

            return damage;
        }
    }
}


/**
 * Returns the modifier of protection enchantments on armors equipped on player.
 */
public static int getEnchantmentModifierDamage(ItemStack[] stacks, DamageSource source) {
    enchantmentModifierDamage.damageModifier = 0;
    enchantmentModifierDamage.source = source;
    applyEnchantmentModifierArray(enchantmentModifierDamage, stacks);

    if (enchantmentModifierDamage.damageModifier > 25) {
        enchantmentModifierDamage.damageModifier = 25;
    }
    else if (enchantmentModifierDamage.damageModifier < 0) {
        enchantmentModifierDamage.damageModifier = 0;
    }

    return (enchantmentModifierDamage.damageModifier + 1 >> 1) + enchantmentRand.nextInt((enchantmentModifierDamage.damageModifier >> 1) + 1);
}

from bukkitoldcombatmechanics.

Ferocimo avatar Ferocimo commented on May 20, 2024

@gvlfm78 Tried last version, but can't really be sure if problem is fixed, because of the Old Armour Strength module, which is currently broken (#277 ).

from bukkitoldcombatmechanics.

Blamo27 avatar Blamo27 commented on May 20, 2024

@gvlfm78 ping ?

from bukkitoldcombatmechanics.

Momonche avatar Momonche commented on May 20, 2024

@Blamo27 pong ?

from bukkitoldcombatmechanics.

Ferocimo avatar Ferocimo commented on May 20, 2024

Can now confirm, potion effect is now fixed. Still some isues with armour though.

from bukkitoldcombatmechanics.

kernitus avatar kernitus commented on May 20, 2024

@Blamo27 @Ferocimo closing this issue for now. If new issues arise that are not directly related to the implementation of this module please open a new ticket.

from bukkitoldcombatmechanics.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.