// The Mana World script
// Author: Jesusalva <jesusalva@themanaworld.org>
//
// Magic Script: SKILL_JOYPLIM (Level 1)
// School: General 2
function script SK_Joyplim {
if (getarg(0, true))
delitem GingerBreadMan, 1;
.@b=(BL_PC | BL_PET | BL_MER | BL_HOM); // | BL_MOB
.@r=3+cap_value(getskilllv(SKILL_MAGIC)+(@skillLv/2), 1, 12); // Your radius
.@s=AdjustSpellpower(100); // Your magical stamina
.@c=cap_value(11-@skillLv, 1, 10)*2; // MATK stamina cost per char
.@e=(getskilllv(SKILL_MAGIC_DARK) ? E_EVIL : E_HAPPY); // Emote
getmapxy(.@m$, .@x, .@y, 0);
// TODO: Maybe put this loop in a timer, etc? But... Do we want to?
.@c=getunits(.@b, .@mbs, false, .@m$, .@x-.@r, .@y-.@r, .@x+.@r, .@y+.@r);
for (.@i = 0; .@i < .@c; .@i++) {
unitemote(.@mbs[.@i], E_HAPPY);
// Stamina cost
.@s-=.@c;
if (.@s < 0)
break;
}
specialeffect(FX_MAGIC_JOY_CAST, AREA, getcharid(3));
GetManaExp(@skillId, 2);
return;
}