summaryrefslogtreecommitdiff
path: root/npc
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2018-12-16 19:27:15 +0100
committerGitHub <noreply@github.com>2018-12-16 19:27:15 +0100
commit52360f0cee7916f58da6eda0399f74199f957c44 (patch)
treefac36b1c82dcde7128326b4d82a13f3fd5d13bd6 /npc
parent176d6d61d1946018398c598a842185745fb0312e (diff)
parentd7bbebdf8526667b288223c8adc2d110204814c5 (diff)
downloadhercules-52360f0cee7916f58da6eda0399f74199f957c44.tar.gz
hercules-52360f0cee7916f58da6eda0399f74199f957c44.tar.bz2
hercules-52360f0cee7916f58da6eda0399f74199f957c44.tar.xz
hercules-52360f0cee7916f58da6eda0399f74199f957c44.zip
Merge pull request #2246 from Emistry/scriptcommand_pcneedstatuspoint
Implement status reduction script command.
Diffstat (limited to 'npc')
-rw-r--r--npc/other/CashShop_Functions.txt27
1 files changed, 27 insertions, 0 deletions
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 <type> by <val>.
+// - Returns status points equals to points needed to raise
+// that stat to original value.
+// - Doesn't work if base status <type> would become lower than 1 after reduction.
+// * callfunc("F_CashReduceStat", <type>{, <val>, <itemid>});
+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