Merge pull request #11 from magefree/master

update
This commit is contained in:
Li REN 2013-06-17 11:28:58 -07:00
commit b8e7a50415
24 changed files with 549 additions and 47 deletions

View file

@ -65,6 +65,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
public final ScaledImagePanel imagePanel;
public ImagePanel overlayPanel;
public JPanel buttonPanel;
public JPanel iconPanel;
private GlowText titleText;
private GlowText ptText;
@ -94,6 +95,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
private boolean transformed;
private boolean animationInProgress = false;
private JButton dayNightButton;
private JButton tokenButton;
private boolean displayTitleAnyway;
@ -142,6 +144,23 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
}
});
// token icon
iconPanel = new JPanel();
iconPanel.setLayout(null);
iconPanel.setOpaque(false);
add(iconPanel);
tokenButton = new JButton("");
tokenButton.setLocation(2, 2);
tokenButton.setSize(25, 25);
iconPanel.setVisible(this.gameCard.isToken());
BufferedImage tokenIconImage = ImageManagerImpl.getInstance().getTokenIconImage();
tokenButton.setIcon(new ImageIcon(tokenIconImage));
iconPanel.add(tokenButton);
setBackground(Color.black);
setOpaque(false);
@ -411,6 +430,9 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
buttonPanel.setLocation(cardXOffset + borderSize, cardYOffset + borderSize);
buttonPanel.setSize(cardWidth - borderSize * 2, cardHeight - borderSize * 2);
iconPanel.setLocation(cardXOffset + borderSize, cardYOffset + borderSize);
iconPanel.setSize(cardWidth - borderSize * 2, cardHeight - borderSize * 2);
int fontHeight = Math.round(cardHeight * (27f / 680));
boolean showText = (!isAnimationPanel && fontHeight < 12);
titleText.setVisible(showText);

View file

