// DarkPlasma_RegenerateByValueTraitCustomSample 1.0.0 // Copyright (c) 2023 DarkPlasma // This software is released under the MIT license. // http://opensource.org/licenses/mit-license.php /** * 2023/06/16 1.0.0 公開 */ /*: @target MZ @url https://github.com/elleonard/DarkPlasma-MZ-Plugins/tree/release @plugindesc HP regeneration value MP regeneration value Custom ID sample of feature @author DarkPlasma @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/DarkPlasma-MZ-Plugins ). Original plugin by DarkPlasma. Please check the latest official version at: https://github.com/elleonard/DarkPlasma-MZ-Plugins/tree/release ----- version: 1.0.0 This is a sample implementation of a custom ID defined with DarkPlasma_RegenerateByValueTrait. For custom ID: 1, this will restore HP regeneration by the value of the variable specified by the parameter. The sample trait is defined as follows: (This 0 can be any number and will be ignored.) This plugin requires the following plugin: DarkPlasma_RegenerateByValueTrait version: 1.0.0 If using with the following plugin, add it below it. DarkPlasma_RegenerateByValueTrait @param variableId @text variable @type variable */ /*:ja @plugindesc HP再生値 MP再生値特徴のカスタムIDサンプル @author DarkPlasma @license MIT @target MZ @url https://github.com/elleonard/DarkPlasma-MZ-Plugins/tree/release @base DarkPlasma_RegenerateByValueTrait @orderAfter DarkPlasma_RegenerateByValueTrait @param variableId @text 変数 @type variable @help version: 1.0.0 DarkPlasma_RegenerateByValueTrait で定義するカスタムIDの実装サンプルです。 HP再生値のカスタムID:1について、パラメータで指定した変数の値分回復します。 サンプルのための特徴は以下のように定義します。 (この0は任意の数値で構いません。無視されます) 本プラグインの利用には下記プラグインを必要とします。 DarkPlasma_RegenerateByValueTrait version:1.0.0 下記プラグインと共に利用する場合、それよりも下に追加してください。 DarkPlasma_RegenerateByValueTrait */ (() => { 'use strict'; const pluginName = document.currentScript.src.replace(/^.*\/(.*).js$/, function () { return arguments[1]; }); const pluginParametersOf = (pluginName) => PluginManager.parameters(pluginName); const pluginParameters = pluginParametersOf(pluginName); const settings = { variableId: Number(pluginParameters.variableId || 0), }; const CUSTOM_ID = 1; function Game_Battler_RegenerateByValueCustomMixIn(gameBattler) { const _hpRegenerationValue = gameBattler.hpRegenerationValue; gameBattler.hpRegenerationValue = function (customId) { /** * カスタムID1のHP回復値特徴をかき集め、変数の数値分だけ回復するようにする * 単純に変数の値に、カスタムID1のHP回復値特徴の数をかけても良いが、複雑な計算式の場合に応用が効きやすい実装とする */ if (customId === CUSTOM_ID) { return this.traitsWithId(DataManager.hpRegenerationValueTraitId(), customId).reduce( (result, _) => result + $gameVariables.value(settings.variableId), 0 ); } return _hpRegenerationValue.call(this, customId); }; } Game_Battler_RegenerateByValueCustomMixIn(Game_Battler.prototype); })();