Merge pull request #1122 from lieren2023/lieren2023-patch-8

fix:完善无穷体力、体力上限、护甲显示
This commit is contained in:
Spmario233 2024-03-23 11:47:19 +08:00 committed by GitHub
commit b9dd053e3a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 29 additions and 7 deletions

View File

@ -322,24 +322,46 @@ export class Get extends Uninstantable {
}
static infoHp(hp) {
if (typeof hp == 'number') return hp;
else if (typeof hp == 'string' && hp.includes('/')) {
const num = hp.split('/')[0];
if (num) return num == 'Infinity' ? Infinity : parseInt(num);
else if (typeof hp == 'string') {
if (hp.includes('/')) {
const num = hp.split('/')[0];
if (num) {
if (num == 'Infinity' || num == '∞') {
return Infinity;
} else {
return parseInt(num);
}
}
} else if (hp == 'Infinity' || hp == '∞') return Infinity;
}
return 0;
}
static infoMaxHp(hp) {
if (typeof hp == 'number') return hp;
else if (typeof hp == 'string' && hp.includes('/')) {
const num = hp.split('/')[1];
if (num) return num == 'Infinity' ? Infinity : parseInt(num);
else if (typeof hp == 'string') {
if (hp.includes('/')) {
const num = hp.split('/')[1];
if (num) {
if (num == 'Infinity' || num == '∞') {
return Infinity;
} else {
return parseInt(num);
}
}
} else if (hp == 'Infinity' || hp == '∞') return Infinity;
}
return 0;
}
static infoHujia(hp) {
if (typeof hp == 'string' && hp.includes('/')) {
const num = hp.split('/')[2];
if (num) return num == 'Infinity' ? Infinity : parseInt(num);
if (num) {
if (num == 'Infinity' || num == '∞') {
return Infinity;
} else {
return parseInt(num);
}
}
}
return 0;
}