Merge origin/master

This commit is contained in:
fireshoes 2015-07-19 23:54:31 -05:00
commit caa9794e6b
8 changed files with 301 additions and 239 deletions

View file

@ -28,7 +28,6 @@
package mage.sets.magic2013;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
@ -39,6 +38,7 @@ import mage.abilities.costs.AlternativeCostSourceAbility;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.SplitCardHalf;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Layer;
@ -61,7 +61,6 @@ public class Omniscience extends CardImpl {
super(ownerId, 63, "Omniscience", Rarity.MYTHIC, new CardType[]{CardType.ENCHANTMENT}, "{7}{U}{U}{U}");
this.expansionSetCode = "M13";
// You may cast nonland cards from your hand without paying their mana costs.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new OmniscienceCastingEffect()));
}
@ -116,19 +115,18 @@ class OmniscienceCastingEffect extends ContinuousEffectImpl {
class IsBeingCastFromHandCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
@Override
public boolean apply(Game game, Ability source) {
MageObject object = game.getObject(source.getSourceId());
if(object instanceof Spell) {
Spell spell = (Spell) object;
return spell != null && spell.getFromZone() == Zone.HAND;
}
if(object instanceof Card) {
Card card = (Card)object;
return game.getPlayer(card.getOwnerId()).getHand().get(card.getId(), game) != null;
}
return false;
}
if (object instanceof SplitCardHalf) {
UUID splitCardId = ((Card) object).getMainCard().getId();
object = game.getObject(splitCardId);
}
if (object instanceof Spell) {
Spell spell = (Spell) object;
return spell.getFromZone() == Zone.HAND;
}
return false;
}
}

View file

@ -45,5 +45,7 @@ public class CombatTest extends CardTestPlayerBaseAI {
* AI is not blocking also if able if the damage the attacker will do will kill the AI
* AI is not able to block with two or more creatures one attacking creature to kill it. Even if none of the AI creatures will die
* AI attacks with a flyer even if opponent has a bigger flyer that kills AI
* Opponent of AI has only 1 life. AI has more creatures that can attack taht do at least 1 damage than opponent has blockers. Ai should attack with all needed creatures
*
*/
}

View file

@ -0,0 +1,47 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package org.mage.test.AI.basic;
import org.mage.test.serverside.base.CardTestPlayerBaseAI;
/**
*
* @author LevelX2
*/
public class TriggeredAbilityTest extends CardTestPlayerBaseAI {
/*
*
* TODO: Create tests and fix AI to be able to handle tested situations
*
* Tests to create:
* AI has the only one creature in play and plays a Gilt-Leaf Winnower. AI should select No if asked to use the destray effect becuase it targets the AI creature
*
*
*/
}

View file

