This commit is contained in:
shenjack 2024-03-18 22:42:56 +08:00
parent 6a3a9098a4
commit 5e8d35cd38
Signed by: shenjack
GPG Key ID: 7B1134A979775551
2 changed files with 23 additions and 16 deletions

View File

@ -12337,7 +12337,9 @@
async_goto = 6
break
case 8:
if (C.Array.w(o, n.a(f.a[0]).e.gb2())) ++p.win_count;
if (C.Array.w(o, n.a(f.a[0]).e.gb2())) {
++p.win_count
};
++i;
++p.current_count
async_goto = 3
@ -12360,6 +12362,7 @@
}
q = new T.aq(n, l)
// 当前场次, 目标场次, 胜率
output(p.current_count, p.target_count, p.win_count * 100 / p.current_count)
//捕获胜率
if (p.current_count >= config[stage].count) {

View File

@ -1,26 +1,28 @@
const { JSDOM } = require('jsdom');
const jsdom=require('jsdom');
const {
JSDOM
} = require('jsdom');
const jsdom = require('jsdom');
const fs = require('fs');
const path = require('path');
async function test(str){
async function test(str) {
const localStorageMock = {
setItem: function (key, value) {
this[key] = value;
this[key] = value;
},
getItem: function (key) {
return this[key] || null;
return this[key] || null;
},
removeItem: function (key) {
delete this[key];
delete this[key];
},
clear: function () {
for (const key in this) {
if (this.hasOwnProperty(key) && key !== 'setItem' && key !== 'getItem' && key !== 'removeItem' && key !== 'clear') {
delete this[key];
for (const key in this) {
if (this.hasOwnProperty(key) && key !== 'setItem' && key !== 'getItem' && key !== 'removeItem' && key !== 'clear') {
delete this[key];
}
}
}
}
};
// 在你的 JSDOM 初始化代码之前
let resolvePromise;
@ -32,12 +34,15 @@ async function test(str){
const virtualConsole = new jsdom.VirtualConsole();
const dom = new JSDOM(fs.readFileSync(path.join(__dirname, 'static/md5.html'), 'utf-8'), {
url: 'file://' + path.join(__dirname, 'static/'),
console:virtualConsole,
console: virtualConsole,
runScripts: 'dangerously',
resources: 'usable',
beforeParse(window) {
window.FakelocalStorage = localStorageMock;
window.config =[{"count":11000,"score":10}];
window.config = [{
"count": 12000,
"score": 10
}];
window.name_input = str;
window.stage = 0;
window.skillData = [];
@ -62,6 +67,5 @@ async function test(str){
//str="!test!\n!\n\n11@qwerb\n\n1233";
str="!test!\n!\n\n11@qwerb\n\n1233";
str = "!test!\n!\n\n11@qwerb\n\n1233";
test(str)