summaryrefslogblamecommitdiff
path: root/npc/magic/level2-rain.txt
blob: c008ae3a2b44730487b42d73d1dd915859d52908 (plain) (tree)


























                                                                              
                                                               

                                 

                                                                            


















                                                                              
// 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 (11 ATK = 1s)
    .@PW=80+(20*@skillLv);
    .@dmg=AdjustSpellpower(.@PW);
    .@time=.@dmg/11;
    //debugmes "KAFLOSH: Damage %d Time %d Climate %d", .@dmg, .@time, .@cl;
    .@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;
}