Game_Interpreter.prototype.OkzCountUp = function () {
    let _NowOkz = $gameVariables.value(VN_OkzCount); 
    let _BaseOkz = $gameVariables.value(VN_OkzDayUp); 
    let _ItjOkz = $gameVariables.value(VN_OkzItjUp); 
    let OkzUpCount = Math.floor(_BaseOkz * (Math.random() + 0.5));
    _NowOkz += OkzUpCount;
    _NowOkz += _ItjOkz;
    _ItjOkz = Math.floor(_ItjOkz * 0.5); 
    $gameVariables.setValue(VN_OkzCount, _NowOkz)
    $gameVariables.setValue(VN_OkzItjUp, _ItjOkz)
}
let _DelAcCardSave_System = Game_System.prototype.initialize;
Game_System.prototype.initialize = function () { 
    _DelAcCardSave_System.call(this);
    this._DelDeckACardArr = []; 
    this._DelACardArr = []; 
    this._OffAcCard = false; 
};
Game_Interpreter.prototype.AcCard_削除 = function () {
    AcCard削除_Void();
}
let AcCard削除_Void = function () {
    if ($gameSystem._DelDeckACardArr == undefined) $gameSystem._DelDeckACardArr = [];
    if ($gameSystem._DelACardArr == undefined) $gameSystem._DelACardArr = [];
    $gameSystem._OffAcCard = true;
    for (let i = 0; i <= $gameSystem.DeckArr.length - 1; i++) {
        for (let j = 0; j <= $gameSystem.DeckArr[i].length - 1; j++) {
            let _ckCNo = $gameSystem.DeckArr[i][j];
            let _必殺Flg = Check必殺Card($dataWeapons[_ckCNo]);
            if (_必殺Flg) {
                $gameSystem._DelDeckACardArr.push([i, _ckCNo]);
                $gameSystem.DeckArr[i].splice(j, 1);
                j--;
            }
        }
    }
    for (let i = 0; i <= $gameSystem.DeckArr.length - 1; i++) {
        while ($gameSystem.DeckArr[i].length < 20) {
            $gameSystem.DeckArr[i].push(CId_待機);
        }
    }
    for (let i = 1; i <= $dataWeapons.length - 1; i++) {
        let _必殺Flg = Check必殺Card($dataWeapons[i]);
        if (_必殺Flg) {
            let _WCnt = $gameParty.numItems($dataWeapons[i]);
            if (_WCnt > 0) {
                $gameSystem._DelACardArr.push([i, _WCnt]);
                $gameParty.gainItem($dataWeapons[i], -_WCnt, true)
            }
        }
    }
}
Game_Interpreter.prototype.AcCard_戻し = function () {
    if ($gameSystem._DelDeckACardArr == undefined) $gameSystem._DelDeckACardArr = [];
    if ($gameSystem._DelACardArr == undefined) $gameSystem._DelACardArr = [];
    let addDeckArr = [];
    $gameSystem._DelDeckACardArr.forEach(_dArr => {
        if (addDeckArr.indexOf(_dArr[0]) == -1) {
            $gameSystem.DeckArr[_dArr[0]].push(_dArr[1]);
            addDeckArr.push(_dArr[0]);
        }
    });
    $gameSystem._DelACardArr.forEach(_dArr => {
        $gameParty.gainItem($dataWeapons[_dArr[0]], _dArr[1], true);
    });
    $gameSystem._OffAcCard = false;
}
let _CmnSaveEndFlg = false;
Game_Interpreter.prototype.SaveView_Draw = function () {
    _File_CngFlg = true;
    _CmnSaveEndFlg = false;
    this.SetSpriteFIn(PNo_TBack, MenuUIPath + "Save/PN_CmnSaveBase", 0, 0, 0, 0, 10);
    this.MenuSaveView();
}
/** セーブ完了時に実行するAction：完了後 nullに
 * @type {((gi : Game_Interpreter) => void) | null}
 */
let SaveCompAction = null;
Game_Interpreter.prototype.SaveView_Update = function () {
    this.MenuSaveUpdate();
    if (_SaveWaitTimer >= 0) {
        if (_SaveWaitTimer == 0) {
            this.GameFileSave(_SaveFileNo);
            if (SaveCompAction != null) {
                SaveCompAction(this);
                SaveCompAction = null;
            }
        }
        _SaveWaitTimer--;
        return true; 
    }
    if (Input.isTriggered('menu') || TouchInput.isCancelled() || _CmnSaveEndFlg) {
        this.DelSprite(PNo_TBack);
        this.Layer1_DelPicture();
        _SaveWaitTimer = -1;
        return false;
    }
    return true;
}
var _saveMapId = -1;
var _saveMapXPos = -1;
var _saveMapYPos = -1;
Game_Interpreter.prototype.SaveMapAndPostion = function () {
    _saveMapId = $gameMap.mapId();
    _saveMapXPos = $gamePlayer.x;
    _saveMapYPos = $gamePlayer.y;
}
Game_Interpreter.prototype.LoadMapAndPostion = function () {
    if (_saveMapId != -1) {
        $gamePlayer.reserveTransfer(_saveMapId, _saveMapXPos, _saveMapYPos, 0, 2);
    }
}
Game_Interpreter.prototype.HP割合回復 = function (_Par) {
    let _Wari = _Par / 100;
    $gameActors._data[1]._hp += Math.floor($gameActors._data[1].mhp * _Wari);
    if ($gameActors._data[1]._hp > $gameActors._data[1].mhp) {
        $gameActors._data[1]._hp = $gameActors._data[1].mhp;
    }
    if (RD_Keep_NPlayer != null) {
        RD_Keep_NPlayer[0]._hp = $gameActors._data[1]._hp;
    }
}
let HPPowerUp_Initialize = Game_System.prototype.initialize;
Game_System.prototype.initialize = function () { 
    HPPowerUp_Initialize.call(this);
    this.HPUpValue = []; 
};
Game_Interpreter.prototype.GetHPMaxUp = function (value) {
    if ($gameSystem.HPUpItems == undefined) $gameSystem.HPUpItems = [];
    this.changeHp($gameActors.actor(1), value, true)
    $gameActors.actor(1).addParam(0, value);
    $gameSystem.HPUpItems.push(value);
}
Game_Interpreter.prototype.Check治療可能ウィルス = function () {
    //$gameActors.actor(1)にステート：17,18,19,20,23,24,39,40,43 の何かが付いているか確認
    let cureStates = [17, 18, 19, 20, 23, 24, 39, 40, 43];
    for (let i = 0; i < cureStates.length; i++) {
        if ($gameActors.actor(1).isStateAffected(cureStates[i])) {
            return true;
        }
    }
    return false;
}
