From 0a716ea4be1c2bc323db4ffe9ceb8e3ef43cf9fa Mon Sep 17 00:00:00 2001 From: Slayer95 Date: Wed, 11 Jun 2014 22:19:24 -0500 Subject: [PATCH] Add fallback button for moves lacking valid targets Such as Helping Hand with no partner or, while isolated, moves that can only target adjacent foes. --- js/client-battle.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/js/client-battle.js b/js/client-battle.js index 2440c4501..ea0e013de 100644 --- a/js/client-battle.js +++ b/js/client-battle.js @@ -304,6 +304,7 @@ var myActive = this.battle.mySide.active; var yourActive = this.battle.yourSide.active; var yourSlot = yourActive.length-1-pos; + var anyValidTarget = false; for (var i = yourActive.length-1; i >= 0; i--) { var pokemon = yourActive[i]; @@ -319,6 +320,7 @@ } else if (disabled || pokemon.zerohp) { controls += ' '; } else { + anyValidTarget = true; var posString = ''; controls += ' '; } @@ -340,9 +342,14 @@ } else if (disabled || pokemon.zerohp) { controls += ' '; } else { + anyValidTarget = true; controls += ' '; } } + if (!anyValidTarget) { + controls += '
'; + controls += ''; + } controls += '
'; controls += ''; this.$controls.html(controls);