diff options
authorGravatar Pouar <pouar@pouar.net>2020-10-12 10:53:05 -0500
committerGravatar Pouar <pouar@pouar.net>2020-10-12 10:59:49 -0500
commit4a4fa0d2cc627255e62e011329e517ff5f802ca4 (patch)
parentanother giant commit with a useless log message (diff)
docstrings and declares
2 files changed, 9 insertions, 2 deletions
diff --git a/core/libexec/declares.lisp b/core/libexec/declares.lisp
index 77024c6..bfbf49c 100644
--- a/core/libexec/declares.lisp
+++ b/core/libexec/declares.lisp
@@ -39,6 +39,7 @@
(ftype (function (list) (values null &optional)) wash)
(ftype (function (base-character) (values cons &optional)) go-to-sleep%)
(ftype (function (base-character) (values boolean &optional)) handle-faint)
+ (ftype (function (base-character boolean) (values boolean &optional)) handle-status-effects)
(ftype (function (list symbol symbol) (values action &optional)) getf-action-from-prop)
(ftype (function (&key (:attack (or symbol boolean)) (:item item) (:reload type-specifier) (:no-team-attack t)
(:selected-target (or null enemy team-member))))
diff --git a/core/libexec/functions.lisp b/core/libexec/functions.lisp
index 37dcbbe..1843ddb 100644
--- a/core/libexec/functions.lisp
+++ b/core/libexec/functions.lisp
@@ -612,6 +612,8 @@
(iter (for i in a)
(finding i maximizing (get-diaper-expansion i)))))
(defun handle-faint (character)
+ "Checks if @var{CHARACTER} fainted and returns T if so. Also handles @code{(FAINTED-OF *BATTLE*)} as a side effect."
+ (declare (type base-character character))
(let ((faintedp (member character (fainted-of *battle*))))
(cond ((and (<= (health-of character) 0) (not faintedp))
(f:fmt t (name-of character) " has fainted" #\Newline)
@@ -622,7 +624,10 @@
(setf (fainted-of *battle*) (s:delq character (fainted-of *battle*)))
(t (and faintedp t)))))
-(defun handle-status-effects (character &optional battle)
+(defun handle-status-effects (character battle)
+ "Returns true if @var{CHARACTER} fainted and false if not, but only if in @var{BATTLE}, otherwise unspecified"
+ (declare (type base-character character)
+ (type boolean battle))
(iter (for i in (status-conditions-of character))
(when (or (eq (duration-of i) t) (> (duration-of i) 0))
(condition-script character i battle)
@@ -636,7 +641,8 @@
(let ((faintedp (handle-faint character)))
(process-potty character battle)
- (process-potty character battle)))
+ (progn (process-potty character battle)
+ nil)))
(defun move-to-zone (new-position &key ignore-lock direction old-position)
(declare (type list new-position old-position)
(type symbol direction))