diff options
author | Jesusalva Jesusalva <jesusalva@themanaworld.org> | 2023-05-31 00:44:16 +0000 |
---|---|---|
committer | Jesusalva Jesusalva <jesusalva@themanaworld.org> | 2023-05-31 00:44:16 +0000 |
commit | ee111611d93667b412eda22477fabfac106da0ea (patch) | |
tree | 4f42d3c8f2727de64cb3e87847d837956ab6a391 /npc | |
parent | c4804195c8a3f6116cae8eb6c61bbd7f61e08105 (diff) | |
download | serverdata-ee111611d93667b412eda22477fabfac106da0ea.tar.gz serverdata-ee111611d93667b412eda22477fabfac106da0ea.tar.bz2 serverdata-ee111611d93667b412eda22477fabfac106da0ea.tar.xz serverdata-ee111611d93667b412eda22477fabfac106da0ea.zip |
Simplify Alcohol Script for consistency, and replace penalty.
This replaces Alcohol to use SC_Bonus, which became the de-facto default.
SC_Bonus was made based on Alcohol code, but it received improvements over time. So I decided it was time to let the parent code go.
I also replaced the penalty. The ASPD penalty never struck me as "right". I tried SC_FROSTMISTY (which slows you down, reduces ASPD, etc. ─ more effects but less duration) and SC_QUAGMIRE (reduces DEX/AGI and nullifies buffs for them, slows you down).
But I opted for SC_HALT_REGENERATION. It is used elsewhere as well and is inflexible: While the effect is active, regardless of what drink you used, healing yourself (by magic, not by potions) will be ineffective, and natural regen is inhibited or disabled ─ likely the later).
Diffstat (limited to 'npc')
-rw-r--r-- | npc/functions/dungeon.txt | 4 | ||||
-rw-r--r-- | npc/items/alcohol.txt | 67 |
2 files changed, 16 insertions, 55 deletions
diff --git a/npc/functions/dungeon.txt b/npc/functions/dungeon.txt index 641d00d66..71b2bf82c 100644 --- a/npc/functions/dungeon.txt +++ b/npc/functions/dungeon.txt @@ -134,9 +134,7 @@ OnBleed: } // You are in a BLEEDMAP$, HP regeneration is disabled - if (@bleedio > gettimetick(2)) - sc_end SC_HALT_REGENERATION; - else + if (@bleedio <= gettimetick(2)) SC_Bonus(15, SC_HALT_REGENERATION, 1); // You may bleed at 2% chance per 15 seconds diff --git a/npc/items/alcohol.txt b/npc/items/alcohol.txt index 374a4be31..0305ad4c7 100644 --- a/npc/items/alcohol.txt +++ b/npc/items/alcohol.txt @@ -13,6 +13,7 @@ // 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) @@ -24,22 +25,7 @@ function script ALCReset { } - script alcohol_sc -1,{ - - // Stack remaning bonuses if the last one hasn't finished - // remaining_bonuses(sc, type) - // type 0: delay - // type 1: value - function remaining_bonus - { - if (getstatus(getarg(0))) - { - if (getarg(1)) - return getstatus(getarg(0), 1); - else - return getstatus(getarg(0), 5); // Shouldn't it be 5? - } - return 0; - } + end; OnUse: if (@Alcohol <= 0 || @taste <= 0) { @@ -62,7 +48,8 @@ OnUse: percentheal -@Alcohol, -@Alcohol; } } - .@deltatime=2*60*1000; // How long (in ms) each Alcohol point works? (max. 100 points) + .@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 @@ -71,28 +58,17 @@ OnUse: // Ale (70) : 140 minutes (2h20) // Taste is affected by users near you. - // Each user raises exp bonus in 1.5%, capped to the beverage taste + // 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-12, .@y-12, .@x+12, .@y+12)-1; - .@bonus=.@bonus*15/10; + .@bonus=getareausers(.@m$, .@x-14, .@y-14, .@x+14, .@y+14)-1; + .@bonus=.@bonus*24/10; @taste+=min(@taste, .@bonus); - // Alcohol EXP Bonus - ponderate average, so having more VIT doesn't means + // Alcohol EXP Bonus is ponderate average, so having more VIT doesn't means // more experience - only more time (be careful when mixing alcohol!) - .@v=remaining_bonus(SC_OVERLAPEXPUP, true); - .@t=remaining_bonus(SC_OVERLAPEXPUP, false)/1000; - - if (.@t) .@val1 = ponderate_avg(@taste, @Alcohol, .@v, .@t); - else .@val1 = @taste; - - // Put the delay in ms. - .@delay = remaining_bonus(SC_OVERLAPEXPUP, false); - .@delay = .@t + @Alcohol*.@deltatime; - - // Reset EXP Bonus based on the new cumulative delay and average exp bonus - sc_end SC_OVERLAPEXPUP; - sc_start SC_OVERLAPEXPUP, .@delay, .@val1; + SC_Bonus(.@delay, SC_OVERLAPEXPUP, @taste); // Recalculate Alcohol Threshold and time ALC_THRESHOLD+=@Alcohol; @@ -100,25 +76,12 @@ OnUse: ALC_DELAYTIME=gettimetick(2); ALC_THRESHOLD=@Alcohol; } - ALC_DELAYTIME+=@Alcohol*.@deltatime; - - // Debug comment if you need to check stuff - //debugmes "%d %d | %d %d | f t ", remaining_bonus(SC_OVERLAPEXPUP, false), remaining_bonus(SC_OVERLAPEXPUP, true), remaining_bonus(SC_ATTHASTE_INFINITY, false), remaining_bonus(SC_ATTHASTE_INFINITY, true); + ALC_DELAYTIME+=.@delay; - // For debuff I'll use inc_sc_bonus utilities (exp gain = atk speed loss) - .@delay=@Alcohol*(.@deltatime/1000); - .@min=-(remaining_bonus(SC_OVERLAPEXPUP, true)*2); - .@max=-(remaining_bonus(SC_OVERLAPEXPUP, true)*2); - // Sanitization, and nerf the debuff - .@min=(.@min/2)+1; - .@max=(.@max/2)+2; - // DEX and VIT may affect a tiny bit (there's caps) - .@pam=readparam2(bVit)+readparam2(bDex); - .@min=min(0, .@min*limit(50, 500-.@pam, 500)/500); - .@max=min(0, .@min*limit(100, 500-.@pam, 500)/500); - SC_Bonus(.@delay, SC_ATTHASTE_INFINITY, .@min, .@max); - if (debug || $@GM_OVERRIDE) - debugmes "Alcohol penalty: %d ~ %d for %d s", .@min, .@max, .@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; } |