From 1aa4f340d158be5c7aca2b47c41ddacb2ecc5f95 Mon Sep 17 00:00:00 2001 From: lieren2023 <131325076+lieren2023@users.noreply.github.com> Date: Sat, 23 Mar 2024 08:51:03 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E5=A4=8D=E6=97=A0?= =?UTF-8?q?=E7=A9=B7=E4=BD=93=E5=8A=9B=E3=80=81=E4=BD=93=E5=8A=9B=E4=B8=8A?= =?UTF-8?q?=E9=99=90=E3=80=81=E6=8A=A4=E7=94=B2=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- noname/get/index.js | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/noname/get/index.js b/noname/get/index.js index f30dbe47e..f3a59caf8 100644 --- a/noname/get/index.js +++ b/noname/get/index.js @@ -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; }