
//=============================================================================
// NupuBBgm.js
//=============================================================================

/*:
 * @plugindesc 戦闘勝利後BGM継続
 * @author ぬぷ竜
 *
 * @help 戦闘BGMを勝利時に停止させずに継続させます。
 * 
 * @param Soft ON
 * @desc 機能を有効にするスイッチ番号
 * @default 30
 *
 */

var NupuBgm;
(function () {
    var parameters = PluginManager.parameters('NupuBBgm');
    var SoftON = parseInt(parameters['Soft ON'] || '30');

    console.log(SoftON);

    BattleManager.playVictoryMe = function () {
        console.log(NupuBgm);
        console.log($gameSwitches.value(SoftON));
        if ($gameSwitches.value(SoftON)) {
            AudioManager.playBgm(NupuBgm);
        } else {
            AudioManager.playMe($gameSystem.victoryMe());
        }
        console.log("syoribgm");
    };

    Game_Interpreter.prototype.command241 = function () {
        console.log(this._params[0]);
        AudioManager.playBgm(this._params[0]);
        NupuBgm = this._params[0];
        return true;
    };

    BattleManager.replayBgmAndBgs = function () {
        if (this._mapBgm) {
            if ( $gameSwitches.value(SoftON) == false) {
                AudioManager.replayBgm(this._mapBgm);
            }
        } else {
            AudioManager.stopBgm();
            console.log("stop1");
        }
        if (this._mapBgs) {
            if ($gameSwitches.value(SoftON) == false) {
                AudioManager.replayBgs(this._mapBgs);
            }
        }
    };
})();