From ffb8fcf60a3c01d13b25b0af3146a627accd3c67 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 3 Dec 2018 11:21:24 +0000 Subject: Fix adjustPunish --- scripts/toy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/toy.groovy b/scripts/toy.groovy index 7ba695f..3807e97 100644 --- a/scripts/toy.groovy +++ b/scripts/toy.groovy @@ -169,8 +169,8 @@ def can = {i -> loadBoolean("toy.permission.$i") == true}; def is = {i -> loadBoolean("toy.state.$i") == true}; def set = {i, s -> save("toy.state.$i", s)}; def positioned = { i -> loadString("toy.position") == i }; -def adjustPunish = { p -> save("toy.punishment", getPunish() + p); }; def getPunish = { loadInteger("toy.punishment"); }; +def adjustPunish = { p -> save("toy.punishment", Math.max(getPunish() + (int)p, 0)); }; def sessionAborted = null; def gagText = { t, p -> if (!is(GAGGED)) return t; -- cgit v1.2.3