package org.leumasjaffe.charsheet.model.magic; import java.util.Collection; import java.util.List; import org.leumasjaffe.observer.Observable; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; import lombok.NonNull; @JsonTypeInfo(use = Id.MINIMAL_CLASS) public abstract class DDSpellbook extends Observable.Instance { @NonNull public abstract Collection spellsKnownAtLevel( int level ); @NonNull public abstract List spellsPreparedAtLevel( int level ); @NonNull public List getSpellsPreparedPreviouslyForLevel(int level) { return spellsPreparedAtLevel(level); } public boolean learnsSpells() { return false; } public boolean preparesSpells() { return false; } @JsonIgnore public int getSharedAllowedSlots() { return -1; } public int numSpellsKnownAtLevel( int level ) { return spellsKnownAtLevel( level ).size(); } public abstract int numSpellsPerDayAtLevel( int level ); public int numSpellsPerDayRemainingAtLevel(int level) { return spellsPreparedAtLevel( level ).size(); } public abstract void castSpell( int level, final DDSpell spell ); public void learnSpells(int level, Collection known) { throw new UnsupportedOperationException("This class does not have a list of known spells to edit"); } public abstract void prepareSpells(int level, Collection collection); }