• 🏆 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!

Adrenaline v1.00

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
Alright, here comes my second JASS[JESP] spell :).
============================================================
Spell Action:

The adrenaline pumps the users blood, giving him 35 % chance to completely absorb incoming damage. If the damage he receives is to high, he will instead emit strong nova blasts around him, that deal damage to nearby enemies.

Level 1: Absorbs up to 100 damage. If it can't be absorbed, user will spawn 2 nova
rings around him, each nova dealing 25 damage in AOE of 100.

Level 2: Absorbs up to 150 damage. If it can't be absorbed, user will spawn 2 nova
rings around him, each nova dealing 50 damage in AOE of 100.

Level 1: Absorbs up to 200 damage. If it can't be absorbed, user will spawn 2 nova
rings around him, each nova dealing 75 damage in AOE of 100.

==========================================================

You can change absorb damage, nova damage, AOE, chance, SFX in the trigger constants. It's MUI, and I belive leakless. Hope you have fun :). Rate and post comments, thank you.

Keywords:
Adrenaline, Absorb, Nova, Damage
Contents

Just another Warcraft III map (Map)

Reviews
12th Dec 2015 IcemanBo: Too long time as NeedsFix. Rejected. 20:50, 1st Mar 2010 TriggerHappy: Use an already existing damage detection system, do not inline your own into the spell. Also do not inline the spell event, just use the BJ...

Moderator

M

Moderator

12th Dec 2015
IcemanBo: Too long time as NeedsFix. Rejected.

20:50, 1st Mar 2010
TriggerHappy:

Use an already existing damage detection system, do not inline your own into the spell. Also do not inline the spell event, just use the BJ.

Set/GetUnitState (for life) should be replaced with Set/GetWidgetLife.
 
Level 8
Joined
Jun 18, 2007
Messages
214
And here is the code:
JASS:
//***************************************************************************************************
//* ===================   
//* Adrenaline 
//* ===================  
//* Made by Shdow89 
//* 
//*
//* How to implement:
//* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
//* 1. Copy the spell "Adrenaline" to your map.
//*
//* 2. Copy the trigger trigger Adrenaline, and the entire Costum Script Section, and paste
//*    it in your map. Change the spell rawcode, to the one in your map.
//* 
//* Choosable/Effects:
//* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯   
//*    Go down through constant function and change to what you like. Units affected are:
//*    Enemy Units, Non-Magic immune, Non-Structures and living. This can be changed in the
//*    costum script section of the map.
//*
//* Editor's Word: 
//* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯ 
//*    My second JASS spell, it's fairly simple to make. Post comments and rate it at the
//*    hive. Give credit if used, and enjoy :).
//*
//* Spells Action:
//* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯ 
//*    When adrenaline pumps the users blood, it enables him to completely absorb incoming damage.
//*    If the damage he receives is very high, he will instead emit strong nova blasts around him
//*    and deal damage to nearby enemies.       
//*
//* Credits:
//* ¯¯¯¯¯¯¯¯
//*    Daelin for his tutorial about Polar Projections.
//*    And you for dling the map :).
//*   
//*
//*************************************************************************************************
constant function Adrenaline_DodgeSFX takes nothing returns string
    return "Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl" // SFX when unit absorbs damage
endfunction

constant function Adrenaline_NovaHit_SFX takes nothing returns string
    return "Abilities\\Weapons\\Mortar\\MortarMissile.mdl" // SFX for units hit by nova blast
endfunction

constant function Nova_SFX takes nothing returns string
    return "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile.mdl" // SFX for novas
endfunction

constant function Adrenaline_Rawcode takes nothing returns integer
    return 'A000' // Adrenaline spell rawcode (change this to your rawcode)
endfunction

constant function Nova_Distance takes nothing returns real
    return 150.00 // Distance between each nova
endfunction

constant function Nova_Time takes nothing returns real
    return 0.2 // Time before next nova ring spawns
endfunction

constant function Nova_Count takes nothing returns integer
    return 6 // Number of novas in each ring
endfunction

constant function Max_Damage takes integer i returns integer
    return 50+(i*50) // Maximum damage that unit will absorb ( 50 + Adrenaline level * 50)
endfunction

constant function Max_Chance takes nothing returns integer
    return 35 // Adrenaline activate chance
endfunction

constant function Damage_AOE takes nothing returns real
    return 125.00 // AOE of the nova damage
endfunction

constant function Nova_Damage takes integer i returns real
    return 25.00*i // Total damage each nova deals ( 50 + 50 * level of Adrenaline)
endfunction

//=========================================================================================
// Polar projection X and Y functions. Credit to Daelin.

function PolarProjectionX takes real x, real dist, real angle returns real
    return x+dist*Cos(angle*bj_DEGTORAD)
endfunction

function PolarProjectionY takes real y, real dist, real angle returns real
    return y+dist*Sin(angle*bj_DEGTORAD)
endfunction

//==========================================================================================
// Don't edit anything below this, if you are unsure.

function Trig_Adrenaline_Conditions takes nothing returns boolean
    return GetLearnedSkillLevel() == 1 and GetLearnedSkill() == Adrenaline_Rawcode()
endfunction

