HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Light Shield

02-18-2009, 09:17 PM#1
Flame_Phoenix
Ok people, this is the return of my infamous Light Shield. After a discussion with Rising_Dusk complaining about me not using systems and doing things in an insane way, I quited the spell again, after all it worked well. However, recently (once again) I started working on the spell to make it approved, I decided that after so much time wasted on the spell, it would be a crime not to make an acceptable version of it to wc3c. Therefore I returned from the shadows making this spell as modular as I can, with as much experience as possible for a newbie like me xD
I know the mods are having problems with the unstoppable waves of submissions (or so I have been told) and I also know that the server was down for a few days, so instead of blasting the spell right in the submitting section (as I usually do when I finish) I decided to be more helpful and to post it on the Triggers and Scripts section of wc3c and THW so I could get critics on the code and suggestions for ideas and improvements.
Anyway, I think I did all I could to ease the job of the moderators, and somehow, I think I am addicted to the high standards of wc3c (it's a curse, trust me...) so here i am presenting another spell for the community.

Description:
- A JESP spell that allows the hero to cast a shield on a not Ud ally or on an Ud enemy (just like Holy Light). The shield will absorb an amount of damage for the allied unit thus protecting it from harm, or it will amplify the damage caused to the unit if it is enemy. When the shield dies, the shield unit will get healed by the remaining energies of the shield if it is an ally, or it will be damage by the remaining energies if it is an enemy.

Click image for larger version

Name:	LightShield1.jpg
Views:	158
Size:	216.9 KB
ID:	40580

Click image for larger version

Name:	LightShield2.jpg
Views:	347
Size:	174.8 KB
ID:	40579

Requirements:
- Jass NewGen Pack (uses vJASS)
- Timer Utils ( I use Blue flavor)
- xe basic and xedamage module
- ABuff and ADamage
- LastOrder(stand alone version) and AbortSpell

History:
Hidden information:

Version 1.0:
- Start of the spell, release to the forums in order to upgrade and search solutions

Version 1.1, 1.2, 1.3, 1.4:
- Testing and construction of the spell, fix of bugs and add of functionalities
- Public release as ready

Version 1.5
- Decided to join the community standards and so the spell now uses ADamage and Abuff

Version 1.6, 1.7:
- Improved many other aspects of the spell, including personalized error messages
among other new features

Version 1.8:
- Improved map to use AborSpell better
- Reduced the two error messages to only 1, thus simplifying the code and the SETUP
section
- Fixed a bug on the targets, now choosing targets work fine
- Corrected a few documentation typos

Version 1.9:
- Removed the alone version, it was buggy and inferior when compared to the other
- Improved the code, now the extra damage considers enemy armor when dealt
- Added w3gamer to credits

Version 2.0:
- Quick fix to a bug. Now when you cast the spell with chainlightning as an
order string it wont conflict
- Corrected a typo in the documentation and updated the JESP document
- Updated the requirements of the spell

Version 2.0.1:
- Removed the use of tags, after all, they are useless for this spell
- Improved the code in a line
- Updated the credits
- Changed the attack type to chaos
- Corrected the requirements of the spell

Version 2.0.2:
- Added another function to the SETUP that allows use to make a better use of the
spell
- Eliminated a useless variable ".lastDamage", this allowed me to greatly simplify
the if statements of some sections and allowed me to clean up the code a lot better
- Minos fixes in the change log

Version 2.1:
- Added another xedamage object that allows the use to calibrate the lastDamage
caused by the destruction of the shield in a different way
- Added new globals that allow the user to define the attachment points of the
effects on the units
- Fixed a leak problem
- Added another function that allows the to chose what he wants to do when the shield
dies
- Increased and corrected code documentation

Version 2.1.1:
- Fixed the capitalization conventions for the SETUP section
- Improved comments

Version 2.1.2:
- Fixed the description of the ability
- Fixed the description of the map
- Fixed the description of the loading screen
- Added more levels to the aura
- Fixed the tooltip of the buff, now it is not red, it is green

Version 2.1.3:
- Updated for patch 1.24.


code:
LightShield 2.1.3.txt

I am sorry, but I can not post the entire code here... it is too long, so instead I just post a txt file with it.
Attached Images
File type: jpgLightShield2.jpg (174.8 KB)
File type: jpgLightShield1.jpg (216.9 KB)
Attached Files
File type: w3xLight Shield 2.1.3.w3x (101.0 KB)
File type: txtLightShield 2.1.3.txt (16.8 KB)
02-19-2009, 06:16 AM#2
darkwulfv
Quote:
I think I am addicted to the high standards of wc3c (it's a curse, trust me...)
I wouldn't consider it a curse, since it makes you create things with a high standard by default; and since when has that been a bad thing? =P
02-19-2009, 12:46 PM#3
emjlr3
i was under the impression Dusks lastorder doodad was built to work through the issueorder event, though perhaps it makes no difference

Collapse JASS:
call SetWidgetLife(shieldData.shielded, damage * 0.9)

i say save the multiplication and just use 1., or .5 - how often does someone actually take damage that is less then 1.? and how often does it actually matter? the overhead is negligable, but neglibable is the name of the game here - also I wonder, what if damage*.9<.405? ( I haven't run the math with your expression but it seems possible)

also, won't that method screw with assistance systems? - I see no internal way you can pass out who did the life reduction...currently
02-19-2009, 12:58 PM#4
Flame_Phoenix
Quote:
I wouldn't consider it a curse, since it makes you create things with a high standard by default; and since when has that been a bad thing? =P
Lol, it was supposed to be a joke, but it is annoying to have people trying to destroy your codes all the time =P

Quote:
i say save the multiplication and just use 1., or .5 - how often does someone actually take damage that is less then 1.? and how often does it actually matter - also, the damage*.9 does not take into consideration armor/spell resistance/etc. (I think), therefor that could fail as well
I make no idea the attack that my victim will take, so the multiplication works for all cases. It is safe bet.
About armor, the extra damage is calculated based on the incoming damage, which is reduced by armor, so the extra damage will depend on the armor afaik.
And it will not screw assistance systems, first because the extra damage will be caused by the attacking unit and second because it can't die due extra damage, it dies due to the final damage.
In case my english skills fail, I just want to say that I am 100% this will not mess up assistance systems because we always have the attacker doing the damage in last place, thus the attacking unit always gets credit.
02-19-2009, 02:29 PM#5
Rising_Dusk
Quote:
Originally Posted by emjlr3
i was under the impression Dusks lastorder doodad was built to work through the issueorder event, though perhaps it makes no difference
It works on both, but it works the best on the ISSUED_ORDER events.
02-19-2009, 03:39 PM#6
emjlr3
FP, looks like you commented on a pre-edited version of my post, look at it again
02-19-2009, 03:52 PM#7
Flame_Phoenix
Quote:
also I wonder, what if damage*.9<.405?
For that to happen we would need to have a damage value lower than 1, and in wc3 the lowest attack a unit can have is 1. Therefore this case is impossible.

Quote:
also, won't that method screw with assistance systems? - I see no internal way you can pass out who did the life reduction...currently
I think I already answered this question, but since I don't remember, I will just say it again: it doesn't matter who is doing the extra damage, because the unit making the extra will inevitably do the normal damage after. Because a unit can not kill with extra damage, we ensure a unit always damages the enemy (or kills it). This is I am sure I don't screw up kill systems or assistance systems.
Besides I am really not sure if it is my obligation to make my spells compatible with all other systems out there, because that is impossible.

Quote:
It works on both, but it works the best on the ISSUED_ORDER events.
I make no idea what you guys are talking about, but I just want to say I am using the same tactic I used in Launch Seal spell to cancel the spell and re-cast it again. If Dusk says it is Ok in Launch Seal, than it must be Ok here as well.
02-19-2009, 04:30 PM#8
Rising_Dusk
It could still be better using the same library. If you read the AbortSpell library documentation, it works best on the ISSUED_ORDER events. It still works on the SPELL_CAST event, but it's a quick change and improves the order intercepting significantly.

If you're doing it in that launch spell with SPELL_CAST, I recommend changing it there as well.
02-19-2009, 04:51 PM#9
Anitarf
Quote:
Originally Posted by Flame_Phoenix
For that to happen we would need to have a damage value lower than 1, and in wc3 the lowest attack a unit can have is 1. Therefore this case is impossible.
You are forgetting armour damage reduction.
02-19-2009, 05:52 PM#10
emjlr3
along with spells, etc.

maybe I am entirely blind, but when exactly do you use the method damaged?
02-19-2009, 06:31 PM#11
Anitarf
Quote:
Originally Posted by emjlr3
maybe I am entirely blind, but when exactly do you use the method damaged?
It is used here.

F_P, you should only list the spell's actual requirements. For example, you don't use TimerUtils or Table, ABuff uses them; a different implementation of ABuff might not need them.

Also, you really should be using the order event for aborting spells.
02-19-2009, 08:08 PM#12
Flame_Phoenix
Quote:
If you read the AbortSpell library documentation, it works best on the ISSUED_ORDER events. It still works on the SPELL_CAST event, but it's a quick change and improves the order intercepting significantly.

If you're doing it in that launch spell with SPELL_CAST, I recommend changing it there as well.
Ohh....
Mmm, it seems a quick change in fact I will change that asap.

Quote:
You are forgetting armour damage reduction.
Werrmm, since it is extra damage, should it really be reduced?
Besides, how am I supposed to do that with the method Moyack suggested ? I just can't. For some reason amplifying damage with ADamage is nearly impossible, it is a nightmare to avoid an infinite loop, and xedamage doesn't help at all.

Quote:
F_P, you should only list the spell's actual requirements. For example, you don't use TimerUtils or Table, ABuff uses them; a different implementation of ABuff might not need them.
Right, I'm on it.

Ok guys, I will make a few changes and then will update this post telling what I changed.

EDIT EDIT EDIT

Ok guys, I made a few updates, see changelog (or code) for more info.
Meh, heck with it:
1 - I changed the event to issue order (as requested by Dusk)
2 - simplified the SETUP section and therefore the inner code related to it
3 - fixed a few typos
4 - fixed a bug (or so I think it was one)
5 - Removed Table and TimerUtils from the requirements (as requested by Ani)

I think this is all =P
03-09-2009, 02:47 AM#13
Anitarf
Quote:
Originally Posted by Flame_Phoenix
5 - Removed Table and TimerUtils from the requirements (as requested by Ani)
My request was broader than that.

Your spell now conflicts with any other spell using the same orderstring, fix it.
03-09-2009, 11:39 AM#14
Flame_Phoenix
Quote:
My request was broader than that.
I also did other changes. Anyway please Elaborate.

Quote:
Your spell now conflicts with any other spell using the same orderstring, fix it.
?? I don't understand how can it conflict? I think I changed the spell to go as Dusk intended to, using an order string. I don't understand Ani, please Elaborate.

EDIT EDIT EDIT


Version Updated to meet (some of) Anitarf's demands:
- Now the shield considers armor
- Added TimerUtils to requirements because now I use it on code directly

Please see change log for more info.
Ani, I still need your help to understand what you want me to change about he conflicting order.

Quote:
Your spell now conflicts with any other spell using the same orderstring,
Isn't this suppose to happen?
03-09-2009, 12:43 PM#15
emjlr3
if another hero uses a spell with with the same order string, al biet of a different ability, this will consider it the same thing

that should not be the case