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