{"action":"created","comment":{"url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/pulls/comments/40300085","id":40300085,"diff_hunk":"@@ -1002,18 +997,23 @@\n \t\t\t\ttext += '</div></div>';\n \t\t\t\tbreak;\n \n-\t\t\tcase 'pokemon':\n-\t\t\t\tvar pokemon = this.battle.getPokemon(thing);\n+\t\t\tcase 'pokemon': // Tooltip for active pokemon. Initially we select the spectator/opponent sees view.\n+\t\t\t\tvar side = this.battle[thing.slice(0, -1) + \"Side\"];\n+\t\t\t\tvar pokemon = side.active[thing.slice(-1)];\n \t\t\t\tif (!pokemon) return;\n \t\t\t\t/* falls through */\n-\t\t\tcase 'sidepokemon':\n+\t\t\tcase 'sidepokemon': // Tooltip for switching pokemon; myPokemon contains the latest server state.\n \t\t\t\tvar battlePokemon;\n \t\t\t\tvar myPokemon;\n \t\t\t\tif (this.myPokemon) {\n \t\t\t\t\tif (!pokemon) {\n+\t\t\t\t\t\t// We didn't fall through, so we're switching. Just show the server state.\n \t\t\t\t\t\tpokemon = this.myPokemon[parseInt(thing)];\n \t\t\t\t\t\tbattlePokemon = this.battle.getPokemon('other: old: ' + pokemon.ident, pokemon.details);\n \t\t\t\t\t} else if (pokemon.side === this.battle.mySide) {","path":"js/client-battle.js","position":87,"original_position":87,"commit_id":"d1ddef0e03c3dc3cfb92d4b8d3071d9ea0a34a73","original_commit_id":"d1ddef0e03c3dc3cfb92d4b8d3071d9ea0a34a73","user":{"login":"urkerab","id":13849513,"avatar_url":"https://avatars.githubusercontent.com/u/13849513?v=3","gravatar_id":"","url":"https://api.github.com/users/urkerab","html_url":"https://github.com/urkerab","followers_url":"https://api.github.com/users/urkerab/followers","following_url":"https://api.github.com/users/urkerab/following{/other_user}","gists_url":"https://api.github.com/users/urkerab/gists{/gist_id}","starred_url":"https://api.github.com/users/urkerab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urkerab/subscriptions","organizations_url":"https://api.github.com/users/urkerab/orgs","repos_url":"https://api.github.com/users/urkerab/repos","events_url":"https://api.github.com/users/urkerab/events{/privacy}","received_events_url":"https://api.github.com/users/urkerab/received_events","type":"User","site_admin":false},"body":"Sorry, I'm not sure what you mean there. There are several cases:\r\n- Choosing one of your own Pokémon for a switch (or targeting an ally in doubles/triples). This uses the `'sidepokemon'` case, and controlsShown is always true. This case uses the noted line and none of the other cases do.\r\n- Targeting one of your opponent's Pokémon in doubles/triples. This uses the `'pokemoin'` case, and controlsShown is always true, but it's your opponent, so it makes no difference.\r\n- Hovering over your opponent's Pokémon in the battle. This uses the `'pokemon'` case, and controlsShown may or may not be true, but it's your opponent, so it makes no difference.\r\n- Hovering over your own Pokémon in the battle. This uses the `'pokemon'` case, and controlsShown may or may not be true. The `else if` part of the noted condition takes effect allowing the stats to be shown (and the ability even if the opponent doesn't know it). The current code assumes that if the opponent knows your Ability (e.g. due to in-turn activation, Skill Swap, Entrainment, Worry Seed etc.) then that's always at least as up-to-date as the server, so it doesn't check `controlsShown`.","created_at":"2015-09-24T09:26:28Z","updated_at":"2015-09-24T09:26:28Z","html_url":"https://github.com/Zarel/Pokemon-Showdown-Client/pull/476#discussion_r40300085","pull_request_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/pulls/476","_links":{"self":{"href":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/pulls/comments/40300085"},"html":{"href":"https://github.com/Zarel/Pokemon-Showdown-Client/pull/476#discussion_r40300085"},"pull_request":{"href":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/pulls/476"}}},"pull_request":{"url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/pulls/476","id":45170127,"html_url":"https://github.com/Zarel/Pokemon-Showdown-Client/pull/476","diff_url":"https://github.com/Zarel/Pokemon-Showdown-Client/pull/476.diff","patch_url":"https://github.com/Zarel/Pokemon-Showdown-Client/pull/476.patch","issue_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/issues/476","number":476,"state":"open","locked":false,"title":"Make tooltips work in instant replays","user":{"login":"urkerab","id":13849513,"avatar_url":"https://avatars.githubusercontent.com/u/13849513?v=3","gravatar_id":"","url":"https://api.github.com/users/urkerab","html_url":"https://github.com/urkerab","followers_url":"https://api.github.com/users/urkerab/followers","following_url":"https://api.github.com/users/urkerab/following{/other_user}","gists_url":"https://api.github.com/users/urkerab/gists{/gist_id}","starred_url":"https://api.github.com/users/urkerab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urkerab/subscriptions","organizations_url":"https://api.github.com/users/urkerab/orgs","repos_url":"https://api.github.com/users/urkerab/repos","events_url":"https://api.github.com/users/urkerab/events{/privacy}","received_events_url":"https://api.github.com/users/urkerab/received_events","type":"User","site_admin":false},"body":"During an instant replay the controls are not updated and therefore the tooltips don't work, unless you are lucky and the battle was forfeited with all the Pokémon still playing.\r\n\r\nBy setting up the tooltips prior to the start we can ensure that they will always work. I had to change the way the Pokémon is selected as `Battle.getPokemon` works on the logical rather than the visual sides and also if you give it a fainted Pokémon it will happily substitute another Pokémon for you. The new code will automatically ignore fainted Pokémon or Pokémon that are out of range (e.g. position 2 in singles).\r\n\r\nThe `thing` for the `'pokemon'` tooltip is now a concatenation of either `'my'` or `'your'` depending on the visual side and the integer offset in the active array, thus in doubles the possible values are `my0`, `my1`, `your0` and `your1`.\r\n\r\nThe tooltips are created with a loop to make it easier to see what's going on, rather than using a large unreadable block of HTML.\r\n\r\nThere is one other place that field tooltips are used and that is when selecting the target of a move in doubles or triples, so I have adapted that case accordingly.","created_at":"2015-09-16T13:20:44Z","updated_at":"2015-09-24T09:26:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f76d14171efa527b95b37697834da1c6a387ad87","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/pulls/476/commits","review_comments_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/pulls/476/comments","review_comment_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/issues/476/comments","statuses_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/statuses/d1ddef0e03c3dc3cfb92d4b8d3071d9ea0a34a73","head":{"label":"urkerab:instant-replay-tooltips","ref":"instant-replay-tooltips","sha":"d1ddef0e03c3dc3cfb92d4b8d3071d9ea0a34a73","user":{"login":"urkerab","id":13849513,"avatar_url":"https://avatars.githubusercontent.com/u/13849513?v=3","gravatar_id":"","url":"https://api.github.com/users/urkerab","html_url":"https://github.com/urkerab","followers_url":"https://api.github.com/users/urkerab/followers","following_url":"https://api.github.com/users/urkerab/following{/other_user}","gists_url":"https://api.github.com/users/urkerab/gists{/gist_id}","starred_url":"https://api.github.com/users/urkerab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urkerab/subscriptions","organizations_url":"https://api.github.com/users/urkerab/orgs","repos_url":"https://api.github.com/users/urkerab/repos","events_url":"https://api.github.com/users/urkerab/events{/privacy}","received_events_url":"https://api.github.com/users/urkerab/received_events","type":"User","site_admin":false},"repo":{"id":40965364,"name":"Pokemon-Showdown-Client","full_name":"urkerab/Pokemon-Showdown-Client","owner":{"login":"urkerab","id":13849513,"avatar_url":"https://avatars.githubusercontent.com/u/13849513?v=3","gravatar_id":"","url":"https://api.github.com/users/urkerab","html_url":"https://github.com/urkerab","followers_url":"https://api.github.com/users/urkerab/followers","following_url":"https://api.github.com/users/urkerab/following{/other_user}","gists_url":"https://api.github.com/users/urkerab/gists{/gist_id}","starred_url":"https://api.github.com/users/urkerab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urkerab/subscriptions","organizations_url":"https://api.github.com/users/urkerab/orgs","repos_url":"https://api.github.com/users/urkerab/repos","events_url":"https://api.github.com/users/urkerab/events{/privacy}","received_events_url":"https://api.github.com/users/urkerab/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/urkerab/Pokemon-Showdown-Client","description":"The client for Pokémon Showdown","fork":true,"url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client","forks_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/forks","keys_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/teams","hooks_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/hooks","issue_events_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/issues/events{/number}","events_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/events","assignees_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/assignees{/user}","branches_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/branches{/branch}","tags_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/tags","blobs_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/git/refs{/sha}","trees_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/statuses/{sha}","languages_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/languages","stargazers_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/stargazers","contributors_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/contributors","subscribers_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/subscribers","subscription_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/subscription","commits_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/commits{/sha}","git_commits_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/git/commits{/sha}","comments_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/comments{/number}","issue_comment_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/issues/comments{/number}","contents_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/contents/{+path}","compare_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/merges","archive_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/downloads","issues_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/issues{/number}","pulls_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/pulls{/number}","milestones_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/milestones{/number}","notifications_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/labels{/name}","releases_url":"https://api.github.com/repos/urkerab/Pokemon-Showdown-Client/releases{/id}","created_at":"2015-08-18T10:18:45Z","updated_at":"2015-08-18T10:18:46Z","pushed_at":"2015-09-24T08:53:25Z","git_url":"git://github.com/urkerab/Pokemon-Showdown-Client.git","ssh_url":"git@github.com:urkerab/Pokemon-Showdown-Client.git","clone_url":"https://github.com/urkerab/Pokemon-Showdown-Client.git","svn_url":"https://github.com/urkerab/Pokemon-Showdown-Client","homepage":"http://pokemonshowdown.com","size":24213,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Zarel:master","ref":"master","sha":"0b3b09e987ee597cc5fc5a371a1fb4d6413d8f98","user":{"login":"Zarel","id":551184,"avatar_url":"https://avatars.githubusercontent.com/u/551184?v=3","gravatar_id":"","url":"https://api.github.com/users/Zarel","html_url":"https://github.com/Zarel","followers_url":"https://api.github.com/users/Zarel/followers","following_url":"https://api.github.com/users/Zarel/following{/other_user}","gists_url":"https://api.github.com/users/Zarel/gists{/gist_id}","starred_url":"https://api.github.com/users/Zarel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zarel/subscriptions","organizations_url":"https://api.github.com/users/Zarel/orgs","repos_url":"https://api.github.com/users/Zarel/repos","events_url":"https://api.github.com/users/Zarel/events{/privacy}","received_events_url":"https://api.github.com/users/Zarel/received_events","type":"User","site_admin":false},"repo":{"id":7786818,"name":"Pokemon-Showdown-Client","full_name":"Zarel/Pokemon-Showdown-Client","owner":{"login":"Zarel","id":551184,"avatar_url":"https://avatars.githubusercontent.com/u/551184?v=3","gravatar_id":"","url":"https://api.github.com/users/Zarel","html_url":"https://github.com/Zarel","followers_url":"https://api.github.com/users/Zarel/followers","following_url":"https://api.github.com/users/Zarel/following{/other_user}","gists_url":"https://api.github.com/users/Zarel/gists{/gist_id}","starred_url":"https://api.github.com/users/Zarel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zarel/subscriptions","organizations_url":"https://api.github.com/users/Zarel/orgs","repos_url":"https://api.github.com/users/Zarel/repos","events_url":"https://api.github.com/users/Zarel/events{/privacy}","received_events_url":"https://api.github.com/users/Zarel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Zarel/Pokemon-Showdown-Client","description":"The client for Pokémon Showdown","fork":false,"url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client","forks_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/forks","keys_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/teams","hooks_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/hooks","issue_events_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/issues/events{/number}","events_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/events","assignees_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/assignees{/user}","branches_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/branches{/branch}","tags_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/tags","blobs_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/git/refs{/sha}","trees_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/statuses/{sha}","languages_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/languages","stargazers_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/stargazers","contributors_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/contributors","subscribers_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/subscribers","subscription_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/subscription","commits_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/commits{/sha}","git_commits_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/git/commits{/sha}","comments_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/comments{/number}","issue_comment_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/issues/comments{/number}","contents_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/contents/{+path}","compare_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/merges","archive_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/downloads","issues_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/issues{/number}","pulls_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/pulls{/number}","milestones_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/milestones{/number}","notifications_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/labels{/name}","releases_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/releases{/id}","created_at":"2013-01-24T00:09:53Z","updated_at":"2015-09-16T02:37:24Z","pushed_at":"2015-09-24T08:53:32Z","git_url":"git://github.com/Zarel/Pokemon-Showdown-Client.git","ssh_url":"git@github.com:Zarel/Pokemon-Showdown-Client.git","clone_url":"https://github.com/Zarel/Pokemon-Showdown-Client.git","svn_url":"https://github.com/Zarel/Pokemon-Showdown-Client","homepage":"http://pokemonshowdown.com","size":31525,"stargazers_count":82,"watchers_count":82,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":155,"mirror_url":null,"open_issues_count":42,"forks":155,"open_issues":42,"watchers":82,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/pulls/476"},"html":{"href":"https://github.com/Zarel/Pokemon-Showdown-Client/pull/476"},"issue":{"href":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/issues/476"},"comments":{"href":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/issues/476/comments"},"review_comments":{"href":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/pulls/476/comments"},"review_comment":{"href":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/pulls/476/commits"},"statuses":{"href":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/statuses/d1ddef0e03c3dc3cfb92d4b8d3071d9ea0a34a73"}}}}