mirror of
https://github.com/VickScarlet/lifeRestart.git
synced 2025-07-19 18:43:55 +08:00
allow viewing current attributes during trajectory[sic]
补上了查看当前属性的功能。 命令行端的功能现在应该和 web 端差不多了。 ||为什么要给查看当前属性的功能取 getLastRecord 这样奇怪的名字||
This commit is contained in:
27
repl/app.js
27
repl/app.js
@@ -134,7 +134,7 @@ class App {
|
|||||||
case '/alloc':
|
case '/alloc':
|
||||||
case '/allocate':
|
case '/allocate':
|
||||||
case '/attrib':
|
case '/attrib':
|
||||||
case '/attribute': return this.alloc(...command);
|
case '/attribute': return this.attrib(...command);
|
||||||
|
|
||||||
case 'rd':
|
case 'rd':
|
||||||
case 'random':
|
case 'random':
|
||||||
@@ -516,6 +516,31 @@ class App {
|
|||||||
return total - CHR - INT - STR - MNY;
|
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) {
|
alloc(tag, value) {
|
||||||
const warn = str => `${this.prop()}\n${this.style('warn', str)}`
|
const warn = str => `${this.prop()}\n${this.style('warn', str)}`
|
||||||
if(!value) return warn('⚠ 分配的数值没有给定');
|
if(!value) return warn('⚠ 分配的数值没有给定');
|
||||||
|
Reference in New Issue
Block a user