瞬駈天魔のツクール素材製作所

月額支援サイトファンティアを追加しました!
是非、無料ファンでも励みになりますので宜しくお願い致します!m(__)m

[データ丸投げ!]スロットプラグイン編集版 (※文字数制限に伴い、後半部)

2018年05月18日 02時50分00秒 | ツクール日記

Scene_SlotMachine.prototype.spinCommand = function () { this._coin -= this._bet * scale; this._slotCommandWindow.deactivate(); this._slotCommandWindow.close(); this._helpWindow.close(); this._winSpot = this.drawLot(); var t = ""; var i; for (i = 0; i < 5; i++) { t += reel[i][this._winSpot[i]]; } this._rollCount++; //Interval Spin //this._currentStartingReel = 0; //this._startingTimer = setInterval(function(){ // this._reels[this._currentStartingReel].spin(); // this._currentStartingReel++; // console.log("this._currentStartingReel", this._currentStartingReel) // if (this._currentStartingReel > 4) { // clearInterval(this._startingTimer); // this._startingTimer = null; // } //}.bind(this), 200); this._spinStart = true; this._reels[0].setWinSpot(this._winSpot[0]); this._reels[1].setWinSpot(this._winSpot[1]); this._reels[2].setWinSpot(this._winSpot[2]); this._reels[3].setWinSpot(this._winSpot[3]); this._reels[4].setWinSpot(this._winSpot[4]); for (i = 0; i < 5; i++) { this._reels[i].spin(); } }; Scene_SlotMachine.prototype.result = function () { this._rollCount = 0; var win, tmp; win = this.judge(this._winSpot); tmp = win; if (this._coin + win > Scene_SlotMachine.COIN_MAX_VALUE) { win = Scene_SlotMachine.COIN_MAX_VALUE - this._coin; } this._winCoin = this._correctCoin = win; var time = 60 * 10; if (this._winCoin < time) { this._winStep = 1; } else { this._winStep = this._winCoin / time >> 0; } if (this._winCoin > 0) { this._winMessage = winMessage; var reg = /Win Coin/gi; this._winMessage = this._winMessage.replace(reg, String(tmp)); this._helpWindow.setText(this._winMessage); this._helpWindow.open(); AudioManager.playMe({"name": "Victory1", "volume": 90, "pitch": 100, "pan": 0}); } else { this._helpWindow.setText(lostMessage + '\n' + replayMessage); this._helpWindow.open(); this._replayCommandWindow.open(); this._replayCommandWindow.activate(); } }; Scene_SlotMachine.prototype.judge = function (spot) { var result1 = []; result1.push(reel[0][(spot[0] + 1) % reel[0].length]); result1.push(reel[1][(spot[1] + 1) % reel[1].length]); result1.push(reel[2][(spot[2] + 1) % reel[2].length]); result1.push(reel[3][(spot[3] + 1) % reel[3].length]); result1.push(reel[4][(spot[4] + 1) % reel[4].length]); var result2 = []; result2.push(reel[0][spot[0]]); result2.push(reel[1][spot[1]]); result2.push(reel[2][spot[2]]); result2.push(reel[3][spot[3]]); result2.push(reel[4][spot[4]]); var result3 = []; result3.push(reel[0][(this._winSpot[0] - 1 + reel[0].length) % reel[0].length]); result3.push(reel[1][(this._winSpot[1] - 1 + reel[1].length) % reel[1].length]); result3.push(reel[2][(this._winSpot[2] - 1 + reel[2].length) % reel[2].length]); result3.push(reel[3][(this._winSpot[3] - 1 + reel[3].length) % reel[3].length]); result3.push(reel[4][(this._winSpot[4] - 1 + reel[4].length) % reel[4].length]); var returnValue = 0; var cursorArray = this._makeCursorArray(); //line1 var i, base; var win = 0; base = result1[0]; if (this._bet > 1) { for (i = 1; i < 5; i++) { if (base !== result1[i]) { break; } } i--; if (i > 1) { win = scale * odds[i - 2][base]; cursorArray[i - 2][base] = true; returnValue += win; } } //line2 win = 0; base = result2[0]; if (this._bet > 0) { for (i = 1; i < 5; i++) { if (base !== result2[i]) { break; } } i--; if (i > 1) { win = scale * odds[i - 2][base]; cursorArray[i - 2][base] = true; returnValue += win; } } //line3 win = 0; base = result3[0]; if (this._bet > 2) { for (i = 1; i < 5; i++) { if (base !== result3[i]) { break; } } i--; if (i > 1) { win = scale * odds[i - 2][base]; cursorArray[i - 2][base] = true; returnValue += win; } } this._instructionWindow.blinkCursor(cursorArray); return returnValue; }; Scene_SlotMachine.prototype.drawLot = function () { var i, j, l; var s; var spot = []; spot.push(Math.random() * reel[0].length >> 0); spot.push(Math.random() * reel[1].length >> 0); spot.push(Math.random() * reel[2].length >> 0); spot.push(Math.random() * reel[3].length >> 0); spot.push(Math.random() * reel[4].length >> 0); //2〜5reel var l1, l2, l3; var r; var target1 = true; var target2 = true; var target3 = true; for (i = 1; i < 5; i++) { for (j = 0; j < reel[i].length; j++) { if (this.isWin(spot, i)) { spot[i] = (spot[i] + 1) % reel[i].length; } else { break; } } l = reel[i - 1].length; l1 = reel[i - 1][(spot[i - 1] + 1 + l) % l]; l2 = reel[i - 1][(spot[i - 1] + 0 + l) % l]; l3 = reel[i - 1][(spot[i - 1] - 1 + l) % l]; l = reel[i].length; r = Math.random(); if (r < this._probability[i - 1][l2] && target2) { s = reel[i].indexOf(l2); if (s >= 0) { spot[i] = (s + 0 + l) % l; target1 = false; target3 = false; } else { console.error("Illegal lottery. r:", i,"l2:", l2); } } r = Math.random(); if (r < this._probability[i - 1][l1] && target1) { s = reel[i].indexOf(l1); if (s >= 0) { spot[i] = (s - 1 + l) % l; target2 = false; target3 = false; } else { console.error("Illegal lottery. r:", i,"l1:", l1); } } r = Math.random(); if (r < this._probability[i - 1][l3] && target3) { s = reel[i].indexOf(l3); if (s >= 0) { spot[i] = (s + 1 + l) % l; target1 = false; target2 = false; } else { console.error("Illegal lottery. r:", i,"l3:", l3); } } } return spot; }; /** * * @param spot * @param r * @return {boolean} */ Scene_SlotMachine.prototype.isWin = function (spot, r) { return !!( reel[r - 1][(spot[r - 1] + 1) % reel[r - 1].length] === reel[r][(spot[r] + 1) % reel[r].length] || reel[r - 1][(spot[r - 1] + 0) % reel[r - 1].length] === reel[r][(spot[r] + 0) % reel[r].length] || reel[r - 1][(spot[r - 1] - 1) % reel[r - 1].length] === reel[r][(spot[r] - 1) % reel[r].length] ); }; Scene_SlotMachine.prototype.correct = function () { this._coin += this._correctCoin; this._correctCoin = 0; if (this._coin >= Scene_SlotMachine.COIN_MAX_VALUE) { this._helpWindow.setText(coinFullMessage + '\n' + replayMessage); } else { this._helpWindow.setText(this._winMessage + '\n' + replayMessage); } this._winMessage = ""; this._replayCommandWindow.open(); this._replayCommandWindow.activate(); }; Scene_SlotMachine.prototype.replayCommand = function () { this._slotCommandWindow.enableBet(); this._slotCommandWindow.disableSpin(); if (this._coin < scale) { this._slotCommandWindow.disableBet(); } this._slotCommandWindow.select(0); this._replayCommandWindow.close(); this._slotCommandWindow.open(); this._slotCommandWindow.activate(); this._helpWindow.setText(helpMessage); this._bet = 0; this.refreshStatus(); }; Scene_SlotMachine.prototype.refreshStatus = function () { this._slotMachineWindow.bet = this._bet * scale; this._slotMachineWindow.coin = this._coin - this._bet * scale; if (this._bet === 0) { this._betLine.clear(); } else { this._betLine.enableLine(this._bet - 1); } }; Scene_SlotMachine.prototype.update = function () { Scene_MenuBase.prototype.update.call(this); var result = 0; if (this._spinStart && !this.isSpinning()) { this._spinStart = false; this.result(); } else if (this.isWinCounting()) { if (this._winCoin <= this._winStep) { this._winCoin = 0; result = this._coin + this._correctCoin; this._slotMachineWindow.coin = result; this.correct(); } else { this._winCoin -= this._winStep; result = this._coin + this._correctCoin - this._winCoin; this._slotMachineWindow.coin = result; } } if (Input.isRepeated('up') && this._slotCommandWindow.active) { if (this._slotCommandWindow.isAllowBet) { SoundManager.playOk(); this.betCommand(); } else { SoundManager.playBuzzer(); } } if (Input.isRepeated('down') && this._slotCommandWindow.active) { if (this._slotCommandWindow.isAllowSpin && !this._spinStart) { SoundManager.playOk(); this.spinCommand(); } } }; Scene_SlotMachine.prototype._makeCursorArray = function () { var returnValue = []; for (var i = 0; i < 3; i++) { returnValue.push([]); for (var j = 0; j < 6; j++) { returnValue[i].push(false); } } return returnValue; }; //----------------------------------------------------------------------------- // Window_SlotInstruction // // This window is instruction card for the slot machines. function Window_SlotInstruction() { this.initialize.apply(this, arguments); } Window_SlotInstruction.prototype = Object.create(Window_Base.prototype); Window_SlotInstruction.prototype.constructor = Window_SlotInstruction; Window_SlotInstruction.prototype.initialize = function (x, y, width, height) { Window_Base.prototype.initialize.call(this, x, y, width, height); this._cursol = [[],[],[]]; var b = ImageManager.loadBitmap("img/slotmachine/", "win_cursor"); var cx = 47; var cy = 32; var cw = 224; for (var i = 2; i >= 0; i--) { for (var j = 5; j >= 0; j--) { var sprite = new InstructionCursorSprite(b); this.addChild(sprite); sprite.x = cx + i * (cw + 20); sprite.y = cy + j * 24; this._cursol[2 - i].push(sprite); } } this.clearCursor(); }; Window_SlotInstruction.prototype.lineHeight = function () { return 24; }; Window_SlotInstruction.prototype.refresh = function () { this.setBackgroundType(2); this.contents.clear(); if (this._odds) { this.contents.fontSize = 22; var x = 51 - 18; var y = 14; var w = 224; this.drawText(this._odds[2][5], x, y, w, "right"); y += this.lineHeight(); this.drawText(this._odds[2][4], x, y, w, "right"); y += this.lineHeight(); this.drawText(this._odds[2][3], x, y, w, "right"); y += this.lineHeight(); this.drawText(this._odds[2][2], x, y, w, "right"); y += this.lineHeight(); this.drawText(this._odds[2][1], x, y, w, "right"); y += this.lineHeight(); this.drawText(this._odds[2][0], x, y, w, "right"); x += w + 20; y = 14; this.drawText(this._odds[1][5], x, y, w, "right"); y += this.lineHeight(); this.drawText(this._odds[1][4], x, y, w, "right"); y += this.lineHeight(); this.drawText(this._odds[1][3], x, y, w, "right"); y += this.lineHeight(); this.drawText(this._odds[1][2], x, y, w, "right"); y += this.lineHeight(); this.drawText(this._odds[1][1], x, y, w, "right"); y += this.lineHeight(); this.drawText(this._odds[1][0], x, y, w, "right"); x += w + 20; y = 14; this.drawText(this._odds[0][5], x, y, w, "right"); y += this.lineHeight(); this.drawText(this._odds[0][4], x, y, w, "right"); y += this.lineHeight(); this.drawText(this._odds[0][3], x, y, w, "right"); y += this.lineHeight(); this.drawText(this._odds[0][2], x, y, w, "right"); y += this.lineHeight(); this.drawText(this._odds[0][1], x, y, w, "right"); y += this.lineHeight(); this.drawText(this._odds[0][0], x, y, w, "right"); } this.contents.fontSize = this.standardFontSize(); }; Window_SlotInstruction.prototype.setOdds = function (odds) { this._odds = odds; }; Window_SlotInstruction.prototype.clearCursor = function () { for (var i = 0; i
 

ここまでになります。
長いですが、まぁ・・・仕方なし・・・(-_-;)
そのままコピペしたら、お食事万歳!!になりますからね!!(`・ω・´)
 

最新の画像もっと見る

コメントを投稿

ブログ作成者から承認されるまでコメントは反映されません。