allow viewing current attributes during trajectory[sic]

补上了查看当前属性的功能。
命令行端的功能现在应该和 web 端差不多了。
||为什么要给查看当前属性的功能取 getLastRecord 这样奇怪的名字||
This commit is contained in:
Nathan Du
2021-10-02 15:04:19 +08:00
committed by 神戸小鳥
parent 70d0b4460a
commit 79e21a1156

View File

@@ -134,7 +134,7 @@ class App {
case '/alloc':
case '/allocate':
case '/attrib':
case '/attribute': return this.alloc(...command);
case '/attribute': return this.attrib(...command);
case 'rd':
case 'random':
@@ -516,6 +516,31 @@ class App {
return total - CHR - INT - STR - MNY;
}
attrib(tag, value) {
switch (this.#step) {
case this.Steps.PROPERTY:
return this.alloc(tag, value);
case this.Steps.TRAJECTORY:
return this.viewProperty();
default:
return undefined;
}
}
viewProperty() {
let property = this.#life.getLastRecord();
return `当前属性
属性(TAG) 当前值
颜值(CHR) ${property.CHR}
智力(INT) ${property.INT}
体质(STR) ${property.STR}
家境(MNY) ${property.MNY}
快乐(SPR) ${property.SPR}`
}
alloc(tag, value) {
const warn = str => `${this.prop()}\n${this.style('warn', str)}`
if(!value) return warn('⚠ 分配的数值没有给定');