//***************************************************************************************************
//* ===================
//* 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