Page MenuHomeYugipedia

Rework monster types code in CT2 and deploy it to {{Anime card}} et al.
Open, NormalPublic


This has been a very long time coming. The monster types-related code in CT2 has always sucked horribly; when {{Anime card}} was written, the opportunity was taken to rework the code somewhat. However, this reworked code is still positional in nature (there's a single types parameter, but its value is split into type, type2, etc. and handled in that way), and none of the reworked code was ever backported to CT2.

Instead, the code should be rewritten to match and operate on monster types according to classification, which should somewhat simplify existing code and make it significantly easier to add new functionality. I actually started on this a couple of weeks ago, but didn't get very far and lost my work when my computer restarted.

The scheme I have in mind is approximately as follows: add a types parameter; if type, type2, etc. are used instead, treat them as a single types value. This parameter/value gets stored in a @types array, which is #arrayintersected with arrays holding Types, Abilities, monster types (frame colors), and monster subtypes, as well as checked for the special-case Pendulum and Effect Monster types (any others?). From here, the rest of the template code is converted as needed to make use of the results of these comparisons.

Potential sticking points include how to handle unknown values (not necessarily such a problem for CT2, but it will definitely be an issue for the anime/manga templates), and how to preserve weird orders (this can be done by a final #arrayintersect where the initial input is intersected with the final array of values, though this does mean we'd have to be really careful that all initial values make it through to the final array; see the code of Template:Card info links for an example).

After this is worked out for CT2 and a reasonable amount of time has passed for any potential bugs to be shaken out from the new code, it should be ported to {{Anime card}} et al. In the long term, it should be ported to the central card-template module, so that individual card templates don't have to maintain separate copies that have to be kept in sync with each other.

Event Timeline

The template I come up with some years ago already deals with types that way (source (search for # Types:)). Subtemplates that deal with specific cases: monsters; non-monsters).

My template also deals with the sets in a more fashionable way. That also needs to be reworked for CT2.

Monster type codes are used to select the character types and to get the codes about the types so that we can change them. The scheme I have in my mind is uk best essays review so that we can re-written the monster code to classify them.