第一个Zinc技能 有点小激动
[jass]
//! zinc
library Shuiren requires TimerUtils{
constant integer INT_DS = 40; //距离
constant integer TIME = 90; //时间
constant integer SPELL_ID = 'A000' ; //技能ID
constant string EFFECT_STRING = "Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl" ;
private struct Bolang
{
unit Hero;
timer t;
real x,y,dx,dy;
integer i;
method destroy() {
ReleaseTimer(this.t);
this.t = null;
this.Hero = null;
this.deallocate();
}
private static method Timer() {
real x,y,Ds;
Bolang data = Bolang(GetTimerData(GetExpiredTimer()));
x = GetUnitX(data.Hero)+data.x;
y = GetUnitY(data.Hero)+data.y;
Ds = SquareRoot((data.dx-GetUnitX(data.Hero))*(data.dx-GetUnitX(data.Hero))+(data.dy-GetUnitY(data.Hero))*(data.y-GetUnitY(data.Hero)));
SetUnitX(data.Hero,x);
SetUnitY(data.Hero,y);
DestroyEffect(AddSpecialEffect(EFFECT_STRING,x,y));
data.i -= 1;
if(data.i<0||Ds<=20){
SetUnitVertexColor( data.Hero, 255, 255, 255,255 );
data.destroy();
}
}
private static method create(unit u,real x,real y ) -> Bolang {
Bolang data = Bolang.allocate();
real angle = Atan2(y-GetUnitY(u),x-GetUnitX(u));
data.x = INT_DS*Cos(angle);
data.y = INT_DS*Sin(angle);
data.dx = x;
data.dy = y;
data.Hero = u;
data.t = NewTimer();
data.i = TIME;
SetTimerData(data.t,integer(data));
SetUnitVertexColor( u, 255, 255, 255,0 );
TimerStart(data.t,0.02,true,function Bolang.Timer );
return data;
}
private static method Start() -> boolean {
if (GetSpellAbilityId() == SPELL_ID) {
Bolang.create(GetTriggerUnit(),GetSpellTargetX(),GetSpellTargetY());
}
return false;
}
private static method onInit(){
trigger t = CreateTrigger();
TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT);
TriggerAddCondition(t, Condition(function Bolang.Start));
t = null;
}
}
}
//! endzinc
[/jass]
[通魔作坊]仿dota技能 - 波浪形态.w3x
(187 KB, 下载次数: 101)
|