Fix incorrect filtering of effect sources.
This commit is contained in:
4
User.ts
4
User.ts
@ -7,8 +7,8 @@ const DEFAULT_PROMPT = ">";
|
|||||||
export default class User {
|
export default class User {
|
||||||
#prompt: string;
|
#prompt: string;
|
||||||
|
|
||||||
constructor(prompt: string) {
|
constructor(prompt: string = DEFAULT_PROMPT) {
|
||||||
this.#prompt = prompt || DEFAULT_PROMPT;
|
this.#prompt = prompt;
|
||||||
}
|
}
|
||||||
|
|
||||||
ask(question: string): string {
|
ask(question: string): string {
|
||||||
|
17
Vessel.ts
17
Vessel.ts
@ -35,15 +35,14 @@ export default class Vessel<T extends VesselProperties> {
|
|||||||
activePlayerEffects: string[],
|
activePlayerEffects: string[],
|
||||||
activeSceneEffects: string[]
|
activeSceneEffects: string[]
|
||||||
): T {
|
): T {
|
||||||
const activeEffects = [...activePlayerEffects, ...activeSceneEffects];
|
const playerSet = new Set(activePlayerEffects);
|
||||||
const map = this._conditions.effects.reduce(
|
const sceneSet = new Set(activeSceneEffects);
|
||||||
(map: { [name: string]: Effect<T> }, effect: Effect<T>) => {
|
|
||||||
map[effect.name] = effect;
|
const effects = this._conditions.effects.filter(({ name, source }) => {
|
||||||
return map;
|
const set = source === "player" ? playerSet : sceneSet;
|
||||||
},
|
return set.has(name);
|
||||||
{}
|
});
|
||||||
);
|
|
||||||
const effects = activeEffects.map((e) => map[e]);
|
|
||||||
const appliedProperties = { ...this._properties };
|
const appliedProperties = { ...this._properties };
|
||||||
|
|
||||||
// for each effect, apply changed properties to the
|
// for each effect, apply changed properties to the
|
||||||
|
@ -35,7 +35,7 @@ export const hall: StoryScene<SceneProperties> = {
|
|||||||
effect: "flashlight-on",
|
effect: "flashlight-on",
|
||||||
|
|
||||||
// can be "player" or "scene"
|
// can be "player" or "scene"
|
||||||
applyTo: "scene",
|
applyTo: "player",
|
||||||
|
|
||||||
// When it's used, this is what should be reported back to
|
// When it's used, this is what should be reported back to
|
||||||
// the user.
|
// the user.
|
||||||
|
Reference in New Issue
Block a user