Spell Armor Crush

WolfieeifloW

WEHZ Helper
Reaction score
372
Armor Crush
Created By: WolfieeifloW

Requires NewGen and AIDS
Version:
1.5


Credits:
Spell editing, revised idea, and triggers were created by WolfieeifloW.
Original spell idea was created by Dirac.



If you take the time to download / look at these, please at least leave a comment.
Don't forget to rate also (using the stars
rating_5.gif
) !

armorcrushscreenieda3.jpg

Screenshots serve no justice, try the spell out ingame.


NOTE: This percentages I have used are based off a 2500 health hero.
With this much health and a level 4 Armor Crush, the skill returns 200 damage.
That's why I chose the % of health to return that I did.


Features:
-Insanely customizable
-Leakless
-Lagless
-Eye/Ear-candy
-MUI
-vJASS


Spell Description
Gives a 15% chance to deal a portion of your health back at the attacker. This blow is so shocking it also reduces the attackers armor.
Level 1 - Deals 2% of your current health and -1 armor (Stacks up to -3)
Level 2 - Deals 4% of your current health and -2 armor (Stacks up to -6)
Level 3 - Deals 6% of your current health and -3 armor (Stacks up to -9)
Level 4 - Deals 8% of your current health and -4 armor (Stacks up to -12)


Spell Code
JASS:
// +------------------------------------------------------------+
// |                                                            |
// |               -=-=- Armor Crush [v1.5] -=-=-               |
// |                -=-=- By WolfieeifloW -=-=-                 |
// |                Requires JASS NewGen and AIDS               |
// |                                                            |
// +------------------------------------------------------------+
// |                                                            |
// |   Gives a 15% chance to deal a portion of your health      |
// |   back at the attacker. This blow is so shocking it        |
// |   also reduces the attackers armor.                        |
// |                                                            |
// +------------------------------------------------------------+
// |                                                            |
// |   -=-=- How To Implement -=-=-                             |
// |      1. Copy this trigger into your map                    |
// |      2. Copy AIDS into your map                            |
// |       b. Implement AIDS (Follow the script instructions)   |
// |      3. Copy the buffs into your map                       |
// |      4. Copy the abilities into your map                   |
// |      5. Copy the dummies into your map                     |
// |      6. Make sure the 'Rawcodes' in the trigger match      |
// |          your buffs/abilities/units in Object Editor       |
// |      7. Customize the spell                                |
// |      8. Enjoy!                                             |
// |                                                            |
// +------------------------------------------------------------+
// |                                                            |
// |   -=-=- Credits -=-=-                                      |
// |      Credits are not needed, but appreciated               |
// |         Just don't claim this as yours                     |
// |                                                            |
// +------------------------------------------------------------+
// |   -=-=- Version History -=-=-                              |
// |                                                            |
// |      Version 1.5                                           |
// |       - Changed PUI to AIDS                                |
// |       - Fixed some coding issues                           |
// |       - Added some test map features                       |
// |       - Touched up coding conventions                      |
// |                                                            |
// |      Version 1.4                                           |
// |         - Fixed a FirstOfGroup to ForGroup                 |
// |         - Fixed a sound leak                               |
// |         - Fixed texttag leak                               |
// |         - Made floating text more efficient                |
// |            Credits to Artificial                           |
// |                                                            |
// |      Version 1.3                                           |
// |         - Fixed a major bug with Armor Crush not stacking  |
// |         - Made Armor Crush based off an aura               |
// |            Prevents the buff from being removed            |
// |         - Implemented PUI to save GetUnitUserData()        |
// |         - Fixed some BJ's                                  |
// |         - Made Armor Crush sound effect customizable       |
// |         - Various minor changes                            |
// |                                                            |
// |      Older versions...                                     |
// |       Read changelog in thread                             |
// |                                                            |
// +------------------------------------------------------------+

scope ArmorCrush initializer Init