@ -25,11 +25,11 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package org.mage.test.cards.single;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
@ -37,27 +37,24 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
*
* @author LevelX2
*/
public class OmniscienceTest extends CardTestPlayerBase {
/**
* Omniscience {7}{U}{U}{U}
* Omniscience {7}{U}{U}{U}
*
* Enchantment
* You may cast nonland cards from your hand without paying their mana costs.
* Enchantment You may cast nonland cards from your hand without paying
* their mana costs.
*
*/
@Test
public void testCastingCreature() {
addCard(Zone.BATTLEFIELD, playerA, "Omniscience");
/* player.getPlayable does not take alternate
casting costs in account, so for the test the mana has to be available
but won't be used
*/
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
/* player.getPlayable does not take alternate
casting costs in account, so for the test the mana has to be available
but won't be used
*/
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
addCard(Zone.HAND, playerA, "Silvercoat Lion");
@ -80,7 +77,7 @@ public class OmniscienceTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Island", 1);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
// Fire deals 2 damage divided as you choose among one or two target creatures and/or players.
addCard(Zone.HAND, playerA, "Fire // Ice");
@ -94,7 +91,7 @@ public class OmniscienceTest extends CardTestPlayerBase {
assertLife(playerA, 20);
assertLife(playerB, 18);
assertTapped("Island", false);
assertTapped("Mountain", false);
}
@ -104,9 +101,9 @@ public class OmniscienceTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Omniscience");
/* player.getPlayable does not take alternate
casting costs in account, so for the test the mana has to be available
but won't be used
*/
casting costs in account, so for the test the mana has to be available
but won't be used
*/
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
addCard(Zone.BATTLEFIELD, playerA, "Ornithopter", 1);
@ -124,12 +121,13 @@ public class OmniscienceTest extends CardTestPlayerBase {
assertGraveyardCount(playerA, "Ornithopter", 1);
assertTapped("Mountain", false);
}
/**
* Spell get cast for 0 if Omniscience is being in play.
* But with Trinisphere it costs at least {3}.
* Cost/alternate cost (Omniscience) + additional costs - cost reductions + minimum cost (Trinishpere) = total cost.
*/
/**
* Spell get cast for 0 if Omniscience is being in play. But with
* Trinisphere it costs at least {3}. Cost/alternate cost (Omniscience) +
* additional costs - cost reductions + minimum cost (Trinishpere) = total
* cost.
*/
@Test
public void testCastingWithTrinisphere() {
addCard(Zone.BATTLEFIELD, playerA, "Omniscience");
@ -153,4 +151,45 @@ public class OmniscienceTest extends CardTestPlayerBase {
assertPermanentCount(playerA, "Silvercoat Lion", 1);
assertTapped("Plains", true); // plains have to be tapped because {3} have to be paid
}
/**
* Omniscience is not allowing me to cast spells for free. I'm playing a
* Commander game against the Computer, if that helps.
*
* Edit: It's not letting me cast fused spells for free. Others seems to be
* working.
*/
@Test
@Ignore // targeting of fused/split spells not supported by thestplayer
public void testCastingFusedSpell() {
addCard(Zone.BATTLEFIELD, playerA, "Omniscience");
addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion");
addCard(Zone.BATTLEFIELD, playerB, "Pillarfield Ox");
/*
* Instant
* Far {1}{U} Return target creature to its owner's hand.
* Away{2}{B} Target player sacrifices a creature.
* Fuse (You may cast one or both halves of this card from your hand.)
*/
addCard(Zone.HAND, playerA, "Far // Away");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "fused Far // Away", "Silvercoat Lion^targetPlayer=PlayerB");
playerB.addTarget("Pillarfield Ox");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertHandCount(playerA, 1);
assertHandCount(playerB, 0);
assertGraveyardCount(playerA, "Far // Away", 1);
assertPermanentCount(playerB, "Pillarfield Ox", 0);
assertGraveyardCount(playerB, "Pillarfield Ox", 1);
}
}

View file

@ -1,31 +1,30 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.cards;
import java.util.ArrayList;
@ -33,7 +32,6 @@ import java.util.List;
import java.util.UUID;
import mage.MageObject;
import mage.Mana;
import mage.ObjectColor;
import mage.abilities.Abilities;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
@ -46,26 +44,45 @@ import mage.game.Game;
public interface Card extends MageObject {
UUID getOwnerId();
int getCardNumber();
Rarity getRarity();
void setOwnerId(UUID ownerId);
public Abilities<Ability> getAbilities(Game game);
void setSpellAbility(SpellAbility ability);
SpellAbility getSpellAbility();
List<String> getRules(); // gets base card rules
List<String> getRules(Game game); // gets card rules + in game modifications
String getExpansionSetCode();
String getTokenSetCode();
void setFaceDown(boolean value, Game game);
boolean isFaceDown(Game game);
boolean turnFaceUp(Game game, UUID playerId);
boolean turnFaceDown(Game game, UUID playerId);
boolean isFlipCard();
String getFlipCardName();
boolean isSplitCard();
boolean canTransform();
Card getSecondCardFace();
boolean isNightCard();
void assignNewId();
@ -74,14 +91,18 @@ public interface Card extends MageObject {
/**
* Moves the card to the specified zone
*
* @param zone
* @param sourceId
* @param game
* @param flag If zone
* <ul>
* <li>LIBRARY: <ul><li>true - put on top</li><li>false - put on bottom</li></ul></li>
* <li>BATTLEFIELD: <ul><li>true - tapped</li><li>false - untapped</li></ul></li>
* <li>GRAVEYARD: <ul><li>true - not from Battlefield</li><li>false - from Battlefield</li></ul></li>
* <li>LIBRARY: <ul><li>true - put on top</li><li>false - put on
* bottom</li></ul></li>
* <li>BATTLEFIELD: <ul><li>true - tapped</li><li>false -
* untapped</li></ul></li>
* <li>GRAVEYARD: <ul><li>true - not from Battlefield</li><li>false - from
* Battlefield</li></ul></li>
* </ul>
* @return true if card was moved to zone
*/
@ -91,6 +112,7 @@ public interface Card extends MageObject {
/**
* Moves the card to an exile zone
*
* @param exileId set to null for generic exile zone
* @param name used for exile zone with the specified exileId
* @param sourceId
@ -98,15 +120,19 @@ public interface Card extends MageObject {
* @return true if card was moved to zone
*/
boolean moveToExile(UUID exileId, String name, UUID sourceId, Game game);
boolean moveToExile(UUID exileId, String name, UUID sourceId, Game game, ArrayList<UUID> appliedEffects);
boolean cast(Game game, Zone fromZone, SpellAbility ability, UUID controllerId);
boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId);
boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped);
boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped, boolean facedown);
boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped, boolean facedown, ArrayList<UUID> appliedEffects);
List<Mana> getMana();
void build();
@ -116,24 +142,30 @@ public interface Card extends MageObject {
* @return true if there exists various art images for this card
*/
boolean getUsesVariousArt();
Counters getCounters(Game game);
void addCounters(String name, int amount, Game game);
void addCounters(String name, int amount, Game game, ArrayList<UUID> appliedEffects);
void addCounters(Counter counter, Game game);
void addCounters(Counter counter, Game game, ArrayList<UUID> appliedEffects);
void removeCounters(String name, int amount, Game game);
void removeCounters(Counter counter, Game game);
@Override
Card copy();
/**
*
* @return The main card of a split half card, otherwise thae card itself is returned
* @return The main card of a split half card, otherwise thae card itself is
* returned
*/
Card getMainCard();
void setZone(Zone zone, Game game);
void setZone(Zone zone, Game game);
}

