From b7230033bbad5b617abc819c1575b8de4cf773f5 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sun, 22 May 2016 17:34:31 +0200 Subject: [PATCH] Fixed issue where popover wasn't appearing when first pokemon didn't have a mega stone --- client/app/js/models/battles/pokemon.coffee | 1 + client/app/js/views/battles/battle_view.coffee | 1 + public/js/app.js | 4 ++++ public/js/replays.js | 4 ++++ 4 files changed, 10 insertions(+) diff --git a/client/app/js/models/battles/pokemon.coffee b/client/app/js/models/battles/pokemon.coffee index 37ef9c5..1cffed3 100644 --- a/client/app/js/models/battles/pokemon.coffee +++ b/client/app/js/models/battles/pokemon.coffee @@ -248,6 +248,7 @@ class @Pokemon extends Backbone.Model if @get('species') == "Rayquaza" and "Dragon Ascent" in @get('moves') return true item = @getItem() + return false if typeof item == "undefined" return false if item.type != 'megastone' [ species, forme ] = item.mega return false if @get('species') != species || @get('forme') != 'default' diff --git a/client/app/js/views/battles/battle_view.coffee b/client/app/js/views/battles/battle_view.coffee index 5c540b5..55ab45b 100644 --- a/client/app/js/views/battles/battle_view.coffee +++ b/client/app/js/views/battles/battle_view.coffee @@ -166,6 +166,7 @@ class @BattleView extends Backbone.View this movePopover: ($this, moveName, move) => + console.log(moveName) {type, damage} = move damageFriendly = move.damage[0].toUpperCase() + move.damage.substr(1) targetFriendly = move.target[0].toUpperCase() + move.target.substr(1) diff --git a/public/js/app.js b/public/js/app.js index a3faaec..670cb5a 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -1855,6 +1855,9 @@ return true; } item = this.getItem(); + if (typeof item === "undefined") { + return false; + } if (item.type !== 'megastone') { return false; } @@ -3198,6 +3201,7 @@ BattleView.prototype.movePopover = function($this, moveName, move) { var damage, damageFriendly, displayName, options, targetFriendly, type; + console.log(moveName); type = move.type, damage = move.damage; damageFriendly = move.damage[0].toUpperCase() + move.damage.substr(1); targetFriendly = move.target[0].toUpperCase() + move.target.substr(1); diff --git a/public/js/replays.js b/public/js/replays.js index 1f20af3..650a854 100644 --- a/public/js/replays.js +++ b/public/js/replays.js @@ -1855,6 +1855,9 @@ return true; } item = this.getItem(); + if (typeof item === "undefined") { + return false; + } if (item.type !== 'megastone') { return false; } @@ -2924,6 +2927,7 @@ BattleView.prototype.movePopover = function($this, moveName, move) { var damage, damageFriendly, displayName, options, targetFriendly, type; + console.log(moveName); type = move.type, damage = move.damage; damageFriendly = move.damage[0].toUpperCase() + move.damage.substr(1); targetFriendly = move.target[0].toUpperCase() + move.target.substr(1);