//============================================================================= // RPG Maker MZ - CommonResult // // Copyright 2024 min-pub. All rights reserved. // This source code or any portion thereof must not be // reproduced or used without licensed in any manner whatsoever. //============================================================================= /*: * @target MZ * @plugindesc 共通リザルト処理 * @author 四号戦車 * @base PluginCommonBase * @base PluginUtils * @orderAfter PluginCommonBase * @orderAfter PluginUtils * * @param event * @text 呼び出すコモンイベント * @desc 実際の処理を行うコモンイベント * @type common_event * @default 0 * * @param respawnEvent * @text 呼び出すリスポーンイベント * @desc リスポーン処理を行うコモンイベント * @type common_event * @default 0 * * @param prostituteChanged * @text 娼婦レベル変動値 * @desc レベル変動時の結果 * @type variable * @default 0 * * @param braveChanged * @text 勇者レベル変動値 * @desc レベル変動時の結果 * @type variable * @default 0 * * @param levelChangeEvent * @text レベル変動イベント * @desc レベル変動時に呼び出すイベント * @type common_event * @default 0 * * @param braveLebel * @text 勇者レベル * @desc 操作する勇者レベル変数の指定 * @type variable * @default 0 * * @param prostituteLebel * @text 娼婦レベル * @desc 操作する娼婦レベル変数の指定 * @type variable * @default 0 * * @param braveBuff * @text 勇者レベル補正値 * @desc 勇者レベル吸淫時に乗算されます * @type variable * @default 0 * * @param prostituteBuff * @text 娼婦レベル補正値 * @desc 娼婦レベル上昇時に乗算されます * @type variable * @default 0 * * @param emptyLebelFlag * @text レベルゼロフラグ * @desc これ以上吸えない時のフラグ * @type switch * @default 0 * * @param lewdLebel * @text エロステ段階 * @desc 現在のエロステ段階変数の指定 * @type variable * @default 0 * * @param life * @text 残機 * @desc 現在の残機変数の指定 * @type variable * @default 0 * * @param lifeLimit * @text 残機上限 * @desc 現在の残機上限変数の指定 * @type variable * @default 0 * * @param comment * @text 備考欄 * @desc プラグイン側では使用しません。 * メモ欄としてお使いください。 * @type multiline_string * @default * * @command level * @text レベル変動処理 * @desc 娼婦レベル/勇者レベルの変動処理を行います * * @arg actor * @text 対象キャラ * @desc レベル変動処理を行う対象のキャラ * @type actor * @default 0 * * @arg braveLevel * @text 減少する勇者レベル * @desc * @type number * @default 0 * * @arg prostituteLevel * @text 上昇する娼婦レベル * @desc * @type number * @default 0 * * @help CommonResult.js * * Version: 0.0.1 * * 共通リザルト処理の呼び出しプラグイン * * */ (() => { "use strict"; //======================================================================== // プラグイン定義 //======================================================================== const pluginName = "CommonResult"; const script = document.currentScript; const param = PluginManagerEx.createParameter(script); //======================================================================== // 定数定義 //======================================================================== const drainBraveLevel = (drainedBraveLebel) => { if (param.braveLebel > 0) { const current = PluginUtils.getVariables(param.braveLebel); if (current - drainedBraveLebel <= 1) { // 勇者レベルの減少値が下限に到達したので代わりに娼婦レベルを下げる const flow = Math.abs((current - 1) - drainedBraveLebel); // 娼婦レベル変動値を格納 $gameSwitches.setValue(param.emptyLebelFlag, false); $gameVariables.setValue(param.prostituteChanged, (flow * -1)); const currentProstitute = PluginUtils.getVariables(param.prostituteLebel); if (flow >= currentProstitute) { // 娼婦レベルすら残ってない if (param.emptyLebelFlag > 0) { $gameSwitches.setValue(param.emptyLebelFlag, true); } $gameVariables.setValue(param.prostituteLebel, 0); } else { const drainedProstituteLebel = Math.max(currentProstitute - flow, 0); if (drainedProstituteLebel > 0) { $gameVariables.setValue(param.prostituteLebel, drainedProstituteLebel); } } } // 勇者レベル変動値を格納 $gameVariables.setValue(param.braveChanged, (drainedBraveLebel * -1)); const after = Math.max(current - drainedBraveLebel, 1); if (after > 0) { $gameVariables.setValue(param.braveLebel, after); } return after; } return 0; }; const MAX_PROSTITUTE_LEVEL = 999; // 娼婦レベル上限 const raiseProstituteLevel = (raisedProstituteLebel) => { if (raisedProstituteLebel <= 0) { // 上昇なし return 0; } if (param.prostituteLebel > 0) { const currentChanged = PluginUtils.getVariables(param.prostituteChanged); const changed = raisedProstituteLebel + currentChanged; // 娼婦レベル変動値を格納 $gameVariables.setValue(param.prostituteChanged, changed); const current = PluginUtils.getVariables(param.prostituteLebel); const after = Math.min(Math.max(current + changed, 0), MAX_PROSTITUTE_LEVEL); $gameVariables.setValue(param.prostituteLebel, after); return after; } return 0; }; const processLevel = (actorId, braveLevel, prostituteLevel, interpreter) => { // レベル変動値をリセット $gameVariables.setValue(param.braveChanged, 0); $gameVariables.setValue(param.prostituteChanged, 0); // 勇者レベル吸淫 const braveBuff = PluginUtils.getVariables(param.braveBuff) ?? 0; const brave = drainBraveLevel(Math.round(PluginUtils.percentOver(braveLevel, braveBuff), 0)); // 娼婦レベル上昇 const prostituteBuff = PluginUtils.getVariables(param.prostituteBuff) ?? 0; const prostitute = raiseProstituteLevel(Math.round(PluginUtils.percentOver(prostituteLevel, prostituteBuff), 0)); // 合計レベル設定 if (actorId > 0) { const actor = $gameActors.actor(actorId); actor.changeLevel(brave + prostitute, true); } PluginUtils.waitCommonEvent(param.levelChangeEvent, interpreter); }; //======================================================================== // プラグインコマンド //======================================================================== PluginManagerEx.registerCommand(script, 'level', args => { processLevel(args.actor, args.braveLevel, args.prostituteLevel, args.interpreter); }); })();