blob: 4538c75ef51bd3a331bf200d60fa1e24770643cb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
;;;; queries.lisp -- query the database
(in-package :dnd)
(defun all-heroes ()
(db:store-objects-with-class 'hero))
(defun player-campaigns (player)
"Return a list of campaigns that that player is involved in."
(remove nil (mapcar #'hero-campaign (player-heroes player))))
(defun campaign-heros (campaign &key (activep t))
"All the heros actively involved in this CAMPAIGN. If ACTIVEP, then
only the active quest(s) are considered, otherwise all quests are considered."
(remove-duplicates
(mapcan #'heroes-on-quest
(if activep
(remove-if-not #'quest-startedp (quests-in-campaign campaign))
(quests-in-campaign campaign)))))
(defun fetch-comrades (player &key (activep t))
"Returns all the heroes in any one of the player's campaigns. If
ACTIVEP, then only heroes involved in active quests are returned."
(remove-duplicates
(loop :for campaign :in (player-campaigns player)
:nconc (campaign-heros campaign :activep activep))))
|