查看: 3881|回复: 6

[已经解决] 請問有沒有辦法移動戰鬥中人物的位子

[复制链接]
梦石
0
星屑
497
在线时间
266 小时
注册时间
2015-12-8
回帖
729
发表于 2016-2-16 00:50:38 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
就是衡版戰鬥開始時,腳色預先站的地方
梦石
0
星屑
22879
在线时间
8598 小时
注册时间
2011-12-31
回帖
3270
发表于 2016-2-16 10:19:53 | 显示全部楼层
本帖最后由 tseyik 于 2016-2-16 10:24 编辑

事件戦鬥
可和同作者的ATB戦鬥併用
Released under the MIT license
http://woodpenguin.web.fc2.com/MV_Plugin/CommonBattle.html
20151120000340.jpg
Image002.png
Image003.png
Image004.png
範本 74M

MPP_CommonBattle.js[pre lang="javascript"]//=============================================================================
// MPP_CommonBattle.js
//=============================================================================
// Copyright (c) 2015 Mokusei Penguin
// Released under the MIT license
// http://opensource.org/licenses/mit-license.php
//=============================================================================

/*:
* @plugindesc 【MPP ver.1.0】戦闘アクションの処理をコモンイベントによる処理に変更します。
* @author 木星ペンギン
*
* @help ※アクティブタイムバトル(MPP_ActiveTimeBattle.js)と併用する場合、
*  こちらのプラグインが下になるように導入してください。
*
* ●戦闘行動の実行時に呼び出されるコモンイベント名
* 指定した名前のコモンイベントが呼び出されます。
*
* 使用するスキル・アイテムのメモ欄に
*   <cbCommonId:n>
* と記述した場合、n番のコモンイベントが優先して呼び出されます。
*
* ●待機時の移動処理を行うコモンイベント名
* 指定した名前のコモンイベントが呼び出されます。
* 各キャラクターが自身を使用者として実行します。
*
* 使用者のメモ欄に
*   <cbRefreshId:n>
* と記述した場合、n番のコモンイベントが優先して呼び出されます。
*
*
* ●戦闘開始時の移動処理を行うコモンイベント名
* 指定した名前のコモンイベントが呼び出されます。
*
* 使用者のメモ欄に
*   <cbEntryId:n>
* と記述した場合、n番のコモンイベントが優先して呼び出されます。
*
*
* ●勝利時、逃走時、敗北時のコモンイベント
* 条件を満たした際に実行されます。
* 使用者はいません。対象は味方全体となります。
*
*
* ●イベント用のアクター
* 指定したIDのアクターはイベント用として戦闘マップに配置されます。
* ここで指定したアクターをパーティメンバーに入れないでください。
*
*
* ●アクティブタイムバトルと併用する際の注意点
*  1.イベント実行中も時間が止まることはありません。
*    プラグインコマンド
*      AtWait (true/false)
*    を実行することで時間を止めるかどうかを設定できます。
*  
*  2.[逃走状態で逃走モーションを行うかどうか]や
*    [コマンド入力中に前進するかどうか]といった
*    キャラクターの行動を扱う設定は無効となります。
*    コモンイベントの内容を修正してください。
*
*
* その他、細かな仕様は下記のURLを参照してください。
* http://woodpenguin.web.fc2.com/MV_Plugin/CommonBattle.html
*
* ================================
* 制作 : 木星ペンギン
* URL : http://woodpenguin.blog.fc2.com/
*
* @param Execute Action
* @desc 戦闘行動の実行時に呼び出されるコモンイベント名
* @default ●戦闘行動の実行
*
* @param Actor Refresh
* @desc アクターの待機時の移動処理を行うコモンイベント名
* @default ●アクター待機
*
* @param Enemy Refresh
* @desc エネミーの待機時の移動処理を行うコモンイベント名
* @default ●エネミー待機
*
* @param Battle Start
* @desc 戦闘開始時の処理を行うコモンイベント名
* @default ●戦闘開始
*
* @param Process Victory
* @desc 戦闘勝利時に呼び出されるコモンイベント名
* @default ●勝利の処理
*
* @param Process Escape
* @desc 逃走時に呼び出されるコモンイベント名
* @default ●逃走の処理
*
* @param Process Defeat
* @desc 逃走時に呼び出されるコモンイベント名
* @default ●敗北の処理
*
* @param Event Actors
* @desc イベント用のアクターID
* (カンマで区切ってください)
*
* @param Upper Message Row
* @desc 戦闘中にメッセージウィンドウを上に表示させたときの行数
* @default 1
*
* @param Pace X
* @desc X軸の1歩の移動距離
* @default 48
*
* @param Pace Y
* @desc Y軸の1歩の移動距離
* @default 16
*
* @param === Pop Icon ===
*
* @param Icon Set Name
* @desc アイコン画像のファイル名
* @default IconSet
*
* @param Icon Width
* @desc アイコンの幅
* @default 32
*
* @param Icon Height
* @desc アイコンの高さ
* @default 32
*
*/

function Game_ComBatInterpreter() {
    this.initialize.apply(this, arguments);
}

