// The Mana World script
// Author: Jesusalva <jesusalva@themanaworld.org>
//
// Magic Script: SKILL_CHIPCHIP (Level 1)
// School: Nature 2
function script SK_Shear {
.@mobGD=getarg(0, @skillTarget);
if (.@mobGD <= 0)
return;
// We only want monsters
if (getunittype(.@mobGD) != UNITTYPE_MOB) {
dispbottom l("This skill can only be used on monsters!");
return;
}
// Global data
setarray .@valid, Fluffy, EasterFluffy, SpikyMushroom, Mouboo, MauvePlant, CobaltPlant, GambogePlant, AlizarinPlant, Silkworm, Pinkie;
setarray .@prize, WhiteFur, WhiteFur, HardSpike, CottonCloth, MauveHerb, CoblatHerb, GambogeHerb, AlizarinHerb, SilkCocoon, PinkAntenna;
setarray .@score, 300, 300, 250, 175, 700, 700, 700, 700, 300, 180;
// Specific data
.@mobID=getunitdata(.@mobGD, UDT_CLASS);
.@matk=AdjustSpellpower(40+(10*@skillLv));
.@idx=array_find(.@valid, .@mobID);
// Invalid target
if (.@idx < 0) return;
// Not yet sheared
if (array_rfind(@shear, .@mobGD) < 0) {
array_push(@shear, @mobGD);
if (.@matk > .@score[.@idx])
getitem .@prize[.@idx], 1;
}
// Sagratha bonus
if (.@mobId == Fluffy || .@mobId == Mouboo || .@mobId == Pinkie)
QuestSagathaHappy(any(true, true, false));
// Special effect
specialeffect(FX_MAGIC_SHEAR_CAST, AREA, getcharid(3));
specialeffect(FX_MAGIC_SHEAR_CAST, AREA, .@mobGD);
// Truncate.
// We're saving the GID so it must be "big enough"
// But not too big so rfind() is not expensive
if (getarraysize(@study) > 99) {
deletearray(@study, 30);
}
return;
}