Some spelling changes to SplttCards.

This commit is contained in:
LevelX2 2013-05-02 00:09:43 +02:00
parent ad99fcad23
commit 533c0a028e
3 changed files with 72 additions and 72 deletions

View file

@ -58,16 +58,16 @@ public class GiveTake extends SplitCard<GiveTake> {
this.color.setBlue(true); this.color.setBlue(true);
// Give // Give
Card leftHalvCard = this.createLeftHalveCard("Give", "{2}{G}"); Card leftHalfCard = this.createLeftHalfCard("Give", "{2}{G}");
// Put three +1/+1 counters on target creature. // Put three +1/+1 counters on target creature.
leftHalvCard.getSpellAbility().addEffect(new AddCountersTargetEffect(CounterType.P1P1.createInstance(3))); leftHalfCard.getSpellAbility().addEffect(new AddCountersTargetEffect(CounterType.P1P1.createInstance(3)));
leftHalvCard.getSpellAbility().addTarget(new TargetCreaturePermanent(true)); leftHalfCard.getSpellAbility().addTarget(new TargetCreaturePermanent(true));
// Take // Take
Card rightHalvCard = this.createRightHalveCard("Take", "{2}{U}"); Card rightHalfCard = this.createRightHalfCard("Take", "{2}{U}");
// Remove all +1/+1 counters from target creature you control. Draw that many cards. // Remove all +1/+1 counters from target creature you control. Draw that many cards.
rightHalvCard.getSpellAbility().addEffect(new TakeEffect()); rightHalfCard.getSpellAbility().addEffect(new TakeEffect());
rightHalvCard.getSpellAbility().addTarget(new TargetControlledCreaturePermanent(true)); rightHalfCard.getSpellAbility().addTarget(new TargetControlledCreaturePermanent(true));
// Fuse (You may cast one or both halves of this card from your hand.) // Fuse (You may cast one or both halves of this card from your hand.)

View file

@ -55,17 +55,17 @@ public class AssaultBattery extends SplitCard<AssaultBattery> {
this.color.setGreen(true); this.color.setGreen(true);
// Assault // Assault
Card leftHalvCard = this.createLeftHalveCard("Assault", "{R}"); Card leftHalfCard = this.createLeftHalfCard("Assault", "{R}");
// Assault deals 2 damage to target creature or player. // Assault deals 2 damage to target creature or player.
Effect effect = new DamageTargetEffect(2); Effect effect = new DamageTargetEffect(2);
effect.setText("Assault deals 2 damage to target creature or player"); effect.setText("Assault deals 2 damage to target creature or player");
leftHalvCard.getSpellAbility().addEffect(effect); leftHalfCard.getSpellAbility().addEffect(effect);
leftHalvCard.getSpellAbility().addTarget(new TargetCreatureOrPlayer(true)); leftHalfCard.getSpellAbility().addTarget(new TargetCreatureOrPlayer(true));
// Battery // Battery
Card rightHalvCard = this.createRightHalveCard("Battery", "{3}{G}"); Card rightHalfCard = this.createRightHalfCard("Battery", "{3}{G}");
// Put a 3/3 green Elephant creature token onto the battlefield. // Put a 3/3 green Elephant creature token onto the battlefield.
rightHalvCard.getSpellAbility().addEffect(new CreateTokenEffect(new ElephantToken())); rightHalfCard.getSpellAbility().addEffect(new CreateTokenEffect(new ElephantToken()));
} }

View file