(function() {

var parameters = PluginManager.parameters('MPP_CommonBattle');
var MPPlugin = {
    atb_plugin:$plugins.some(function(plugin) {
        return (plugin.name === 'MPP_ActiveTimeBattle' && plugin.status);
    }),

    executeAction:(parameters['Execute Action'] || '●戦闘行動の実行'),
    actorRefresh:(parameters['Actor Refresh'] || '●アクター待機'),
    enemyRefresh:(parameters['Enemy Refresh'] || '●エネミー待機'),

    battleStart:(parameters['Battle Start'] || '●戦闘開始'),
    processVictory:(parameters['Process Victory'] || '●勝利の処理'),
    processEscape:(parameters['Process Escape'] || '●逃走の処理'),
    processDefeat:(parameters['Process Defeat'] || '●敗北の処理'),

    eventActors:(parameters['Event Actors'] || '').split(",").map(Number),
   
    upperMessageRow:Number(parameters['Upper Message Row'] || 1),
   
    paceX:Number(parameters['Pace X'] || 48),
    paceY:Number(parameters['Pace Y'] || 16),
   
    // Pop Icon
    iconSetName:parameters['Icon Set Name'] || '',
    iconWidth:Number(parameters['Icon Width'] || 32),
    iconHeight:Number(parameters['Icon Height'] || 32)
   
};

var Alias = {};

//-----------------------------------------------------------------------------
// ComBat

function ComBat() {
    throw new Error('This is a static class');
}

ComBat._characters = [];

ComBat.getCommonEvent = function(commonName, commonId) {
    var result;
    if (commonId) {
        result = $dataCommonEvents[commonId];
        if (!result) {
            alert("コモンイベントID\n  " + commonId + "\nが見つかりませんでした。");
        }
    } else {
        result = this.getCommonByName(commonName);
    }
    return result;
};

ComBat.getCommonByName = function(name) {
    for (var i = $dataCommonEvents.length - 1; i > 0; i--) {
        var event = $dataCommonEvents;
        if (event.name === name) {
            return event;
        }
    }
    alert("コモンイベント名\n  " + name + "\nが見つかりませんでした。");
    return null;
};

ComBat.setCharacter = function(index, character) {
    this._characters[index] = character;
};

ComBat.getCharacter = function(index) {
    return this._characters[index];
};

ComBat.clearCharacter = function() {
    this._characters = [];
};

ComBat.isCharacter = function(character) {
    return this._characters.contains(character);
};

//-----------------------------------------------------------------------------
// BattleManager

//10
Alias.BaMa_setup = BattleManager.setup;
BattleManager.setup = function(troopId, canEscape, canLose) {
    Alias.BaMa_setup.call(this, troopId, canEscape, canLose);
    ComBat.clearCharacter();
    this._userWait = false;
};

BattleManager.setUserWait = function(wait) {
    if (this._userWait !== wait) {
        this._userWait = wait;
        this.clearActor();
    }
};

BattleManager.isEvantWait = function() {
    if (MPPlugin.atb_plugin) {
        return this._userWait;
    } else {
        return $gameMessage.isBusy();
    }
};

//150
BattleManager.updateEventMain = function() {
    //$gameTroop.updateInterpreter();
    $gameParty.requestMotionRefresh();
    if ($gameTroop.isEventRunning() || this.checkBattleEnd()) {
        return true;
    }
    $gameTroop.setupBattleEvent();
    if ($gameTroop.isEventRunning() || SceneManager.isSceneChanging()) {
        return true;
    }
    return false;
};

//220
BattleManager.startBattle = function() {
    this._phase = 'start';
    $gameSystem.onBattleStart();
    $gameParty.onBattleStart();
    $gameTroop.onBattleStart();
    //this.displayStartMessages();
    $gameTroop.setupBattleEvent();
    if (!$gameTroop.isEventRunning()) {
        var event = ComBat.getCommonByName(MPPlugin.battleStart);
        if (event) {
            var selfVar = {};
            $gameTroop.setupInterpreter(event.list, selfVar);
        }
    }
    if (MPPlugin.atb_plugin) {
        this.setupAllBattlerAt();
        this.startTurn();
    }
};

//369
BattleManager.startAction = function() {
    var subject = this._subject;
    var action = subject.currentAction();
    var targets = action.makeTargets();
    this._phase = 'action';
    this._action = action;
    this._targets = targets;
    this._action.applyGlobal();

    var item = this._action.item();
    var commonId = item ? Number(item.meta.cbCommonId) : undefined;
    var event = ComBat.getCommonEvent(MPPlugin.executeAction, commonId);
    if (event) {
        var selfVar = {
            user:      subject,
            allTargets:targets,
            target:    targets[0],
            item:      item,
            action:    action
        };
        $gameTroop.setupInterpreter(event.list, selfVar);
    }
};

//382
BattleManager.updateAction = function() {
    if (!$gameTroop.isEventRunning()) {
        this.endAction();
    }
};

BattleManager.callLogMethod = function(args) {
    this._logWindow.push.apply(this._logWindow, args);
};

//493
BattleManager.processVictory = function() {
    $gameParty.removeBattleStates();
    this.startCommon(MPPlugin.processVictory);
    this.endBattle(0);
};

//505
BattleManager.processEscape = function() {
    this.startCommon(MPPlugin.processEscape);
    if (!MPPlugin.atb_plugin) this.startTurn();
};

BattleManager.judgeEscape = function() {
    var success = this._preemptive ? true : (Math.random() < this._escapeRatio);
    if (success) {
        this._escaped = true;
    } else {
        this._escapeRatio += 0.1;
    }
    return success;
};

//528
BattleManager.processDefeat = function() {
    this.startCommon(MPPlugin.processDefeat);
    this.endBattle(2);
};

BattleManager.startCommon = function(name) {
    var event = ComBat.getCommonByName(name);
    if (event) {
        var selfVar = {
            allTargets:$gameParty.members().clone()
        };
        $gameTroop.setupInterpreter(event.list, selfVar);
    }
};

//-----------------------------------------------------------------------------
// Game_BattlerBase

Game_BattlerBase.prototype.allMetadata = function(name) {
    return this.traitObjects().map(function(obj) {
        return obj.meta[name];
    }).filter(Boolean);
};

Game_BattlerBase.prototype.allMetaNumbers = function(name) {
    return this.allMetadata(name).map(Number);
};

Game_BattlerBase.prototype.metadataIncludes = function(name, n) {
    if (n === undefined) {
        return this.allMetadata(name).length > 0;
    } else {
        return this.allMetaNumbers(name).contains(n);
    }
};

Game_BattlerBase.prototype.metadataPi = function(name) {
    return Math.floor(this.allMetaNumbers(name).reduce(function(r, n) {
        return r * n / 100;
    }, 100));
};

Game_BattlerBase.prototype.metadataSum = function(name) {
    return this.allMetaNumbers(name).reduce(function(r, n) {
        return r + n;
    }, 0);
};

Game_BattlerBase.prototype.metadataMax = function(name) {
    return this.allMetaNumbers(name).reduce(function(r, n) {
        if (r === 0 || r < n) r = n;
        return r;
    }, 0);
};

Game_BattlerBase.prototype.metadataMin = function(name) {
    return this.allMetaNumbers(name).reduce(function(r, n) {
        if (r === 0 || r > n) r = n;
        return r;
    }, 0);
};

//-----------------------------------------------------------------------------
// Game_Battler

Game_Battler.prototype.getCharacter = function() {
    return null;
};

Game_Battler.prototype.direction = function() {
    var character = this.getCharacter();
    return character ? character.direction() : 0;
};

Game_Battler.prototype.animeMirror = function() {
    return this.direction() === 6;
};

Game_Battler.prototype.homeX = function() {
    var character = this.getCharacter();
    return character ? character.homeX() : 0;
};

Game_Battler.prototype.homeY = function() {
    var character = this.getCharacter();
    return character ? character.homeY() : 0;
};

Game_Battler.prototype.moveX = function() {
    var character = this.getCharacter();
    return character ? character.moveX() : 0;
};

Game_Battler.prototype.moveY = function() {
    var character = this.getCharacter();
    return character ? character.moveY() : 0;
};

Game_Battler.prototype.realX = function() {
    var character = this.getCharacter();
    return character ? character.realX() : 0;
};

Game_Battler.prototype.realY = function() {
    var character = this.getCharacter();
    return character ? character.realY() : 0;
};

Game_Battler.prototype.height = function() {
    var character = this.getCharacter();
    return character ? character.height : 0;
};

Game_Battler.prototype.width = function() {
    var character = this.getCharacter();
    return character ? character.width : 0;
};

Game_Battler.prototype.isMoving = function() {
    var character = this.getCharacter();
    return character && character.isMoving();
};

Game_Battler.prototype.inHomePosition = function() {
    var character = this.getCharacter();
    return character && character.inHomePosition();
};

Game_Battler.prototype.isSurrounded = function() {
    var left = false;
    var right = false;
    var homeX = this.homeX();
    var members = this.opponentsUnit().aliveMembers();
    for (var i = 0; i < members.length; i++) {
        members.homeX() < homeX ? left = true : right = true;
        if (left && right) return true;
    }
    return false;
};
//-----------------------------------------------------------------------------
// Game_Actor

Game_Actor.prototype.getCharacter = function() {
    var index = 1;
    if (MPPlugin.eventActors.contains(this.actorId())) {
        index += MPPlugin.eventActors.indexOf(this.actorId()) + 16;
    } else {
        index += this.index();
    }
    return ComBat.getCharacter(index);
};

Game_Actor.prototype.attackMotionType = function(index) {
    var weapons = this.weapons();
    var wtypeId = weapons[index] ? weapons[index].wtypeId : 0;
    var attackMotion = $dataSystem.attackMotions[wtypeId];
    return attackMotion ? attackMotion.type : -1;
};

Game_Actor.prototype.performSubAttack = function() {
    var weapons = this.weapons();
    var wtypeId = weapons[1] ? weapons[1].wtypeId : 0;
    var attackMotion = $dataSystem.attackMotions[wtypeId];
    if (attackMotion) {
        if (attackMotion.type === 0) {
            this.requestMotion('thrust');
        } else if (attackMotion.type === 1) {
            this.requestMotion('swing');
        } else if (attackMotion.type === 2) {
            this.requestMotion('missile');
        }
        this.startWeaponAnimation(attackMotion.weaponImageId);
    }
};

//-----------------------------------------------------------------------------
// Game_Enemy

Game_Enemy.prototype.getCharacter = function() {
    var index = this.index() + 9;
    return ComBat.getCharacter(index);
};

//-----------------------------------------------------------------------------
// Game_Unit

Game_Unit.prototype.isSurrounded = function() {
    return this.aliveMembers().some(function(member) {
        return member.isSurrounded();
    });
};

//-----------------------------------------------------------------------------
// Game_Troop

//5184
Alias.GaTr_initialize = Game_Troop.prototype.initialize;
Game_Troop.prototype.initialize = function() {
    Alias.GaTr_initialize.call(this);
    this._interpreter = new Game_ComBatInterpreter();
};

Game_Troop.prototype.setupInterpreter = function(list, selfVar) {
    this._interpreter.setup(list, selfVar);
};

//-----------------------------------------------------------------------------
// Game_ComBatInterpreter

Game_ComBatInterpreter.prototype = Object.create(Game_Interpreter.prototype);
Game_ComBatInterpreter.prototype.constructor = Game_ComBatInterpreter;

Game_ComBatInterpreter.prototype.initialize = function(depth) {
    Game_Interpreter.prototype.initialize.call(this, depth);
};

Game_ComBatInterpreter.prototype.clear = function() {
    Game_Interpreter.prototype.clear.call(this);
    this._selfVar = null;
};

Game_ComBatInterpreter.prototype.setup = function(list, selfVar) {
    Game_Interpreter.prototype.setup.call(this, list)
    this._selfVar = selfVar || {};
};

Game_ComBatInterpreter.prototype.updateWaitMode = function() {
    var waiting = false;
    switch (this._waitMode) {
    case 'bmBusy':
        waiting = BattleManager.isBusy();
        break;
    default:
        return Game_Interpreter.prototype.updateWaitMode.call(this);
    }
    if (!waiting) this._waitMode = '';
    return waiting;
};

Game_ComBatInterpreter.prototype.character = function(param) {
    if (param < 0) {
        if (this._selfVar.target) {
            return this._selfVar.target.getCharacter();
        }
    } else if (param === 0) {
        if (this._selfVar.user) {
            return this._selfVar.user.getCharacter();
        }
    } else {
        return ComBat.getCharacter(param);
    }
    return null;
};

// Conditional Branch
Game_ComBatInterpreter.prototype.command111 = function() {
    var result = false;
    if (this._params[0] === 12) {
        var v = $gameVariables._data;
        var selfVar = this._selfVar;
        var user = selfVar.user;
        var allTargets = selfVar.allTargets;
        var target = selfVar.target;
        var item = selfVar.item;
        var action = selfVar.action;
        result = !!eval(this._params[1]);
        this._branch[this._indent] = result;
        if (this._branch[this._indent] === false) {
            this.skipBranch();
        }
        return true;
    } else {
        return Game_Interpreter.prototype.command111.call(this);
    }
};

// Control Variables
Game_ComBatInterpreter.prototype.command122 = function() {
    if (this._params[3] === 4) {
        var v = $gameVariables._data;
        var selfVar = this._selfVar;
        var user = selfVar.user;
        var allTargets = selfVar.allTargets;
        var target = selfVar.target;
        var item = selfVar.item;
        var action = selfVar.action;
        var value = eval(this._params[4]);
        for (var i = this._params[0]; i <= this._params[1]; i++) {
            this.operateVariable(i, this._params[2], value);
        }
        return true;
    } else {
        return Game_Interpreter.prototype.command122.call(this);
    }
};

Game_ComBatInterpreter.prototype.gameDataOperand = function(type, param1, param2) {
    if (type === 5) {
        var character = this.character(param1);
        if (character) {
            switch (param2) {
            case 0:  // Map X
                return character.moveX();
            case 1:  // Map Y
                return character.moveY();
            case 2:  // Direction
                return character.direction();
            case 3:  // Screen X
                return character.x;
            case 4:  // Screen Y
                return character.y;
            }
        }
        return 0;
    } else {
        return Game_Interpreter.prototype.gameDataOperand.call(this, type, param1, param2);
    }
};

Game_ComBatInterpreter.prototype.setupChild = function(list) {
    this._childInterpreter = new Game_ComBatInterpreter(this._depth + 1);
    this._childInterpreter.setup(list, this._selfVar);
};

// Set Movement Route
Game_ComBatInterpreter.prototype.command205 = function() {
    this._character = this.character(this._params[0]);
    if (this._character) {
        this._character.forceMoveRoute(this._params[1], this._selfVar);
        if (this._params[1].wait) {
            this.setWaitMode('route');
        }
    }
    return true;
};

// Script
Game_ComBatInterpreter.prototype.command355 = function() {
    var script = this.currentCommand().parameters[0] + '\n';
    while (this.nextEventCode() === 655) {
        this._index++;
        script += this.currentCommand().parameters[0] + '\n';
    }
    try {
        var v = $gameVariables._data;
        var selfVar = this._selfVar;
        var user = selfVar.user;
        var allTargets = selfVar.allTargets;
        var target = selfVar.target;
        var item = selfVar.item;
        var action = selfVar.action;
        eval(script);
    } catch (e) {
        if ($gameTemp.isPlaytest()) {
            var text = "以下のスクリプトでエラーが発生しました。\n\n";
            text += script;
            alert(text);
        }
    }
    return true;
};

// Plugin Command
Game_ComBatInterpreter.prototype.command356 = function() {
    try {
        Game_Interpreter.prototype.command356.call(this);
    } catch (e) {
        if ($gameTemp.isPlaytest()) {
            var text = "以下のプラグインコマンドでエラーが発生しました。\n\n";
            text += this._params[0];
            alert(text);
        }
    }
    return true;
};

Game_ComBatInterpreter.SetUser = 'SetUser';
Game_ComBatInterpreter.SetAllTargets = 'SetAllTargets';
Game_ComBatInterpreter.AddTarget = 'AddTarget';
Game_ComBatInterpreter.DeleteTarget = 'DeleteTarget';
Game_ComBatInterpreter.SetTarget = 'SetTarget';
Game_ComBatInterpreter.SetItem = 'SetItem';
Game_ComBatInterpreter.UseItem = 'UseItem';
Game_ComBatInterpreter.LogWindow = 'LogWindow';
Game_ComBatInterpreter.ShowAnimation = 'ShowAnimation';
Game_ComBatInterpreter.ShowAnimationToTarget = 'ShowAnimationToTarget';
Game_ComBatInterpreter.ShowNormalAnimation = 'ShowNormalAnimation';
Game_ComBatInterpreter.WaitBusy = 'WaitBusy';
Game_ComBatInterpreter.ActionApply = 'ActionApply';
Game_ComBatInterpreter.CounterApply = 'CounterApply';
Game_ComBatInterpreter.RefreshStatus = 'RefreshStatus';
Game_ComBatInterpreter.UsedCommon = 'UsedCommon';
Game_ComBatInterpreter.AddLog = 'AddLog';
Game_ComBatInterpreter.AtWait = 'AtWait';

Game_ComBatInterpreter.prototype.pluginCommand = function(command, args) {
    Game_Interpreter.prototype.pluginCommand.call(this, command, args);
    var v = $gameVariables._data;
    var selfVar = this._selfVar;
    var user = selfVar.user;
    var allTargets = selfVar.allTargets;
    var target = selfVar.target;
    var item = selfVar.item;
    var action = selfVar.action;
    var GCBI = Game_ComBatInterpreter;
    switch (command) {
    case GCBI.SetUser:
        var newUser;
        var value = eval(args[1]);
        switch (args[0]) {
        case 'party':
            newUser = $gameParty.members()[value];
            break;
        case 'troop':
            newUser = $gameTroop.members()[value];
            break;
        default:
            newUser = value;
            break;
        }
        if (newUser && (newUser.isActor() || newUser.isEnemy())) {
            this._selfVar.user = newUser;
            action.setSubject(newUser);
        }
        break;
    case GCBI.SetAllTargets:
        var newAllTargets;
        switch (args[0]) {
        case 'party':
            switch (args[1]) {
            case 'alive':
                newAllTargets = $gameParty.aliveMembers().clone();
                break;
            case 'dead':
                newAllTargets = $gameParty.deadMembers().clone();
                break;
            default:
                newAllTargets = $gameParty.members().clone();
                break;
            }
            break;
        case 'troop':
            switch (args[1]) {
            case 'alive':
                newAllTargets = $gameTroop.aliveMembers().clone();
                break;
            case 'dead':
                newAllTargets = $gameTroop.deadMembers().clone();
                break;
            default:
                newAllTargets = $gameTroop.members().clone();
                break;
            }
            break;
        case 'refresh':
            newAllTargets = action.makeTargets();
            break;
        default:
            newAllTargets = eval(args[1]);
            break;
        }
        if (Array.isArray(newAllTargets)) {
            this._selfVar.allTargets = newAllTargets;
        }
        break;
    case GCBI.AddTarget:
        var newTarget = eval(args[0]);
        if (newTarget) {
            if (args[1] === 'true') {
                this._selfVar.allTargets.unshift(newTarget);
            } else {
                this._selfVar.allTargets.push(newTarget);
            }
        }
        break;
    case GCBI.DeleteTarget:
        var battler = eval(args[0]);
        this._selfVar.allTargets = allTargets.filter(function(target) {
            return target !== battler;
        });
        break;
    case GCBI.SetTarget:
        var newTarget;
        var value = eval(args[1]);
        switch (args[0]) {
        case 'party':
            newTarget = $gameParty.members()[value];
            break;
        case 'troop':
            newTarget = $gameTroop.members()[value];
            break;
        case 'shift':
            newTarget = allTargets.shift();
            break;
        default:
            newTarget = value;
            break;
        }
        if (!newTarget || newTarget.isActor() || newTarget.isEnemy()) {
            this._selfVar.target = newTarget;
        }
        break;
    case GCBI.SetItem:
        var value = eval(args[1]);
        switch (args[0]) {
        case 'item':
            this._selfVar.item = $dataSkills[value];
            break;
        case 'skill':
            this._selfVar.item = $dataItems[value];
            break;
        }
        action.setItemObject(this._selfVar.item);
        break;
    case GCBI.UseItem:
        user.useItem(item);
        BattleManager.refreshStatus();
        break;
    case GCBI.LogWindow:
        for (var i = 1; i < args.length; i++) {
            args = eval(args);
        }
        BattleManager.callLogMethod(args);
        this.wait(1);
        break;
    case GCBI.ShowAnimation:
        var param = ['showAnimation', user, allTargets.clone(), item.animationId];
        BattleManager.callLogMethod(param);
        break;
    case GCBI.ShowAnimationToTarget:
        var param = ['showAnimation', user, [target], item.animationId];
        BattleManager.callLogMethod(param);
        break;
    case GCBI.ShowNormalAnimation:
        var param = ['showNormalAnimation', allTargets.clone()];
        param[2] =  eval(args[0]);
        param[3] =  eval(args[1]) || false;
        BattleManager.callLogMethod(param);
        break;
    case GCBI.WaitBusy:
        this.setWaitMode('bmBusy');
        //this.wait(1);
        break;
    case GCBI.ActionApply:
        var actionTarget = args[0] ? eval(args[0]) : target;
        action.apply(actionTarget);
        break;
    case GCBI.CounterApply:
        var counterAction = new Game_Action(target);
        counterAction.setAttack();
        counterAction.apply(user);
        break;
    case GCBI.RefreshStatus:
        BattleManager.refreshStatus();
        break;
    case GCBI.UsedCommon:
        var commonTarget = eval(args[0]);
        if (commonTarget) {
            var character = commonTarget.getCharacter();
            if (character) {
                character.setCommon(args[1], args[2]);
            }
        }
        break;
    case GCBI.AddLog:
        var param = ['push', 'addText', args[0]];
        BattleManager.callLogMethod(param);
        param = ['push', 'waitForNewLine'];
        BattleManager.callLogMethod(param);
        break;
    case GCBI.AtWait:
        BattleManager.setUserWait(args[0] === 'true');
        break;
    }
};

//-----------------------------------------------------------------------------
// Sprite_Battler

//465
Alias.SpBa_initMembers = Sprite_Battler.prototype.initMembers;
Sprite_Battler.prototype.initMembers = function() {
    Alias.SpBa_initMembers.call(this);
    this._interpreter = new Game_ComBatInterpreter();
    this._direction = 4;
   
    this._moveRoute = null;
    this._moveRouteIndex = 0;
   
    this._jumpCount = 0;
    this._jumpPeak = 0;
    this._jumpRate = 5;
   
    this._scaleX = 1;
    this._scaleY = 1;
    this._targetScaleX = 1;
    this._targetScaleY = 1;
    this._scaleDuration = 0;
   
    this._altitude = 0;
    this._targetAltitude = 0;
    this._altitudeDuration = 0;
   
    this._encloseSpeed = 0;
    this._encloseType = 0;
    this._encloseBaseCharacter = null;
    this._encloseXRate = 1;
    this._encloseYRate = 1;
    this._encloseAngle = 0;
    this._encloseDistance = 0;
   
    this._motionAnime = true;
    this._waitCount = 0;
    this._selfVar = {};
    this._shadowVisible = true;
    this.cbZ = 20;
};

Sprite_Battler.prototype.homeX = function() {
    return this._homeX;
};

Sprite_Battler.prototype.homeY = function() {
    return this._homeY;
};

Sprite_Battler.prototype.moveX = function() {
    return this._homeX + this._targetOffsetX;
};

Sprite_Battler.prototype.moveY = function() {
    return this._homeY + this._targetOffsetY;
};

Sprite_Battler.prototype.realX = function() {
    return this._homeX + this._offsetX;
};

Sprite_Battler.prototype.realY = function() {
    return this._homeY + this._offsetY;
};

//524
Alias.SpBa_updateMove = Sprite_Battler.prototype.updateMove;
Sprite_Battler.prototype.updateMove = function() {
    if (this._jumpCount > 0) {
        var c = this._jumpCount;
        this._offsetX = (this._offsetX * (c - 1) + this._targetOffsetX) / c;
        this._offsetY = (this._offsetY * (c - 1) + this._targetOffsetY) / c;
        this._jumpCount--;
    } else {
        Alias.SpBa_updateMove.call(this);
    }
    this.updateAltitude();
    this.updateEnclose();
};

Sprite_Battler.prototype.direction = function() {
    return this._direction;
};

Sprite_Battler.prototype.reverseDir = function(d) {
    return 10 - d;
};

Sprite_Battler.prototype.setDirection = function(d) {
    if (d === 4 || d === 6) {
        this._direction = d;
    }
};

Sprite_Battler.prototype.isMirror = function() {
    return false;
};

Sprite_Battler.prototype.startMotion = function() {
};

Sprite_Battler.prototype.startWeapon = function() {
};

Sprite_Battler.prototype.jumpHeight = function() {
    var height = (this._jumpPeak * this._jumpPeak -
            Math.pow(Math.abs(this._jumpCount - this._jumpPeak), 2)) / 2;
    return Math.floor(height * this._jumpRate);
};

Sprite_Battler.prototype.getCharacter = function(param) {
    if (param === -2) {
        return this;
    } else if (param === -1) {
        if (this._selfVar.target) {
            return this._selfVar.target.getCharacter();
        }
    } else if (param === 0) {
        if (this._selfVar.user) {
            return this._selfVar.user.getCharacter();
        }
    } else if (param > 0) {
        return ComBat.getCharacter(param);
    }
    return null;
};

Sprite_Battler.prototype.isMoveRouteForcing = function() {
    return !!this._moveRoute;
};

Sprite_Battler.prototype.forceMoveRoute = function(moveRoute, selfVar) {
    if (this._battler) {
        this._moveRoute = moveRoute;
        this._moveRouteIndex = 0;
        this._waitCount = 0;
        this._selfVar = selfVar;
    }
};

//490
Alias.SpBa_update = Sprite_Battler.prototype.update;
Sprite_Battler.prototype.update = function() {
    Alias.SpBa_update.call(this);
    this._interpreter.update();
    if (this._battler) {
        this.updateBalloon();
        this.updateZoom();
        this.updateEcho();
    }
    if (this._moveRoute) {
        this.updateRoutineMove();
    }
};

//509
Alias.SpBa_updatePosition = Sprite_Battler.prototype.updatePosition;
Sprite_Battler.prototype.updatePosition = function() {
    Alias.SpBa_updatePosition.call(this);
    this.y -=  this.jumpHeight() + this._altitude;
    this.scale.x = this._scaleX * (this.isMirror() ? -1 : 1);
    this.scale.y = this._scaleY;
};

Sprite_Battler.prototype.updateRoutineMove = function() {
    if (this._waitCount > 0) {
        this._waitCount--;
        if (this._waitCount > 0) {
            return;
        }
    }
    do {
        var command = this._moveRoute.list[this._moveRouteIndex];
        if (command) {
            this.processMoveCommand(command);
            this.advanceMoveRouteIndex();
        } else {
            break;
        }
    } while (this._moveRoute && this._waitCount === 0 && this._moveRouteIndex > 0);
};

Sprite_Battler.prototype.processMoveCommand = function(command) {
    var gc = Game_Character;
    var params = command.parameters;
    switch (command.code) {
    case gc.ROUTE_END:
        this.processRouteEnd();
        break;
    case gc.ROUTE_MOVE_DOWN:
        this.moveStraight(2);
        break;
    case gc.ROUTE_MOVE_LEFT:
        this.moveStraight(4);
        break;
    case gc.ROUTE_MOVE_RIGHT:
        this.moveStraight(6);
        break;
    case gc.ROUTE_MOVE_UP:
        this.moveStraight(8);
        break;
    case gc.ROUTE_MOVE_LOWER_L:
        this.moveDiagonally(4, 2);
        break;
    case gc.ROUTE_MOVE_LOWER_R:
        this.moveDiagonally(6, 2);
        break;
    case gc.ROUTE_MOVE_UPPER_L:
        this.moveDiagonally(4, 8);
        break;
    case gc.ROUTE_MOVE_UPPER_R:
        this.moveDiagonally(6, 8);
        break;
    case gc.ROUTE_MOVE_RANDOM:
        this.moveRandom();
        break;
    case gc.ROUTE_MOVE_TOWARD:
        this.moveTowardCharacter(this._selfVar.target);
        break;
    case gc.ROUTE_MOVE_AWAY:
        this.moveAwayFromCharacter(this._selfVar.target);
        break;
    case gc.ROUTE_MOVE_FORWARD:
        this.moveStraight(this.direction());
        break;
    case gc.ROUTE_MOVE_BACKWARD:
        this.moveStraight(this.reverseDir(this.direction()));
        break;
    case gc.ROUTE_JUMP:
        this.startJump(params[0], params[1]);
        this._waitCount = this._jumpCount;
        break;
    case gc.ROUTE_WAIT:
        this._waitCount = params[0];
        break;
//    case gc.ROUTE_TURN_DOWN:
//        this.setDirection(2);
//        break;
    case gc.ROUTE_TURN_LEFT:
        this.setDirection(4);
        break;
    case gc.ROUTE_TURN_RIGHT:
        this.setDirection(6);
        break;
//    case gc.ROUTE_TURN_UP:
//        this.setDirection(8);
//        break;
//    case gc.ROUTE_TURN_90D_R:
//        this.turnRight90();
//        break;
//    case gc.ROUTE_TURN_90D_L:
//        this.turnLeft90();
//        break;
    case gc.ROUTE_TURN_180D:
        this.turn180();
        break;
//    case gc.ROUTE_TURN_90D_R_L:
//        this.turnRightOrLeft90();
//        break;
    case gc.ROUTE_TURN_RANDOM:
        this.turnRandom();
        break;
    case gc.ROUTE_TURN_TOWARD:
        this.turnTowardCharacter(-1);
        break;
    case gc.ROUTE_TURN_AWAY:
        this.turnAwayFromCharacter(-1);
        break;
    case gc.ROUTE_SWITCH_ON:
        $gameSwitches.setValue(params[0], true);
        break;
    case gc.ROUTE_SWITCH_OFF:
        $gameSwitches.setValue(params[0], false);
        break;
//    case gc.ROUTE_CHANGE_SPEED:
//        this.setMoveSpeed(params[0]);
//        break;
//    case gc.ROUTE_CHANGE_FREQ:
//        this.setMoveFrequency(params[0]);
//        break;
    case gc.ROUTE_WALK_ANIME_ON:
        this._motionAnime = true;
        this._weaponSprite._weaponAnime = true;
        break;
    case gc.ROUTE_WALK_ANIME_OFF:
        this._motionAnime = false;
        this._weaponSprite._weaponAnime = false;
        break;
    case gc.ROUTE_STEP_ANIME_ON:
        this._motionAnime = true;
        this._weaponSprite._weaponAnime = true;
        break;
    case gc.ROUTE_STEP_ANIME_OFF:
        this._motionAnime = false;
        this._weaponSprite._weaponAnime = false;
        break;
//    case gc.ROUTE_DIR_FIX_ON:
//        this._directionFix = true;
//        break;
//    case gc.ROUTE_DIR_FIX_OFF:
//        this._directionFix = false;
//        break;
//    case gc.ROUTE_THROUGH_ON:
//        this.setThrough(true);
//        break;
//    case gc.ROUTE_THROUGH_OFF:
//        this.setThrough(false);
//        break;
    case gc.ROUTE_TRANSPARENT_ON:
        this.hide();
        break;
    case gc.ROUTE_TRANSPARENT_OFF:
        this.show();
        break;
//    case gc.ROUTE_CHANGE_IMAGE:
//        this.setImage(params[0], params[1]);
//        break;
//    case gc.ROUTE_CHANGE_OPACITY:
//        this.setOpacity(params[0]);
//        break;
//    case gc.ROUTE_CHANGE_BLEND_MODE:
//        this.setBlendMode(params[0]);
//        break;
    case gc.ROUTE_PLAY_SE:
        AudioManager.playSe(params[0]);
        break;
    case gc.ROUTE_SCRIPT:
        try {
            var user = this._selfVar.user;
            var allTargets = this._selfVar.allTargets;
            var target = this._selfVar.target;
            var item = this._selfVar.item;
            var action = this._selfVar.action;
            var selfVar = this._selfVar;
            var script = this.convertMethod(params[0]);
            eval(script);
        } catch (e) {
            if ($gameTemp.isPlaytest()) {
                var text = "以下のスクリプトでエラーが発生しました。\n\n";
                text += params[0];
                alert(text);
            }
        }
        break;
    }
};

Sprite_Battler.prototype.convertMethod = function(text) {
    text = text.replace(/^home\(/g, 'this.setHome(');
    text = text.replace(/^move\(/g, 'this.startMove(');
    text = text.replace(/^jump\(/g, 'this.startJump(');
    text = text.replace(/^motion\(/g, 'this.startMotion(');
    text = text.replace(/^weapon\(/g, 'this.startWeapon(');
    text = text.replace(/^zoom\(/g, 'this.startZoom(');
    text = text.replace(/^alt\(/g, 'this.startAltitude(');
    text = text.replace(/^shadowOn/g, 'this.shadowOn()');
    text = text.replace(/^shadowOff/g, 'this.shadowOff()');
    text = text.replace(/^turn\(/g, 'this.turnTowardCharacter(');
    text = text.replace(/^icon\(/g, 'this.startIcon(');
    text = text.replace(/^iconMove\(/g, 'this.startIconMove(');
    text = text.replace(/^iconRotation\(/g, 'this.startIconRotation(');
    text = text.replace(/^iconZoom\(/g, 'this.startIconZoom(');
    text = text.replace(/^echoOn/g, 'this.startEcho()');
    text = text.replace(/^echoOff/g, 'this.endEcho()');
    text = text.replace(/^enclose\(/g, 'this.startEnclose(');
    return text;
};

Sprite_Battler.prototype.xWithDirection = function(x, d) {
    return x + (d === 6 ? 1 : d === 4 ? -1 : 0);
};

Sprite_Battler.prototype.yWithDirection = function(y, d) {
    return y + (d === 2 ? 1 : d === 8 ? -1 : 0);
};

Sprite_Battler.prototype.directionSign = function() {
    return this._direction === 4 ? -1 : 1;
};

Sprite_Battler.prototype.xWithSign = function(x, dir) {
    var character = this.getCharacter(dir);
    var sign = character ? character.directionSign() : 1;
    return x * sign;
};

//610
Alias.SpBa_startMove = Sprite_Battler.prototype.startMove;
Sprite_Battler.prototype.startMove = function(x, y, d, home, dir) {
    x = Math.floor(x * MPPlugin.paceX);
    y = Math.floor(y * MPPlugin.paceY);
    if (home === undefined) home = -2;
    if (dir === undefined) dir = -2;
    var character = this.getCharacter(home) || this;
    x = this.xWithSign(x, dir);
    x += character.homeX() - this.homeX();
    y += character.homeY() - this.homeY();
    Alias.SpBa_startMove.call(this, x, y, d);
};

Sprite_Battler.prototype.moveStraight = function(d) {
    var x = this.xWithDirection(this._offsetX / MPPlugin.paceX, d);
    var y = this.yWithDirection(this._offsetY / MPPlugin.paceY, d);
    this.startMove(x, y, 12, -2, -3);
    this._waitCount = 12;
};

Sprite_Battler.prototype.moveDiagonally = function(horz, vert) {
    var x = this.xWithDirection(this._offsetX / MPPlugin.paceX, horz);
    var y = this.yWithDirection(this._offsetY / MPPlugin.paceY, vert);
    this.startMove(x, y, 17, -2, -3);
    this._waitCount = 17;
};

Sprite_Battler.prototype.startJump = function(x, y, count, rate, home, dir) {
    x = Math.floor(x * MPPlugin.paceX);
    y = Math.floor(y * MPPlugin.paceY);
    if (rate === undefined) rate = 1;
    if (home === undefined) home = -2;
    if (dir === undefined) dir = -2;
    var character = this.getCharacter(home) || this;
    x = this.xWithSign(x, dir);
    x += character.homeX() - this.homeX();
    y += character.homeY() - this.homeY();
    this._targetOffsetX = x;
    this._targetOffsetY = y;
    if (!count) {
        var xPlus = (x - this._offsetX) / MPPlugin.paceX;
        var yPlus = (y - this._offsetY) / MPPlugin.paceY;
        var distance = Math.round(Math.sqrt(xPlus * xPlus + yPlus * yPlus));
        this._jumpPeak = 5 + distance;
        this._jumpCount = this._jumpPeak * 2;
    } else {
        this._jumpCount = count;
        this._jumpPeak = this._jumpCount / 2;
    }
    this._jumpRate = rate;
};

Sprite_Battler.prototype.moveRandom = function() {
    this.moveStraight(2 + Math.randomInt(4) * 2);
};

Sprite_Battler.prototype.moveTowardCharacter = function(character) {
    if (!character) return;
    if (!ComBat.isCharacter(character)) {
        character = character.getCharacter();
        if (!character) return;
    }
    var sx = this.realX() - character.realX();
    this.moveStraight(sx > 0 ? 4 : 6);
};

Sprite_Battler.prototype.moveAwayFromCharacter = function(character) {
    if (!character) return;
    if (!ComBat.isCharacter(character)) {
        character = character.getCharacter();
        if (!character) return;
    }
    var sx = this.realX() - character.realX();
    this.moveStraight(sx > 0 ? 6 : 4);
};

Sprite_Battler.prototype.turnTowardCharacter = function(param) {
    var character = this.getCharacter(param);
    if (!character) return;
    var sx = this.realX() - character.realX();
    if (sx !== 0) this.setDirection(sx > 0 ? 4 : 6);
};

Sprite_Battler.prototype.turnAwayFromCharacter = function(param) {
    var character = this.getCharacter(param);
    if (!character) return;
    var sx = this.realX() - character.realX();
    if (sx !== 0) this.setDirection(sx > 0 ? 6 : 4);
};

Sprite_Battler.prototype.processRouteEnd = function() {
    this._moveRouteIndex = -1;
    if (!this._moveRoute.repeat) {
        this._moveRoute = null;
        this._moveRouteIndex = 0;
    }
};

Sprite_Battler.prototype.advanceMoveRouteIndex = function() {
    var moveRoute = this._moveRoute;
    if (moveRoute) {
        var numCommands = moveRoute.list.length - 1;
        this._moveRouteIndex++;
        if (moveRoute.repeat && this._moveRouteIndex >= numCommands) {
            this._moveRouteIndex = 0;
        }
    }
};

Sprite_Battler.prototype.turn180 = function() {
    this.setDirection(this.reverseDir(this.direction()));
};

Sprite_Battler.turnRandom = function() {
    this.setDirection(4 + Math.randomInt(2) * 2);
};

Sprite_Battler.prototype.requestBalloon = function(balloonId) {
    if (!this._balloonSprite) {
        this._balloonSprite = new Sprite_Balloon();
    }
    this._balloonSprite.setup(balloonId);
    //this.parent.addChild(this._balloonSprite);
};

Sprite_Battler.prototype.updateBalloon = function() {
    if (this._balloonSprite) {
        this._balloonSprite.x = this.x;
        this._balloonSprite.y = this.y - this.height;
        if (!this._balloonSprite.isPlaying()) {
            this.endBalloon();
        }
    }
};

Sprite_Battler.prototype.endBalloon = function() {
    if (this._balloonSprite) {
        this.parent.removeChild(this._balloonSprite);
        this._balloonSprite = null;
    }
};

Sprite_Battler.prototype.isBalloonPlaying = function() {
    return !!this._balloonSprite;
};

Sprite_Battler.prototype.requestAnimation = function(animationId) {
    var animation = $dataAnimations[animationId];
    this.startAnimation(animation, false, 0);
};

Sprite_Battler.prototype.setCommon = function(commonName, methodName) {
    if (this._battler) {
        var commonId = 0;
        if (methodName) {
            commonId = this._battler.metadataMax(methodName);
        }
        var commonEvent = ComBat.getCommonEvent(commonName, commonId);
        if (commonEvent) {
            var selfVar = {
                user:      this._battler,
                allTargets:[]
            };
            this._interpreter.setup(commonEvent.list, selfVar);
        }
    }
};

//183
Alias.SpBa_isMoving = Sprite_Battler.prototype.isMoving;
Sprite_Battler.prototype.isMoving = function() {
    return Alias.SpBa_isMoving.call(this) || this._jumpCount > 0;
};

Sprite_Battler.prototype.shadowOn = function() {
    this._shadowVisible = true;
};

Sprite_Battler.prototype.shadowOff = function() {
    this._shadowVisible = false;
};

Sprite_Battler.prototype.updateZoom = function() {
    if (this._scaleDuration > 0) {
        var d = this._scaleDuration;
        this._scaleX = (this._scaleX * (d - 1) + this._targetScaleX) / d;
        this._scaleY = (this._scaleY * (d - 1) + this._targetScaleY) / d;
        this._scaleDuration--;
    }
};

Sprite_Battler.prototype.startZoom = function(scaleX, scaleY, duration) {
    this._targetScaleX = scaleX;
    this._targetScaleY = scaleY;
    this._scaleDuration = duration;
    if (this._scaleDuration === 0) {
        this._scaleX = this._targetScaleX;
        this._scaleY = this._targetScaleY;
    }
};

Sprite_Battler.prototype.updateAltitude = function() {
    if (this._altitudeDuration > 0) {
        var d = this._altitudeDuration;
        this._altitude = (this._altitude * (d - 1) + this._targetAltitude) / d;
        this._altitudeDuration--;
    }
};

Sprite_Battler.prototype.startAltitude = function(altitude, duration) {
    this._targetAltitude = altitude;
    this._altitudeDuration = duration;
    if (this._altitudeDuration === 0) {
        this._altitude = this._targetAltitude;
    }
};

Sprite_Battler.prototype.startIcon = function(iconIndex) {
    if (iconIndex === 0 && this._popIconSprite) {
        this.removeChild(this._popIconSprite);
        this._popIconSprite = null;
    } else if (iconIndex > 0) {
        if (!this._popIconSprite) {
            this._popIconSprite = new Sprite_PopIcon();
            this.addChild(this._popIconSprite);
        }
        this._popIconSprite.setIcon(iconIndex);
    }
};

Sprite_Battler.prototype.startIconMove = function(x, y, duration) {
    if (this._popIconSprite) {
        this._popIconSprite.startMove(x, y, duration);
    }
};

Sprite_Battler.prototype.startIconRotation = function(speed) {
    if (this._popIconSprite) {
        this._popIconSprite.startRotation(speed);
    }
};

Sprite_Battler.prototype.startIconZoom = function(scaleX, scaleY, duration) {
    if (this._popIconSprite) {
        this._popIconSprite.startZoom(scaleX, scaleY, duration);
    }
};

Sprite_Battler.prototype.startEcho = function() {
    if (!this._echoSprites) {
        var sprites = [];
        for (var i = 0; i < 3; i++) {
            sprites = new Sprite();
            sprites.anchor.x = 0.5;
            sprites.anchor.y = 1;
            sprites.setColorTone([-96, -96, 96, 0]);
            sprites.opacity = 160;
            sprites.cbZ = 15;
            this.parent.addChild(sprites);
        }
        this._echoSprites = sprites;
        this._echoData = [];
    }
};

Sprite_Battler.prototype.endEcho = function() {
    if (this._echoSprites) {
        var sprites = this._echoSprites;
        for (var i = 0; i < sprites.length; i++) {
            this.parent.removeChild(sprites);
        }
        this._echoSprites = null;
        this._echoData = null;
    }
};

Sprite_Battler.prototype.updateEcho = function() {
    if (this._echoSprites) {
        var sprites = this._echoSprites;
        for (var i = 0; i < sprites.length; i++) {
            this.setEchoData(sprites, this._echoData[i * 5 + 5]);
        }
        this._echoData.unshift(this.createEchoData());
        if (this._echoData.length > 18) {
            this._echoData.pop();
        }
    }
};

Sprite_Battler.prototype.setEchoData = function(sprite, data) {
};

Sprite_Battler.prototype.createEchoData = function() {
};

Sprite_Battler.prototype.startEnclose = function(speed, type, base, dir, xRate, yRate) {
    this._encloseSpeed = speed;
    if (type === undefined) type = 0;
    if (base === undefined) base = -2;
    if (dir === undefined) dir = -2;
    if (xRate === undefined) xRate = 1;
    if (yRate === undefined) yRate = 1;
    var character = this.getCharacter(dir);
    this._encloseSpeed = speed * (character ? character.directionSign() : 1);
    this._encloseType = type;
    this._encloseBaseCharacter = this.getCharacter(base) || this;
    this._encloseXRate = xRate;
    this._encloseYRate = yRate;
    if (xRate && yRate) {
        this._encloseAngle = 0;
        this._encloseDistance = 0;
    } else {
        var character = this._encloseBaseCharacter;
        if (this._encloseType === 0) {
            var dx = (this.moveX() - character.homeX()) * this._encloseXRate;
            var dy = (this.moveY() - character.homeY()) * this._encloseYRate;
        } else {
            var dx = (this.moveX() - character.realX()) * this._encloseXRate;
            var dy = (this.moveY() - character.realY()) * this._encloseYRate;
        }
        if (dx || dy) {
            this._encloseAngle = Math.atan2(dx, dy) * 180 / Math.PI;
            this._encloseDistance = -dx || -dy;
        } else {
            this._encloseAngle = 0;
            this._encloseDistance = 0;
        }
    }
};

Sprite_Battler.prototype.updateEnclose = function() {
    if (this._encloseSpeed !== 0) {
        var character = this._encloseBaseCharacter;
        var radian, distance;
        if (this._encloseXRate && this._encloseYRate) {
            if (this._encloseType === 0) {
                var dx = (this.realX() - character.homeX()) / this._encloseXRate;
                var dy = (this.realY() - character.homeY()) / this._encloseYRate;
            } else {
                var dx = (this.realX() - character.realX()) / this._encloseXRate;
                var dy = (this.realY() - character.realY()) / this._encloseYRate;
            }
            if (dx || dy) {
                radian = Math.atan2(dx, dy) - this._encloseSpeed * Math.PI / 180;
                distance = Math.sqrt(dx * dx + dy * dy);
            } else {
                radian = 0;
                distance = 0;
            }
        } else {
            this._encloseAngle -= this._encloseSpeed;
            this._encloseAngle = this._encloseAngle.mod(360);
            radian = this._encloseAngle * Math.PI / 180;
            distance = this._encloseDistance;
        }
        var ox = distance * Math.sin(radian) * this._encloseXRate;
        var oy = distance * Math.cos(radian) * this._encloseYRate;
        this._offsetX = ox + character.homeX() - this.homeX();
        this._offsetY = oy + character.homeY() - this.homeY();
    }
};

//-----------------------------------------------------------------------------
// Sprite_Actor

//39
Alias.SpAc_initMembers = Sprite_Actor.prototype.initMembers;
Sprite_Actor.prototype.initMembers = function() {
    Alias.SpAc_initMembers.call(this);
    this._motionSpeed = 0;
    this._motionRestore = true;
    this._direction = 4;
};

//91
Sprite_Actor.prototype.moveToStartPosition = function() {
};

//107
Alias.SpAc_updateShadow = Sprite_Actor.prototype.updateShadow;
Sprite_Actor.prototype.updateShadow = function() {
    Alias.SpAc_updateShadow.call(this);
    this._shadowSprite.visible = this._shadowSprite.visible && this._shadowVisible;
    this._shadowSprite.y = this.jumpHeight() + this._altitude;
};

Sprite_Actor.prototype.startWeaponAnimation = function(imageId, wait) {
    this._weaponSprite.setup(imageId, wait);
};

//132
Alias.SpAc_startMotion = Sprite_Actor.prototype.startMotion;
Sprite_Actor.prototype.startMotion = function(motionType, loopType, speed, restore) {
    if (loopType === undefined) loopType = false;
    if (speed === undefined) speed = 12;
    if (restore === undefined) restore = true;
    if (typeof motionType === "string") {
        var lastMotion = this._motion;
        Alias.SpAc_startMotion.call(this, motionType);
        if (lastMotion !== this._motion) {
            this._motionSpeed = 12;
            this._motionRestore = true;
        }
    } else {
        this._motion = { index: motionType,  loop: loopType  };
        this._motionSpeed = speed;
        this._motionRestore = restore;
        this._motionCount = 0;
        this._pattern = 0;
    }
};

Sprite_Battler.prototype.startWeapon = function(weaponImageId, rate) {
    this._weaponSprite.setup(weaponImageId, rate);
};

//141
Sprite_Actor.prototype.updateTargetPosition = function() {
};

//191
Sprite_Actor.prototype.updateMotionCount = function() {
    if (this._motion && this._motionAnime && this.motionSpeed() > 0 &&
            ++this._motionCount >= this.motionSpeed()) {
        if (this._motion.loop) {
            this._pattern = (this._pattern + 1) % 4;
        } else if (this._pattern < 2) {
            this._pattern++;
        } else if (this._motionRestore) {
            this.refreshMotion();
        }
        this._motionCount = 0;
    }
};

//204
Sprite_Actor.prototype.motionSpeed = function() {
    return this._motionSpeed;
};

//208
Sprite_Actor.prototype.refreshMotion = function() {
    if (!this._interpreter.isRunning()) {
        this.setCommon(MPPlugin.actorRefresh, 'cbRefreshId');
    }
};

//234
Sprite_Actor.prototype.startEntryMotion = function() {
};

Sprite_Actor.prototype.isMirror = function() {
    return this._direction === 6;
};

//256
Sprite_Actor.prototype.onMoveEnd = function() {
    Sprite_Battler.prototype.onMoveEnd.call(this);
};

//263
Alias.SpAc_damageOffsetX = Sprite_Actor.prototype.damageOffsetX;
Sprite_Actor.prototype.damageOffsetX = function() {
    return Alias.SpAc_damageOffsetX.call(this) * -this.directionSign();
};

Sprite_Actor.prototype.setEchoData = function(sprite, data) {
    if (data) {
        var bitmap = data.bitmap;
        sprite.bitmap = bitmap;
        sprite.x = data.x;
        sprite.y = data.y;
        if (bitmap) {
            var motionIndex = data.index;
            var pattern = data.pattern;
            var cw = bitmap.width / 9;
            var ch = bitmap.height / 6;
            var cx = Math.floor(motionIndex / 6) * 3 + pattern;
            var cy = motionIndex % 6;
            sprite.setFrame(cx * cw, cy * ch, cw, ch);
        }
        sprite.scale = data.scale;
        sprite.rotation = data.rotation;
    }
};

Sprite_Actor.prototype.createEchoData = function() {
        return {
            bitmap:  this._mainSprite.bitmap,
            x:       this.x,
            y:       this.y,
            index:   this._motion ? this._motion.index : 0,
            pattern: this._pattern < 3 ? this._pattern : 1,
            scale:   this.scale.clone(),
            rotation:this.rotation
        };
};

//-----------------------------------------------------------------------------
// Sprite_Enemy

//940
Alias.SpEn_setBattler = Sprite_Enemy.prototype.setBattler;
Sprite_Enemy.prototype.setBattler = function(battler) {
    Alias.SpEn_setBattler.call(this, battler);
    this._direction = 6;
};

Sprite_Enemy.prototype.isMirror = function() {
    return this._direction === 4;
};

//943
Alias.SpEn_update = Sprite_Enemy.prototype.update;
Sprite_Enemy.prototype.update = function() {
    Alias.SpEn_update.call(this);
    if (this._enemy && this._enemy.isMotionRefreshRequested()) {
        this.refreshMotion();
        this._enemy.clearMotion();
    }
};

Sprite_Enemy.prototype.refreshMotion = function() {
    this.setCommon(MPPlugin.enemyRefresh, 'cbRefreshId');
};

Sprite_Enemy.prototype.setEchoData = function(sprite, data) {
    if (data) {
        sprite.bitmap = data.bitmap;
        sprite.x = this.xWithSign(data.x - this.x, -2);
        sprite.y = data.y - this.y;
        sprite.scale = data.scale;
        sprite.rotation = data.rotation;
    }
};

Sprite_Enemy.prototype.createEchoData = function() {
    return {
        bitmap:this.bitmap,
        x:     this.x,
        y:     this.y,
        scale:   this.scale.clone(),
        rotation:this.rotation
    };
};

//-----------------------------------------------------------------------------
// Sprite_Weapon

//13
Alias.SpWe_initialize = Sprite_Weapon.prototype.initialize;
Sprite_Weapon.prototype.initialize = function() {
    Alias.SpWe_initialize.call(this);
    this._animationWait = 12;
    this._weaponAnime = true;
};

//27
Alias.SpWe_setup = Sprite_Weapon.prototype.setup;
Sprite_Weapon.prototype.setup = function(weaponImageId, wait) {
    this._animationWait = wait || 12;
    Alias.SpWe_setup.call(this, weaponImageId);
};

//35
Sprite_Weapon.prototype.update = function() {
    Sprite_Base.prototype.update.call(this);
    if (this._weaponAnime) {
        this._animationCount++;
    }
    if (this._animationCount >= this.animationWait()) {
        this.updatePattern();
        this.updateFrame();
        this._animationCount = 0;
    }
};

//45
Sprite_Weapon.prototype.animationWait = function() {
    return this._animationWait;
};

//-----------------------------------------------------------------------------
// Sprite_PopIcon

function Sprite_PopIcon() {
    this.initialize.apply(this, arguments);
}

Sprite_PopIcon.prototype = Object.create(Sprite.prototype);
Sprite_PopIcon.prototype.constructor = Sprite_PopIcon;

Sprite_PopIcon.prototype.initialize = function() {
    Sprite.prototype.initialize.call(this);
    this.initMembers();
    this.loadBitmap();
};

Sprite_PopIcon.prototype.initMembers = function() {
    this._iconIndex = 0;
    this._targetX = 0;
    this._targetY = 0;
    this._moveDuration = 0;
    this._rotationSpeed = 0;
    this._targetScaleX = 1;
    this._targetScaleY = 1;
    this._scaleDuration = 0;
    this.anchor.x = 0.5;
    this.anchor.y = 0.5;
};

Sprite_PopIcon.prototype.loadBitmap = function() {
    this.bitmap = ImageManager.loadSystem(MPPlugin.iconSetName);
    this.setFrame(0, 0, 0, 0);
};

Sprite_PopIcon.prototype.setIcon = function(iconIndex) {
    this._iconIndex = iconIndex;
    this.updateFrame();
};

Sprite_PopIcon.prototype.startMove = function(x, y, duration) {
    this._targetX = x;
    this._targetY = y;
    this._moveDuration = duration;
    if (duration === 0) {
        this.x = x;
        this.y = y;
    }
};

Sprite_PopIcon.prototype.startRotation = function(speed) {
    this._rotationSpeed = speed * Math.PI / 180;
};

Sprite_PopIcon.prototype.startZoom = function(scaleX, scaleY, duration) {
    this._targetScaleX = scaleX;
    this._targetScaleY = scaleY;
    this._scaleDuration = duration;
    if (duration === 0) {
        this.scale.x = scaleX;
        this.scale.y = scaleY;
    }
};

Sprite_PopIcon.prototype.update = function() {
    Sprite.prototype.update.call(this);
    if (this._moveDuration > 0) {
        var d = this._moveDuration;
        this.x = (this.x * (d - 1) + this._targetX) / d;
        this.y = (this.y * (d - 1) + this._targetY) / d;
        this._moveDuration--;
    }
    if (this._rotationSpeed) {
        this.rotation = (this.rotation + this._rotationSpeed).mod(Math.PI * 2);
    }
    if (this._scaleDuration) {
        var d = this._scaleDuration;
        this.scale.x = (this.scale.x * (d - 1) + this._targetScaleX) / d;
        this.scale.y = (this.scale.y * (d - 1) + this._targetScaleY) / d;
        this._scaleDuration--;
    }
};

Sprite_PopIcon.prototype.updateFrame = function() {
    var pw = MPPlugin.iconWidth;
    var ph = MPPlugin.iconHeight;
    var sx = this._iconIndex % 16 * pw;
    var sy = Math.floor(this._iconIndex / 16) * ph;
    this.setFrame(sx, sy, pw, ph);
};


//-----------------------------------------------------------------------------
// Spriteset_Battle

//18
Alias.SpsetBa_createLowerLayer = Spriteset_Battle.prototype.createLowerLayer;
Spriteset_Battle.prototype.createLowerLayer = function() {
    Alias.SpsetBa_createLowerLayer.call(this);
    this.createEvents();
    this.setupCharacter();
};

Spriteset_Battle.prototype.createEvents = function() {
    this._eventSprites = [];
    for (var i = 0; i < MPPlugin.eventActors.length; i++) {
        var actor = $gameActors.actor(MPPlugin.eventActors);
        if (actor) {
            this._eventSprites = new Sprite_Actor(actor);
            this._eventSprites.shadowOff();
            this._battleField.addChild(this._eventSprites);
        }
    }
};

Spriteset_Battle.prototype.setupCharacter = function() {
    for (var i = 0; i < this._actorSprites.length; i++) {
        ComBat.setCharacter(i + 1, this._actorSprites);
    }
    for (var i = 0; i < this._enemySprites.length; i++) {
        var enemy = this._enemySprites._enemy;
        ComBat.setCharacter(enemy.index() + 9, this._enemySprites);
    }
    for (var i = 0; i < this._eventSprites.length; i++) {
        ComBat.setCharacter(i + 17, this._eventSprites);
    }
};

//33
Alias.SpsetBa_update = Spriteset_Battle.prototype.update;
Spriteset_Battle.prototype.update = function() {
    Alias.SpsetBa_update.call(this);
    this.sortBfChildren();
};

//51
Alias.SpsetBa_createBattleback = Spriteset_Battle.prototype.createBattleback;
Spriteset_Battle.prototype.createBattleback = function() {
    Alias.SpsetBa_createBattleback.call(this);
    this._back1Sprite.cbZ = 10;
    this._back2Sprite.cbZ = 10;
};

Spriteset_Battle.prototype.sortBfChildren = function() {
    this._battleField.children.sort(this._compareChildOrder.bind(this));
};

Spriteset_Battle.prototype._compareChildOrder = function(a, b) {
    if (!a.cbZ) {
        return 1;
    } else if (!b.cbZ) {
        return -1;
    } else if (a.cbZ !== b.cbZ) {
        return a.cbZ - b.cbZ;
    } else if (a.y !== b.y) {
        return a.y - b.y;
    } else {
        return a.spriteId - b.spriteId;
    }
};

//-----------------------------------------------------------------------------
// Window_Message

//108
Alias.WiMe_updatePlacement = Window_Message.prototype.updatePlacement;
Window_Message.prototype.updatePlacement = function() {
    Alias.WiMe_updatePlacement.call(this);
    if ($gameParty.inBattle()) {
        if (this._positionType === 0) {
            this.height = this.fittingHeight(MPPlugin.upperMessageRow);
        } else {
            this.height = this.windowHeight();
        }
    }
    Alias.WiMe_updatePlacement.call(this);
};

//-----------------------------------------------------------------------------
// Scene_Battle

//29
Alias.ScBa_prototype = Scene_Battle.prototype.update;
Scene_Battle.prototype.update = function() {
    $gameTroop.updateInterpreter();
    Alias.ScBa_prototype.call(this);
};

//58
Alias.ScBa_changeInputWindow = Scene_Battle.prototype.changeInputWindow;
Scene_Battle.prototype.changeInputWindow = function() {
    if (!BattleManager._userWait) {
        Alias.ScBa_changeInputWindow.call(this);
    }
};

//82
Alias.ScBa_terminate = Scene_Battle.prototype.terminate;
Scene_Battle.prototype.terminate = function() {
    Alias.ScBa_terminate.call(this);
    ComBat.clearCharacter();
};

//94
Scene_Battle.prototype.updateStatusWindow = function() {
    if (BattleManager.isEvantWait()) {
        this._statusWindow.close();
        this._partyCommandWindow.close();
        this._actorCommandWindow.close();
    } else if (this.isActive() && !this._messageWindow.isClosing()) {
        this._statusWindow.open();
    }
};

})();
[/pre]


回复

使用道具 举报

梦石
0
星屑
497
在线时间
266 小时
注册时间
2015-12-8
回帖
729
 楼主| 发表于 2016-2-16 12:26:06 | 显示全部楼层
tseyik 发表于 2016-2-16 10:19
事件戦鬥
可和同作者的ATB戦鬥併用
Released under the MIT license

範例沒辦法下載

点评

范例可以下,在左上角 下载那个图标选项那里  发表于 2016-2-16 12:58
回复

使用道具 举报

梦石
0
星屑
497
在线时间
266 小时
注册时间
2015-12-8
回帖
729
 楼主| 发表于 2016-2-16 16:12:23 | 显示全部楼层
小叮鈴 发表于 2016-2-16 12:26
範例沒辦法下載

我知道阿,ダウンロード中文意思是下載 問題點了無法顯示網頁

点评

去下个翻墙软件,推荐Lantern,方便快捷,找准正版,很多第三方带插件的  发表于 2016-2-18 23:47
回复

使用道具 举报

梦石
0
星屑
22879
在线时间
8598 小时
注册时间
2011-12-31
回帖
3270
发表于 2016-2-20 13:06:37 | 显示全部楼层
本帖最后由 tseyik 于 2016-2-20 16:14 编辑

サイドビューのアクター配置設定
http://i.gmobb.jp/nekoma/rpg_tkool/
@help
* プラグインコマンド:
*   SetActorHomeX 式        # 角色X座標的計算式。
*   SetActorHomeY 式        # 角色Y座標的計算式。
*
* プラグインコマンド例:
*   SetActorHomeX 600 + index * 32
*   : 式中用index、自動計算各個角色的数値
*   : 先頭角色為「0番目」、以降+1。
*
* プラグインコマンド例(応用編):
*   SetActorHomeX (index == 0) ? 100 : 200
*   : 「indexが0時為100。以外為200」
*   
*   SetActorHomeX (index == 0 || index == 1) ? 100 : 200
*   : 「indexが0和1時為100。以外為200」
*   
*   SetActorHomeX (index == 0) ? 100 : (index == 1) ? 200 : 300
*   : 「indexが0時為100。indexが1時為200。以外為300」
*/
例
Cbnu1p-UEAEF-bA.png
Cbnu1puVAAADF-s.png







回复

使用道具 举报

梦石
0
星屑
50
在线时间
44 小时
注册时间
2015-12-27
回帖
42
发表于 2016-2-22 09:09:04 | 显示全部楼层
tseyik 发表于 2016-2-16 10:19
事件戦鬥
可和同作者的ATB戦鬥併用
Released under the MIT license

这个插件好
回复

使用道具 举报

梦石
0
星屑
1225
在线时间
564 小时
注册时间
2014-11-30
回帖
126
发表于 2016-3-28 22:29:49 | 显示全部楼层
tseyik 发表于 2016-2-16 10:19
事件戦鬥
可和同作者的ATB戦鬥併用
Released under the MIT license

不会用这个,不会怎么设置坐标,按你上面的公式也搞不对,在范本里一关闭ATB脚本就错,我不想用ATB的,自己无法单独使用这个坐标脚本,能不能写个使用方法出来,非常需要这个脚本
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部