|
@@ -3,16 +3,11 @@ package org.leumasjaffe.charsheet.model.magic.impl;
|
|
|
import java.util.Collection;
|
|
import java.util.Collection;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
import org.leumasjaffe.charsheet.model.DDClass;
|
|
import org.leumasjaffe.charsheet.model.DDClass;
|
|
|
import org.leumasjaffe.charsheet.model.magic.DDSpell;
|
|
import org.leumasjaffe.charsheet.model.magic.DDSpell;
|
|
|
-import org.leumasjaffe.charsheet.model.magic.DDSpellFactory;
|
|
|
|
|
import org.leumasjaffe.charsheet.model.magic.DDSpellbook;
|
|
import org.leumasjaffe.charsheet.model.magic.DDSpellbook;
|
|
|
|
|
|
|
|
-import com.fasterxml.jackson.annotation.JsonCreator;
|
|
|
|
|
-import com.fasterxml.jackson.annotation.JsonProperty;
|
|
|
|
|
-
|
|
|
|
|
import lombok.AccessLevel;
|
|
import lombok.AccessLevel;
|
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.NonNull;
|
|
import lombok.NonNull;
|
|
@@ -22,17 +17,11 @@ import lombok.experimental.NonFinal;
|
|
|
@AllArgsConstructor
|
|
@AllArgsConstructor
|
|
|
@FieldDefaults(level=AccessLevel.PRIVATE, makeFinal=true)
|
|
@FieldDefaults(level=AccessLevel.PRIVATE, makeFinal=true)
|
|
|
public class Inspired implements DDSpellbook {
|
|
public class Inspired implements DDSpellbook {
|
|
|
|
|
+ @AllArgsConstructor
|
|
|
@FieldDefaults(level=AccessLevel.PRIVATE, makeFinal=true)
|
|
@FieldDefaults(level=AccessLevel.PRIVATE, makeFinal=true)
|
|
|
private static class Level {
|
|
private static class Level {
|
|
|
@NonNull List<DDSpell> spellsPrepared;
|
|
@NonNull List<DDSpell> spellsPrepared;
|
|
|
@NonFinal int spellsPerDay;
|
|
@NonFinal int spellsPerDay;
|
|
|
-
|
|
|
|
|
- @JsonCreator
|
|
|
|
|
- Level(@JsonProperty("spellsPerDay") int spellsPerDay,
|
|
|
|
|
- @JsonProperty("spellsPrepared") List<String> spellsPrepared) {
|
|
|
|
|
- this.spellsPerDay = spellsPerDay;
|
|
|
|
|
- this.spellsPrepared = spellsPrepared.stream().map(s -> DDSpellFactory.loadSpell(s)).collect(Collectors.toList());
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private static class ClassReference {
|
|
private static class ClassReference {
|
|
@@ -63,7 +52,7 @@ public class Inspired implements DDSpellbook {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public List<DDSpell> spellsPreparedAtLevel(int level) {
|
|
public List<DDSpell> spellsPreparedAtLevel(int level) {
|
|
|
- return spellInfo.size() <= level ? null : spellInfo.get( level ).spellsPrepared;
|
|
|
|
|
|
|
+ return spellInfo.get( level ).spellsPrepared;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|