From 9df076d76c6aa3f8663edf1f2dfe6871d31134fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20Kra=C3=9Fmann?= Date: Sun, 26 Jan 2025 22:39:08 +0100 Subject: [PATCH] wip: Improved Cinderella skill --- scripts/com.r2studio.TsumBeta/src/index.js | 42 +++++++++++++--------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/scripts/com.r2studio.TsumBeta/src/index.js b/scripts/com.r2studio.TsumBeta/src/index.js index fee23040..1db9aa5a 100644 --- a/scripts/com.r2studio.TsumBeta/src/index.js +++ b/scripts/com.r2studio.TsumBeta/src/index.js @@ -1789,7 +1789,8 @@ Tsum.prototype.goTsumTsumStorePage = function() { } } -Tsum.prototype.clearAllBubbles = function(startDelay, endDelay, fromY) { +Tsum.prototype.clearAllBubbles = function(startDelay, endDelay, fromY, delayBetweenLines) { + delayBetweenLines = delayBetweenLines || 0; if (typeof startDelay === 'number' && startDelay > 0) { this.sleep(startDelay); } @@ -1803,6 +1804,7 @@ Tsum.prototype.clearAllBubbles = function(startDelay, endDelay, fromY) { for (var bx = Button.gameBubblesFrom.x; bx <= Button.gameBubblesTo.x; bx += 140) { this.tap({x: bx, y: by}, 10); } + this.sleep(delayBetweenLines); } if (typeof endDelay === 'number' && endDelay > 0) { @@ -1810,19 +1812,29 @@ Tsum.prototype.clearAllBubbles = function(startDelay, endDelay, fromY) { } } -Tsum.prototype.useCinderellaSkill = function(board) { - var size = this.skillLevel + 6; - board.sort(function(a, b) { - return a.y - b.y; - }); - var paths = convertTo2DArray(board, size); - for (var i = 0; i < paths.length - 1; i++) { - var path = paths[i]; - path.sort(function(a, b) { - return a.x - b.x; - }); - this.linkTsums(path); +Tsum.prototype.useCinderellaSkill = function() { + var path, offset, y; + for (var i = 0; i < 5; i += 1) { + for (offset = 0; offset <= 200; offset += 200) { + path = []; + for (y = 170; y >= 70; y -= 20) + path.push({x: Math.abs(offset - 10), y: y}); + + for (y = 60; y <= 180; y += 20) + path.push({x: Math.abs(offset - 40), y: y}); + + for (y = 180; y >= 60; y -= 20) + path.push({x: Math.abs(offset - 70), y: y}); + + for (y = 60; y <= 180; y += 20) + path.push({x: Math.abs(offset - 100), y: y}); + + debug("Cinderella i =", i, ", offset =", offset); + this.linkTsums(path); + } } + this.sleep(3000); + this.clearAllBubbles(10, 50, (Button.gameBubblesFrom.y + Button.gameBubblesTo.y) / 2, 200); } Tsum.prototype.useSkill = function(board) { @@ -1956,10 +1968,6 @@ Tsum.prototype.useSkill = function(board) { } else if(this.skillType === 'block_cinderella_s') { this.sleep(1500); this.useCinderellaSkill(board); - this.sleep(500); - board = this.scanBoardQuick(); - this.useCinderellaSkill(board); - this.clearAllBubbles(2500, 50); } else if(this.skillType === 'block_woody2_s'){ this.sleep(1800); this.tapDown({x: 540, y: 960}, 20);