查看: 3056|回复: 0

[已经过期] 哪个大神帮忙修改一下这个插件~

[复制链接]
梦石
0
星屑
3662
在线时间
1133 小时
注册时间
2017-4-6
回帖
229

开拓者

发表于 2017-7-15 14:11:31 | 显示全部楼层 |阅读模式

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

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

×
出处:https://www6.atwiki.jp/pokotan/pages/3.html
这个插件实用性很大,可以查看敌我buff的详细说明,窗口会随着buff数量增宽或变窄,但是比较尴尬的就是窗口不会随着名字的长短而变化,只会压缩名字的宽度,因为敌人有些有前后词缀,比较长,所以太影响美观,有没有大神愿意帮忙修改一下呢,窗口也会根据名字长短而变化,谢谢!


12314321243.JPG



  1. //
  2. //  ステートヘルプ ver1.03
  3. //
  4. // ------------------------------------------------------
  5. // Copyright (c) 2016 Yana
  6. // Released under the MIT license
  7. // [url]http://opensource.org/licenses/mit-license.php[/url]
  8. // ------------------------------------------------------
  9. //
  10. // author Yana
  11. //

  12. var Imported = Imported || {};
  13. Imported['StateHelp'] = 1.03;

  14. /*:
  15. * @plugindesc ver1.03/ステートにヘルプを付け、ステートの詳細を見るための仕組みを追加します。
  16. * @author Yana
  17. *
  18. * @param State Help Text
  19. * @desc 戦闘時、パーティコマンドに追加するステートヘルプの名称です。
  20. * ここを空白にすると、ステートヘルプが追加されなくなります。
  21. * @default ステート詳細
  22. *
  23. * @param Call State Window Key
  24. * @desc ステートヘルプを呼び出すためのショートカットキーです。
  25. * ここを空白にすると、ショートカットが無効になります。
  26. * @default left
  27. *
  28. * @param Use Touch Call
  29. * @desc 画面の左端をクリックするすることでステートヘルプを呼び出せるようにするかの設定です。
  30. * @default true
  31. *
  32. * @param Add Menu State Help
  33. * @desc メニュー画面にステートヘルプを追加するかの設定です。
  34. * @default true
  35. *
  36. * @param Touch Call Rect
  37. * @desc タッチすることで起動する領域の矩形位置です。
  38. * @default 0,0,128,444
  39. *
  40. * @param Debuff Help HP1
  41. * @desc 最大HP1段階減少のデバフのヘルプです。
  42. * @default 最大HPが25%減少します。
  43. *
  44. * @param Debuff Help HP2
  45. * @desc 最大HP2段階減少のデバフのヘルプです。
  46. * @default 最大HPが50%減少します。
  47. *
  48. * @param Debuff Help MP1
  49. * @desc 最大MP1段階減少のデバフのヘルプです。
  50. * @default 最大HPが25%減少します。
  51. *
  52. * @param Debuff Help HP2
  53. * @desc 最大MP2段階減少のデバフのヘルプです。
  54. * @default 最大MPが50%減少します。
  55. *
  56. * @param Debuff Help ATK1
  57. * @desc 攻撃力1段階減少のデバフのヘルプです。
  58. * @default 攻撃力が25%減少します。
  59. *
  60. * @param Debuff Help ATK2
  61. * @desc 攻撃力2段階減少のデバフのヘルプです。
  62. * @default 攻撃力がが50%減少します。
  63. *
  64. * @param Debuff Help DEF1
  65. * @desc 防御力1段階減少のデバフのヘルプです。
  66. * @default 防御力が25%減少します。
  67. *
  68. * @param Debuff Help DEF2
  69. * @desc 防御力2段階減少のデバフのヘルプです。
  70. * @default 防御力が50%減少します。
  71. *
  72. * @param Debuff Help MAT1
  73. * @desc 魔法力1段階減少のデバフのヘルプです。
  74. * @default 魔法力が25%減少します。
  75. *
  76. * @param Debuff Help MAT2
  77. * @desc 魔法力1段階減少のデバフのヘルプです。
  78. * @default 魔法力が50%減少します。
  79. *
  80. * @param Debuff Help MDF1
  81. * @desc 魔法防御1段階減少のデバフのヘルプです。
  82. * @default 魔法防御が25%減少します。
  83. *
  84. * @param Debuff Help MDF2
  85. * @desc 魔法防御2段階減少のデバフのヘルプです。
  86. * @default 魔法防御が50%減少します。
  87. *
  88. * @param Debuff Help AGI1
  89. * @desc 敏捷性1段階減少のデバフのヘルプです。
  90. * @default 敏捷性が25%減少します。
  91. *
  92. * @param Debuff Help AGI2
  93. * @desc 敏捷性2段階減少のデバフのヘルプです。
  94. * @default 敏捷性が50%減少します。
  95. *
  96. * @param Debuff Help LUK1
  97. * @desc 運1段階減少のデバフのヘルプです。
  98. * @default 運が25%減少します。
  99. *
  100. * @param Debuff Help LUK2
  101. * @desc 運2段階減少のデバフのヘルプです。
  102. * @default 運が50%減少します。
  103. *
  104. * @param Buff Help HP1
  105. * @desc 最大HP1段階上昇のデバフのヘルプです。
  106. * @default 最大HPが25%上昇します。
  107. *
  108. * @param Buff Help HP2
  109. * @desc 最大HP2段階上昇のデバフのヘルプです。
  110. * @default 最大HPが50%上昇します。
  111. *
  112. * @param Buff Help MP1
  113. * @desc 最大MP1段階上昇のデバフのヘルプです。
  114. * @default 最大HPが25%上昇します。
  115. *
  116. * @param Buff Help HP2
  117. * @desc 最大MP2段階上昇のデバフのヘルプです。
  118. * @default 最大MPが50%上昇します。
  119. *
  120. * @param Buff Help ATK1
  121. * @desc 攻撃力1段階上昇のデバフのヘルプです。
  122. * @default 攻撃力が25%上昇します。
  123. *
  124. * @param Buff Help ATK2
  125. * @desc 攻撃力2段階上昇のデバフのヘルプです。
  126. * @default 攻撃力がが50%上昇します。
  127. *
  128. * @param Buff Help DEF1
  129. * @desc 防御力1段階上昇のデバフのヘルプです。
  130. * @default 防御力が25%上昇します。
  131. *
  132. * @param Buff Help DEF2
  133. * @desc 防御力2段階上昇のデバフのヘルプです。
  134. * @default 防御力が50%上昇します。
  135. *
  136. * @param Buff Help MAT1
  137. * @desc 魔法力1段階上昇のデバフのヘルプです。
  138. * @default 魔法力が25%上昇します。
  139. *
  140. * @param Buff Help MAT2
  141. * @desc 魔法力1段階上昇のデバフのヘルプです。
  142. * @default 魔法力が50%上昇します。
  143. *
  144. * @param Buff Help MDF1
  145. * @desc 魔法防御1段階上昇のデバフのヘルプです。
  146. * @default 魔法防御が25%上昇します。
  147. *
  148. * @param Buff Help MDF2
  149. * @desc 魔法防御2段階上昇のデバフのヘルプです。
  150. * @default 魔法防御が50%上昇します。
  151. *
  152. * @param Buff Help AGI1
  153. * @desc 敏捷性1段階上昇のデバフのヘルプです。
  154. * @default 敏捷性が25%上昇します。
  155. *
  156. * @param Buff Help AGI2
  157. * @desc 敏捷性2段階上昇のデバフのヘルプです。
  158. * @default 敏捷性が50%上昇します。
  159. *
  160. * @param Buff Help LUK1
  161. * @desc 運1段階上昇のデバフのヘルプです。
  162. * @default 運が25%上昇します。
  163. *
  164. * @param Buff Help LUK2
  165. * @desc 運2段階上昇のデバフのヘルプです。
  166. * @default 運が50%上昇します。
  167. *
  168. * @help------------------------------------------------------
  169. *  プラグインコマンドはありません。
  170. * ------------------------------------------------------
  171. * ------------------------------------------------------
  172. * 設定方法
  173. * ------------------------------------------------------
  174. *
  175. * ステートのメモ欄に
  176. *
  177. * <ステートヘルプ>
  178. * ステートの解説
  179. * </ステートヘルプ>
  180. *
  181. * または、
  182. *
  183. * <STATE_HELP>
  184. * ステートの解説
  185. * </STATE_HELP>
  186. *
  187. * と記述することで、そのステートに説明を設定することができます。
  188. *
  189. * ------------------------------------------------------
  190. * 仕様
  191. * ------------------------------------------------------
  192. *
  193. * 戦闘中、アクターコマンドまたはパーティコマンドがアクティブな状態で、画面の左側をクリックすることで、
  194. * ステートヘルプウィンドウを呼び出すことができます。
  195. * この設定は、UseTouchCallをfalseにすることで無効化できます。
  196. *
  197. * ステートヘルプウィンドウは、ステートヘルプウィンドウ以外の領域をクリックすることでも、閉じることができます。
  198. *
  199. * ------------------------------------------------------
  200. * 利用規約
  201. * ------------------------------------------------------
  202. * 当プラグインはMITライセンスで公開されています。
  203. * 使用に制限はありません。商用、アダルト、いずれにも使用できます。
  204. * 二次配布も制限はしませんが、サポートは行いません。
  205. * 著作表示は任意です。行わなくても利用できます。
  206. * 要するに、特に規約はありません。
  207. * バグ報告や使用方法等のお問合せはネ実ツクールスレ、または、Twitterにお願いします。
  208. * [url]https://twitter.com/yanatsuki_[/url]
  209. * 素材利用は自己責任でお願いします。
  210. * ------------------------------------------------------
  211. * 更新履歴:
  212. * ver1.03:
  213. * 利用規約をMITライセンスに変更
  214. * メニューで呼び出した際にエネミーが表示されるバグを修正
  215. * ver1.02:
  216. * YEP_X_BattleSysATBと競合しないように処理を修正
  217. * ver1.01:
  218. * 隠れているエネミーが表示されていたバグを修正
  219. * ver1.00:
  220. * 公開
  221. */

  222. (function(){
  223.    
  224.     var parameters = PluginManager.parameters('StateHelp');
  225.     var stateHelpText = String(parameters['State Help Text']);
  226.     var callStateWindowKey = String(parameters['Call State Window Key']);
  227.     var useTouchCall = String(parameters['Use Touch Call']) === 'true';
  228.     var addMenuStateHelp = String(parameters['Add Menu State Help']) === 'true';
  229.     var touchCallRect = String(parameters['Touch Call Rect'] || '0,0,128,444');
  230.     var buffHelp = [
  231.         String(parameters['Debuff Help HP2'] || '最大HPが50%減少します。'),
  232.         String(parameters['Debuff Help HP1'] || '最大HPが25%減少します。'),
  233.         String(parameters['Buff Help HP1'] || '最大HPが25%上昇します。'),
  234.         String(parameters['Buff Help HP2'] || '最大HPが50%上昇します。'),
  235.         String(parameters['Debuff Help MP2'] || '最大MPが50%減少します。'),
  236.         String(parameters['Debuff Help MP1'] || '最大MPが25%減少します。'),
  237.         String(parameters['Buff Help MP1'] || '最大MPが25%上昇します。'),
  238.         String(parameters['Buff Help MP2'] || '最大MPが50%上昇します。'),
  239.         String(parameters['Debuff Help ATK2'] || '攻撃力が50%減少します。'),
  240.         String(parameters['Debuff Help ATK1'] || '攻撃力が25%減少します。'),
  241.         String(parameters['Buff Help ATK1'] || '攻撃力が25%上昇します。'),
  242.         String(parameters['Buff Help ATK2'] || '攻撃力が50%上昇します。'),
  243.         String(parameters['Debuff Help DEF2'] || '防御力が50%減少します。'),
  244.         String(parameters['Debuff Help DEF1'] || '防御力が25%減少します。'),
  245.         String(parameters['Buff Help DEF1'] || '防御力が25%上昇します。'),
  246.         String(parameters['Buff Help DEF2'] || '防御力が50%上昇します。'),
  247.         String(parameters['Debuff Help MAT2'] || '魔法力が50%減少します。'),
  248.         String(parameters['Debuff Help MAT1'] || '魔法力が25%減少します。'),
  249.         String(parameters['Buff Help MAT1'] || '魔法力が25%上昇します。'),
  250.         String(parameters['Buff Help MAT2'] || '魔法力が50%上昇します。'),
  251.         String(parameters['Debuff Help MDF2'] || '魔法防御が50%減少します。'),
  252.         String(parameters['Debuff Help MDF1'] || '魔法防御が25%減少します。'),
  253.         String(parameters['Buff Help MDF1'] || '魔法防御が25%上昇します。'),
  254.         String(parameters['Buff Help MDF2'] || '魔法防御が50%上昇します。'),
  255.         String(parameters['Debuff Help AGI2'] || '敏捷性が50%減少します。'),
  256.         String(parameters['Debuff Help AGI1'] || '敏捷性が25%減少します。'),
  257.         String(parameters['Buff Help AGI1'] || '敏捷性が25%上昇します。'),
  258.         String(parameters['Buff Help AGI2'] || '敏捷性が50%上昇します。'),
  259.         String(parameters['Debuff Help LUK2'] || '運が50%減少します。'),
  260.         String(parameters['Debuff Help LUK1'] || '運が25%減少します。'),
  261.         String(parameters['Buff Help LUK1'] || '運が25%上昇します。'),
  262.         String(parameters['Buff Help LUK2'] || '運が50%上昇します。')
  263.     ]
  264.    
  265.     function Window_StateHelp() {
  266.         this.initialize.apply(this, arguments);
  267.     }

  268.     Window_StateHelp.prototype = Object.create(Window_Selectable.prototype);
  269.     Window_StateHelp.prototype.constructor = Window_StateHelp;

  270.     Window_StateHelp.prototype.initialize = function() {
  271.         this._posY = 120;
  272.         var width = this.windowWidth();
  273.         var height = this.windowHeight();
  274.         var x = (Graphics.boxWidth - width) / 2;
  275.         var y = this.posY();
  276.         this._topCol = 0;
  277.         Window_Selectable.prototype.initialize.call(this, x, y, width, height);
  278.         this.refresh();
  279.         this.openness = 0;
  280.         this._subIndex = 0;
  281.     };
  282.    
  283.     Window_StateHelp.prototype.posY = function() {
  284.         return this._posY;
  285.     };
  286.    
  287.     Window_StateHelp.prototype.windowWidth = function() {
  288.         return 134 + this.fittingWidth(Math.max(Math.min(this.maxIcons(),this.numVisibleCols()),1));
  289.     };
  290.    
  291.     Window_StateHelp.prototype.numVisibleCols = function() {
  292.         return 16;
  293.     };
  294.    
  295.     Window_StateHelp.prototype.fittingWidth = function(numCols){
  296.         return numCols * this.itemWidth() + this.standardPadding() * 2;
  297.     };

  298.     Window_StateHelp.prototype.windowHeight = function() {
  299.         return this.fittingHeight(this.numVisibleRows());
  300.     };
  301.    
  302.     Window_StateHelp.prototype.fittingHeight = function(numLines) {
  303.         return numLines * this.itemHeight() + this.standardPadding() * 2;
  304.     };

  305.    
  306.     Window_StateHelp.prototype.numVisibleRows = function() {
  307.         return Math.min(this.maxItems(),7);
  308.     };
  309.    
  310.     Window_StateHelp.prototype.maxItems = function() {
  311.         return this.allBattleMembers().length;
  312.     };
  313.    
  314.     Window_StateHelp.prototype.allBattleMembers = function() {
  315.         var members = [];
  316.         if ($gameParty.inBattle()){
  317.             members = BattleManager.allBattleMembers().filter(function(obj){ return obj.isAppeared() });
  318.         } else {
  319.             members = $gameParty.members();
  320.         }
  321.         return members;
  322.     };
  323.    
  324.     Window_StateHelp.prototype.maxPageRows = function() {
  325.         return Math.min(this.maxItems(), 7);
  326.     };
  327.    
  328.     Window_StateHelp.prototype.itemWidth = function() {
  329.         return 40;
  330.     };
  331.    
  332.     Window_StateHelp.prototype.itemHeight = function() {
  333.         return 40;
  334.     };
  335.    
  336.     Window_StateHelp.prototype.maxIcons = function() {
  337.         var n = 0;
  338.         for(var i=0;i<this.maxItems();i++){
  339.             var chr = BattleManager.allBattleMembers()[i];
  340.             if (n < chr.allIcons().length) { n = chr.allIcons().length }
  341.         }
  342.         return n;
  343.     };
  344.    
  345.     Window_StateHelp.prototype.maxColItems = function() {
  346.         return this.maxColIndex(this.index());
  347.     };
  348.    
  349.     Window_StateHelp.prototype.maxColIndex = function(index) {
  350.         var character = BattleManager.allBattleMembers()[index];
  351.         if (!character){ return 1 }
  352.         return Math.max(character.allIcons().length,1);
  353.     };
  354.    
  355.     Window_StateHelp.prototype.maxTopCols = function() {
  356.         return Math.max(this.numVisibleCols - this.maxColIndex(),0);
  357.     };
  358.    
  359.     Window_StateHelp.prototype.colWidth = function(index) {
  360.         return (this.maxColIndex(index)-1) * this.itemWidth();
  361.     };
  362.    
  363.     Window_StateHelp.prototype.adjustWindowSize = function() {
  364.         this.width = this.windowWidth();
  365.         this.height = this.windowHeight();
  366.         this.x = (Graphics.boxWidth - this.width) / 2;
  367.         this.y = this.posY();
  368.     };

  369.     Window_StateHelp.prototype.itemRect = function(index) {
  370.         var rect = Window_Selectable.prototype.itemRect.call(this,index);
  371.         rect.x += 130 + (this.itemWidth() * (this._subIndex - this._topCol));
  372.         return rect;
  373.     };
  374.    
  375.     Window_StateHelp.prototype.updateHelp = function() {
  376.         Window_Selectable.prototype.updateHelp.call(this);
  377.         var character = BattleManager.allBattleMembers()[this.index()];
  378.         if (character){
  379.             var states = character.addedShowStates();
  380.             var buffs = character.addedShowBuffs();
  381.             var text = '';
  382.             if (this._subIndex < states.length){
  383.                 text = DataManager.getStateHelp(states[this._subIndex]);
  384.             } else if (this._subIndex < (states.length + buffs.length)) {
  385.                 var buff = buffs[this._subIndex - states.length];
  386.                 text = DataManager.getBuffHelp(buff);
  387.             }
  388.             this._helpWindow.setText(text);
  389.         } else {
  390.             this._helpWindow.setText('');
  391.         }
  392.     };
  393.    
  394.     Window_StateHelp.prototype.checkTopCol = function() {
  395.         if (this._subIndex >= this.numVisibleCols()){
  396.             this._topCol = this._subIndex - this.numVisibleCols() + 1;
  397.             this.refresh();
  398.         } else if (this._subIndex <= this._topCol){
  399.             this._topCol = this._subIndex;
  400.             this.refresh();
  401.         }
  402.     };
  403.    
  404.     Window_StateHelp.prototype.select = function(index) {
  405.         this.checkTopCol();
  406.         Window_Selectable.prototype.select.call(this,index);
  407.     };
  408.    
  409.     Window_StateHelp.prototype.initSelect = function() {
  410.         this.select(0);
  411.         this._subIndex = 0;
  412.         this._lastSubIndex = this._subIndex;
  413.     };
  414.    
  415.     Window_StateHelp.prototype.cursorRight = function(wrap) {
  416.         this._subIndex = (this._subIndex + 1) % this.maxColItems();
  417.         this.select(this.index());
  418.     };

  419.     Window_StateHelp.prototype.cursorLeft = function(wrap) {
  420.         this._subIndex = (this._subIndex + (this.maxColItems() - 1)) % this.maxColItems();
  421.         this.select(this.index());
  422.     };
  423.    
  424.     Window_StateHelp.prototype.cursorUp = function(wrap) {
  425.         Window_Selectable.prototype.cursorUp.call(this,wrap);
  426.         this._subIndex = Math.min(this._subIndex,this.maxColItems()-1);
  427.         this.select(this.index());
  428.     };
  429.    
  430.     Window_StateHelp.prototype.cursorDown = function(wrap) {
  431.         Window_Selectable.prototype.cursorDown.call(this,wrap);
  432.         this._subIndex = Math.min(this._subIndex,this.maxColItems()-1);
  433.         this.select(this.index());
  434.     };
  435.    
  436.     Window_StateHelp.prototype.processCursorMove = function() {
  437.         Window_Selectable.prototype.processCursorMove.call(this);
  438.         if (this._lastSubIndex !== this._subIndex){
  439.             if (this.active){ SoundManager.playCursor() }
  440.             this._lastSubIndex = this._subIndex;
  441.         }
  442.     };
  443.    
  444.     Window_StateHelp.prototype.scrollRight = function() {
  445.         if (this._topCol + 1 < this.maxTopCols()) {
  446.             this._topCol += 1;
  447.         }
  448.     };

  449.     Window_Selectable.prototype.scrollLeft = function() {
  450.         if (this._topCol > 0) {
  451.             this._topCol -= 1;
  452.         }
  453.     };
  454.    
  455.     Window_StateHelp.prototype.onTouch = function(triggered) {
  456.         var lastIndex = this.index();
  457.         var x = this.canvasToLocalX(TouchInput.x);
  458.         var y = this.canvasToLocalY(TouchInput.y);
  459.         var hitIndex = this.hitTest(x, y);
  460.         if (hitIndex >= 0) {
  461.             if (hitIndex === this.index()) {
  462.                 if (triggered && this.isTouchOkEnabled()) {
  463.                     this.processOk();
  464.                 }
  465.             } else if (this.isCursorMovable()) {
  466.                 this.select(hitIndex);
  467.             }
  468.         } else if (this._stayCount >= 10) {
  469.             if (y < this.padding) {
  470.                 this.cursorUp();
  471.             } else if (y >= this.height - this.padding) {
  472.                 this.cursorDown();
  473.             } else if (x < 132) {
  474.                 this.cursorLeft();
  475.             } else if (x >= this.width - this.padding) {
  476.                 this.cursorRight();
  477.             }
  478.         }
  479.         if (this.index() !== lastIndex) {
  480.             if (this.active){ SoundManager.playCursor() }
  481.         } else if (this._subIndex !== this._lastSubIndex) {
  482.             if (this.active){ SoundManager.playCursor() }
  483.             this._lastSubIndex = this._subIndex;
  484.         }
  485.     };
  486.    
  487.     Window_StateHelp.prototype.hitTest = function(x, y) {
  488.         if (this.isContentsArea(x, y)) {
  489.             var cx = x - this.padding;
  490.             var cy = y - this.padding;
  491.             var topIndex = this.topIndex();
  492.             for (var i = 0; i < this.maxPageItems(); i++) {
  493.                 var index = topIndex + i;
  494.                 if (index < this.maxItems()) {
  495.                     var rect = this.itemRect(index);
  496.                     var left = 132;
  497.                     var right = left + rect.width + this.colWidth(index);
  498.                     var bottom = rect.y + rect.height;
  499.                     if (cx >= left && cy >= rect.y && cx < right && cy < bottom) {
  500.                         this._subIndex = Math.floor((cx - 132) / this.itemWidth()) + this._topCol;
  501.                         this.select(index);
  502.                         return index;
  503.                     }
  504.                 }
  505.             }
  506.         }
  507.         return -1;
  508.     };
  509.    
  510.     Window_StateHelp.prototype.drawItem = function(index) {
  511.         var rect = this.itemRect(index);
  512.         var character = this.allBattleMembers()[index];
  513.         //var rect = this.itemRectForText(index);
  514.         var y = rect.y;
  515.         var x = 0;
  516.         var iw = this.itemWidth();
  517.         var c = Math.min(character.allIcons().length,this.numVisibleCols());
  518.         this.drawText(character.name(),x,y,120);
  519.         this.drawText(':',120,y);
  520.         for (var i=this._topCol;i<(c+this._topCol);i++){
  521.             var ii = i-this._topCol;
  522.             this.drawIcon(character.allIcons()[i],x+iw*ii+134,y+(iw-32)/2);
  523.         }
  524.     };
  525.    
  526.     Window_StateHelp.prototype.refresh = function() {
  527.         this.adjustWindowSize();
  528.         this.createContents();
  529.         Window_Selectable.prototype.refresh.call(this);
  530.     };
  531.    
  532.     ///////////////////////////////////////////////////////////////////////////////////
  533.    
  534.     DataManager.getStateHelp = function(state) {
  535.         if (!state) { return '' }
  536.         if (state.description){ return state.description }
  537.         state.description = '';
  538.         var texts = state.note.split('\n');
  539.         var description = '';
  540.         var start = false;
  541.         for (var i=0;i<texts.length;i++){
  542.             var text = texts[i];
  543.             if (text.match(/^<\/ステートヘルプ>/) || text.match(/^<\/STATE_HELP>/)){
  544.                 start = false;
  545.                 state.description = description;
  546.             } else if (text.match(/^<ステートヘルプ>/)  || text.match(/^<STATE_HELP>/)){
  547.                 start = true;
  548.             } else if (start){
  549.                 description += text + '\n';
  550.             }
  551.         }
  552.         return state.description;
  553.     };
  554.    
  555.     DataManager.getBuffHelp = function(buff) {
  556.         if (!buff){ return '' }
  557.         var n = buff[0]*4+buff[1]+2;
  558.         if (buff[1] > 0){ n -= 1 }
  559.         return buffHelp[n];
  560.     };
  561.    
  562.     ///////////////////////////////////////////////////////////////////////////////////
  563.    
  564.     Game_BattlerBase.prototype.addedShowStates = function() {
  565.         return this.states().map(function(state) {
  566.             return state;
  567.         }).filter(function(state) {
  568.             return state.iconIndex > 0;
  569.         });
  570.     };

  571.     Game_BattlerBase.prototype.addedShowBuffs = function() {
  572.         var result = [];
  573.         for (var i = 0; i < this._buffs.length; i++) {
  574.             if (this._buffs[i] !== 0) {
  575.                 result.push([i,this._buffs[i]]);
  576.             }
  577.         }
  578.         return result;
  579.     };
  580.    
  581.     ///////////////////////////////////////////////////////////////////////////////////
  582.    
  583.     var _sHelp_WPCommand_makeCommandList = Window_PartyCommand.prototype.makeCommandList;
  584.     Window_PartyCommand.prototype.makeCommandList = function() {
  585.         _sHelp_WPCommand_makeCommandList.call(this);
  586.         if (stateHelpText){ this.addCommand(stateHelpText,  'stateHelp') }
  587.     };
  588.    
  589.     ///////////////////////////////////////////////////////////////////////////////////
  590.    
  591.     var _sHelp_SBattle_createDisplayObjects = Scene_Battle.prototype.createDisplayObjects;
  592.     Scene_Battle.prototype.createDisplayObjects = function() {
  593.         _sHelp_SBattle_createDisplayObjects.call(this);
  594.         this.createStateHelpWindow();
  595.         this._windowLayer.removeChild(this._helpWindow);
  596.         this.addWindow(this._helpWindow);
  597.     };
  598.    
  599.     Scene_Battle.prototype.createStateHelpWindow = function() {
  600.         this._stateHelpWindow = new Window_StateHelp();
  601.         this._stateHelpWindow.setHelpWindow(this._helpWindow);
  602.         this._stateHelpWindow.setHandler('cancel', this.cancelStateHelp.bind(this));
  603.         this.addWindow(this._stateHelpWindow);
  604.     };
  605.    
  606.     var _sHelp_SBattle_createPartyCommandWindow = Scene_Battle.prototype.createPartyCommandWindow;
  607.     Scene_Battle.prototype.createPartyCommandWindow = function() {
  608.         _sHelp_SBattle_createPartyCommandWindow.call(this);
  609.         this._partyCommandWindow.setHandler('stateHelp', this.commandStateHelp.bind(this));
  610.     };
  611.    
  612.     Scene_Battle.prototype.commandStateHelp = function() {
  613.         this._stateHelpWindow.refresh();
  614.         this._stateHelpWindow.initSelect();
  615.         this._stateHelpWindow.activate();
  616.         this._stateHelpWindow.open();
  617.         this._helpWindow.show();
  618.         this._callPhaseWindow = null;
  619.         if (this._partyCommandWindow.isOpen()) this._activedCommand = 1;
  620.         if (this._actorCommandWindow.isOpen()) this._activedCommand = 2;
  621.         this._partyCommandWindow.deactivate();
  622.         this._actorCommandWindow.deactivate();
  623.         BattleManager._phase = 'input';
  624.     };
  625.    
  626.     Scene_Battle.prototype.cancelStateHelp = function() {
  627.         this._stateHelpWindow.deactivate();
  628.         this._stateHelpWindow.close();
  629.         this._helpWindow.hide();
  630.         if (BattleManager.isInputting()){
  631.             if (this._activedCommand === 1){
  632.                 this._partyCommandWindow.activate();
  633.             } else if (this._activedCommand === 2) {
  634.                 this._actorCommandWindow.activate();
  635.             }
  636.             /*
  637.             if (BattleManager.actor()){
  638.                 this._actorCommandWindow.activate();
  639.             }else{
  640.                 this._partyCommandWindow.activate();
  641.             }
  642.             */
  643.         }
  644.     };
  645.    
  646.     var _sHelp_SBattle_changeInputWindow = Scene_Battle.prototype.changeInputWindow;
  647.     Scene_Battle.prototype.changeInputWindow = function() {
  648.         if(!this._stateHelpWindow.active){
  649.             _sHelp_SBattle_changeInputWindow.call(this);
  650.         }
  651.     };
  652.    
  653.     var _sHelp_SBattle_update = Scene_Battle.prototype.update;
  654.     Scene_Battle.prototype.update = function() {
  655.         _sHelp_SBattle_update.call(this);
  656.         if (this._actorCommandWindow.active || this._partyCommandWindow.active) {
  657.             if (Input.isTriggered(callStateWindowKey) || this.onTouchCallStateHelp()){
  658.                 SoundManager.playOk();
  659.                 this.commandStateHelp();
  660.             }
  661.         } else if (this._stateHelpWindow.active) {
  662.             if (this.onTouchCancelStateHelp()){
  663.                 SoundManager.playCancel();
  664.                 this.cancelStateHelp();
  665.             }
  666.         }
  667.     };
  668.    
  669.     Scene_Battle.prototype.onTouchCallStateHelp = function() {
  670.         if (!useTouchCall){ return false }
  671.         if (TouchInput.isTriggered()){
  672.             var touchPos = touchCallRect.split(',');
  673.             var x = TouchInput.x;
  674.             var y = TouchInput.y;
  675.             var ax = Number(touchPos[0]);
  676.             var xw = ax + Number(touchPos[2]);
  677.             var ay = Number(touchPos[1]);
  678.             var yh = ay + Number(touchPos[3]);
  679.             return x >= ax && x <= xw && y >= ay && y <= yh;
  680.         }
  681.         return false;
  682.     };
  683.    
  684.     Scene_Battle.prototype.onTouchCancelStateHelp = function() {
  685.         if (TouchInput.isTriggered()){
  686.             var x = TouchInput.x;
  687.             var y = TouchInput.y;
  688.             var ax = this._stateHelpWindow.x;
  689.             var xw = ax + this._stateHelpWindow.width;
  690.             var ay = this._stateHelpWindow.y;
  691.             var yh = ay + this._stateHelpWindow.height;
  692.             return !(x >= ax && x <= xw && y >= ay && y <= yh);
  693.         }
  694.         return false;
  695.     };
  696.     ////////////////////////////////////////////////////////////////////////////////////   

  697.     var _sHelp_WMCommand_addOriginalCommands = Window_MenuCommand.prototype.addOriginalCommands;
  698.     Window_MenuCommand.prototype.addOriginalCommands = function() {
  699.         _sHelp_WMCommand_addOriginalCommands.call(this);
  700.         if (stateHelpText && addMenuStateHelp){ this.addCommand(stateHelpText, 'stateHelp', true) }
  701.     };
  702.    
  703.     ///////////////////////////////////////////////////////////////////////////////////
  704.    
  705.     var _sHelp_SMenu_createCommandWindow = Scene_Menu.prototype.createCommandWindow;
  706.     Scene_Menu.prototype.createCommandWindow = function() {
  707.         _sHelp_SMenu_createCommandWindow.call(this);
  708.         this._commandWindow.setHandler('stateHelp',   this.commandStateHelp.bind(this));
  709.     };
  710.    
  711.     Scene_Menu.prototype.commandStateHelp = function() {
  712.         SceneManager.push(Scene_StateHelp);
  713.     };
  714.    
  715.     ///////////////////////////////////////////////////////////////////////////////////
  716.    
  717.    
  718.     function Scene_StateHelp() {
  719.         this.initialize.apply(this, arguments);
  720.     };
  721.    
  722.     Scene_StateHelp.prototype = Object.create(Scene_MenuBase.prototype);
  723.     Scene_StateHelp.prototype.constructor = Scene_StateHelp;

  724.     Scene_StateHelp.prototype.create = function() {
  725.         Scene_MenuBase.prototype.create.call(this);
  726.         this.createAllWindows();
  727.     };
  728.    
  729.     Scene_StateHelp.prototype.createAllWindows = function() {
  730.         this.createHelpWindow();
  731.         this.createStateHelpWindow();
  732.     };
  733.    
  734.     Scene_StateHelp.prototype.createStateHelpWindow = function() {
  735.         this._stateHelpWindow = new Window_StateHelp();
  736.         this._stateHelpWindow.setHelpWindow(this._helpWindow);
  737.         this._stateHelpWindow.setHandler('cancel', this.returnScene.bind(this));
  738.         this._stateHelpWindow.show();
  739.         this._stateHelpWindow.openness = 255;
  740.         this._stateHelpWindow.initSelect();
  741.         this._stateHelpWindow.activate();
  742.         this._stateHelpWindow.y = (Graphics.boxHeight - this._helpWindow.height) / 2 - (this._stateHelpWindow.height / 2) + this._helpWindow.height;
  743.         this._stateHelpWindow._posY = this._stateHelpWindow.y;
  744.         this.addWindow(this._stateHelpWindow);
  745.     };
  746.    
  747.     Scene_StateHelp.prototype.returnScene = function() {
  748.         this.popScene(this);
  749.     };
  750.    
  751.     Scene_StateHelp.prototype.update = function() {
  752.         Scene_Base.prototype.update.call(this);
  753.         if (this.onTouchCancelStateHelp()){ this.returnScene() }
  754.     };
  755.    
  756.     Scene_StateHelp.prototype.onTouchCancelStateHelp = function() {
  757.         if (TouchInput.isTriggered()){
  758.             var x = TouchInput.x;
  759.             var y = TouchInput.y;
  760.             var ax = this._stateHelpWindow.x;
  761.             var xw = ax + this._stateHelpWindow.width;
  762.             var ay = this._stateHelpWindow.y;
  763.             var yh = ay + this._stateHelpWindow.height;
  764.             return !(x >= ax && x <= xw && y >= ay && y <= yh);
  765.         }
  766.         return false;
  767.     };
  768. }());
复制代码
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

在本版发帖返回顶部