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

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

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

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

はい、こちらはスロットプラグインのデータ丸投げ!!

と言っても、そのまま丸投げすると・・・ネタになります!!(`・ω・´)

ちゃんとコピペする前に一部は修正しないと・・・お食事ネタになりますよ!!(`・ω・´)

何故、JSファイルで出さないのかって・・・?

そのままお食事ネタで使いそうじゃないですか!!(`・ω・´;)

文字数制限の関係上、こっちは前半部で次に記載するのは後半部となります。

まず前半部のこれをコピーしたらメモ帳へペースト(貼り付け)をしたら、
そのメモ帳内の一番下に後半部のプラグインデータをコピーして貼り付けをし、
保存時のファイル名を「SlotMachine.js」で
右側の選択は「すべてのファイル」を選択して保存すると「JSファイル」が出来上がります。

・・・という訳でこちら!! ↓

 

//=============================================================================
// SlotMachine.js
//
// (c)2016 KADOKAWA CORPORATION./YOJI OJIMA
//=============================================================================

/*:
 * @plugindesc Slot Machine scene
 * @author Takeya Kimura
 *
 * @param Variable ID
 * @desc Variable ID for store the coin.
 * @default 11
 *
 * @param Help Text
 * @desc This text is a help message.
 * @default カーソルキーの上でベッド、カーソルキーの下でお食事開始
 *
 * @param Won Text
 * @desc This text is a won message. "Win Coin" will be replaced with the number of coins won.
 * @default おめでとうございます!Win Coin肉獲得です!
 *
 * @param Lost Text
 * @desc This text is a lost message.
 * @default ご馳走様でした。
 *
 * @param Replay Text
 * @desc This text is a replay message.
 * @default もう一度ご馳走になりますか?
 *
 * @param CoinFull Text
 * @desc This text is a coin full message.
 * @default お腹が満腹になりました。
 *
 * @param Bet Text
 * @desc This text is a bet command.
 * @default ベッド
 *
 * @param Spin Text
 * @desc This text is a coin spin command.
 * @default フライスピン
 *
 * @param Yes Text
 * @desc This text is a coin "yes" command.
 * @default お食事開始
 *
 * @param No Text
 * @desc This text is a "no" command.
 * @default もう食べれません
 *
 * @requiredAssets img/slotmachine/bet_line_1
 * @requiredAssets img/slotmachine/bet_line_2
 * @requiredAssets img/slotmachine/bet_line_3
 * @requiredAssets img/slotmachine/bg
 * @requiredAssets img/slotmachine/line_base
 * @requiredAssets img/slotmachine/reel
 * @requiredAssets img/slotmachine/scale_x1
 * @requiredAssets img/slotmachine/scale_x10
 * @requiredAssets img/slotmachine/scale_x100
 * @requiredAssets img/slotmachine/win_cursor
 * @requiredAssets audio/me/Victory1
 * @requiredAssets audio/se/Switch2
 *
 * @help
 * Plugin Command:
 *   SlotMachine open               # Open the slot machines
 *   SlotMachine expectation 0.5    # Set the expectation
 *   SlotMachine scale 0            # Set the scale [0 | 1 | 2](scale1 | scale10 | scale100)
 */

/*:ja
 * @plugindesc Slot Machine scene
 * @author Takeya Kimura
 *
 * @param Variable ID
 * @desc 所持お肉の数を保管する変数ID
 * @default 11
 *
 * @param Help Text
 * @desc ヘルプメッセージです。
 * @default カーソルキーの上でベッド、カーソルキーの下でお食事 *
 * @param Won Text
 * @desc 食事後のメッセージ。 "Win Coin"は獲得したお肉に置換されます。
 * @default おめでとうございます!Win Coin肉獲得です!
 *
 * @param Lost Text
 * @desc 食べれなかった時のメッセージ
 * @default 食べれませんでした。
 *
 * @param Replay Text
 * @desc 温め時の選択メッセージ
 * @default もう一度ご馳走になりますか?
 *
 * @param Coin Full Text
 * @desc お肉で満腹に達した時のメッセージ
 * @default お腹が満腹になりました。
 *
 * @param Bet Text
 * @desc ベットコマンドのテキスト
 * @default ベッド
 *
 * @param Spin Text
 * @desc スピンコマンドのテキスト
 * @default フライスピン
 *
 * @param Yes Text
 * @desc はいコマンドのテキスト
 * @default お食事開始
 *
 * @param No Text
 * @desc いいえコマンドのテキスト
 * @default もう食べれません
 *
 * @requiredAssets img/slotmachine/bet_line_1
 * @requiredAssets img/slotmachine/bet_line_2
 * @requiredAssets img/slotmachine/bet_line_3
 * @requiredAssets img/slotmachine/bg
 * @requiredAssets img/slotmachine/line_base
 * @requiredAssets img/slotmachine/reel
 * @requiredAssets img/slotmachine/scale_x1
 * @requiredAssets img/slotmachine/scale_x10
 * @requiredAssets img/slotmachine/scale_x100
 * @requiredAssets img/slotmachine/win_cursor
 * @requiredAssets audio/me/Victory1
 * @requiredAssets audio/se/Switch2
 *
 * @help
 * Plugin Command:
 *   SlotMachine open               # 精肉マシーンを開きます
 *   SlotMachine expectation 0.5    # 期待値を0~1の間で設定します。1に近づくほど当たりやすくなりますが、確実にお食事できるわけではありません。
 *   SlotMachine scale 0            # 倍率を設定します0は1倍、1は10倍、2は100倍です。
 */

(function () {

var parameters = PluginManager.parameters('SlotMachine');
var variableId = Number(parameters['Variable ID'] || 11);
var helpMessage = String(parameters['Help Text'] || "カーソルキーの上でベッド、カーソルキーの下でお食事");
var winMessage = String(parameters['Won Text'] || "おめでとうございます!Win Coin肉獲得です!");
var lostMessage = String(parameters['Lost Text'] || "食べれませんでした。");
var replayMessage = String(parameters['Replay Text'] || "もう一度ご馳走になりますか?");
var coinFullMessage = String(parameters['CoinFull Text'] || "お腹が満腹になりました。");
var betText = String(parameters['Bet Text'] || "ベッド");
var spinText = String(parameters['Spin Text'] || "フライスピン");
var yesText = String(parameters['Yes Text'] || "お食事開始");
var noText = String(parameters['No Text'] || "もう食べれません");
var scale = 1;
var expectation = 0.5;

//odds
//You can set the odds.
var odds = [];
odds.push([]);
odds[0].push(3); //000
odds[0].push(5); //111
odds[0].push(10); //222
odds[0].push(30); //333
odds[0].push(500); //444
odds[0].push(777); //555
odds.push([]);
odds[1].push(6); //0000
odds[1].push(30); //1111
odds[1].push(50); //2222
odds[1].push(300); //3333
odds[1].push(5000); //4444
odds[1].push(7777); //5555
odds.push([]);
odds[2].push(20); //00000
odds[2].push(300); //11111
odds[2].push(500); //22222
odds[2].push(3000); //33333
odds[2].push(5000); //44444
odds[2].push(77777); //55555

//make reel
//You can rearrange the order of the reel.
//The number can not be changed.
var reel = [];
reel.push([0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5]);
reel.push([5, 4, 3, 2, 1, 0, 5, 4, 3, 2, 1, 0, 5, 4, 3, 2, 1, 0]);
reel.push([0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 0, 1, 2, 3, 4, 5]);
reel.push([0, 2, 4, 1, 3, 5, 0, 2, 4, 1, 3, 5, 0, 2, 4, 1, 3, 5]);
reel.push([0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5]);

function getCoin() {
    return $gameVariables.value(variableId);
}

function setCoin(value) {
    return $gameVariables.setValue(variableId, value);
}

var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function (command, args) {
    _Game_Interpreter_pluginCommand.call(this, command, args);
    if (command === "SlotMachine") {
        switch (args[0]) {
            case "open":
                SceneManager.push(Scene_SlotMachine);
                break;
            case "expectation":
                expectation = Number(args[1]);
                break;
            case "scale":
                switch (args[1]) {
                    case "0":
                        scale = 1;
                        break;
                    case "1":
                        scale = 10;
                        break;
                    case "2":
                        scale = 100;
                        break;
                    default :
                        scale = 1;
                        break;
                }
                break;
        }
    }
};

//-----------------------------------------------------------------------------
// SLTReelSprite
//
// Slot Machine Reel Sprite

function SLTReelSprite() {
    this.initialize.apply(this, arguments);
}

SLTReelSprite.prototype = Object.create(Sprite.prototype);
SLTReelSprite.prototype.constructor = SLTReelSprite;

SLTReelSprite.STOP = 0;
SLTReelSprite.SPINNING = 1;
SLTReelSprite.SPIN = 2;
SLTReelSprite.STOPPING = 3;
SLTReelSprite.FRAME_SPINNING = 40;
SLTReelSprite.FRAME_SPIN = 60;
SLTReelSprite.FRAME_STOPPING = 40;

SLTReelSprite.prototype.initialize = function (bitmap) {
    Sprite.prototype.initialize.call(this, bitmap);
    this._numSpot = 18;
    this._spotHeight = 54;
    this._winSpot = 0;
    this._scrollY = 0;
    this._speedHigh = 30;
    this._speedLow = 4;
    this._status = 0;
    this._spinFrame = 0;
    this._spinEndFrame = SLTReelSprite.FRAME_SPIN;
};

Object.defineProperty(SLTReelSprite.prototype, 'status', {
    get: function () {
        return this._status;
    },
    configurable: true
});

SLTReelSprite.prototype.update = function () {
    Sprite.prototype.update.call(this);

    switch (this._status) {

        case SLTReelSprite.STOP:
            break;

        case SLTReelSprite.SPINNING:
            if (this._spinFrame > SLTReelSprite.FRAME_SPINNING) {
                this._status = SLTReelSprite.SPIN;
                break;
            }
            this._scrollY = (this._scrollY + this._speedLow) % (this._numSpot * this._spotHeight);
            this.setFrame(
                0,
                this._spotHeight * this._numSpot * 2 - this._scrollY - this._spotHeight * 2,
                116,
                this._spotHeight * 3
            );
            this._spinFrame++;
            break;

        case SLTReelSprite.SPIN:
            if (this._spinFrame > this._spinEndFrame + SLTReelSprite.FRAME_SPINNING) {
                this._status = SLTReelSprite.STOPPING;
                this._scrollY = this._winSpot * this._spotHeight - this._spotHeight * 3;
                break;
            }
            this._scrollY = (this._scrollY + this._speedHigh) % (this._numSpot * this._spotHeight);
            this.setFrame(
                0,
                this._spotHeight * this._numSpot * 2 - this._scrollY - this._spotHeight * 2,
                116,
                this._spotHeight * 3
            );
            this._spinFrame++;
            break;

        case SLTReelSprite.STOPPING:
            this._scrollY = (this._scrollY + this._speedLow) % (this._numSpot * this._spotHeight);
            if (this._scrollY > this._winSpot * this._spotHeight) {
                this._scrollY = this._winSpot * this._spotHeight;
                this._status = SLTReelSprite.STOP;
                AudioManager.playSe({"name": "Switch2", "volume": 90, "pitch": 100, "pan": 0});
            }
            this.setFrame(
                0,
                this._spotHeight * this._numSpot * 2 - this._scrollY - this._spotHeight * 2,
                116,
                this._spotHeight * 3
            );
            break;
    }
};

SLTReelSprite.prototype.setSpot = function (spot) {
    if (0  0) {
        if (this._counter > InstructionCursorSprite.FRAME_BLINK_END + 1) {
            this._counter = 0;
        }
        else {
            var s = this._counter / InstructionCursorSprite.FRAME_BLINK >> 0;
            this.visible = s % 2 === 0;
            this._counter++;
        }
    }
};

/**
 * @method drawImage
 * @param bitmap    source bitmap
 * @param sx        source x
 * @param sy        source y
 * @param sw        source width
 * @param sh        source height
 * @param dx        destination x
 * @param dy        destination y
 */
Bitmap.prototype.drawImage = function(bitmap, sx, sy, sw, sh, dx, dy) {
    this._context.drawImage(bitmap.canvas, sx, sy, sw, sh, dx, dy, sw, sh);
    this._setDirty();
};

//-----------------------------------------------------------------------------
// Scene_SlotMachine
//
// Will play the slot machine.

function Scene_SlotMachine() {
    this.initialize.apply(this, arguments);
}

Scene_SlotMachine.prototype = Object.create(Scene_MenuBase.prototype);
Scene_SlotMachine.prototype.constructor = Scene_SlotMachine;

Scene_SlotMachine.COIN_MAX_VALUE = 99999999;
Scene_SlotMachine.ODDS_MAX_VALUE = 100000;

Scene_SlotMachine.prototype.initialize = function () {
    Scene_MenuBase.prototype.initialize.call(this);

    this._bet = 0;
    this._coin = getCoin();
    this._winSpot = null;
    this._spinStart = false;
    this._rollCount = 0;
    this._winCoin = 0;
    this._correctCoin = 0;
    this._winStep = 0;
    this._winMessage = "";

    //Winning percentage is calculated by the odds
    this._probability = [];
    this._probability.push([]);
    this._probability[0].push(0.92); //00
    this._probability[0].push(0.86); //11
    this._probability[0].push(0.69); //22
    this._probability[0].push(0.62); //33
    this._probability[0].push(0.54); //44
    this._probability[0].push(0.46); //55

    this._probability.push([]);
    this._probability[1].push((1 / this._probability[0][0]) *
        expectation * (1 / odds[0][0])); //000
    this._probability[1].push((1 / this._probability[0][1]) *
        expectation * (1 / odds[0][1])); //111
    this._probability[1].push((1 / this._probability[0][2]) *
        expectation * (1 / odds[0][2])); //222
    this._probability[1].push((1 / this._probability[0][3]) *
        expectation * (1 / odds[0][3])); //333
    this._probability[1].push((1 / this._probability[0][4]) *
        expectation * (1 / odds[0][4])); //444
    this._probability[1].push((1 / this._probability[0][5]) *
        expectation * (1 / odds[0][5])); //555

    this._probability.push([]);
    this._probability[2].push((1 / (this._probability[0][0] * this._probability[1][0])) *
        expectation * (1 / odds[1][0])); //0000
    this._probability[2].push((1 / (this._probability[0][1] * this._probability[1][1])) *
        expectation * (1 / odds[1][1])); //1111
    this._probability[2].push((1 / (this._probability[0][2] * this._probability[1][2])) *
        expectation * (1 / odds[1][2])); //2222
    this._probability[2].push((1 / (this._probability[0][3] * this._probability[1][3])) *
        expectation * (1 / odds[1][3])); //3333
    this._probability[2].push((1 / (this._probability[0][4] * this._probability[1][4])) *
        expectation * (1 / odds[1][4])); //4444
    this._probability[2].push((1 / (this._probability[0][5] * this._probability[1][5])) *
        expectation * (1 / odds[1][5])); //5555

    this._probability.push([]);
    this._probability[3].push((1 / (this._probability[0][0] * this._probability[1][0] * this._probability[2][0])) *
        expectation * (1 / odds[2][0])); //00000
    this._probability[3].push((1 / (this._probability[0][1] * this._probability[1][1] * this._probability[2][1])) *
        expectation * (1 / odds[2][1])); //11111
    this._probability[3].push((1 / (this._probability[0][2] * this._probability[1][2] * this._probability[2][2])) *
        expectation * (1 / odds[2][2])); //22222
    this._probability[3].push((1 / (this._probability[0][3] * this._probability[1][3] * this._probability[2][3])) *
        expectation * (1 / odds[2][3])); //33333
    this._probability[3].push((1 / (this._probability[0][4] * this._probability[1][4] * this._probability[2][4])) *
        expectation * (1 / odds[2][4])); //44444
    this._probability[3].push((1 / (this._probability[0][5] * this._probability[1][5] * this._probability[2][5])) *
        expectation * (1 / odds[2][5])); //55555

    //Interval Spin
    //this._startingTimer = null;
    //this._currentStartingReel = 0;

    if (this._coin > Scene_SlotMachine.COIN_MAX_VALUE) {
        this._coin = Scene_SlotMachine.COIN_MAX_VALUE;
    }
};

Scene_SlotMachine.prototype.create = function () {
    this.createBackground();
    this._backgroundSprite.bitmap = ImageManager.loadBitmap("img/slotmachine/", "bg");
    this.createReels();
    this.createBetLine();
    this.createScale();
    this.updateActor();
    this.createWindowLayer();
    this.createHelpWindow();
    this.createInstruction();
    this.createSlotMachine();
    this.createSlotCommand();
    this.createReplayCommand();

    this.refreshStatus();

    if (this._coin < scale) {
        this._slotCommandWindow.disableBet();
    }
};

Scene_SlotMachine.prototype.start = function() {
    this.makeReel();
    this._instructionWindow.refresh();
    this._slotMachineWindow.refresh();
    this._helpWindow.setText(helpMessage);
};

Scene_SlotMachine.prototype.makeReel = function() {
    for (var i = 0; i < 5; i++) {
        for (var j = 0; j < 18; j++) {
            for (var k = 0; k < 3; k++) {
                this._reels[i].bitmap.drawImage(
                    this._reelBitmap,
                    reel[i][j] * 116,
                    0,
                    116,
                    54,
                    0,
                    (54 * 18 * 3) - j * 54 - k * (18 * 54) - 54);
            }
        }

        this._reels[i].setSpot(Math.random() * 18 >> 0);
    }
};

Scene_SlotMachine.prototype.isSpinning = function() {
    var returnValue = false;
    for (var i = 0; i < 5; i++) {
        returnValue = returnValue || this._reels[i].status !== SLTReelSprite.STOP;
    }
    return returnValue;
};

Scene_SlotMachine.prototype.isWinCounting = function() {
    return this._winCoin > 0;
};

Scene_SlotMachine.prototype.createHelpWindow = function() {
    Scene_MenuBase.prototype.createHelpWindow.call(this);
    this._helpWindow.y = Graphics.boxHeight - this._helpWindow.height;
};

Scene_SlotMachine.prototype.createInstruction = function () {
    this._instructionWindow = new Window_SlotInstruction(0, 0, Graphics.boxWidth, 26 * 6 + 18 * 2);
    this._instructionWindow.setOdds(odds);
    this.addWindow(this._instructionWindow);
};

Scene_SlotMachine.prototype.createSlotMachine = function () {
    this._slotMachineWindow = new Window_SlotMachine(0, this._instructionWindow.height, Graphics.boxWidth, 200);
    this._slotMachineWindow.coin = this._coin;
    this._slotMachineWindow.bet = this._bet;
    this.addWindow(this._slotMachineWindow);
};

Scene_SlotMachine.prototype.createSlotCommand = function () {
    this._slotCommandWindow = new Window_SlotCommand(0, 0);
    this._slotCommandWindow.setHandler('bet', this.betCommand.bind(this));
    this._slotCommandWindow.setHandler('spin', this.spinCommand.bind(this));
    this._slotCommandWindow.setHandler('cancel', this.cancelCommand.bind(this));
    this.addWindow(this._slotCommandWindow);
    this._slotCommandWindow.y = this._helpWindow.y - this._slotCommandWindow.height;
};

Scene_SlotMachine.prototype.createReplayCommand = function () {
    this._replayCommandWindow = new Window_ReplayCommand(0, 0);
    this._replayCommandWindow.setHandler('yes', this.replayCommand.bind(this));
    this._replayCommandWindow.setHandler('no', this.cancelCommand.bind(this));
    this._replayCommandWindow.setHandler('cancel', this.cancelCommand.bind(this));
    this.addWindow(this._replayCommandWindow);
    this._replayCommandWindow.x = Graphics.boxWidth - this._replayCommandWindow.width;
    this._replayCommandWindow.y = this._helpWindow.y - this._replayCommandWindow.height;
};

Scene_SlotMachine.prototype.createReels = function () {
    this._reelBitmap = ImageManager.loadBitmap("img/slotmachine/", "reel");
    this._reels = [];
    for (var i = 0; i < 5; i++) {
        var sprite = new SLTReelSprite(new Bitmap(116, 54 * 18 * 3));
        this._reels.push(sprite);
        sprite.x = 110 + i * 120;
        sprite.y = 222;
        sprite.setSpinEndFrame(SLTReelSprite.FRAME_SPIN + i * 40);
        sprite.setFrame(0, 0, 116, 54 * 3);
        this.addChild(sprite);
    }
};

Scene_SlotMachine.prototype.createBetLine = function () {
    var bitmap = ImageManager.loadBitmap("img/slotmachine/", "line_base");
    this._betLine = new LotLineSprite(bitmap);
    this._betLine.x = 43;
    this._betLine.y = 227;
    this._betLine.clear();
    this.addChild(this._betLine);
};

Scene_SlotMachine.prototype.createScale = function () {
    var bitmap;
    if (scale === 10) {
        bitmap = ImageManager.loadBitmap("img/slotmachine/", "scale_x10");
    }
    else if (scale === 100) {
        bitmap = ImageManager.loadBitmap("img/slotmachine/", "scale_x100");
    }
    else {
        bitmap = ImageManager.loadBitmap("img/slotmachine/", "scale_x1");
    }
    this._scale = new Sprite(bitmap);
    this._scale.x = 719;
    this._scale.y = 212;
    this.addChild(this._scale);
};

Scene_SlotMachine.prototype.cancelCommand = function () {
    this._bet = 0;
    this.refreshStatus();
    setCoin(this._coin);
    this.popScene();
};

Scene_SlotMachine.prototype.betCommand = function () {
    if (this._bet < 3) {
        this._bet++;
        this._slotCommandWindow.enableSpin();
    }
    if (this._bet > 2) {
        this._slotCommandWindow.disableBet();
    }
    if (this._coin - this._bet * scale 

最新の画像もっと見る

コメントを投稿

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