mirror of
https://github.com/magefree/mage.git
synced 2026-09-11 11:58:30 +02:00
Page:
Implementing Double Faced Cards
Pages
AI Players
Changelog 1.4.52‐V5‐beta8
Changelog 1.4.52‐V5‐beta9
Changelog 1.4.52‐V6‐beta1
Changelog 1.4.52‐V6‐beta2
Changelog 1.4.52‐V6‐beta3
Changelog 1.4.52‐V6‐beta4
Changelog 1.4.52‐V6‐beta5
Changelog 1.4.52‐V6‐beta6
Changelog 1.4.52‐V6‐beta7
Changelog 1.4.52‐V6‐beta8
Changelog 1.4.52‐V6‐beta9
Changelog 1.4.52‐V7‐beta1
Changelog 1.4.52‐V7‐beta2
Changelog 1.4.52‐V7‐beta3
Changelog 1.4.52‐V7‐beta4
Changelog 1.4.52‐V7‐beta5
Changelog 1.4.52‐V7‐beta6
Changelog 1.4.52‐V7‐beta7
Changelog 1.4.52‐V7‐beta8
Changelog 1.4.52‐V7‐beta9
Changelog 1.4.52‐V8‐beta1
Changelog for next release
Code Templates
Creating a new release for xmage
DEv Release 2014_09_04 and older
Dev Release 2014_09_13
Dev Release 2014_09_26
Dev Release 2014_10_05
Dev Release 2014_10_18
Dev Release 2014_11_01
Dev Release 2014_11_08
Dev Release 2014_11_29
Dev Release 2015_02_07
Dev Release 2015_03_14
Developer Getting Started
Developer HOWTO Guides
Development HOWTO Guides
Development Testing Tools
Development Workflow
Home
Hosting an XMage server
Image test
Implementing Double Faced Cards
List of cards that will not be implemented on Xmage
Older Releases
Parse mtgsalvation spoiler data
Project Overview
Release 1.4.0
Release 1.4.1
Release 1.4.10
Release 1.4.11
Release 1.4.12
Release 1.4.13
Release 1.4.14
Release 1.4.15
Release 1.4.16
Release 1.4.17
Release 1.4.18
Release 1.4.19
Release 1.4.2
Release 1.4.20
Release 1.4.21
Release 1.4.22
Release 1.4.23
Release 1.4.24
Release 1.4.25
Release 1.4.26
Release 1.4.27
Release 1.4.28
Release 1.4.29
Release 1.4.3
Release 1.4.30
Release 1.4.31
Release 1.4.32
Release 1.4.33
Release 1.4.34
Release 1.4.35
Release 1.4.36
Release 1.4.37
Release 1.4.38
Release 1.4.39
Release 1.4.4
Release 1.4.40
Release 1.4.41
Release 1.4.42
Release 1.4.43
Release 1.4.44
Release 1.4.45
Release 1.4.46
Release 1.4.47
Release 1.4.48
Release 1.4.49
Release 1.4.5
Release 1.4.50
Release 1.4.53
Release 1.4.54
Release 1.4.55
Release 1.4.56
Release 1.4.57
Release 1.4.58
Release 1.4.59
Release 1.4.6
Release 1.4.60
Release 1.4.61
Release 1.4.7
Release 1.4.8
Release 1.4.9
Release changes
Server configuration
Set implementation list
Setting up your Development Environment
Supported deck formats
No results
1
Implementing Double Faced Cards
Leandro Doctors edited this page 2020-02-04 20:29:27 -03:00
Table of contents
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):
- Generate both card classes using gen-card.pl one by one. You'll get two classes: ThrabenSentry.java, ThrabenMilitia.java
- Add the following lines to day card (Thraben Sentry):
this.canTransform = true;
this.secondSideCard = new ThrabenMilitia(ownerId);
- Add the transform ability to day card:
this.addAbility(new TransformAbility());
- Change the card number in the night card to day card's number + 1000:
super(ownerId, 1038, ...
- Add the following lines to night card (Thraben Militia):
this.nightCard = true;
this.canTransform = true;
- 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.