@ -154,12 +154,15 @@ public class CardInfoPaneImpl extends JEditorPane implements CardInfoPane {
} else if (CardUtil.isPlaneswalker(card)) {
pt = card.getLoyalty().toString();
}
if (pt.length() > 0) {
buffer.append("<table cellspacing=0 cellpadding=0 border=0 width='100%' valign='bottom'><tr><td>");
buffer.append("<b>");
buffer.append(pt);
buffer.append("</b>");
buffer.append("</td></tr></table>");
if (pt.length() > 0 || card.isToken()) {
buffer.append("<table cellspacing=0 cellpadding=0 border=0 width='100%' valign='bottom'><tr><td><b>");
buffer.append(pt).append("</b></td>");
if (card.isToken()) {
buffer.append("<td align='right'>Token</td>");
}
buffer.append("</tr></table>");
}
StringBuilder rule = new StringBuilder("<br/>");

View file

@ -11,6 +11,8 @@ public interface ImageManager {
Image getSicknessImage();
Image getDayImage();
Image getNightImage();
Image getTokenIconImage();
Image getDlgAcceptButtonImage();
Image getDlgActiveAcceptButtonImage();

View file

@ -97,6 +97,15 @@ public class ImageManagerImpl implements ImageManager {
return imageNight;
}
@Override
public BufferedImage getTokenIconImage() {
if (imageTokenIcon == null) {
Image image = getImageFromResourceTransparent("/card/token.png", Color.WHITE, new Rectangle(20, 20));
imageTokenIcon = BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB);
}
return imageTokenIcon;
}
@Override
public Image getDlgCancelButtonImage() {
if (imageDlgCancelButton == null) {
@ -216,6 +225,8 @@ public class ImageManagerImpl implements ImageManager {
private static BufferedImage imageDay;
private static BufferedImage imageNight;
private static BufferedImage imageTokenIcon;
private static BufferedImage imageDlgAcceptButton;
private static BufferedImage imageDlgActiveAcceptButton;
private static BufferedImage imageDlgCancelButton;

Binary file not shown.

After

Width:  |  Height:  |  Size: 753 B

View file

@ -82,6 +82,7 @@ public class CardView extends SimpleCardView {
protected boolean transformed;
protected boolean isSplitCard;
protected boolean isToken;
protected String leftSplitName;
protected ManaCosts leftSplitCosts;
protected List<String> leftSplitRules;
@ -152,12 +153,23 @@ public class CardView extends SimpleCardView {
if (card instanceof PermanentToken) {
this.isToken = true;
this.rarity = Rarity.COMMON;
this.expansionSetCode = ((PermanentToken) card).getExpansionSetCode();
if (((PermanentToken) card).getToken().getOriginalCardNumber() > 0) {
// a token copied from permanent
this.expansionSetCode = ((PermanentToken) card).getToken().getOriginalExpansionSetCode();
this.cardNumber = ((PermanentToken) card).getToken().getOriginalCardNumber();
} else {
// a created token
this.expansionSetCode = ((PermanentToken) card).getExpansionSetCode();
}
//
// set code und card number for token copies to get the image
this.rules = ((PermanentToken) card).getRules();
this.type = ((PermanentToken)card).getToken().getTokenType();
} else {
this.rarity = card.getRarity();
this.isToken = false;
}
if (card.getCounters() != null && !card.getCounters().isEmpty()) {
counters = new ArrayList<CounterView>();
@ -453,6 +465,10 @@ public class CardView extends SimpleCardView {
return this.secondCardFace;
}
public boolean isToken() {
return this.isToken;
}
public void setTransformed(boolean transformed) {
this.transformed = transformed;
}

View file

@ -28,11 +28,16 @@
package mage.view;
import mage.constants.PhaseStep;
import mage.constants.TurnPhase;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.costs.Cost;
import mage.cards.Card;
import mage.constants.PhaseStep;
import mage.constants.TurnPhase;
import mage.constants.Zone;
import mage.game.ExileZone;
import mage.game.Game;
@ -46,11 +51,6 @@ import mage.game.stack.StackAbility;
import mage.game.stack.StackObject;
import mage.players.Player;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
*
@ -131,14 +131,16 @@ public class GameView implements Serializable {
this.phase = state.getTurn().getPhaseType();
this.step = state.getTurn().getStepType();
this.turn = state.getTurnNum();
if (state.getActivePlayerId() != null)
if (state.getActivePlayerId() != null) {
this.activePlayerName = state.getPlayer(state.getActivePlayerId()).getName();
else
} else {
this.activePlayerName = "";
if (state.getPriorityPlayerId() != null)
}
if (state.getPriorityPlayerId() != null) {
this.priorityPlayerName = state.getPlayer(state.getPriorityPlayerId()).getName();
else
} else {
this.priorityPlayerName = "";
}
for (CombatGroup combatGroup: state.getCombat().getGroups()) {
combat.add(new CombatGroupView(combatGroup, game));
}

View file

@ -50,7 +50,6 @@ public class PermanentView extends CardView {
private boolean summoningSickness;
private int damage;
private List<UUID> attachments;
private List<CounterView> counters;
private CardView original;
public PermanentView(Permanent permanent, Card card) {
@ -66,13 +65,7 @@ public class PermanentView extends CardView {
attachments = new ArrayList<UUID>();
attachments.addAll(permanent.getAttachments());
}
if (permanent.getCounters().size() > 0) {
counters = new ArrayList<CounterView>();
for (Counter counter: permanent.getCounters().values()) {
counters.add(new CounterView(counter));
}
}
if (permanent instanceof PermanentToken) {
if (isToken()) {
original = new CardView(((PermanentToken)permanent).getToken());
original.expansionSetCode = permanent.getExpansionSetCode();
}
@ -110,10 +103,6 @@ public class PermanentView extends CardView {
return attachments;
}
public List<CounterView> getCounters() {
return counters;
}
public CardView getOriginal() {
return original;
}

View file

@ -75,6 +75,8 @@ public class AdventOfTheWurm extends CardImpl<AdventOfTheWurm> {
subtype.add("Wurm");
power = new MageInt(5);
toughness = new MageInt(5);
expansionSetCode = "RTR";
addAbility(TrampleAbility.getInstance());
}

View file

@ -100,11 +100,11 @@ class GrislySpectacleEffect extends OneShotEffect<GrislySpectacleEffect> {
Player controller = game.getPlayer(creature.getControllerId());
if (controller != null) {
int power = creature.getPower().getValue();
if (creature.destroy(source.getSourceId(), game, false)) {
Effect effect = new PutLibraryIntoGraveTargetEffect(power);
effect.setTargetPointer(new FixedTarget(controller.getId()));
return effect.apply(game, source);
}
creature.destroy(source.getSourceId(), game, false);
// the mill effect works also if creature is indestructible or regenerated
Effect effect = new PutLibraryIntoGraveTargetEffect(power);
effect.setTargetPointer(new FixedTarget(controller.getId()));
return effect.apply(game, source);
}
}
return false;

View file

@ -28,13 +28,13 @@
package mage.sets.gatecrash;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.GainLifeEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetControlledCreaturePermanent;

View file

@ -0,0 +1,54 @@
/*
* 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.sets.modernmasters;
import java.util.UUID;
import mage.constants.Rarity;
/**
*
* @author LevelX2
*/
public class HammerheimDeadeye extends mage.sets.planarchaos.HammerheimDeadeye {
public HammerheimDeadeye(UUID ownerId) {
super(ownerId);
this.cardNumber = 119;
this.expansionSetCode = "MMA";
this.rarity = Rarity.COMMON;
}
public HammerheimDeadeye(final HammerheimDeadeye card) {
super(card);
}
@Override
public HammerheimDeadeye copy() {
return new HammerheimDeadeye(this);
}
}

View file

@ -0,0 +1,52 @@
/*
* 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.sets.modernmasters;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class Phthisis extends mage.sets.timespiral.Phthisis {
public Phthisis(UUID ownerId) {
super(ownerId);
this.cardNumber = 93;
this.expansionSetCode = "MMA";
}
public Phthisis(final Phthisis card) {
super(card);
}
@Override
public Phthisis copy() {
return new Phthisis(this);
}
}

View file

@ -0,0 +1,52 @@
/*
* 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.sets.modernmasters;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class SuddenShock extends mage.sets.timespiral.SuddenShock {
public SuddenShock(UUID ownerId) {
super(ownerId);
this.cardNumber = 133;
this.expansionSetCode = "MMA";
}
public SuddenShock(final SuddenShock card) {
super(card);
}
@Override
public SuddenShock copy() {
return new SuddenShock(this);
}
}

View file

@ -28,9 +28,19 @@
package mage.sets.modernmasters;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continious.ControlEnchantedEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.abilities.keyword.SplitSecondAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.target.TargetPermanent;
/**
*
@ -46,8 +56,18 @@ public class TakePossession extends CardImpl<TakePossession> {
this.color.setBlue(true);
// Split second
this.addAbility(SplitSecondAbility.getInstance());
// Enchant permanent
TargetPermanent auraTarget = new TargetPermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.GainControl));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// You control enchanted permanent.
Effect effect = new ControlEnchantedEffect();
effect.setText("You control enchanted permanent");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
}
public TakePossession(final TakePossession card) {

View file

@ -116,7 +116,8 @@ class TestOfFaithPreventDamageTargetEffect extends PreventionEffectImpl<TestOfFa
Permanent targetPermanent = game.getPermanent(source.getTargets().getFirstTarget());
if (targetPermanent != null) {
targetPermanent.addCounters(CounterType.P1P1.createInstance(prevented), game);
game.informPlayers("Adding " + prevented + " +1/+1 counters to " + targetPermanent.getName());
game.informPlayers(new StringBuilder("Test of Faith: Prevented ").append(prevented).append(" damage ").toString());
game.informPlayers("Test of Faith: Adding " + prevented + " +1/+1 counters to " + targetPermanent.getName());
}
}
return true;

View file

@ -0,0 +1,84 @@
/*
* 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.sets.planarchaos;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.keyword.EchoAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.target.Target;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author LevelX2
*/
public class HammerheimDeadeye extends CardImpl<HammerheimDeadeye> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with flying");
static {
filter.add(new AbilityPredicate(FlyingAbility.class));
}
public HammerheimDeadeye(UUID ownerId) {
super(ownerId, 101, "Hammerheim Deadeye", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{R}");
this.expansionSetCode = "PLC";
this.subtype.add("Giant");
this.subtype.add("Warrior");
this.color.setRed(true);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// Echo {5}{R}
this.addAbility(new EchoAbility("{5}{R}"));
// When Hammerheim Deadeye enters the battlefield, destroy target creature with flying.
Ability ability = new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect());
Target target = new TargetCreaturePermanent(filter);
target.setRequired(true);
ability.addTarget(target);
this.addAbility(ability);
}
public HammerheimDeadeye(final HammerheimDeadeye card) {
super(card);
}
@Override
public HammerheimDeadeye copy() {
return new HammerheimDeadeye(this);
}
}

View file

@ -0,0 +1,105 @@
/*
* 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.sets.timespiral;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.SuspendAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author LevelX2
*/
public class Phthisis extends CardImpl<Phthisis> {
public Phthisis(UUID ownerId) {
super(ownerId, 122, "Phthisis", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{3}{B}{B}{B}{B}");
this.expansionSetCode = "TSP";
this.color.setBlack(true);
// Destroy target creature. Its controller loses life equal to its power plus its toughness.
this.getSpellAbility().addEffect(new PhthisisEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent(true));
// Suspend 5-{1}{B}
this.addAbility(new SuspendAbility(5, new ManaCostsImpl("{1}{B}"), this));
}
public Phthisis(final Phthisis card) {
super(card);
}
@Override
public Phthisis copy() {
return new Phthisis(this);
}
}
class PhthisisEffect extends OneShotEffect<PhthisisEffect> {
public PhthisisEffect() {
super(Outcome.DestroyPermanent);
this.staticText = "Destroy target creature. Its controller loses life equal to its power plus its toughness";
}
public PhthisisEffect(final PhthisisEffect effect) {
super(effect);
}
@Override
public PhthisisEffect copy() {
return new PhthisisEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent creature = game.getPermanent(getTargetPointer().getFirst(game, source));
if (creature != null) {
Player controller = game.getPlayer(creature.getControllerId());
if (controller != null) {
int lifeLoss = creature.getPower().getValue() + creature.getToughness().getValue();
creature.destroy(source.getSourceId(), game, false);
// the life loss happens also if the creature is indestructible or regenerated (legal targets)
controller.loseLife(lifeLoss, game);
return true;
}
}
return false;
}
}

View file

@ -0,0 +1,65 @@
/*
* 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.sets.timespiral;
import java.util.UUID;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.keyword.SplitSecondAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.target.common.TargetCreatureOrPlayer;
/**
*
* @author LevelX2
*/
public class SuddenShock extends CardImpl<SuddenShock> {
public SuddenShock(UUID ownerId) {
super(ownerId, 179, "Sudden Shock", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{1}{R}");
this.expansionSetCode = "TSP";
this.color.setRed(true);
// Split second
this.addAbility(SplitSecondAbility.getInstance());
// Sudden Shock deals 2 damage to target creature or player.
this.getSpellAbility().addEffect(new DamageTargetEffect(2, true));
this.getSpellAbility().addTarget(new TargetCreatureOrPlayer(true));
}
public SuddenShock(final SuddenShock card) {
super(card);
}
@Override
public SuddenShock copy() {
return new SuddenShock(this);
}
}

View file

@ -28,15 +28,14 @@
package mage.abilities.effects.common;
import mage.constants.Outcome;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.Target;
import java.util.UUID;
import mage.target.targetpointer.FirstTargetPointer;
/**
@ -105,12 +104,14 @@ public class DestroyTargetEffect extends OneShotEffect<DestroyTargetEffect> {
StringBuilder sb = new StringBuilder();
if (mode.getTargets().size() == 0) {
sb.append("destroy that creature"); //TODO add possibility to specify text with targetPointer usage
} else if (mode.getTargets().get(0).getNumberOfTargets() == 1)
} else if (mode.getTargets().get(0).getNumberOfTargets() == 1) {
sb.append("Destroy target ").append(mode.getTargets().get(0).getTargetName());
else
} else {
sb.append("Destroy ").append(mode.getTargets().get(0).getNumberOfTargets()).append(" target ").append(mode.getTargets().get(0).getTargetName());
if (noRegen)
}
if (noRegen) {
sb.append(". It can't be regenerated");
}
return sb.toString();
}

View file

@ -86,8 +86,9 @@ public class PutLibraryIntoGraveTargetEffect extends OneShotEffect<PutLibraryInt
break;
}
}
return true;
}
return true;
return false;
}
@Override

View file

@ -65,7 +65,7 @@ public class SunburstAbility extends EntersBattlefieldAbility{
@Override
public String getRule() {
return "Sunburst";
return "Sunburst <i>(This enters the battlefield with a +1/+1 counter on it for each color of mana spent to cast it.)</i>";
}

View file

@ -49,6 +49,8 @@ public class Token extends MageObjectImpl<Token> {
protected String description;
private UUID lastAddedTokenId;
private int tokenType;
private int originalCardNumber;
private String originalExpansionSetCode;
public enum Type {
FIRST(1),
@ -146,4 +148,21 @@ public class Token extends MageObjectImpl<Token> {
public void setTokenType(int tokenType) {
this.tokenType = tokenType;
}
public int getOriginalCardNumber() {
return originalCardNumber;
}
public void setOriginalCardNumber(int originalCardNumber) {
this.originalCardNumber = originalCardNumber;
}
public String getOriginalExpansionSetCode() {
return originalExpansionSetCode;
}
public void setOriginalExpansionSetCode(String originalExpansionSetCode) {
this.originalExpansionSetCode = originalExpansionSetCode;
}
}

View file

@ -79,7 +79,8 @@ public class CopyTokenFunction implements Function<Token, Card> {
for (String type : sourceObj.getSupertype()) {
target.getSupertype().add(type);
}
//target.setExpansionSetCode(source.getExpansionSetCode());
target.setOriginalExpansionSetCode(source.getExpansionSetCode());
target.setOriginalCardNumber(source.getCardNumber());
target.getAbilities().clear();
for (Ability ability0 : sourceObj.getAbilities()) {