|
|
@@ -1,9 +1,9 @@
|
|
|
package org.leumasjaffe.charsheet.model;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Optional;
|
|
|
import java.util.stream.Collectors;
|
|
|
-import java.util.stream.IntStream;
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
|
import org.leumasjaffe.charsheet.model.features.DDProperty;
|
|
|
@@ -77,11 +77,17 @@ public class DDCharacterClass extends Observable.Instance implements Comparable<
|
|
|
secondary.map(Stream::of).orElse(Stream.empty())).toArray(DDSpellbook[]::new);
|
|
|
}
|
|
|
|
|
|
+ public void setSecondary(DDSpellbook book) {
|
|
|
+ assert(!secondary.isPresent());
|
|
|
+ secondary = Optional.of(book);
|
|
|
+ }
|
|
|
+
|
|
|
DDSpellbook main;
|
|
|
Optional<DDSpellbook> secondary = Optional.empty();
|
|
|
}
|
|
|
|
|
|
Optional<DDSpellbookWrapper> spellBook;
|
|
|
+ @Getter(AccessLevel.PRIVATE) List<DDProperty> features = new ArrayList<>();
|
|
|
|
|
|
public DDCharacterClass(String name) {
|
|
|
this.level = new IntValue(0);
|
|
|
@@ -141,9 +147,16 @@ public class DDCharacterClass extends Observable.Instance implements Comparable<
|
|
|
}
|
|
|
|
|
|
public List<DDProperty> getFeatureBonuses(Object appliesScope) {
|
|
|
- return IntStream.rangeClosed(1, level.value())
|
|
|
- .mapToObj(level -> name.base.getFeatures(level).stream())
|
|
|
- .reduce(Stream.empty(), (l, r) -> Stream.concat(l, r))
|
|
|
- .filter(p -> p.appliesTo(appliesScope)).collect(Collectors.toList());
|
|
|
+ return this.features.stream().filter(p -> p.appliesTo(appliesScope)).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
+ @SuppressWarnings("unused")
|
|
|
+ private void setFeatures(List<DDProperty> feats) {
|
|
|
+ this.features.clear();
|
|
|
+ this.features.addAll(feats);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void addFeature(DDProperty ddProperty) {
|
|
|
+ this.features.add(ddProperty);
|
|
|
}
|
|
|
}
|