summaryrefslogblamecommitdiff
path: root/npc/items/legacy_heal.txt
blob: 57a3da2d8e7a90ab61605e49f3969abd331d71bf (plain) (tree)


















                                                                                          



                                                                                   
 



                                                                       
                                                         
                                                         
                              




                                                         

                                     






                                                               



                                        
             


            

        
// TMW-2 Script.
// Evol scripts.
// Author:
//    Reid
//    Jesusalva
// Description:
//    Legacy Healing System
//
// Variables:
//    @delay    Second of healing
//    @min      Min amount of healing
//    @max      Max amount of healing
//
// *getequipoption(EQI_HEAD_TOP,1,168); → Heal Bonus (should be first bonus on Chef Hat)


-	script	legacy_heal	-1,{

OnUse:
    if (@delay <= 0) {
        Exception("Invalid legacy healing item, deleting without healing effect.");
        end;
    }

    // Decide the healing bonus type. We have four types: S, L, G and M
    // By default, we use 'S'
    .@skill = SC_S_LIFEPOTION;

    // minimum between @min and bVit / 2 * BaseLevel / 10
    //@min = min(@max, readparam(bVit) * BaseLevel / 20);
    @val1 = rand2(@min, @max);

    @delay *= 1000; // Put the delay in ms

    // We now have @val1 (new effect), @delay (new delay)
    // But do we have .@v and .@d (old effect and delay)?
    .@v=getstatus(.@skill, 1);
    .@d=getstatus(.@skill, 4) * 1000;

    // If there WAS an effect previously, get ponderate average
    if (.@v > 0) {
        @val1=ponderate_avg(@val1, @delay, .@v, .@d);
        @delay=ponderate_avg(@delay, @val1, .@d, .@v);
    }

    // Apply the effect and finish
    sc_end .@skill;
    sc_start2 .@skill, @delay, @val1, 1;

    @delay=0;
    @min=0;
    @max=0;
    @val1=0;
    end;
}