//============================================================================= // TMVplugin - 行動パターン拡張 // 作者: tomoaky (http://hikimoki.sakura.ne.jp/) // Version: 0.1a // 最終更新日: 2016/07/29 //============================================================================= /*: @plugindesc Corrects the Enemies behavior pattern determination process. @author tomoaky @url https://github.com/munokura/tomoaky-MV-plugins @license MIT @help English Help Translator: munokura This is an unofficial English translation of the plugin help, created to support global RPG Maker users. Feedback is welcome to improve translation quality (see: https://github.com/munokura/tomoaky-MV-plugins ). Original plugin by tomoaky. ----- Usage: This changes the behavior pattern determination process for Enemies tagged in the Note field. Note field Tag (Enemies): When an action cannot be performed due to reasons such as insufficient MP when performing multiple actions or applying silence before using a spell, this will re-roll the action. The value set in the tag is the probability of re-rolling; for example, 50 means a 50% chance of re-rolling. */ /*:ja @plugindesc 敵キャラの行動パターン決定処理を修正します。 @author tomoaky @url https://github.com/munokura/tomoaky-MV-plugins @license MIT @help 使い方: メモ欄にタグを付けた敵キャラの行動パターン決定処理が変化します。 メモ欄タグ(敵キャラ): 複数回行動時のMP不足、魔法使用前に沈黙付加、などの理由で行動が実行 できなくなったときに、行動の再抽選を実行します。 タグに設定した数値が再抽選の実行確率となります、50 なら50%で再抽選。 */ var Imported = Imported || {}; Imported.TMEnemyActionEx = true; (function() { //----------------------------------------------------------------------------- // Game_Action // var _Game_Action_prepare = Game_Action.prototype.prepare; Game_Action.prototype.prepare = function() { _Game_Action_prepare.call(this); if (!this.isValid() && Math.randomInt(100) < this.subject().actionPrepareRate()) { this.setEnemyAction(this.subject().prepareAction()); } }; //----------------------------------------------------------------------------- // Game_BattlerBase // Game_BattlerBase.prototype.actionPrepareRate = function() { return 0; }; //----------------------------------------------------------------------------- // Game_Enemy // Game_Enemy.prototype.actionPrepareRate = function() { return this.enemy().meta.actionPrepare || 0; }; Game_Enemy.prototype.prepareAction = function() { var actionList = this.enemy().actions.filter(function(a) { return this.isActionValid(a); }, this); if (actionList.length > 0) { var ratingMax = Math.max.apply(null, actionList.map(function(a) { return a.rating; })); var ratingZero = ratingMax - 3; actionList = actionList.filter(function(a) { return a.rating > ratingZero; }); return this.selectAction(actionList, ratingZero); } return null; }; })();