Explorar el Código

Follow up to 021bed5f5de02a9262831ebcb968a627f2ddba26

Jittapan Pluemsumran hace 8 años
padre
commit
472b885ca8
Se han modificado 1 ficheros con 12 adiciones y 8 borrados
  1. 12 8
      npc/other/CashShop_Functions.txt

+ 12 - 8
npc/other/CashShop_Functions.txt

@@ -307,20 +307,24 @@ function	script	F_Snowball	{
 
 // Status reduction potion
 //============================================================
-// - Permanently reduces base stat <type> by 1.
+// - 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> is already 1.
-// * callfunc("F_CashReduceStat",<type>{,<itemid>});
+// - 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);
-	.@itemid = getarg(1, 0);
+	.@amount = getarg(1, -1);
+	.@itemid = getarg(2, 0);
 	
-	if(readparam(.@type) < 2) return;
+	if((readparam(.@type) + .@amount) < 1) return;
 	
 	if(.@itemid)
-		delitem .@itemid,1;
-	StatusPoint += needed_status_point(.@type, -1);
-	statusup2 .@type,-1;
+		if(countitem(.@itemid))
+			delitem .@itemid,1;
+		else
+			return;
+	StatusPoint += needed_status_point(.@type, .@amount);
+	statusup2 .@type,.@amount;
 	return;
 }