XGM Forum
Сайт - Статьи - Проекты - Ресурсы - Блоги

Форуме в режиме ТОЛЬКО ЧТЕНИЕ. Вы можете задать вопросы в Q/A на сайте, либо создать свой проект или ресурс.
Вернуться   XGM Forum > Warcraft> Академия: форум для вопросов> Jass
Ник
Пароль
Войти через VK в один клик
Сайт использует только имя.

Закрытая тема
 
playerzorg

offline
Опыт: 214
Активность:
private function И library
Чё это такое? объясните кто-нибудь чё за scope,private constant,globals,private rect, чё за язык такой? непонятно(
Код:
//Bloody Run by Hanky aka OrkOfMordor aka MDZ-OrkOfMordor

//Constants
scope BloodyRun

   globals
     private constant integer SpellId    ='A00C'  //Bloody Run
     private constant integer BuffSpellId='A00E'  //Blood Run - Effect (Caster)
     private constant integer BuffId     ='B00A'  //Blood Run
     private constant string BuffOrder   ="soulburn"
     private constant string RunOrder    ="move"
     private constant string StopOrder   ="stop"
     private constant integer DummyId    ='e000'
     private rect MaxArea                =null
     private constant real Speed         =10.00
     private constant real MinTime       =0.2
     private constant real Range         =90.00
     private constant string dmgGFX      ="Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl"
     private constant string dmgAtt      ="origin"
     private constant string uGFX        ="Abilities\\Spells\\Items\\VampiricPotion\\VampPotionCaster.mdl"
     private constant string uAtt        ="origin"
   endglobals

   private constant function Damage takes real lvl returns real
     return 25+50*lvl
   endfunction
   
   //Conditions
   
   private function Trig_Bloody_Run_Conditions takes nothing returns boolean
      return GetSpellAbilityId()==SpellId
   endfunction
   
   //Actions

   private struct BloodyRunDatas extends MotionLoop
      unit caster
      effect gfx
      group notDamage
      
      real distance
      real dmg      
      real mx
      real my
      
      method motion takes nothing returns nothing
        local real x              =GetUnitX(.caster)+.mx
        local real y              =GetUnitY(.caster)+.my
        local group g
        local unit a
        local unit bx
        
        if CountDestructableInRangeOfXY(x,y,Range)>0 and not IsPointWalkable(x,y) then
          set .active=false
          return
        endif        
        if .distance>0. and GetUnitState(.caster,UNIT_STATE_LIFE)>0. and RectContainsCoords(MaxArea,x,y) then
          call SetUnitX(.caster,x)
          call SetUnitY(.caster,y)

          set g=GetUnitsInRange(Range,x,y)
          loop
            set a=FirstOfGroup(g)
            exitwhen a==null
            call GroupRemoveUnit(g,a)
            
            if not IsUnitInGroup(a,.notDamage) and IsUnitNotImmun(.caster,a) then
              call DestroyEffect(AddSpecialEffectTarget(dmgGFX,a,dmgAtt))
              call GroupAddUnit(.notDamage,a)
              call UnitDamageTarget(.caster,a,.dmg,true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL  ,WEAPON_TYPE_WHOKNOWS)
            endif
          endloop
          
          set .distance=.distance-Speed
          set g=null
        else
          set .active=false
        endif
        if GetUnitAbilityLevel(.caster,BuffId)<=0 then
          set bx=CreateUnit(Player(14),DummyId,x,y,0)
          call UnitAddAbility(bx,BuffSpellId)
          call IssueTargetOrder(bx,BuffOrder,.caster)
          call U2Null(bx,0.5)
          set bx=null
        endif
      endmethod
      
      method endmotion takes nothing returns nothing  
          local real x=GetUnitX(.caster)
          local real y=GetUnitY(.caster)
      
          call SetUnitPathing(.caster,true)
          call IssueImmediateOrder(.caster,StopOrder)
          call SetUnitPosition(.caster,GetPointWalkableX(x,y),GetPointWalkableY(x,y))
          call SetUnitVertexColor(.caster,255,255,255,255)
          call DestroyBuffAfterTime(.caster,BuffId,2.) 
          call DestroyEffect(.gfx)
          call AB_DestroyGroup(.notDamage)
          
          call .destroy()
      endmethod
      
      method onDestroy takes nothing returns nothing
          set .caster   =null
          set .gfx      =null
          set .notDamage=null
          
          set .distance =0.
          set .dmg      =0.
          set .mx       =0.
          set .my       =0.
      endmethod
   endstruct

   private function Trig_Bloody_Run_Actions takes nothing returns nothing
      local BloodyRunDatas dat  =BloodyRunDatas.create()
      local location OrderPoint =GetSpellTargetLoc()
      local unit u              =GetTriggerUnit()
      local real ux             =GetUnitX(u)
      local real uy             =GetUnitY(u)
      local real tx             =GetLocationX(OrderPoint)
      local real ty             =GetLocationY(OrderPoint)
      local real distance       =D2PXY(ux,uy,tx,ty)
      local real angle          =A2PXY(ux,uy,tx,ty)
      local unit bx
      
      set dat.caster   =u
      set dat.distance =distance-(distance/GetUnitMoveSpeed(u)*(Speed*Speed))
      set dat.gfx      =AddSpecialEffectTarget(uGFX,u,uAtt)
      set dat.notDamage=CreateGroup()
      set dat.mx       =Speed*Cos(angle*3.14159/180)
      set dat.my       =Speed*Sin(angle*3.14159/180)
      set dat.dmg      =Damage(I2R(GetUnitAbilityLevel(u,SpellId)))
      
      if (ux!=tx or uy!=ty) then
        set bx=CreateUnit(Player(14),DummyId,ux,uy,0)
        call UnitAddAbility(bx,BuffSpellId)
        call IssueTargetOrder(bx,BuffOrder,u)
        call U2Null(bx,0.5)
        set bx=null
      endif
      
      call SetUnitVertexColor(u,255,50,50,75)
      call SetUnitPathing(u,false)
      call IssuePointOrder(u,RunOrder,tx,ty)

      call AddObjectToMotion(dat)
      
      call RemoveLocation(OrderPoint)
      set OrderPoint=null
      set u         =null
   endfunction

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

    set gg_trg_Bloody_Run = CreateTrigger(  )
    set MaxArea=bj_mapInitialPlayableArea
    loop
      call TriggerRegisterPlayerUnitEvent(gg_trg_Bloody_Run, 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_Bloody_Run, Condition( function Trig_Bloody_Run_Conditions ) )
    call TriggerAddAction( gg_trg_Bloody_Run, function Trig_Bloody_Run_Actions )
    
    //Preload
    call Preload(dmgGFX)
    call Preload(uGFX)
  endfunction
endscope
Старый 02.05.2009, 22:49
FellGuard
Losyash
offline
Опыт: 39,547
Активность:
Вот тут внизу есть мануал. Это надстройка над обычным джассом. Разбирайся.
Старый 02.05.2009, 22:57
Закрытая тема

Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск

Ваши права в разделе
Вы не можете создавать темы
Вы не можете отвечать на сообщения
Вы не можете прикреплять файлы
Вы можете скачивать файлы

BB-коды Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход



Часовой пояс GMT +3, время: 21:13.