refactor: dynamic...

This commit is contained in:
Rintim 2023-12-22 22:09:02 +08:00
parent b4ef8dac2c
commit 9973c8f2ba
No known key found for this signature in database
GPG Key ID: BE9E1EA615BACFCF
1 changed files with 10 additions and 10 deletions

View File

@ -7273,11 +7273,11 @@ export class Game extends Uninstantable {
ui.window.appendChild(event.nodes[i]); ui.window.appendChild(event.nodes[i]);
} }
'step 1' 'step 1'
var rand = event.config.first; let rand1 = event.config.first;
if (rand == 'rand') { if (rand1 == 'rand') {
rand = (Math.random() < 0.5); rand1 = (Math.random() < 0.5);
} }
if (rand) { if (rand1) {
_status.color = true; _status.color = true;
event.side = 1; event.side = 1;
} }
@ -7394,17 +7394,17 @@ export class Game extends Uninstantable {
event.avatars[i].classList.add('selecting'); event.avatars[i].classList.add('selecting');
} }
} }
var rand = []; let rand2 = [];
for (let i = 0; i < event.config.width; i++) { for (let i = 0; i < event.config.width; i++) {
for (let j = 0; j < event.config.width - i; j++) { for (let j = 0; j < event.config.width - i; j++) {
rand.push(i); rand2.push(i);
} }
} }
for (let i = 0; i < event.config.num; i++) { for (let i = 0; i < event.config.num; i++) {
let rand2 = rand.randomGet(); let rand2 = rand2.randomGet();
for (let j = 0; j < rand.length; j++) { for (let j = 0; j < rand2.length; j++) {
if (rand[j] == rand2) { if (rand2[j] == rand2) {
rand.splice(j--, 1); rand2.splice(j--, 1);
} }
} }
event.enemylist.push(event.enemy[rand2]); event.enemylist.push(event.enemy[rand2]);