Descrição da Spell:
Sempre que atacado, o herói possui certa chance de contra atacar causando uma explosão mágica ao seu redor, danificando todos os inimigos próximos.
Plataforma da Spell:
vJass
Requisitos:
JNGP (Jass New Generation Pack)
Setup (JESP):
- Open Source: pode ser aberto no World Editor
JNGP (Link Externo)
- Página de download da ferramenta
- Instruções de uso e instalação na página de download (inglês).
Sempre que atacado, o herói possui certa chance de contra atacar causando uma explosão mágica ao seu redor, danificando todos os inimigos próximos.
Plataforma da Spell:
vJass
Requisitos:
JNGP (Jass New Generation Pack)
Setup (JESP):
- Código:
module CounterHelixSetup
public static constant method SPELL_RAWCODE takes nothing returns integer
return 'A000'
endmethod
public static method COUNTER_CHANCE_FACTOR takes real level returns real
return (level * 10.00)
endmethod
public static method SPELL_DAMAGE_FACTOR takes real level returns real
return (level * 50.00)
endmethod
// AOE = Área of Effect
public static constant method SPELL_AOE takes nothing returns real
return 256.00
endmethod
public static constant method COUNTER_EFFECT takes nothing returns string
return "Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilSpecialArt.mdl"
endmethod
public static constant method SOUND_PATH takes nothing returns string
return "Units\\Undead\\Banshee\\BansheeDeath.wav"
endmethod
endmodule
- Código:
module enemyAttack
private static method prepareDamageEvent takes nothing returns boolean
local unit u1 = GetTriggerUnit()
local unit u2 = GetAttacker()
local integer i = 0
if GetUnitAbilityLevel(u1,SPELL_RAWCODE()) > 0 then
set i = GetUnitAbilityLevel(u1,SPELL_RAWCODE())
call thistype.registerDamageEvent(u1,i)
endif
set u2 = null
set u1 = null
return false
endmethod
private static method onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 0
loop
call TriggerRegisterPlayerUnitEvent(t,Player(i),ConvertPlayerUnitEvent(18),null)
set i = i + 1
exitwhen i == 12
endloop
call TriggerAddCondition(t,Condition(function thistype.prepareDamageEvent))
endmethod
endmodule
struct CounterHelix extends array
implement CounterHelixSetup
implement enemyAttack
private static hashtable hash = InitHashtable()
private static method filterEnemies takes nothing returns boolean
return GetUnitState(GetFilterUnit(),ConvertUnitState(0)) > 0 and not IsUnitType(GetFilterUnit(),ConvertUnitType(15))
endmethod
private static method doSpin takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local unit u = null
local player p = null
local real i = COUNTER_CHANCE_FACTOR(I2R(LoadInteger(hash,GetHandleId(t),StringHash("key"))))
local real r = GetRandomReal(0.,100.)
local group g = null
local unit f = null
local boolexpr b = null
local effect e = null
local effect e2 = null
local sound s = null
if r < i then
set u = GetTriggerUnit()
set p = GetOwningPlayer(u)
set g = CreateGroup()
set b = Filter(function thistype.filterEnemies)
set e2 = AddSpecialEffect(COUNTER_EFFECT(),GetUnitX(u),GetUnitY(u))
set s = CreateSound(SOUND_PATH(),false,true,true,12700,12700,null)
call AttachSoundToUnit(s,u)
call SetSoundVolume(s,127)
call StartSound(s)
call KillSoundWhenDone(s)
call GroupEnumUnitsInRange(g,GetUnitX(u),GetUnitY(u),SPELL_AOE(),b)
loop
set f = FirstOfGroup(g)
if IsUnitEnemy(f,p) then
call UnitDamageTarget(u,f,SPELL_DAMAGE_FACTOR(I2R(LoadInteger(hash,GetHandleId(t),StringHash("key")))),false,false,ConvertAttackType(0),ConvertDamageType(4),ConvertWeaponType(0))
set e = AddSpecialEffect("Objects\\Spawnmodels\\Human\\HumanBlood\\HumanBloodSmall0.mdl",GetUnitX(f),GetUnitY(f))
call DestroyEffect(e)
endif
call GroupRemoveUnit(g,f)
exitwhen f == null
endloop
call TriggerSleepAction(.5)
call DestroyEffect(e2)
call DestroyBoolExpr(b)
call DestroyGroup(g)
endif
call FlushChildHashtable(hash,GetHandleId(t))
call DestroyTrigger(t)
set e = null
set e2 = null
set e = null
set b = null
set g = null
set p = null
set u = null
set t = null
endmethod
private static method registerDamageEvent takes unit un,integer in returns nothing
local trigger t = CreateTrigger()
call SaveInteger(hash,GetHandleId(t),StringHash("key"),in)
call TriggerRegisterUnitEvent(t,un,ConvertUnitEvent(52))
call TriggerAddAction(t,function thistype.doSpin)
set t = null
endmethod
private static method prepareDamageEvent takes nothing returns boolean
local unit u1 = GetTriggerUnit()
local unit u2 = GetAttacker()
local integer i = 0
if GetUnitAbilityLevel(u1,SPELL_RAWCODE()) > 0 then
set i = GetUnitAbilityLevel(u1,SPELL_RAWCODE())
call thistype.registerDamageEvent(u1,i)
endif
set u2 = null
set u1 = null
return false
endmethod
private static method prepareAttackEvent takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 0
loop
call TriggerRegisterPlayerUnitEvent(t,Player(i),ConvertPlayerUnitEvent(18),null)
set i = i + 1
exitwhen i == 12
endloop
call TriggerAddCondition(t,Condition(function thistype.prepareDamageEvent))
endmethod
private static method prepareSkill takes nothing returns boolean
local unit u = null
local player p = null
local integer i = 0
if GetLearnedSkill() == SPELL_RAWCODE() then
set u = GetTriggerUnit()
set p = GetOwningPlayer(u)
set i = GetUnitAbilityLevel(u,GetLearnedSkill())
endif
return false
endmethod
private static method onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 0
loop
call TriggerRegisterPlayerUnitEvent(t,Player(i),ConvertPlayerUnitEvent(42),null)
set i = i + 1
exitwhen i == 12
endloop
call TriggerAddCondition(t,Condition(function thistype.prepareSkill))
set t = null
endmethod
endstruct
- Open Source: pode ser aberto no World Editor
JNGP (Link Externo)
- Página de download da ferramenta
- Instruções de uso e instalação na página de download (inglês).