View file

@ -25,7 +25,6 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.cards;
import java.util.ArrayList;
@ -53,9 +52,9 @@ public abstract class SplitCard extends CardImpl {
protected Card rightHalfCard;
public SplitCard(UUID ownerId, int cardNumber, String nameLeft, String nameRight, Rarity rarity, CardType[] cardTypes, String costsLeft, String costsRight, boolean fused) {
super(ownerId, cardNumber, new StringBuilder(nameLeft).append(" // ").append(nameRight).toString(), rarity, cardTypes, costsLeft + costsRight, (fused ?SpellAbilityType.SPLIT_FUSED:SpellAbilityType.SPLIT));
this.createLeftHalfCard(nameLeft, costsLeft);
this.createRightHalfCard(nameRight, costsRight);
super(ownerId, cardNumber, new StringBuilder(nameLeft).append(" // ").append(nameRight).toString(), rarity, cardTypes, costsLeft + costsRight, (fused ? SpellAbilityType.SPLIT_FUSED : SpellAbilityType.SPLIT));
leftHalfCard = new SplitCardHalfImpl(this.getOwnerId(), this.getCardNumber(), nameLeft, this.rarity, cardTypes, costsLeft, this, SpellAbilityType.SPLIT_LEFT);
rightHalfCard = new SplitCardHalfImpl(this.getOwnerId(), this.getCardNumber(), nameRight, this.rarity, cardTypes, costsRight, this, SpellAbilityType.SPLIT_RIGHT);
this.splitCard = true;
}
@ -65,29 +64,11 @@ public abstract class SplitCard extends CardImpl {
this.rightHalfCard = card.rightHalfCard.copy();
}
private Card createLeftHalfCard (String nameLeft, String costsLeft) {
CardType[] cardTypes = new CardType[getCardType().size()];
this.getCardType().toArray(cardTypes);
leftHalfCard = new LeftHalfCard(this.getOwnerId(), this.getCardNumber(), nameLeft, this.rarity, cardTypes, costsLeft, this);
//leftHalfCard.getAbilities().setSourceId(objectId);
public Card getLeftHalfCard() {
return leftHalfCard;
}
private Card createRightHalfCard (String nameRight, String costsRight) {
CardType[] cardTypes = new CardType[getCardType().size()];
this.getCardType().toArray(cardTypes);
rightHalfCard = new RightHalfCard(this.getOwnerId(), this.getCardNumber(), nameRight, this.rarity, cardTypes, costsRight, this);
//rightHalfCard.getAbilities().setSourceId(objectId);
return rightHalfCard;
}
public Card getLeftHalfCard () {
return leftHalfCard;
}
public Card getRightHalfCard () {
public Card getRightHalfCard() {
return rightHalfCard;
}
@ -114,7 +95,7 @@ public abstract class SplitCard extends CardImpl {
@Override
public boolean cast(Game game, Zone fromZone, SpellAbility ability, UUID controllerId) {
switch(ability.getSpellAbilityType()) {
switch (ability.getSpellAbilityType()) {
case SPLIT_LEFT:
return this.getLeftHalfCard().cast(game, fromZone, ability, controllerId);
case SPLIT_RIGHT:
@ -131,17 +112,16 @@ public abstract class SplitCard extends CardImpl {
game.setZone(getRightHalfCard().getId(), zone);
}
@Override
public Abilities<Ability> getAbilities(){
public Abilities<Ability> getAbilities() {
Abilities<Ability> allAbilites = new AbilitiesImpl<>();
for (Ability ability : super.getAbilities()) {
if (ability instanceof SpellAbility && !((SpellAbility)ability).getSpellAbilityType().equals(SpellAbilityType.SPLIT)) {
if (ability instanceof SpellAbility && !((SpellAbility) ability).getSpellAbilityType().equals(SpellAbilityType.SPLIT)) {
allAbilites.add(ability);
}
}
allAbilites.addAll(leftHalfCard.getAbilities());
allAbilites.addAll(rightHalfCard.getAbilities());
allAbilites.addAll(rightHalfCard.getAbilities());
return allAbilites;
}
@ -149,15 +129,15 @@ public abstract class SplitCard extends CardImpl {
public Abilities<Ability> getAbilities(Game game) {
Abilities<Ability> allAbilites = new AbilitiesImpl<>();
for (Ability ability : super.getAbilities(game)) {
if (ability instanceof SpellAbility && !((SpellAbility)ability).getSpellAbilityType().equals(SpellAbilityType.SPLIT)) {
if (ability instanceof SpellAbility && !((SpellAbility) ability).getSpellAbilityType().equals(SpellAbilityType.SPLIT)) {
allAbilites.add(ability);
}
}
allAbilites.addAll(leftHalfCard.getAbilities(game));
allAbilites.addAll(rightHalfCard.getAbilities(game));
allAbilites.addAll(rightHalfCard.getAbilities(game));
return allAbilites;
}
@Override
public List<String> getRules() {
List<String> rules = new ArrayList<>();
@ -179,136 +159,3 @@ public abstract class SplitCard extends CardImpl {
}
}
/*
* The left side card of the split card
*/
class LeftHalfCard extends CardImpl {
SplitCard splitCardParent;
public LeftHalfCard(UUID ownerId, int cardNumber, String name, Rarity rarity, CardType[] cardTypes, String costs, SplitCard splitCardParent) {
super(ownerId, cardNumber, name, rarity, cardTypes, costs, SpellAbilityType.SPLIT_LEFT);
this.splitCardParent = splitCardParent;
}
public LeftHalfCard(final LeftHalfCard card) {
super(card);
this.splitCardParent = card.splitCardParent;
}
@Override
public LeftHalfCard copy() {
return new LeftHalfCard(this);
}
@Override
public UUID getOwnerId() {
return splitCardParent.getOwnerId();
}
@Override
public String getImageName() {
return splitCardParent.getImageName();
}
@Override
public String getExpansionSetCode() {
return splitCardParent.getExpansionSetCode();
}
@Override
public int getCardNumber() {
return splitCardParent.getCardNumber();
}
@Override
public boolean moveToZone(Zone toZone, UUID sourceId, Game game, boolean flag, ArrayList<UUID> appliedEffects) {
return splitCardParent.moveToZone(toZone, sourceId, game, flag, appliedEffects);
}
@Override
public boolean moveToExile(UUID exileId, String name, UUID sourceId, Game game, ArrayList<UUID> appliedEffects) {
return splitCardParent.moveToExile(exileId, name, sourceId, game, appliedEffects);
}
@Override
public Card getMainCard() {
return splitCardParent;
}
@Override
public void setZone(Zone zone, Game game) {
super.setZone(zone, game);
game.setZone(splitCardParent.getId(), zone);
game.setZone(splitCardParent.getRightHalfCard().getId(), zone);
}
}
/*
* The right side card of the split card
*/
class RightHalfCard extends CardImpl {
SplitCard splitCardParent;
public RightHalfCard(UUID ownerId, int cardNumber, String name, Rarity rarity, CardType[] cardTypes, String costs, SplitCard splitCardParent) {
super(ownerId, cardNumber, name, rarity, cardTypes, costs, SpellAbilityType.SPLIT_RIGHT);
this.splitCardParent = splitCardParent;
}
public RightHalfCard(final RightHalfCard card) {
super(card);
this.splitCardParent = card.splitCardParent;
}
@Override
public RightHalfCard copy() {
return new RightHalfCard(this);
}
@Override
public UUID getOwnerId() {
return splitCardParent.getOwnerId();
}
@Override
public String getImageName() {
return splitCardParent.getImageName();
}
@Override
public String getExpansionSetCode() {
return splitCardParent.getExpansionSetCode();
}
@Override
public int getCardNumber() {
return splitCardParent.getCardNumber();
}
@Override
public boolean moveToZone(Zone toZone, UUID sourceId, Game game, boolean flag, ArrayList<UUID> appliedEffects) {
return splitCardParent.moveToZone(toZone, sourceId, game, flag, appliedEffects);
}
@Override
public boolean moveToExile(UUID exileId, String name, UUID sourceId, Game game, ArrayList<UUID> appliedEffects) {
return splitCardParent.moveToExile(exileId, name, sourceId, game, appliedEffects);
}
@Override
public Card getMainCard() {
return splitCardParent;
}
@Override
public void setZone(Zone zone, Game game) {
super.setZone(zone, game);
game.setZone(splitCardParent.getId(), zone);
game.setZone(splitCardParent.getLeftHalfCard().getId(), zone);
}
}

View file

@ -0,0 +1,16 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mage.cards;
/**
*
* @author LevelX2
*/
public interface SplitCardHalf extends Card {
@Override
Card copy();
}

View file

@ -0,0 +1,81 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mage.cards;
import java.util.ArrayList;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.SpellAbilityType;
import mage.constants.Zone;
import mage.game.Game;
/**
*
* @author LevelX2
*/
public class SplitCardHalfImpl extends CardImpl implements SplitCardHalf {
SplitCard splitCardParent;
public SplitCardHalfImpl(UUID ownerId, int cardNumber, String name, Rarity rarity, CardType[] cardTypes, String costs, SplitCard splitCardParent, SpellAbilityType spellAbilityType) {
super(ownerId, cardNumber, name, rarity, cardTypes, costs, spellAbilityType);
this.splitCardParent = splitCardParent;
}
public SplitCardHalfImpl(final SplitCardHalfImpl card) {
super(card);
this.splitCardParent = card.splitCardParent;
}
@Override
public UUID getOwnerId() {
return splitCardParent.getOwnerId();
}
@Override
public String getImageName() {
return splitCardParent.getImageName();
}
@Override
public String getExpansionSetCode() {
return splitCardParent.getExpansionSetCode();
}
@Override
public int getCardNumber() {
return splitCardParent.getCardNumber();
}
@Override
public boolean moveToZone(Zone toZone, UUID sourceId, Game game, boolean flag, ArrayList<UUID> appliedEffects) {
return splitCardParent.moveToZone(toZone, sourceId, game, flag, appliedEffects);
}
@Override
public boolean moveToExile(UUID exileId, String name, UUID sourceId, Game game, ArrayList<UUID> appliedEffects) {
return splitCardParent.moveToExile(exileId, name, sourceId, game, appliedEffects);
}
@Override
public Card getMainCard() {
return splitCardParent;
}
@Override
public void setZone(Zone zone, Game game) {
game.setZone(splitCardParent.getId(), zone);
game.setZone(splitCardParent.getLeftHalfCard().getId(), zone);
game.setZone(splitCardParent.getRightHalfCard().getId(), zone);
}
@Override
public SplitCardHalfImpl copy() {
return new SplitCardHalfImpl(this);
}
}