summaryrefslogtreecommitdiff
path: root/npc/items/legacy_heal.txt
blob: 9ef8e548b61a5c9cb9ffa0ce9991d53cdbad9bc4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// 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) end;

    // minimum between @min and bVit / 2 * BaseLevel / 10
    @min = min(@max, readparam(bVit) * BaseLevel / 20);
    @val1 = rand(@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(getarg(0), 1);
    .@d=getstatus(getarg(0), 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);
    }

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

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

    end;
}