{"action":"closed","issue":{"url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/issues/1148","repository_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client","labels_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/issues/1148/labels{/name}","comments_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/issues/1148/comments","events_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown-Client/issues/1148/events","html_url":"https://github.com/Zarel/Pokemon-Showdown-Client/issues/1148","id":364882671,"node_id":"MDU6SXNzdWUzNjQ4ODI2NzE=","number":1148,"title":"Support headless client","user":{"login":"yuzeh","id":351023,"node_id":"MDQ6VXNlcjM1MTAyMw==","avatar_url":"https://avatars2.githubusercontent.com/u/351023?v=4","gravatar_id":"","url":"https://api.github.com/users/yuzeh","html_url":"https://github.com/yuzeh","followers_url":"https://api.github.com/users/yuzeh/followers","following_url":"https://api.github.com/users/yuzeh/following{/other_user}","gists_url":"https://api.github.com/users/yuzeh/gists{/gist_id}","starred_url":"https://api.github.com/users/yuzeh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yuzeh/subscriptions","organizations_url":"https://api.github.com/users/yuzeh/orgs","repos_url":"https://api.github.com/users/yuzeh/repos","events_url":"https://api.github.com/users/yuzeh/events{/privacy}","received_events_url":"https://api.github.com/users/yuzeh/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-09-28T13:10:59Z","updated_at":"2018-10-16T07:49:00Z","closed_at":"2018-10-16T07:49:00Z","author_association":"CONTRIBUTOR","body":"Picking up where we left off on #1137: I'm interested in implementing a headless client in the PSC repo.\r\n\r\nThis will let other projects use the battle state inference code that's already been implemented in this repo in a modular fashion. More importantly, it allows for *unit testing* of the battle state inference code (there doesn't seem to be any such testing currently).\r\n\r\nMy vision of how this will work:\r\n\r\n* Per https://github.com/Zarel/Pokemon-Showdown-Client/pull/1137#issuecomment-410474024, `new Battle(null, null)` (or `new Battle()`) creates a headless Battle object.\r\n* On constructor call, a stub `BattleScene` object is created that basically no-ops all of its methods. This can be done in at least two ways:\r\n    * Common interface between a handwritten `StubBattleScene` class (along with a handwritten `StubPokemonSprite`) and the existing `BattleScene` class, or\r\n    * ES6 `Proxy`.\r\n* Unit tests are written to demonstrate how this should be used. I'm not quite sure myself how this is supposed to be done, but I've had luck doing the following:\r\n```js\r\nbattle.activityQueue.push(message);\r\nbattle.play();\r\nbattle.fastForwardTo(-1);\r\n```\r\n\r\nIf this sounds good, I can start working on a PR."}}
{"actor":{"display_login":"Zarel"}}