Attack Separator Script

separates attack into attack from self-created lines and attack from garbage lines

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         Attack Separator Script
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  separates attack into attack from self-created lines and attack from garbage lines
// @author       Oki
// @match        https://*.jstris.jezevec10.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    window.addEventListener('load', function(){

/**************************
   Attack Separator Script
**************************/

var trim=a=>{a=a.slice(0,-1);a=a.substr(a.indexOf("{")+1);return a}

if(typeof Game == "undefined"){

    var oldFunc2 = Replayer.prototype.checkLineClears.toString()
    oldFunc2 = "rows0=0;rows1=0;" + trim(oldFunc2)
    
    oldFunc2 = oldFunc2.split("=== 10){for(var ")
    var rowVar = oldFunc2[1].split("=")[1].split(";")[0]
    oldFunc2 = oldFunc2.join('=== 10){eval("rows"+ +(JSON.stringify(this.matrix['+rowVar+']).indexOf(8)<0)+"++");for(var ')
    
    var oldTextBar = View.prototype.updateTextBar.toString()
    oldTextBar = oldTextBar.replace("this.sentElement.innerHTML=this.g.gamedata.lines,","")
    oldTextBar = oldTextBar.replace("this.sentElement.innerHTML=this.g.gamedata.linesSent","")
    
    oldTextBar = trim(oldTextBar)
    
    oldFunc2 = oldFunc2.split("+=")
    var sum = oldFunc2[oldFunc2.length-1].split(";")[0]
    oldFunc2[oldFunc2.length-1] = sum+';distr=[rows1/(rows0+rows1),(rows0/(rows0+rows1))].map(x=>x*('+sum+'));var sentHTML=this.v.sentElement.innerHTML.split("/");if(sentHTML!=0){distr[0]+= +sentHTML[0];distr[1]+= +sentHTML[1]};this.v.sentElement.innerHTML=distr[0].toFixed(2)+" / "+distr[1].toFixed(2);' + oldFunc2[oldFunc2.length-1]
    oldFunc2 = oldFunc2.join`+=`
    
    View.prototype.onReady = function(){this.setupMode(),this.updateQueueBox(),this.redrawHoldBox(),this.clearMainCanvas(),this.sentElement.innerHTML=0}
    View.prototype.updateTextBar = new Function(oldTextBar);
    Replayer.prototype.checkLineClears = new Function(oldFunc2);

} else {

    var oldFunc = Game.prototype.checkLineClears.toString()
    oldFunc = "var rows0=0;var rows1=0;" + trim(oldFunc)
    
    oldFunc = oldFunc.split(")};for(")
    var rowVar = oldFunc[0].split("(")[oldFunc[0].split("(").length-1]
    oldFunc = oldFunc.join(')};eval("rows"+ +(JSON.stringify(this.matrix['+rowVar+']).indexOf(8)<0)+"++");var oldSent=this.gamedata.linesSent;for(')
    var split = oldFunc.split("> 0){this[_")
    var inject = 'var distr=[rows1/(rows0+rows1),(rows0/(rows0+rows1))].map(x=>x*(this.gamedata.linesSent-oldSent));var sentHTML=this.sentElement.innerHTML.split("/");if(sentHTML!=0){distr[0]+= +sentHTML[0];distr[1]+= +sentHTML[1]};this.sentElement.innerHTML=distr[0].toFixed(2)+" / "+distr[1].toFixed(2);'
    
    split[3] = split[3].replace("=","*/")
    split[3] = split[3].replace(")",");"+inject)
    for (var i = 0; i < split.length-1; i++) {
        split[i] += (i==2) ? "> 0){/*this[_" : "> 0){this[_"
    }
    
    oldFunc = split.join``
    Game.prototype.checkLineClears = new Function(oldFunc);
}

    });
})();