Advertisement
Maliki79

Mal_Equip_Hp_Mp_adjust

Apr 6th, 2016
466
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Snippet ver 1.1
  2. Scene_Equip.prototype.onItemOk = function() {
  3.     SoundManager.playEquip();
  4.     if (this._slotWindow.item()) {
  5.     if (this._slotWindow.item().params[0] != 0){
  6.         if (this.actor().isAlive()){
  7.         this.actor()._hp -= this._slotWindow.item().params[0];
  8.         if (this.actor()._hp < 1) this.actor()._hp = 1;
  9.         }
  10.     }
  11.     if (this._slotWindow.item().params[1] != 0){
  12.         this.actor()._mp -= this._slotWindow.item().params[1];
  13.         if (this.actor()._mp < 0) this.actor()._mp = 0;
  14.     }
  15.     }
  16.     this.actor().changeEquip(this._slotWindow.index(), this._itemWindow.item());
  17.     this._slotWindow.activate();
  18.     this._slotWindow.refresh();
  19.     if (this._itemWindow.item()){
  20.         if (this._itemWindow.item().params[0] != 0){
  21.             if (this.actor().isAlive()){
  22.             this.actor()._hp += this._itemWindow.item().params[0];
  23.             if (this.actor()._hp < 1) this.actor()._hp = 1;
  24.             }
  25.         }
  26.         if (this._itemWindow.item().params[1] != 0){
  27.             this.actor()._mp += this._itemWindow.item().params[1];
  28.             if (this.actor()._mp < 0) this.actor()._mp = 0;
  29.         }
  30.     }
  31.     this._itemWindow.deselect();
  32.     this._itemWindow.refresh();
  33.     this._statusWindow.refresh();
  34. };
  35.  
  36. Scene_Equip.prototype.commandOptimize = function() {
  37.     SoundManager.playEquip();
  38.     var MHP = this.actor().mhp;
  39.     var MMP = this.actor().mmp;
  40.     var hp = this.actor()._hp;
  41.     var mp = this.actor()._mp;
  42.     this.actor().optimizeEquipments();
  43.     this._statusWindow.refresh();
  44.     this._slotWindow.refresh();
  45.     if (this.actor().isAlive()) this.actor()._hp = hp + (this.actor().mhp - MHP);
  46.     this.actor()._mp = mp + (this.actor().mmp - MMP);
  47.     this._commandWindow.activate();
  48. };
  49.  
  50. Scene_Equip.prototype.commandClear = function() {
  51.     SoundManager.playEquip();
  52.     var MHP = this.actor().mhp;
  53.     var MMP = this.actor().mmp;
  54.     var hp = this.actor()._hp;
  55.     var mp = this.actor()._mp;
  56.     this.actor().clearEquipments();
  57.     this._statusWindow.refresh();
  58.     this._slotWindow.refresh();
  59.     var test = hp + (this.actor().mhp - MHP);
  60.     if (test < 1)
  61.     {
  62.         this.actor()._hp = 1;
  63.         } else {
  64.         this.actor()._hp = test;
  65.     }
  66.     if (this.actor().mmp - MMP < 0) mp -= this.actor().mmp - MMP;
  67.     this._commandWindow.activate();
  68. };
  69.  
  70. Game_Party.prototype.checkItemIsEquippedId = function(item) {
  71.     for (var i = 1; i < $gameActors._data.length; ++i) {
  72.       var actor = $gameActors.actor(i);
  73.       if (!actor) continue;
  74.       if (actor.equips().contains(item)) return i;
  75.     }
  76.     return 0;
  77. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement