Advertisement
isiahgames

IsiahCGCEndButtonIndexFix

Jul 24th, 2022
426
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Window_SkillList.prototype.endTurnIndex = function ()
  2. {
  3.     return 0;
  4. };
  5.  
  6. var Scene_Battle_createItemButton = Scene_Battle.prototype.createItemButtom;
  7. Scene_Battle.prototype.createItemButtom = function ()
  8. {
  9.     Scene_Battle_createItemButton.call(this);
  10.     this._itemButton.setIndex(1);
  11. };
  12.  
  13. Window_SkillList.prototype.makeItemList = function ()
  14. {
  15.     if (!$gameSystem._cardBattleEnabled)
  16.     {
  17.         Isiah.CGC.Window_SkillList_makeItemList.call(this);
  18.         return;
  19.     }
  20.     this._data = [];
  21.     this._itemsBeforeCards = 0;
  22.     if (this._cardSprites)
  23.     {
  24.         for (var i = 0; i < this._cardSprites.length; i++)
  25.         {
  26.             this._data[i] = this._cardSprites[i]._skill;
  27.             if (this.isEnabled(this._data[i]))
  28.                 this._cardSprites[i]._enabledSprite.show();
  29.             else
  30.                 this._cardSprites[i]._enabledSprite.hide();
  31.         }
  32.  
  33.         if (SceneManager._scene instanceof Scene_Battle)
  34.         {
  35.             if (Isiah.CGC.showItemButton)
  36.             {
  37.                 this._data.unshift('itemMenu');
  38.                 this._itemsBeforeCards++;
  39.             }
  40.             if (Isiah.CGC.showEndTurn)
  41.             {
  42.                 this._data.unshift($dataSkills[Isiah.CGC.endTurnSkill]);
  43.                 this._itemsBeforeCards++;
  44.                 this._endTurnButton.setIndex(this.endTurnIndex());
  45.             }
  46.         }
  47.     }
  48. };
  49.  
  50. BattleManager.updateDiscard = function ()
  51. {
  52.     if (this._cardsToDiscard <= 0)
  53.     {
  54.         var skillWindow = SceneManager._scene._skillWindow;
  55.         SceneManager._scene._skillWindow.setDiscardMode('');
  56.         this._phase = this._previousPhase;
  57.         if (this._phase != 'input')
  58.         {
  59.             skillWindow.deactivate();
  60.         }
  61.     }
  62.     else
  63.     {
  64.         var skillWindow = SceneManager._scene._skillWindow;
  65.         skillWindow.activate();
  66.         if (skillWindow.index() == -1)
  67.         {
  68.             skillWindow.select(skillWindow._itemsBeforeCards);
  69.         }
  70.     }
  71. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement