From a8680c39fbc3aea65a2185b07e3987a8bf1ca102 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sun, 14 Apr 2019 22:54:09 -0300 Subject: Luck Increasing Potions (A, B and C) --- db/re/item_db.conf | 51 ++++++++++++++++++++++++++++++++++++++++++++++ npc/items/inc_sc_bonus.txt | 48 +++++++++++++++++++++++++++++++++++++++++++ npc/scripts.conf | 1 + 3 files changed, 100 insertions(+) create mode 100644 npc/items/inc_sc_bonus.txt diff --git a/db/re/item_db.conf b/db/re/item_db.conf index 9174ec7f0..bd56d8db7 100644 --- a/db/re/item_db.conf +++ b/db/re/item_db.conf @@ -2816,6 +2816,57 @@ item_db: ( sc_start SC_INCHIT,20000,40; "> }, +{ + Id: 648 + AegisName: "IncLukAPotion" + Name: "Inc Luck Potion" + Type: "IT_USABLE" + Buy: 1000000 + Sell: 0 + Weight: 20 + Refine: false + Script: <" + @min = 5; + @max = 10; + @delay = 20; + @type = SC_INCLUK; + doevent "inc_sc_bonus::OnUse"; + "> +}, +{ + Id: 649 + AegisName: "IncLukBPotion" + Name: "Inc Luck+ Potion" + Type: "IT_USABLE" + Buy: 1000000 + Sell: 0 + Weight: 20 + Refine: false + Script: <" + @min = 10; + @max = 20; + @delay = 15; + @type = SC_INCLUK; + doevent "inc_sc_bonus::OnUse"; + "> +}, +{ + Id: 650 + AegisName: "IncLukCPotion" + Name: "Inc Luck++ Potion" + Type: "IT_USABLE" + Buy: 1000000 + Sell: 0 + Weight: 20 + Refine: false + Script: <" + @min = 20; + @max = 30; + @delay = 10; + @type = SC_INCLUK; + doevent "inc_sc_bonus::OnUse"; + "> +}, // Mounts (690 to 699, probably there will be extra IDs) { diff --git a/npc/items/inc_sc_bonus.txt b/npc/items/inc_sc_bonus.txt new file mode 100644 index 000000000..a4f7cdac5 --- /dev/null +++ b/npc/items/inc_sc_bonus.txt @@ -0,0 +1,48 @@ +// TMW-2 Script. +// Author: +// Jesusalva +// Description: +// Applies effects for INC_* (STR doesn't exist) +// Valid values: INCAGI INCVIT INCINT INCDEX INCLUK INCHIT +/// Untested Values: INCHIT INCFLEE INCMHP INCMSP WALKSPEED INVINCIBLE +// +// Variables: +// @delay Second of buffing +// @min Min amount of type +// @max Max amount of type +// @type SC_* + +- script inc_sc_bonus -1,{ +OnUse: + if (@delay <= 0) close; + + // Get the bonus value + .@bonus=rand(@min, @max); + + // 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=(.@bonus*@delay+@v*@t)/(@t+@delay); + else + @v=.@bonus; + + // Update time value to ms and to stack + @t+=@delay; + @t*=1000; + + // Restart the bonus + sc_end @type; + sc_start @type,@t,@v; + + close; +} + diff --git a/npc/scripts.conf b/npc/scripts.conf index 4bf722fdf..05a55604c 100644 --- a/npc/scripts.conf +++ b/npc/scripts.conf @@ -27,6 +27,7 @@ "npc/functions/scoreboards.txt", "npc/functions/random-talk.txt", "npc/items/rand_sc_heal.txt", +"npc/items/inc_sc_bonus.txt", "npc/commands/event.txt", // config script -- cgit v1.2.3-70-g09d2