스킬)사슬벼락
@사슬벼락 {
set @sd, mysd();
set @id, myid();
set @target_id, script_target(@sd); // 타겟
set @time, 10;
set @count, 0;
if(get_mp(@sd) < 10000)
{
message @sd, 3, "마력이 부족합니다.";
end;
}
/* 거리 조절 */
set @user_x, get_x(@id);
set @user_y, get_y(@id);
set @target_x, get_x(@target_id);
set @target_y, get_y(@target_id);
set @gap_x, @user_x - @target_x; // 내 위치와 거리 계산
set @gap_y, @user_y - @target_y;
if(@gap_x < 0){ set @gap_x, @gap_x * (-1); } // 거리 차가 음수일경우 양수로 변경
if(@gap_y < 0){ set @gap_y, @gap_y * (-1); }
if(@gap_x > 8 || @gap_y > 8)
{
message @sd, 3, "마력이 미치지 않습니다.";
end;
}
/* 거리 조절 끝*/
set @x, get_x(@target_id);
set @y, get_y(@target_id);
setarray @target_x[0], @x+1, @x , @x-1, @x;
setarray @target_y[0], @y , @y+1, @y , @y-1;
for(set @loop, 0; @loop < getarraysize(@target_x); set @loop, @loop+1) // 주변에 몹이 있는지 체크
{
set @target_mid, obj_getxy(@target_x[@loop], @target_y[@loop]);
if(@target_mid > 0)
{
if(istype(@target_mid) == 2) { set @count, @count + 1; } // 주변 "몹" 체크용
}
}
if(@count == 0){ set @time, 1; } // 주변에 몹 없으면 0초
if(istype(@target_id) == 1)
{
message @sd, 3, "걸리지 않습니다.";
end;
}
else if(istype(@target_id) == 2)
{
sound @target_id, 59;
effect @target_id, 123;
set_mp @sd, get_mp(@sd)-100;
mobspellaether @target_id, name2spellid("사슬벼락"), @time;
set_mp @sd, 0;
spelldelay @sd, name2spellid("사슬벼락"), 200;
message @sd, 3, "사슬벼락을 외웠습니다.";
}
deletearray @target_x[0], getarraysize(@target_x);
deletearray @target_y[0], getarraysize(@target_y);
}
@사슬벼락지속 {
set @target_id, objid();
set @x, get_x(@target_id);
set @y, get_y(@target_id);
setarray @target_x[0], @x+1, @x , @x-1, @x;
setarray @target_y[0], @y , @y+1, @y , @y-1;
if(istype(@target_id) == 2)
{
effect @target_id, 150;
set @minhp, (get_mobmaxhp(@target_id)*10)/100; //최소 몹의 체력
set @check, get_mobhp(@target_id)-((get_mobmaxhp(@target_id)*20)/100); // 체크
for(set @loop, 0; @loop < getarraysize(@target_x); set @loop, @loop+1) // 주변몹도 걸어주기
{
set @target_mid, obj_getxy(@target_x[@loop], @target_y[@loop]);
if(@target_mid > 0)
{
if(istype(@target_mid) == 2) // 몹이면
{
if(mobspellaethered(@target_mid, name2spellid("사슬벼락")) == 0)
{
effect @target_mid, 123;
mobspellaether @target_mid, name2spellid("사슬벼락"), 10;
}
}
}
}
if(@minhp < @check) { set_mobhp @target_id, @check; }
else { set_mobhp @target_id, get_mobhp(@target_id); }
}
deletearray @target_x[0], getarraysize(@target_x);
deletearray @target_y[0], getarraysize(@target_y);
}

달퐁 님의 최근 댓글
ㄳㄳ 2018 07.17 ㅋ 2018 07.15 ㄳㄳ 2018 07.12