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
|
// TMW-2 Script.
// Author:
// Crush
// Jesusalva
// Description:
// Alcohol effects
// TODO: Retroactive, weakens every hour...
//
// Variables:
// @taste Alcohol taste (0~100) - influences exp up
// @Alcohol Alcoholic rating (0~100) - influences Attack Speed Malus, Min. Vit and duration
// ALC_DELAYTIME For how long you are drunk (the delay) - gettimetick(2)
// ALC_THRESHOLD How drunk you are (the bonus)
//
// When drunk, attack speed is lowered but exp gain is increased.
// Actual penalty: SC_HALT_REGENERATION
// Attack Speed Reductor: SC_ATTHASTE_INFINITY (reset upon death), SC_ATTHASTE_POTION2 (not reset upon death)
// Max HP Reductor: SC_INCMHPRATE
// EXP Increaser: SC_CASH_PLUSEXP (not reset upon death), SC_OVERLAPEXPUP (reset upon death)
function script ALCReset {
if (ALC_DELAYTIME < gettimetick(2))
ALC_THRESHOLD=0;
return;
}
- script alcohol_sc -1,{
end;
OnUse:
if (@Alcohol <= 0 || @taste <= 0) {
Exception("Invalid alcoholic item, deleting without any effect.");
end;
}
// Just to be sure
ALCReset();
// Do you have enough vitality to hold your beer?
// Skip this check on the first drink
if (ALC_THRESHOLD) {
.@vit=readparam2(bVit);
if (@Alcohol+ALC_THRESHOLD > .@vit) {
if (GSET_ALCOHOL_NOOVERDRINK) dispbottom l("You vomit, you are too drunk for this to have effect anymore.");
else dispbottom l("You vomit, you are too drunk and drinking is harmful.");
dispbottom l("Raise vitality to be able to drink even more.");
sc_start SC_CONFUSION, 5000, 0, 10000, SCFLAG_NOAVOID; // Warning, forces user to use @resync!
if (GSET_ALCOHOL_NOOVERDRINK) end;
percentheal -@Alcohol, -@Alcohol;
}
}
.@weight=2*60; // How long (in secs) each Alcohol point works? (max. 100 points)
.@delay = (@Alcohol*.@weight);
// Default value is 2 minutes per alcohol point - you'll be somber after at most four hours.
// Beer (7): 14 minutes
// Wine (16): 32 minutes
// Sake (25): 50 minutes
// Rum (40) : 80 minutes (1h20)
// Ale (70) : 140 minutes (2h20)
// Taste is affected by users near you.
// Each user raises exp bonus in 2.4%, capped to the beverage taste
// If you are with many people, drink a better beverage! ;-)
// (Rounded down : So there's a "bonus" every ~3 people)
getmapxy(.@m$, .@x, .@y, 0);
.@bonus=getareausers(.@m$, .@x-14, .@y-14, .@x+14, .@y+14)-1;
.@bonus=.@bonus*24/10;
@taste+=min(@taste, .@bonus);
// Alcohol EXP Bonus is ponderate average, so having more VIT doesn't means
// more experience - only more time (be careful when mixing alcohol!)
SC_Bonus(.@delay, SC_OVERLAPEXPUP, @taste);
// Recalculate Alcohol Threshold and time
ALC_THRESHOLD+=@Alcohol;
if (ALC_DELAYTIME < gettimetick(2)) {
ALC_DELAYTIME=gettimetick(2);
ALC_THRESHOLD=@Alcohol;
}
ALC_DELAYTIME+=.@delay;
// For debuff I'll use inc_sc_bonus utilities
// (Now that I switched from SC_ATTHASTE_INFINITY to SC_HALT_REGENERATION,
// the actual value is no longer relevant)
SC_Bonus(.@delay, SC_HALT_REGENERATION, 1);
close;
}
|