/*:----------------------------------------------------------------------------------- * NUUN_BattleME.js * * Copyright (C) 2020 NUUN * This software is released under the MIT License. * http://opensource.org/licenses/mit-license.php * ------------------------------------------------------------------------------------- * * 更新履歴 * 2020/11/29 Ver 1.0.0 */ /*: @target MZ @url https://github.com/nuun888/MZ @plugindesc Enemy group individual battle victory/defeat ME @author NUUN @license MIT License @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/NUUN-MZ-plugins ). Original plugin by NUUN. Please check the latest official version at: https://github.com/nuun888/MZ ----- You can set battle victory/defeat effects for each enemy group. Please enter these in the notes on the first page of the enemy group's battle event. Battle Victory Effects The effect specified in [name] will be played. *[eval] can be omitted. Battle Defeat Effects The effect specified in [name] will be played. *[eval] can be omitted. [name]: Effects file name (without extension) [volume]: Volume [pitch]: Pitch [pan]: Phase [eval]: Playback condition (evaluation formula) Example The victory effect will be Victory2. The effect upon defeat will be Defeat2. When switch ID 3 is True, the effect upon victory will be Victory3. For conditional effect modes, please list them in order of priority. By design, the first playable effect mode found will be played. Terms of Use This plugin is distributed under the MIT License. */ /*:ja @target MZ @plugindesc 敵グループの個別戦闘勝利敗北ME @author NUUN @help 敵グループごとに戦闘勝利敗北MEを設定できます。 敵グループのバトルイベントの1ページ目に注釈で記入してください。 戦闘勝利時のME [name]で指定したMEが再生られます。 ※[eval]は省略できます。 戦闘敗北時のME [name]で指定したMEが再生られます。 ※[eval]は省略できます。 [name]:MEファイル名(拡張子なし) [volume]:音量 [pitch]:ピッチ [pan]:位相 [eval]:再生条件(評価式) 例 勝利時のMEがVictory2になります。 敗北時のMEがDefeat2になります。 スイッチID3番がTrueの時、勝利時のMEがVictory3になります。 条件付きのMEはなるべく優先度の高い順に上から記入してください。 仕様上、一番最初に再生可能なMEが見つかったらそのMEが再生されます。 利用規約 このプラグインはMITライセンスで配布しています。 */ var Imported = Imported || {}; Imported.NUUN_BattleME = true; (() => { const parameters = PluginManager.parameters('NUUN_BattleME'); const reVictory = /<(?:battleVictoryME):\s*(.*)>/; const reDefeat = /<(?:battleDefeatME):\s*(.*)>/; const _Game_Troop_setup = Game_Troop.prototype.setup; Game_Troop.prototype.setup = function(troopId) { _Game_Troop_setup.call(this, troopId); const victoryME = this.battleVictoryMESetup(); $gameSystem.setVictoryMe(victoryME); const defeatME = this.battleDefeatMESetup(); $gameSystem.setDefeatMe(defeatME); }; Game_Troop.prototype.battleVictoryMESetup = function() { const pages = this.troop().pages[0]; let list = null; pages.list.forEach(tag => { if ((tag.code === 108 || tag.code === 408) && !list) { let match = reVictory.exec(tag.parameters[0]); if (match) { list = this.battleVictoryMERequest(match[1]); } } }); return list; }; Game_Troop.prototype.battleDefeatMESetup = function() { const pages = this.troop().pages[0]; let list = null; pages.list.forEach(tag => { if ((tag.code === 108 || tag.code === 408) && !list) { let match = reDefeat.exec(tag.parameters[0]); if (match) { list = this.battleDefeatMERequest(match[1]); } } }); return list; }; Game_Troop.prototype.battleMEConditions = function(conditions) { return conditions ? eval(conditions) : true; }; Game_Troop.prototype.battleVictoryMERequest = function(data) { const list = data.split(','); if(this.battleMEConditions(list[4])){ return {name:list[0],volume:list[1],pitch:list[2],pan:list[3]}; } return null; }; Game_Troop.prototype.battleDefeatMERequest = function(data) { const list = data.split(','); if(this.battleMEConditions(list[4])){ return {name:list[0],volume:list[1],pitch:list[2],pan:list[3]}; } return null; }; })();