summaryrefslogtreecommitdiff
path: root/npc/magic/level2-rain.txt
blob: c2b9a29ab6bf1d189af3c93e407c56dee01323e3 (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
// The Mana World script
// Author: Jesusalva <jesusalva@themanaworld.org>
//
// Magic Script: SKILL_KAFLOSH (Level 1)
// School: Nature 2

function	script	SK_Kaflosh	{
    .@m$=getmap();
    .@cl="#WeatherCore"::climate(.@m$);

    // Bad Climate
    if (.@cl == CLIMATE_NONE) {
        dispbottom l("It was impossible to conjure rain clouds on this map.");
        return;
    }

    // Techinically not needed
    .@rain="#WeatherCore"::weather(MASK_RAIN);
    if (.@rain) {
        dispbottom l("It is already raining!");
        return;
    }

    // From now on, you'll have the cost paid and the MEXP deposited
    delitem BottleOfWater, 1;
    GetManaExp(@skillId, 2);

    // Adjusted MATK will determine rain duration (15 ATK = 1s)
    .@PW=80+(20*@skillLv);
    .@dmg=AdjustSpellpower(.@PW);
    .@time=.@dmg/15;
    .@time+=getskilllv(SKILL_MAGIC_NATURE)-2; // +1 second per nature magic lv

    // Adverse climate (eg. desert and icelands) will cut this to 1/3
    if (.@cl != CLIMATE_MODERATE)
        .@time=.@time/3;

    // Rain must last at least 5 seconds or the clouds won't even gather
    if (.@time < 5) {
        dispbottom l("You do not have suffice magic power to make rain.");
        return;
    }

    // Invoke the rain clouds; Everything else should work out of the box
    // The builtin checks are not necessary in this case =D
    // But would be for a sandstorm or snowstorm.
    "#WeatherCore"::weather_override(MASK_RAIN, .@time, .@m$, true);
    return;
}