summaryrefslogtreecommitdiff
path: root/npc/magic/parum.txt
blob: d91dbd1b49177f8e15a8c41c48a2d9146c62a04e (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// TMW2 script
// Author: Jesusalva <admin@tmw2.org>
//
// Magic Script: TMW2_PARUM
//
// Attempts to transmutate Raw Logs.
// May create arrows, Mouboo Figurines, Warped Logs.
// With enough ManaExp may create WoodenLog.
// Is not powerful enough to create overly complex stuff like Wooden Sword, Wooden Shield or Wooden Bow
// Final item is random
// TODO: Using too much transmutation magic may have dire consequences! Like, uh, transmutating your head!
// Nah, it is probably just propaganda... I hope. ¬.¬

-	script	sk#parum	32767,{
    end;

/*
OnFriendlyDeath:
    emote 4;
    end;
*/

OnCall:
    // Other requeriments
    if (countitem(RawLog) < 1) {
        dispbottom l("You need @@ to cast this skill.", getitemlink(RawLog));
        end;
    }

    // Check cooldown
    if (@parum_at > gettimetick(2)) {
        dispbottom l("Skill is in cooldown for @@.", FuzzyTime(@parum_at));
        end;
    }

    // Check requisites
    if (!MagicCheck(TMW2_PARUM, 50))
        end;

    // Consume items
    delitem RawLog, 1;

    // Create the stuff based on MAGIC_EXP
    .@r=rand(1,41);
    // Each 2 mexp reduces chance to get a fail
    if (.@r < 42-(MAGIC_EXP/2)) {
        getitem WarpedLog, 1;
    } else {
        // Proeficiency makes more likely to finish it
        if (.@r > 30-abizit())
            getitem MoubooFigurine, 1;
        else if (.@r > 20-abizit() && MAGIC_EXP > 82)
            getitem WoodenLog, 1;
        else
            getitem Arrow, .@r;
    }
    // I know, the code is not very sane. A number from 0 to 40 is cast.
    // You will get lots of useless Warped Logs until you have 82 MExp.
    // If you do not get a Warped Log, you have 25% chances of getting the
    // Mouboo figurine. The other will be arrows, unless you hit the 82 MExp value
    // which will add 25% chances to get a Wooden Log too. These values are estimate.

    // set cooldown
    @parum_at=gettimetick(2);
    @parum_at=@parum_at+4;

    // Get a few mana experience points (this is NOT used by Mana Stone)
    GetManaExp(TMW2_PARUM, rand(1,3));
    end;

OnInit:
    bindatcmd "sk-parum", "sk#parum::OnCall", 0, 100, 0;
    end;
}