Browse Source

加入生成版面状态

tags/v26.0
枫谷剑仙 3 years ago
parent
commit
a1ae2577c9
1 changed files with 11 additions and 1 deletions
  1. +11
    -1
      script-skill-parser.js

+ 11
- 1
script-skill-parser.js View File

@@ -283,8 +283,18 @@ class Board2
}
}
//生成版面状态
generateBlockStates(blockState, count = 1, size = [1,1], position = [1,1])
generateBlockStates(blockState, count = 1, size = [1,1], position = [0, 0])
{
for (let i=0; i<count; i++) {
let [width, height] = size, [x, y] = position;
if (!x) x = Math.randomInteger(this.columnCount - width); else x--;
if (!y) y = Math.randomInteger(this.rowCount - height); else y--;
for (let hi=0; hi<height; hi++) {
for (let wi=0; wi<height; wi++) {
this.setOrbAndBlock(null, this.blocksData[hi][wi], null, null, blockState);
}
}
}
}
//导出数组
valueOf()


Loading…
Cancel
Save