• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 1.X+ Buggy life and mana leech in TFS 1.3

Unknown Soldier

Mapping a map
Joined
Oct 30, 2010
Messages
290
Solutions
11
Reaction score
659
Hello everybody,

I don't know if it is already a known issue, but I would like to check if this is really a bug or an error of mine. I think the formula, or perhaps something else, isn't correct for life and mana leech feature.

I have found two issues:

1. Using some area spell, like exori, with a weapon which has life/mana leech, while there is no monster around, so noone gets damage, it still gives life and mana points to the player (video #1). For the comparison I've shown also weapon with elemental damage, and normal, 100% physical weapon.
2. The percentage values for leeches are not correct, for example (video #2):
  • Life leech: 100% chance, 10% amount
  • Mana leech 100% chance, 2% amount
  • Hit 508 (42 physical dmg, 466 death dmg)
  • Result: You were healed for 10 hitpoints. / You gained 11 mana. Why?

TFS 1.3 Compiled on Dec 14 2020 21:45:15 for platform x64 (AppVeyor build)

 
Last edited:
Last edited:
ah I yes I had to fix this, but I forgot, ty for reminding
Post automatically merged:

I didn't test the code, so not entirely sure it works as expected (probably elemental damage bug will be still there)
Give it a try and I will enjoy feedback.
Fix mana and life leech bugs by nekiro · Pull Request #3267 · otland/forgottenserver (github.com)
The first one seems to be fixed, so no more free life and mana ^^

And as you said, the percentage is still not correct
 
Just pushed a commit, few seconds ago, check it out.

Much better! It is pretty close to the values of 10% hp and 2% mp in this case :) Hit examples below.
Now the question if this is supposed to be more or less those values, or exactly x%? Not even sure how it works in global Tibia...
If the first variant, then it looks promising 👏


Code:
19:36 You were healed for 63 hitpoints.
19:36 You gained 13 mana.
19:36 A behemoth loses 606 hitpoints due to your attack.

19:37 You were healed for 55 hitpoints.
19:37 You gained 11 mana.
19:37 A behemoth loses 494 hitpoints due to your attack.

19:40 You were healed for 22 hitpoints.
19:40 You gained 4 mana.
19:40 A behemoth loses 139 hitpoints due to your attack.

19:41 You were healed for 33 hitpoints.
19:41 You gained 7 mana.
19:41 A behemoth loses 250 hitpoints due to your attack.
 
Much better! It is pretty close to the values of 10% hp and 2% mp in this case :) Hit examples below.
Now the question if this is supposed to be more or less those values, or exactly x%? Not even sure how it works in global Tibia...
If the first variant, then it looks promising 👏


Code:
19:36 You were healed for 63 hitpoints.
19:36 You gained 13 mana.
19:36 A behemoth loses 606 hitpoints due to your attack.

19:37 You were healed for 55 hitpoints.
19:37 You gained 11 mana.
19:37 A behemoth loses 494 hitpoints due to your attack.

19:40 You were healed for 22 hitpoints.
19:40 You gained 4 mana.
19:40 A behemoth loses 139 hitpoints due to your attack.

19:41 You were healed for 33 hitpoints.
19:41 You gained 7 mana.
19:41 A behemoth loses 250 hitpoints due to your attack.
Values are probably getting altered by one of your creaturescripts. I changed the method to always add the raw value and to avoid modifications from any type of health/mana changes, if you use latest code it should work right now.
 
Values are probably getting altered by one of your creaturescripts. I changed the method to always add the raw value and to avoid modifications from any type of health/mana changes, if you use latest code it should work right now.

My creaturescripts shouldn't change anything, there are raw values
Lua:
return primaryDamage, primaryType, secondaryDamage, secondaryType

With the last build the leeches are gone ^^ So no hp/mp goes back to the player
 
My creaturescripts shouldn't change anything, there are raw values
Lua:
return primaryDamage, primaryType, secondaryDamage, secondaryType

With the last build the leeches are gone ^^ So no hp/mp goes back to the player
You probably cant see the values, look at your health and mana bar.
 
You probably cant see the values, look at your health and mana bar.

Ye, right, my bad. The difference is that it does not show you the numbers in server log anymore, neither animated text over a player, hence my mistake. But removig it was intentional?
 
Ye, right, my bad. The difference is that it does not show you the numbers in server log anymore, neither animated text over a player, hence my mistake. But removig it was intentional?
Nope, I just wanted it to correctly calculate, does it correctly calculate now? If so I will add the message and animated message back.
 
Nope, I just wanted it to correctly calculate, does it correctly calculate now? If so I will add the message and animated message back.
As you could see, I posted some hits, values were not so exact, but if you'd ask me, that was pretty acurate and I love the change :)

BTW. Until version 1.0.1087 was with the new, corrected values.
 
As you could see, I posted some hits, values were not so exact, but if you'd ask me, that was pretty acurate and I love the change :)

BTW. Until version 1.0.1087 was with the new, corrected values.
Latest code, should properly calculate total damage done to life and mana leech percentage. Can you confirm?
 
Latest code, should properly calculate total damage done to life and mana leech percentage. Can you confirm?
In 1.0.1087 yes, for single target. It turns out that for multiple targets it takes back only single leech back, instead of values from all creatures which were damaged. I wrote you a PM
 
In 1.0.1087 yes, for single target. It turns out that for multiple targets it takes back only single leech back, instead of values from all creatures which were damaged. I wrote you a PM
Yes, that's correct behaviour for AOE spells. Imagine leeching hp for every single creature, that would be broken.
 
Yes, that's correct behaviour for AOE spells. Imagine leeching hp for every single creature, that would be broken.
Ok, so neither of us were right. Just googled and it is like this:

Single target is simple, it's just the true % of damage dealt.

AoE is a bit more complicated: true % for one of the monsters hit, then 10% of the leech amount for every subsequent monster. It's best explained with an example:

If I throw an avalanche that does 100 damage to 10 monsters, and I have 8% mana leech, I would receive 8 mana from 1 monster and .8 mana from the remaining 9 monsters, so an additional 7.2 mana., yielding 15.2 mana total.

Well... ^^
 
I will need confirmation of this one or having it documented with movie/gifs.
I'll try to find something, or maybe try it myself in rl Tibia.

Tbh I am surprised with what I found, I always thought it was leech amount * number of creatures, and it is no secret that the more creatures you hit, the more effective imbuements are (in global Tibia). But if you think about it... it could generate insane numbers with UE for example...

Anyway, will let you know if I find something on that.

Thanks for the time and the fixes today!
 
Back
Top