summaryrefslogtreecommitdiff
path: root/npc/other
diff options
context:
space:
mode:
authorEmistry Haoyan <equinox1991@gmail.com>2018-10-02 22:41:53 +0800
committerEmistry Haoyan <equinox1991@gmail.com>2018-10-05 01:33:05 +0800
commitd7bbebdf8526667b288223c8adc2d110204814c5 (patch)
tree0a044119b50b06b3199aadc53e935bcc784cd1ff /npc/other
parent852c13305f67948531bd0277eb1922dbd02b1f26 (diff)
downloadhercules-d7bbebdf8526667b288223c8adc2d110204814c5.tar.gz
hercules-d7bbebdf8526667b288223c8adc2d110204814c5.tar.bz2
hercules-d7bbebdf8526667b288223c8adc2d110204814c5.tar.xz
hercules-d7bbebdf8526667b288223c8adc2d110204814c5.zip
Implement status reduction script command.
- for stat reduction support. - return the amount of status point required to increase a status.
Diffstat (limited to 'npc/other')
-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