1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-02 03:18:09 -09:00
This commit is contained in:
BetaSteward 2011-06-16 23:05:20 -04:00
commit a934d2733c
12 changed files with 610 additions and 79 deletions
Mage.Client/src/main/java/mage/client
Mage.Sets/src/mage/sets
Mage/src/mage

View file

@ -34,8 +34,21 @@
package mage.client.cards;
import java.awt.Dimension;
import java.awt.Rectangle;
import mage.Constants.CardType;
import mage.cards.MageCard;
import mage.client.constants.Constants;
import mage.client.constants.Constants.SortBy;
import mage.client.deckeditor.table.TableModel;
import mage.client.plugins.impl.Plugins;
import mage.client.util.*;
import mage.client.util.Event;
import mage.view.CardView;
import mage.view.CardsView;
import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.beans.Beans;
@ -43,27 +56,12 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import javax.swing.DefaultComboBoxModel;
import mage.Constants.CardType;
import mage.cards.MageCard;
import mage.client.constants.Constants.SortBy;
import mage.client.plugins.impl.Plugins;
import mage.client.util.CardViewColorComparator;
import mage.client.util.CardViewCostComparator;
import mage.client.util.CardViewNameComparator;
import mage.client.util.CardViewRarityComparator;
import mage.client.util.Config;
import mage.client.util.Event;
import mage.client.util.Listener;
import mage.view.CardView;
import mage.view.CardsView;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class CardsList extends javax.swing.JPanel implements MouseListener {
public class CardsList extends javax.swing.JPanel implements MouseListener, ICardGrid {
protected CardEventSource cardEventSource = new CardEventSource();
private Dimension cardDimension;
@ -71,24 +69,82 @@ public class CardsList extends javax.swing.JPanel implements MouseListener {
protected BigCard bigCard;
protected UUID gameId;
private TableModel mainModel;
private JTable mainTable;
private ICardGrid currentView;
/** Creates new form Cards */
public CardsList() {
initComponents();
jScrollPane1.setOpaque(false);
makeTransparent();
//initListViewComponents();
//currentView = mainModel; // by default we have List (table) view
currentView = this;
}
public void makeTransparent() {
jScrollPane1.setOpaque(false);
cardArea.setOpaque(false);
jScrollPane1.getViewport().setOpaque(false);
cbSortBy.setModel(new DefaultComboBoxModel(SortBy.values()));
}
public void initListViewComponents() {
mainTable = new JTable();
mainModel = new TableModel();
mainModel.addListeners(mainTable);
mainTable.setModel(mainModel);
mainTable.setForeground(Color.white);
DefaultTableCellRenderer myRenderer = (DefaultTableCellRenderer) mainTable.getDefaultRenderer(String.class);
myRenderer.setBackground(new Color(0, 0, 0, 100));
mainTable.getColumnModel().getColumn(0).setMaxWidth(0);
mainTable.getColumnModel().getColumn(0).setPreferredWidth(10);
mainTable.getColumnModel().getColumn(1).setPreferredWidth(110);
mainTable.getColumnModel().getColumn(2).setPreferredWidth(90);
mainTable.getColumnModel().getColumn(3).setPreferredWidth(50);
mainTable.getColumnModel().getColumn(4).setPreferredWidth(170);
mainTable.getColumnModel().getColumn(5).setPreferredWidth(30);
mainTable.getColumnModel().getColumn(6).setPreferredWidth(15);
mainTable.getColumnModel().getColumn(7).setPreferredWidth(15);
//jScrollPane1.setViewportView(mainTable);
mainTable.setOpaque(false);
//cbSortBy.setEnabled(false);
//chkPiles.setEnabled(false);
mainTable.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
if (e.getClickCount() == 2 && !e.isConsumed()) {
e.consume();
if (mainTable.getSelectedRowCount() > 0) {
int[] n = mainTable.getSelectedRows();
List<Integer> indexes = asList(n);
Collections.reverse(indexes);
for (Integer index : indexes) {
mainModel.doubleClick(index);
}
}
}
}
});
}
public List<Integer> asList(final int[] is) {
List<Integer> list = new ArrayList<Integer>();
for (int i : is) list.add(i);
return list;
}
public void loadCards(CardsView showCards, BigCard bigCard, UUID gameId) {
//FIXME: why we remove all cards? for performance it's better to merge changes
cards = showCards;
this.bigCard = bigCard;
this.gameId = gameId;
drawCards((SortBy) cbSortBy.getSelectedItem());
currentView.loadCards(showCards, null, false, bigCard, gameId);
//loadCards(showCards, null, false, bigCard, gameId);
}
private void drawCards(SortBy sortBy) {
public void drawCards(SortBy sortBy, boolean piles) {
int maxWidth = this.getParent().getWidth();
int numColumns = maxWidth / Config.dimensions.frameWidth;
int curColumn = 0;
@ -194,6 +250,20 @@ public class CardsList extends javax.swing.JPanel implements MouseListener {
public void addCardEventListener(Listener<Event> listener) {
cardEventSource.addListener(listener);
//mainModel.addCardEventListener(listener);
}
public void drawCards(SortBy sortBy) {
drawCards(sortBy, false);
}
@Override
public void loadCards(CardsView showCards, SortBy sortBy, boolean piles, BigCard bigCard, UUID gameId) {
//FIXME: why we remove all cards? for performance it's better to merge changes
cards = showCards;
this.bigCard = bigCard;
this.gameId = gameId;
drawCards((SortBy) cbSortBy.getSelectedItem());
}
public void clearCardEventListeners() {
@ -292,8 +362,7 @@ public class CardsList extends javax.swing.JPanel implements MouseListener {
drawCards((SortBy) cbSortBy.getSelectedItem());
}//GEN-LAST:event_chkPilesActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLayeredPane cardArea;
private javax.swing.JComboBox cbSortBy;
private javax.swing.JCheckBox chkPiles;

View file

@ -115,7 +115,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
public void mousePressed(MouseEvent e) {
if (e.getClickCount() == 2 && !e.isConsumed()) {
e.consume();
//TODO: jButtonAddToMainActionPerformed(null);
jButtonAddToMainActionPerformed(null);
}
}
});
@ -210,6 +210,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
}
public void removeCard(UUID cardId) {
this.mainModel.removeCard(cardId);
this.cardGrid.removeCard(cardId);
for (Card card: cards) {
if (card.getId().equals(cardId)) {

View file

@ -169,7 +169,6 @@ public class DeckEditorPanel extends javax.swing.JPanel {
if (mode == DeckEditorMode.Sideboard || mode == DeckEditorMode.Limited) {
deck.getSideboard().remove(card);
cardSelector.removeCard(card.getId());
//cardTableSelector.removeCard(card.getId());
}
if (cardInfoPane instanceof CardInfoPane) {
((CardInfoPane)cardInfoPane).setCard(new CardView(card));
@ -188,35 +187,6 @@ public class DeckEditorPanel extends javax.swing.JPanel {
}
);
}
/*this.cardTableSelector.getCardsList().clearCardEventListeners();
this.cardTableSelector.getCardsList().addCardEventListener(
new Listener<Event> () {
@Override
public void event(Event event) {
if (event.getEventName().equals("double-click")) {
Card card = cardTableSelector.getCard((UUID) event.getSource());
if (card != null) {
deck.getCards().add(Sets.createCard(card.getClass()));
if (mode == DeckEditorMode.Sideboard || mode == DeckEditorMode.Limited) {
deck.getSideboard().remove(card);
cardSelector.removeCard(card.getId());
cardTableSelector.removeCard(card.getId());
}
if (cardInfoPane instanceof CardInfoPane) {
((CardInfoPane)cardInfoPane).setCard(new CardView(card));
}
}
} else if (event.getEventName().equals("shift-double-click") && mode == DeckEditorMode.Constructed) {
Card card = cardTableSelector.getCard((UUID) event.getSource());
deck.getSideboard().add(Sets.createCard(card.getClass()));
if (cardInfoPane instanceof CardInfoPane) {
((CardInfoPane)cardInfoPane).setCard(new CardView(card));
}
}
refreshDeck();
}
}
);*/
this.deckArea.clearDeckEventListeners();
this.deckArea.addDeckEventListener(
new Listener<Event> () {

View file

@ -0,0 +1,103 @@
/*
* 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.alarareborn;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author Loki
*/
public class NemesisofReason extends CardImpl<NemesisofReason> {
public NemesisofReason (UUID ownerId) {
super(ownerId, 28, "Nemesis of Reason", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{U}{B}");
this.expansionSetCode = "ARB";
this.subtype.add("Leviathan");
this.subtype.add("Horror");
this.color.setBlue(true);
this.color.setBlack(true);
this.power = new MageInt(3);
this.toughness = new MageInt(7);
this.addAbility(new NemesisofReasonTriggeredAbility());
}
public NemesisofReason (final NemesisofReason card) {
super(card);
}
@Override
public NemesisofReason copy() {
return new NemesisofReason(this);
}
}
class NemesisofReasonTriggeredAbility extends TriggeredAbilityImpl<NemesisofReasonTriggeredAbility> {
NemesisofReasonTriggeredAbility() {
super(Constants.Zone.BATTLEFIELD, new PutLibraryIntoGraveTargetEffect(10));
}
NemesisofReasonTriggeredAbility(final NemesisofReasonTriggeredAbility ability) {
super(ability);
}
@Override
public NemesisofReasonTriggeredAbility copy() {
return new NemesisofReasonTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId()) ) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
}
return true;
}
return false;
}
@Override
public String getRule() {
return "Whenever Nemesis of Reason attacks, defending player puts the top ten cards of his or her library into his or her graveyard.";
}
}

View file

@ -0,0 +1,61 @@
/*
* 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.mirrodinbesieged;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.effects.common.continious.BoostOpponentsEffect;
import mage.cards.CardImpl;
/**
*
* @author Loki
*/
public class TurntheTide extends CardImpl<TurntheTide> {
public TurntheTide (UUID ownerId) {
super(ownerId, 35, "Turn the Tide", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{U}");
this.expansionSetCode = "MBS";
this.color.setBlue(true);
this.getSpellAbility().addEffect(new BoostOpponentsEffect(-2, 0, Constants.Duration.EndOfTurn));
}
public TurntheTide (final TurntheTide card) {
super(card);
}
@Override
public TurntheTide copy() {
return new TurntheTide(this);
}
}

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.newphyrexia;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.effects.common.LoseLifeTargetEffect;
import mage.abilities.effects.common.SacrificeEffect;
import mage.abilities.effects.common.SacrificeTargetEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.target.TargetPlayer;
/**
*
* @author Loki
*/
public class GethsVerdict extends CardImpl<GethsVerdict> {
public GethsVerdict (UUID ownerId) {
super(ownerId, 61, "Geth's Verdict", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{B}{B}");
this.expansionSetCode = "NPH";
this.color.setBlack(true);
this.getSpellAbility().addEffect(new SacrificeEffect(new FilterCreaturePermanent(), 1, "Target player"));
this.getSpellAbility().addEffect(new LoseLifeTargetEffect(1));
this.getSpellAbility().addTarget(new TargetPlayer());
}
public GethsVerdict (final GethsVerdict card) {
super(card);
}
@Override
public GethsVerdict copy() {
return new GethsVerdict(this);
}
}

View file

@ -0,0 +1,98 @@
/*
* 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.newphyrexia;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DrawCardControllerEffect;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetPlayer;
/**
*
* @author Loki
*/
public class GitaxianProbe extends CardImpl<GitaxianProbe> {
public GitaxianProbe (UUID ownerId) {
super(ownerId, 35, "Gitaxian Probe", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{UP}");
this.expansionSetCode = "NPH";
this.color.setBlue(true);
this.getSpellAbility().addEffect(new GitaxianProbeEffect());
this.getSpellAbility().addEffect(new DrawCardControllerEffect(1));
this.getSpellAbility().addTarget(new TargetPlayer());
}
public GitaxianProbe (final GitaxianProbe card) {
super(card);
}
@Override
public GitaxianProbe copy() {
return new GitaxianProbe(this);
}
}
class GitaxianProbeEffect extends OneShotEffect<GitaxianProbeEffect> {
GitaxianProbeEffect() {
super(Constants.Outcome.Detriment);
}
GitaxianProbeEffect(final GitaxianProbeEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Player player = game.getPlayer(targetPointer.getFirst(source));
if (player != null && controller != null) {
controller.lookAtCards("Gitaxian Probe", player.getHand(), game);
}
return true;
}
@Override
public GitaxianProbeEffect copy() {
return new GitaxianProbeEffect(this);
}
@Override
public String getText(Ability source) {
return "Look at target player's hand";
}
}

View file

@ -0,0 +1,61 @@
/*
* 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.newphyrexia;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.effects.common.PutOnLibraryTargetEffect;
import mage.cards.CardImpl;
import mage.target.common.TargetCardInGraveyard;
/**
*
* @author Loki
*/
public class NoxiousRevival extends CardImpl<NoxiousRevival> {
public NoxiousRevival (UUID ownerId) {
super(ownerId, 118, "Noxious Revival", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{GP}");
this.expansionSetCode = "NPH";
this.color.setGreen(true);
this.getSpellAbility().addEffect(new PutOnLibraryTargetEffect(true));
this.getSpellAbility().addTarget(new TargetCardInGraveyard());
}
public NoxiousRevival (final NoxiousRevival card) {
super(card);
}
@Override
public NoxiousRevival copy() {
return new NoxiousRevival(this);
}
}

View file

@ -0,0 +1,119 @@
/*
* 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.scarsofmirrodin;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.Abilities;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ColoredManaCost;
import mage.abilities.effects.common.continious.BecomesCreatureSourceEOTEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.Token;
/**
*
* @author Loki
*/
public class GlintHawkIdol extends CardImpl<GlintHawkIdol> {
public GlintHawkIdol (UUID ownerId) {
super(ownerId, 156, "Glint Hawk Idol", Rarity.COMMON, new CardType[]{CardType.ARTIFACT}, "{2}");
this.expansionSetCode = "SOM";
this.addAbility(new GlintHawkIdolTriggeredAbility());
this.addAbility(new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new BecomesCreatureSourceEOTEffect(new GlintHawkIdolToken(), ""), new ColoredManaCost(Constants.ColoredManaSymbol.W)));
}
public GlintHawkIdol (final GlintHawkIdol card) {
super(card);
}
@Override
public GlintHawkIdol copy() {
return new GlintHawkIdol(this);
}
}
class GlintHawkIdolTriggeredAbility extends TriggeredAbilityImpl<GlintHawkIdolTriggeredAbility> {
GlintHawkIdolTriggeredAbility() {
super(Constants.Zone.BATTLEFIELD, new BecomesCreatureSourceEOTEffect(new GlintHawkIdolToken(), ""), true);
}
GlintHawkIdolTriggeredAbility(final GlintHawkIdolTriggeredAbility ability) {
super(ability);
}
@Override
public GlintHawkIdolTriggeredAbility copy() {
return new GlintHawkIdolTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && !event.getTargetId().equals(this.getSourceId())) {
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
if (zEvent.getToZone() == Constants.Zone.BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.getCardType().contains(CardType.ARTIFACT)) {
return true;
}
}
}
return false;
}
@Override
public String getRule() {
return "Whenever another artifact enters the battlefield under your control, you may have Glint Hawk Idol become a 2/2 Bird artifact creature with flying until end of turn.";
}
}
class GlintHawkIdolToken extends Token {
GlintHawkIdolToken() {
super("", "a 2/2 Bird artifact creature with flying");
cardType.add(CardType.ARTIFACT);
cardType.add(CardType.CREATURE);
subtype.add("Bird");
power = new MageInt(2);
toughness = new MageInt(2);
addAbility(FlyingAbility.getInstance());
}
}

View file

@ -67,7 +67,7 @@ public class PutLibraryIntoGraveTargetEffect extends OneShotEffect<PutLibraryInt
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getFirstTarget());
Player player = game.getPlayer(targetPointer.getFirst(source));
if (player != null) {
// putting cards to grave shouldn't end the game, so getting minimun available
int cardsCount = Math.min(amount.calculate(game, source), player.getLibrary().size());

View file

@ -113,7 +113,10 @@ public class BecomesCreatureSourceEOTEffect extends ContinuousEffectImpl<Becomes
@Override
public String getText(Ability source) {
return "Until end of turn {this} becomes a " + token.getDescription() + " that's still a " + this.type;
if (type.length() > 0)
return "Until end of turn {this} becomes a " + token.getDescription() + " that's still a " + this.type;
else
return "Until end of turn {this} becomes a " + token.getDescription();
}
@Override

View file

@ -105,30 +105,11 @@ public class Deck implements Serializable {
return cards;
}
// /**
// * @param cards the cards to set
// */
// public void setCards(List<Card> cards) {
// this.cards = cards;
// }
/**
* @return the sideboard
*/
public Set<Card> getSideboard() {
return sideboard;
}
// /**
// * @param sideboard the sideboard to set
// */
// public void setSideboard(Cards sideboard) {
// this.sideboard = sideboard;
// }
// public void setOwnerId(UUID playerId) {
// cards.setOwner(playerId);
// sideboard.setOwner(playerId);
// }
}