// +-------------------------------------+
// |       -=-=- MODIFY HERE -=-=-       |
// |       -=-=- MODIFY HERE -=-=-       |
// |       -=-=- MODIFY HERE -=-=-       |
// +-------------------------------------+
    globals
        private constant integer ABILITY_ID = 'AACR'
        // Rawcode of 'Armor Crush' ability
    
        private constant integer DUMMY_ABILITY_ID = 'AACD'
        // Rawcode of 'Armor Crushed' ability
    
        private constant integer BUFF_ID = 'BACR'
        // Rawcode of 'Armor Crush' buff
    
        private constant integer DUMMY_BUFF_ID = 'BACD'
        // Rawcode of 'Armor Crushed' buff
    
        private constant integer DUMMY = 'nACD'
        // Rawcode of 'DummyCaster' unit
    
        private constant integer VOLUME = 100
        // Volume of the played sound
    
        private constant string EFFECT = "Abilities\\Spells\\Items\\ResourceItems\\ResourceEffectTarget.mdl"
        // Path for Armor Crush special effect
    
        private constant string ATTACH = "overhead"
        // Attachment point of Armor Crush special effect
        
        private constant string SOUND = "Abilities\\Spells\\Human\\Feedback\\Feedback.wav"
        // Path for Armor Crush sound effect
    
        private constant attacktype ATTACK_TYPE = ATTACK_TYPE_HERO
        // Attack type Armor Crush deals
    
        private constant damagetype DAMAGE_TYPE = DAMAGE_TYPE_FIRE
        // Damage type Armor Crush deals
    
        private constant real TEXT_OFFSET = 0
        // Floating text offset
    
        private constant real TEXT_SIZE = 10
        // Floating text font size
    
        private constant integer TEXT_RED = 0
        // Floating text red color amount (0-100)
    
        private constant integer TEXT_GREEN = 0
        // Floating text green color amount (0-100)
    
        private constant integer TEXT_BLUE = 100
        // Floating text blue color amount (0-100)
    
        private constant integer TEXT_ALPHA = 0
        // Floating text transparency (0-100)
    
        private constant real TEXT_LIFE = 3
        // Floating text life
    
        private constant real TEXT_AGE = 2
        // Floating text age
    
        private constant real TEXT_SPEED = 75
        // Floating text speed
    
        private constant real TEXT_ANGLE = 90
        // Floating text angle
    
        private constant string DUMMY_STRING = "innerfire"
        // 'Order String Use/Turn On' for 'Armor Crushed' ability
    
        // Don't change the following three(3) variables
        private sound CrushSound = null // Don't change this!
        private constant group CRUSHED_GROUP = CreateGroup() // Don't change this!
        private integer array UnitCustom // Don't change this!
        // Don't change the above three(3) variables
    endglobals
    
// +------------------------------------------------+
// |       -=-=- CONFIGURABLE FUNCTIONS -=-=-       |
// |       -=-=- CONFIGURABLE FUNCTIONS -=-=-       |
// |       -=-=- CONFIGURABLE FUNCTIONS -=-=-       |
// +------------------------------------------------+
    // Chance to cast Armor Crush
    private function Chance takes integer level returns integer
        return 15
    endfunction
    
    // How many times Armor Crush stacks
    private function Stack takes integer level returns integer
        return 3
    endfunction
    
    // Percentage of health Armor Crush returns
    // Each 0.01 is equal to 1% (So 0.05 would be 5%, 0.25 would be 25%, and so on)
    private function Return takes integer level returns real
        return level * 0.02
    endfunction    

// +----------------------------------------------+
// |       -=-=- NO TOUCHIE PAST HERE -=-=-       |
// |       -=-=- NO TOUCHIE PAST HERE -=-=-       |
// |       -=-=- NO TOUCHIE PAST HERE -=-=-       |
// +----------------------------------------------+
    private function ACConditions takes nothing returns boolean
        return GetRandomInt(1, 100) <= Chance(GetUnitAbilityLevel(GetTriggerUnit(), ABILITY_ID)) and GetUnitAbilityLevel(GetTriggerUnit(), BUFF_ID) > 0
    endfunction

    private function ACActions takes nothing returns nothing
        local unit ar = GetAttacker()
        local real x = GetUnitX(ar)
        local real y = GetUnitY(ar)
        local unit ad = GetTriggerUnit()
        local integer damageAttacker
        local texttag tt  = CreateTextTag()
        local unit u
        local integer QT = GetUnitAbilityLevel(ad, ABILITY_ID)
        
        if CrushSound == null then
            set CrushSound = CreateSound(SOUND, false, true, true, 10, 10, "SpellsEAX")
        endif
        call AttachSoundToUnit(CrushSound, ar)
        call SetSoundVolume(CrushSound, VOLUME)
        call StartSound(CrushSound)
        call KillSoundWhenDone(CrushSound)
        set CrushSound = null
        call DestroyEffect(AddSpecialEffectTarget(EFFECT, ar, ATTACH))
        set damageAttacker = R2I(GetWidgetLife(ar))
        call UnitDamageTarget(ad, ar, (GetUnitState(ad, UNIT_STATE_LIFE) * (Return(QT))), true, true, ATTACK_TYPE, DAMAGE_TYPE, WEAPON_TYPE_WHOKNOWS)
        set damageAttacker = damageAttacker - R2I(GetWidgetLife(ar))
        set u = CreateUnit(GetOwningPlayer(ad), DUMMY, x, y, GetUnitFacing(ar))
        call SetUnitAbilityLevel(u, DUMMY_ABILITY_ID, (UnitCustom[GetUnitIndex(ar)] * QT))
        call IssueTargetOrder(u, DUMMY_STRING, ar)
        call UnitApplyTimedLife(u, 'BTLF', 2.00)
        set tt = CreateTextTagUnitBJ((I2S(damageAttacker) + "!" ), ar, TEXT_OFFSET, TEXT_SIZE, TEXT_RED, TEXT_GREEN, TEXT_BLUE, TEXT_ALPHA)
        call SetTextTagPermanent(tt, false)
        call SetTextTagLifespan(tt, TEXT_LIFE)
        call SetTextTagFadepoint(tt, TEXT_AGE)
        call SetTextTagVelocityBJ(tt, TEXT_SPEED, TEXT_ANGLE)
        set tt = null
        if UnitCustom[GetUnitIndex(ar)] < Stack(QT) then
            set UnitCustom[GetUnitIndex(ar)] = UnitCustom[GetUnitIndex(ar)] + 1
            set u = CreateUnit(GetOwningPlayer(ad), DUMMY, x, y, GetUnitFacing(ar))
            call SetUnitAbilityLevel(u, DUMMY_ABILITY_ID, (UnitCustom[GetUnitIndex(ar)] * QT))
            call IssueTargetOrder(u, DUMMY_STRING, ar)
            call UnitApplyTimedLife(u, 'BTLF', 2.00)
            if (IsUnitInGroup(ar, CRUSHED_GROUP) == false) then
                call GroupAddUnit(CRUSHED_GROUP, ar)
            endif
        endif
        set ar = null
        set ad = null
        set u = null
    endfunction

    private function CGRConditions takes nothing returns boolean
        return FirstOfGroup(CRUSHED_GROUP) != null
    endfunction

    private function RemoveU takes nothing returns nothing
        if GetUnitAbilityLevel(GetEnumUnit(), DUMMY_BUFF_ID) < 1 then
            call GroupRemoveUnit(CRUSHED_GROUP, GetEnumUnit())
            set UnitCustom[GetUnitIndex(GetEnumUnit())] = 0
        endif
    endfunction
    
    private function CGRActions takes nothing returns nothing
        call ForGroup(CRUSHED_GROUP, function RemoveU)
    endfunction

//===========================================================================
    private function Init takes nothing returns nothing
        local trigger trig = CreateTrigger()
        local integer index = 0
        
        loop
            call TriggerRegisterPlayerUnitEvent(trig, Player(index), EVENT_PLAYER_UNIT_ATTACKED, null)
            set index = index + 1
        exitwhen index == bj_MAX_PLAYER_SLOTS
        endloop
        call TriggerAddCondition(trig, Condition(function ACConditions))
        call TriggerAddAction(trig, function ACActions)
        
        set trig = CreateTrigger()
        call TriggerRegisterTimerEvent(trig, 1.50, true)
        call TriggerAddCondition(trig, Condition(function CGRConditions))
        call TriggerAddAction(trig, function CGRActions)
        set trig = null
    endfunction

endscope


Test map included.
Constructive criticism is welcomed, flaming is not.
This spell will only be submitted to TH.net.
Do not redistribute or modify without permission.
Credits are not needed but are appreciated.
Just don't claim the spell as yours.
If you plan to use this spell, it would be nice if you could PM me so I know.

Hope you enjoy it!​

Changelog
v1.5
- Changed PUI to AIDS
- Fixed some coding issues
- Added some test map features
- Touched up coding conventions


v1.4
- Fixed a FirstOfGroup to ForGroup
- Fixed a sound leak
- Fixed texttag leak
- Made floating text more efficient
Credits to Artificial

v1.3
- Fixed a major bug with Armor Crush not stacking
- Made Armor Crush based off an aura
Prevents the buff from being removed
- Implemented PUI to save GetUnitUserData()
- Fixed some BJ's
- Made Armor Crush sound effect customizable
- Various minor changes

v1.2
- Code layout touchup
- Fixed sound BJ's
- Added formula configurable options
- Added an extra implementation step
- Removed a couple useless configurables
- Removed GUI version from map
Download v1.1 if you want GUI
Note I'm not updating the GUI version anymore

v1.1
- Fixed "Feedback" sound not sounding, although now it's unconfigurable
- Greatly optimized code

v1.0
- Initial release
 

Attachments

  • opt-Armor_Crush_v13.w3x
    23.1 KB · Views: 568
  • opt-Armor_Crush_v14.w3x
    23.6 KB · Views: 706
  • opt-Armor_Crush_v15.w3x
    35.2 KB · Views: 671
It doesn't "give health back to the person"?
I suggest you download the map and take a look :p .

EDIT: Changed the spell to make tooltips more clear.

EDITEDIT: Added v1.1, check the Changelog for more information.
 
"Gives a 15% chance to deal a portion of your health back at the attacker."

That's what I meant.

"NOTE: This spell was made for my map for an Agility hero that would have around 2500 health.
That's why I chose the % of health to return that I did."

If it's only going to work with a hero with those preferences i'm going to have to say either:
A: Make a version without the health return effect.
B: Make the percentage of health returned easy to edit. (If it's not already, I havn't looked at it sorry)

Because it's not going to be very usefull if people have to edit their entire hero around the spell.
Just my opinion though.
 
WolfieNoCT, I think you should put your code into wc3 tag (replace [.code] with [.wc3] and [./code] with [./wc3] - without the dot . )

this ability is useful for tankers, I guess :D
 
"Gives a 15% chance to deal a portion of your health back at the attacker."

That's what I meant.
That means when someone attacks you, you have a chance to deal damage back to them equal to a certain percentage of your current health.

"NOTE: This spell was made for my map for an Agility hero that would have around 2500 health.
That's why I chose the % of health to return that I did."

If it's only going to work with a hero with those preferences i'm going to have to say either:
A: Make a version without the health return effect.
B: Make the percentage of health returned easy to edit. (If it's not already, I havn't looked at it sorry)

