summaryrefslogblamecommitdiff
path: root/npc/magic/level2-rain.txt
blob: 30171c06c5213cc1353dc79fd29ea5e8fa3fe9c8 (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);

    // Eventually, a quest or another will depend on Kaflosh, so
    if (isin("006-1", 82, 59, 14))
        callfunc "QuestTreeTrigger", 1;
    return;
}