//! zinc
//! zinc
library HellIcePlugin{
constant real PERIOD = .031250000;
constant timer MainTimer = CreateTimer();
constant group GROUP = CreateGroup();
integer StrucData[];
integer MUI = 0;
//
public struct HIP{
unit c;
unit caster;
unit dum = null;
real dmg;
real scale;
real radius;
real scaleintevar;
real height;
real minscale;
real scl = 0.;
real minh = 0.;
attacktype att;
damagetype dam;
weapontype wea;
integer fl;
string effectice;
string bl;
string at;
string dis;
boolean b = false;
static method allies(unit u,unit f) -> boolean{
//
return IsUnitEnemy(f,GetOwningPlayer(u)) && !(IsUnitType(u,UNIT_TYPE_DEAD) || GetUnitTypeId(u) == 0);
//
}
static method onPeriodic(){
thistype this;
integer i;
unit f;
//
for(0 < i <= MUI){
this = StrucData[i];
if(scl <= scale && !b){
scl = scl + scaleintevar;
minh = minh + height;
//
b = (scl >= minscale);
}
else{
scl = scl - scaleintevar;
minh = minh - height;
//
if(minh <= 0.){
StrucData[i] = StrucData[MUI];
StrucData[MUI] = -1;
MUI = MUI - 1;
if(MUI == 0)
PauseTimer(MainTimer);
if(dum != null && GetUnitFlyHeight(dum) <= GetUnitDefaultFlyHeight(dum)+50)
{
UnitDamageTarget(caster,dum,dmg,true,false,att,dam,wea);
DestroyEffect(AddSpecialEffect(effectice,GetWidgetX(dum),GetWidgetY(dum)));
SetUnitFlyHeight(dum,GetUnitDefaultFlyHeight(dum),0.);
}
DestroyEffect(AddSpecialEffect(dis,GetWidgetX(c),GetWidgetY(c)));
RemoveUnit(c);
att = null;
dam = null;
wea = null;
c = null;
destroy();
}
}
//
SetUnitScale(c,scl,0.,0.);
//
if(IsUnitType(dum,UNIT_TYPE_DEAD) || GetUnitTypeId(dum) == 0){
SetUnitFlyHeight(dum,GetUnitDefaultFlyHeight(dum),0.);
dum = null;
}
else
SetUnitFlyHeight(dum,minh,0.);
//
GroupEnumUnitsInRange(GROUP,GetWidgetX(c),GetWidgetY(c),radius,null);
//
if(dum == null){
while(FirstOfGroup(GROUP) != null){
f = FirstOfGroup(GROUP);
if(allies(caster,f))
if(GetUnitFlyHeight(f) < minh){
if(UnitAddAbility(f,fl))
UnitRemoveAbility(f,fl);
dum = f;
UnitDamageTarget(caster,dum,dmg/2,true,false,att,dam,wea);
DestroyEffect(AddSpecialEffectTarget(bl,dum,at));
break;
}
GroupRemoveUnit(GROUP,f);
}
}
}
}
static method add(unit s,unit u,real d,real maxscale,real sclintevar,real hitradius,real h,string eff,string blood,string attach,string disa,attacktype a,damagetype dd,weapontype w,integer fly){
thistype this = allocate();
//
MUI = MUI + 1;
StrucData[MUI] = this;
//
if(MUI == 1){
TimerStart(MainTimer,PERIOD,true,function thistype.onPeriodic);
}
//
c = u;
dis = disa;
caster = s;
dmg = d;
effectice = eff;
height = h;
scale = maxscale;
scaleintevar = sclintevar;
minscale = scale - scaleintevar;
radius = hitradius;
fl = fly;
at = attach;
bl = blood;
att = a;
dam = dd;
w = wea;
//
}
}
}
//! endzinc