Because it's not going to be very usefull if people have to edit their entire hero around the spell.
Just my opinion though.
It is easy to edit.
I've added a "Spell Customization" section that even tells you how to change it.
Read the whole post next time before replying :p ...

WolfieNoCT, I think you should put your code into wc3 tag (replace [.code] with [.wc3] and [./code] with [./wc3] - without the dot . )

this ability is useful for tankers, I guess :D
I don't really like those tags, but I'll change them over.

It's good on heroes that are always getting attacked.
If no one attacks the tank (because they kill the weaker heroes first), it's sort of a useless spell to be on him.
It's better for a DPS hero ;) !
 
Instead of me having to reply back asking "what" or "which part" every time, could you just tell me what parts of what triggers and why this isn't MUI :rolleyes: .
 
well then you dont know what MUI is or how to do it, i suggest you read some tutorials
 
I do know what MUI is, and I just don't see how this isn't.
If you're going to be hard about it, don't respond here.
 
can you tell me how it is?
your variables are overwriting
you should take out 'mui' from your 'cons' unless you can change it
 
The variables are all supposed to be overwritten?
Why would I want the life of the attacking unit to stay constant?
And the position of him?

EDIT: The spell works perfectly with all my tests.
 
MUI means that multiply units can cast it at the same time without interupting each other/causing the spell to fail. Enjoy.
 
Any other comments on this spell guys?
Anything you'd like added?
Suggestions on how to make it better?
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    +1
  • Varine Varine:
    I've been really into this
  • Varine Varine:
    It's a musical retelling of The Odyssey
  • Varine Varine:
    Also if you want mixed drinks without alcohol, there's a handful of non-alcoholic 'spirits'. Ritual Zero and Free Spirit are the two brands I've tried and they are alright. They don't have a TON of options, but they have some gin and whiskey alternatives that are fun to play with.
  • Varine Varine:
    I got a couple bottles to make some mixy drinks around holidays when I mostly want to drink, they aren't exact replacements but they are surprisingly close.
  • Varine Varine:
    I ended up with some hop water things that I really like instead for when I want to feel like I'm participating
  • Varine Varine:
    I just got moved to unsupervised probation, so I can get away with drinking a bit now. I technically am not supposed to, but I don't think I get checked anymore. I really want to smoke weed but it scares me
  • The Helper The Helper:
    Happy Wednesday! I am not feeling it today, my teeth are bothering me, or the fragments that were left behind are coming up and it is extra painful today. Don't ever let them tell you that getting full dental implants is easy. They have to pull all your teeth to do those and apparently they are not very good at getting all the teeth out all the time.
    +1
  • The Helper The Helper:
    That is true with Dentures too. I am taking the day off and working from home. The big difference is though, I am not drinking anymore so I have a nice tea and coffee regimen set up :)
  • Varine Varine:
    I wish i had a 3D scanner
  • Varine Varine:
    That would make what I'm doing SO much easier
  • Varine Varine:
    I guess I could just take a picture of it and then use that as a reference. I have a circuit board with some weird holes I can't get measured right
  • Varine Varine:
    Oh I got a Klipper mod for my big printer! It comes with a bunch of parts and I don't totally understand what it does but apparently it's way better than Marlin, which is I think what it currently runs
    +1
  • The Helper The Helper:
    Nice!
  • Varine Varine:
    You're people in Florida safe? The only couple I know are safe but I think they evacuated.
  • The Helper The Helper:
    They are without power but safe. Flood damage and stuff alot of tornados hit east Florida. No fatalities or injuries to any of my people that I know of
  • The Helper The Helper:
    They have been through all the Florida hurricanes they are like me I have been through every texas hurricane for the last 50 years.
  • The Helper The Helper:
    Never evacuated.
  • The Helper The Helper:
    Check out this bad ass Chicken Noodle soup recipe - https://www.thehelper.net/threads/crack-chicken-noodle-soup.196687/
  • The Helper The Helper:
    Happy Saturday!
    +1

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top