新規スキル案


※上記の広告は60日以上更新のないWIKIに表示されています。更新することで広告が下部へ移動します。

//Mystic Net by Hanky aka OrkOfMordor aka MDZ-OrkOfMordor

//Constants
scope MysticNet
  globals
    private constant integer SpellId          ='A00G'  //Mystic Net
    private constant string LightningType     ="LEAS"
    private constant integer BuffSpellId      ='A00H'  //Mystic Net - Effect
    private constant string BuffOrder         ="berserk"
    private rect MaxArea                      =null
    private constant real MissileFlyHeight    =60.00
    private constant real MaxMissileDistance  =750.00
    private constant real MissileSpeed        =20.00
    private constant real TargetSpeed         =15.00
    private constant real MissileCollision    =90.00
    private constant real StopTargetRange     =120.00
    private constant real lightningZ          =45.00
    private constant real DeformationRange    =200.00
    private constant integer DummyId          ='e000'
    private constant string MissileGFXPath    ="Abilities\\Weapons\\LordofFlameMissile\\LordofFlameMissile.mdl"
    private constant string MissileGFXAttach  ="origin"
    private constant string MissGFXPath       ="Abilities\\Spells\\Orc\\Disenchant\\DisenchantSpecialArt.mdl"
    private constant string MissGFXAttach     ="origin"
    private constant string HitGFXPath        ="Abilities\\Spells\\Human\\AerialShackles\\AerialShacklesTarget.mdl"
    private constant string HitGFXAttach      ="origin"
    private constant string GroundHitGFXPath  ="Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl"
    private constant string GroundNetGFXPath  ="Abilities\\Weapons\\DemolisherFireMissile\\DemolisherFireMissile.mdl"
    private constant string ReactHitGFXPath   ="Abilities\\Spells\\NightElf\\BattleRoar\\RoarCaster.mdl"
    private constant string ReactHitGFXAttach ="origin"
    private constant string ReactMissGFXPath  ="Abilities\\Spells\\NightElf\\Taunt\\TauntCaster.mdl"
    private constant string ReactMissGFXAttach="origin"
    private constant real maxHigh             =500.00
  endglobals

  private constant function MaxFlyHeight takes real distance returns real
    return distance*1.1
  endfunction

  private constant function DamagePerLevel takes real lvl returns real
     return 20+60*lvl
  endfunction
  
  //Conditions

  function Trig_Mystic_Net_Conditions takes nothing returns boolean
    return GetSpellAbilityId()==SpellId
  endfunction
  
  //Actions
  
  private struct MNdat_Hit extends MotionLoop
    unit target
    unit caster
    effect gfx
    lightning rope

    real dmg
    real mtime
    real ctime
    real endz
    real x
    real y
    real z
    real tx
    real ty
  
    method motion takes nothing returns nothing
      local real x              =GetUnitX(.target)
      local real y              =GetUnitY(.target)
      local real cx
      local real cy
      local real angle
      local real curv

      if .mtime>=.ctime and GetUnitState(.caster,UNIT_STATE_LIFE)>0.00 then
         set cx=GetUnitX(.caster)
         set cy=GetUnitY(.caster)
         set angle=A2PXY(x,y,cx,cy)
         set curv=GetFlyParabel(.x,.y,.z,0.,.mtime,.ctime,.endz,TargetSpeed,x,y,.tx,.ty)
         set .ctime=.ctime+Motion_periodic
         set x=x+TargetSpeed*Cos(angle*3.14159/180)
         set y=y+TargetSpeed*Sin(angle*3.14159/180)

         call MoveLightningEx(.rope,true,cx,cy,MissileFlyHeight+GetZ(x,y),x,y,curv+lightningZ+GetZ(x,y))
         call SetUnitPosition(.target,x,y)
         call UnitAddFly(.target)
         call SetUnitFlyHeight(.target,curv,0)
       else
         call UnitDamageTarget(.caster,.target,.dmg,true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
         call UnitAddAbility(.target,BuffSpellId)
         call IssueImmediateOrder(.target,BuffOrder)
         call UnitRemoveAbility(.target,BuffSpellId)
         call TerrainDeformationRippleXY(1,false,x,y,0,DeformationRange,90.,0.5,200.)
         call DestroyEffect(AddSpecialEffect(GroundHitGFXPath,x,y))
         call DestroyEffect(AddSpecialEffect(GroundNetGFXPath,x,y))
         call UnitAddFly(.target)
         if IsUnitType(.target, UNIT_TYPE_FLYING) then
           call SetUnitFlyHeight(.target,.z,300.)
         else
           call SetUnitFlyHeight(.target,0.,0.)
         endif
      
         set .active=false
      endif
    endmethod
    
    method endmotion takes nothing returns nothing
      call DestroyEffect(.gfx)
      call DestroyLightning(.rope)
      
      call .destroy()
    endmethod
    
    method onDestroy takes nothing returns nothing
      set .target=null
      set .caster=null
      set .gfx   =null
      set .dmg   =0.
      set .mtime =0.
      set .ctime =0.
      set .endz  =0.
      set .x     =0.
      set .y     =0.
      set .z     =0.
      set .tx    =0.
      set .ty    =0.
    endmethod
  endstruct
  
  private struct MNdat_Miss extends MotionLoop
    unit dummy
    effect gfx
    lightning rope

    real x
    real y
    real tx
    real ty
    real mx
    real my
    real mz
    real distance
  
    method motion takes nothing returns nothing    
      if .distance>0 then
        set .x=.x+.mx
        set .y=.y+.my
        set .distance=.distance-MissileSpeed
        
        call MoveLightningEx(.rope,true,.x,.y,.mz,.tx,.ty,.mz)
        call DestroyEffect(.gfx)
        set .gfx=AddSpecialEffectTarget(MissGFXPath,.dummy,MissGFXAttach)
      else
        set .active=false
      endif
    endmethod
    
    method endmotion takes nothing returns nothing
      call DestroyEffect(.gfx)
      call RemoveUnit(.dummy)
      call DestroyLightning(.rope)
    
      call .destroy()
    endmethod
    
    method onDestroy takes nothing returns nothing
      set .gfx     =null
      set .dummy   =null
      set .rope    =null
      
      set .x       =0.
      set .y       =0.
      set .mx      =0.
      set .my      =0.
      set .tx      =0.
      set .ty      =0.
      set .mz      =0.
      set .distance=0.
    endmethod
  endstruct

  private struct MNdat_Throw extends MotionLoop
    real x
    real y
    real z
    real distance
    unit caster
    unit dummy
    effect gfx
    lightning rope
    
    method motion takes nothing returns nothing
      local MNdat_Miss Mdat
      local MNdat_Hit  Hdat
    
      local real x              =GetUnitX(.caster)
      local real y              =GetUnitY(.caster)
      local real z
      local real angle          =A2PXY(x,y,.x,.y)
      local boolean hit         =false
      local unit t
      local unit a
      local group g


      set .x=.x+MissileSpeed*Cos(angle*3.14159/180)
      set .y=.y+MissileSpeed*Sin(angle*3.14159/180)
      set .distance=D2PXY(.x,.y,x,y)
      set z=GetZ(.x,.y)
      
      call MoveLightningEx(.rope,true,x,y,.z,.x,.y,.z)
      call UnitAddFly(.dummy)
      call SetUnitFlyHeight(.dummy,.z-z,0)
      call SetUnitX(.dummy,.x)
      call SetUnitY(.dummy,.y)
      call SetUnitFacing(.dummy,angle)

      set g=GetUnitsInRange(MissileCollision,.x,.y)
      loop
        set a=FirstOfGroup(g)
        exitwhen a==null
        call GroupRemoveUnit(g,a)
        
        if IsUnitNotImmun(.caster,a) then
          set t=a
          set hit=true
        endif
      endloop

      if z>=.z or .distance>=MaxMissileDistance or not RectContainsCoords(MaxArea,.x,.y) or GetUnitState(.caster,UNIT_STATE_LIFE)<=0.00 or CountDestructableInRangeOfXY(.x,.y,MissileCollision)>0 then

         //Miss Init
         set Mdat      =MNdat_Miss.create()

         set Mdat.dummy  =.dummy
         set Mdat.gfx    =AddSpecialEffectTarget(MissGFXPath,.dummy,MissGFXAttach)
         set Mdat.rope   =.rope

         set Mdat.x       =x
         set Mdat.y       =y
         set Mdat.mx      =MissileSpeed*Cos(angle*3.14159/180)
         set Mdat.my      =MissileSpeed*Sin(angle*3.14159/180)
         set Mdat.tx      =.x
         set Mdat.ty      =.y
         set Mdat.mz      =.z
         set Mdat.distance=D2PXY(x,y,.x,.y)

         call DestroyEffect(AddSpecialEffectTarget(ReactMissGFXPath,.caster,ReactMissGFXAttach))
         call UnitAddFly(.dummy)
         call SetUnitFlyHeight(.dummy,.z-z,0)
         call SetUnitX(.dummy,.x)
         call SetUnitY(.dummy,.y)
        
         call AddObjectToMotion(Mdat)
         set .active=false
       elseif hit then
         //Hit Init        
         set Hdat       =MNdat_Hit.create()

         set Hdat.target=t
         set Hdat.caster=.caster
         set Hdat.ctime =0.
         set Hdat.rope  =.rope
         set Hdat.mtime =.distance/TargetSpeed*Motion_periodic
         set Hdat.dmg   =DamagePerLevel(I2R(GetUnitAbilityLevel(.caster,SpellId)))
         set Hdat.x     =GetUnitX(t)
         set Hdat.y     =GetUnitY(t)
         set Hdat.z     =GetUnitDefaultFlyHeight(t)
         set Hdat.tx    =x+StopTargetRange*Cos(angle*3.14159/180)
         set Hdat.ty    =y+StopTargetRange*Sin(angle*3.14159/180)
         set Hdat.endz  =MaxFlyHeight(D2PXY(Hdat.x,Hdat.y,Hdat.tx,Hdat.ty))
         set Hdat.gfx   =AddSpecialEffectTarget(HitGFXPath,t,HitGFXAttach)
        
         call AddObjectToMotion(Hdat)
         call RemoveUnit(.dummy)
         call DestroyEffect(AddSpecialEffectTarget(ReactHitGFXPath,.caster,ReactHitGFXAttach))
         call SetUnitPathing(t,false)
        
         set .active=false
         set t=null
      endif
      
      set g=null
    endmethod
    
    method endmotion takes nothing returns nothing
      call DestroyEffect(.gfx)
      
      call .destroy()
    endmethod
    
    method onDestroy takes nothing returns nothing
      set .caster  =null
      set .dummy   =null
      set .gfx     =null
      set .rope    =null
    
      set .x       =0.
      set .y       =0.
      set .z       =0.
      set .distance=0.
    endmethod
  endstruct

  private function Trig_Mystic_Net_Actions takes nothing returns nothing
    local location loc        =GetSpellTargetLoc()
    local real lx             =GetLocationX(loc)
    local real ly             =GetLocationY(loc)
    local MNdat_Throw dat     =MNdat_Throw.create()
    local real angle
    local real x
    local real y
    local real z
    
    set dat.caster  =GetTriggerUnit()
    set x           =GetUnitX(dat.caster)
    set y           =GetUnitY(dat.caster)
    set angle       =A2PXY(x,y,lx,ly)
    set dat.x       =x+MissileSpeed*Cos(angle*3.14159/180)
    set dat.y       =y+MissileSpeed*Sin(angle*3.14159/180)
    set z           =GetZ(dat.x,dat.y)
    set dat.z       =MissileFlyHeight+z
    set dat.distance=0.
    set dat.rope    =AddLightningEx(LightningType,true,dat.x,dat.y,dat.z,dat.x,dat.y,dat.z)
    set dat.dummy   =CreateUnit(Player(14),DummyId,dat.x,dat.y,A2PXY(dat.x,dat.y,lx,ly))
    set dat.gfx     =AddSpecialEffectTarget(MissileGFXPath,dat.dummy,MissileGFXAttach)
    
    call UnitAddFly(dat.dummy)
    call SetUnitFlyHeight(dat.dummy,dat.z-z,0)
    call SetUnitX(dat.dummy,dat.x)
    call SetUnitY(dat.dummy,dat.y)

    call AddObjectToMotion(dat)
    
    call RemoveLocation(loc)
    set loc=null
  endfunction

//===========================================================================
function InitTrig_Mystic_Net takes nothing returns nothing
    local integer i=0

    set gg_trg_Mystic_Net = CreateTrigger(  )
    set MaxArea=bj_mapInitialPlayableArea
    loop
      call TriggerRegisterPlayerUnitEvent(gg_trg_Mystic_Net, Player(i),EVENT_PLAYER_UNIT_SPELL_EFFECT, Filter(function Enum_AntiLeak))

      set i=i+1
      exitwhen i==bj_MAX_PLAYER_SLOTS
    endloop
    call TriggerAddCondition( gg_trg_Mystic_Net, Condition( function Trig_Mystic_Net_Conditions ) )
    call TriggerAddAction( gg_trg_Mystic_Net, function Trig_Mystic_Net_Actions )
    
    //Preload
    call Preload(MissileGFXPath)
    call Preload(MissGFXPath)
    call Preload(HitGFXPath)
    call Preload(GroundHitGFXPath)
    call Preload(ReactHitGFXPath)
    call Preload(ReactMissGFXPath)
endfunction
endscope
ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。