- Joined
- Jul 26, 2008
- Messages
- 1,009
I want to Create 2 different spells all of which call on the same struct to create it's effect.
Firewall - Creates a row of collision dummies that burn enemies who get to close.
Apocalypse - Creates a single collision dummy that burns enemies who get too close.
The spells and math and whatnot are made, what isn't working is that when I call the starting struct member, it wants to call it within the scope and gives me a compile error. Since there's also item versions of these two spells it's good to have this struct. Just need help making it work.
Firewall - Creates a row of collision dummies that burn enemies who get to close.
Apocalypse - Creates a single collision dummy that burns enemies who get too close.
The spells and math and whatnot are made, what isn't working is that when I call the starting struct member, it wants to call it within the scope and gives me a compile error. Since there's also item versions of these two spells it's good to have this struct. Just need help making it work.
JASS:
struct FirePatch extends xecollider
unit caster
real dam
method onUnitHit takes unit target returns nothing
local xedamage d= xedamage.create()
set d.dtype = DAMAGE_TYPE_MAGIC
set d.atype = ATTACK_TYPE_MELEE
set d.exception = UNIT_TYPE_FLYING
call d.factor ( UNIT_TYPE_STRUCTURE, 0.4)
call d.damageTarget(.caster,target,.dam)
call d.destroy()
endmethod
static method Actions takes unit c, integer id, real x, real y, real dur, real dam returns nothing
local integer lvl = GetUnitAbilityLevel(c, id)
local FirePatch xc = FirePatch.create(x, y, 0)
set xc.caster = c
set xc.speed = 0
set xc.expirationTime = dur
set xc.collisionSize = 50
set xc.fxpath = GetAbilityEffectById(id, EFFECT_TYPE_MISSILE, lvl-1)
set xc.scale = 1.5
set xc.dam = dam
endmethod
endstruct
scope FireWall
globals
private constant integer SPELLID = 'A011'
endglobals
private function Actions takes unit c, real x, real y returns nothing
local real angle = Atan2(y+90 - GetUnitY(c), x+90 - GetUnitX(c))
local real dx = x + i*100 * Cos(angle)
local real dy = y + i*100 * Sin(angle)
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
local integer i = -lvl-1
local real dam = SpellStat(0.35+0.2*lvl)+10*lvl
loop
exitwhen i > lvl+1
call FirePatch.Actions( c, SPELLID, dx, dy, 6, dam)
set i = i + 1
endloop
endfunction
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID
call Actions( GetTriggerUnit(),GetSpellTargetX(),GetSpellTargetY() )
endif
return false
endfunction
public function InitTrig_FireWall takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition(t, function Conditions )
set t = null
endfunction
endscope