设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1176|回复: 2
打印 上一主题 下一主题

[已经解决] 属性点分配插件无法使用

[复制链接]

Lv1.梦旅人

梦石
0
星屑
163
在线时间
73 小时
注册时间
2014-4-10
帖子
109
跳转到指定楼层
1
发表于 2016-5-20 11:56:35 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
如题,找到个很好用的升级分配属性插件但总报错,新人表示灰常无奈。。哪位大大给指点一下。{:2_281:}
附代码:

JAVASCRIPT 代码复制
  1. //=============================================================================
  2. // StatDistribution.js
  3. //=============================================================================
  4.  
  5. /*:
  6. @author Icaro10100 / FrozenPhoenix
  7. @plugindesc Get stat points on level up, those points can be spent to increase stat value
  8. @help
  9.  
  10. *********************************************************************************
  11.  
  12. Actors will gain stat points whenever they level up or when you want to give
  13. them via script call: $gameActors.actor(id).gainStats(amount)
  14.  
  15. Those points can be used to increase the actor's stats via a custom scene.
  16. To call the scene use the call: SceneManager.sceneDistribution(actor)
  17.  
  18. Example: SceneManager.sceneDistribution($gameParty.members()[0])
  19. Learn the basic script calls
  20.  
  21. To call the scene for the entire party use SceneManager.partyDistribution()
  22. Press Q/W to swap the party members. You can use SceneManager.partyDistribution(id)
  23. to have the scene start with the actor in position "id" in the party, example:
  24. SceneManager.partyDistribution(2) will start the scene with the third actor in the
  25. party.
  26.  
  27. Holding shift while increasing the attributes will increase them faster.
  28.  
  29. Press "x" to toggle between decrease/increase option
  30.  
  31. Put the following tags to determine how much the param/stat will increase per
  32. stat point spent:
  33.  
  34. <ihp: amount>
  35. <imp: amount>
  36. <iatk: amount>
  37. <idef: amount>
  38. <imat: amount>
  39. <imdf: amount>
  40. <iagi: amount>
  41. <iluk: amount>
  42.  
  43. For extra parameters:
  44.  
  45. <ihit: amount>
  46. <ieva: amount>
  47. <icri: amount>
  48. <icev: amount>
  49. <imev: amount>
  50. <imrf: amount>
  51. <icnt: amount>
  52. <ihrg: amount>
  53. <imrg: amount>
  54. <itrg: amount>
  55.  
  56. The tags should be put in the class notebox OR in the actor notebox
  57.  
  58. To have custom parameter limits for each actor/class put those tags in the notebox:
  59.  
  60. <hplimit: >
  61. <mplimit: >
  62. <atklimit: >
  63. <deflimit: >
  64. <matlimit: >
  65. <mdflimit: >
  66. <agilimit: >
  67. <luklimit: >
  68.  
  69.  
  70.  
  71. Feel free to use for free/comercial games, just give credit.
  72. Enjoy
  73.  
  74. ChangeLog:
  75.  
  76. --1.2
  77. -Fixed bug of max hp value displaying 999 on screen even when the actual value was higher
  78. -Added option to add custom limits for parameters, those can be different for each actor
  79. -Added option to limit how much points you can spend on the same parameter each level
  80. -Added party option, press Q/W to swap between party members
  81. -Can now put tags in the actor's note box as well
  82.  
  83. --1.1
  84. -Added names for some stuff
  85. -Added option to decrease stat
  86. -Added support for extra parameters (crit/evasion etc)
  87.  
  88. *********************************************************************************
  89.  
  90. @param PointsName
  91. @desc The name given to stat points
  92. @default Points
  93.  
  94. @param ActorName
  95. @desc The word before the actor's name
  96. @default Name
  97.  
  98. @param ClassName
  99. @desc The word before the actor's class
  100. @default Class
  101.  
  102. @param ExpName
  103. @desc The word before the actor's experience
  104. @default EXP
  105.  
  106. @param IncreaseName
  107. @desc The word that means increase duhhh (if doing game on another language)
  108. @default Increase
  109.  
  110. @param DecreaseName
  111. @desc Same thing as before
  112. @default Decrease
  113.  
  114. @param StatNameColor
  115. @desc The color the stat's name appears, select a number from the windowskin
  116. @default 1
  117.  
  118. @param StatValueColor
  119. @desc The color the stat's value appears, select a number from the windowskin
  120. @default 0
  121.  
  122. @param ShiftIncrease
  123. @desc When holding shift, the amount increased will be multiplicated by this parameter
  124. @default 5
  125.  
  126. @param LevelUpPoints
  127. @desc Points gained on level up, can be any number or formula that returns a number
  128. @default 10
  129.  
  130. @param UsedStats
  131. @desc The basic stats that will be available to increase, put the id separated by a comma Example: 0,3,4,5
  132. @default 0,1,2,3,4,5,6,7
  133.  
  134. @param UsedXStats
  135. @desc Same as before, but for extra parameters (crit/evasion etc)
  136. @default
  137.  
  138. @param ExtraParamNames
  139. @desc Names for the extra stats (crit/evasion etc), just modify the strings in the default.
  140. @default ["Hit rate", "Evasion", "Crit chance", "Crit Evasion", "Magic Evasion", "Magic Reflect", "Counter", "HP Regen", "MP Regen", "TP Regen"]
  141.  
  142. @param DefaultLimits
  143. @desc Highest possible value for the parameter
  144. Just change the values, in order: hp/mp/atk/def/mat/mdf/agi/luk
  145. @default [99999, 9999, 999, 999, 999, 999, 999, 999]
  146.  
  147. @param DefaultxParamLimits
  148. @desc Highest possible value for special parameters
  149. Just change the values, in order: hit/eva/crit/criteva etc.
  150. @default [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
  151.  
  152. @param MaxPointsPerLevel
  153. @desc How much points you can spend per level on a single parameter
  154. use any formula that returns a number, leave 0 for no limits
  155. @default 0
  156.  
  157.  
  158.  
  159.  
  160. */
  161.  
  162.  
  163.  
  164. (function() {
  165.  
  166. //Parameters   
  167. var parameters = PluginManager.parameters('StatDistribution');
  168. var pointsName = String(parameters["PointsName"]);
  169. var actorName = String(parameters["ActorName"]);
  170. var className = String(parameters["ClassName"]);
  171. var expName = String(parameters["ExpName"]);
  172. var increaseName = String(parameters["IncreaseName"]);
  173. var decreaseName = String(parameters["DecreaseName"]);
  174. var statNameColor = Number(parameters["StatNameColor"]);
  175. var statValueColor = Number(parameters["StatValueColor"]);
  176. var shiftIncrease = Number(parameters["ShiftIncrease"]);
  177. var levelUpPoints = String(parameters["LevelUpPoints"]);
  178. var usedStats = String(parameters["UsedStats"]);
  179. var usedXStats = String(parameters["UsedXStats"]);
  180. var xParamNames = String(parameters["ExtraParamNames"]);
  181. var defaultLimits = String(parameters['DefaultLimits']);
  182. var defaultxLimits = String(parameters['DefaultxParamLimits']);
  183. var maxPointsPerLevel = String(parameters['MaxPointsPerLevel']);
  184.  
  185. getLimit = function(id) {
  186.     limits = eval(defaultLimits);
  187.     return limits[id];
  188. }
  189.  
  190. getTag = function(id) {
  191.     switch(id) {
  192.         case 0:
  193.             return "hplimit";
  194.         case 1:
  195.             return "mplimit";
  196.         case 2:
  197.             return "atklimit";
  198.         case 3:
  199.             return "deflimit";
  200.         case 4:
  201.             return "matlimit";
  202.         case 5:
  203.             return "mdflimit";
  204.         case 6:
  205.             return "agilimit";
  206.         case 7:
  207.             return "luklimit";                 
  208.     }
  209. }
  210.  
  211.  
  212. //This function will return an array with the ids of the used stats
  213. getUsedStats = function() {
  214.     var re = /\d+/g;
  215.     return usedStats.match(re) || [];  
  216. }
  217.  
  218. //This function will return an array with the ids of the used extra stats
  219. getUsedXStats = function() {
  220.     var re = /\d+/g;
  221.     return usedXStats.match(re) || [];
  222. }
  223.  
  224. //This function will return the name of the extra param with given index
  225. getXParamName = function(id) {
  226.     var names = eval(xParamNames);
  227.     return names[id];
  228. }
  229.  
  230. //Game batlerbase
  231.  
  232. Game_BattlerBase.prototype.xparam = function(xparamId) {
  233.     var value = this.traitsSum(Game_BattlerBase.TRAIT_XPARAM, xparamId) + this._gainedxparams[xparamId];
  234.     return value;
  235. };
  236.  
  237. _GameBattlerBaseInitialize = Game_BattlerBase.prototype.initialize;
  238. Game_BattlerBase.prototype.initialize = function() {
  239.     _GameBattlerBaseInitialize.call(this);
  240.     this._gainedxparams = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
  241. };
  242.  
  243.  
  244. Game_BattlerBase.prototype.paramMax = function(paramId) {
  245.     if (paramId == 0) {
  246.         return 999999;  // MHP
  247.     } else if (paramId == 1) {
  248.         return 9999;    // MMP
  249.     } else {
  250.         return 999;
  251.     }
  252. };
  253.  
  254.  
  255. //---Game Actor
  256.  
  257. _GameActorInitialize = Game_Actor.prototype.initialize;
  258. Game_Actor.prototype.initialize = function(actorId) {
  259.     _GameActorInitialize.call(this, actorId);
  260.     this._statPoints = 0;
  261.     this.resetUsedPoints();
  262. };
  263.  
  264. Game_Actor.prototype.resetUsedPoints = function() {
  265.     this._usedPoints = [0, 0, 0, 0, 0, 0, 0, 0];
  266.     this._usedxPoints = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
  267. }
  268.  
  269. Game_Actor.prototype.increasePointLimit = function() {
  270.     for (i=0; i<this._usedxPoints.length; i++) {
  271.         if (i<this._usedPoints.length) {
  272.             this._usedPoints[i] -= this.maxPerLevel();
  273.         }
  274.         this._usedxPoints[i] -= this.maxPerLevel();
  275.     }
  276. }
  277.  
  278. Game_Actor.prototype.usePoints = function(paramid, points) {
  279.     this._usedPoints[paramid] += points;
  280. }
  281.  
  282. Game_Actor.prototype.usexPoints = function(paramid, points) {
  283.     this._usedxPoints[paramid] += points;
  284. }
  285.  
  286. Game_Actor.prototype.canIncrease = function(paramid, points, alreadyUsed) {
  287.     var result = true;
  288.     if (((this._usedPoints[paramid] + points) > this.maxPerLevel()) && (this.maxPerLevel() != 0)) {
  289.         result = false;
  290.     }
  291.     if ((this.param(paramid) + alreadyUsed + points*this.statPerPoint(paramid)) > this.paramMax(paramid)) {
  292.         result =false;
  293.     }
  294.     return result;
  295. }
  296.  
  297. Game_Actor.prototype.canIncreasex = function(paramid, points, alreadyUsed) {
  298.     var result = true;
  299.     if (((this._usedxPoints[paramid] + points) > this.maxPerLevel()) && (this.maxPerLevel() != 0)) {
  300.         result = false;
  301.     }
  302.     if ((this.xparam(paramid) + alreadyUsed + points*this.xstatPerPoint(paramid)) > this.xparamMax(paramid)) {
  303.         result =false;
  304.     }
  305.     return result;
  306. }
  307.  
  308. Game_Actor.prototype.paramMax = function(paramId) {
  309.     var limit;
  310.     var meta = "this.actor().meta." + getTag(paramId);
  311.     meta = eval(meta);
  312.     meta = meta ? meta : "$dataClasses[this.actor().id].meta." + getTag(paramId);
  313.     meta = eval(meta);
  314.     if (meta) {
  315.         limit = Number(meta);
  316.     } else {
  317.         limit = getLimit(paramId);
  318.     }
  319.     return limit;
  320. };
  321.  
  322. Game_Actor.prototype.xparamMax = function(paramId) {
  323.     var limit = eval(defaultxLimits);
  324.     return limit[paramId];
  325. };
  326.  
  327. Game_Actor.prototype.maxPerLevel = function() {
  328.     return eval(this.actor().meta.maxPerLevel) || Number(maxPointsPerLevel);
  329. }
  330.  
  331. //Stat increase per stat point
  332. Game_Actor.prototype.statPerPoint = function(id) {
  333.     var str;
  334.     switch(id) {
  335.         case 0:
  336.             str = "ihp";
  337.             break;
  338.         case 1:
  339.             str = "imp";
  340.             break;
  341.         case 2:
  342.             str = "iatk";
  343.             break;
  344.         case 3:
  345.             str = "idef";
  346.             break;
  347.         case 4:
  348.             str = "imat";
  349.             break;
  350.         case 5:
  351.             str = "imdf";
  352.             break;
  353.         case 6:
  354.             str = "iagi";
  355.             break;
  356.         case 7:
  357.             str = "iluk";
  358.             break;         
  359.     }
  360.     var met = "$dataClasses[this._classId].meta." + str;
  361.     met = eval(met);
  362.     met = met ? met : "this.actor().meta." + str;
  363.     met = eval(met);
  364.     return met ? eval(met) : 1;
  365. }
  366.  
  367. //Xstat increase per stat point
  368. Game_Actor.prototype.xstatPerPoint = function(id) {
  369.     var str;
  370.     switch(id) {
  371.         case 0:
  372.             str = "ihit";
  373.             break;
  374.         case 1:
  375.             str = "ieva";
  376.             break;
  377.         case 2:
  378.             str = "icri";
  379.             break;
  380.         case 3:
  381.             str = "icev";
  382.             break;
  383.         case 4:
  384.             str = "imev";
  385.             break;
  386.         case 5:
  387.             str = "imrf";
  388.             break;
  389.         case 6:
  390.             str = "icnt";
  391.             break;
  392.         case 7:
  393.             str = "ihrg";
  394.             break;
  395.         case 8:
  396.             str = "imrg";
  397.             break;
  398.         case 9:
  399.             str = "itrg";
  400.     }
  401.     var met = "$dataClasses[this._classId].meta." + str;
  402.     met = eval(met);
  403.     met = met ? met : "this.actor().meta." + str;
  404.     met = eval(met);
  405.     return eval(met) ? eval(met) : 1;
  406. }
  407.  
  408. //-New function gainStats to call on level ups etc
  409. Game_Actor.prototype.gainStats = function(amount) {
  410.     this._statPoints += amount;
  411. }
  412.  
  413. //-Gain stats on level up
  414. _GameActorLevelUp = Game_Actor.prototype.levelUp;
  415. Game_Actor.prototype.levelUp = function() {
  416.     _GameActorLevelUp.call(this);
  417.     this.gainStats(eval(levelUpPoints));
  418.     this.increasePointLimit();
  419. };
  420.  
  421. //-Actor current stats
  422. Game_Actor.prototype.statPoints = function() {
  423.     return this._statPoints;
  424. }  
  425.  
  426. //-----New windows
  427.  
  428. //****************************************************
  429. //
  430. //---Window Points, to display stat points.
  431. //
  432. //****************************************************
  433.  
  434.  
  435. function Window_Points() {
  436.     this.initialize.apply(this, arguments);
  437. }
  438.  
  439. Window_Points.prototype = Object.create(Window_Base.prototype);
  440. Window_Points.prototype.constructor = Window_Points;
  441.  
  442. Window_Points.prototype.initialize = function(x, y, actor) {
  443.     var width = this.windowWidth();
  444.     var height = this.windowHeight();
  445.     this._actor = actor;
  446.     Window_Base.prototype.initialize.call(this, x, y, width, height);
  447.     this.refresh();
  448. };
  449.  
  450. Window_Points.prototype.windowWidth = function() {
  451.     return 300;
  452. };
  453.  
  454. Window_Points.prototype.actor = function () {
  455.     return this._actor;
  456. }
  457.  
  458. Window_Points.prototype.windowHeight = function() {
  459.     return this.fittingHeight(1);
  460. };
  461.  
  462. Window_Points.prototype.refresh = function(newActor) {
  463.     if (!newActor) {
  464.         newActor = this.actor();
  465.     }
  466.     this._actor = newActor;
  467.     var x = this.textPadding();
  468.     var width = this.contents.width - this.textPadding() * 2;
  469.     this.contents.clear();
  470.     this.drawThings();
  471. };
  472.  
  473. Window_Points.prototype.drawThings = function() {
  474.     var x = 1;
  475.     var y = 1;
  476.     var mWidth = Math.round(this.windowWidth()/2.5);
  477.     var value = this._actor.statPoints();
  478.     this.changeTextColor(this.textColor(statNameColor));
  479.     this.drawText(pointsName, x, y, mWidth);
  480.     this.changeTextColor(this.textColor(statValueColor));
  481.     this.drawText(value, x + mWidth + 10, y, mWidth);  
  482. }
  483.  
  484. Window_Points.prototype.open = function() {
  485.     this.refresh();
  486.     Window_Base.prototype.open.call(this);
  487. };
  488.  
  489.  
  490. //****************************************************
  491. //
  492. //---Window Selecting, to increase stats or leave scene
  493. //
  494. //****************************************************
  495.  
  496.  
  497. Window_Selecting.prototype = Object.create(Window_Command.prototype);
  498. Window_Selecting.prototype.constructor = Window_Selecting;
  499.  
  500. function Window_Selecting() {
  501.     this.initialize.apply(this, arguments);
  502. }
  503.  
  504. Window_Selecting.prototype.initialize = function (x, y, mode) {
  505.     this._mode = mode;
  506.     Window_Command.prototype.initialize.call(this, x, y);
  507. }
  508.  
  509. Window_Selecting.prototype.windowWidth = function() {
  510.     return 350;
  511. };
  512.  
  513. Window_Selecting.prototype.numVisibleRows = function() {
  514.     return 9;
  515. };
  516.  
  517. Window_Selecting.prototype.processOk = function() {
  518.     if (this.isCurrentItemEnabled()) {
  519.         this.updateInputData();
  520.         this.deactivate();
  521.         this.callOkHandler();
  522.     }
  523. };
  524.  
  525. Window_Selecting.prototype.activate = function(index) {
  526.     Window_Base.prototype.activate.call(this);
  527.     index2 = index ? index : this._index;
  528.     this.select(index2);
  529. };
  530.  
  531. Window_Selecting.prototype.makeCommandList = function() {
  532.     var name;
  533.     var used = getUsedStats();
  534.     var usedx = getUsedXStats();
  535.     var k;
  536.     var mode = this._mode;
  537.     for(i=0;i<used.length;i++) {
  538.         k = Number(used[i]);
  539.         name = mode + " " + TextManager.param(k);
  540.         this.addCommand(name, 'param' + k.toString());
  541.     }
  542.     for(i=0;i<usedx.length;i++) {
  543.         k = Number(usedx[i]);
  544.         y = k + 10;
  545.         name = mode + " " + getXParamName(k);
  546.         this.addCommand(name, 'param' + y.toString());
  547.     }
  548.     this.addCommand("Exit", 'exit');
  549. }
  550.  
  551.  
  552. //****************************************************
  553. //
  554. //---Window xParams, display character especial parameters
  555. //
  556. //****************************************************
  557.  
  558. function Window_xParams() {
  559.     this.initialize.apply(this, arguments);
  560. }
  561.  
  562. Window_xParams.prototype = Object.create(Window_Base.prototype);
  563. Window_xParams.prototype.constructor = Window_xParams;
  564.  
  565. Window_xParams.prototype.initialize = function (x, y, actor, increased) {
  566.     this._increased = increased;
  567.     this._width = Graphics.boxWidth - x;
  568.     var height = Graphics.boxHeight - y;
  569.     Window_Base.prototype.initialize.call(this, x, y, this._width, height);
  570.     this._actor = actor;
  571.     this.refresh();
  572. };
  573.  
  574. Window_xParams.prototype.actor = function() {
  575.     return this._actor;
  576. };
  577.  
  578. Window_xParams.prototype.baseDraw = function(name, value, x, y) {
  579.     var mWidth = Math.round(this._width/1.5);
  580.     var x2 = x + mWidth + 5;
  581.     this.changeTextColor(this.textColor(statNameColor));
  582.     this.drawText(name, x, y, mWidth);
  583.     this.changeTextColor(this.textColor(statValueColor));
  584.     this.drawText(value, x2, y, mWidth);
  585. }
  586.  
  587. Window_xParams.prototype.drawActorStat = function(x, y, id) {
  588.     var pName = getXParamName(id);
  589.     var pValue = this.actor().xparam(id) + this._increased[id];
  590.     this.baseDraw(pName, pValue.toFixed(2), x, y);
  591. };
  592.  
  593. Window_xParams.prototype.drawParameters = function() {
  594.     var x = 1;
  595.     var y = 1;
  596.     var usedx = getUsedXStats();
  597.     var lineHeight = this.lineHeight();
  598.     for(i=0;i<usedx.length;i++) {
  599.         this.drawActorStat(x, y + lineHeight * i, Number(usedx[i]));      
  600.     }
  601. }
  602.  
  603. Window_xParams.prototype.refresh = function(newActor) {
  604.     if (!newActor) {
  605.         newActor = this.actor();
  606.     }
  607.     this._actor = newActor;
  608.     if (this.contents) {
  609.         this.contents.clear();
  610.         this.drawParameters();
  611.     }
  612. }
  613.  
  614.  
  615. //****************************************************
  616. //
  617. //---Window Char, display character image and current stats
  618. //
  619. //****************************************************
  620.  
  621.  
  622. function Window_Char() {
  623.     this.initialize.apply(this, arguments);
  624. }
  625.  
  626. Window_Char.prototype = Object.create(Window_Base.prototype);
  627. Window_Char.prototype.constructor = Window_Char;
  628.  
  629.  
  630. Window_Char.prototype.initialize = function (x, y, actor, increased) {
  631.     var width = this.windowWidth();
  632.     var height = this.windowHeight();
  633.     this._increased = increased;
  634.     this._actor = actor;
  635.     Window_Base.prototype.initialize.call(this, x, y, width, height);
  636.     this.loadImages();
  637.     this.refresh();
  638. };
  639.  
  640. Window_Char.prototype.actor = function() {
  641.     return this._actor;
  642. };
  643.  
  644. Window_Char.prototype.windowWidth = function() {
  645.     return Graphics.boxWidth;
  646. };
  647.  
  648. Window_Char.prototype.windowHeight = function() {
  649.     return Math.round(Graphics.boxHeight / 3) - 20;
  650. };
  651.  
  652. Window_Char.prototype.loadImages = function() {
  653.     for (i=0; i<$gameParty.members().length;i++){
  654.         ImageManager.loadFace($gameParty.members()[i].faceName());
  655.     }
  656. };
  657.  
  658. Window_Char.prototype.drawItem = function() {
  659.     this.drawItemImage();
  660.     this.drawItemStatus();
  661.     this.drawParameters();
  662. };
  663.  
  664. Window_Char.prototype.drawItemImage = function() {
  665.     this.drawActorFace(this.actor(), 1, 1, 144, 144);
  666. };
  667.  
  668. Window_Char.prototype.drawItemStatus = function() {
  669.     var x = 160;
  670.     var actor = this.actor();
  671.     var y = 1;
  672.     var lineHeight = this.lineHeight();
  673.     this.drawActorName(actor, x, y);
  674.     this.drawActorLevel(actor, x, y + lineHeight * 1);
  675.     this.drawActorClass(actor, x, y + lineHeight * 2);
  676.     this.drawActorExp(actor, x, y + lineHeight * 3);
  677. };
  678.  
  679. Window_Char.prototype.drawParameters = function() {
  680.     var x = 390;
  681.     var y = 1;
  682.     var used = getUsedStats();
  683.     var lineHeight = this.lineHeight();
  684.     var k;
  685.     for(i=0;i<used.length;i++) {
  686.         if (i < 4) {
  687.             this.drawActorStat(x, y + lineHeight * i, used[i]);
  688.         } else {
  689.             k = i-4;   
  690.             this.drawActorStat(x + 220, y + lineHeight * k, used[i]);
  691.         }  
  692.     }
  693. }
  694.  
  695. Window_Char.prototype.baseDraw = function(name, value, x, y) {
  696.     var mWidth = Math.round(this.windowWidth()/8);
  697.     var x2 = x + mWidth + 10;
  698.     this.changeTextColor(this.textColor(statNameColor));
  699.     this.drawText(name, x, y, mWidth);
  700.     this.changeTextColor(this.textColor(statValueColor));
  701.     this.drawText(value, x2, y, mWidth);
  702. }
  703.  
  704. Window_Char.prototype.drawActorExp = function(actor, x, y) {
  705.     this.baseDraw(expName, actor.currentExp(), x, y);
  706. }
  707.  
  708. Window_Char.prototype.drawActorClass = function(actor, x, y) {
  709.     this.baseDraw(className, actor.currentClass().name, x, y);
  710. }
  711.  
  712. Window_Char.prototype.drawActorName = function(actor, x, y) {
  713.     this.baseDraw(actorName, actor.name(), x, y);
  714. };
  715.  
  716. Window_Char.prototype.drawActorLevel = function(actor, x, y) {
  717.     this.baseDraw(TextManager.level, actor.level, x, y);
  718. };
  719.  
  720.  
  721. Window_Char.prototype.drawActorStat = function(x, y, id) {
  722.     var pName = TextManager.param(id);
  723.     var pValue = this.actor().param(id) + this._increased[id];
  724.     this.baseDraw(pName, pValue.toFixed(0), x, y);
  725. };
  726.  
  727. Window_Char.prototype.refresh = function(newActor) {
  728.     if (!newActor) {
  729.         newActor = this.actor();
  730.     }
  731.     this._actor = newActor;
  732.     if (this.contents) {
  733.         this.contents.clear();
  734.         this.drawItem();
  735.     }
  736. }
  737.  
  738.  
  739.  
  740. //****************************************************
  741. //
  742. //---Scene Distribution, the main scene
  743. //
  744. //****************************************************
  745.  
  746.  
  747. function Scene_Distribution() {
  748.     this.initialize.apply(this, arguments);
  749. }
  750.  
  751. Scene_Distribution.prototype = Object.create(Scene_MenuBase.prototype);
  752. Scene_Distribution.prototype.constructor = Scene_Distribution;
  753.  
  754.  
  755. Scene_Distribution.prototype.initialize = function(actor, party) {
  756.     this._actorr = actor;
  757.     this._party = party;
  758.     this._params = [0,0,0,0,0,0,0,0,0,0,0,0,0];
  759.     this._xparams = [0,0,0,0,0,0,0,0,0,0,0,0,0];
  760.     this._usedStats = 0;
  761.     Scene_MenuBase.prototype.initialize.call(this);
  762. };
  763.  
  764. Scene_Distribution.prototype.actor = function() {
  765.     return this._actorr;
  766. }
  767.  
  768. Scene_Distribution.prototype.inPartyMode = function() {
  769.     return this._party;
  770. }
  771.  
  772. Scene_Distribution.prototype.create = function() {
  773.     Scene_MenuBase.prototype.create.call(this);
  774.     this.createCharWindow(this.actor());
  775.     this.createXParamWindow(this.actor());
  776.     this.createDecreaseWindow();
  777.     this.createSelectingWindow();
  778.     this.createPointWindow(this.actor());
  779. }
  780.  
  781.  
  782. Scene_Distribution.prototype.start = function() {
  783.     Scene_MenuBase.prototype.start.call(this);
  784.     this._charWindow.refresh();
  785. };
  786.  
  787.  
  788. Scene_Distribution.prototype.createCharWindow = function(actor) {
  789.     this._charWindow = new Window_Char(0, 0, actor, this._params);
  790.     this.addWindow(this._charWindow);
  791. }
  792.  
  793. Scene_Distribution.prototype.createXParamWindow = function(actor) {
  794.     var usedx = getUsedXStats();
  795.     if (usedx) {
  796.         if (usedx.length >= 1) {
  797.             this._xParamWindow = new Window_xParams(500, this._charWindow.windowHeight(), actor, this._xparams);
  798.             this.addWindow(this._xParamWindow);
  799.         }      
  800.     }  
  801. }
  802.  
  803. Scene_Distribution.prototype.createSelectingWindow = function() {
  804.     this._selectingWindow = new Window_Selecting(0, this._charWindow.windowHeight(), increaseName);
  805.     var used = getUsedStats();
  806.     var usedx = getUsedXStats();
  807.     var k;
  808.     for(i=0;i<used.length;i++) {
  809.         k = Number(used[i]);
  810.         this._selectingWindow.setHandler('param' + k.toString(), this.increaseParam.bind(this, k));
  811.     }
  812.     for(i=0;i<usedx.length;i++) {
  813.         k = Number(usedx[i]);
  814.         y = k + 10;
  815.         this._selectingWindow.setHandler('param' + y.toString(), this.increaseExParam.bind(this, k));
  816.     }
  817.     if (this.inPartyMode()) {
  818.         this._selectingWindow.setHandler('pageup', this.nextActor.bind(this, false));
  819.         this._selectingWindow.setHandler('pagedown', this.nextActor.bind(this, true));
  820.     }
  821.     this._selectingWindow.setHandler('exit', this.exit.bind(this));
  822.     this._selectingWindow.setHandler('cancel', this.swapWindows.bind(this, "decrease"));
  823.     this.addWindow(this._selectingWindow);
  824.     this._selectingWindow.activate();
  825. }
  826.  
  827. Scene_Distribution.prototype.createDecreaseWindow = function() {
  828.     this._decreaseWindow = new Window_Selecting(0, this._charWindow.windowHeight(), decreaseName);
  829.     var used = getUsedStats();
  830.     var usedx = getUsedXStats();
  831.     var k;
  832.     for(i=0;i<used.length;i++) {
  833.         k = Number(used[i]);
  834.         this._decreaseWindow.setHandler('param' + k.toString(), this.decreaseParam.bind(this, k));
  835.     }
  836.     for(i=0;i<usedx.length;i++) {
  837.         k = Number(usedx[i]);
  838.         y = k + 10;
  839.         this._decreaseWindow.setHandler('param' + y.toString(), this.decreaseExParam.bind(this, k));
  840.     }
  841.     if (this.inPartyMode()) {
  842.         this._decreaseWindow.setHandler('pageup', this.nextActor.bind(this, false));
  843.         this._decreaseWindow.setHandler('pagedown', this.nextActor.bind(this, true));
  844.     }
  845.     this._decreaseWindow.setHandler('exit', this.exit.bind(this));
  846.     this._decreaseWindow.setHandler('cancel', this.swapWindows.bind(this, "increase"));
  847.     this.addWindow(this._decreaseWindow);
  848.     this._decreaseWindow.hide();
  849.     this._decreaseWindow.deactivate();
  850. }
  851.  
  852. Scene_Distribution.prototype.nextActor = function(mode) {
  853.     SoundManager.playEvasion;
  854.     var j = $gameParty.members().indexOf(this.actor());
  855.     var l = $gameParty.members().length;
  856.     if (mode) {
  857.         j = (j+1)==l ? 0 : (j+1);
  858.     } else {
  859.         j = (j-1)<0 ? (l-1) : (j-1);
  860.     }
  861.     this.addParameters();
  862.     this._actorr = $gameParty.members()[j];
  863.     this._charWindow.refresh(this.actor());
  864.     if (this._xParamWindow) {
  865.         this._xParamWindow.refresh(this.actor());
  866.     }
  867.     this._pointWindow.refresh(this.actor());
  868.     this.swapWindows("increase");
  869. }
  870.  
  871. Scene_Distribution.prototype.swapWindows = function(mode) {
  872.     SoundManager.playEvasion;
  873.     switch (mode) {
  874.         case "increase":
  875.             this._decreaseWindow.deactivate();
  876.             this._decreaseWindow.hide();
  877.             this._selectingWindow.show();
  878.             this._selectingWindow.activate(this._decreaseWindow._index);
  879.             break;
  880.         case "decrease":
  881.             this._selectingWindow.deactivate();
  882.             this._selectingWindow.hide();
  883.             this._decreaseWindow.show();
  884.             this._decreaseWindow.activate(this._selectingWindow._index);
  885.             break;         
  886.     }
  887. }
  888.  
  889. Scene_Distribution.prototype.addParameters = function() {
  890.     for (i=0;i<8;i++) {
  891.         this.actor().addParam(i, Number(this._params[i].toFixed()));
  892.     }
  893.     for (i=0;i<10;i++) {
  894.         this.actor()._gainedxparams[i] += Number(this._xparams[i].toFixed(2));
  895.     }
  896.     for (i=0;i<13;i++){
  897.         this._params[i] = 0;
  898.         this._xparams[i] = 0;
  899.     }
  900.     this._usedStats = 0;
  901. }
  902.  
  903. Scene_Distribution.prototype.exit = function() {
  904.     SoundManager.playCancel();
  905.     this.addParameters();
  906.     SceneManager.pop();
  907. }
  908.  
  909. Scene_Distribution.prototype.createPointWindow = function(actor) {
  910.     var y = this._charWindow.windowHeight() + this._selectingWindow.windowHeight();
  911.     this._pointWindow = new Window_Points(0, y, actor);
  912.     this.addWindow(this._pointWindow);
  913. }
  914.  
  915. Scene_Distribution.prototype.increaseParam = function(id) {
  916.     var x = Input.isPressed('shift') ? shiftIncrease : 1;
  917.     var amount;
  918.     var condition = this.actor().canIncrease(id, x, this._params[id]);
  919.     if ((this.actor().statPoints() >= x) && condition) {
  920.         amount = this.actor().statPerPoint(id)*x;
  921.         this._params[id] += amount;
  922.         this._selectingWindow.playOkSound();
  923.         this._usedStats += x;
  924.         this.actor().gainStats(-x);
  925.         this.actor().usePoints(id, x);
  926.     } else {
  927.         this._selectingWindow.playBuzzerSound();
  928.     }
  929.     this._charWindow.refresh();
  930.     this._pointWindow.refresh();
  931.     if (this._xParamWindow) {
  932.         this._xParamWindow.refresh();
  933.     }
  934.     this._selectingWindow.activate();
  935. }
  936.  
  937. Scene_Distribution.prototype.increaseExParam = function(id) {
  938.     var x = Input.isPressed('shift') ? shiftIncrease : 1;
  939.     var amount;
  940.     var condition = this.actor().canIncreasex(id, x, this._xparams[id]);
  941.     if ((this.actor().statPoints() >= x) && condition) {
  942.         amount = this.actor().xstatPerPoint(id)*x;
  943.         this._xparams[id] += amount;
  944.         this._selectingWindow.playOkSound();
  945.         this._usedStats += x;
  946.         this.actor().gainStats(-x);
  947.         this.actor().usexPoints(id, x);
  948.     } else {
  949.         this._selectingWindow.playBuzzerSound();
  950.     }
  951.     this._charWindow.refresh();
  952.     this._pointWindow.refresh();
  953.     if (this._xParamWindow) {
  954.         this._xParamWindow.refresh();
  955.     }
  956.     this._selectingWindow.activate();
  957. }
  958.  
  959. Scene_Distribution.prototype.decreaseParam = function(id) {
  960.     var x = Input.isPressed('shift') ? shiftIncrease : 1;
  961.     var amount = this.actor().statPerPoint(id)*x;;
  962.     if ((this._usedStats >= x) && (this._params[id] >= amount)) {
  963.         this._params[id] -= amount;
  964.         SceneManager.playCancel;
  965.         this._usedStats -= x;
  966.         this.actor().gainStats(x);
  967.         this.actor().usePoints(id, -x);
  968.     } else {
  969.         this._decreaseWindow.playBuzzerSound();
  970.     }
  971.     this._charWindow.refresh();
  972.     this._pointWindow.refresh();
  973.     if (this._xParamWindow) {
  974.         this._xParamWindow.refresh();
  975.     }
  976.     this._decreaseWindow.activate();
  977. }
  978.  
  979. Scene_Distribution.prototype.decreaseExParam = function(id) {
  980.     var x = Input.isPressed('shift') ? shiftIncrease : 1;
  981.     var amount = this.actor().xstatPerPoint(id)*x;;
  982.     if ((this._usedStats >= x) && (this._xparams[id] >= amount)) {
  983.         this._xparams[id] -= amount;
  984.         SceneManager.playCancel;
  985.         this._usedStats -= x;
  986.         this.actor().gainStats(x);
  987.         this.actor().usePoints(id, -x);
  988.     } else {
  989.         this._decreaseWindow.playBuzzerSound();
  990.     }
  991.     this._charWindow.refresh();
  992.     this._pointWindow.refresh();
  993.     if (this._xParamWindow) {
  994.         this._xParamWindow.refresh();
  995.     }
  996.     this._decreaseWindow.activate();
  997. }
  998.  
  999.  
  1000.  
  1001. SceneManager.sceneDistribution = function(actor, party) {
  1002.     if (typeof(party) === 'undefined') {
  1003.         party = false;
  1004.     }
  1005.     this._stack.push(this._scene.constructor);
  1006.     if (Scene_Distribution) {
  1007.         this._nextScene = new Scene_Distribution(actor, party);
  1008.     }
  1009.     if (this._scene) {
  1010.         this._scene.stop();
  1011.     }
  1012. }
  1013.  
  1014. SceneManager.partyDistribution = function(index) {
  1015.     if (typeof(index) === 'undefined') {
  1016.         index = 0;
  1017.     }
  1018.     var actor = $gameParty.members()[index];
  1019.     this.sceneDistribution(actor, true);
  1020. }
  1021.  
  1022. })();

Lv1.梦旅人

梦石
0
星屑
163
在线时间
73 小时
注册时间
2014-4-10
帖子
109
2
 楼主| 发表于 2016-5-20 11:58:46 | 只看该作者
报错截图:

QQ截图20160520115839.png (35.78 KB, 下载次数: 6)

QQ截图20160520115839.png
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-28 16:20

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表