mirror of
https://github.com/magefree/mage.git
synced 2026-01-25 04:39:18 -08:00
refactor a few more cards to test some more possible situations
This commit is contained in:
parent
cb9f608fad
commit
0f25453898
11 changed files with 208 additions and 177 deletions
|
|
@ -2,10 +2,12 @@ package mage.cards;
|
|||
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.keyword.TransformAbility;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.target.Target;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
@ -16,6 +18,7 @@ public abstract class TransformingDoubleFacedCard extends CardImpl {
|
|||
|
||||
protected TransformingDoubleFacedCardHalfImpl leftHalfCard; // main card in all zone
|
||||
protected TransformingDoubleFacedCardHalfImpl rightHalfCard; // second side card, can be only in stack and battlefield zones
|
||||
private boolean finalized = false;
|
||||
|
||||
public TransformingDoubleFacedCard(
|
||||
UUID ownerId, CardSetInfo setInfo,
|
||||
|
|
@ -57,6 +60,10 @@ public abstract class TransformingDoubleFacedCard extends CardImpl {
|
|||
super(card);
|
||||
this.leftHalfCard = card.leftHalfCard.copy();
|
||||
this.rightHalfCard = card.rightHalfCard.copy();
|
||||
if (!card.finalized) {
|
||||
throw new IllegalStateException("Error, finalizeDFC needs to be called");
|
||||
}
|
||||
this.finalized = true;
|
||||
}
|
||||
|
||||
public Card getLeftHalfCard() {
|
||||
|
|
@ -72,11 +79,24 @@ public abstract class TransformingDoubleFacedCard extends CardImpl {
|
|||
this.getCardType().addAll(this.getLeftHalfCard().getCardType());
|
||||
this.getSubtype().addAll(this.getLeftHalfCard().getSubtype());
|
||||
for (Ability ability : this.getLeftHalfCard().getAbilities()) {
|
||||
this.addAbility(ability);
|
||||
if (!ability.equals(this.getLeftHalfCard().getSpellAbility())) {
|
||||
this.addAbility(ability);
|
||||
}
|
||||
}
|
||||
if (!this.getAbilities().containsClass(TransformAbility.class)) {
|
||||
this.addAbility(new TransformAbility());
|
||||
}
|
||||
for (Effect effect : this.getLeftHalfCard().getSpellAbility().getEffects()) {
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
}
|
||||
for (Target target : this.getLeftHalfCard().getSpellAbility().getTargets()) {
|
||||
this.getSpellAbility().addTarget(target);
|
||||
}
|
||||
this.addAbility(new TransformAbility());
|
||||
this.power = this.getLeftHalfCard().getPower().copy();
|
||||
this.toughness = this.getLeftHalfCard().getToughness().copy();
|
||||
this.startingLoyalty = this.getLeftHalfCard().getStartingLoyalty();
|
||||
this.startingDefense = this.getLeftHalfCard().getStartingDefense();
|
||||
this.finalized = true;
|
||||
}
|
||||
|
||||
public static void copyToBackFace(TransformingDoubleFacedCard tdfc, Card card) {
|
||||
|
|
@ -85,8 +105,18 @@ public abstract class TransformingDoubleFacedCard extends CardImpl {
|
|||
card.getCardType().addAll(tdfc.getRightHalfCard().getCardType());
|
||||
card.getSubtype().addAll(tdfc.getRightHalfCard().getSubtype());
|
||||
for (Ability ability : tdfc.getRightHalfCard().getAbilities()) {
|
||||
card.addAbility(ability);
|
||||
if (!ability.equals(tdfc.getRightHalfCard().getSpellAbility())) {
|
||||
card.addAbility(ability);
|
||||
}
|
||||
}
|
||||
for (Effect effect : tdfc.getRightHalfCard().getSpellAbility().getEffects()) {
|
||||
card.getSpellAbility().addEffect(effect);
|
||||
}
|
||||
for (Target target : tdfc.getRightHalfCard().getSpellAbility().getTargets()) {
|
||||
card.getSpellAbility().addTarget(target);
|
||||
}
|
||||
card.setPT(tdfc.getRightHalfCard().getPower().copy(), tdfc.getRightHalfCard().getToughness().copy());
|
||||
card.setStartingLoyalty(tdfc.getRightHalfCard().getStartingLoyalty());
|
||||
card.setStartingDefense(tdfc.getRightHalfCard().getStartingDefense());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue