查看: 5044|回复: 4

[已经过期] MV难度插件

[复制链接]
梦石
2
星屑
1239
在线时间
355 小时
注册时间
2014-9-27
回帖
98
发表于 2016-12-24 16:09:30 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×


话说......有哪位大佬可以教我一下怎么在游戏的选项设置里面加一项难度的设置(分为简单、普通、困难三种难度)。
最好是有插件,并且各个难度的怪物生命、攻击、金钱、经验等百分比可以自己调整......(话说要求是不是有点太多了)
在此拜谢各位大佬。
梦石
0
星屑
22879
在线时间
8598 小时
注册时间
2011-12-31
回帖
3270
发表于 2016-12-24 16:21:09 | 显示全部楼层
https://raw.githubusercontent.co ... DifficultyExtend.js

叧一個
Vitsuno_Difficulty.js
  1. //=============================================================================
  2. // Vitsuno_Difficulty.js
  3. //-----------------------------------------------------------------------------
  4. // Copyright (c) 2016 Tsuno Ozumi
  5. // Released under the MIT license
  6. // [url]http://opensource.org/licenses/mit-license.php[/url]
  7. //=============================================================================

  8. var Vitsuno = Vitsuno || {};
  9. Vitsuno.Difficulty = {};
  10. Vitsuno.Difficulty.version = 1.00;

  11. /*:
  12. * @plugindesc 難易度により能力値や報酬倍率を変更できるようになります。
  13. * @author 尾角 つの (Tsuno Ozumi)
  14. *
  15. * @param Init Difficulty ID
  16. * @desc 難易度IDの初期値です。
  17. * @default 2
  18. *
  19. * @param Use Option
  20. * @desc オプションで難易度変更するかどうか。0:しない 1:する
  21. * @default 1
  22. *
  23. * @param Option Name
  24. * @desc オプションでの表示名です。
  25. * @default 難易度
  26. *
  27. * @param --(Difficulty ID:1)--
  28. *
  29. * @param 1 : Name
  30. * @desc 難易度名です。(使用しない場合は無記入にしてください。)
  31. * @default イージー
  32. *
  33. * @param 1 : Param Rate
  34. * @desc 難易度によるステータス倍率です。
  35. * 最大HP,最大MP,攻撃力,防御力,魔法力,魔法防御,敏捷性,運
  36. * @default 0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7
  37. *
  38. * @param 1 : Drop Rate
  39. * @desc 難易度による報酬倍率です。
  40. * 経験値,お金,アイテム1,アイテム2,アイテム3
  41. * @default 1.0,1.0,1.0,1.0,1.0
  42. *
  43. * @param --(ID:2)-------------
  44. *
  45. * @param 2 : Name
  46. * @desc 難易度名です。(使用しない場合は無記入にしてください。)
  47. * @default ノーマル
  48. *
  49. * @param 2 : Param Rate
  50. * @desc 難易度によるステータス倍率です。
  51. * 最大HP,最大MP,攻撃力,防御力,魔法力,魔法防御,敏捷性,運
  52. * @default 1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0
  53. *
  54. * @param 2 : Drop Rate
  55. * @desc 難易度による報酬倍率です。
  56. * 経験値,お金,アイテム1,アイテム2,アイテム3
  57. * @default 1.0,1.0,1.0,1.0,1.0
  58. *
  59. * @param --(ID:3)-------------
  60. *
  61. * @param 3 : Name
  62. * @desc 難易度名です。(使用しない場合は無記入にしてください。)
  63. * @default ハード
  64. *
  65. * @param 3 : Param Rate
  66. * @desc 難易度によるステータス倍率です。
  67. * 最大HP,最大MP,攻撃力,防御力,魔法力,魔法防御,敏捷性,運
  68. * @default 1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3
  69. *
  70. * @param 3 : Drop Rate
  71. * @desc 難易度による報酬倍率です。
  72. * 経験値,お金,アイテム1,アイテム2,アイテム3
  73. * @default 1.2,1.2,1.2,1.2,1.2
  74. *
  75. * @param --(ID:4)-------------
  76. *
  77. * @param 4 : Name
  78. * @desc 難易度名です。(使用しない場合は無記入にしてください。)
  79. * @default ベリーハード
  80. *
  81. * @param 4 : Param Rate
  82. * @desc 難易度によるステータス倍率です。
  83. * 最大HP,最大MP,攻撃力,防御力,魔法力,魔法防御,敏捷性,運
  84. * @default 1.6,1.6,1.6,1.6,1.6,1.6,1.6,1.6
  85. *
  86. * @param 4 : Drop Rate
  87. * @desc 難易度による報酬倍率です。
  88. * 経験値,お金,アイテム1,アイテム2,アイテム3
  89. * @default 1.4,1.4,1.4,1.4,1.4
  90. *
  91. * @param --(ID:5)-------------
  92. *
  93. * @param 5 : Name
  94. * @desc 難易度名です。(使用しない場合は無記入にしてください。)
  95. * @default マニア
  96. *
  97. * @param 5 : Param Rate
  98. * @desc 難易度によるステータス倍率です。
  99. * 最大HP,最大MP,攻撃力,防御力,魔法力,魔法防御,敏捷性,運
  100. * @default 1.9,1.9,1.9,1.9,1.9,1.9,1.9,1.9
  101. *
  102. * @param 5 : Drop Rate
  103. * @desc 難易度による報酬倍率です。
  104. * 経験値,お金,アイテム1,アイテム2,アイテム3
  105. * @default 1.6,1.6,1.6,1.6,1.6
  106. *
  107. * @param --(ID:6)-------------
  108. *
  109. * @param 6 : Name
  110. * @desc 難易度名です。(使用しない場合は無記入にしてください。)
  111. *
  112. * @param 6 : Param Rate
  113. * @desc 難易度によるステータス倍率です。
  114. * 最大HP,最大MP,攻撃力,防御力,魔法力,魔法防御,敏捷性,運
  115. * @default 1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0
  116. *
  117. * @param 6 : Drop Rate
  118. * @desc 難易度による報酬倍率です。
  119. * 経験値,お金,アイテム1,アイテム2,アイテム3
  120. * @default 1.0,1.0,1.0,1.0,1.0
  121. *
  122. * @param --(ID:7)-------------
  123. *
  124. * @param 7 : Name
  125. * @desc 難易度名です。(使用しない場合は無記入にしてください。)
  126. *
  127. * @param 7 : Param Rate
  128. * @desc 難易度によるステータス倍率です。
  129. * 最大HP,最大MP,攻撃力,防御力,魔法力,魔法防御,敏捷性,運
  130. * @default 1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0
  131. *
  132. * @param 7 : Drop Rate
  133. * @desc 難易度による報酬倍率です。
  134. * 経験値,お金,アイテム1,アイテム2,アイテム3
  135. * @default 1.0,1.0,1.0,1.0,1.0
  136. *
  137. * @param --(ID:8)-------------
  138. *
  139. * @param 8 : Name
  140. * @desc 難易度名です。(使用しない場合は無記入にしてください。)
  141. *
  142. * @param 8 : Param Rate
  143. * @desc 難易度によるステータス倍率です。
  144. * 最大HP,最大MP,攻撃力,防御力,魔法力,魔法防御,敏捷性,運
  145. * @default 1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0
  146. *
  147. * @param 8 : Drop Rate
  148. * @desc 難易度による報酬倍率です。
  149. * 経験値,お金,アイテム1,アイテム2,アイテム3
  150. * @default 1.0,1.0,1.0,1.0,1.0
  151. *
  152. * @help
  153. *
  154. * プラグインコマンド:
  155. *    Difficulty SetID 難易度ID     # 難易度IDを変更する
  156. *    Difficulty Next              # 難易度IDを上げる
  157. *    Difficulty Previous          # 難易度IDを下げる
  158. */

  159. // ● プラグインの設定値を取得
  160. (function($) {
  161.     $.parameters = PluginManager.parameters('Vitsuno_Difficulty');
  162.     $.initDifficultyId = Number($.parameters['Init Difficulty ID']) || 2;
  163.     $.useOption = Number($.parameters['Use Option']) === 1;
  164.     $.optionName = $.parameters['Option Name'];
  165.     $.data = [];
  166.     $.data[0] = null;
  167.    
  168.     // ● セットアップ用の一時関数
  169.     var setup = function(id) {
  170.         // 設定値の取得
  171.         var idText = '%1 : '.format(id);
  172.         var nameData = $.parameters[idText + 'Name'] || '';
  173.         var paramData = $.parameters[idText + 'Param Rate'];
  174.         var dropData = $.parameters[idText + 'Drop Rate'];
  175.         if (nameData === '' || paramData === undefined || dropData === undefined) {
  176.             return false;
  177.         }
  178.         // データの準備
  179.         var paramRate = paramData ? paramData.split(',').map(Number) : [];
  180.         var dropRate = dropData ? dropData.split(',').map(Number) : [];
  181.         var getRate = function(rate) {
  182.             return typeof rate === 'number' ? rate : 1.0;
  183.         };
  184.         // 難易度オブジェクトの作成
  185.         var difficulty = {};
  186.         difficulty.name = nameData;
  187.         difficulty.paramRate = [];
  188.         for (var i = 0; i < 8; i++) {
  189.             difficulty.paramRate[i] = getRate(paramRate[i]);
  190.         }
  191.         difficulty.expRate = getRate(dropRate[0]);
  192.         difficulty.goldRate = getRate(dropRate[1]);
  193.         difficulty.dropItemRate = [];
  194.         for (var i = 0;; i++) {
  195.             if (typeof dropRate[i + 2] === 'number' || i < 3) {
  196.                 difficulty.dropItemRate[i] = getRate(dropRate[i + 2]);
  197.             } else {
  198.                 break;
  199.             }
  200.         }
  201.         $.data[id] = difficulty;
  202.         return true;
  203.     };
  204.    
  205.     for (var i = 1;; i++) {
  206.         if (!setup(i)) {
  207.             break;
  208.         }
  209.     }
  210.    
  211. })(Vitsuno.Difficulty);

  212. //-----------------------------------------------------------------------------
  213. // DataManager
  214. //-----------------------------------------------------------------------------

  215. // ● ニューゲームのセットアップ
  216. Vitsuno.Difficulty.DataMgr_setupNewGame = DataManager.setupNewGame;
  217. DataManager.setupNewGame = function() {
  218.     Vitsuno.Difficulty.DataMgr_setupNewGame.call(this);
  219.     SceneManager.setDifficultyMutable();
  220. };

  221. // ● 戦闘テストのセットアップ
  222. Vitsuno.Difficulty.DataMgr_setupBattleTest = DataManager.setupBattleTest;
  223. DataManager.setupBattleTest = function() {
  224.     Vitsuno.Difficulty.DataMgr_setupBattleTest.call(this);
  225.     SceneManager.setDifficultyMutable();
  226. };

  227. // ● イベントテストのセットアップ
  228. Vitsuno.Difficulty.DataMgr_setupEventTest = DataManager.setupEventTest
  229. DataManager.setupEventTest = function() {
  230.     Vitsuno.Difficulty.DataMgr_setupEventTest.call(this);
  231.     SceneManager.setDifficultyMutable();
  232. };

  233. // ● ゲームのロード
  234. Vitsuno.Difficulty.DataMgr_loadGame = DataManager.loadGame;
  235. DataManager.loadGame = function(savefileId) {
  236.     var result = Vitsuno.Difficulty.DataMgr_loadGame.call(this, savefileId);
  237.     if (result) {
  238.         SceneManager.setDifficultyMutable();
  239.     }
  240.     return result;
  241. };

  242. //-----------------------------------------------------------------------------
  243. // TextManager
  244. //-----------------------------------------------------------------------------

  245. // ● 難易度表示名を取得
  246. Object.defineProperty(TextManager, 'difficulty', {
  247.     get: function() { return Vitsuno.Difficulty.optionName; },
  248.     configurable: true
  249. });

  250. //-----------------------------------------------------------------------------
  251. // SceneManager
  252. //-----------------------------------------------------------------------------

  253. // ● クラス変数
  254. SceneManager._isDifficultyMutable = false;

  255. // ● 難易度変更可能判定
  256. SceneManager.isDifficultyMutable = function() {
  257.     return SceneManager._isDifficultyMutable;
  258. };

  259. // ● 難易度変更可能に設定
  260. SceneManager.setDifficultyMutable = function() {
  261.     SceneManager._isDifficultyMutable = true;
  262. };

  263. // ● 難易度変更可能設定を削除
  264. SceneManager.removeDifficultyMutable = function() {
  265.     SceneManager._isDifficultyMutable = false;
  266. };

  267. //-----------------------------------------------------------------------------
  268. // Game_System
  269. //-----------------------------------------------------------------------------

  270. // ● 初期化
  271. Vitsuno.Difficulty.GSystem_initialize = Game_System.prototype.initialize;
  272. Game_System.prototype.initialize = function() {
  273.     Vitsuno.Difficulty.GSystem_initialize.call(this);
  274.     this._difficultyId = Vitsuno.Difficulty.initDifficultyId;
  275. };

  276. // ● 難易度IDの取得
  277. Game_System.prototype.difficultyId = function() {
  278.     if (this._difficultyId === undefined) {
  279.         this._difficultyId = Vitsuno.Difficulty.initDifficultyId;
  280.     }
  281.     return this._difficultyId;
  282. };

  283. // ● 難易度IDの設定
  284. Game_System.prototype.setDifficultyId = function(difficultyId) {
  285.     if (Vitsuno.Difficulty.data[difficultyId]) {
  286.         this._difficultyId = difficultyId;
  287.     }
  288. };

  289. // ● 難易度の設定
  290. Game_System.prototype.setDifficulty = function(difficulty) {
  291.     var id = Vitsuno.Difficulty.data.indexOf(difficulty);
  292.     if (id >= 0) {
  293.         this.setDifficultyId(id);
  294.     }
  295. };

  296. // ● 難易度オブジェクトの取得
  297. Game_System.prototype.difficultyObject = function() {
  298.     return Vitsuno.Difficulty.data[this.difficultyId()];
  299. };

  300. // ● 難易度名の取得
  301. Game_System.prototype.difficultyName = function() {
  302.     var difficulty = this.difficultyObject();
  303.     return difficulty ? difficulty.name : '';
  304. };

  305. // ● 難易度オブジェクト配列の取得
  306. Game_System.prototype.difficulties = function() {
  307.     return Vitsuno.Difficulty.data.filter(function(difficulty) {
  308.         return difficulty;
  309.     });
  310. };

  311. // ● 次の難易度に変更
  312. Game_System.prototype.nextDifficulty = function(wrap) {
  313.     var lastDifficulty = this.difficultyObject();
  314.     var difficulties = this.difficulties();
  315.     var index = difficulties.indexOf(lastDifficulty);
  316.     index = index < 0 ? 0 : index + 1;
  317.     index = wrap ? index % difficulties.length : index;
  318.     if (index >= 0 && index < difficulties.length) {
  319.         this.setDifficulty(difficulties[index]);
  320.     }
  321.     return lastDifficulty !== this.difficultyObject();
  322. };

  323. // ● 前の難易度に変更する
  324. Game_System.prototype.previousDifficulty = function(wrap) {
  325.     var lastDifficulty = this.difficultyObject();
  326.     var difficulties = this.difficulties();
  327.     var index = difficulties.indexOf(lastDifficulty);
  328.     index = index < 0 ? 0 : index - 1;
  329.     index = wrap ? index % difficulties.length : index;
  330.     if (index >= 0 && index < difficulties.length) {
  331.         this.setDifficulty(difficulties[index]);
  332.     }
  333.     return lastDifficulty !== this.difficultyObject();
  334. };

  335. //-----------------------------------------------------------------------------
  336. // Game_Enemy
  337. //-----------------------------------------------------------------------------

  338. // ● 能力値倍率の取得
  339. Vitsuno.Difficulty.GEnemy_paramRate = Game_Enemy.prototype.paramRate;
  340. Game_Enemy.prototype.paramRate = function(paramId) {
  341.     var rate = Vitsuno.Difficulty.GEnemy_paramRate ?
  342.         Vitsuno.Difficulty.GEnemy_paramRate.call(this, paramId) :
  343.         Game_Battler.prototype.paramRate.call(this, paramId);
  344.     var difficulty = $gameSystem.difficultyObject();
  345.     if (difficulty) {
  346.         rate *= difficulty.paramRate[paramId];
  347.     }
  348.     return rate;
  349. };

  350. // ● 経験値の取得
  351. Vitsuno.Difficulty.GEnemy_exp = Game_Enemy.prototype.exp;
  352. Game_Enemy.prototype.exp = function() {
  353.     var exp = Vitsuno.Difficulty.GEnemy_exp.call(this);
  354.     var difficulty = $gameSystem.difficultyObject();
  355.     if (difficulty) {
  356.         exp *= difficulty.expRate;
  357.     }
  358.     return Math.floor(exp);
  359. };

  360. // ● お金の取得
  361. Vitsuno.Difficulty.GEnemy_gold = Game_Enemy.prototype.gold;
  362. Game_Enemy.prototype.gold = function() {
  363.     var gold = Vitsuno.Difficulty.GEnemy_gold.call(this);
  364.     var difficulty = $gameSystem.difficultyObject();
  365.     if (difficulty) {
  366.         gold *= difficulty.goldRate;
  367.     }
  368.     return Math.floor(gold);
  369. };

  370. // ● ドロップアイテムの作成 (再定義)
  371. Game_Enemy.prototype.makeDropItems = function() {
  372.     return this.enemy().dropItems.reduce(function(r, di, i) {
  373.         if (di.kind > 0 && Math.random() * di.denominator < this.dropItemRateFromIndex(i)) {
  374.             return r.concat(this.itemObject(di.kind, di.dataId));
  375.         } else {
  376.             return r;
  377.         }
  378.     }.bind(this), []);
  379. };

  380. // ● インデック付きドロップアイテムレートの取得
  381. Game_Enemy.prototype.dropItemRateFromIndex = function(index) {
  382.     var rate = this.dropItemRate();
  383.     var difficulty = $gameSystem.difficultyObject();
  384.     if (difficulty) {
  385.         rate *= difficulty.dropItemRate[index];
  386.     }
  387.     return rate;
  388. };

  389. //-----------------------------------------------------------------------------
  390. // Game_Interpreter
  391. //-----------------------------------------------------------------------------

  392. // ● プラグインコマンドの実行
  393. Vitsuno.Difficulty.GInterpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
  394. Game_Interpreter.prototype.pluginCommand = function(command, args) {
  395.     Vitsuno.Difficulty.GInterpreter_pluginCommand.call(this, command, args);
  396.     if (command === 'Difficulty') {
  397.         switch (args[0]) {
  398.             case 'SetID':
  399.                 $gameSystem.setDifficultyId(Number(args[1]));
  400.                 break;
  401.             case 'Next':
  402.                 $gameSystem.nextDifficulty(false);
  403.                 break;
  404.             case 'Previous':
  405.                 $gameSystem.previousDifficulty(false);
  406.                 break;
  407.         }
  408.     }
  409. };

  410. //-----------------------------------------------------------------------------
  411. // Window_Options
  412. //-----------------------------------------------------------------------------

  413. // ● コマンドリストの作成
  414. Vitsuno.Difficulty.WOptions_makeCommandList = Window_Options.prototype.makeCommandList;
  415. Window_Options.prototype.makeCommandList = function() {
  416.     Vitsuno.Difficulty.WOptions_makeCommandList.call(this);
  417.     this.addDifficultyOptions();
  418. };

  419. // ● 難易度を表示するか判定
  420. Window_Options.prototype.isDifficultyDisplayed = function() {
  421.     return Vitsuno.Difficulty.useOption;
  422. };

  423. // ● 難易度が有効かどうか
  424. Window_Options.prototype.isDifficultyEnabled = function() {
  425.     return $gameSystem && SceneManager.isDifficultyMutable();
  426. };

  427. // ● 難易度コマンドの追加
  428. Window_Options.prototype.addDifficultyOptions = function() {
  429.     if (this.isDifficultyDisplayed()) {
  430.         var enabled = this.isDifficultyEnabled();
  431.         this.addCommand(TextManager.difficulty, 'difficulty', enabled);
  432.     }
  433. };

  434. // ● 状態文字の取得
  435. Vitsuno.Difficulty.WOptions_statusText = Window_Options.prototype.statusText;
  436. Window_Options.prototype.statusText = function(index) {
  437.     if (this.commandSymbol(index) === 'difficulty') {
  438.         return this.isDifficultyEnabled() ? $gameSystem.difficultyName() : '';
  439.     } else {
  440.         return Vitsuno.Difficulty.WOptions_statusText.call(this, index);
  441.     }
  442. };

  443. // ● 決定時の処理
  444. Vitsuno.Difficulty.WOptions_processOk = Window_Options.prototype.processOk;
  445. Window_Options.prototype.processOk = function() {
  446.     if (this.commandSymbol(this.index()) === 'difficulty') {
  447.         if (this.isDifficultyEnabled()) {
  448.             if ($gameSystem.nextDifficulty(true)) {
  449.                 this.redrawItem(this.findSymbol('difficulty'));
  450.                 SoundManager.playCursor();
  451.             }
  452.         }
  453.     } else {
  454.         Vitsuno.Difficulty.WOptions_processOk.call(this);
  455.     }
  456. };

  457. // ● カーソルを右に移動
  458. Vitsuno.Difficulty.WOptions_cursorRight = Window_Options.prototype.cursorRight;
  459. Window_Options.prototype.cursorRight = function(wrap) {
  460.     if (this.commandSymbol(this.index()) === 'difficulty') {
  461.         if (this.isDifficultyEnabled()) {
  462.             if ($gameSystem.nextDifficulty(false)) {
  463.                 this.redrawItem(this.findSymbol('difficulty'));
  464.                 SoundManager.playCursor();
  465.             }
  466.         }
  467.     } else {
  468.         Vitsuno.Difficulty.WOptions_cursorRight.call(this, wrap);
  469.     }
  470. };

  471. // ● カーソルを左に移動
  472. Vitsuno.Difficulty.WOptions_cursorLeft = Window_Options.prototype.cursorLeft;
  473. Window_Options.prototype.cursorLeft = function(wrap) {
  474.     if (this.commandSymbol(this.index()) === 'difficulty') {
  475.         if (this.isDifficultyEnabled()) {
  476.             if ($gameSystem.previousDifficulty(false)) {
  477.                 this.redrawItem(this.findSymbol('difficulty'));
  478.                 SoundManager.playCursor();
  479.             }
  480.         }
  481.     } else {
  482.         Vitsuno.Difficulty.WOptions_cursorLeft.call(this, wrap);
  483.     }
  484. };

  485. //-----------------------------------------------------------------------------
  486. // Scene_Title
  487. //-----------------------------------------------------------------------------

  488. // ● シーン開始
  489. Vitsuno.Difficulty.STitle_start = Scene_Title.prototype.start;
  490. Scene_Title.prototype.start = function() {
  491.     Vitsuno.Difficulty.STitle_start.call(this);
  492.     SceneManager.removeDifficultyMutable();
  493. };
复制代码

点评

第二個比較接近你的要求  发表于 2016-12-24 16:22
回复 1 0

使用道具 举报

梦石
2
星屑
1239
在线时间
355 小时
注册时间
2014-9-27
回帖
98
 楼主| 发表于 2016-12-24 17:23:29 | 显示全部楼层
tseyik 发表于 2016-12-24 16:21
https://raw.githubusercontent.com/triacontane/RPGMakerMV/master/DifficultyExtend.js

叧一個

多谢大佬,问题成功解决了{:2_249:}
回复

使用道具 举报

梦石
0
星屑
4221
在线时间
1104 小时
注册时间
2008-5-17
回帖
199

开拓者

发表于 2018-6-3 20:06:58 | 显示全部楼层
tseyik 发表于 2016-12-24 16:21
https://raw.githubusercontent.com/triacontane/RPGMakerMV/master/DifficultyExtend.js

叧一個

亲,这个难度插件要怎么才能生效??
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部