;; derived-index-functions.lisp --- Part of srd-tools ;; Copyright (C) 2008 Clinton Ebadi ;; Author: Clinton Ebadi ;; This program is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . (in-package :org.unknownlamer.dnd-tools) (defun player-level->player-class-indexer (player-level) (cons (level-class player-level) (player-level player-level))) (defun spell-level->caster-class-indexer (spell-level) (cons (level-class (caster-level spell-level)) (spell-level spell-level))) (defun spell-level->player-class-indexer (spell-level) (level-class (caster-level spell-level))) (defclass spell-level<->spell () ((spell :initarg :spell :accessor spell :index t) (level :initarg :level :accessor spell-level :index t)) (:metaclass persistent-metaclass)) (defun update-spell-level<->spell-index (spell) (drop-instances (get-instances-by-value 'spell-level<->spell 'spell spell)) (map-pset (lambda (level) (make-instance 'spell-level<->spell :spell spell :level level)) (spell-levels spell)))