//============================================================================= // TargetByFormation.js // ---------------------------------------------------------------------------- // Copyright (c) 2015-2017 Triacontane // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Version // 1.0.0 2017/05/21 初版 // ---------------------------------------------------------------------------- // [Blog] : http://triacontane.blogspot.jp/ // [Twitter]: https://twitter.com/triacontane/ // [GitHub] : https://github.com/triacontane/ //============================================================================= /*: @url https://triacontane.blogspot.com/ @plugindesc Plugin that changes target rate depending on sort order @author Triacontane @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/triacontane-MV-plugins ). Original plugin by Triacontane. Please check the latest official version at: https://triacontane.blogspot.com ----- The chance of being targeted varies depending on the party order. The closer to the front the player is, the more likely they are to be targeted. This plugin does not have any plugin commands. Terms of Use: You may modify and redistribute this plugin without permission from the author, and there are no restrictions on its use (commercial, 18+, etc.). This plugin is now yours. @param 変動倍率 @text Fluctuation rate @desc This is the target probability fluctuation multiplier for each person in the formation. If you set it to 50 for a party of four, the target probability of the person at the front will be 2.5 times that of the person at the back. @default 50 */ /*:ja @plugindesc 並び順による狙われ率変動プラグイン @author トリアコンタン @param 変動倍率 @desc 隊列一人分の狙われ率変動倍率です。4人パーティで50にすると先頭の狙われ率は最後尾の2.5倍になります。 @default 50 @help パーティの並び順によって狙われ率が変動します。 前にいるプレイヤーほど狙われやすくなります。 このプラグインにはプラグインコマンドはありません。 利用規約: 作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等) についても制限はありません。 このプラグインはもうあなたのものです。 */ (function () { 'use strict'; var pluginName = 'TargetByFormation'; //============================================================================= // ローカル関数 // プラグインパラメータやプラグインコマンドパラメータの整形やチェックをします //============================================================================= var getParamString = function (paramNames) { if (!Array.isArray(paramNames)) paramNames = [paramNames]; for (var i = 0; i < paramNames.length; i++) { var name = PluginManager.parameters(pluginName)[paramNames[i]]; if (name) return name; } return ''; }; var getParamNumber = function (paramNames, min, max) { var value = getParamString(paramNames); if (arguments.length < 2) min = -Infinity; if (arguments.length < 3) max = Infinity; return (parseInt(value) || 0).clamp(min, max); }; //============================================================================= // パラメータの取得と整形 //============================================================================= var param = {}; param.changeRate = getParamNumber(['ChangeRate', '変動倍率']); Object.defineProperty(Game_BattlerBase.prototype, 'tgr', { get: function () { return this.sparam(0) * this.getTargetAdjustment(); }, configurable: true }); Game_BattlerBase.prototype.getTargetAdjustment = function () { var descendingIndex = this.friendsUnit().members().length - this.index() - 1; return 1 + (descendingIndex * param.changeRate / 100); }; })();