let Nupu_CharacterMover_update = CharacterMover.prototype.update;
CharacterMover.prototype.update = function () {
    if (!MenuFlgSwich) { 
        Nupu_CharacterMover_update.call(this);
    }
};
Game_Event.prototype.ZurePos = function (_zX, _zY) {
    this._realX += _zX;
    this._x += _zX;
    this._realY += _zY;
    this._y += _zY;
}
Game_Player.prototype.ZurePos = function (_zX, _zY) {
    this._realX += _zX;
    this._x += _zX;
    this._realY += _zY;
    this._y += _zY;
}
const EscUpRg = 15;
const EscDownRg = 16;
let Pl_PlsX = 0; 
let Pl_PlsY = 0; 
let Nupu_SAN_update = Game_Interpreter.prototype.NUpdate;
Game_Interpreter.prototype.NUpdate = function () {
    Nupu_SAN_update.call(this); 
    let _PlCkX = Math.round(PL_realX);
    let _PlCkY = Math.round(PL_realY);
    let _StopMover = false;
    if (!$gameSwitches.value(SW_AutoMoveOff)) {
        switch ($gameMap.regionId(_PlCkX, _PlCkY)) {
            case EscUpRg: 
                Pl_PlsY = -0.07;
                _StopMover = true;
                break;
            case EscDownRg: 
                Pl_PlsY = +0.07;
                _StopMover = true;
                break;
        }
    }
    if (_StopMover) {
        if ($gamePlayer._mover._tarPosVec != null) {
            if (Math.abs($gamePlayer._mover._tarPosVec._x - (PL_realX + 0.5)) < 0.1
                && Math.abs($gamePlayer._mover._tarPosVec._y - (PL_realY + 0.5)) < 0.1) {
                $gamePlayer._mover.clearTargetPosition(); 
                $gameTemp.clearDestination();
            }
        }
    }
    if(_Cmd217_Timer > 0) _Cmd217_Timer--; 
}
let Nupu_PlMover = PlayerMover.prototype.updateCharacter;
PlayerMover.prototype.updateCharacter = function () {
    this._posVec._y += Pl_PlsY;
    this._posVec._x += Pl_PlsX;
    Nupu_PlMover.call(this);
    Pl_PlsX = 0;
    Pl_PlsY = 0;
};
FollowerMover.prototype.updateTargetPosition = function() {
    let precedingCharacter = this.character().precedingCharacter();
    let preChaPosVec = precedingCharacter.posVec();
    let relPosVec = preChaPosVec.sub2(this._posVec);
    this._tarPosVec = (
        _Cmd217_Timer > 0 ?
            relPosVec.len() > 0.1 ?
                preChaPosVec.sub2(relPosVec.scl(1 - ((_Cmd217_ConstTime - _Cmd217_Timer) / _Cmd217_ConstTime) * 1)) 
                :
                null
            :
            relPosVec.len() > 1.0 ?
                preChaPosVec.sub2(relPosVec.scl(1)) 
                :
                null
    );
};
const _Cmd217_ConstTime = 30;
let _Cmd217_Timer = 0;
Game_Interpreter.prototype.command217 = function() {
    _Cmd217_Timer = _Cmd217_ConstTime;
    return true;
};
