{"action":"created","issue":{"url":"https://api.github.com/repos/magarena/magarena/issues/1530","repository_url":"https://api.github.com/repos/magarena/magarena","labels_url":"https://api.github.com/repos/magarena/magarena/issues/1530/labels{/name}","comments_url":"https://api.github.com/repos/magarena/magarena/issues/1530/comments","events_url":"https://api.github.com/repos/magarena/magarena/issues/1530/events","html_url":"https://github.com/magarena/magarena/pull/1530","id":308416279,"number":1530,"title":"Improve and generalize script parsing","user":{"login":"bilbo2","id":684329,"avatar_url":"https://avatars1.githubusercontent.com/u/684329?v=4","gravatar_id":"","url":"https://api.github.com/users/bilbo2","html_url":"https://github.com/bilbo2","followers_url":"https://api.github.com/users/bilbo2/followers","following_url":"https://api.github.com/users/bilbo2/following{/other_user}","gists_url":"https://api.github.com/users/bilbo2/gists{/gist_id}","starred_url":"https://api.github.com/users/bilbo2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bilbo2/subscriptions","organizations_url":"https://api.github.com/users/bilbo2/orgs","repos_url":"https://api.github.com/users/bilbo2/repos","events_url":"https://api.github.com/users/bilbo2/events{/privacy}","received_events_url":"https://api.github.com/users/bilbo2/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-03-26T02:44:21Z","updated_at":"2018-03-26T07:19:19Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/magarena/magarena/pulls/1530","html_url":"https://github.com/magarena/magarena/pull/1530","diff_url":"https://github.com/magarena/magarena/pull/1530.diff","patch_url":"https://github.com/magarena/magarena/pull/1530.patch"},"body":"I noticed Thoughtbind (Counter target spell with converted mana cost 4 or less) that is unsupported\r\nis similar to Liquify (Counter target spell with converted mana cost 3 or less ...) which does not even need groovy and is supported.\r\n\r\nSo I just enabled the card ... and it does not work:\r\njava.lang.RuntimeException: unknown target filter \"spell with converted mana cost 4 or less\"\r\n\r\nI looked then at the system for parsing card rules ... and I decided to generify the system a bit and polish it a little (add Javadoc, add more supported cases, ..) and then create a merge request.\r\n\r\nThis should help whenever new cards are released, as more of them would be supported just \"out of the box\".\r\n\r\nSome variants are now generated for all spell/permanent/card colors or color combinations in a loop, also there is a template system with numeric parameters (usually there is just one, but you can have any number, for example template for #/# creature has two of them) that generates (on demand) specific filters for all possible numerical values.\r\n\r\nNo need to have separate rules for stuff like \"mana costs 1 and less\", \"2 and less\", \"3 and less\"... and other countable things. Just one \"mana cost # or less\" and thats it ... \r\n\r\nMight also help with cards like \"Alter Reality\" a bit in the future :)\r\n\r\nAside from the code change, this adds support for Thoughtbind ...\r\n\r\nBriefly tested (playing vs AI), seems to work fine. I am now running few hundred AI vs AI matches to test that there are no new crashes or other problems.\r\n"},"comment":{"url":"https://api.github.com/repos/magarena/magarena/issues/comments/376069391","html_url":"https://github.com/magarena/magarena/pull/1530#issuecomment-376069391","issue_url":"https://api.github.com/repos/magarena/magarena/issues/1530","id":376069391,"user":{"login":"melvinzhang","id":1620634,"avatar_url":"https://avatars2.githubusercontent.com/u/1620634?v=4","gravatar_id":"","url":"https://api.github.com/users/melvinzhang","html_url":"https://github.com/melvinzhang","followers_url":"https://api.github.com/users/melvinzhang/followers","following_url":"https://api.github.com/users/melvinzhang/following{/other_user}","gists_url":"https://api.github.com/users/melvinzhang/gists{/gist_id}","starred_url":"https://api.github.com/users/melvinzhang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/melvinzhang/subscriptions","organizations_url":"https://api.github.com/users/melvinzhang/orgs","repos_url":"https://api.github.com/users/melvinzhang/repos","events_url":"https://api.github.com/users/melvinzhang/events{/privacy}","received_events_url":"https://api.github.com/users/melvinzhang/received_events","type":"User","site_admin":false},"created_at":"2018-03-26T07:19:18Z","updated_at":"2018-03-26T07:19:18Z","author_association":"CONTRIBUTOR","body":"You can use `make debug`, it will run the game and attempt to load and parse all card scripts during the startup. Most groovy code that creates a target choice does it during the script load, so if there are any issues parsing the filter expression it would be caught at load time."}}
{"actor":{"display_login":"melvinzhang"}}