// The Mana World script
// Author: Jesusalva <jesusalva@themanaworld.org>
//
// Magic Script: MULTIPLE (Level 1)
// School: Transmutation *
function script SK_Transmute {
// Setup
switch (@skillId) {
case SKILL_PARUM:
.@prize = MoubooFigurine; .@pc = 1;
.@mexp = 1; .@fx = FX_MAGIC_WOOD_CAST;
setarray .@component, RawLog;
setarray .@co_amount, 1;
setarray .@failure, Iten, WarpedLog, WarpedLog;
break;
case SKILL_KULARZUFRILL:
.@prize = Arrow; .@pc = AdjustSpellpower(40+@skillLv*2);
.@mexp = 2; .@fx = FX_MAGIC_ARROW_CAST;
setarray .@component, RawLog;
setarray .@co_amount, 1;
setarray .@failure, WarpedLog, WarpedLog;
break;
case SKILL_ZUKMINBIRF:
.@prize = IronPowder; .@pc = 1+AdjustSpellpower(@skillLv*5);
.@mexp = 2; .@fx = FX_MAGIC_IRON_CAST;
setarray .@component, IronOre;
setarray .@co_amount, 1;
setarray .@failure, Iten, IronOre, IronOre;
break;
case SKILL_PATMUPLOO:
.@prize = CottonShirt; .@pc = 1;
.@mexp = 2; .@fx = FX_MAGIC_SHIRT_CAST;
setarray .@component, CottonCloth;
setarray .@co_amount, 5;
setarray .@failure, CottonCloth, CottonCloth;
break;
case SKILL_PATVILOREE:
.@prize = ShortTankTop; .@pc = 1;
.@mexp = 2; .@fx = FX_MAGIC_SHIRT_CAST;
setarray .@component, CottonCloth;
setarray .@co_amount, 3;
setarray .@failure, CottonCloth, CottonCloth;
break;
case SKILL_PATLOREE:
.@prize = TankTop; .@pc = 1;
.@mexp = 2; .@fx = FX_MAGIC_SHIRT_CAST;
setarray .@component, CottonCloth;
setarray .@co_amount, 4;
setarray .@failure, CottonCloth, CottonCloth;
break;
case SKILL_GOLE:
.@prize = SulphurPowder; .@pc = 1+AdjustSpellpower(@skillLv*20);
.@mexp = 1; .@fx = FX_MAGIC_SULPHUR_CAST;
setarray .@component, PileOfAsh;
setarray .@co_amount, 1;
setarray .@failure, PileOfAsh, PileOfAsh;
break;
case SKILL_MANPAHIL:
.@prize = Lifestone; .@pc = 10;
.@mexp = 2; .@fx = FX_MAGIC_STONE_CAST;
setarray .@component, BugLeg, MaggotSlime, MauveHerb, AlizarinHerb, CobaltHerb, GambogeHerb;
setarray .@co_amount, 1, 1, 1, 1, 1, 1;
setarray .@failure, Lifestone, Lifestone;
break;
default: return;
}
// Check for items
for (.@i=0; .@i < getarraysize(.@component); .@i++) {
if (countitem(.@component[.@i]) < .@co_amount[.@i]) {
dispbottom l("You do not have enough %s (min %d)",
getitemname(.@component[.@i]), .@co_amount[.@i]);
return;
}
}
// Delete reagents
inventoryplace Iten, 1, .@prize, .@pc;
for (.@i=0; .@i < getarraysize(.@component); .@i++) {
delitem(.@component[.@i], .@co_amount[.@i]);
}
// Effect and EXP
specialeffect(.@fx, AREA, getcharid(3));
GetManaExp(@skillId, .@mexp);
// The chances of success are based on magic exp, abizit and skill level
.@rand100 = abizit()*10 + cap_value(MAGIC_EXP/100, 0, 50) + (@skillLv*5);
if (.@rand100 > rand2(100)) {
getitem .@prize, .@pc;
} else {
dispbottom l("Your magic takes a mind of its own!");
getitem any_of(.@failure), 1;
}
return;
}