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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
// TMW-2 Script.
// Author:
// Jesusalva
// Description:
// Applies effects for INC_* (STR doesn't exist)
// Valid values: INCAGI INCVIT INCINT INCDEX INCLUK INCHIT INCFLEE
// Doesn't works: SC_STRUP -> SC_STR_SCROLL instead
// Works if .@min == .@max: INCMHP INCMHPRATE INCMSP INCMSPRATE
/// Untested Values: WALKSPEED (reverse logic) INVINCIBLE (broken)
// PS. SC_CRITICALPERCENT (Crit) SC_FOOD_CRITICALSUCCESSVALUE (Crit) SC_STRIKING (Crit , ATK)
//
// Variables:
// .@delay Second of buffing
// .@type SC_*
// .@min Min amount of type
// .@max Max amount of type (optional)
// SC_Bonus(delay, SC, min{, max})
function script SC_Bonus {
.@delay=getarg(0);
.@type=getarg(1);
.@min=getarg(2);
.@max=getarg(3, .@min);
if (.@delay <= 0)
return false;
// Moubootaur Showdown Effects
if (getvariableofnpc(.mapMode, "#Moubootaur") == ML_MAPMODE_NOBOOST) {
// Semi Hardcoded-way to find buffs
if (getmap() == "001-15" && .@min > 0 && array_find($@sc_buffs, .@type))
return false;
}
// Get the bonus value
if (.@min != .@max)
.@bonus=rand2(.@min, .@max);
else
.@bonus=.@min;
// Remaining time and effect conversion
.@v=getstatus(.@type, 1);
.@t=getstatus(.@type, 5);
// Convert remaining time to seconds, rounded down
if (.@t > 1000)
.@t=.@t/1000;
else
.@t=0;
// If there was effect previously, get ponderate average
if (.@v > 0)
.@v=ponderate_avg(.@bonus, .@delay, .@v, .@t);
else
.@v=.@bonus;
// Update time value to ms and to stack
.@t+=.@delay;
.@t*=1000;
// Debug print if needed
if (debug || $@GM_OVERRIDE)
debugmes "Effect %d (+%d percent) for %d ms", .@type, .@bonus, .@t;
// Restart the bonus
sc_end .@type;
sc_start .@type,.@t,.@v;
return true;
}
- script inc_sc_bonus -1,{
OnUse:
// Moubootaur Showdown Effects
if (getvariableofnpc(.mapMode, "#Moubootaur") == ML_MAPMODE_NOBOOST) {
if (getmap() == "001-15")
end;
}
SC_Bonus(@delay, @type, @min, @max);
@delay=0;
@type=0;
@min=0;
@max=0;
end;
// Document all buffs
OnInit:
setarray $@sc_buffs, SC_ATTHASTE_POTION1, SC_INCHIT, SC_KAIZEL, SC_INCATKRATE, SC_ATTHASTE_POTION1, SC_PLUSATTACKPOWER, SC_WALKSPEED, SC_INCLUK, SC_INCDEX, SC_INCAGI, SC_INCVIT, SC_INCINT, SC_STR_SCROLL, SC_CASH_DEATHPENALTY, SC_INCFLEE, SC_FOOD_CRITICALSUCCESSVALUE, SC_CRITICALPERCENT, SC_INCMSPRATE, SC_INCMHPRATE, SC_INCMSP, SC_INCMHP, SC_STRUP, SC_STRIKING, SC_INCHITRATE, SC_INCATKRATE, SC_INCFLEERATE, SC_INCDEFRATE, SC_ATTHASTE_POTION2, SC_OVERLAPEXPUP;
end;
}
|