From d7bbebdf8526667b288223c8adc2d110204814c5 Mon Sep 17 00:00:00 2001 From: Emistry Haoyan Date: Tue, 2 Oct 2018 22:41:53 +0800 Subject: Implement status reduction script command. - for stat reduction support. - return the amount of status point required to increase a status. --- npc/other/CashShop_Functions.txt | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'npc/other') diff --git a/npc/other/CashShop_Functions.txt b/npc/other/CashShop_Functions.txt index 92fe841e1..5b957f9f2 100644 --- a/npc/other/CashShop_Functions.txt +++ b/npc/other/CashShop_Functions.txt @@ -310,3 +310,30 @@ function script F_Snowball { } end; } + +// Status reduction potion +//============================================================ +// - Permanently reduces base stat by . +// - Returns status points equals to points needed to raise +// that stat to original value. +// - Doesn't work if base status would become lower than 1 after reduction. +// * callfunc("F_CashReduceStat", {, , }); +function script F_CashReduceStat { + .@type = getarg(0); + .@amount = getarg(1, -1); + .@itemid = getarg(2, 0); + + if ((readparam(.@type) + .@amount) < 1) return; + + if (.@itemid) { + if (countitem(.@itemid)) + delitem .@itemid, 1; + else + return; + } + + StatusPoint += needed_status_point(.@type, .@amount); + statusup2 .@type, .@amount; + + return; +} \ No newline at end of file -- cgit v1.2.3-60-g2f50