summaryrefslogblamecommitdiff
path: root/npc/magic/level2-shear.txt
blob: 7902101343575b4598cf61e04f920b01c642ac1c (plain) (tree)


































































                                                                                                                                 
-	script	shear	NPC32767,{
    if(call("magic_checks")) end;
    if (Sp < 23) end;
    if (getskilllv(SKILL_MAGIC) < .level) end;
    if (getskilllv(.school) < .level) end;
    set @_M_BLOCK, 1; // block casting, until the timer clears it
    addtimer 1000, "Magic Timer::OnClear"; // set the new debuff
    callfunc "adjust_spellpower";
    Sp = Sp - 23;
    misceffect FX_MAGIC_GREEN, strcharinfo(0);
    setarray @chipchipspell[0],
        @spellpower,
        (((200 - Agi) * 2000) / 200); //delay
    callfunc "magic_exp";
    goto L_FreeRecast;

OnAttack:
    if (isloggedin(@target_id)) goto L_FreeRecast; // can not shear a player
    if (sc_check(SC_SHEARED, @target_id)) goto L_FreeRecast; // mob already sheared
    if (target(BL_ID, @target_id, 22) != 22) goto L_FreeRecast; // 0x10 | 0x02 | 0x04
    sc_start SC_SHEARED, 600000, 0, @target_id;
    .@score = rand(1000 - rand(@chipchipspell[0]));
    set .@id, get(Class, @target_id); // get the mob ID
    @chipchipspell[2] = 0;

    if   (.@id == 1020 && .@score < 300) set .@item$, "WhiteFur"; // Fluffy
    elif (.@id == 1027 && .@score < 300) set .@item$, "WhiteFur"; // EasterFluffy
    elif (.@id == 1019 && .@score < 250) set .@item$, "HardSpike"; // SpikyMushroom
    elif (.@id == 1028 && .@score < 175) set .@item$, "CottonCloth"; // Mouboo
    elif (.@id == 1029 && .@score < 700) set .@item$, "MauveHerb"; // MauvePlant
    elif (.@id == 1030 && .@score < 700) set .@item$, "CobaltHerb"; // CobaltPlant
    elif (.@id == 1031 && .@score < 700) set .@item$, "GambogeHerb"; // GambogePlant
    elif (.@id == 1032 && .@score < 700) set .@item$, "AlizarinHerb"; // AlizarinPlant
    elif (.@id == 1035 && .@score < 300) set .@item$, "SilkCocoon"; // SilkWorm
    elif (.@id == 1018 && .@score < 180) set .@item$, "PinkAntenna"; // Pinkie
    else end;
    makeitem .@item$, 1, getmapname(), rand(POS_X - 1, POS_X + 1), rand(POS_Y - 1, POS_Y + 1);

    if (.@id != 1020 && .@id != 1028 && .@id != 1018 && rand(2) != 1) end;
    @value = 1;
    callfunc "QuestSagathaHappy";
    end;

L_FreeRecast:
    @chipchipspell[2] = 1;
    addtimer 0, strnpcinfo(0) + "::OnSetRecast"; // we can't do it while already overridden, until it reaches a script terminator
    end;

OnDischarge:
    if (@chipchipspell[2] < 1) end;
    @chipchipspell[2] = 0;
    misceffect FX_FIRE_BURST, strcharinfo(0);
    overrideattack;
    end;

OnSetRecast:
    overrideattack @chipchipspell[1], 1, ATTACK_ICON_SHEARING, 30, strnpcinfo(0)+"::OnAttack";
    end;

OnInit:
    .school = SKILL_MAGIC_NATURE;
    set .invocation$, chr(MAGIC_SYMBOL) + "chipchip"; // used in npcs that refer to this spell
    void call("magic_register");
    .level = 2;
    .exp_gain = 0;
    end;
}