• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

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

Status
Not open for further replies.
Level 25
Joined
Jun 26, 2020
Messages
1,973
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?
 
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.
 
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.
 
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.
 
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.
 
Status
Not open for further replies.
Back
Top