@ -50,13 +50,13 @@ import mage.watchers.Watcher;
public abstract class SplitCard<T extends SplitCard<T>> extends CardImpl<T> { public abstract class SplitCard<T extends SplitCard<T>> extends CardImpl<T> {
public enum ActiveCardHalve { public enum ActiveCardHalf {
NONE, LEFT, RIGHT NONE, LEFT, RIGHT
} }
private Card leftHalveCard; private Card leftHalfCard;
private Card rightHalveCard; private Card rightHalfCard;
private ActiveCardHalve activeCardHalve = ActiveCardHalve.NONE; private ActiveCardHalf activeCardHalf = ActiveCardHalf.NONE;
public SplitCard(UUID ownerId, int cardNumber, String name, Rarity rarity, CardType[] cardTypes, String costs) { public SplitCard(UUID ownerId, int cardNumber, String name, Rarity rarity, CardType[] cardTypes, String costs) {
super(ownerId, cardNumber, name, rarity, cardTypes, costs); super(ownerId, cardNumber, name, rarity, cardTypes, costs);
@ -65,48 +65,48 @@ public abstract class SplitCard<T extends SplitCard<T>> extends CardImpl<T> {
public SplitCard(SplitCard card) { public SplitCard(SplitCard card) {
super(card); super(card);
this.leftHalveCard = card.leftHalveCard; this.leftHalfCard = card.leftHalfCard;
this.rightHalveCard = card.rightHalveCard; this.rightHalfCard = card.rightHalfCard;
this.activeCardHalve = card.activeCardHalve; this.activeCardHalf = card.activeCardHalf;
} }
public Card createLeftHalveCard (String name, String costs) { public Card createLeftHalfCard (String name, String costs) {
CardType[] cardTypes = new CardType[getCardType().size()]; CardType[] cardTypes = new CardType[getCardType().size()];
this.getCardType().toArray(cardTypes); this.getCardType().toArray(cardTypes);
leftHalveCard = new leftHalveCard(this.getOwnerId(), this.getCardNumber(), name, this.rarity, cardTypes, costs); leftHalfCard = new leftHalfCard(this.getOwnerId(), this.getCardNumber(), name, this.rarity, cardTypes, costs);
leftHalveCard.getAbilities().setSourceId(objectId); leftHalfCard.getAbilities().setSourceId(objectId);
return leftHalveCard; return leftHalfCard;
} }
public Card createRightHalveCard (String name, String costs) { public Card createRightHalfCard (String name, String costs) {
CardType[] cardTypes = new CardType[getCardType().size()]; CardType[] cardTypes = new CardType[getCardType().size()];
this.getCardType().toArray(cardTypes); this.getCardType().toArray(cardTypes);
rightHalveCard = new leftHalveCard(this.getOwnerId(), this.getCardNumber(), name, this.rarity, cardTypes, costs); rightHalfCard = new leftHalfCard(this.getOwnerId(), this.getCardNumber(), name, this.rarity, cardTypes, costs);
rightHalveCard.getAbilities().setSourceId(objectId); rightHalfCard.getAbilities().setSourceId(objectId);
return rightHalveCard; return rightHalfCard;
} }
public Card getLeftHalveCard () { public Card getLeftHalfCard () {
return leftHalveCard; return leftHalfCard;
} }
public Card getRightHalveCard () { public Card getRightHalfCard () {
return rightHalveCard; return rightHalfCard;
} }
public ActiveCardHalve getActiveCardHalve() { public ActiveCardHalf getActiveCardHalf() {
return activeCardHalve; return activeCardHalf;
} }
@Override @Override
public boolean cast(Game game, Constants.Zone fromZone, SpellAbility ability, UUID controllerId) { public boolean cast(Game game, Constants.Zone fromZone, SpellAbility ability, UUID controllerId) {
if (super.cast(game, fromZone, ability, controllerId)) { if (super.cast(game, fromZone, ability, controllerId)) {
if (leftHalveCard.getAbilities().contains(ability)) { if (leftHalfCard.getAbilities().contains(ability)) {
activeCardHalve = ActiveCardHalve.LEFT; activeCardHalf = ActiveCardHalf.LEFT;
} else if (rightHalveCard.getAbilities().contains(ability)) { } else if (rightHalfCard.getAbilities().contains(ability)) {
activeCardHalve = ActiveCardHalve.RIGHT; activeCardHalf = ActiveCardHalf.RIGHT;
} else { } else {
activeCardHalve = ActiveCardHalve.NONE; activeCardHalf = ActiveCardHalf.NONE;
} }
return true; return true;
} }
@ -117,7 +117,7 @@ public abstract class SplitCard<T extends SplitCard<T>> extends CardImpl<T> {
public boolean moveToZone(Constants.Zone toZone, UUID sourceId, Game game, boolean flag, ArrayList<UUID> appliedEffects) { public boolean moveToZone(Constants.Zone toZone, UUID sourceId, Game game, boolean flag, ArrayList<UUID> appliedEffects) {
if (super.moveToZone(toZone, sourceId, game, flag, appliedEffects)) { if (super.moveToZone(toZone, sourceId, game, flag, appliedEffects)) {
if (!toZone.equals(Zone.STACK)) { if (!toZone.equals(Zone.STACK)) {
activeCardHalve = ActiveCardHalve.NONE; activeCardHalf = ActiveCardHalf.NONE;
} }
return true; return true;
} }
@ -127,7 +127,7 @@ public abstract class SplitCard<T extends SplitCard<T>> extends CardImpl<T> {
@Override @Override
public boolean moveToExile(UUID exileId, String name, UUID sourceId, Game game, ArrayList<UUID> appliedEffects) { public boolean moveToExile(UUID exileId, String name, UUID sourceId, Game game, ArrayList<UUID> appliedEffects) {
if(super.moveToExile(exileId, name, sourceId, game, appliedEffects)) { if(super.moveToExile(exileId, name, sourceId, game, appliedEffects)) {
activeCardHalve = ActiveCardHalve.NONE; activeCardHalf = ActiveCardHalf.NONE;
return true; return true;
} }
return false; return false;
@ -136,11 +136,11 @@ public abstract class SplitCard<T extends SplitCard<T>> extends CardImpl<T> {
@Override @Override
public Abilities<Ability> getAbilities(){ public Abilities<Ability> getAbilities(){
Abilities<Ability> allAbilites = new AbilitiesImpl<Ability>(); Abilities<Ability> allAbilites = new AbilitiesImpl<Ability>();
if (activeCardHalve.equals(ActiveCardHalve.NONE) || activeCardHalve.equals(ActiveCardHalve.LEFT)) { if (activeCardHalf.equals(ActiveCardHalf.NONE) || activeCardHalf.equals(ActiveCardHalf.LEFT)) {
allAbilites.addAll(leftHalveCard.getAbilities()); allAbilites.addAll(leftHalfCard.getAbilities());
} }
if (activeCardHalve.equals(ActiveCardHalve.NONE) || activeCardHalve.equals(ActiveCardHalve.RIGHT)) { if (activeCardHalf.equals(ActiveCardHalf.NONE) || activeCardHalf.equals(ActiveCardHalf.RIGHT)) {
allAbilites.addAll(rightHalveCard.getAbilities()); allAbilites.addAll(rightHalfCard.getAbilities());
} }
for (Ability ability: super.getAbilities()) { for (Ability ability: super.getAbilities()) {
if (ability instanceof FuseAbility) { if (ability instanceof FuseAbility) {
@ -152,11 +152,11 @@ public abstract class SplitCard<T extends SplitCard<T>> extends CardImpl<T> {
@Override @Override
public SpellAbility getSpellAbility() { public SpellAbility getSpellAbility() {
switch (activeCardHalve) { switch (activeCardHalf) {
case LEFT: case LEFT:
return leftHalveCard.getSpellAbility(); return leftHalfCard.getSpellAbility();
case RIGHT: case RIGHT:
return rightHalveCard.getSpellAbility(); return rightHalfCard.getSpellAbility();
} }
return null; return null;
} }
@ -164,16 +164,16 @@ public abstract class SplitCard<T extends SplitCard<T>> extends CardImpl<T> {
@Override @Override
public List<String> getRules() { public List<String> getRules() {
List<String> rules = new ArrayList<String>(); List<String> rules = new ArrayList<String>();
if (activeCardHalve.equals(ActiveCardHalve.NONE) || activeCardHalve.equals(ActiveCardHalve.LEFT)) { if (activeCardHalf.equals(ActiveCardHalf.NONE) || activeCardHalf.equals(ActiveCardHalf.LEFT)) {
rules.add(new StringBuilder("<b>").append(leftHalveCard.getName()).append("<b/>").toString()); rules.add(new StringBuilder("<b>").append(leftHalfCard.getName()).append("<b/>").toString());
rules.addAll(leftHalveCard.getRules()); rules.addAll(leftHalfCard.getRules());
} }
if (activeCardHalve.equals(ActiveCardHalve.NONE)) { if (activeCardHalf.equals(ActiveCardHalf.NONE)) {
rules.add("<br/>"); rules.add("<br/>");
} }
if (activeCardHalve.equals(ActiveCardHalve.NONE) || activeCardHalve.equals(ActiveCardHalve.RIGHT)) { if (activeCardHalf.equals(ActiveCardHalf.NONE) || activeCardHalf.equals(ActiveCardHalf.RIGHT)) {
rules.add(new StringBuilder("<b>").append(rightHalveCard.getName()).append("<b/>").toString()); rules.add(new StringBuilder("<b>").append(rightHalfCard.getName()).append("<b/>").toString());
rules.addAll(rightHalveCard.getRules()); rules.addAll(rightHalfCard.getRules());
} }
for (Ability ability: super.getAbilities()) { for (Ability ability: super.getAbilities()) {
@ -188,30 +188,30 @@ public abstract class SplitCard<T extends SplitCard<T>> extends CardImpl<T> {
@Override @Override
public void setControllerId(UUID controllerId) { public void setControllerId(UUID controllerId) {
abilities.setControllerId(controllerId); abilities.setControllerId(controllerId);
leftHalveCard.getAbilities().setControllerId(controllerId); leftHalfCard.getAbilities().setControllerId(controllerId);
rightHalveCard.getAbilities().setControllerId(controllerId); rightHalfCard.getAbilities().setControllerId(controllerId);
} }
@Override @Override
public void setOwnerId(UUID ownerId) { public void setOwnerId(UUID ownerId) {
this.ownerId = ownerId; this.ownerId = ownerId;
abilities.setControllerId(ownerId); abilities.setControllerId(ownerId);
leftHalveCard.getAbilities().setControllerId(ownerId); leftHalfCard.getAbilities().setControllerId(ownerId);
leftHalveCard.setOwnerId(ownerId); leftHalfCard.setOwnerId(ownerId);
rightHalveCard.getAbilities().setControllerId(ownerId); rightHalfCard.getAbilities().setControllerId(ownerId);
rightHalveCard.setOwnerId(ownerId); rightHalfCard.setOwnerId(ownerId);
} }
@Override @Override
public List<Watcher> getWatchers() { public List<Watcher> getWatchers() {
List<Watcher> allWatchers = new ArrayList<Watcher>(); List<Watcher> allWatchers = new ArrayList<Watcher>();
switch (activeCardHalve) { switch (activeCardHalf) {
case LEFT: case LEFT:
allWatchers.addAll(leftHalveCard.getWatchers()); allWatchers.addAll(leftHalfCard.getWatchers());
break; break;
case RIGHT: case RIGHT:
allWatchers.addAll(rightHalveCard.getWatchers()); allWatchers.addAll(rightHalfCard.getWatchers());
break; break;
} }
return allWatchers; return allWatchers;
@ -224,37 +224,37 @@ public abstract class SplitCard<T extends SplitCard<T>> extends CardImpl<T> {
/* /*
* The left side card of the split card * The left side card of the split card
*/ */
class leftHalveCard extends CardImpl<leftHalveCard> { class leftHalfCard extends CardImpl<leftHalfCard> {
public leftHalveCard(UUID ownerId, int cardNumber, String name, Rarity rarity, CardType[] cardTypes, String costs) { public leftHalfCard(UUID ownerId, int cardNumber, String name, Rarity rarity, CardType[] cardTypes, String costs) {
super(ownerId, cardNumber, name, rarity, cardTypes, costs); super(ownerId, cardNumber, name, rarity, cardTypes, costs);
} }
public leftHalveCard(final leftHalveCard card) { public leftHalfCard(final leftHalfCard card) {
super(card); super(card);
} }
@Override @Override
public leftHalveCard copy() { public leftHalfCard copy() {
return new leftHalveCard(this); return new leftHalfCard(this);
} }
} }
/* /*
* The right side card of the split card * The right side card of the split card
*/ */
class rightHalveCard extends CardImpl<rightHalveCard> { class rightHalfCard extends CardImpl<rightHalfCard> {
public rightHalveCard(UUID ownerId, int cardNumber, String name, Rarity rarity, CardType[] cardTypes, String costs) { public rightHalfCard(UUID ownerId, int cardNumber, String name, Rarity rarity, CardType[] cardTypes, String costs) {
super(ownerId, cardNumber, name, rarity, cardTypes, costs); super(ownerId, cardNumber, name, rarity, cardTypes, costs);
} }
public rightHalveCard(final rightHalveCard card) { public rightHalfCard(final rightHalfCard card) {
super(card); super(card);
} }
@Override @Override
public rightHalveCard copy() { public rightHalfCard copy() {
return new rightHalveCard(this); return new rightHalfCard(this);
} }
} }