DDSpellbook.java 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package org.leumasjaffe.charsheet.model.magic;
  2. import java.util.Collection;
  3. import java.util.List;
  4. import org.leumasjaffe.observer.Observable;
  5. import com.fasterxml.jackson.annotation.JsonIgnore;
  6. import com.fasterxml.jackson.annotation.JsonTypeInfo;
  7. import com.fasterxml.jackson.annotation.JsonTypeInfo.Id;
  8. import lombok.NonNull;
  9. @JsonTypeInfo(use = Id.MINIMAL_CLASS)
  10. public abstract class DDSpellbook extends Observable.Instance {
  11. @NonNull public abstract Collection<DDSpell> spellsKnownAtLevel( int level );
  12. @NonNull public abstract List<DDSpell> spellsPreparedAtLevel( int level );
  13. @NonNull public List<DDSpell> getSpellsPreparedPreviouslyForLevel(int level) { return spellsPreparedAtLevel(level); }
  14. public boolean learnsSpells() { return false; }
  15. public boolean preparesSpells() { return false; }
  16. @JsonIgnore public int getSharedAllowedSlots() {
  17. return -1;
  18. }
  19. public int numSpellsKnownAtLevel( int level ) {
  20. return spellsKnownAtLevel( level ).size();
  21. }
  22. public abstract int numSpellsPerDayAtLevel( int level );
  23. public int numSpellsPerDayRemainingAtLevel(int level) {
  24. return spellsPreparedAtLevel( level ).size();
  25. }
  26. public abstract void castSpell( int level, final DDSpell spell );
  27. public void learnSpells(int level, Collection<DDSpell> known) {
  28. throw new UnsupportedOperationException("This class does not have a list of known spells to edit");
  29. }
  30. public abstract void prepareSpells(int level, Collection<DDSpell> collection);
  31. }