magarena / magarena-scripts-builder

Generate card templates from JSON card description
3 stars 1 forks source link

generating requires_groovy_code to make use of existing groovy scripts #6

Closed melvinzhang closed 7 years ago

melvinzhang commented 7 years ago

We have a large set of groovy scripts, most implement a single ability. I'm wondering whether we can leverage on them to further extend the capabilities of scripts-builder by allowing it to generate requires_groovy_code that refer to existing scripts.

The idea is to create an input file with the ability text (as current generated by scripts-builder) and card name (where the groovy script is found). scripts-builder loads this file during scripts generation and check if the ability text matches exactly the one from the file, it will include the card name in the requires_groovy_code property. This way we can get more cards added automatically.

A quick check in release/Magarena/scripts shows 152 cards that reference other cards, seems a bit low. I'm not sure if this effort will be worth it, hence putting it up here for some feedback. Tag @ShawnieBoy

ShawnieBoy commented 7 years ago

My first thought is that if an ability is appearing many times in groovy files, it would be a candidate to be included in MagicRuleEventAction or MagicAbility. Essentially go in the opposite direction, from groovy to engine.

melvinzhang commented 7 years ago

Of course, not sure how this applies here, I'm referring to new cards. New cards don't have groovy code but they sometimes can refer to existing ones. Right now you have to be very familiar with existing groovy code to know that a new cards is the same as that other card which we have groovy code for. I'm thinking we can perform this check in scripts-builder then insert the requires_groovy_property automatically.

ShawnieBoy commented 7 years ago

I think this would make more sense being added to the current error-card parser in Magarena than trying to add analysis to Scriptbuilder. Just the thought of trying to assemble that input file - it would be massive.

The parser can already return the text that doesn't match - Have it then check against implemented cards with the same text. Those that match would have groovy code in order for them to be implemented in the first place.

melvinzhang commented 7 years ago

Input file is done separately but creating it will be a pain. I like your solution of look at oracle text in an implemented card. I think I will be able to prototype something to suggest the requires field. Thanks for the insights :)