Skip to content

Implementing Double Faced Cards

Leandro Doctors edited this page Feb 4, 2020 · 1 revision

Introduction

The main idea of two-faced cards implementation is each side being implemented as separated single card and then connected to each other. Only day cards are displayed in the game (deck editor, collection viewer, game). Night cards are used for transformation and for copying stats and abilities to day card only.

Note: as collector number for such cards uses letters ('a' and 'b'), not to change all other cards to use String, it was decided to add 1000 to day card number to form the night card. Here is an example:

  • Original: Thraben Sentry - 38a Thraben Militia - 38b
  • In MAGE: Thraben Sentry - 38 Thraben Militia - 1038

Details

The steps for implementing a double faced card are as follows (we'll use Thraben Sentry / Thraben Militia for this example):

  1. Generate both card classes using gen-card.pl one by one. You'll get two classes: ThrabenSentry.java, ThrabenMilitia.java
  2. Add the following lines to day card (Thraben Sentry):
this.canTransform = true;
this.secondSideCard = new ThrabenMilitia(ownerId);
  1. Add the transform ability to day card:
this.addAbility(new TransformAbility());
  1. Change the card number in the night card to day card's number + 1000:
super(ownerId, 1038, ...
  1. Add the following lines to night card (Thraben Militia):
this.nightCard = true;
this.canTransform = true;
  1. Add triggered abilities to transform the card. Use TransformSourceEffect() that is one shot effect to transform the card from day state to night and vice versa.
Clone this wiki locally