//The function after damage receive.
function Trig_Adrenaline_MainActions takes nothing returns nothing
 local unit kenny = GetTriggerUnit()
 
 local integer chance = GetRandomInt(1, 100)
 
 local integer counter2 = 0
 local integer novas = Nova_Count()
 
 local real damage = GetEventDamage()
 
 local integer angle = 360/Nova_Count()
 local real dist = Nova_Distance() 
 
 if chance <= Max_Chance() then
    if Max_Damage(GetUnitAbilityLevel(kenny, Adrenaline_Rawcode())) > damage then
         call SetUnitState(kenny, UNIT_STATE_LIFE, GetUnitState(kenny, UNIT_STATE_LIFE) + damage)
         call DestroyEffect(AddSpecialEffect(Adrenaline_DodgeSFX(), GetUnitX(kenny), GetUnitY(kenny)))
   else   
         loop
         set counter2 = counter2 + 1
         exitwhen counter2 > Nova_Count()            
         call DestroyEffect(AddSpecialEffect(Nova_SFX(), PolarProjectionX(GetUnitX(kenny), dist, I2R(counter2*angle)), PolarProjectionY(GetUnitY(kenny), dist, I2R(counter2*angle))))
         call DamageEnemiesArea(kenny, Damage_AOE(), PolarProjectionX(GetUnitX(kenny), dist, I2R(counter2*angle)), PolarProjectionY(GetUnitY(kenny), dist, I2R(counter2*angle)), Nova_Damage(GetUnitAbilityLevel(kenny, Adrenaline_Rawcode())), true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS, Adrenaline_NovaHit_SFX())     
         endloop

         set counter2 = 0
         set dist = dist + Nova_Distance()
         call TriggerSleepAction(Nova_Time())

         loop
         set counter2 = counter2 + 1
         exitwhen counter2 > Nova_Count()            
         call DestroyEffect(AddSpecialEffect(Nova_SFX(), PolarProjectionX(GetUnitX(kenny), dist, I2R(counter2*angle)), PolarProjectionY(GetUnitY(kenny), dist, I2R(counter2*angle))))
         call DamageEnemiesArea(kenny, Damage_AOE(), PolarProjectionX(GetUnitX(kenny), dist, I2R(counter2*angle)), PolarProjectionY(GetUnitY(kenny), dist, I2R(counter2*angle)), Nova_Damage(GetUnitAbilityLevel(kenny, Adrenaline_Rawcode())), true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS, Adrenaline_NovaHit_SFX())
         endloop
  
         set counter2 = 0
         set dist = 0.00      
    endif 
 else
  set kenny = null
  set chance = 0
  set damage = 0.00
  set novas = 0
  set angle = 0 
 endif   
endfunction

//If the selected(unit with spell) unit has the spell, add him to damage event.
function Trig_Adrenaline_Actions takes nothing returns nothing
 local unit u = GetTriggerUnit()
 local trigger t = CreateTrigger()
 
 call TriggerRegisterUnitEvent(t, u, EVENT_UNIT_DAMAGED)
 call TriggerAddAction(t, function Trig_Adrenaline_MainActions)
 
 set u = null
 set t = null 
endfunction

//The init trigger
function InitTrig_Adrenaline takes nothing returns nothing
    local trigger trig = CreateTrigger()
    local integer sisa
    
    set sisa = 0
    loop
        call TriggerRegisterPlayerUnitEvent(trig, Player(sisa), EVENT_PLAYER_HERO_SKILL , null)
        set sisa = sisa + 1
        exitwhen sisa == 16
    endloop

    call TriggerAddCondition(trig, Condition(function Trig_Adrenaline_Conditions))
    call TriggerAddAction(trig, function Trig_Adrenaline_Actions)
    
    call Preload(Adrenaline_DodgeSFX())
    call Preload(Nova_SFX())
     
    set sisa = 0
    set trig = null
endfunction
 
Level 8
Joined
Jun 18, 2007
Messages
214
Cool! =) From zero to jass in such a quick time :p
Anyways, one thing you might want to think about is adjusting the spell so that if you use the tome of unlearning, the spell doesn't work anymore ;) get my point?

Well, hehe, I guess it really can't be perfect :):)..... I hope you like the spell, since it seems you're the only one commenting my spells xD..... I gotta give you rep :D. +Rep
 
Level 8
Joined
Jun 18, 2007
Messages
214
Bugy.

Set block rate to 100% and then inflict 50 damage when you are at full HP and see what I mean.

Hmmm.... I know exactly what you mean. For example, if unit receives 200 damage, and it has 100, while block being activated, the unit will still die. Because, the damage calculation on taking away HP comes before replacing it (you can't replenish HP of the dead unit :p). To be honest, I don't really now how to improve this: how to make the damage 100 % absorb, so the unit don't die if it receives more damage then it's HP.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,190
Actually no, the on damage event triggers before the damage is removed from HP.
Thus the problem is with the units max life, as you reheal the damage it will take but if its at max HP it can not reheal enough damage to result in the HP not changing. You need to reheal the unit enough so it can not die from the damage and then 0.00 seconds later (use a timer) you restore its HP back to what it should be. All under a frame of time.
 
Top