Moderator
M
Moderator
12:54, 2nd Jun 2013
Magtheridon96: Approved.
Looking good.
Magtheridon96: Approved.
Looking good.
/*
Reaping Field v1.00
by Adiktuz
--------------------------------------------------------
External Library Requirements:
Nova - http://www.hiveworkshop.com/forums/spells-569/nova-system-2-01-a-181884/
SpellEffectEvent - http://www.hiveworkshop.com/forums/jass-resources-412/snippet-spelleffectevent-187193/
--------------------------------------------------------
How to Import:
1) Import the Nova and Spell trigger folders to your map
2) Import the dummy.mdx model (if you haven't have one already) and create a dummy caster
3) Modify the spell settings on the globals block and spell setting functions
of the Reaping Field(this trigger)
4) Make sure that you set the dummy's rawcode on the Nova library
--------------------------------------------------------
*/
library ReapingField initializer OnInit requires Nova, SpellEffectEvent
globals
private constant integer SPELL_ID = 'A000' //Rawcode of the spell
private constant string PATH = "Abilities\\Spells\\Undead\\OrbOfDeath\\AnnihilationMissile.mdl" //Path to the effect of the spell
private constant attacktype AT = ATTACK_TYPE_MAGIC //attack type of the spell
private constant damagetype DT = DAMAGE_TYPE_MAGIC //damage type of the spell
private constant string HIT_PATH = "Abilities\\Spells\\Undead\\DeathandDecay\\DeathandDecayTarget.mdl" //Path to the effect played upon hit
private constant boolean SHOW_HIT = true //set this to true if you're using HIT_PATH
private constant boolean ONCAST = true //Does the spell's effect start right after cast?
endglobals
//Setting functions for the base spell
//Determines the damage AOE of the spell
private function Faoe takes integer level, unit caster returns real
return 150.0 + 50.0*level
endfunction
//Determines the scale of the special effect
private function Scale takes integer level, unit caster returns real
return 2.0 + 0.2*level
endfunction
//Determines the height of the special effect
private function Height takes integer level, unit caster returns real
return 50.0
endfunction
//Determines the total time of the spell
private function TotalTime takes integer level, unit caster returns real
return 5.0
endfunction
//Determines the time interval per damage of the spell
private function TimeInterval takes integer level, unit caster returns real
return 1.0
endfunction
//Determines the damage multiplier for the spell
//Damage = (Max HP - Current HP)*multiplier
private function DamageMulti takes integer level, unit caster returns real
return level*0.3
endfunction
//Manages the showing of hit effects
static if SHOW_HIT then
private function OnDamage takes nothing returns nothing
call DestroyEffect(AddSpecialEffectTarget(HIT_PATH,NovaSystem.data.filter,"origin"))
endfunction
endif
//Handles setting of damage per target
//Do not edit if you don't now what you're doing
private function OnHit takes nothing returns nothing
local NovaSystem nova = NovaSystem.data
local real maxhp = GetUnitState(nova.filter,UNIT_STATE_MAX_LIFE)
set nova.damage = (maxhp-GetWidgetLife(nova.filter))*DamageMulti(GetUnitAbilityLevel(nova.caster,SPELL_ID),nova.caster)
endfunction
//Main spell function
private function Fire takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer level = GetUnitAbilityLevel(u,SPELL_ID)
call NovaSystem.create(u, null, GetSpellTargetX(), GetSpellTargetY(), 0.0, Faoe(level,u), Height(level,u), 1,/*
*/1, TimeInterval(level,u), TotalTime(level,u),0.0, Scale(level,u), false, ONCAST,/*
*/false, PATH, AT, DT, true, SPELL_ID)
set u = null
endfunction
private function OnInit takes nothing returns nothing
call RegisterSpellEffectEvent(SPELL_ID, function Fire)
call NovaSystem.registerOnHit(SPELL_ID, function OnHit)
static if SHOW_HIT then
call NovaSystem.registerOnDamage(SPELL_ID, function OnDamage)
endif
endfunction
endlibrary