Advertisement
Guest User

Untitled

a guest
Dec 13th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. //! zinc
  2. library Water requires GroupUtils,UnitLibrary,TerrainPathability,UnitData{
  3.  
  4. private{
  5. constant integer MURLOC_BUILDER_ABIL_ID = 'A0K1';
  6. constant integer MURLOC_BUILDER_BUFF_ID = 'B04B';
  7. constant integer MURLOC_BUILDER_BASE_ID = 'A003'; //Panic
  8.  
  9. constant real PERIOD = 0.10;
  10. }
  11.  
  12. function onFilter()->boolean{
  13. return GetUnitTypeId(GetFilterUnit())==MURLOC_BUILDER;//Add more to filter for water based passives
  14. }
  15.  
  16. function onTimer()->boolean{
  17. unit u=null;
  18. group g=NewGroup();
  19. boolexpr b=Filter(function onFilter);
  20. GroupEnumUnitsInArea(g,0.0,0.0,10000,b);
  21. DestroyBoolExpr(b);
  22. if (CountUnitsInGroup(g)>0){
  23. u=FirstOfGroup(g);
  24. while (u!=null){
  25. if (IsTerrainShallowWater(Unit[u].x,Unit[u].y)){
  26. if (Unit[u].id==MURLOC_BUILDER){
  27. if (Unit[u].getAbilityLevel(MURLOC_BUILDER_ABIL_ID)==0){
  28. Unit[u].addAbility(MURLOC_BUILDER_ABIL_ID);
  29. Unit[u].hideAbility(MURLOC_BUILDER_ABIL_ID,true);
  30. Unit[u].setAbilityLevel(MURLOC_BUILDER_BASE_ID,2);
  31. }
  32. }
  33. }else{
  34. if (Unit[u].id==MURLOC_BUILDER){
  35. if (Unit[u].getAbilityLevel(ABIL_ID)>0){
  36. Unit[u].removeAbility(MURLOC_BUILDER_ABIL_ID);
  37. Unit[u].removeBuff(MURLOC_BUILDER_BUFF_ID);
  38. Unit[u].setAbilityLevel(MURLOC_BUILDER_BASE_ID,1);
  39. }
  40. }
  41. }
  42. GroupRemoveUnit(g,u);
  43. u=FirstOfGroup(g);
  44. }
  45. }
  46. ReleaseGroup(g);
  47. u=null;
  48. g=null;
  49. b=null;
  50. return false;
  51. }
  52.  
  53. function onInit(){
  54. trigger t=CreateTrigger();
  55. TriggerRegisterTimerEventPeriodic(t,PERIOD);
  56. TriggerAddCondition(t,Filter(function onTimer));
  57. t=null;
  58. }
  59. }
  60. //! endzinc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement