Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -urp orig/YEP_WeaponAnimation.js new/YEP_WeaponAnimation.js
- --- orig/YEP_WeaponAnimation.js 2016-06-23 17:52:18.600875800 -0400
- +++ new/YEP_WeaponAnimation.js 2016-06-23 17:14:13.108151700 -0400
- @@ -181,7 +181,7 @@ DataManager.processWANotetags1 = functio
- var obj = group[n];
- var notedata = obj.note.split(/[\r\n]+/);
- - obj.weaponImageIndex = 0;
- + obj.weaponImageIndex = [];
- obj.weaponAttackMotion = undefined;
- obj.weaponAnimationId = 0;
- obj.weaponHue = undefined;
- @@ -189,7 +189,7 @@ DataManager.processWANotetags1 = functio
- for (var i = 0; i < notedata.length; i++) {
- var line = notedata[i];
- if (line.match(/<(?:WEAPON IMAGE):[ ](\d+)>/i)) {
- - obj.weaponImageIndex = parseInt(RegExp.$1);
- + obj.weaponImageIndex.push(parseInt(RegExp.$1));
- if (obj.weaponAttackMotion) continue;
- var motion = $dataSystem.attackMotions[parseInt(RegExp.$1)];
- if (motion) {
- @@ -205,7 +205,7 @@ DataManager.processWANotetags1 = functio
- }
- if (obj.weaponHue === undefined) obj.weaponHue = 0;
- } else if (line.match(/<(?:WEAPON IMAGE):[ ](.*)>/i)) {
- - obj.weaponImageIndex = String(RegExp.$1);
- + obj.weaponImageIndex.push(String(RegExp.$1));
- obj.weaponAttackMotion = Yanfly.Param.WAMotion;
- } else if (line.match(/<(?:WEAPON MOTION):[ ](.*)>/i)) {
- obj.weaponAttackMotion = String(RegExp.$1).toLowerCase();
- @@ -263,7 +263,7 @@ Game_Battler.prototype.getUniqWeapAniId
- for (var i = 0; i < length; ++i) {
- var obj = this.states()[i];
- if (obj && obj.weaponImageIndex) {
- - this._cacheWeaponImage = obj.weaponImageIndex;
- + this._cacheWeaponImage = Yanfly.Util.getRandomElement(obj.weaponImageIndex);
- this._cacheWeaponHue = obj.weaponHue;
- return this._cacheWeaponImage;
- }
- @@ -319,18 +319,18 @@ Game_Actor.prototype.getUniqWeapAniId =
- for (var i = 0; i < length; ++i) {
- var obj = this.equips()[i];
- if (obj && obj.weaponImageIndex) {
- - this._cacheWeaponImage = obj.weaponImageIndex;
- + this._cacheWeaponImage = Yanfly.Util.getRandomElement(obj.weaponImageIndex);
- this._cacheWeaponHue = obj.weaponHue;
- return this._cacheWeaponImage;
- }
- }
- if (this.currentClass().weaponImageIndex) {
- - this._cacheWeaponImage = this.currentClass().weaponImageIndex;
- + this._cacheWeaponImage = Yanfly.Util.getRandomElement(this.currentClass().weaponImageIndex);
- this._cacheWeaponHue = this.currentClass().weaponHue;
- return this._cacheWeaponImage;
- }
- if (this.actor().weaponImageIndex) {
- - this._cacheWeaponImage = this.actor().weaponImageIndex;
- + this._cacheWeaponImage = Yanfly.Util.getRandomElement(this.actor().weaponImageIndex);
- this._cacheWeaponHue = this.actor().weaponHue;
- return this._cacheWeaponImage;
- }
- @@ -416,7 +416,7 @@ Game_Enemy.prototype.getUniqWeapAniId =
- return this._cacheWeaponImage;
- }
- if (this.enemy().weaponImageIndex) {
- - this._cacheWeaponImage = this.enemy().weaponImageIndex;
- + this._cacheWeaponImage = Yanfly.Util.getRandomElement(this.enemy().weaponImageIndex);
- this._cacheWeaponHue = this.enemy().weaponHue;
- return this._cacheWeaponImage;
- }
- @@ -517,5 +517,16 @@ Sprite_Weapon.prototype.update = functio
- };
- //=============================================================================
- +// Utilities
- +//=============================================================================
- +
- +Yanfly.Util = Yanfly.Util || {};
- +
- +Yanfly.Util.getRandomElement = function(array) {
- + var value = array[Math.floor(Math.random() * array.length)];
- + return value;
- +};
- +
- +//=============================================================================
- // End of File
- //=============================================================================
Advertisement
Add Comment
Please, Sign In to add comment