summaryrefslogblamecommitdiff
path: root/npc/config/magic.txt
blob: 9ad6d0b9a0aa06e01baa691fe8c30c32e26ce934 (plain) (tree)



































                                                                            



                                                                                                
                                           

 
// TMW2 script
// Author: Jesusalva <admin@tmw2.org>
//
// Magic Script Core Functions
// 
// Used for our pseudo-magic.
// These are only helpers, you can add more restrictions and effects freely.

// SkillID, Mana, MobID{, MP per level, Script}
function	script	SummonMagic	{
    .@sk=getarg(0);
    .@mp=getarg(1);
    .@id=getarg(2);
    .@scr$=getarg(4,"Cassia::OnSkip");

    // PRE EXECUTION
    // Check Skill
    if (getskilllv(.@sk) < 1)
        end;

    // Load mana cost
    .@amp=getarg(3,0);
    .@mp=.@mp+getskilllv(.@sk)*.@amp-.@amp;

    // Check mana
    if (readparam(Sp) < .@mp) {
        dispbottom l("Insufficient mana: @@/@@.", readparam(Sp), .@mp);
        end;
    }


    // EXECUTION
    // Apply costs
    heal 0, 0-.@mp;

    // Cause effect
    // Summoned monsters live from 45 to 60 seconds, and each skill levels grants 10s extra life
    // The 35~50 is not a defect, remember skill starts at level 1...
    for (.@i = 0; .@i < (getskilllv(.@sk)+1)/2; .@i++)
    	summon("Summoned Monster", .@id, rand(35000,50000)+getskilllv(.@sk)*10000);
    dispbottom l("All monsters summoned!");

}