找回密码
 点一下
查看: 1177|回复: 2

[vJass]技能的书写格式正确麽?

[复制链接]
发表于 2015-2-6 19:03:15 | 显示全部楼层 |阅读模式
本帖最后由 RoyalFlare 于 2015-2-6 19:10 编辑

  1. scope KiritoAOE initializer KiritoAOE__init

  2. globals
  3. private constant real KiritoAOE__DISTANCE=18
  4. private constant real KiritoAOE__RADIUS=400
  5. private constant integer KiritoAOE__SPELLID='A012'
  6. private constant integer KiritoAOE__OODAMABALL='h0C9'
  7. private constant integer KiritoAOE__ICENOVA='h0A5'
  8. private constant integer KiritoAOE__ICENOVA1='h0A7'
  9. private constant integer KiritoAOE__EFFECTID='A0EC'
  10. private constant integer KiritoAOE__EFFECTID1='A0EB'
  11. private constant integer si__KiritoAOE__data=48
  12. private integer si__KiritoAOE__data_F=0
  13. private integer si__KiritoAOE__data_I=0
  14. private integer array si__KiritoAOE__data_V
  15. private unit array s__KiritoAOE__data_c
  16. private real array s__KiritoAOE__data_targetx
  17. private real array s__KiritoAOE__data_targety
  18. endglobals

  19. private function s__KiritoAOE__data__allocate takes nothing returns integer
  20.     local integer this=si__KiritoAOE__data_F
  21.     if(this!=0)then
  22.         set si__KiritoAOE__data_F=si__KiritoAOE__data_V[this]
  23.     else
  24.         set si__KiritoAOE__data_I=si__KiritoAOE__data_I+1
  25.         set this=si__KiritoAOE__data_I
  26.     endif
  27.     if(this>8190)then
  28.         call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,1000.,"Unable to allocate id for an object of type: KiritoAOE__data")
  29.         return 0
  30.     endif
  31.     set si__KiritoAOE__data_V[this]=-1
  32.     return this
  33. endfunction

  34. private function s__KiritoAOE__data_deallocate takes integer this returns nothing
  35.     if this==null then
  36.         call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,1000.,"Attempt to destroy a null struct of type: KiritoAOE__data")
  37.         return
  38.     elseif(si__KiritoAOE__data_V[this]!=-1)then
  39.         call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,1000.,"Double free of type: KiritoAOE__data")
  40.         return
  41.     endif
  42.     set si__KiritoAOE__data_V[this]=si__KiritoAOE__data_F
  43.     set si__KiritoAOE__data_F=this
  44. endfunction

  45. private function s__KiritoAOE__data_destroy takes integer this returns nothing
  46.     call UnitRemoveAbility(s__KiritoAOE__data_c[this],KiritoAOE__EFFECTID)
  47.     call UnitRemoveAbility(s__KiritoAOE__data_c[this],KiritoAOE__EFFECTID1)
  48.     call s__KiritoAOE__data_deallocate(this)
  49. endfunction

  50. private function s__KiritoAOE__data_Boolean takes nothing returns boolean
  51.     return true
  52. endfunction
  53. private function s__KiritoAOE__data_FinalTimer takes nothing returns nothing
  54. local timer z=GetExpiredTimer()
  55. local integer this=(LoadInteger(TimerUtils___ht,0,GetHandleId((z))))
  56. local group g
  57. local unit v
  58. local real a
  59. local real r=(GetUnitAbilityLevel(s__KiritoAOE__data_c[this],KiritoAOE__SPELLID)*100)
  60. call PauseUnit(s__KiritoAOE__data_c[this],false)
  61. call SetUnitInvulnerable(s__KiritoAOE__data_c[this],false)
  62. call SetUnitPathing(s__KiritoAOE__data_c[this],true)
  63. call SetUnitTimeScale(s__KiritoAOE__data_c[this],1)
  64. call DustWave(0.4,0.12,1.0,20,s__KiritoAOE__data_targetx[this],s__KiritoAOE__data_targety[this],155,255,255,30)
  65. set g=NewGroup()
  66. call GroupEnumUnitsInRange(g,s__KiritoAOE__data_targetx[this],s__KiritoAOE__data_targety[this],KiritoAOE__RADIUS,Filter(function s__KiritoAOE__data_Boolean))
  67. loop
  68.     set v=FirstOfGroup(g)
  69.     exitwhen v==null
  70.     if FilterGeneral(s__KiritoAOE__data_c[this],v)then
  71.         set a=Angle(s__KiritoAOE__data_targetx[this],s__KiritoAOE__data_targety[this],GetUnitX(v),GetUnitY(v))
  72.         call DamageTarget(s__KiritoAOE__data_c[this],v,r,TAIJUTSU_DAMAGE)
  73.         call SlideUnitAngle(v,0,0,a,"")
  74.         call SetUnitAnimation(v,"death")
  75.     endif
  76.     call GroupRemoveUnit(g,v)
  77. endloop
  78. call ReleaseGroup(g)
  79. call SetUnitAnimation(s__KiritoAOE__data_c[this],"attack")
  80. call EffectUnitColor(s__KiritoAOE__data_c[this],s__KiritoAOE__data_targetx[this],s__KiritoAOE__data_targety[this],GetUnitFacing(s__KiritoAOE__data_c[this]),3,KiritoAOE__OODAMABALL,1,255,255,255,255)
  81. call EffectUnitColor(s__KiritoAOE__data_c[this],s__KiritoAOE__data_targetx[this],s__KiritoAOE__data_targety[this],GetUnitFacing(s__KiritoAOE__data_c[this]),2,KiritoAOE__ICENOVA,1,255,255,255,255)
  82. call EffectUnitColor(s__KiritoAOE__data_c[this],s__KiritoAOE__data_targetx[this],s__KiritoAOE__data_targety[this],GetUnitFacing(s__KiritoAOE__data_c[this]),3,KiritoAOE__ICENOVA1,1,255,255,255,255)
  83. call ReleaseTimer(z)
  84. call s__KiritoAOE__data_destroy(this)
  85. endfunction

  86. private function s__KiritoAOE__data_TimerExpired takes nothing returns nothing
  87. local timer z=GetExpiredTimer()
  88. local integer this=(LoadInteger(TimerUtils___ht,0,GetHandleId((z))))
  89. local real a=Angle(GetUnitX(s__KiritoAOE__data_c[this]),GetUnitY(s__KiritoAOE__data_c[this]),s__KiritoAOE__data_targetx[this],s__KiritoAOE__data_targety[this])
  90. local real x=(((GetUnitX(s__KiritoAOE__data_c[this]))*1.0)+((KiritoAOE__DISTANCE)*1.0)*Cos(((a)*1.0)*bj_DEGTORAD))
  91. local real y=(((GetUnitY(s__KiritoAOE__data_c[this]))*1.0)+((KiritoAOE__DISTANCE)*1.0)*Sin(((a)*1.0)*bj_DEGTORAD))
  92. local real r=50
  93. if IsTerrainPathable(x,y,PATHING_TYPE_FLYABILITY)==false then
  94.     call SetUnitPosition(s__KiritoAOE__data_c[this],x,y)
  95. else
  96.     call SetUnitAnimation(s__KiritoAOE__data_c[this],"attack")
  97.     call TimerStart(z,0.1,false,function s__KiritoAOE__data_FinalTimer)
  98. endif
  99. if Distance(x,y,s__KiritoAOE__data_targetx[this],s__KiritoAOE__data_targety[this])<=100 then
  100.     call SetUnitAnimation(s__KiritoAOE__data_c[this],"attack")
  101.     call TimerStart(z,0.1,false,function s__KiritoAOE__data_FinalTimer)
  102. endif
  103. endfunction

  104. private function s__KiritoAOE__data_create takes unit caster,real x,real y returns integer
  105. local timer z=(NewTimerEx(0))
  106. local integer this=s__KiritoAOE__data__allocate()
  107. set s__KiritoAOE__data_c[this]=caster
  108. set s__KiritoAOE__data_targetx[this]=x
  109. set s__KiritoAOE__data_targety[this]=y
  110. call PauseUnit(s__KiritoAOE__data_c[this],true)
  111. call SetUnitInvulnerable(s__KiritoAOE__data_c[this],true)
  112. call SetUnitPathing(s__KiritoAOE__data_c[this],false)
  113. call SetUnitAnimationByIndex(s__KiritoAOE__data_c[this],1)
  114. call SaveInteger(TimerUtils___ht,0,GetHandleId((z)),(this))
  115. call SetUnitAnimation(s__KiritoAOE__data_c[this],"attack")
  116. call SetUnitTimeScale(s__KiritoAOE__data_c[this],0)
  117. call UnitAddAbility(s__KiritoAOE__data_c[this],KiritoAOE__EFFECTID)
  118. call UnitAddAbility(s__KiritoAOE__data_c[this],KiritoAOE__EFFECTID1)
  119. call SoundStart("war3mapImported\\KiritoWhak2.mp3",GetUnitX(s__KiritoAOE__data_c[this]),GetUnitY(s__KiritoAOE__data_c[this]))
  120. call TimerStart(z,0.02,true,function s__KiritoAOE__data_TimerExpired)
  121. return this
  122. endfunction

  123. private function KiritoAOE__Conditions takes nothing returns boolean
  124. return GetSpellAbilityId()==KiritoAOE__SPELLID
  125. endfunction

  126. private function KiritoAOE__Actions takes nothing returns nothing
  127. call s__KiritoAOE__data_create(GetTriggerUnit(),GetSpellTargetX(),GetSpellTargetY())
  128. endfunction

  129. private function KiritoAOE__init takes nothing returns nothing
  130.     local trigger t=CreateTrigger()
  131.     local integer index=0
  132.     loop
  133.         call TriggerRegisterPlayerUnitEvent(t,Player(index),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
  134.         set index=index+1
  135.         exitwhen index==bj_MAX_PLAYER_SLOTS
  136.     endloop
  137.     call TriggerAddCondition(t,Condition(function KiritoAOE__Conditions))
  138.     call TriggerAddAction(t,function KiritoAOE__Actions)
  139.     set t=null
  140. endfunction

  141. endscope
复制代码

最近参考老外的地图学习vJass中 按照论坛里的示例格式书写1个冲锋移动范围伤害技能 求大神帮忙看下是否有书写错误的地方 身边的电脑暂时无法测试 自己用EverEdit和NotePad Plus手打的 不知道能否通过JassHelper的语法检查 先谢过了

@ck5524210 @希瓦 @chyj4747 @zhuzeitou @actboy168
 楼主| 发表于 2015-2-6 19:12:12 | 显示全部楼层
http://home.feifeishijie.com/thread-378477-1-1.html
这样的帖子发在飞飞世界都没人看的 唉,看来还是发到GA比较好
话说静态和非静态Struct的使用方法还是不太明白 GA论坛怎麽都没有这方面的教程和演示呢?
回复

使用道具 举报

发表于 2015-2-6 21:57:35 | 显示全部楼层
不会的路过(不过支持下。。。)
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-12-22 15:54 , Processed in 0.205491 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表