wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Resources > Code Resources > Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 05-08-2009, 09:12 PM   #1
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,729

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default ArmorUtils

ArmorUtils Library

Background:
This is a library that allows calculation of a unit's armor, it's full damage (before armor reduction), and the reduced damage (after armor reduction). Someone reminded me recently that using Daelin's old system was a pain to use, so I decided to submit this. Daelin's system also didn't account properly for that gameplay constant 'Armor Damage Reduction Multiplier', but this script does. After making my code portable, writing some documentation, and developing a testmap, here it is!

Requirements:Requirements (Optional):Credits:Code:
Expand Library:

Function List:
This library gives the following armor and damage manipulating functions.
  • function GetUnitArmor takes unit u returns real
  • function GetReducedDamage takes real baseDamage, real armor returns real
  • function GetFullDamage takes real damage, real armor returns real
Attached Files
File Type: w3x ArmorUtilsTestMap.w3x (46.7 KB, 169 views)
__________________

Last edited by Rising_Dusk : 09-11-2010 at 04:54 PM. Reason: Updated
Rising_Dusk is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 05-08-2009, 09:17 PM   #2
Troll-Brain
User
 
Join Date: Oct 2006
Posts: 1,490

Submissions (1)

Troll-Brain has a spectacular aura about (134)

Default

GetUnitArmor shouldn't returns an integer instead of a real ?
Troll-Brain is offline   Reply With Quote
Old 05-08-2009, 09:18 PM   #3
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,729

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

Heroes can have non-integer armor values. They display an integer, but for calculations they use the actual real value.
__________________
Rising_Dusk is offline   Reply With Quote
Old 05-08-2009, 09:33 PM   #4
Troll-Brain
User
 
Join Date: Oct 2006
Posts: 1,490

Submissions (1)

Troll-Brain has a spectacular aura about (134)

Default

Quote:
Originally Posted by Rising_Dusk
Heroes can have non-integer armor values. They display an integer, but for calculations they use the actual real value.
ok, i know reals are float, however does the game round the real like 3 numbers after the digit ?

For example you get 1.5236 with your function GetUnitArmor(), does it really takes 1.5236 or 1.524 when the unit receive damages ?
Maybe it's irrelevant in the result, just a thought.
Troll-Brain is offline   Reply With Quote
Old 05-08-2009, 09:42 PM   #5
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,729

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

Quote:
Originally Posted by Troll-Brain
For example you get 1.5236 with your function GetUnitArmor(), does it really takes 1.5236 or 1.524 when the unit receive damages ?
Maybe it's irrelevant in the result, just a thought.
I haven't actually verified this, I know it takes at least 3 digits, although I suspect that it wouldn't round at all. You can easily test it with the demo map in the first post.
__________________

Last edited by Rising_Dusk : 05-08-2009 at 09:42 PM.
Rising_Dusk is offline   Reply With Quote
Old 05-08-2009, 09:53 PM   #6
Troll-Brain
User
 
Join Date: Oct 2006
Posts: 1,490

Submissions (1)

Troll-Brain has a spectacular aura about (134)

Default

Quote:
Originally Posted by Rising_Dusk
I haven't actually verified this, I know it takes at least 3 digits, although I suspect that it wouldn't round at all. You can easily test it with the demo map in the first post.
You have to, because if it round up you should edit your functions :p
Troll-Brain is offline   Reply With Quote
Old 05-08-2009, 10:10 PM   #7
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,729

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

I have never heard of it rounding at all, so I'm not worried. I have dinner and a movie to go to, so test it yourself if you care. :p
__________________
Rising_Dusk is offline   Reply With Quote
Old 05-08-2009, 10:14 PM   #8
Mr.Malte
User
 
Mr.Malte's Avatar
 
Join Date: Apr 2008
Posts: 286

Submissions (2)

Mr.Malte is on a distinguished road (11)

Default

It doesn't round up, but in text messages it does only display 3 digits after the comma.
Mr.Malte is offline   Reply With Quote
Old 05-08-2009, 10:16 PM   #9
Troll-Brain
User
 
Join Date: Oct 2006
Posts: 1,490

Submissions (1)

Troll-Brain has a spectacular aura about (134)

Default

Quote:
Originally Posted by Mr.Malte
It doesn't round up, but in text messages it does only display 3 digits after the comma.
And Blizzard invented R2SW.

@Rising_Dusk : I will test it myself later, good evening.
Troll-Brain is offline   Reply With Quote
Old 05-09-2009, 08:35 AM   #10
wraithseeker
User
 
Join Date: Feb 2009
Posts: 406

wraithseeker is on a distinguished road (17)

Default

Thank god my bugging made you post this, next up is hero selection system :)
wraithseeker is offline   Reply With Quote
Old 05-09-2009, 11:33 AM   #11
Deaod
User
 
Join Date: Jan 2007
Posts: 542

Submissions (11)

Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)

Default

theres no way to modify the damage increase when a units armor is less than 0. Its hardcoded to 0.06, and hardcapped at seventy something percent damage increase, iirc.
__________________
Deaod is offline   Reply With Quote
Old 05-09-2009, 11:53 AM   #12
Mr.Malte
User
 
Mr.Malte's Avatar
 
Join Date: Apr 2008
Posts: 286

Submissions (2)

Mr.Malte is on a distinguished road (11)

Default

You could use Vex's Logartihm to detect armor below 0.
Mr.Malte is offline   Reply With Quote
Old 05-09-2009, 12:35 PM   #13
Troll-Brain
User
 
Join Date: Oct 2006
Posts: 1,490

Submissions (1)

Troll-Brain has a spectacular aura about (134)

Default

I've tested, and sometimes the actual damage is exactly the same as the calculated damage and sometimes not, but the imprecision is for the eight number under the digit, so it doesn't really matter (at all).
Troll-Brain is offline   Reply With Quote
Old 05-09-2009, 01:20 PM   #14
Litany
Sesquipedalia Mentula
 
Litany's Avatar
 
Join Date: Jul 2003
Posts: 239

Submissions (4)

Litany is a jewel in the rough (219)Litany is a jewel in the rough (219)Litany is a jewel in the rough (219)Litany is a jewel in the rough (219)

Default

You should probably include a note that changes to Chaos Damage in Gameplay Constants will break this.
Litany is offline   Reply With Quote
Old 05-09-2009, 08:13 PM   #15
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,729

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

Did I not? I thought I did in that massive documentation. Huh, guess I didn't. Thanks for bringing it to my attention.
Quote:
Originally Posted by Deaod
theres no way to modify the damage increase when a units armor is less than 0. Its hardcoded to 0.06, and hardcapped at seventy something percent damage increase, iirc.
Really? Is this verified? If so, I'll update.
__________________

Last edited by Rising_Dusk : 05-09-2009 at 08:15 PM.
Rising_Dusk is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 02:23 AM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services