summaryrefslogtreecommitdiff
path: root/npc/config/magic.txt
blob: 1617bfeff8670228de198aa47bdc646175f17187 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// 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, MobPerSkillLevel=2}
function	script	SummonMagic	{
    .@sk=getarg(0);
    .@mp=getarg(1);
    .@id=getarg(2);
    .@adj=getarg(4,2);

    if (.@adj < 1) {
        debugmes "\033[31mInvalid MobPerSkillLevel for SummonMagic (.@adj): "+.@adj+"\033[0m";
        dispbottom l("Invalid parameter specified, blame saulc.");
        end;
    }

    // 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)+(.@adj-1))/.@adj; .@i++)
    	summon("Summoned Monster", .@id, rand(35000,50000)+getskilllv(.@sk)*10000);
    dispbottom l("All monsters summoned!");

}