let NPlayer = [];   
let NEnemy = [];    
let Next戦闘PlayerHP割合 = 100;
Game_Interpreter.prototype.NPlayer_Setting = function (keepFlg) {
    keepFlg = typeof keepFlg !== 'undefined' ? keepFlg : false;
    //プレイヤー：初期設定　(_ENo * -1) - 1
    if (!keepFlg) {
        NPlayer.push($gameActors._data[1]);
    }
    NPlayer[0]._mp = 0;
    NPlayer[0]._TurnCount = 0; 
    NPlayer[0]._screenX = 767; 
    NPlayer[0]._screenY = 386; 
    NPlayer[0]._PosX = NPlayer[0]._screenX;
    NPlayer[0]._PosY = NPlayer[0]._screenY;
    NPlayer[0]._befhp = -1; 
    NPlayer[0]._befdef = -1; 
    NPlayer[0]._BtlBit = []; 
    if (Next戦闘PlayerHP割合 != 100) {
        NPlayer[0]._hp = Math.round(NPlayer[0].mhp * (Next戦闘PlayerHP割合 / 100));
    }
    Next戦闘PlayerHP割合 = 100;
}
Game_Interpreter.prototype.NPlayer_MaxHpAdd = function (addHp) {
    NPlayer[0]._paramPlus[0] += addHp;
    NPlayer[0]._hp += addHp;
}
const _SetMktPNull = 9999;
Game_Interpreter.prototype.NPlayer_Add = function (enemyId) {
    let setX = Number(MetaChecker($dataEnemies[enemyId], "味方X", _SetMktPNull));
    let setY = Number(MetaChecker($dataEnemies[enemyId], "味方Y", _SetMktPNull));
    let setTgtRnk = Number(MetaChecker($dataEnemies[enemyId], "味方狙率", 100));
    if ($gameSwitches.value(SW_BtlLastBoss)) { 
        setTgtRnk = 0; 
    }
    if (setX == _SetMktPNull) setX = 135;
    if (setY == _SetMktPNull) setX = 50;
    setX = NPlayer[0]._screenX + Number(setX);
    setY = NPlayer[0]._screenY + Number(setY);
    NPlayer.push(new Game_Enemy(enemyId, setX, setY));
    NPlayer[NPlayer.length - 1]._UsePtnNo = this.GetEnemyNextActionNo_ENo(-NPlayer.length, 0);
    NPlayer[NPlayer.length - 1]._PicNo = NPlayer.length - 1;
    NPlayer[NPlayer.length - 1]._TgtRnk = setTgtRnk;
    NPlayer[NPlayer.length - 1]._befhp = -1;
    NPlayer[NPlayer.length - 1].SpineFlg = MetaChecker($dataEnemies[NPlayer[NPlayer.length - 1]._enemyId], "Spine表示", false);
    let btlPicPath = $dataEnemies[NPlayer[NPlayer.length - 1]._enemyId].battlerName;
    if (NPlayer[NPlayer.length - 1].SpineFlg) {
        Spn_FileLoad(btlPicPath);
    }
    btl味方VoiceData = new Btl味方VoiceData(NPlayer[NPlayer.length - 1]._enemyId);
}
let _BtlLoadCk = [];
Game_Interpreter.prototype.NEnemys_Setting = function () {
    _BtlLoadCk = []; 
    NEnemy = [];     
    $gameTroop.setup(BtlData.EnemyGrpNo);
    for (let i = 0; i <= $gameTroop._enemies.length - 1; i++) {
        NEnemy.push($gameTroop._enemies[i]); 
        NEnemy[NEnemy.length - 1].SpineFlg =
            MetaChecker($dataEnemies[$gameTroop._enemies[i]._enemyId], "Spine表示", false);
        if (NEnemy[NEnemy.length - 1].SpineFlg) { 
            let spineName = GetEnemyData_ENo(NEnemy.length - 1).battlerName;
            Spn_FileLoad(spineName);      
            _BtlLoadCk.push(spineName);
        }
        NEnemy[NEnemy.length - 1]._PicNo = NEnemy.length - 1;
        if (NEnemy[NEnemy.length - 1]._hidden) {
            NEnemy[NEnemy.length - 1].FstHidden = true; 
            NEnemy[NEnemy.length - 1]._hp = 0; 
        }
    }
    for (let i = 0; i <= NEnemy.length - 1; i++) {
        NEnemy[i]._bar_x = 0;
        let _Ckbarx = MetaChecker($dataEnemies[NEnemy[i]._enemyId], 'bar_x');
        if (_Ckbarx != "") NEnemy[i]._bar_x = Number(_Ckbarx);
        NEnemy[i]._bar_y = 0;
        let _Ckbary = MetaChecker($dataEnemies[NEnemy[i]._enemyId], 'bar_y');
        if (_Ckbary != "") NEnemy[i]._bar_y = Number(_Ckbary);
        NEnemy[i]._IcX = 0;
        let _CkIcX = MetaChecker($dataEnemies[NEnemy[i]._enemyId], 'IcX');
        if (_CkIcX != "") NEnemy[i]._IcX = Number(_CkIcX);
        NEnemy[i]._IcY = 0;
        let _CkIcY = MetaChecker($dataEnemies[NEnemy[i]._enemyId], 'IcY');
        if (_CkIcY != "") NEnemy[i]._IcY = Number(_CkIcY);
    }
}
Game_Interpreter.prototype.NPlayer_途中Add = function (enemyId) {
    this.NPlayer_Add(enemyId);
    this.MikataDraw_ENo(NPlayer.length - 1, true); 
}
let Nupu_ActorinitMembers = Game_Actor.prototype.initMembers;
Game_Actor.prototype.initMembers = function () {
    Nupu_ActorinitMembers.call(this);
    this._PicNo = 0; 
    this._TurnCount = 0;
    this._TurnGage = 1; 
    this._Seikan = 0;   
    this._PosX = 0;     
    this._PosY = 0;     
    this._TgtOpi = 0;   
    this._NState = [];
    this._screenX = 0;  
    this._screenY = 0;  
    this._TgtRnk = 100; 
    this._bar_x = 0;
    this._bar_y = 0; 
    this._DmgCng = 0; 
};
let Nupu_Enemyinitialize = Game_Enemy.prototype.initialize;
Game_Enemy.prototype.initialize = function (enemyId, x, y) {
    Nupu_Enemyinitialize.apply(this, arguments);
    this._PicNo = 0; 
    this._name = _以降文字削除($dataEnemies[enemyId].name, "::"); 
    this._OneSkillNo = []; 
    this._TurnCount = 1; 
    this._FstTn = true;   　
    this._TurnGage = 30; 
    this._TgtOpi = 0; 
    this._pWidth = 0; 
    this._pHeight = 0; 
    this._UsePtnNo = -1; 
    this._bar_x = 0;
    this._bar_y = 0; 
    this._IcX = 0;
    this._IcY = 0; 
    this._NState = [];
    this._TgtRnk = 100; 
    this._RePtnArr = []; 
    this._DmgCng = 0; 
}
class StacDmgData {
    constructor() {
        this._Type; 
        this._CNo;  
        this._Flame; 
        this._Var;  
        this._CardId; 
        this._StId; 
        this._Turn; 
        this._Kouka; 
        this._CardEditSkill; 
        this._ShakeSkipFlg = false; 
    }
}
let memoSkillArr = [];  
let memoSicoArr = [];   
class CardEditSkillData { 
    constructor() {
        this._Maisu = null;     
        this._CardId = null;    
        this._CmnNo = null;     
        this._SWNo = null;      
    }
}
let GetSkillMemoData = function (metaObject, usePtnNo) {
    memoSkillArr = [];
    try {
        if (usePtnNo == -1) {
            memoSkillArr = MetaChecker(metaObject, "Skill", "").split(',');
        } else if (usePtnNo == -2) {
            memoSkillArr = MetaChecker(metaObject, "Skill0", "").split(',');
        } else {
            memoSkillArr = MetaChecker(metaObject, "Skill" + (usePtnNo + 1), "").split(',');
        }
    } catch (ex) {
    }
}
let CardStatus = function (bukiData, setTurn) {
    setTurn = typeof setTurn !== 'undefined' ? setTurn : 0;
    this.atk = bukiData.params[2];
    this.def = bukiData.params[3];
    this.mat = bukiData.params[4];
    this.mdf = bukiData.params[5];
    this.agi = bukiData.params[6];
    this.luk = bukiData.params[7];
    this.mhp = bukiData.params[0];
    this.mmp = bukiData.params[1];
    this.hp = $gameActors._data[1]._hp;
    this.mp = $gameActors._data[1]._mp;
    this.zmp = 0;
    try {
        this.zmp = NPlayer[0]._mp; 
    } catch (e) {
    }
    this.Turn = setTurn; 
};
let EnemyStatus = function (NEnemySet) {
    this.atk = NEnemySet.atk;
    this.def = NEnemySet.def;
    this.mat = NEnemySet.mat;
    this.mdf = NEnemySet.mdf;
    this.agi = NEnemySet.agi;
    this.luk = NEnemySet.luk;
    this.mhp = NEnemySet.mhp;
    this.mmp = NEnemySet.mmp;
    this.hp = NEnemySet._hp;
    this.mp = NEnemySet._mp;
};
