summaryrefslogblamecommitdiff
path: root/world/map/npc/magic/level2-shear.txt
blob: c6141a1c001b100445d07b66942ed0709d2fccac (plain) (tree)
1
2
3
4
5
6
7
8
9

                    
                                 


                                              

                                                                 
                                         

                                 
                                                   


                                             
                         
                      

         


                                                                                     
                                               
                                                      
                                                       
                             


















                                                                                          
             
                             


                                                                                                                                 


                                   
                                                  


                   
            
                                                                                                                             

        


                                                                                              
                                



                     
-|script|shear|32767
{
    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
    sc_start SC_COOLDOWN, 1000, 0, BL_ID;
    callfunc "adjust_spellpower";
    set Sp, Sp - 23;
    misceffect FX_MAGIC_SHEAR_CAST, 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;
    set .@score, rand(1000 - rand(@chipchipspell[0]));
    set .@id, get(Class, @target_id); // get the mob ID
    set @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, getmap(), 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;
    set @value, 1;
    callfunc "QuestSagathaHappy";
    end;

L_FreeRecast:
    set @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;
    set @chipchipspell[2], 0;
    misceffect FX_MAGIC_DISCHARGE, strcharinfo(0);
    overrideattack;
    end;

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

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