Guest User

Untitled

a guest
Jun 23rd, 2016
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 3.90 KB | None | 0 0
  1. diff -urp orig/YEP_WeaponAnimation.js new/YEP_WeaponAnimation.js
  2. --- orig/YEP_WeaponAnimation.js 2016-06-23 17:52:18.600875800 -0400
  3. +++ new/YEP_WeaponAnimation.js  2016-06-23 17:14:13.108151700 -0400
  4. @@ -181,7 +181,7 @@ DataManager.processWANotetags1 = functio
  5.      var obj = group[n];
  6.      var notedata = obj.note.split(/[\r\n]+/);
  7.  
  8. -    obj.weaponImageIndex = 0;
  9. +    obj.weaponImageIndex = [];
  10.      obj.weaponAttackMotion = undefined;
  11.      obj.weaponAnimationId = 0;
  12.      obj.weaponHue = undefined;
  13. @@ -189,7 +189,7 @@ DataManager.processWANotetags1 = functio
  14.      for (var i = 0; i < notedata.length; i++) {
  15.        var line = notedata[i];
  16.        if (line.match(/<(?:WEAPON IMAGE):[ ](\d+)>/i)) {
  17. -        obj.weaponImageIndex = parseInt(RegExp.$1);
  18. +        obj.weaponImageIndex.push(parseInt(RegExp.$1));
  19.          if (obj.weaponAttackMotion) continue;
  20.          var motion = $dataSystem.attackMotions[parseInt(RegExp.$1)];
  21.          if (motion) {
  22. @@ -205,7 +205,7 @@ DataManager.processWANotetags1 = functio
  23.          }
  24.          if (obj.weaponHue === undefined) obj.weaponHue = 0;
  25.        } else if (line.match(/<(?:WEAPON IMAGE):[ ](.*)>/i)) {
  26. -        obj.weaponImageIndex = String(RegExp.$1);
  27. +        obj.weaponImageIndex.push(String(RegExp.$1));
  28.          obj.weaponAttackMotion = Yanfly.Param.WAMotion;
  29.        } else if (line.match(/<(?:WEAPON MOTION):[ ](.*)>/i)) {
  30.          obj.weaponAttackMotion = String(RegExp.$1).toLowerCase();
  31. @@ -263,7 +263,7 @@ Game_Battler.prototype.getUniqWeapAniId
  32.      for (var i = 0; i < length; ++i) {
  33.        var obj = this.states()[i];
  34.        if (obj && obj.weaponImageIndex) {
  35. -        this._cacheWeaponImage = obj.weaponImageIndex;
  36. +        this._cacheWeaponImage = Yanfly.Util.getRandomElement(obj.weaponImageIndex);
  37.          this._cacheWeaponHue = obj.weaponHue;
  38.          return this._cacheWeaponImage;
  39.        }
  40. @@ -319,18 +319,18 @@ Game_Actor.prototype.getUniqWeapAniId =
  41.      for (var i = 0; i < length; ++i) {
  42.        var obj = this.equips()[i];
  43.        if (obj && obj.weaponImageIndex) {
  44. -        this._cacheWeaponImage = obj.weaponImageIndex;
  45. +        this._cacheWeaponImage = Yanfly.Util.getRandomElement(obj.weaponImageIndex);
  46.          this._cacheWeaponHue = obj.weaponHue;
  47.          return this._cacheWeaponImage;
  48.        }
  49.      }
  50.      if (this.currentClass().weaponImageIndex) {
  51. -      this._cacheWeaponImage = this.currentClass().weaponImageIndex;
  52. +      this._cacheWeaponImage = Yanfly.Util.getRandomElement(this.currentClass().weaponImageIndex);
  53.          this._cacheWeaponHue = this.currentClass().weaponHue;
  54.        return this._cacheWeaponImage;
  55.      }
  56.      if (this.actor().weaponImageIndex) {
  57. -      this._cacheWeaponImage = this.actor().weaponImageIndex;
  58. +      this._cacheWeaponImage = Yanfly.Util.getRandomElement(this.actor().weaponImageIndex);
  59.          this._cacheWeaponHue = this.actor().weaponHue;
  60.        return this._cacheWeaponImage;
  61.      }
  62. @@ -416,7 +416,7 @@ Game_Enemy.prototype.getUniqWeapAniId =
  63.        return this._cacheWeaponImage;
  64.      }
  65.      if (this.enemy().weaponImageIndex) {
  66. -      this._cacheWeaponImage = this.enemy().weaponImageIndex;
  67. +      this._cacheWeaponImage = Yanfly.Util.getRandomElement(this.enemy().weaponImageIndex);
  68.          this._cacheWeaponHue = this.enemy().weaponHue;
  69.        return this._cacheWeaponImage;
  70.      }
  71. @@ -517,5 +517,16 @@ Sprite_Weapon.prototype.update = functio
  72.  };
  73.  
  74.  //=============================================================================
  75. +// Utilities
  76. +//=============================================================================
  77. +
  78. +Yanfly.Util = Yanfly.Util || {};
  79. +
  80. +Yanfly.Util.getRandomElement = function(array) {
  81. +    var value = array[Math.floor(Math.random() * array.length)];
  82. +    return value;
  83. +};
  84. +
  85. +//=============================================================================
  86.  // End of File
  87.  //=============================================================================
Advertisement
Add Comment
Please, Sign In to add comment