summaryrefslogtreecommitdiff
path: root/npc/items/alcohol.txt
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-04-22 11:26:36 -0300
committerJesusaves <cpntb1@ymail.com>2019-04-22 11:26:36 -0300
commit968bcf66efed06852ecfe6532603017af8195c6b (patch)
tree712cea8f35ca83f22132d9d7834a9a26aee30983 /npc/items/alcohol.txt
parent5a5841cc09f881cf9cbe94f8ee99fb2331b6f3ec (diff)
downloadserverdata-968bcf66efed06852ecfe6532603017af8195c6b.tar.gz
serverdata-968bcf66efed06852ecfe6532603017af8195c6b.tar.bz2
serverdata-968bcf66efed06852ecfe6532603017af8195c6b.tar.xz
serverdata-968bcf66efed06852ecfe6532603017af8195c6b.zip
Try to rewrite Alcohol System
Diffstat (limited to 'npc/items/alcohol.txt')
-rw-r--r--npc/items/alcohol.txt33
1 files changed, 18 insertions, 15 deletions
diff --git a/npc/items/alcohol.txt b/npc/items/alcohol.txt
index b5d187f67..cfe6258b3 100644
--- a/npc/items/alcohol.txt
+++ b/npc/items/alcohol.txt
@@ -55,26 +55,22 @@ OnUse:
.@bonus=getareausers(.@m$, .@x-10, .@y-10, .@x+10, .@y+10)-1;
@taste+=min(@taste*2, .@bonus);
- // Put the delay in ms. Each Alcohol point is 10 minutes.
+ // Alcohol EXP Bonus - ponderate average, so having more VIT doesn't means
+ // more experience - only more time (be careful when mixing alcohol!)
+ .@v=remaining_bonus(SC_CASH_PLUSEXP, true);
+ .@t=remaining_bonus(SC_CASH_PLUSEXP, false)/1000;
+
+ if (.@t) .@val1 = ponderate_avg(@taste, @Alcohol, .@v, .@t);
+ else .@val1 = @taste;
+
+ // Put the delay in ms.
.@delay = remaining_bonus(SC_CASH_PLUSEXP, false);
- .@delay += @Alcohol*.@deltatime;
- // Alcohol EXP Bonus sums to previous exp bonus
- .@val1 = remaining_bonus(SC_CASH_PLUSEXP, true);
- .@val1 += @taste;
+ .@delay = .@t + @Alcohol*.@deltatime;
- // Reset EXP Bonus
+ // Reset EXP Bonus based on the new cumulative delay and average exp bonus
sc_end SC_CASH_PLUSEXP;
sc_start SC_CASH_PLUSEXP, .@delay, .@val1;
- // Same goes for attack speed debuff
- // Except malus is recalculated
- .@delay = remaining_bonus(SC_ATTHASTE_INFINITY, false)+@Alcohol*.@deltatime;
- .@val1 = (ALC_THRESHOLD+@Alcohol)/2;
-
- // Reset Attack Speed Debuff
- sc_end SC_ATTHASTE_INFINITY;
- sc_start SC_ATTHASTE_INFINITY, .@delay, -.@val1;
-
// Recalculate Alcohol Threshold and time
ALC_THRESHOLD+=@Alcohol;
if (ALC_DELAYTIME < gettimetick(2))
@@ -83,6 +79,13 @@ OnUse:
// Debug comment if you need to check stuff
//debugmes "%d %d | %d %d | f t ", remaining_bonus(SC_CASH_PLUSEXP, false), remaining_bonus(SC_CASH_PLUSEXP, true), remaining_bonus(SC_ATTHASTE_INFINITY, false), remaining_bonus(SC_ATTHASTE_INFINITY, true);
+
+ // For debuff I'll use inc_sc_bonus utilities (exp gain = atk speed loss)
+ @min=-remaining_bonus(SC_CASH_PLUSEXP, true);
+ @max=-remaining_bonus(SC_CASH_PLUSEXP, true);
+ @type=SC_ATTHASTE_INFINITY;
+ @delay=@Alcohol*(.@deltatime/1000);
+ doevent "inc_sc_bonus::OnUse";
close;
}