summaryrefslogtreecommitdiff
path: root/npc/magic/dragokin.txt
blob: cfcc2ef440be913dd67ac3604ef9089c91cc1074 (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
// TMW2 script
// Author: Jesusalva <admin@tmw2.org>
//
// Magic Script: TMW2_DRAGOKIN
//
// Summons a Green Dragon because they are cool :3
//
// Cooldown is cast duration

-	script	sk#dragokin	32767,{
    end;

OnCall:
    // Other requeriments: 5x Dragon Scale or Demure Axe
    if (!(countitem(DragonScales) >= 4 || countitem(DemureAxe))) {
        dispbottom l("You need 4x @@ to cast this skill.", getitemlink(DragonScales));
        end;
    }

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

    // Setup
    @sk=TMW2_DRAGOKIN;
    @mp=50;
    @amp=4;

    // Check if you have mana to cast
    // MagicCheck(SkillID, Mana{, MP per level})
    if (!MagicCheck(@sk, @mp, @amp))
        end;

    // Destroy reagents
    if (!countitem(DemureAxe))
        delitem DragonScale, 4;

    // set cooldown
    @dragokin_at=gettimetick(2);
    @dragokin_at=@dragokin_at+16;

    // As usual, magic profeciency affects
    if (rand(1,6) < abizit()+1) {
        // Summon Magic
        // SummonMagic(SkillID, MobID{, SkillLevelPerMob=2{, Level Override}})
        SummonMagic(@sk, GreenDragon, 5, MAGIC_LVL+getskilllv(@sk)-1);
    } else {
        dispbottom l("The spell fails!");
    }

    // Get five mana experience point (this is NOT used by Mana Stone)
    GetManaExp(@sk, 5);

    end;

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