Zarsla

Zar_Yanfly_Victory_Aftermath_Ext_For_Stat_Allocation.js

Jun 9th, 2019
81
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. /*:
  3. @plugindesc v1.00 Adds AP scene in victory aftermath
  4. @author Zarsla + Yanfly Engine Plugins
  5.  
  6. @help
  7. ============================================================================
  8. Introduction
  9. ============================================================================
  10. Nothing much to say out side of the fact that this copies and paste the JP
  11. victory aftermath scene, and turns it into an AP one.
  12.  
  13. ============================================================================
  14. Changelog
  15. ============================================================================
  16.  
  17. */
  18. //=============================================================================
  19. function Window_VictoryAp() {
  20. this.initialize.apply(this, arguments);
  21. }
  22.  
  23. Window_VictoryAp.prototype = Object.create(Window_VictoryExp.prototype);
  24. Window_VictoryAp.prototype.constructor = Window_VictoryAp;
  25.  
  26. Window_VictoryAp.prototype.drawActorGauge = function(actor, index) {
  27. this.clearGaugeRect(index);
  28. var rect = this.gaugeRect(index);
  29. this.changeTextColor(this.normalColor());
  30. this.drawActorName(actor, rect.x + 2, rect.y);
  31. this.drawLevel(actor, rect);
  32. this.drawApGained(actor, rect);
  33. };
  34.  
  35. Window_VictoryAp.prototype.drawApGained = function(actor, rect) {
  36. var actorLv = actor._preVictoryLv;
  37. var nowExp = actor._preVictoryExp - actor.expForLevel(actorLv);
  38. var nextExp = actor.expForLevel(actorLv + 1) - actor.expForLevel(actorLv);
  39. //Edit Text:
  40. var textEarned = "AP Earned in Battle";
  41. var wy = rect.y + this.lineHeight() * 1;
  42. this.changeTextColor(this.systemColor());
  43. this.drawText(textEarned, rect.x + 2, wy, rect.width - 4,
  44. 'left');
  45. var bonusAp = 1.0 * actor.availableAp() * this._tick /
  46. Yanfly.Param.VAGaugeTicks;
  47. var value = Yanfly.Util.toGroup(parseInt(bonusAp));
  48. //Edit Text:
  49. var ApText = value + " AP";
  50. this.changeTextColor(this.normalColor());
  51. wx = rect.x + rect.width - this.textWidthEx(ApText);
  52. this.drawTextEx(ApText, wx, wy);
  53. };
  54.  
  55. //=============================================================================
  56. // Scene_Battle
  57. //=============================================================================
  58.  
  59. var Yanfly_AP_Scene_Battle_addCustomVictorySteps =
  60. Scene_Battle.prototype.addCustomVictorySteps;
  61. Scene_Battle.prototype.addCustomVictorySteps = function(array) {
  62. array = Yanfly_AP_Scene_Battle_addCustomVictorySteps.call(this, array);
  63. if (!array.contains('AP')) array.push('AP');
  64. return array;
  65. };
  66.  
  67. var Yanfly_AP_Scene_Battle_updateVictorySteps =
  68. Scene_Battle.prototype.updateVictorySteps;
  69. Scene_Battle.prototype.updateVictorySteps = function() {
  70. Yanfly_AP_Scene_Battle_updateVictorySteps.call(this);
  71. if (this.isVictoryStep('AP')) this.updateVictoryAp();
  72. };
  73.  
  74. Scene_Battle.prototype.updateVictoryAp = function() {
  75. if (!this._victoryApWindow) {
  76. this.createVictoryAp();
  77. } else if (this._victoryApWindow.isReady()) {
  78. if (this.victoryTriggerContinue()) this.finishVictoryAp();
  79. }
  80. };
  81.  
  82. Scene_Battle.prototype.createVictoryAp = function() {
  83. //Edit Text
  84. var text = "AP Earned"
  85. this._victoryTitleWindow.refresh(text);
  86. this._victoryApWindow = new Window_VictoryAp();
  87. this.addWindow(this._victoryApWindow);
  88. this._victoryApWindow.open();
  89. };
  90.  
  91. Scene_Battle.prototype.finishVictoryAp = function() {
  92. SoundManager.playOk();
  93. this._victoryApWindow.close();
  94. this.processNextVictoryStep();
  95. };
RAW Paste Data