/*:ja
 * @plugindesc 
 * @author Nupuryu
 */
let Dbg_GameStartFlg = false; 
DataManager._databaseFiles.push({
    name: '$DbgBtlClass',
    src: 'DbgBtlClass.json'
});
let dbgBtlClass = null;
class DbgBtlClass {
    constructor(_setData) {
        this.deckCardList = [];
        _setData.deckCardList.forEach(cardId => {
            this.deckCardList.push(cardId);
        });
        this.enemyTrpId = _setData.enemyTrpId;
        this.mikataId = _setData.mikataId;
        this.acKinshi = _setData.acKinshi;
    }
}
let DisplayViewX = 0;
let DisplayViewY = 0;
let DisplayViewData = [];
const PN_Display = 25;
let Display情報表示_LongBackFlg = false;
Game_Interpreter.prototype.Display情報表示_Start = function () {
    let drawPicName = "DataBack";
    if (Display情報表示_LongBackFlg) drawPicName = "LongDataBack";
    Display情報表示_LongBackFlg = false;
    this.SetSprite(PN_Display - 1 , drawPicName);
    for (let i = 0; i <= DisplayViewData.length - 1; i++) {
        this.SpriteStr(PN_Display + i, DisplayViewData[i], 26, DisplayViewX, DisplayViewY + i * 30);
    }
}
Game_Interpreter.prototype.Display情報表示_Update = function () {
    if (TouchInput.isTriggered() || TouchInput.isCancelled()) {
        this.DelSpriteSpan(PN_Display - 1, PN_Display + DisplayViewData.length - 1);
        return false; 
    }
    return true; 
}
const PN_QSave = 495;
const PN_QLoad = PN_QSave + 1;
const PN_QPicCk = PN_QLoad + 1;
const PN_DMapName = PN_QPicCk + 1;
const QSaveNo = 50;
let QSaveLoadNotViewFlg = false;
let QSaveLoad_NUpdateSc = Game_Interpreter.prototype.NUpdateSc;
Game_Interpreter.prototype.NUpdateSc = function () {
    QSaveLoad_NUpdateSc.call(this);
    if ($gameTemp.isPlaytest() && !QSaveLoadNotViewFlg && DbgFlg) {
        this.SetSprite(PN_QSave , MapPicPath + "PN_QSave" , 1334 , 4);
        this.SetSprite(PN_QLoad , MapPicPath + "PN_QLoad"  , 1334 , 4 + 42)
        this.SetSprite(PN_QPicCk , MapPicPath + "PN_QPicCk"  , 1334 , 4 + 42);
        this.SpriteCngColor(PN_QSave);
        this.SpriteCngColor(PN_QLoad);
        this.SpriteCngColor(PN_QPicCk);
        if (overPointerSpCkTm(PN_QSave)) {
            this.SpriteCngColor(PN_QSave , [150,150,150,0] );
            if (TouchInput.isPressed()) {
                SoundManager.playSave();
                Live2D_Save();
                this.GameFileSave(QSaveNo);
                $gameTemp.clearDestination();
            }
        }
        if (overPointerSpCkTm(PN_QLoad)) {
            this.SpriteCngColor(PN_QLoad , [150,150,150,0] );
            if (TouchInput.isPressed()) { 
                _LoadOKFlg = true;
                SaveSelectNo = 1;
                SaveSelPage = 4;
                this.LoadBtnClick();
            }
        }
        if (overPointerSpCkTm(PN_QPicCk)) {
            this.SpriteCngColor(PN_QPicCk , [150,150,150,0] );
            if (TouchInput.isPressed()) {
                TxtMemoryCheckStart();
            }
        }
        this.SpriteStrR( PN_DMapName ,$gameMap.mapId() + ":" + GetMapName() , 12 , 1433 , 80);
    }
    if(Input.isTriggered('dbg_9') && $gameTemp.isPlaytest()){
        QSaveLoadNotViewFlg = !QSaveLoadNotViewFlg;
        this.DelSprite(PN_QSave);
        this.DelSprite(PN_QLoad);
        this.DelSprite(PN_QPicCk);
        this.DelSprite(PN_DMapName);
    }
}
let GetMapName = function () {
    if ($dataMapInfos && $dataMapInfos[$gameMap.mapId()]) {
        return $dataMapInfos[$gameMap.mapId()].name;
    } else {
        return "---"
    }
}
const DbmPicPath = "pictures/UI_Menu/0_Debug/"; 
const CN_DbmCmnNo = 1300;
const PN_DbmMenuBack = 368;
const PN_DbmTxt = PN_DbmMenuBack + 1;
let DbmTxtArr = [
    "◆シナリオスキップ　　　　　",
    "◆多数のカードを取得　　　　",
    "◆デッキ待機カード埋OFF　　",
    "◆デバッグルームへ移動　　　",
    "◆ジャミングデバッグ　　　",
    "",
    "",
    "",
    "",
    "◆コモンイベント:1297",
    "ロード（不安定）　　　　　"
];
let Dbm_flame = 0;
let Dbm_Drawflame = 0;
let Dbm_SelectNo = -1;
let Dbm_PicArr = [];
let _Dbm_Mode = {
    Base: 1,
    JumCheck: 2,
    LoadWin: 3
};
let Dbm_Mode = _Dbm_Mode.Base;
Game_Interpreter.prototype.DbmMenu_Start = function () {
    if (!DbgFlg) return;
    DelSpriteSpan(PN_DbmTxt, PN_DbmTxt + 24);
    Dbm_flame = 0;
    Dbm_Mode = _Dbm_Mode.Base;
    Dbm_Drawflame = 10;
    Dbm_SelectNo = -1;
    this.DbmMenu_Draw();
}
Game_Interpreter.prototype.DbmMenu_Draw = function () {
    this.SetSprite(PN_DbmMenuBack, DbmPicPath + "PN_DbmMenuBack", 0, 0);
    Dbm_PicArr = [];
    for (let i = 0; i <= DbmTxtArr.length - 1; i++) {
        if (DbmTxtArr[i] == "") continue;
        this.DelSprite(PN_DbmTxt + i);
        if (Dbm_SelectNo == PN_DbmTxt + i) {
            this.SetPicStrBG("rgba(255,255,0,1)");
        }
        this.SpriteStr(PN_DbmTxt + i, DbmTxtArr[i], 24, 1105, 85 + (36 * i));
        Dbm_PicArr.push(PN_DbmTxt + i);
    }
}
Game_Interpreter.prototype.DbmMenu_Update = function () {
    if (Dbm_Mode == _Dbm_Mode.JumCheck) {
        return this.DbmMenu_JumCheckUpdate(); 
    }
    if (Dbm_Mode == _Dbm_Mode.LoadWin) {
        this.TitleLoadUpdate(); 
        return true;
    }
    Dbm_flame++;
    Dbm_Drawflame = 10;
    let _CNo = overPointerSpCkArr(Dbm_PicArr);
    if (_CNo != -1) {
        Dbm_SelectNo = _CNo;
        this.DbmMenu_Draw();
        if (TouchInput.isPressed()) {
            let _Seli = Dbm_SelectNo - PN_DbmTxt;
            let ckTxt = DbmTxtArr[_Seli];
            switch (ckTxt) {
                case "◆シナリオスキップ　　　　　": 
                    this.DbmMenu_Close();
                    this.SetCmnEventSc(CN_SnoSkipCmn); 
                    return false; 
                case "◆多数のカードを取得　　　　": 
                    this.DbmMenu_Close();
                    _ゆどんげカード渡し();
                    return false; 
                case "◆デッキ待機カード埋OFF　　": 
                    this.DbmMenu_Close();
                    for (let i = 0; i <= $gameSystem.DeckArr.length - 1; i++) {
                        for (let j = 0; j <= $gameSystem.DeckArr[i].length - 1; j++) {
                            if ($gameSystem.DeckArr[i][j] == CId_待機) {
                                $gameSystem.DeckArr[i].splice(j, 1);
                                j--;
                            }
                        }
                    }
                    _Dbg_待機埋めOff = !_Dbg_待機埋めOff;
                    return false; 
                case "◆デバッグルームへ移動　　　": 
                    this.DbmMenu_Close();
                    this.SetCmnEvent(1299); 
                    return false; 
                case "◆ジャミングデバッグ　　　": 
                    this.DbmMenu_JumCheckView();
                    Dbm_Mode = _Dbm_Mode.JumCheck;
                    return true; 
                case "◆コモンイベント:1297": 
                    this.SetCmnEvent(1297);
                    this.DelSpriteSpan(PN_DbmMenuBack, PN_DbmTxt + DbmTxtArr.length - 1)
                    return false; 
                case "ロード（不安定）　　　　　":
                    LoadModeFlg = true;
                    NowLoadNo = $gameVariables.value(VN_BefSaveNo); 
                    _File_CngFlg = true;
                    if (NowLoadNo == 0) NowLoadNo = -1;
                    this.MenuSaveView(true); 
                    Dbm_Mode = _Dbm_Mode.LoadWin;
                    return true;
            }
        }
    }
    if (Input.isTriggered('dbg_Ex') && Dbm_flame > 10) {
        this.DelSpriteSpan(PN_DbmMenuBack, PN_DbmTxt + DbmTxtArr.length - 1)
        return false; 
    }
    return true;
}
let Dbm_ジャミングCkArr = [
    ["戦闘用グローブ　　　　　", 42],
    ["腕スーツ　　　　　　　　", 43],
    ["インナー　　　　　　　　", 44],
    ["ボディスーツ　　　　　　", 45],
    ["脚スーツ　　　　　　　　", 46],
    ["股間アーマー　　　　　　", 47],
    ["脚装甲　　　　　　　　　", 48],
    ["肩装甲　　　　　　　　　", 49],
    ["胸プレート　　　　　　　", 50],
    ["胸装甲　　　　　　　　　", 51]
]
let Dbm_ジャミングSwtArr = [];
Game_Interpreter.prototype.DbmMenu_JumCheckView = function () {
    DelSpriteSpan(PN_DbmTxt, PN_DbmTxt + DbmTxtArr.length - 1);
    Dbm_PicArr = [];
    Dbm_ジャミングSwtArr = [];
    let _LastNo = 0;
    for (let i = 0; i <= Dbm_ジャミングCkArr.length - 1; i++) {
        this.DelSprite(PN_DbmTxt + i);
        if (Dbm_SelectNo == PN_DbmTxt + i) {
            this.SetPicStrBG("rgba(255,255,0,1)");
        }
        let _setStr = "□";
        if ($gameSwitches.value(Dbm_ジャミングCkArr[i][1])) {
            _setStr = "■";
        }
        _setStr += Dbm_ジャミングCkArr[i][0];
        this.SpriteStr(PN_DbmTxt + i, _setStr, 24, 1105, 85 + (36 * i));
        Dbm_PicArr.push(PN_DbmTxt + i);
        _LastNo = i;
    }
    _LastNo++;
    this.SpriteStr(PN_DbmTxt + _LastNo + 1, "反映させる", 24, 1105, 85 + (36 * _LastNo));
}
Game_Interpreter.prototype.DbmMenu_JumCheckUpdate = function () {
    let _CNo = overPointerSpCkArr(Dbm_PicArr);
    if (_CNo != -1) {
        Dbm_SelectNo = _CNo;
        if (TouchInput.isTriggered()) {
            let _swNo = Dbm_ジャミングCkArr[Dbm_SelectNo - PN_DbmTxt][1];
            $gameSwitches.setValue(_swNo, !$gameSwitches.value(_swNo));
        }
        this.DbmMenu_JumCheckView();
    }
    if (overPointerSpCkTm(PN_DbmTxt + Dbm_ジャミングCkArr.length + 1)) {
        if (TouchInput.isTriggered()) {
            DelSpriteSpan(PN_DbmMenuBack, PN_DbmTxt + Dbm_ジャミングCkArr.length + 1);
            this.SetCmnEvent(CN_romasha_battale);
            this.SpineCngAccess();
            return false;
        }
    }
    return true; 
}
Game_Interpreter.prototype.DbmMenu_Close = function () {
    Dbm_flame = 10;
    DelSpriteSpan(PN_DbmMenuBack, PN_DbmTxt + Dbm_ジャミングCkArr.length + 1);
}
const CN_SnoSkipCmn = 1203;
const PN_SSkpBase = 380;
const PN_SSkpSyo = PN_SSkpBase + 2;
const PN_SSkpTxt = PN_SSkpSyo + 5;
class _SSkpSaveFile {
    constructor(_SaveNo, _Txt) {
        this._SaveNo = _SaveNo;
        this._Txt = _Txt;
    }
}
let SSkp_1章_Ps = new Pos2D(100, 50 + 100);
let SSkp_1章_TxtArr = [
    new _SSkpSaveFile(1, "ディアド戦前"),
    new _SSkpSaveFile(2, "ドラゴン戦前"),
    new _SSkpSaveFile(3, "尋問スクワット後"),
    new _SSkpSaveFile(4, "プロローグ終了前"),
    new _SSkpSaveFile(5, "０番隊から電子署名を集めよう"),
    new _SSkpSaveFile(6, "スピナ面会（１回目）直前"),
    new _SSkpSaveFile(7, "レゾナンス型のトラッシュからデータを集めよう！"),
    new _SSkpSaveFile(8, "サンドイッチをゲイン先生へ持っていこう"),
    new _SSkpSaveFile(9, "スピナ面会（２回目）直前"),
    new _SSkpSaveFile(10, "トラッシュデータ集め開始"),
    new _SSkpSaveFile(11, "スピナ通信連絡直前"),
    new _SSkpSaveFile(12, "１章最終戦直前")
];
let SSkp_2章_Ps = new Pos2D(100, 467 + 100);
let SSkp_2章_TxtArr = [
    new _SSkpSaveFile(13, "中間地点の森にて"),
    new _SSkpSaveFile(14, "スピナの故郷（最初）"),
    new _SSkpSaveFile(15, "薬草採取ダンジョン出発直前"),
    new _SSkpSaveFile(16, "ジジ救出ダンジョン出発直前"),
    new _SSkpSaveFile(17, "森を抜けましょう！")
];
let SSkp_3章_Ps = new Pos2D(650, 50 + 100);
let SSkp_3章_TxtArr = [
    new _SSkpSaveFile(18, "情報を集めよう！"),
    new _SSkpSaveFile(19, "猪鹿蝶へ行こう！"),
    new _SSkpSaveFile(20, "２人を助けた後→ホテルへ"),
    new _SSkpSaveFile(21, "お金を貯めましょう（自由行動）"),
    new _SSkpSaveFile(22, "闘技場受付前"),
    new _SSkpSaveFile(23, "闘技場１回戦前"),
    new _SSkpSaveFile(24, "闘技場２回戦前"),
    new _SSkpSaveFile(25, "スピナパート：フリーセに会いに行こう"),
    new _SSkpSaveFile(26, "闘技場３回戦前"),
    new _SSkpSaveFile(27, "闘技場決勝戦前")
];
let SSkp_PicArr = [];
let SSkp_SelectPicNo = -1;
const SSkpYズレ = 27;
Game_Interpreter.prototype.ScenarioSkip_Start = function () {
    Menu禁止Flg = true;
    this.SetSpriteFIn(PN_SSkpBase, "Black", 0, 0, 0, 0, 10, 150);
    this.SpriteStr(PN_SSkpBase + 1, "※右クリックで閉じる", 24, 974, 756);
    SSkp_SelectPicNo = -2;
    this.ScenarioSkip_Draw();
}
let Select_SSkpSaveFile;
Game_Interpreter.prototype.ScenarioSkip_Draw = function (_SSkpSelNo) {
    _SSkpSelNo = typeof _SSkpSelNo !== 'undefined' ? _SSkpSelNo : -1;
    if (SSkp_SelectPicNo == _SSkpSelNo) return; 
    if (SSkp_SelectPicNo > 0) this.DelSprite(SSkp_SelectPicNo);
    SSkp_SelectPicNo = _SSkpSelNo;
    let _SetOpi = 0;
    if (_SSkpSelNo != -1) {
        _SetOpi = 255;
    }
    this.SpriteStr(PN_SSkpSyo + 0, "【プロローグ＆１章】", 22, SSkp_1章_Ps._x, SSkp_1章_Ps._y - SSkpYズレ, _SetOpi);
    this.MoveSprite(PN_SSkpSyo + 0, true, true, 10);
    this.SpriteStr(PN_SSkpSyo + 1, "【２章】", 22, SSkp_2章_Ps._x, SSkp_2章_Ps._y - SSkpYズレ, _SetOpi);
    this.MoveSprite(PN_SSkpSyo + 1, true, true, 10);
    this.SpriteStr(PN_SSkpSyo + 2, "【３章】", 22, SSkp_3章_Ps._x, SSkp_3章_Ps._y - SSkpYズレ, _SetOpi);
    this.MoveSprite(PN_SSkpSyo + 2, true, true, 10);
    let _TxtCnt = 0;
    for (let i = 0; i <= SSkp_1章_TxtArr.length - 1; i++) {
        if (PN_SSkpTxt + i + _TxtCnt == _SSkpSelNo) {
            DelSprite(PN_SSkpTxt + i + _TxtCnt);
            this.SetPicStrBG("rgba(255,255,0,1)");
            Select_SSkpSaveFile = SSkp_1章_TxtArr[i];
        }
        this.SpriteStr(PN_SSkpTxt + i + _TxtCnt, SSkp_1章_TxtArr[i]._Txt, 22,
            SSkp_1章_Ps._x, i * SSkpYズレ + SSkp_1章_Ps._y, _SetOpi);
        this.MoveSprite(PN_SSkpTxt + i + _TxtCnt, true, true, 10);
        SSkp_PicArr.push(PN_SSkpTxt + i + _TxtCnt);
    }
    _TxtCnt += SSkp_1章_TxtArr.length;
    for (let i = 0; i <= SSkp_2章_TxtArr.length - 1; i++) {
        if (PN_SSkpTxt + i + _TxtCnt == _SSkpSelNo) {
            DelSprite(PN_SSkpTxt + i + _TxtCnt);
            this.SetPicStrBG("rgba(255,255,0,1)");
            Select_SSkpSaveFile = SSkp_2章_TxtArr[i];
        }
        this.SpriteStr(PN_SSkpTxt + i + _TxtCnt, SSkp_2章_TxtArr[i]._Txt, 22,
            SSkp_2章_Ps._x, i * SSkpYズレ + SSkp_2章_Ps._y, _SetOpi);
        this.MoveSprite(PN_SSkpTxt + i + _TxtCnt, true, true, 10);
        SSkp_PicArr.push(PN_SSkpTxt + i + _TxtCnt);
    }
    _TxtCnt += SSkp_2章_TxtArr.length;
    for (let i = 0; i <= SSkp_3章_TxtArr.length - 1; i++) {
        if (PN_SSkpTxt + i + _TxtCnt == _SSkpSelNo) {
            DelSprite(PN_SSkpTxt + i + _TxtCnt);
            this.SetPicStrBG("rgba(255,255,0,1)");
            Select_SSkpSaveFile = SSkp_3章_TxtArr[i];
        }
        this.SpriteStr(PN_SSkpTxt + i + _TxtCnt, SSkp_3章_TxtArr[i]._Txt, 22,
            SSkp_3章_Ps._x, i * SSkpYズレ + SSkp_3章_Ps._y, _SetOpi);
        this.MoveSprite(PN_SSkpTxt + i + _TxtCnt, true, true, 10);
        SSkp_PicArr.push(PN_SSkpTxt + i + _TxtCnt);
    }
}
let NotRomaLoading = false;
const CN_Live2DAllFadeOut = 13;
Game_Interpreter.prototype.ScenarioSkip_Update = function () {
    if (GameResetFlame > 0) return true; 
    if (ClickCkFlg == true) {
        let _Clk_CNo = this.ClickCk_Update();
        if (_Clk_CNo == PN_ClickCk_Yes) {
            L2dAutoFadeOut("romasha_talk",15);
            this.SetCmnEvent(CN_Live2DAllFadeOut);
            _LoadSelectNo = Select_SSkpSaveFile._SaveNo;
            this.UTA_Save();
            SaveFolCngName = "save_skip";
            _LoadStartingFlame = 0; 
            this.LoadStarting();
            ClickCkFlg = false;
            SSkipFlg = true;
            NotRomaLoading = true;
            let _PicSum = SSkp_1章_TxtArr.length + SSkp_2章_TxtArr.length + SSkp_3章_TxtArr.length;
            DelSpriteSpan(PN_SSkpBase, PN_SSkpTxt + _PicSum);
            Menu禁止Flg = false;
            Menu禁止Flame = 5;
            return false;
        }
        if (_Clk_CNo == PN_ClickCk_No) {
            this.ClickCk_WinDel();
        }
        return true; 
    }
    let _CNo = overPointerSpCkArr(SSkp_PicArr);
    if (_CNo != -1) {
        this.ScenarioSkip_Draw(_CNo);
        if (TouchInput.isPressed()) {
            this.ClickCk_WinView([Select_SSkpSaveFile._Txt + " を読み込みますか？", ""])
        }
    }
    if (Input.isTriggered('menu') || TouchInput.isCancelled()) {
        let _PicSum = SSkp_1章_TxtArr.length + SSkp_2章_TxtArr.length + SSkp_3章_TxtArr.length;
        DelSpriteSpan(PN_SSkpBase, PN_SSkpTxt + _PicSum);
        Menu禁止Flg = false;
        Menu禁止Flame = 5;
        return false; 
    }
    return true; 
}
let SSkipLoadCmp_Func = function () {
    $gameSwitches.setValue(BtlStatic.SW_終了後HP回復, true); 
}
let NS_DbgUpdate = Game_Interpreter.prototype.NUpdateSc;
Game_Interpreter.prototype.NUpdateSc = function () {
    NS_DbgUpdate.call(this);
    if (DbgFlg) {
        let _dbgNo = -1;
        if (Dbm_Drawflame > 0) Dbm_Drawflame--;
        if (Input.isTriggered('dbg_Ex') && Dbm_Drawflame <= 0) {
            this.SetCmnEventSc(CN_DbmCmnNo); 
            return;
        }
        if (Input.isTriggered('dbg_0')) _dbgNo = 0;
        if (Input.isTriggered('dbg_1')) _dbgNo = 1;
        if (Input.isTriggered('dbg_2')) _dbgNo = 2;
        if (Input.isTriggered('dbg_3')) _dbgNo = 3;
        if (Input.isTriggered('dbg_4')) _dbgNo = 4;
        if (Input.isTriggered('dbg_5')) _dbgNo = 5;
        if (Input.isTriggered('dbg_6')) _dbgNo = 6;
        if (Input.isTriggered('dbg_7')) _dbgNo = 7;
        if (Input.isTriggered('dbg_8')) _dbgNo = 8;
        if (Input.isTriggered('dbg_9')) _dbgNo = 9;
        if (_dbgNo != -1) this.Dbg_KeyDown(_dbgNo);
    }
}
let Dbg_HelpTxt = [
    "0キー：◆デバッグコマンド一覧　を閉じる",
    "1キー：胸の装甲を取り除く",
    "2キー：ダンジョン引き直し：即表示",
    "3キー：",
    "4キー：",
    "5キー：",
    "6キー：ロマーシャ敗北",
    "7キー：バニボン強制発動",
    "8キー：ロマーシャ立ち絵再開",
    "9キー：性欲ゲージ+11"
];
const _DbgPicNo = PVS_MaxPicNo - 15; 
let _DbgDrawFlg = false;
Game_Interpreter.prototype.Dbg_helpDraw = function () {
    this.SetPict(_DbgPicNo, "system/DbgHelp", NErrPos._x, NErrPos._y);
    D_Text_Cng_font = ""; 
    let fseSet = "\\ow[0]"
    for (let i = 0; i <= Dbg_HelpTxt.length - 1; i++) {
        this.SetPicStr(_DbgPicNo + 1 + i, fseSet + Dbg_HelpTxt[i], 16, NErrPos._x + 34, NErrPos._y + 39 + (20 * i));
        if (i == 10) {
            break;
        }
    }
    D_Text_Cng_font = ""; 
    _DbgDrawFlg = true;
}
Game_Interpreter.prototype.Dbg_KeyDown = function (_DbgNo) {
    if ($gameSwitches.value(SW_NoDebug)) return;
    if (_DbgDrawFlg) {
        this.DelPictSpan(_DbgPicNo, PVS_MaxPicNo);
    }
    try { 
        switch (_DbgNo) {
            case 1: 
                if (battleflg) { 
                    for (let i = 0; i <= NEnemy.length - 1; i++) {
                        this.SetEnemyNextAction(i, true); 
                    }
                }
                break;
            case 2: 
                if (RD_Flg) {
                    this.RD_ReloadBtnOn();
                    RD_ReloadCnt = 0;
                }
                break;
            case 3: 
                break;
            case 4: 
                break;
            case 5: 
                break;
            case 6: 
                if (battleflg) {
                    NPlayer[0]._hp = 0;
                } else {
                    this.SetCmnEventSc(1293);
                }
                break;
            case 7: 
                if (battleflg) {
                    this.BtlItemBtnUse(EnItemNo.BaniBom);
                } else {
                    this.SetCmnEventSc(1294);
                }
                break;
            case 8: 
                this.SetCmnEventSc(1295);
                break;
            case 9: 
                if ($gameVariables._data[VN_Seikan] == undefined) {
                    $gameVariables._data[VN_Seikan] = 0;
                }
                $gameVariables._data[VN_Seikan] += 11;
                break;
            case 0: 
                if (!_DbgDrawFlg) {
                    this.Dbg_helpDraw();
                } else {
                    _DbgDrawFlg = false;
                }
                break;
        }
    } catch (e) {
    }
    console.log(Dbg_HelpTxt[_DbgNo]);
    if (_DbgNo != 0) {
        _DbgDrawFlg = false;
    }
}
let TBtl_EnemyNo = 0;   
let TBtl_MikataNo = 0;  
let TBtl_EditEmNo = 0;  
let NoMikataCngFlg = false;
Game_Interpreter.prototype.Battle_Easy_Setting = function () {
    if (dbgBtlClass == null) dbgBtlClass = new DbgBtlClass($DbgBtlClass);
    this.Dbg_デッキカード追加(dbgBtlClass.deckCardList);
    TBtl_EnemyNo = dbgBtlClass.enemyTrpId;
    if (!NoMikataCngFlg) TBtl_MikataNo = dbgBtlClass.mikataId;
    if (TBtl_EditEmNo != 0) TBtl_EnemyNo = TBtl_EditEmNo;
    NoMikataCngFlg = false;
}
Game_Interpreter.prototype.Battle_Easy_Setting_2 = function () {
    Dbg_デッキ変更_OFF = true;
    this.Battle_Easy_Setting();
}
Game_Interpreter.prototype.Battle_Easy_Setting_3 = function () {
    Dbg_デッキ変更_OFF = true;
    NoMikataCngFlg = true;
    this.Battle_Easy_Setting();
}
const PN_BtlEffCheck = 150;
const PN_BtlEffCard = PN_BtlEffCheck + 1;
let BtlEff_FstScNo = 1; 
let EffCheck_BtlUpdate = Game_Interpreter.prototype.BtlUpdate;
Game_Interpreter.prototype.BtlUpdate = function () {
    if (DbgFlg) {
        if (Input.isTriggered('dbg_BtlEff')) {
            if (_Btl_EffCheck_Flg) {
                _Btl_EffCheck_Flg = false;
                this.DelSpriteSpan(PN_BtlEffCheck, PN_BtlEffCard + 26);
            } else {
                _Btl_EffCheck_Flg = true;
                this.Btl_EffCheck_Start();
            }
        }
        if (_Btl_EffCheck_Flg) {
            this.Btl_EffCheck_Update();
        }
    }
    EffCheck_BtlUpdate.call(this);
}
let _dbgBtlSetup_1 = Game_Interpreter.prototype.BattleSetUp;
Game_Interpreter.prototype.BattleSetUp = function () {
    _Btl_EffCheck_Flg = false;
    _dbgBtlSetup_1.call(this);
}
let _Btl_EffCheck_flame = 0;
let _Btl_EffCheck_Flg = false;
let _Btl_EffCHeck_SelNo = -1;
let _Btl_EffPicArr = [];
let CM_Btl_EffPic = [
    [1182, 753, 115, 51],
    [1182 + 130, 753, 115, 51]
];
Game_Interpreter.prototype.Btl_EffCheck_Start = function () {
    _Btl_EffCheck_flame = 0;
    BtlEff_FstScNo = $gameVariables.value(VN_DggEffScNo);
    if (BtlEff_FstScNo < 500) {
        BtlEff_FstScNo = 500;
        $gameVariables.setValue(VN_DggEffScNo ,500);
    }
    this.SetSprite(PN_BtlEffCheck, DbgPicPath + "PN_BtlEffCheck", 0, 0);
    this.Btl_EffCheck_CardDraw();
}
Game_Interpreter.prototype.Btl_EffCheck_CardDraw = function () {
    this.DelSpriteSpan(PN_BtlEffCard + 0, PN_BtlEffCard + 25);
    _Btl_EffPicArr = [];
    for (let i = 0; i <= 26 - 1; i++) {
        let _CardData = $dataWeapons[BtlEff_FstScNo + i];
        let _DrawStr = "No." + (BtlEff_FstScNo + i) + " " + _CardData.name + "　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　";
        if (i == _Btl_EffCHeck_SelNo) {
            this.SetPicStrBG("#336699");
        }
        this.SpriteStr(PN_BtlEffCard + i, _DrawStr, 21, 980, 45 + (29 * i));
        _Btl_EffPicArr.push(PN_BtlEffCard + i);
    }
}
Game_Interpreter.prototype.Btl_EffCheck_Update = function () {
    if (TouchInput.wheelY < 0) { 
        BtlEff_FstScNo--;
        if (BtlEff_FstScNo <= 0) BtlEff_FstScNo = 1;
        this.Btl_EffCheck_CardDraw();
    }
    if (TouchInput.wheelY > 0) { 
        BtlEff_FstScNo++;
        if (BtlEff_FstScNo + 25 > $dataWeapons.length - 1) BtlEff_FstScNo--;
        this.Btl_EffCheck_CardDraw();
    }
    let _CNo = overSpriteClickable(PN_BtlEffCheck, CM_Btl_EffPic);
    if (_CNo != -1) {
        if (TouchInput.isTriggered()) {
            if (_CNo == 0) {
                BtlEff_FstScNo -= 25;
                if (BtlEff_FstScNo <= 0) BtlEff_FstScNo = 1;
            }
            if (_CNo == 1) {
                BtlEff_FstScNo += 25;
                if (BtlEff_FstScNo + 25 > $dataWeapons.length - 1) BtlEff_FstScNo = $dataWeapons.length - 1;
            }
            this.Btl_EffCheck_CardDraw();
        }
        return;
    }
    _CNo = overPointerSpCkArr(_Btl_EffPicArr);
    if (_CNo != -1) {
        if (_Btl_EffCHeck_SelNo != _CNo - PN_BtlEffCard) {
            _Btl_EffCHeck_SelNo = _CNo - PN_BtlEffCard;
            this.Btl_EffCheck_CardDraw();
        }
        if (TouchInput.isTriggered()) {
            $gameVariables.setValue(VN_DggEffScNo, BtlEff_FstScNo);
            DbgCardUseNo = _Btl_EffCHeck_SelNo + BtlEff_FstScNo;
            this.UTA_Save();
        }
    }
}
const VN_DggEm_MaxNo = 1085;
var _DggEm_MaxNo = 0;
Game_Interpreter.prototype.Btl_EmNoSel_Start = function () {
    _Btl_EffCheck_flame = 0;
    BtlEff_FstScNo = $gameVariables.value(VN_DggEmScNo);
    _DggEm_MaxNo = $gameVariables.value(VN_DggEm_MaxNo);
    this.SetSprite(PN_BtlEffCheck, DbgPicPath + "PN_BtlEmNoSel", 0, 0);
    this.Btl_EmNoSel_Draw();
}
let emBtlTestMax = 23;
Game_Interpreter.prototype.Btl_EmNoSel_Draw = function () {
    this.DelSpriteSpan(PN_BtlEffCard + 0, PN_BtlEffCard + emBtlTestMax);
    _Btl_EffPicArr = [];
    for (let i = 0; i <= $DbgBtlClass.enemyTrpSortList.length - 1; i++) {
        if (i + BtlEff_FstScNo > $DbgBtlClass.enemyTrpSortList.length - 1) break;
        let _TrpData = $dataTroops[$DbgBtlClass.enemyTrpSortList[i + BtlEff_FstScNo]];
        let _DrawStr = "ID." + _TrpData.id + " " + _TrpData.name + "　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　";
        if (i == _Btl_EffCHeck_SelNo) this.SetPicStrBG("#336699");
        this.SpriteStr(PN_BtlEffCard + i, _DrawStr, 21, 980, 45 + (29 * i));
        _Btl_EffPicArr.push(PN_BtlEffCard + i);
        if (emBtlTestMax == i) break;
    }
    this.SetSprite(PN_BtlEffCard + emBtlTestMax + 1, DbgPicPath + "BtlUpCngBtn", 1200, 755);
    this.SetSprite(PN_BtlEffCard + emBtlTestMax + 2, DbgPicPath + "BtlDownCngBtn", 1320, 755);
}
Game_Interpreter.prototype.Btl_EmNoSel_Update = function () {
    if (TouchInput.wheelY < 0) { 
        BtlEff_FstScNo--;
        if (BtlEff_FstScNo <= 0) BtlEff_FstScNo = 1;
        this.Btl_EmNoSel_Draw();
    }
    if (TouchInput.wheelY > 0) { 
        BtlEff_FstScNo++;
        if (_DggEm_MaxNo != 0) {
            if (BtlEff_FstScNo + emBtlTestMax > _DggEm_MaxNo - 1) BtlEff_FstScNo--;
        }
        if (BtlEff_FstScNo + emBtlTestMax > $dataTroops.length - 1) BtlEff_FstScNo--;
        this.Btl_EmNoSel_Draw();
    }
    this.SpriteCngColor( PN_BtlEffCard + emBtlTestMax + 1);
    this.SpriteCngColor( PN_BtlEffCard + emBtlTestMax + 2);
    if (overPointerSpCk(PN_BtlEffCard + emBtlTestMax + 1)) {
        this.SpriteCngColor( PN_BtlEffCard + emBtlTestMax + 1 ,[150,150,150,0] );
        if (TouchInput.isTriggered()) {
            BtlEff_FstScNo -= emBtlTestMax;
            if (BtlEff_FstScNo <= 0) BtlEff_FstScNo = 1;
            this.Btl_EmNoSel_Draw();
            return true;
        }
    }
    if (overPointerSpCk(PN_BtlEffCard + emBtlTestMax + 2)) {
        this.SpriteCngColor( PN_BtlEffCard + emBtlTestMax + 2 ,[150,150,150,0] );
        if (TouchInput.isTriggered()) {
            BtlEff_FstScNo += 10;
            if (_DggEm_MaxNo != 0) {
                if (BtlEff_FstScNo + emBtlTestMax > _DggEm_MaxNo - 1) BtlEff_FstScNo--;
            }
            if (BtlEff_FstScNo + emBtlTestMax > $dataTroops.length - 1) BtlEff_FstScNo--;
            this.Btl_EmNoSel_Draw();
            return true;
        }
    }
    let _CNo = overPointerSpCkArr(_Btl_EffPicArr);
    if (_CNo != -1) {
        if (_Btl_EffCHeck_SelNo != _CNo - PN_BtlEffCard) {
            _Btl_EffCHeck_SelNo = _CNo - PN_BtlEffCard;
            this.Btl_EmNoSel_Draw();
        }
        if (TouchInput.isTriggered()) {
            $gameVariables.setValue(VN_DggEmScNo, BtlEff_FstScNo);
            TBtl_EditEmNo = $DbgBtlClass.enemyTrpSortList[_Btl_EffCHeck_SelNo + BtlEff_FstScNo];
            this.UTA_Save();
            this.DelSpriteSpan(PN_BtlEffCheck, PN_BtlEffCheck + 26);
            return false;
        }
    }
    if (TouchInput.isCancelled()) {
        TBtl_EditEmNo = -1;
        $gameVariables.setValue(VN_DggEmScNo, BtlEff_FstScNo);
        this.UTA_Save();
        this.DelSpriteSpan(PN_BtlEffCheck, PN_BtlEffCheck + 26);
        return false;
    }
    return true;
}
let Btl_DgnNo = -1;
let Bef_SelectDgnId = -1;
Game_Interpreter.prototype.Btl_DgnCheck_Start = function () {
    _Btl_EffCheck_flame = 0;
    this.UTA_Load();
    BtlEff_FstScNo = $gameVariables.value(VN_DggDgnScNo);
    this.SetSprite(PN_BtlEffCheck, DbgPicPath + "PN_BtlDgnNoSel", 0, 0);
    this.Btl_DgnCheck_Draw();
}
Game_Interpreter.prototype.Btl_DgnCheck_Draw = function () {
    this.DelSpriteSpan(PN_BtlEffCard + 0, PN_BtlEffCard + 25);
    _Btl_EffPicArr = [];
    for (let i = 0; i <= 26 - 1; i++) {
        try {
            let _TrpData = RD_MasterData_Get($RDData.dgnDatas[i + BtlEff_FstScNo].id);
            let _DrawStr = _TrpData.id + "：" + _TrpData.name + "　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　";
            if (i == _Btl_EffCHeck_SelNo) {
                this.SetPicStrBG("#336699");
                Btl_DgnNo = _TrpData._RdId;
            }
            this.SpriteStr(PN_BtlEffCard + i, _DrawStr, 21, 980, 45 + (29 * i));
            _Btl_EffPicArr.push(PN_BtlEffCard + i);
        } catch (e) { }
    }
}
Game_Interpreter.prototype.Btl_DgnCheck_Update = function () {
    if (TouchInput.wheelY < 0) { 
        BtlEff_FstScNo--;
        if (BtlEff_FstScNo <= 0) BtlEff_FstScNo = 0;
        this.Btl_DgnCheck_Draw();
    }
    if (TouchInput.wheelY > 0) { 
        BtlEff_FstScNo++;
        if (BtlEff_FstScNo + 25 > $dataWeapons.length - 1) BtlEff_FstScNo--;
        this.Btl_DgnCheck_Draw();
    }
    let _CNo = overPointerSpCkArr(_Btl_EffPicArr);
    if (_CNo != -1) {
        if (_Btl_EffCHeck_SelNo != _CNo - PN_BtlEffCard) {
            _Btl_EffCHeck_SelNo = _CNo - PN_BtlEffCard;
            this.Btl_DgnCheck_Draw();
        }
        if (TouchInput.isTriggered()) {
            dgnSel_RdId = RD_Id = $RDData.dgnDatas[_Btl_EffCHeck_SelNo + BtlEff_FstScNo].id; 
            $gameVariables.setValue(VN_DggDgnScNo ,BtlEff_FstScNo);
            this.UTA_Save();
            this.DelSpriteSpan(PN_BtlEffCheck, PN_BtlEffCheck + 26);
            return false;
        }
    }
    if (TouchInput.isCancelled()) {
        dgnSel_RdId = -1;
        $gameVariables.setValue(VN_DggDgnScNo ,BtlEff_FstScNo);
        this.UTA_Save();
        this.DelSpriteSpan(PN_BtlEffCheck, PN_BtlEffCheck + 26);
        return false;
    }
    return true;
}
const PN_FzkDbgBase = 220;
const PN_FzkDbgTxt = PN_FzkDbgBase + 1;
let FzkDbgArr = [];
let FzkDbgMode = false;
let FzkDbgZureNo = 0;
let Bef_FzkDbgSelect = 0;
let FzkDbgSelect = 0;
let _Fzk_EffPicArr = [];
Game_Interpreter.prototype.Btl_FzkDbg_Start = function () {
    this.SetSprite(PN_FzkDbgBase, DbgPicPath + "PN_FzkDbgBase", 0, 0);
    this.Btl_FzkDbg_Draw();
    FzkDbgMode = true;
}
Game_Interpreter.prototype.Btl_FzkDbg_Draw = function () {
    this.DelSpriteSpan(PN_FzkDbgTxt, PN_FzkDbgTxt + 26);
    _Fzk_EffPicArr = [];
    for (let i = 0; i <= 26 - 1; i++) {
        let _viewStr = FzkDbgArr[i + FzkDbgZureNo][1];
        if (i == FzkDbgSelect) {
            this.SetPicStrBG("#336699");
        }
        this.SpriteStr(PN_FzkDbgTxt + i, _viewStr, 21, 980, 45 + (29 * i));
        _Fzk_EffPicArr.push(PN_FzkDbgTxt + i);
    }
}
Game_Interpreter.prototype.Btl_FzkDbg_Update = function () {
    if (TouchInput.wheelY < 0) { 
        FzkDbgZureNo--;
        if (FzkDbgZureNo <= 0) FzkDbgZureNo = 1;
        this.Btl_FzkDbg_Draw();
    }
    if (TouchInput.wheelY > 0) { 
        FzkDbgZureNo++;
        if (FzkDbgZureNo + 25 > FzkDbgArr.length - 1) FzkDbgZureNo--;
        this.Btl_FzkDbg_Draw();
    }
    let _CNo = overPointerSpCkArr(_Fzk_EffPicArr);
    if (_CNo != -1) {
        FzkDbgSelect = _CNo - PN_FzkDbgTxt;
        if (TouchInput.isTriggered()) {
            this.Fz_CardSetting(FzkDbgSelect + FzkDbgZureNo);
            this.DelSpriteSpan(PN_FzkDbgBase, PN_FzkDbgTxt + 26);
            this.Fz_CardDrawMove(); 
            FzkDbgMode = false;
            return;
        }
        this.Btl_FzkDbg_Draw();
    }
}
FzkDbgArr.push([0, "ベッドイン"]);
FzkDbgArr.push([1, "緊張"]);
FzkDbgArr.push([2, "トーク（デフォルメ"]);
FzkDbgArr.push([3, "水分補給（デフォルメ"]);
FzkDbgArr.push([4, "たわし洗い"]);
FzkDbgArr.push([5, "鯉の滝登り"]);
FzkDbgArr.push([6, "裏千流下り"]);
FzkDbgArr.push([7, "バスタイム"]);
FzkDbgArr.push([8, "キス"]);
FzkDbgArr.push([9, "乳首舐め手コキ"]);
FzkDbgArr.push([10, "フェラチオ"]);
FzkDbgArr.push([11, "パイズリ"]);
FzkDbgArr.push([12, "アナル舐め手コキ"]);
FzkDbgArr.push([13, "正常位"]);
FzkDbgArr.push([14, "後背位"]);
FzkDbgArr.push([15, "種付プレス"]);
FzkDbgArr.push([16, "ボディタッチ"]);
FzkDbgArr.push([17, "スパイダー騎乗位"]);
FzkDbgArr.push([18, "騎乗位"]);
FzkDbgArr.push([19, "おっぱい吸い"]);
FzkDbgArr.push([20, "ローション（デフォルメ"]);
FzkDbgArr.push([21, "表千流下り"]);
FzkDbgArr.push([22, "風見鶏"]);
FzkDbgArr.push([23, "立ちバック"]);
FzkDbgArr.push([24, "クンニ"]);
FzkDbgArr.push([25, "聖水プレイ"]);
FzkDbgArr.push([26, "アナルファック"]);
FzkDbgArr.push([27, "イラマチオ"]);
FzkDbgArr.push([28, "カエル挟み"]);
FzkDbgArr.push([29, "ボディー洗い"]);
FzkDbgArr.push([30, "恋人繋ぎ"]);
FzkDbgArr.push([31, "スマイル"]);
FzkDbgArr.push([32, "ディルド"]);
FzkDbgArr.push([33, "バイブ"]);
FzkDbgArr.push([34, "誘惑"]);
FzkDbgArr.push([35, "キャストオフ"]);
FzkDbgArr.push([36, "アルコール"]);
FzkDbgArr.push([37, "お掃除フェラ"]);
FzkDbgArr.push([38, "側位"]);
FzkDbgArr.push([39, "髪をほどく（デフォルメ）"]);
Game_Interpreter.prototype.BtlDebug_Save = function () {
    let setStr = "";
    for (let i = 0; i <= $gameSystem.DeckArr[0].length - 1; i++) {
        if (setStr != "") setStr += ",";
        setStr += $gameSystem.DeckArr[0][i];
    }
    $gameVariables.setValue(VN_戦闘Debug, setStr);
    this.UTA_Save();
}
Game_Interpreter.prototype.BtlDebug_Load = function () {
    let setStr = $gameVariables.value(VN_戦闘Debug);
    let setArr = setStr.split(',');
    let setCkArr = [];
    for (let i = 0; i <= setArr.length - 1; i++) {
        setCkArr.push(Number(setArr[i]));
    }
    $gameSystem.DeckArr[0] = setCkArr;
}
