Game_Interpreter.prototype.BtlEvSkip = function () {
    if (battleflg) { 
        this._index = this._list.length; 
    }
}
let _Mikata_Hp_維持Flg = false;
let _Mikata_Hp = [0, 0, 0];
Game_Interpreter.prototype._味方HP_維持開始 = function () {
    _Mikata_Hp_維持Flg = true;
    _Mikata_Hp = [0, 0, 0]; 
    if ($gameVariables.value(BtlStatic.VN_味方No) != 0) { 
        let _EmNo = $gameVariables.value(BtlStatic.VN_味方No);
        let _EmData = new Game_Enemy(_EmNo, 0, 0);
        _Mikata_Hp[0] = _EmData._hp;
        RD_MikataSetup = true;
    }
}
Game_Interpreter.prototype._味方HP_リセット = function () {
    this._味方HP_維持開始();
}
Game_Interpreter.prototype._味方HP_維持終了 = function () {
    _Mikata_Hp_維持Flg = false;
    _Mikata_Hp = [0, 0, 0];
}
Game_Interpreter.prototype.MPKaihuku = function (_KaiMp , b上限突破) {
    b上限突破 = typeof b上限突破 !== 'undefined' ? b上限突破 : true; 
    NPlayer[0]._mp += _KaiMp;
    if (NPlayer[0]._mp > 9) NPlayer[0]._mp = 9;
    if (NPlayer[0]._mp > GetTurnStartRecoveryMP() && !b上限突破) {
        NPlayer[0]._mp = GetTurnStartRecoveryMP();
    }
    this.SetSprite(PN_EdCount, GetBtlEdCountPic(), 817, 621);
}
let GetBtlEdCountPic = function () {
    return BtlPicPath + "PN_EdCount" + Math.max(0, Math.min(NPlayer[0]._mp , 10));
}
Game_Interpreter.prototype.AllCardTrash = function () {
    this.AllCardTrash_Move();
    CardData = [];
}
Game_Interpreter.prototype.AllCardTrash_Move = function () {
    for (let i = 0; i <= CardData.length - 1; i++) {
        $gameScreen.rotatePicture(CardData[i].setPNo, 40);
        EasingStr = "easeOutQuad";
        this.MovePict(CardData[i].setPNo, 977, 759, 45, 255, 0, 0);
        EasingStr = "";
    }
}
let BefSelectSortNo = -2; 
Game_Interpreter.prototype.HandCardPicSort = function (SelectCPNo) {
    let Cardxset = HandZureX();
    let selcount = 0; 
    if (SelectCPNo == -1) {
        this.HandKeepGet(); 
    }
    for (let i = 0; i <= CardData.length - 1; i++) {
        if (SelectCPNo == CardData[i].setPNo) {
            CardData[i].selectFlg = true;
        } else {
            CardData[i].selectFlg = false;
        }
    }
    for (let i = 0; i <= BtlStatic._手札最大枚数 - 1; i++) {
        this.DelPict(PN_Card + i);
        this.PicInObj(PN_Card + i, null);
    }
    let _cardKakudo = (CardData.length / 2) * -Cardkakudo;
    let inCnt = 0;
    let _SelXZure = 0;
    for (let i = 0; i <= CardData.length - 1; i++) {
        CardData[i].XPos = handCardBasePostion._x + (Cardxset * i) + _SelXZure;
        CardData[i].YPos = handCardBasePostion._y + Math.abs(_cardKakudo + (Cardkakudo * i) * 1.2);
        if (CardData[i].selectFlg) { 
            if (i != 0) _SelXZure += 30;
            CardData[i].XPos += _SelXZure;
            CardData[i].YPos = handCardBasePostion._y - 20;
            CardData[i].setPNo = PN_Card + CardData.length - 1;
            this.PicInObj(CardData[i].setPNo, CardData[i].KeepPicData);
            selcount = 1;
            _SelXZure += 30;
        } else {
            if (selcount == 0) { 
                CardData[i].setPNo = PN_Card + inCnt;
                this.PicInObj(CardData[i].setPNo, CardData[i].KeepPicData);
                inCnt++;
            } else { 
                CardData[i].setPNo = PN_Card + CardData.length - 1 - (selcount);
                this.PicInObj(CardData[i].setPNo, CardData[i].KeepPicData);
                selcount++;
            }
        }
    }
}
Game_Interpreter.prototype.BasePLMove = function () {
    if (!this.IsPlayerメタル化()) this.SetSpineAnime(PN_CharacterPL, "Idl", true);
    TgMoveX = NPlayer[0]._screenX;
    TgMoveY = NPlayer[0]._screenY;
    this.MovePict(PN_CharacterPL, TgMoveX, TgMoveY, PLMoveBaseTime, 255, plSpineScaleX, plSpineScaleY);
}
const Cardkakudo = 10; 
let ZeroMoveCardDrawMoveFlg = false;
Game_Interpreter.prototype.CardDrawMove = function () {
    let Cardxset = HandZureX();
    let ccOpi = 200;
    for (let i = 0; i <= CardData.length - 1; i++) {
        let _cardKakudo = (CardData.length / 2) * -Cardkakudo;
        setPNoEv = PN_Card + i;
        CardData[i].setPNo = setPNoEv;
        CardData[i].XPos = handCardBasePostion._x + Cardxset * i;
        let moveFrame = 15;
        if (ZeroMoveCardDrawMoveFlg) moveFrame = 1;
        ZeroMoveCardDrawMoveFlg = false;
        CardData[i].YPos = handCardBasePostion._y + Math.abs(_cardKakudo + (Cardkakudo * i) * 1.2);
        this.MovePict(CardData[i].setPNo, CardData[i].XPos, CardData[i].YPos,moveFrame, ccOpi, 67, 67);
        $gameScreen.tintPicture(CardData[i].setPNo, [-20, -20, -20, 0], 0);
        btlWaitFlame = 3; 
        btl操作不能Flame = moveFrame; 
        this.AnglePict(CardData[i].setPNo, _cardKakudo + (Cardkakudo * i));
        if (CardData[i].MoveAftPtc != "") {
            this.PlayPtcPic(CardData[i].MoveAftPtc, CardData[i].XPos, CardData[i].YPos);
            CardData[i].MoveAftPtc = "";
        }
    }
}
let WinBgm = "WinBgm"; 
let WinBgmSkipFlg = false; 
let LoseSkipFlg = false; 
Game_Interpreter.prototype.WinBgmSkip = function (skipFlg) {
    skipFlg = typeof skipFlg !== 'undefined' ? skipFlg : true;
    WinBgmSkipFlg = BgmLoadSkipFlg = skipFlg;
}
Game_Interpreter.prototype.LoseBgmSkip = function (skipFlg) {
    skipFlg = typeof skipFlg !== 'undefined' ? skipFlg : true;
    LoseSkipFlg = BgmLoadSkipFlg = skipFlg;
}
let BtlWinLoseBgmReset = function () {
    WinBgm = "WinBgm";
    WinBgmSkipFlg = LoseSkipFlg = false;
}
Game_Interpreter.prototype.BtlFlgLoop対策 = function () {
    if (battleflg) this._index = this._list.length; 
}
Game_Interpreter.prototype.PlayAnimeTopBtlChara = function (_ENo, _AnimeNo, _ZureX, _ZureY) {
    _ZureX = typeof _ZureX !== 'undefined' ? _ZureX : 0;
    _ZureY = typeof _ZureY !== 'undefined' ? _ZureY : 0;
    let _AnimeX = _AnimeY = 0;
    if (_ENo <= -1) {
        _AnimeX = NPlayer[(_ENo * -1) - 1]._screenX;
        _AnimeY = NPlayer[(_ENo * -1) - 1]._screenY;
    } else {
        _AnimeX = NEnemy[_ENo]._screenX;
        _AnimeY = NEnemy[_ENo]._screenY;
    }
    this.PlayAnime(_AnimeNo, _AnimeX + _ZureX, _AnimeY + _ZureY);
}
Game_Interpreter.prototype.PlayAnimeTopBtlChara_HpOn = function (_ENo, _AnimeNo, _ZureX, _ZureY) {
    if (_ENo <= -1) {
        if (NPlayer[(_ENo * -1) - 1].hp <= 0) return;
    } else {
        if (NEnemy[_ENo].hp <= 0) return;
    }
    this.PlayAnimeTopBtlChara(_ENo, _AnimeNo, _ZureX, _ZureY);
}
Game_Interpreter.prototype.BattleWhiteSet = function (_time) {
    _time = typeof _time !== 'undefined' ? _time : 25;
    this.SetPictFIn(PNo_Ensyutu, "White", 0, 0, 0, 0, _time);
    this.wait(_time);
};
Game_Interpreter.prototype.BattleWhiteDel = function (_time) {
    _time = typeof _time !== 'undefined' ? _time : 25;
    this.MovePict(PNo_Ensyutu, 0, 0, _time, 0);
    this.wait(_time);
};
Game_Interpreter.prototype.DeckNomalCng = function () {
    for (let i = 0; i <= BtlDeck.length - 1; i++) {
        let _CkMeta = MetaChecker($dataWeapons[BtlDeck[i]], "NCNo")
        if (_CkMeta != "") {
            BtlDeck[i] = Number(_CkMeta);
        }
    }
}
Game_Interpreter.prototype.DeckAccessCng = function () {
    $gameSystem.MasterDeck = $gameSystem.MasterDeck.filter(number => number !== 1);
    BtlDeck = CopyArr($gameSystem.MasterDeck); 
    for (let i = 0; i <= BtlDeck.length - 1; i++) {
        if ((BtlDeck[i] >= 171 && BtlDeck[i] <= 188) ||
            (BtlDeck[i] >= 376 && BtlDeck[i] <= 387) ||
            BtlDeck[i] == 980) {
            BtlDeck.splice(i , 1);
            i--; 
            continue;
        }
    }
    if ($gameSwitches.value(SW_BtlGrbOFF)) BtlDeck.push(4);
    if ($gameSwitches.value(SW_BtlUdeSutuOFF)) BtlDeck.push(5);
    if ($gameSwitches.value(SW_BtlInnerOFF)) BtlDeck.push(6);
    if ($gameSwitches.value(SW_BtlBodySutuOFF)) BtlDeck.push(7);
    if ($gameSwitches.value(SW_BtlLegSutuOFF)) BtlDeck.push(8);
    if ($gameSwitches.value(SW_BtlAmKosiOFF)) BtlDeck.push(9);
    if ($gameSwitches.value(SW_BtlAmLegOFF)) BtlDeck.push(10);
    if ($gameSwitches.value(SW_BtlAmKataOFF)) BtlDeck.push(11);
    if ($gameSwitches.value(SW_BtlPltMuneOFF)) BtlDeck.push(12);
    if ($gameSwitches.value(SW_BtlAmMuneOFF)) BtlDeck.push(13);
}
Game_Interpreter.prototype.デッキ内アクセスカード削除 = function () {
    for (let i = 0; i <= DeckCard.length - 1; i++) {
        if (MetaChecker($dataWeapons[DeckCard[i]] , "アクセス" , false) != false) {
            DeckCard.splice(i , 1); i--; 
            continue;
        }
        if ($dataWeapons[DeckCard[i]] == undefined) continue;
        if ($dataWeapons[DeckCard[i]].wtypeId == CType.必殺) {
            DeckCard.splice(i , 1); i--; 
            continue;
        }
    }
    for (let i = 0; i <= BtlDeck.length - 1; i++) {
        if (MetaChecker($dataWeapons[BtlDeck[i]] , "アクセス" , false) != false) {
            BtlDeck.splice(i , 1); i--; 
            continue;
        }
        if ($dataWeapons[BtlDeck[i]] == undefined) continue;
        if ($dataWeapons[BtlDeck[i]].wtypeId == CType.必殺) {
            BtlDeck.splice(i , 1); i--; 
            continue;
        }
    }
    for (let i = 0; i <= CardData.length - 1; i++) {
        if (MetaChecker($dataWeapons[CardData[i].CardData.id] , "アクセス" , false) != false) {
            CardData.splice(i , 1); i--; 
            continue;
        }
        if (CardData[i].CardData.wtypeId == CType.必殺) {
            CardData.splice(i , 1); i--; 
            continue;
        }
    }
    this.HandCardDraw();
    this.CardDrawMove(); 
}
Game_Interpreter.prototype.Btl_Live2D_FadeOut = function () {
    L2dAutoFadeOut(WaitMdlName, 15);
    CardUsing_EffEnd_Live2DBackFlg = true;
}
Game_Interpreter.prototype.Btl_Live2D_FadeIn = function () {
    L2dFadeMdl(WaitMdlName, WaitSetPs + "in", 15, "", 1, 1, WaitZureX, WaitZureY);
    L2D_ParamSet(MdlRomashaBattle, "BattleSize", 30); 
}
let 敵Grp名判定 = function (_敵判定名) {
    if (SetBtlMVVar_DoEnemyName_味方Flg) {
        let _DoEmNo = NPlayer[_TnEmNo]._enemyId;
        let RtnValue = MetaChecker($dataEnemies[_DoEmNo], _敵判定名, false);
        return RtnValue != false;
    } else {
        let _DoEmNo = NEnemy[TurnCard[0]._No]._enemyId;
        let RtnValue = MetaChecker($dataEnemies[_DoEmNo], _敵判定名, false);
        return RtnValue != false;
    }
}
let SetBtlMVVar_DoEnemyName_味方Flg = false;
let SetBtlMVVar_DoEnemyName = function () {
    if (SetBtlMVVar_DoEnemyName_味方Flg) {
        let enemyID = NPlayer[_TnEmNo]._enemyId;
        BtlMVVar = _以降文字削除($dataEnemies[enemyID].name, "::");
    } else {
        if (TurnCard.length > 0 && TurnCard[0]._No >= 0) {
            let enemyID = NEnemy[TurnCard[0]._No]._enemyId;
            BtlMVVar = _以降文字削除($dataEnemies[enemyID].name, "::");
        }
    }
    SetBtlMVVar_DoEnemyName_味方Flg = false;
}
