Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //! zinc
- library Water requires GroupUtils,UnitLibrary,TerrainPathability,UnitData{
- private{
- constant integer MURLOC_BUILDER_ABIL_ID = 'A0K1';
- constant integer MURLOC_BUILDER_BUFF_ID = 'B04B';
- constant integer MURLOC_BUILDER_BASE_ID = 'A003'; //Panic
- constant real PERIOD = 0.10;
- }
- function onFilter()->boolean{
- return GetUnitTypeId(GetFilterUnit())==MURLOC_BUILDER;//Add more to filter for water based passives
- }
- function onTimer()->boolean{
- unit u=null;
- group g=NewGroup();
- boolexpr b=Filter(function onFilter);
- GroupEnumUnitsInArea(g,0.0,0.0,10000,b);
- DestroyBoolExpr(b);
- if (CountUnitsInGroup(g)>0){
- u=FirstOfGroup(g);
- while (u!=null){
- if (IsTerrainShallowWater(Unit[u].x,Unit[u].y)){
- if (Unit[u].id==MURLOC_BUILDER){
- if (Unit[u].getAbilityLevel(MURLOC_BUILDER_ABIL_ID)==0){
- Unit[u].addAbility(MURLOC_BUILDER_ABIL_ID);
- Unit[u].hideAbility(MURLOC_BUILDER_ABIL_ID,true);
- Unit[u].setAbilityLevel(MURLOC_BUILDER_BASE_ID,2);
- }
- }
- }else{
- if (Unit[u].id==MURLOC_BUILDER){
- if (Unit[u].getAbilityLevel(ABIL_ID)>0){
- Unit[u].removeAbility(MURLOC_BUILDER_ABIL_ID);
- Unit[u].removeBuff(MURLOC_BUILDER_BUFF_ID);
- Unit[u].setAbilityLevel(MURLOC_BUILDER_BASE_ID,1);
- }
- }
- }
- GroupRemoveUnit(g,u);
- u=FirstOfGroup(g);
- }
- }
- ReleaseGroup(g);
- u=null;
- g=null;
- b=null;
- return false;
- }
- function onInit(){
- trigger t=CreateTrigger();
- TriggerRegisterTimerEventPeriodic(t,PERIOD);
- TriggerAddCondition(t,Filter(function onTimer));
- t=null;
- }
- }
- //! endzinc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement