• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

How can I get the attack amount of a unit with bonuses?

Level 24
Joined
Jun 26, 2020
Messages
1,853
1683063390690.png

Hello, I searched for some method to get the damage a unit can deal with the bonuses, but I don't find any more than control the bonuses with systems (but I wanna consider auras and buffs) or getting directly the value from the frame (but I need have selected only the unit and sync the value and that takes time).
Do you know a clean way to do it?
 
Level 12
Joined
Jan 10, 2023
Messages
191
Don't you know? Or have I to use this non-reliable methods I mentioned?
In the trigger editor, there is a Unit action that allows you to get Unit Real data and Unit Integer data, I'm not at home so I can't post it right now, but I would:

1. use those Unit Actions to get the Unit's damage base, damage number of dice, and damage sides per dice.

2. Depending on which makes more sense I would either Save to a variable or Check using triggers when necessary anything else that would affect damage: Items, Abilities, Attributes, Buffs/Effects.

3. Using these values I would calculate the final damage myself, keeping in mind that this is a range (range will be between [damage base + minimal dice value] and [damage base + maximum dice value])

To do this calculation, you will have to be familiar with how these all add up.

If you google this, WC3 damage calculation, you will find links to the Blizzard website that give the mathematical equations for these.
 
Level 12
Joined
Jan 10, 2023
Messages
191
This is the part with I have issues, I think I can just use a system like this: New Bonus [vJASS][LUA]
You can, I haven't taken a deep dive into that system, but it looks like it covers the same topic.

I assumed you would be using GUI, if you're using JASS or Lua it would be the same idea as I said above, but frankly it will be a lot easier lol.

Plus, JASS I can do from my phone when I have the time.

My only objection to using that system is that if all you need to do is check the damage, that's a lot of extra code you won't be needing in that system, but if you're familiar with JASS, give it a shot and post what you come up with, if you are not familiar with JASS, I can help you out on Monday if no do-gooder comes along and solves it first.
 
Level 24
Joined
Jun 26, 2020
Messages
1,853
You can, I haven't taken a deep dive into that system, but it looks like it covers the same topic.

I assumed you would be using GUI, if you're using JASS or Lua it would be the same idea as I said above, but frankly it will be a lot easier lol.

Plus, JASS I can do from my phone when I have the time.

My only objection to using that system is that if all you need to do is check the damage, that's a lot of extra code you won't be needing in that system, but if you're familiar with JASS, give it a shot and post what you come up with, if you are not familiar with JASS, I can help you out on Monday if no do-gooder comes along and solves it first.
Thanks, but I'm using Lua and I know how to use it, the problem with it is it doesn't work with percentages and I wanted to know if still there is a good way to get the damage, but I resigned myself not to use percentages.
 
Level 24
Joined
Jun 26, 2020
Messages
1,853
You could store for each buff the %dec/inc it gives, then you calc it.
Avg = base + DiceNumber*(1 or DiceSize/2) - bonus primary
total = avg + avg*Sum of buffFactors + flatBonus

Sadly we don't know a buffs baseclass, nor it's power nor can one get the buffId from the spell otherwise it could be (partly) automated.
I could if the buff calculates the percentages only of the base damage and not of the total damage, it is? I would test, is just that this buffs can be very annoying to deal.
 
Top