Charles445 / RLTweaker

Pack specific mod to tweak and fix miscellaneous things
MIT License
2 stars 5 forks source link

[Suggestion] Add a priority to Archey, Magic Focus, Klutz, & Magic Inhibition for compat with Scaling Health. #7

Open SonicX8000 opened 2 years ago

SonicX8000 commented 2 years ago

I dunno how difficult this would be to do but currently those potion effects only affect the player, meaning that these do nothing to the mob itself if they're affected by these effects.

An Arrow shot by a Skeleton that's inflicted with Archery/Klutz could have it's arrow damage increased or decreased depending on what potion they have.

A Guardian's eye beam could have an increase/decrease if inflicted with Magic Focus/Magic Inhibition... if the eye beam is actually affected by those potions. This also includes it's passive "thorns" effect which IS actually affected by Magic Focus/Magic Inhibition... but only for the player currently.

Note: Guardians actually hit you twice in one tick, one for a melee hit and one for it's "indirectMagic" hit. Only the melee hit gets a buff/debuff from Strength/Weakness Potion effects. This was found out by using ToroHUD as it'll show you individual damage pop-offs and you should see two 5 hit splats if the guardian lacks any buffs and attacks you, as shown in the image below.

ToroHUD has a bit of a thing for showing rounded up damage but if you look at my health bar, I took 9 total damage from that guardian.

SonicX8000 commented 2 years ago

Upon further looking into, apparently these potions do in fact apply to the mob's damage, however scaling health just isn't catching these for the scaler which is what led me to opening this issue in the first place.

In short... the scaler upscales the base damage first and then the potion's damage is applied after it. I had the damage upscaled to 153 damage from a base 2 'thorns' damage from a guardian, and Magic Focus II applied +8 after that scaled damage... so it became 161.

EDIT It's a priority issue, Scaling Health uses HIGHEST so any of potion core's stuff will go after the scaling is done. If Scaling Health didn't have any priority then potion core will apply the damage onto the base, so 2 becomes 10 and then it'll get upscaled.

I'ma change the title to reflect that. I think if by going with HIGHEST priority. I think the order will go by modid if something else used HIGHEST... although I'm not 100% sure. Scaling Health's modid is 'scalinghealth' so... it starts with an S.

Charles445 commented 2 years ago

It looks like Scaling Health is trying to avoid other mod handlers getting scaled with itself for whatever reason, so most mods aren't going to be affected by mob scaling Not sure what the reasoning is, but it seems very deliberate It is easy and possible to move the scaling health scaling to run after most/all other mod handlers, but that could cause unexpected results

SonicX8000 commented 2 years ago

I could try to see how it fairs with HIGH as that at least allows those potions to work with the scaler but then there could be unexpected results. For example...

With the way I have it config'd... Archery is +3 per level so at X it becomes +30 being added onto 4 base arrow damage from a Skeleton. That becomes "34 -> upscaled" with HIGH, otherwise it's "4 -> upscaled + 30" with HIGHEST.

Will need to test this further to be sure that nothing unexpected happens.

Charles445 commented 2 years ago

You could shove scaling health onto lowest and see if anything funny happens, I think potion core runs on normal so you'd need low or lowest for it to run

Also event handler sorting is a bit complicated The most important thing is priority of course, those get sorted into groups What takes priority within the same priority is first when they get registered (preInit, init, postInit, loadComplete) If they get registered in the same priority and the same initialization phase, then the mod load order takes effect (which is alphabetical, pretty sure

SonicX8000 commented 2 years ago

Sorry for the late reply for this, but setting it to LOWEST wouldn't be wise, one example being if an item reduces the damage taken to 1. Here's a quote explaining how this goes with an item that reduces damage taken to 1.

If LOWEST... You take 10 damage, it gets upscaled to 1000, but... you have an item that reduces the damage to 1, so... in this case... it's 10 which is then reduced to 1 but then gets upscaled to 100 since scaling health is applying after everything else.

Not exactly reducing the damage to 1, right?


If HIGH...

You take 10 damage, it gets upscaled to 1000 but... you have an item that reduces the damage to 1, since the scaler already did the work... that 1000 damage becomes 1 damage due to the item.

Throughout some testing with the priority set at HIGH, it seems to be going well as I haven't noticed any issues so far... though there may be a rare case where something may happen with the scaler not working correctly but for now... Archery & Magic Focus, etc. work as they should now with the HIGH priority, an example...

HIGHEST: 2 -> Upscaled + 8 HIGH: 2 + 8 = 10 -> Upscaled

The 8 is the boost from the Archery or Magic Focus Potion effects... or from their attributes. Upscaled is the damage being scaled up via the damage scaler.