New source found from dndbeyond.com
This commit is contained in:
@@ -15,27 +15,10 @@ import { FeatAccessors, FeatSimulators } from "../engine/Feat";
|
||||
import { HelperUtils } from "../engine/Helper";
|
||||
import { featDefinitionMap, getFeatManager } from "./FeatManager";
|
||||
import { apiCreatorSelectors, rulesEngineSelectors } from "../selectors";
|
||||
import { FeaturesManager } from './FeaturesManager';
|
||||
export class CharacterFeaturesManager extends FeaturesManager {
|
||||
import { BaseManager } from './BaseManager';
|
||||
export class CharacterFeaturesManager extends BaseManager {
|
||||
constructor(params) {
|
||||
super(params);
|
||||
//TODO GFS THIS!!!!
|
||||
this.getBlessings = () => __awaiter(this, void 0, void 0, function* () {
|
||||
// TODO get the blessings only?
|
||||
/**
|
||||
* this could be on the character obj under blessings key
|
||||
*/
|
||||
const blessingManagers = yield this.getCharacterFeatures();
|
||||
this.blessingManagers = blessingManagers;
|
||||
return blessingManagers;
|
||||
});
|
||||
this.getBlessing = (id) => { var _a; return (_a = this.blessingManagers.find((blessing) => id === blessing.getId())) !== null && _a !== void 0 ? _a : null; };
|
||||
// TODO is there value in moving these to hasFeatures and hasBlessings
|
||||
this.hasBlessings = () => __awaiter(this, void 0, void 0, function* () {
|
||||
const blessings = yield this.getBlessings();
|
||||
return blessings.length > 0;
|
||||
});
|
||||
this.hasBlessing = (blessing) => !!this.blessingManagers.find((characterBlessing) => characterBlessing.getId() === blessing.getId());
|
||||
this.handlePreferenceChange = (preferenceKey, value) => {
|
||||
const typedPrefKey = CharacterUtils.getPreferenceKey(preferenceKey);
|
||||
if (typedPrefKey !== null) {
|
||||
@@ -43,7 +26,6 @@ export class CharacterFeaturesManager extends FeaturesManager {
|
||||
}
|
||||
};
|
||||
this.params = params;
|
||||
this.blessingManagers = [];
|
||||
}
|
||||
mapFeatsToManagers(feats) {
|
||||
return feats.map((feat) => getFeatManager(Object.assign(Object.assign({}, this.params), { feat })));
|
||||
@@ -127,16 +109,6 @@ export class CharacterFeaturesManager extends FeaturesManager {
|
||||
return [];
|
||||
});
|
||||
}
|
||||
getBlessingShoppe(additionalConfig) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const blessings = yield this.getFeaturesShoppe({
|
||||
params: {
|
||||
category: 'blessing',
|
||||
},
|
||||
});
|
||||
return orderBy(blessings, (blessing) => blessing.getName());
|
||||
});
|
||||
}
|
||||
//UTILS
|
||||
// filter to only allow one of each simulated repeatable feat group
|
||||
filterUniqueSimulatedRepeatableFeats(feats, parentFeats) {
|
||||
|
||||
Reference in New Issue
Block a user