let BSelMenu_flame = 0;
const 情報PicPath = BtlPic + "/Joho/";
const _数字IcoNo = 245;
Game_Interpreter.prototype.N_Btl_BSelMenu_Cng = function () {
    BSelMenu_flame = 0;
    _BSel_メニューFlg = true;
    this.SetSpriteFIn(PN_JBase, 情報PicPath + "PN_JBase", 0, 0, 0, 0, 2);
    this.N_Btl_BSelMenuDraw(PN_jPLStart, NPlayer, 732, 26);
    this.N_Btl_BSelMenuDraw(PN_jEmStart, NEnemy, 48, 30, true);
    if (_Btl_TutorialNo == -1)
        this.SetSpriteFIn(PN_bDataBtn_Close, BtlPic + "PN_bDataBtn_Close", 18, 715, 0, 0, 2, 255);
}
Game_Interpreter.prototype.N_Btl_BSelMenuDraw = function (_PicNo, _State, _PsX, _PsY, _LeftFlg) {
    _LeftFlg = typeof _LeftFlg !== 'undefined' ? _LeftFlg : false;
    D_Text_Cng_font = "Makinas"; 
    if (_LeftFlg) {
        let _CNo = $gameVariables.value(VN_CInChaTNo); 
        this.SetSpriteFIn(_PicNo + PN_jCutIn, Btl_CInPic + "PN_bsCBack_T_C" + _CNo, _PsX + 200, _PsY + 70, 0, 0, 2, 180, 70, 70);
        this.SetSpriteFIn(_PicNo + PN_jCNameTxt, Btl_CInPic + "PN_bsCBack_T_N" + _CNo, _PsX - 340, _PsY - 48, 0, 0, 2, 255, 50, 50);
    } else {
        let _CNo = $gameVariables.value(VN_CInChaBNo); 
        this.SetSpriteFIn(_PicNo + PN_jCutIn, Btl_CInPic + "PN_bsCBack_B_C" + _CNo, _PsX - 370, _PsY + 70, 0, 0, 2, 180, 70, 70);
        this.SetSpriteFIn(_PicNo + PN_jCNameTxt, Btl_CInPic + "PN_bsCBack_B_N" + _CNo, _PsX - 47, _PsY - 46, 0, 0, 2, 255, 50, 50);
    }
    this.SetSpriteFIn(_PicNo + PN_jStBase, 情報PicPath + "PN_jStBase", _PsX + 30, _PsY + 60, 0, 0, 2);
    for (let i = 0; i <= 6 - 1; i++) {
        let _StVarBase = 0;
        let _StVar = 0;
        switch (i) {
            case 0: 
                _StVarBase = _State.mhp;
                _StVar = _State.b_mhp;
                break;
            case 1: 
                _StVarBase = _State.atk;
                _StVar = _State.b_atk;
                break;
            case 2: 
                _StVarBase = _State.def;
                _StVar = _State.b_def;
                break;
            case 3: 
                _StVarBase = _State._hit;
                _StVar = _State.b_hit;
                break;
            case 4: 
                _StVarBase = _State._avo;
                _StVar = _State.b_avo;
                break;
            case 5: 
                _StVarBase = _State._pre;
                _StVar = _State.b_pre;
                break;
        }
        _StVarBase = Math.floor(_StVarBase);
        _StVar = Math.floor(_StVar);
        let _SetVarStr = _StVar;
        let AdjustStVar = function () {
            let ckValue = 568;
            if (_StVarBase > ckValue) _StVarBase = ckValue;
            if (_StVar > ckValue) _StVar = ckValue;
        }
        if (_StVarBase < _StVar) {
            AdjustStVar();
            this.SetSprite(_PicNo + PN_jStBar + i, 情報PicPath + "PN_jStBar_Up", _PsX + 88, _PsY + 72 + (29 * i), 0, _StVar);
            this.MoveSprite(_PicNo + PN_jStBar + i, true, true, 2, 255, true);
            this.SetSprite(_PicNo + PN_jStBarTop + i, 情報PicPath + "PN_jStBar", _PsX + 88, _PsY + 72 + (29 * i), 0, _StVarBase);
            this.MoveSprite(_PicNo + PN_jStBarTop + i, true, true, 2, 255, true);
            _SetVarStr += "（+" + (_StVar - _StVarBase) + "） ";
        } else if (_StVarBase > _StVar) {
            AdjustStVar();
            this.SetSprite(_PicNo + PN_jStBar + i, 情報PicPath + "PN_jStBar", _PsX + 88, _PsY + 72 + (29 * i), 0, _StVarBase);
            this.MoveSprite(_PicNo + PN_jStBar + i, true, true, 2, 100, true);
            this.SetSprite(_PicNo + PN_jStBarTop + i, 情報PicPath + "PN_jStBar_Down", _PsX + 88, _PsY + 72 + (29 * i), 0, _StVar);
            this.MoveSprite(_PicNo + PN_jStBarTop + i, true, true, 2, 255, true);
            _SetVarStr += "（-" + (_StVarBase - _StVar) + "） ";
        } else {
            AdjustStVar();
            this.SetSprite(_PicNo + PN_jStBarTop + i, 情報PicPath + "PN_jStBar", _PsX + 88, _PsY + 72 + (29 * i), 0, _StVarBase);
            this.MoveSprite(_PicNo + PN_jStBarTop + i, true, true, 2, 255, true);
        }
        this.SpriteStr(_PicNo + PN_jStTxt + i, " \\ow[4]\\oc[rgba(0,0,0,1)]" + _SetVarStr + " ", 20, _PsX + 80, _PsY + 60 + (29 * i), 0);
        this.MoveSprite(_PicNo + PN_jStTxt + i, true, true, 2);
    }
    for (let i = 0; i <= _State.state.length - 1; i++) {
        let _CkState = $dataStates[_State.state[i]._No];
        let _StVar = " \\I[" + _CkState.iconIndex + "] \\}" + _CkState.name + "：" + _CkState.message1;
        this.SpriteStr(_PicNo + PN_jStateTxtA + i, _StVar, 23, _PsX + 43, _PsY + 297 + (39 * i), 0);
        this.MoveSprite(_PicNo + PN_jStateTxtA + i, true, true, 2);
        let _TurnStr = "\\oc[rgba(0,0,0,1)]" + _State.state[i]._Turn
        this.SpriteStrR(_PicNo + PN_jStateTxtB + i, _TurnStr, 22, _PsX + 85, _PsY + 307 + (39 * i), 0);
        this.MoveSprite(_PicNo + PN_jStateTxtB + i, true, true, 2);
    }
    let _SetStrArr = ["", ""];
    for (let i = 0; i <= _State.PsvArr.length - 1; i++) {
        let _AmId = _State.PsvArr[i];
        if (i < 3) {
            if (_SetStrArr[0] != "") _SetStrArr[0] += " , ";
            _SetStrArr[0] += $dataArmors[_AmId].description;
        } else {
            if (_SetStrArr[1] != "") _SetStrArr[1] += " , ";
            _SetStrArr[1] += $dataArmors[_AmId].description;
        }
    }
    for (let i = 0; i <= _SetStrArr.length - 1; i++) {
        this.SpriteStr(_PicNo + PN_jPsvTxt + i, _SetStrArr[i], 18, _PsX + 43, _PsY + 297 + 293 + (28 * i), 0);
        this.MoveSprite(_PicNo + PN_jPsvTxt + i, true, true, 2);
    }
    D_Text_Cng_font = ""; 
}
Game_Interpreter.prototype.N_Btl_BSelMenu_Update = function () {
    if (BSelMenu_flame > 5) {
        let _cncl = false;
        this.SpriteCngColor(PN_bDataBtn_Close);
        if (overPointerSpCk(PN_bDataBtn_Close)) {
            this.SpriteCngColor(PN_bDataBtn_Close, [70, 70, 70, 0]);
            if (TouchInput.isTriggered()) {
                _cncl = true;
            }
        }
        if (Input.isTriggered('cancel') || Input.isTriggered('c') || TouchInput.isCancelled() || _cncl) {
            this.N_Btl_BSelMenu_End();
            _Blt_SelWaitFlame = 5;
        }
    }
    BSelMenu_flame++;
}
Game_Interpreter.prototype.N_Btl_BSelMenu_End = function () {
    this.DelSpriteSpan(PN_JBase, PN_JEnd);
    _BSel_メニューFlg = false;
}
let SkillSelNo_Ck = function (_SaCnt) {
    _SaCnt = typeof _SaCnt !== 'undefined' ? _SaCnt : 0;
    let _ckNo = SkillSelNo;
    _ckNo += _SaCnt;
    while (true) {
        if (_ckNo < 0) {
            let _ss = SelectSkillArr.length + _ckNo;
            _ckNo = _ss;
            continue;
        }
        if (_ckNo >= SelectSkillArr.length) {
            let _ss = _ckNo - SelectSkillArr.length;
            _ckNo = _ss;
            continue;
        }
        break;
    }
    return _ckNo;
}
let Sel_BltDrawHitStr = "";
Game_Interpreter.prototype.Sel_BltDraw = function (_PsNo, _SkillId, _OneFlg) {
    _OneFlg = typeof _OneFlg !== 'undefined' ? _OneFlg : false;
    let _ズレX = 20;
    let _BltDt = new _BltImgData(_PsNo);
    let _PicNo = PN_BtlSelUI + (_PsNo * Cnt_PN_bPLBltWin);
    let _PosX = _BltDt._PsX - _ズレX;
    let _PosY = _BltDt._PsY;
    let _SkillNo = SelectSkillArr[_SkillId] + btlSelect_TpUse[SelectDoNo];
    let _THSkillFlg = false;
    if (SelectSkillArr[_SkillId] == SKN_THSkill + $gameVariables.value(VN_THSkLv)) {
        _SkillNo = SKN_THSkill + $gameVariables.value(VN_THSkLv);
        _THSkillFlg = true;
        if (_PsNo == 0) this.MoveSprite(PN_TPPowUp, true, true, 5, 0);
    }
    let _ColStr = Skill相性Col(_SkillNo, NEnemy.DO_Arr[SelectDoNo]);
    if (!Em_DoViewArr[SelectDoNo]) _ColStr = ""; 
    let _HitStr = Sel_BltDrawHitStr;
    let _Opi = _BltDt._透明度;
    if (_OneFlg) {
        _Opi = 255;
        _PosX = _BltDt._PsX;
    }
    if (_THSkillFlg) Draw_弾丸Cost = _PL_SelWillMp;
    this.N_Btl_Pl弾丸Draw(_PicNo, _ColStr, _HitStr, _SkillNo, _PosX, _PosY, _Opi, _BltDt._拡大);
    if (!_THSkillFlg) this.TpUse_PicColCng(_PicNo, SelectDoNo);
    if (!_OneFlg) {
        this.N_Btl_Pl弾丸Move(_PicNo, _PosX + _ズレX, _PosY, 5);
    }
}
Game_Interpreter.prototype.TpUse_PicColCng = function (_PicNo, _TpSelNo) {
    this.SpriteCngColor(_PicNo);
    let _SetWari = 0;
    switch (btlSelect_TpUse[_TpSelNo]) {
        case 1:
            _SetWari = (1 / 3);
            this.SpriteCngColor(_PicNo, [150 * _SetWari, 0 * _SetWari, 0 * _SetWari, 0]);
            break;
        case 2:
            _SetWari = (2 / 3);
            this.SpriteCngColor(_PicNo, [150 * _SetWari, 10 * _SetWari, 11 * _SetWari, 0]);
            break;
        case 3:
            _SetWari = (3 / 3);
            this.SpriteCngColor(_PicNo, [150 * _SetWari, 10 * _SetWari, 10 * _SetWari, 0]);
            break;
    }
}
class _BltImgData {
    constructor(_PsNo) {
        this._拡大 = 100;
        this._透明度 = 255;
        this._差X = 0;
        this._差Y = 0;
        if (Math.abs(_PsNo) == 1) {
            this._拡大 = 80;
            this._差X = 86;
        }
        if (Math.abs(_PsNo) == 2) {
            this._拡大 = 75;
            this._透明度 = 180;
            this._差X = 180;
        }
        if (Math.abs(_PsNo) == 3) {
            this._拡大 = 50;
            this._透明度 = 0;
            this._差X = 250;
        }
        if (_PsNo > 0) this._差Y = 10;
        let _sX = DoPos_Pl._x + 50;
        let _sY = DoPos_Pl._y - 5 + (_BltY差 * SelectDoNo);
        this._PsX = _sX + this._差X + 180;
        this._PsY = _sY + this._差Y + (_BltY差 * _PsNo);
    }
}
Game_Interpreter.prototype.TH_Skill_Add = function () {
    if (SelectSkillArr.indexOf(SKN_THSkill + $gameVariables.value(VN_THSkLv)) == -1) {
        SelectSkillArr.push(SKN_THSkill + $gameVariables.value(VN_THSkLv));
    }
}
Game_Interpreter.prototype.TH_Skill_Del = function () {
    for (let i = 0; i <= SelectSkillArr.length - 1; i++) {
        if (SelectSkillArr[i] == SKN_THSkill + $gameVariables.value(VN_THSkLv)) {
            SelectSkillArr.splice(i, 1);
            i--;
        }
    }
}
let N_Btl_Select_1_flame = 0;
let _シリンダー角度 = 0;
let _THSelectFlg = false;
let _BtlPicX = 0; 
let _BtlPicY = 0;
Game_Interpreter.prototype.N_Btl_Select_1_Draw = function (_OneFlg) {
    _OneFlg = typeof _OneFlg !== 'undefined' ? _OneFlg : false;
    let _SelDoSkNo = NPlayer.DO_Arr[SelectDoNo];
    N_Btl_Select_1_flame = _BtlNxt_flame = 0;
    for (let i = 0; i <= SelectSkillArr.length - 1; i++) {
        if (_SelDoSkNo == SelectSkillArr[i] + btlSelect_TpUse[SelectDoNo]) {
            SkillSelNo = i;
        }
    }
    if (_THSelectFlg) {
        if (SelectSkillArr.indexOf(SKN_THSkill) != -1) {
            SkillSelNo = SelectSkillArr.indexOf(SKN_THSkill);
        }
        _THSelectFlg = false;
    }
    _BSelMode = 1;
    for (let i = -2; i <= 2; i++) {
        if (i == 0) {
            Sel_BltDrawHitStr = this._Txt命中被弾(
                SelectDoNo, SelectSkillArr[SkillSelNo] + btlSelect_TpUse[SelectDoNo]
            );
            let _BltDt = new _BltImgData(i);
            _BtlPicX = _BltDt._PsX;
            _BtlPicY = _BltDt._PsY;
        }
        this.Sel_BltDraw(i, SkillSelNo_Ck(i), _OneFlg);
        Sel_BltDrawHitStr = "";
    }
    _BefNo = 0;
    let _SkillNo = SelectSkillArr[SkillSelNo];
    if (SelectSkillArr[SkillSelNo] != SNo_ドミニオン) {
        _SkillNo += btlSelect_TpUse[SelectDoNo];
    }
    this.N_Btl_SetuView(_SkillNo, 636 + 330, 375 + (_BltY差 * SelectDoNo));
}
let BltSel_flame = 0;
let TPUpPs = new Pos2D(1207, 368);
Game_Interpreter.prototype.BltSelMove = function (_MoveNo) {
    _シリンダー角度 += 60 * _MoveNo;
    this.AngleSprite(PN_BtlSrinder, _シリンダー角度);
    for (let i = -2; i <= 2; i++) {
        let _BltDt = new _BltImgData(i + _MoveNo);
        let _PicNo = PN_BtlSelUI + (i * Cnt_PN_bPLBltWin);
        let _PicX = _BltDt._PsX;
        let _PicY = _BltDt._PsY;
        let _Opi = _BltDt._透明度;
        let _MSize = _BltDt._拡大;
        this.N_Btl_Pl弾丸Move(_PicNo, _PicX, _PicY, 5, _Opi, _MSize);
    }
    let _BltDt = new _BltImgData(-3 * _MoveNo);
    this.N_Btl_Pl弾丸Move(PN_BtlSelUI + (-3 * Cnt_PN_bPLBltWin), _BltDt._PsX, _BltDt._PsY, 5, 0, _BltDt._拡大);
    _BltDt = new _BltImgData(-2 * _MoveNo);
    this.N_Btl_Pl弾丸Move(PN_BtlSelUI + (+3 * Cnt_PN_bPLBltWin), _BltDt._PsX, _BltDt._PsY, 5,
        _BltDt._透明度, _BltDt._拡大);
    let tpBtnDrawSkipFlg = false;
    if (_Btl_TutorialNo != -1) {
        if (_Btl_TutorialNo != 26) tpBtnDrawSkipFlg = true;
    }
    this.DelSpriteSpan(PN_TPPowUp + 0, PN_TPPowUp + 1);
    if (SkillSelNo == -1) SkillSelNo = SelectSkillArr.length - 1;
    if (!tpBtnDrawSkipFlg && SelectSkillArr[SkillSelNo] != SNo_ドミニオン) {
        if (btlSelect_TpUse[SelectDoNo] != 3 && btlSelect_PlTp >= 10) {
            this.SetSpriteC(PN_TPPowUp + 0, BtlPic + "PN_TPPowUp",
                TPUpPs._x - 10, TPUpPs._y + (_BltY差 * SelectDoNo), 0);
            this.MoveSprite(PN_TPPowUp + 0, TPUpPs._x, true, 5, 255);
            if (btlSelect_PlTp < 10) this.DelSprite(PN_TPPowUp + 0);
        }
        if ((btlSelect_TpUse[SelectDoNo] != 0)) {
            this.SetSpriteC(PN_TPPowUp + 1, BtlPic + "PN_TPPowUp_Cancel",
                TPUpPs._x - 57 - 10, TPUpPs._y + 134 + (_BltY差 * SelectDoNo), 0);
            this.MoveSprite(PN_TPPowUp + 1, TPUpPs._x - 57 - 10, true, 5, 255);
        }
    }
    BltSel_flame = 5;
};
let _BtlNxt_flame = 0;
let _Bef_PLDoNo = 0; 
let _Bef_PLDoTpCnt = 0; 
let _Blt_SelWaitFlame = 0;
let _Btl_ブーストLv = 0;
Game_Interpreter.prototype.N_Btl_SelectUpdate_1 = function () {
    if (_Blt_SelWaitFlame > 0) {
        _Blt_SelWaitFlame--;
        return;
    }
    if (_Nowシリンダー角度 > _シリンダー角度) {
        _Nowシリンダー角度 += -10;
        this.AngleSprite(PN_BtlSrinder, _Nowシリンダー角度);
        if (_Nowシリンダー角度 < _シリンダー角度) _Nowシリンダー角度 = _シリンダー角度;
    }
    if (_Nowシリンダー角度 < _シリンダー角度) {
        _Nowシリンダー角度 += 10;
        this.AngleSprite(PN_BtlSrinder, _Nowシリンダー角度);
        if (_Nowシリンダー角度 > _シリンダー角度) _Nowシリンダー角度 = _シリンダー角度;
    }
    if (BltSel_flame > 0) {
        BltSel_flame--;
        if (BltSel_flame == 0) this.N_Btl_Select_1_Draw(true);
        return;
    }
    if (_BtlNxt_flame >= 1) {
        if (_BtlNxt_flame == 6) {
            this.N_Btl_DoView();
            let _DelMinPic = PN_BtlSelUI + (-3 * Cnt_PN_bPLBltWin);
            let _DelMaxPic = PN_BtlSelUI + (+3 * Cnt_PN_bPLBltWin);
            this.DelSpriteSpan(_DelMinPic, _DelMaxPic);
            this.DelSpriteSpan(PN_TPPowUp, PN_TPPowUp + 1);
            if (NPlayer.DO_Arr[SelectDoNo] != 0) {
                this.N_Btl_SetuView(NPlayer.DO_Arr[SelectDoNo], _DoSetuPosX, 402 + (_BltY差 * SelectDoNo));
            }
            _BSelMode = 0;
            let _PlDoCnt = 0;
            for (let i = 0; i <= NPlayer.DO_Arr.length - 1; i++) {
                if (NPlayer.DO_Arr[i] != 0) _PlDoCnt++;
            }
            if (_PlDoCnt >= 6) {
                if (this.Blt_TutorialCheck()) { 
                    this.Btl_Ready_Cng();
                }
            }
        }
        _BtlNxt_flame++;
        return;
    }
    if (N_Btl_Select_1_flame > 0) {
        if (this.N_Btl_THModeUpdate()) return; 
        if (_Btl_TutorialNo == 0) _Btl_TutorialNo = 1; 
        if (this.Blt_TutorialUpdate()) return; 
        this.N_Btl_異常確認_Update();
        if (_Btl_TutorialNo != -1) this.DelSprite(PN_bDataBtn);
        let _MenuOnFlg = false;
        this.SpriteCngColor(PN_bDataBtn);
        if (overPointerSpCk(PN_bDataBtn)) {
            this.SpriteCngColor(PN_bDataBtn, [70, 70, 70, 0]);
            if (TouchInput.isTriggered()) {
                _MenuOnFlg = true;
            }
        }
        if (Input.isTriggered('c')) {
            _MenuOnFlg = true;
        }
        if (_MenuOnFlg) {
            if (_Btl_TutorialNo != -1) return; 
            this.SpriteCngColor(PN_bDataBtn);
            this.N_Btl_BSelMenu_Cng();
            return;
        }
        let _mvFlg = false;
        if (Input.isTriggered('up') || TouchInput.wheelY > 0) {
            SkillSelNo++;
            _mvFlg = true;
            this.BltSelMove(-1);
        }
        if (Input.isTriggered('down') || TouchInput.wheelY < 0) {
            SkillSelNo--;
            _mvFlg = true;
            this.BltSelMove(1);
        }
        if (SkillSelNo < 0) SkillSelNo = SelectSkillArr.length - 1;
        if (SkillSelNo >= SelectSkillArr.length) SkillSelNo = 0;
        let tpBtnDrawSkipFlg = false;
        if (_Btl_TutorialNo != -1) {
            if (_Btl_TutorialNo != 26) tpBtnDrawSkipFlg = true;
        }
        let BoostUpAction  = function (gi) {
            if (btlSelect_PlTp < 10 || btlSelect_TpUse[SelectDoNo] >= 3) {
                return;
            }
            btlSelect_PlTp -= 10;
            btlSelect_TpUse[SelectDoNo]++;
            gi.BltSelMove(0);
            gi.N_Btl_Select_1_Draw();
            _Btl_ブーストLv = btlSelect_TpUse[SelectDoNo];
            gi.SetCmnEventSc(CN_SkillLvUp);
            gi.N_Btl_SelTpDraw();
        }
        let BoostDownAction = function (gi) {
            btlSelect_TpUse[SelectDoNo]--;
            btlSelect_PlTp += 10;
            gi.BltSelMove(0);
            gi.N_Btl_Select_1_Draw();
            _Btl_ブーストLv = btlSelect_TpUse[SelectDoNo];
            gi.SetCmnEventSc(CN_SkillLvDown);
            gi.N_Btl_SelTpDraw();
        }
        if (SelectSkillArr[SkillSelNo] != SKN_THSkill + $gameVariables.value(VN_THSkLv)
            && !tpBtnDrawSkipFlg) {
            if (Input.isTriggered('right')) {
                BoostUpAction(this);
            }
            if (Input.isTriggered('left') && btlSelect_TpUse[SelectDoNo] > 0) {
                BoostDownAction(this);
            }
        }
        if (_mvFlg) {
            NPlayer.DO_Arr[SelectDoNo] = SelectSkillArr[SkillSelNo] + btlSelect_TpUse[SelectDoNo];
            _PL_DoArrDraw = true; 
            this.N_Btl_DoView();
            _PL_DoArrDraw = false;
            this.SetCmnEvent(CN_戦闘ｺﾏﾝﾄﾞ回転時);
        }
        _ckNo = overPointerSpCkArr(BltPicArr);
        let _cnslFlg = false;
        if (_ckNo != -1) {
            _ckNo = Math.floor((_ckNo - PN_bPLBltWin) / Cnt_PN_bPLBltWin);
            if (SelectDoNo != _ckNo) {
                if (TouchInput.isTriggered()) {
                }
            }
        }
        if (TouchInput.isCancelled() || Input.isTriggered('cancel') || _cnslFlg) {
            if (_Btl_TutorialNo == 26) return; 
            if (SelectDoNo == 0) return; 
            _BSelMode = 0;
            for (let i = PN_BtlSrinder; i <= PN_SetuHitTxt + 1 - 1; i++) {
                this.MoveSpriteAdd(i, -20, 0, 5, 0);
            }
            this.MoveSpriteAdd(PN_TPPowUp, -20, 0, 5, 0);
            NPlayer.DO_Arr[SelectDoNo] = _Bef_PLDoNo;
            btlSelect_PlTp += (btlSelect_TpUse[SelectDoNo] - _Bef_PLDoTpCnt) * 10;
            btlSelect_TpUse[SelectDoNo] = _Bef_PLDoTpCnt;
            SelectDoNo--; 
            if (SelectDoNo < 0) SelectDoNo = 0;
            this.N_Btl_DoView();
            return;
        }
        this.SpriteCngColor(PN_TPPowUp + 0);
        if (overPointerSpCk(PN_TPPowUp + 0)) {
            this.SpriteCngColor(PN_TPPowUp + 0, [150, 100, 100, 0]);
            if (TouchInput.isTriggered()) {
                BoostUpAction(this);
            }
            return;
        }
        this.SpriteCngColor(PN_TPPowUp + 1);
        if (overPointerSpCk(PN_TPPowUp + 1)) {
            this.SpriteCngColor(PN_TPPowUp + 1, [150, 100, 100, 0]);
            if (TouchInput.isTriggered()) {
                BoostDownAction(this);
            }
            return;
        }
        this.SpriteCngColor(PN_BtlTHBlt);
        let _THPushOkFlg = btlSelect_PlTp >= 50;
        let _TPDrawSkip = false;
        if (_Btl_TutorialNo != -1) {
            if (_Btl_TutorialNo < 27) _TPDrawSkip = true;
            if (_Btl_TutorialNo > 36) _TPDrawSkip = true;
        }
        let _THOnFlg = false;
        if (!_TPDrawSkip) {
            if (NPlayer._tp >= 50 && !TH_ModeFlg) {
                if (btlSelect_PlTp >= 50) {
                    this.CngSprite(PN_BtlTHBlt, BtlPic + "PN_THBlt_1");
                } else {
                    this.CngSprite(PN_BtlTHBlt, BtlPic + "PN_THBlt_1_Off");
                }
            }
            if (Input.isTriggered('shift') && _THPushOkFlg) {
                _THOnFlg = true;
            }
            if (overPointerSpCk(PN_BtlTHBlt) && _THPushOkFlg) {
                this.SpriteCngColor(PN_BtlTHBlt, [80, 80, 80, 0]);
                if (TouchInput.isTriggered()) {
                    _THOnFlg = true;
                }
            }
        }
        if (_THOnFlg) {
            this.Blt_Tutorial_CheckShift(); 
            this.BLogAdd(120, SCol.Red + "Entered TH Mode!!");
            this.N_Btl_THModeStart(); 
            return;
        }
        if (Input.isTriggered('ok') || TouchInput.isTriggered()) {
            if (SelectSkillArr[SkillSelNo] == SNo_ドミニオン) {
                btlSelect_PlTp += btlSelect_TpUse[SelectDoNo] * 10;
                btlSelect_TpUse[SelectDoNo] = 0;
                this.N_Btl_SelTpDraw();
            }
            NPlayer.DO_Arr[SelectDoNo] = SelectSkillArr[SkillSelNo] + btlSelect_TpUse[SelectDoNo];
            EasingStr = "easeOutQuad";
            let _PosX = GetSpriteData(PN_BtlSelUI)._x;
            let _PosY = GetSpriteData(PN_BtlSelUI)._y;
            this.N_Btl_Pl弾丸Move(PN_BtlSelUI, _PosX - 261, _PosY, 5, 255, _Blt拡大);
            this.MoveSpriteAdd(PN_BtlSrinder, -20, 0, 5, 0);
            let _PicNo = PN_bPLBltWin + (SelectDoNo * Cnt_PN_bPLBltWin);
            _PosX = GetSpriteData(_PicNo)._x;
            _PosY = GetSpriteData(_PicNo)._y;
            this.N_Btl_Pl弾丸Move(_PicNo, _PosX - 261, _PosY, 5, 0, _Blt拡大);
            EasingStr = "";
            _BtlNxt_flame++;
            SelectDoNo++; 
            this.Blt_Tutorial_SelCheck(); 
            this.SetCmnEvent(CN_戦闘ｺﾏﾝﾄﾞ決定時);
        }
    }
    N_Btl_Select_1_flame++;
}
Game_Interpreter.prototype._戦闘弾丸UI_OFF = function () {
    for (let i = PN_bEmBltWin; i <= PN_bPLBltWin + Cnt_PN_bPLBltWin * 6; i++) {
        this.MoveSprite(i, true, true, 10, 0, true, true);
    }
    for (let i = PN_bDoPoint; i <= PN_bDoPoint_Em + 19; i++) {
        this.MoveSprite(i, true, true, 10, 0, true, true);
    }
}
Game_Interpreter.prototype._戦闘弾丸UI_ON = function () {
    for (let i = PN_bEmBltWin; i <= PN_bPLBltWin + Cnt_PN_bPLBltWin * 6; i++) {
        this.MoveSprite(i, true, true, 10, 255, true, true);
    }
    for (let i = PN_bDoPoint; i <= PN_bDoPoint_Em + 19; i++) {
        this.MoveSprite(i, true, true, 10, 255, true, true);
    }
}
Game_Interpreter.prototype.Blt_SelectMove = function () {
    this.N_Btl_DoView();
}
let _Btl_ReadyFlame = 0;
Game_Interpreter.prototype.Btl_Ready_Cng = function () {
    _BSel_ReadyFlg = true;
    this.DelSprite(PN_bPLBltHikari);
    this.N_Btl_SetuDel();
    EasingStr = "easeOutQuad";
    this.SetSpriteC(PN_Ready, BtlPic + "PN_Ready", 720, 405, 255, 100, 0);
    this.MoveSprite(PN_Ready, true, true, 10);
    EasingStr = "";
    _Btl_ReadyFlame = 0;
    _DoNo = SelectDoNo = 5;
}
Game_Interpreter.prototype.Btl_Ready_Update = function () {
    if (_Btl_ReadyFlame > 5) {
        if (Input.isTriggered('ok') || TouchInput.isTriggered()) {
            _BSel_ReadyFlg = false;
            this.DelSprite(PN_Ready);
            this.Blt_EnterCng();
        }
        if (Input.isTriggered('cancel') || Input.isTriggered('c') || TouchInput.isCancelled()) {
            _BSel_ReadyFlg = false;
            this.DelSprite(PN_Ready);
            NPlayer.DO_Arr[5] = 0;
        }
    }
    _Btl_ReadyFlame++;
}
let _EnterCnt = 0; 
let Em_DoViewArr_OpenBef = []; 
Game_Interpreter.prototype.Blt_EnterCng = function () {
    this.Adv_SpineEffect_A_Close();
    Em_DoViewArr_OpenBef = Em_DoViewArr.slice(); 
    this.DelSprite(PN_BtlSrinder);
    _DoNo = SelectDoNo = 5;
    _EnterFlame = 1;
    _EnterCnt = 0;
    btlSelect_PlTp = 0;
    this.N_Btl_PlStView();
}
const EnterOpnCnt = 5;
Game_Interpreter.prototype.Blt_EnterUpdate = function () {
    this.DelSprite(PN_bPLBltHikari);
    if (_EnterFlame == 1) {
        i = _EnterCnt;
        if (!Em_DoViewArr[i]) {
            Em_DoViewArr[i] = true; 
            let _ckSkill = $dataSkills[NEnemy.DO_Arr[i]];
            if (_ckSkill != undefined) {
                let _PicNo = PN_bEmBltWin + (i * Cnt_PN_bEmBltWin);
                let _相性Col = Skill相性Col(NEnemy.DO_Arr[i], NPlayer.DO_Arr[i]);
                if (!Em_DoViewArr[i]) _相性Col = ""; 
                let _PosX = DoPos_Em._x;
                let _PosY = DoPos_Em._y + (_BltY差 * i);
                this.N_Btl_Em弾丸Draw(_PicNo, _相性Col, NEnemy.DO_Arr[i], _PosX, _PosY, 255, _Blt拡大);
                this.N_Btl_DoView();
            }
            _EnterCnt++;
        } else {
            _EnterCnt++;
            if (_EnterCnt <= NEnemy.DO_Arr.length - 1) _EnterFlame = 0;
        }
    }
    if (_EnterFlame == EnterOpnCnt - 1) {
        if (_EnterCnt <= NEnemy.DO_Arr.length - 1) _EnterFlame = 0;
    }
    if (_EnterFlame == EnterOpnCnt + 10) {
        this.Adv_SpineEffect_A_Open();
        this.N_Btl_BattleCng();
    }
    _EnterFlame++;
}
