summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-04-10 09:25:59 -0300
committerJesusaves <cpntb1@ymail.com>2019-04-10 09:25:59 -0300
commit7361d9a8860828b6040db76b5c9ebdc5d8fa29c6 (patch)
tree47d6c7bc49e3a1827d2b4047db606fae5966c958
parent207ed7b67d2c47e14ab78c744681b6c3f67a9d0e (diff)
downloadserverdata-7361d9a8860828b6040db76b5c9ebdc5d8fa29c6.tar.gz
serverdata-7361d9a8860828b6040db76b5c9ebdc5d8fa29c6.tar.bz2
serverdata-7361d9a8860828b6040db76b5c9ebdc5d8fa29c6.tar.xz
serverdata-7361d9a8860828b6040db76b5c9ebdc5d8fa29c6.zip
[ALPHA] [UNTESTED] [EXPERIMENTAL] [TEST SERVER ONLY] [FIX TEST REVERT ME PLEASE]
Experimental Drinking System. Only on Red Plush Wine atm (not at Beer) See also: https://wiki.themanaworld.org/index.php/User:Crush/Alcohol
-rw-r--r--db/re/item_db.conf10
-rw-r--r--npc/items/alcohol.txt76
-rw-r--r--npc/scripts.conf1
3 files changed, 80 insertions, 7 deletions
diff --git a/db/re/item_db.conf b/db/re/item_db.conf
index 23f5e6b77..d02fada4d 100644
--- a/db/re/item_db.conf
+++ b/db/re/item_db.conf
@@ -772,13 +772,9 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- sc_start SC_CONFUSION, 5000, 0; // Warning, forces user to use @resync!
- sc_start SC_PLUSATTACKPOWER, 15000, 40;
- @min = 50;
- @max = 110;
- @delay = 5;
- @type = 1;
- doevent "rand_sc_heal::OnUse";
+ @taste = 50;
+ @Alcohol = 49;
+ doevent "alcohol_sc::OnUse";
">
},
{
diff --git a/npc/items/alcohol.txt b/npc/items/alcohol.txt
new file mode 100644
index 000000000..6ecad5571
--- /dev/null
+++ b/npc/items/alcohol.txt
@@ -0,0 +1,76 @@
+// TMW-2 Script.
+// Author:
+// Crush
+// Jesusalva
+// Description:
+// Alcohol effects
+// TODO: Retroactive, weakens every hour...
+//
+// Variables:
+// @taste Alcohol taste (0~100) - influences exp up
+// @Alcool 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.
+// Attack Speed Reductor: SC_ATTHASTE_INFINITY
+// Max HP Reductor: SC_INCMHPRATE
+// EXP Increaser: SC_OVERLAPEXPUP
+
+- 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), 4); // Shouldn't it be 5?
+ }
+ return 0;
+ }
+
+OnUse:
+ if (@Alcool <= 0) close;
+ // Do you have enough vitality to hold your beer?
+ .@vit=readparam(bVit);
+ if (@Alcool+ALC_THRESHOLD > .@vit) {
+ dispbottom l("You vomit, you are too drunk for this to have effect anymore.");
+ 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!
+ end;
+ }
+
+ // Put the delay in ms. Each ALCOOL point is 10 minutes.
+ .@delay = remaining_bonus(SC_OVERLAPEXPUP, false);
+ .@delay += @Alcool*600*1000;
+ // Alcohol EXP Bonus sums to previous exp bonus
+ .@val1 = remaining_bonus(SC_OVERLAPEXPUP, true);
+ .@val1 += @taste;
+
+ // Reset EXP Bonus
+ sc_end SC_OVERLAPEXPUP;
+ sc_start SC_OVERLAPEXPUP, .@delay, .@val1;
+
+ // Same goes for attack speed debuff
+ // Except delay does not stack, and malus is recalculated
+ .@delay = @Alcool*600*1000;
+ .@val1 = ALC_THRESHOLD+@Alcool;
+
+ // Reset Attack Speed Debuff
+ sc_end SC_ATTHASTE_INFINITY;
+ sc_start SC_ATTHASTE_INFINITY, .@delay, -.@val1;
+
+ // Recalculate Alcohol Threshold and time
+ ALC_THRESHOLD+=@Alcool;
+ if (ALC_DELAYTIME < gettimetick(2))
+ ALC_DELAYTIME=gettimetick(2);
+ ALC_DELAYTIME+=@Alcool*600*1000;
+ close;
+}
+
diff --git a/npc/scripts.conf b/npc/scripts.conf
index fbe0fb172..4bf722fdf 100644
--- a/npc/scripts.conf
+++ b/npc/scripts.conf
@@ -62,6 +62,7 @@
"npc/functions/treasure.txt",
// Item functions
+"npc/items/alcohol.txt",
"npc/items/books.txt",
"npc/items/croconut.txt",
"npc/items/emptybox.txt",