add event grade

This commit is contained in:
Vick Scarlet
2021-12-14 19:03:37 +08:00
parent ab705dd46c
commit 8eb8c3ca72
4 changed files with 7 additions and 6 deletions

View File

@@ -44,12 +44,12 @@ class Event {
}
do(eventId, property) {
const { effect, branch, event: description, postEvent } = this.get(eventId);
const { effect, branch, event: description, postEvent, grade } = this.get(eventId);
if(branch)
for(const [cond, next] of branch)
if(checkCondition(property, cond))
return { effect, next, description };
return { effect, postEvent, description };
return { effect, next, description, grade };
return { effect, postEvent, description, grade };
}
}

View File

@@ -142,13 +142,14 @@ class Life {
}
doEvent(eventId) {
const { effect, next, description, postEvent } = this.#event.do(eventId, this.#property);
const { effect, next, description, postEvent, grade } = this.#event.do(eventId, this.#property);
this.#property.change(this.PropertyTypes.EVT, eventId);
this.#property.effect(effect);
const content = {
type: this.PropertyTypes.EVT,
description,
postEvent,
grade,
}
if(next) return [content, this.doEvent(next)].flat();
return [content];