Merge pull request #8 from magefree/master

Merge https://github.com/magefree/mage
This commit is contained in:
Zzooouhh 2017-10-08 14:52:30 +02:00 committed by GitHub
commit cf4d258913
422 changed files with 6114 additions and 1381 deletions

View file

@ -27,20 +27,9 @@
*/ */
package mage.client.cards; package mage.client.cards;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.List;
import java.util.UUID;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import mage.cards.MageCard; import mage.cards.MageCard;
import mage.client.plugins.impl.Plugins; import mage.client.plugins.impl.Plugins;
import mage.client.util.ClientEventType;
import mage.client.util.Event; import mage.client.util.Event;
import mage.client.util.GUISizeHelper; import mage.client.util.GUISizeHelper;
import mage.client.util.Listener; import mage.client.util.Listener;
@ -50,6 +39,13 @@ import mage.view.CardsView;
import mage.view.SimpleCardView; import mage.view.SimpleCardView;
import org.mage.card.arcane.CardPanel; import org.mage.card.arcane.CardPanel;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.List;
import java.util.UUID;
public class CardArea extends JPanel implements MouseListener { public class CardArea extends JPanel implements MouseListener {
protected final CardEventSource cardEventSource = new CardEventSource(); protected final CardEventSource cardEventSource = new CardEventSource();
@ -240,15 +236,15 @@ public class CardArea extends JPanel implements MouseListener {
e.consume(); e.consume();
if (obj instanceof Card) { if (obj instanceof Card) {
if (e.isAltDown()) { if (e.isAltDown()) {
cardEventSource.altDoubleClick(((Card) obj).getOriginal(), "alt-double-click"); cardEventSource.fireEvent(((Card) obj).getOriginal(), ClientEventType.ALT_DOUBLE_CLICK);
} else { } else {
cardEventSource.doubleClick(((Card) obj).getOriginal(), "double-click"); cardEventSource.fireEvent(((Card) obj).getOriginal(), ClientEventType.DOUBLE_CLICK);
} }
} else if (obj instanceof MageCard) { } else if (obj instanceof MageCard) {
if (e.isAltDown()) { if (e.isAltDown()) {
cardEventSource.altDoubleClick(((MageCard) obj).getOriginal(), "alt-double-click"); cardEventSource.fireEvent(((MageCard) obj).getOriginal(), ClientEventType.ALT_DOUBLE_CLICK);
} else { } else {
cardEventSource.doubleClick(((MageCard) obj).getOriginal(), "double-click"); cardEventSource.fireEvent(((MageCard) obj).getOriginal(),ClientEventType.DOUBLE_CLICK);
} }
} }
} }
@ -270,14 +266,14 @@ public class CardArea extends JPanel implements MouseListener {
checkMenu(e, null); checkMenu(e, null);
} }
} else { } else {
cardEventSource.actionConsumedEvent("action-consumed"); cardEventSource.fireEvent(ClientEventType.ACTION_CONSUMED);
} }
} }
private void checkMenu(MouseEvent Me, SimpleCardView card) { private void checkMenu(MouseEvent Me, SimpleCardView card) {
if (Me.isPopupTrigger()) { if (Me.isPopupTrigger()) {
Me.consume(); Me.consume();
cardEventSource.showPopupMenuEvent(card, Me.getComponent(), Me.getX(), Me.getY(), "show-popup-menu"); cardEventSource.fireEvent(card, Me.getComponent(), Me.getX(), Me.getY(), ClientEventType.SHOW_POP_UP_MENU);
} }
} }

View file

@ -27,14 +27,13 @@
*/ */
package mage.client.cards; package mage.client.cards;
import java.awt.Component; import mage.client.util.*;
import java.io.Serializable;
import mage.client.util.Event; import mage.client.util.Event;
import mage.client.util.EventDispatcher;
import mage.client.util.EventSource;
import mage.client.util.Listener;
import mage.view.SimpleCardView; import mage.view.SimpleCardView;
import java.awt.*;
import java.io.Serializable;
/** /**
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
@ -49,42 +48,22 @@ public class CardEventSource implements EventSource<Event>, Serializable {
dispatcher.addListener(listener); dispatcher.addListener(listener);
} }
public void setNumber(SimpleCardView card, String message, int number) { public void fireEvent(SimpleCardView card, ClientEventType eventType, int number){
dispatcher.fireEvent(new Event(card, message, number)); dispatcher.fireEvent(new Event(card, eventType, number));
} }
public void removeSpecificCard(SimpleCardView card, String message) { public void fireEvent(ClientEventType eventType){
dispatcher.fireEvent(new Event(card, message)); dispatcher.fireEvent(new Event(null, eventType));
} }
public void addSpecificCard(SimpleCardView card, String message) { public void fireEvent(SimpleCardView card, ClientEventType eventType){
dispatcher.fireEvent(new Event(card, message)); dispatcher.fireEvent(new Event(card, eventType));
} }
public void doubleClick(SimpleCardView card, String message) { public void fireEvent(SimpleCardView card, Component component, int x, int y, ClientEventType message) {
dispatcher.fireEvent(new Event(card, message));
}
public void altDoubleClick(SimpleCardView card, String message) {
dispatcher.fireEvent(new Event(card, message));
}
public void removeFromMainEvent(String message) {
dispatcher.fireEvent(new Event(null, message));
}
public void removeFromSideboardEvent(String message) {
dispatcher.fireEvent(new Event(null, message));
}
public void showPopupMenuEvent(SimpleCardView card, Component component, int x, int y, String message) {
dispatcher.fireEvent(new Event(card, message, x, y, component)); dispatcher.fireEvent(new Event(card, message, x, y, component));
} }
public void actionConsumedEvent(String message) {
dispatcher.fireEvent(new Event(null, message));
}
@Override @Override
public void clearListeners() { public void clearListeners() {
dispatcher.clearListeners(); dispatcher.clearListeners();

View file

@ -33,22 +33,10 @@
*/ */
package mage.client.cards; package mage.client.cards;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.UUID;
import mage.cards.MageCard; import mage.cards.MageCard;
import mage.client.deckeditor.SortSetting; import mage.client.deckeditor.SortSetting;
import mage.client.plugins.impl.Plugins; import mage.client.plugins.impl.Plugins;
import mage.client.util.ClientEventType;
import mage.client.util.Event; import mage.client.util.Event;
import mage.client.util.GUISizeHelper; import mage.client.util.GUISizeHelper;
import mage.client.util.Listener; import mage.client.util.Listener;
@ -57,6 +45,13 @@ import mage.view.CardView;
import mage.view.CardsView; import mage.view.CardsView;
import org.mage.card.arcane.CardPanel; import org.mage.card.arcane.CardPanel;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.*;
import java.util.List;
import java.util.Map.Entry;
/** /**
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
@ -321,15 +316,15 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener,
Object obj = e.getSource(); Object obj = e.getSource();
if (obj instanceof Card) { if (obj instanceof Card) {
if (e.isAltDown()) { if (e.isAltDown()) {
cardEventSource.altDoubleClick(((Card) obj).getOriginal(), "alt-double-click"); cardEventSource.fireEvent(((Card) obj).getOriginal(), ClientEventType.ALT_DOUBLE_CLICK);
} else { } else {
cardEventSource.doubleClick(((Card) obj).getOriginal(), "double-click"); cardEventSource.fireEvent(((Card) obj).getOriginal(), ClientEventType.DOUBLE_CLICK);
} }
} else if (obj instanceof MageCard) { } else if (obj instanceof MageCard) {
if (e.isAltDown()) { if (e.isAltDown()) {
cardEventSource.altDoubleClick(((MageCard) obj).getOriginal(), "alt-double-click"); cardEventSource.fireEvent(((MageCard) obj).getOriginal(), ClientEventType.ALT_DOUBLE_CLICK);
} else { } else {
cardEventSource.doubleClick(((MageCard) obj).getOriginal(), "double-click"); cardEventSource.fireEvent(((MageCard) obj).getOriginal(), ClientEventType.DOUBLE_CLICK);
} }
} }
} }

View file

@ -62,7 +62,6 @@ import java.util.*;
import java.util.List; import java.util.List;
/** /**
*
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class CardsList extends javax.swing.JPanel implements MouseListener, ICardGrid { public class CardsList extends javax.swing.JPanel implements MouseListener, ICardGrid {
@ -475,9 +474,9 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
setMinimumSize(new java.awt.Dimension(30, 30)); setMinimumSize(new java.awt.Dimension(30, 30));
setPreferredSize((!Beans.isDesignTime())? setPreferredSize((!Beans.isDesignTime()) ?
(GUISizeHelper.editorCardDimension) (GUISizeHelper.editorCardDimension)
:(new Dimension(600, 600))); : (new Dimension(600, 600)));
setRequestFocusEnabled(false); setRequestFocusEnabled(false);
panelControl.setMaximumSize(new java.awt.Dimension(32767, 23)); panelControl.setMaximumSize(new java.awt.Dimension(32767, 23));
@ -522,7 +521,7 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
chkPiles.setMargin(new java.awt.Insets(3, 2, 2, 2)); chkPiles.setMargin(new java.awt.Insets(3, 2, 2, 2));
chkPiles.addActionListener(evt -> chkPilesActionPerformed(evt)); chkPiles.addActionListener(evt -> chkPilesActionPerformed(evt));
cbSortBy.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "SortBy" })); cbSortBy.setModel(new javax.swing.DefaultComboBoxModel(new String[]{"SortBy"}));
cbSortBy.setToolTipText("Sort the cards if card view is active."); cbSortBy.setToolTipText("Sort the cards if card view is active.");
cbSortBy.setMaximumSize(new java.awt.Dimension(120, 20)); cbSortBy.setMaximumSize(new java.awt.Dimension(120, 20));
cbSortBy.setMinimumSize(new java.awt.Dimension(120, 20)); cbSortBy.setMinimumSize(new java.awt.Dimension(120, 20));
@ -660,15 +659,15 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
e.consume(); e.consume();
if (obj instanceof Card) { if (obj instanceof Card) {
if (e.isAltDown()) { if (e.isAltDown()) {
cardEventSource.altDoubleClick(((Card) obj).getOriginal(), "alt-double-click"); cardEventSource.fireEvent(((Card) obj).getOriginal(), ClientEventType.ALT_DOUBLE_CLICK);
} else { } else {
cardEventSource.doubleClick(((Card) obj).getOriginal(), "double-click"); cardEventSource.fireEvent(((Card) obj).getOriginal(), ClientEventType.DOUBLE_CLICK);
} }
} else if (obj instanceof MageCard) { } else if (obj instanceof MageCard) {
if (e.isAltDown()) { if (e.isAltDown()) {
cardEventSource.altDoubleClick(((MageCard) obj).getOriginal(), "alt-double-click"); cardEventSource.fireEvent(((MageCard) obj).getOriginal(), ClientEventType.ALT_DOUBLE_CLICK);
} else { } else {
cardEventSource.doubleClick(((MageCard) obj).getOriginal(), "double-click"); cardEventSource.fireEvent(((MageCard) obj).getOriginal(), ClientEventType.DOUBLE_CLICK);
} }
} }
} }
@ -695,7 +694,7 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
private void checkMenu(MouseEvent Me, SimpleCardView card) { private void checkMenu(MouseEvent Me, SimpleCardView card) {
if (Me.isPopupTrigger()) { if (Me.isPopupTrigger()) {
Me.consume(); Me.consume();
cardEventSource.showPopupMenuEvent(card, Me.getComponent(), Me.getX(), Me.getY(), "show-popup-menu"); cardEventSource.fireEvent(card, Me.getComponent(), Me.getX(), Me.getY(), ClientEventType.SHOW_POP_UP_MENU);
} }
} }

View file

@ -34,17 +34,11 @@
package mage.client.cards; package mage.client.cards;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.ArrayList;
import java.util.List;
import mage.cards.CardDimensions; import mage.cards.CardDimensions;
import mage.cards.MageCard; import mage.cards.MageCard;
import mage.client.plugins.impl.Plugins; import mage.client.plugins.impl.Plugins;
import mage.client.util.CardViewRarityComparator; import mage.client.util.CardViewRarityComparator;
import mage.client.util.ClientEventType;
import mage.client.util.Event; import mage.client.util.Event;
import mage.client.util.Listener; import mage.client.util.Listener;
import mage.client.util.audio.AudioManager; import mage.client.util.audio.AudioManager;
@ -53,6 +47,12 @@ import mage.view.CardView;
import mage.view.CardsView; import mage.view.CardsView;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.ArrayList;
import java.util.List;
/** /**
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
@ -186,7 +186,7 @@ public class DraftGrid extends javax.swing.JPanel implements MouseListener {
if (e.getButton() == MouseEvent.BUTTON1) { if (e.getButton() == MouseEvent.BUTTON1) {
Object obj = e.getSource(); Object obj = e.getSource();
if (obj instanceof MageCard) { if (obj instanceof MageCard) {
this.cardEventSource.doubleClick(((MageCard)obj).getOriginal(), "pick-a-card"); this.cardEventSource.fireEvent(((MageCard)obj).getOriginal(), ClientEventType.PICK_A_CARD);
this.hidePopup(); this.hidePopup();
AudioManager.playOnDraftSelect(); AudioManager.playOnDraftSelect();
} }
@ -203,7 +203,7 @@ public class DraftGrid extends javax.swing.JPanel implements MouseListener {
if (this.markedCard != null) { if (this.markedCard != null) {
markedCard.setSelected(false); markedCard.setSelected(false);
} }
this.cardEventSource.doubleClick(((MageCard)obj).getOriginal(), "mark-a-card"); this.cardEventSource.fireEvent(((MageCard)obj).getOriginal(), ClientEventType.MARK_A_CARD);
markedCard = ((MageCard)obj); markedCard = ((MageCard)obj);
markedCard.setSelected(true); markedCard.setSelected(true);
repaint(); repaint();

View file

@ -70,7 +70,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
if (card.isSelected()) { if (card.isSelected()) {
stack.set(i, null); stack.set(i, null);
removeCardView(card); removeCardView(card);
eventSource.removeSpecificCard(card, "remove-specific-card"); eventSource.fireEvent(card, ClientEventType.REMOVE_SPECIFIC_CARD);
} }
} }
} }
@ -326,7 +326,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
for (CardView card : cards) { for (CardView card : cards) {
card.setSelected(true); card.setSelected(true);
addCardView(card, false); addCardView(card, false);
eventSource.addSpecificCard(card, "add-specific-card"); eventSource.fireEvent(card, ClientEventType.ADD_SPECIFIC_CARD);
} }
layoutGrid(); layoutGrid();
cardContent.repaint(); cardContent.repaint();
@ -381,7 +381,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
for (int i = 0; i < stack.size(); ++i) { for (int i = 0; i < stack.size(); ++i) {
CardView card = stack.get(i); CardView card = stack.get(i);
if (card.isSelected()) { if (card.isSelected()) {
eventSource.removeSpecificCard(card, "remove-specific-card"); eventSource.fireEvent(card, ClientEventType.REMOVE_SPECIFIC_CARD);
stack.set(i, null); stack.set(i, null);
removeCardView(card); removeCardView(card);
} }
@ -1497,7 +1497,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
if (acard.getName().equals(card.getName())) { if (acard.getName().equals(card.getName())) {
CardView pimpedCard = new CardView(acard); CardView pimpedCard = new CardView(acard);
addCardView(pimpedCard, false); addCardView(pimpedCard, false);
eventSource.addSpecificCard(pimpedCard, "add-specific-card"); eventSource.fireEvent(pimpedCard, ClientEventType.ADD_SPECIFIC_CARD);
pimpedCards.put(pimpedCard, 1); pimpedCards.put(pimpedCard, 1);
didModify = true; didModify = true;
} }
@ -1748,9 +1748,9 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
if (e.getClickCount() == 1) { if (e.getClickCount() == 1) {
cardClicked(card, e); cardClicked(card, e);
} else if (e.isAltDown()) { } else if (e.isAltDown()) {
eventSource.altDoubleClick(card, "alt-double-click"); eventSource.fireEvent(card, ClientEventType.ALT_DOUBLE_CLICK);
} else { } else {
eventSource.doubleClick(card, "double-click"); eventSource.fireEvent(card, ClientEventType.DOUBLE_CLICK);
} }
} }
} }
@ -1776,7 +1776,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
if (duplicated) { if (duplicated) {
sortIntoGrid(card); sortIntoGrid(card);
eventSource.addSpecificCard(card, "add-specific-card"); eventSource.fireEvent(card, ClientEventType.ADD_SPECIFIC_CARD);
// Update layout // Update layout
layoutGrid(); layoutGrid();
// Update draw // Update draw

View file

@ -32,10 +32,6 @@
*/ */
package mage.client.deckeditor; package mage.client.deckeditor;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.*;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.decks.Deck; import mage.cards.decks.Deck;
import mage.cards.decks.DeckCardLayout; import mage.cards.decks.DeckCardLayout;
@ -43,12 +39,18 @@ import mage.client.cards.BigCard;
import mage.client.cards.CardEventSource; import mage.client.cards.CardEventSource;
import mage.client.cards.DragCardGrid; import mage.client.cards.DragCardGrid;
import mage.client.constants.Constants.DeckEditorMode; import mage.client.constants.Constants.DeckEditorMode;
import mage.client.util.ClientEventType;
import mage.client.util.Event; import mage.client.util.Event;
import mage.client.util.GUISizeHelper; import mage.client.util.GUISizeHelper;
import mage.client.util.Listener; import mage.client.util.Listener;
import mage.view.CardView; import mage.view.CardView;
import mage.view.CardsView; import mage.view.CardsView;
import javax.swing.*;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** /**
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
@ -124,8 +126,8 @@ public class DeckArea extends javax.swing.JPanel {
// Add to hidden and move to sideboard // Add to hidden and move to sideboard
for (CardView card : cards) { for (CardView card : cards) {
hiddenCards.add(card.getId()); hiddenCards.add(card.getId());
maindeckVirtualEvent.removeSpecificCard(card, "remove-specific-card"); maindeckVirtualEvent.fireEvent(card, ClientEventType.REMOVE_SPECIFIC_CARD);
sideboardVirtualEvent.addSpecificCard(card, "add-specific-card"); sideboardVirtualEvent.fireEvent(card, ClientEventType.ADD_SPECIFIC_CARD);
} }
loadDeck(lastDeck, lastBigCard); loadDeck(lastDeck, lastBigCard);
} }

View file

@ -27,23 +27,6 @@
*/ */
package mage.client.deckeditor; package mage.client.deckeditor;
import java.awt.*;
import java.awt.event.*;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.*;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import javax.swing.*;
import javax.swing.Timer;
import javax.swing.filechooser.FileFilter;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.Sets; import mage.cards.Sets;
import mage.cards.decks.Deck; import mage.cards.decks.Deck;
@ -72,6 +55,18 @@ import mage.view.CardView;
import mage.view.SimpleCardView; import mage.view.SimpleCardView;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import javax.swing.*;
import javax.swing.Timer;
import javax.swing.filechooser.FileFilter;
import java.awt.*;
import java.awt.event.*;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.*;
import java.util.List;
import java.util.concurrent.*;
/** /**
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
@ -280,11 +275,11 @@ public class DeckEditorPanel extends javax.swing.JPanel {
component.clearCardEventListeners(); component.clearCardEventListeners();
component.addCardEventListener( component.addCardEventListener(
(Listener<Event>) event -> { (Listener<Event>) event -> {
switch (event.getEventName()) { switch (event.getEventType()) {
case "double-click": case DOUBLE_CLICK:
moveSelectorCardToDeck(event); moveSelectorCardToDeck(event);
break; break;
case "alt-double-click": case ALT_DOUBLE_CLICK:
if (mode == DeckEditorMode.FREE_BUILDING) { if (mode == DeckEditorMode.FREE_BUILDING) {
moveSelectorCardToSideboard(event); moveSelectorCardToSideboard(event);
} else { } else {
@ -292,10 +287,10 @@ public class DeckEditorPanel extends javax.swing.JPanel {
moveSelectorCardToDeck(event); moveSelectorCardToDeck(event);
} }
break; break;
case "remove-main": case REMOVE_MAIN:
DeckEditorPanel.this.deckArea.getDeckList().removeSelection(); DeckEditorPanel.this.deckArea.getDeckList().removeSelection();
break; break;
case "remove-sideboard": case REMOVE_SIDEBOARD:
DeckEditorPanel.this.deckArea.getSideboardList().removeSelection(); DeckEditorPanel.this.deckArea.getSideboardList().removeSelection();
break; break;
} }
@ -306,8 +301,8 @@ public class DeckEditorPanel extends javax.swing.JPanel {
this.deckArea.addDeckEventListener( this.deckArea.addDeckEventListener(
(Listener<Event>) event -> { (Listener<Event>) event -> {
if (mode == DeckEditorMode.FREE_BUILDING) { if (mode == DeckEditorMode.FREE_BUILDING) {
switch (event.getEventName()) { switch (event.getEventType()) {
case "double-click": { case DOUBLE_CLICK: {
SimpleCardView cardView = (SimpleCardView) event.getSource(); SimpleCardView cardView = (SimpleCardView) event.getSource();
for (Card card : deck.getCards()) { for (Card card : deck.getCards()) {
if (card.getId().equals(cardView.getId())) { if (card.getId().equals(cardView.getId())) {
@ -319,7 +314,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
refreshDeck(); refreshDeck();
break; break;
} }
case "alt-double-click": { case ALT_DOUBLE_CLICK: {
SimpleCardView cardView = (SimpleCardView) event.getSource(); SimpleCardView cardView = (SimpleCardView) event.getSource();
for (Card card : deck.getCards()) { for (Card card : deck.getCards()) {
if (card.getId().equals(cardView.getId())) { if (card.getId().equals(cardView.getId())) {
@ -332,11 +327,11 @@ public class DeckEditorPanel extends javax.swing.JPanel {
refreshDeck(); refreshDeck();
break; break;
} }
case "set-number": { case SET_NUMBER: {
setCardNumberToCardsList(event, deck.getCards()); setCardNumberToCardsList(event, deck.getCards());
break; break;
} }
case "remove-specific-card": { case REMOVE_SPECIFIC_CARD: {
SimpleCardView cardView = (SimpleCardView) event.getSource(); SimpleCardView cardView = (SimpleCardView) event.getSource();
for (Card card : deck.getCards()) { for (Card card : deck.getCards()) {
if (card.getId().equals(cardView.getId())) { if (card.getId().equals(cardView.getId())) {
@ -347,7 +342,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
} }
break; break;
} }
case "add-specific-card": { case ADD_SPECIFIC_CARD: {
SimpleCardView cardView = (CardView) event.getSource(); SimpleCardView cardView = (CardView) event.getSource();
deck.getCards().add(retrieveTemporaryCard(cardView)); deck.getCards().add(retrieveTemporaryCard(cardView));
break; break;
@ -355,9 +350,9 @@ public class DeckEditorPanel extends javax.swing.JPanel {
} }
} else { } else {
// constructing phase or sideboarding during match -> card goes always to sideboard // constructing phase or sideboarding during match -> card goes always to sideboard
switch (event.getEventName()) { switch (event.getEventType()) {
case "double-click": case DOUBLE_CLICK:
case "alt-double-click": { case ALT_DOUBLE_CLICK: {
SimpleCardView cardView = (SimpleCardView) event.getSource(); SimpleCardView cardView = (SimpleCardView) event.getSource();
for (Card card : deck.getCards()) { for (Card card : deck.getCards()) {
if (card.getId().equals(cardView.getId())) { if (card.getId().equals(cardView.getId())) {
@ -371,7 +366,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
refreshDeck(); refreshDeck();
break; break;
} }
case "remove-specific-card": { case REMOVE_SPECIFIC_CARD: {
SimpleCardView cardView = (SimpleCardView) event.getSource(); SimpleCardView cardView = (SimpleCardView) event.getSource();
for (Card card : deck.getCards()) { for (Card card : deck.getCards()) {
if (card.getId().equals(cardView.getId())) { if (card.getId().equals(cardView.getId())) {
@ -382,7 +377,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
} }
break; break;
} }
case "add-specific-card": { case ADD_SPECIFIC_CARD: {
SimpleCardView cardView = (CardView) event.getSource(); SimpleCardView cardView = (CardView) event.getSource();
deck.getCards().add(retrieveTemporaryCard(cardView)); deck.getCards().add(retrieveTemporaryCard(cardView));
break; break;
@ -395,8 +390,8 @@ public class DeckEditorPanel extends javax.swing.JPanel {
(Listener<Event>) event -> { (Listener<Event>) event -> {
if (mode == DeckEditorMode.FREE_BUILDING) { if (mode == DeckEditorMode.FREE_BUILDING) {
// normal edit mode // normal edit mode
switch (event.getEventName()) { switch (event.getEventType()) {
case "double-click": case DOUBLE_CLICK:
// remove card from sideboard (don't add it to deck) // remove card from sideboard (don't add it to deck)
SimpleCardView cardView = (SimpleCardView) event.getSource(); SimpleCardView cardView = (SimpleCardView) event.getSource();
for (Card card : deck.getSideboard()) { for (Card card : deck.getSideboard()) {
@ -408,7 +403,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
hidePopup(); hidePopup();
refreshDeck(); refreshDeck();
break; break;
case "alt-double-click": case ALT_DOUBLE_CLICK:
// remove card from sideboard // remove card from sideboard
cardView = (SimpleCardView) event.getSource(); cardView = (SimpleCardView) event.getSource();
for (Card card : deck.getSideboard()) { for (Card card : deck.getSideboard()) {
@ -421,11 +416,11 @@ public class DeckEditorPanel extends javax.swing.JPanel {
hidePopup(); hidePopup();
refreshDeck(); refreshDeck();
break; break;
case "set-number": { case SET_NUMBER: {
setCardNumberToCardsList(event, deck.getSideboard()); setCardNumberToCardsList(event, deck.getSideboard());
break; break;
} }
case "remove-specific-card": { case REMOVE_SPECIFIC_CARD: {
cardView = (SimpleCardView) event.getSource(); cardView = (SimpleCardView) event.getSource();
for (Card card : deck.getSideboard()) { for (Card card : deck.getSideboard()) {
if (card.getId().equals(cardView.getId())) { if (card.getId().equals(cardView.getId())) {
@ -436,7 +431,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
} }
break; break;
} }
case "add-specific-card": { case ADD_SPECIFIC_CARD: {
cardView = (CardView) event.getSource(); cardView = (CardView) event.getSource();
deck.getSideboard().add(retrieveTemporaryCard(cardView)); deck.getSideboard().add(retrieveTemporaryCard(cardView));
break; break;
@ -444,8 +439,8 @@ public class DeckEditorPanel extends javax.swing.JPanel {
} }
} else { } else {
// construct phase or sideboarding during match // construct phase or sideboarding during match
switch (event.getEventName()) { switch (event.getEventType()) {
case "remove-specific-card": { case REMOVE_SPECIFIC_CARD: {
SimpleCardView cardView = (SimpleCardView) event.getSource(); SimpleCardView cardView = (SimpleCardView) event.getSource();
for (Card card : deck.getSideboard()) { for (Card card : deck.getSideboard()) {
if (card.getId().equals(cardView.getId())) { if (card.getId().equals(cardView.getId())) {
@ -456,13 +451,13 @@ public class DeckEditorPanel extends javax.swing.JPanel {
} }
break; break;
} }
case "add-specific-card": { case ADD_SPECIFIC_CARD: {
SimpleCardView cardView = (CardView) event.getSource(); SimpleCardView cardView = (CardView) event.getSource();
deck.getSideboard().add(retrieveTemporaryCard(cardView)); deck.getSideboard().add(retrieveTemporaryCard(cardView));
break; break;
} }
case "double-click": case DOUBLE_CLICK:
case "alt-double-click": case ALT_DOUBLE_CLICK:
SimpleCardView cardView = (SimpleCardView) event.getSource(); SimpleCardView cardView = (SimpleCardView) event.getSource();
for (Card card : deck.getSideboard()) { for (Card card : deck.getSideboard()) {
if (card.getId().equals(cardView.getId())) { if (card.getId().equals(cardView.getId())) {

View file

@ -33,6 +33,7 @@ import mage.client.cards.CardEventSource;
import mage.client.cards.ICardGrid; import mage.client.cards.ICardGrid;
import mage.client.deckeditor.SortSetting; import mage.client.deckeditor.SortSetting;
import mage.client.plugins.impl.Plugins; import mage.client.plugins.impl.Plugins;
import mage.client.util.ClientEventType;
import mage.client.util.Config; import mage.client.util.Config;
import mage.client.util.Event; import mage.client.util.Event;
import mage.client.util.Listener; import mage.client.util.Listener;
@ -146,7 +147,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
} }
// no easy logic for merge :) // no easy logic for merge :)
for (Iterator<Entry<UUID, CardView>> i = cards.entrySet().iterator(); i.hasNext();) { for (Iterator<Entry<UUID, CardView>> i = cards.entrySet().iterator(); i.hasNext(); ) {
Entry<UUID, CardView> entry = i.next(); Entry<UUID, CardView> entry = i.next();
if (!showCards.containsKey(entry.getKey())) { if (!showCards.containsKey(entry.getKey())) {
i.remove(); i.remove();
@ -306,25 +307,25 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
public void setNumber(int index, int number) { public void setNumber(int index, int number) {
CardView card = view.get(index); CardView card = view.get(index);
cardEventSource.setNumber(card, "set-number", number); cardEventSource.fireEvent(card, ClientEventType.SET_NUMBER, number);
} }
public void doubleClick(int index) { public void doubleClick(int index) {
CardView card = view.get(index); CardView card = view.get(index);
cardEventSource.doubleClick(card, "double-click"); cardEventSource.fireEvent(card, ClientEventType.DOUBLE_CLICK);
} }
public void altDoubleClick(int index) { public void altDoubleClick(int index) {
CardView card = view.get(index); CardView card = view.get(index);
cardEventSource.altDoubleClick(card, "alt-double-click"); cardEventSource.fireEvent(card, ClientEventType.ALT_DOUBLE_CLICK);
} }
public void removeFromMainEvent(int index) { public void removeFromMainEvent(int index) {
cardEventSource.removeFromMainEvent("remove-main"); cardEventSource.fireEvent(ClientEventType.REMOVE_MAIN);
} }
public void removeFromSideEvent(int index) { public void removeFromSideEvent(int index) {
cardEventSource.removeFromSideboardEvent("remove-sideboard"); cardEventSource.fireEvent(ClientEventType.REMOVE_SIDEBOARD);
} }
public void addListeners(final JTable table) { public void addListeners(final JTable table) {

View file

@ -33,9 +33,25 @@
*/ */
package mage.client.draft; package mage.client.draft;
import java.awt.Component; import mage.cards.repository.CardInfo;
import java.awt.Dimension; import mage.cards.repository.CardRepository;
import java.awt.Image; import mage.client.MageFrame;
import mage.client.SessionHandler;
import mage.client.components.tray.MageTray;
import mage.client.deckeditor.SortSettingDraft;
import mage.client.dialog.PreferencesDialog;
import mage.client.plugins.impl.Plugins;
import mage.client.util.*;
import mage.client.util.Event;
import mage.client.util.audio.AudioManager;
import mage.client.util.gui.BufferedImageBuilder;
import mage.constants.PlayerAction;
import mage.view.*;
import org.apache.log4j.Logger;
import javax.swing.*;
import javax.swing.Timer;
import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
@ -46,43 +62,7 @@ import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.StandardOpenOption; import java.nio.file.StandardOpenOption;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Collection; import java.util.*;
import java.util.Date;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import javax.swing.AbstractAction;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import javax.swing.KeyStroke;
import javax.swing.Timer;
import mage.cards.repository.CardInfo;
import mage.cards.repository.CardRepository;
import mage.client.MageFrame;
import mage.client.SessionHandler;
import mage.client.components.tray.MageTray;
import mage.client.deckeditor.SortSettingDraft;
import mage.client.dialog.PreferencesDialog;
import mage.client.plugins.impl.Plugins;
import mage.client.util.CardsViewUtil;
import mage.client.util.Event;
import mage.client.util.GUISizeHelper;
import mage.client.util.ImageHelper;
import mage.client.util.Listener;
import mage.client.util.audio.AudioManager;
import mage.client.util.gui.BufferedImageBuilder;
import mage.constants.PlayerAction;
import mage.view.CardsView;
import mage.view.DraftPickView;
import mage.view.DraftView;
import mage.view.SimpleCardView;
import mage.view.SimpleCardsView;
import mage.view.UserRequestMessage;
import org.apache.log4j.Logger;
/** /**
* *
@ -304,7 +284,7 @@ public class DraftPanel extends javax.swing.JPanel {
this.draftPicks.clearCardEventListeners(); this.draftPicks.clearCardEventListeners();
this.draftPicks.addCardEventListener((Listener<Event>) event -> { this.draftPicks.addCardEventListener((Listener<Event>) event -> {
if (event.getEventName().equals("show-popup-menu")) { if (event.getEventType() == ClientEventType.SHOW_POP_UP_MENU) {
if (event.getSource() != null) { if (event.getSource() != null) {
// Popup Menu Card // Popup Menu Card
cardIdPopupMenu = ((SimpleCardView) event.getSource()).getId(); cardIdPopupMenu = ((SimpleCardView) event.getSource()).getId();
@ -322,7 +302,7 @@ public class DraftPanel extends javax.swing.JPanel {
this.draftBooster.clearCardEventListeners(); this.draftBooster.clearCardEventListeners();
this.draftBooster.addCardEventListener( this.draftBooster.addCardEventListener(
(Listener<Event>) event -> { (Listener<Event>) event -> {
if (event.getEventName().equals("pick-a-card")) { if (event.getEventType() == ClientEventType.PICK_A_CARD) {
SimpleCardView source = (SimpleCardView) event.getSource(); SimpleCardView source = (SimpleCardView) event.getSource();
DraftPickView view = SessionHandler.sendCardPick(draftId, source.getId(), cardsHidden); DraftPickView view = SessionHandler.sendCardPick(draftId, source.getId(), cardsHidden);
if (view != null) { if (view != null) {
@ -332,7 +312,7 @@ public class DraftPanel extends javax.swing.JPanel {
setMessage("Waiting for other players"); setMessage("Waiting for other players");
} }
} }
if (event.getEventName().equals("mark-a-card")) { if (event.getEventType() == ClientEventType.MARK_A_CARD) {
SimpleCardView source = (SimpleCardView) event.getSource(); SimpleCardView source = (SimpleCardView) event.getSource();
SessionHandler.sendCardMark(draftId, source.getId()); SessionHandler.sendCardMark(draftId, source.getId());
} }

View file

@ -27,61 +27,6 @@
*/ */
package mage.client.game; package mage.client.game;
import java.awt.AWTEvent;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import static java.awt.Component.LEFT_ALIGNMENT;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JLayeredPane;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import javax.swing.Timer;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import javax.swing.border.LineBorder;
import javax.swing.plaf.basic.BasicSplitPaneDivider;
import javax.swing.plaf.basic.BasicSplitPaneUI;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.action.ActionCallback; import mage.cards.action.ActionCallback;
import mage.choices.Choice; import mage.choices.Choice;
@ -95,51 +40,43 @@ import mage.client.components.KeyboundButton;
import mage.client.components.MageComponents; import mage.client.components.MageComponents;
import mage.client.components.ext.dlg.DialogManager; import mage.client.components.ext.dlg.DialogManager;
import mage.client.components.layout.RelativeLayout; import mage.client.components.layout.RelativeLayout;
import mage.client.dialog.CardInfoWindowDialog; import mage.client.dialog.*;
import mage.client.dialog.CardInfoWindowDialog.ShowType; import mage.client.dialog.CardInfoWindowDialog.ShowType;
import mage.client.dialog.PickChoiceDialog;
import mage.client.dialog.PickNumberDialog;
import mage.client.dialog.PickPileDialog;
import mage.client.dialog.PreferencesDialog;
import static mage.client.dialog.PreferencesDialog.*;
import mage.client.dialog.ShowCardsDialog;
import mage.client.game.FeedbackPanel.FeedbackMode; import mage.client.game.FeedbackPanel.FeedbackMode;
import mage.client.plugins.adapters.MageActionCallback; import mage.client.plugins.adapters.MageActionCallback;
import mage.client.plugins.impl.Plugins; import mage.client.plugins.impl.Plugins;
import mage.client.util.CardsViewUtil; import mage.client.util.*;
import mage.client.util.Event; import mage.client.util.Event;
import mage.client.util.GUISizeHelper;
import mage.client.util.GameManager;
import mage.client.util.Listener;
import mage.client.util.audio.AudioManager; import mage.client.util.audio.AudioManager;
import mage.client.util.gui.ArrowBuilder; import mage.client.util.gui.ArrowBuilder;
import mage.client.util.gui.MageDialogState; import mage.client.util.gui.MageDialogState;
import mage.constants.Constants; import mage.constants.*;
import mage.constants.EnlargeMode;
import mage.constants.PhaseStep;
import mage.constants.PlayerAction;
import static mage.constants.PlayerAction.TRIGGER_AUTO_ORDER_ABILITY_FIRST;
import static mage.constants.PlayerAction.TRIGGER_AUTO_ORDER_ABILITY_LAST;
import static mage.constants.PlayerAction.TRIGGER_AUTO_ORDER_NAME_FIRST;
import static mage.constants.PlayerAction.TRIGGER_AUTO_ORDER_NAME_LAST;
import static mage.constants.PlayerAction.TRIGGER_AUTO_ORDER_RESET_ALL;
import mage.constants.Zone;
import mage.game.events.PlayerQueryEvent; import mage.game.events.PlayerQueryEvent;
import mage.view.AbilityPickerView; import mage.view.*;
import mage.view.CardView;
import mage.view.CardsView;
import mage.view.ExileView;
import mage.view.GameView;
import mage.view.LookedAtView;
import mage.view.MatchView;
import mage.view.PlayerView;
import mage.view.RevealedView;
import mage.view.SimpleCardsView;
import mage.view.UserRequestMessage;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.mage.card.arcane.CardPanel; import org.mage.card.arcane.CardPanel;
import org.mage.plugins.card.utils.impl.ImageManagerImpl; import org.mage.plugins.card.utils.impl.ImageManagerImpl;
import javax.swing.*;
import javax.swing.GroupLayout.Alignment;
import javax.swing.Timer;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import javax.swing.border.LineBorder;
import javax.swing.plaf.basic.BasicSplitPaneDivider;
import javax.swing.plaf.basic.BasicSplitPaneUI;
import java.awt.*;
import java.awt.event.*;
import java.io.Serializable;
import java.util.*;
import java.util.List;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import static mage.client.dialog.PreferencesDialog.*;
import static mage.constants.PlayerAction.*;
/** /**
* @author BetaSteward_at_googlemail.com, nantuko8 * @author BetaSteward_at_googlemail.com, nantuko8
*/ */
@ -2251,7 +2188,7 @@ public final class GamePanel extends javax.swing.JPanel {
// Event listener for the ShowCardsDialog // Event listener for the ShowCardsDialog
private Listener<Event> getShowCardsEventListener(final ShowCardsDialog dialog) { private Listener<Event> getShowCardsEventListener(final ShowCardsDialog dialog) {
return (Listener<Event>) event -> { return (Listener<Event>) event -> {
if (event.getEventName().equals("show-popup-menu")) { if (event.getEventType() == ClientEventType.SHOW_POP_UP_MENU) {
if (event.getComponent() != null && event.getComponent() instanceof CardPanel) { if (event.getComponent() != null && event.getComponent() instanceof CardPanel) {
JPopupMenu menu = ((CardPanel) event.getComponent()).getPopupMenu(); JPopupMenu menu = ((CardPanel) event.getComponent()).getPopupMenu();
if (menu != null) { if (menu != null) {
@ -2260,7 +2197,7 @@ public final class GamePanel extends javax.swing.JPanel {
} }
} }
} }
if (event.getEventName().equals("action-consumed")) { if (event.getEventType() == ClientEventType.ACTION_CONSUMED) {
dialog.removeDialog(); dialog.removeDialog();
} }
}; };

View file

@ -28,11 +28,9 @@
package mage.client.table; package mage.client.table;
import mage.client.util.*;
import java.io.Serializable; import java.io.Serializable;
import mage.client.util.Event;
import mage.client.util.EventDispatcher;
import mage.client.util.EventSource;
import mage.client.util.Listener;
/** /**
* *
@ -48,7 +46,7 @@ public class PlayerTypeEventSource implements EventSource<Event>, Serializable {
} }
public void playerTypeChanged() { public void playerTypeChanged() {
dispatcher.fireEvent(new Event(null, "playerTypeChanged")); dispatcher.fireEvent(new Event(null, ClientEventType.PLAYER_TYPE_CHANGED));
} }
@Override @Override

View file

@ -0,0 +1,20 @@
package mage.client.util;
public enum ClientEventType {
SET_NUMBER,
ACTION_CONSUMED,
DOUBLE_CLICK,
ALT_DOUBLE_CLICK,
REMOVE_MAIN,
REMOVE_SIDEBOARD,
SHOW_POP_UP_MENU,
REMOVE_SPECIFIC_CARD,
ADD_SPECIFIC_CARD,
PICK_A_CARD,
MARK_A_CARD,
PLAYER_TYPE_CHANGED
}

View file

@ -38,27 +38,27 @@ import java.io.Serializable;
public class Event implements Serializable { public class Event implements Serializable {
private final Object source; private final Object source;
private final Component component; private final Component component;
private final String eventName; private final ClientEventType eventType;
private final int number; private final int number;
private final int xPos; private final int xPos;
private final int yPos; private final int yPos;
public Event(Object source, String eventName) { public Event(Object source, ClientEventType eventType) {
this(source, eventName, 0); this(source, eventType, 0);
} }
public Event(Object source, String eventName, int number) { public Event(Object source, ClientEventType eventType, int number) {
this.source = source; this.source = source;
this.eventName = eventName; this.eventType = eventType;
this.number = number; this.number = number;
this.xPos = 0; this.xPos = 0;
this.yPos = 0; this.yPos = 0;
this.component = null; this.component = null;
} }
public Event(Object source, String eventName, int xPos, int yPos, Component component) { public Event(Object source, ClientEventType eventType, int xPos, int yPos, Component component) {
this.source = source; this.source = source;
this.eventName = eventName; this.eventType = eventType;
this.number =0; this.number =0;
this.xPos = xPos; this.xPos = xPos;
this.yPos = yPos; this.yPos = yPos;
@ -69,8 +69,8 @@ public class Event implements Serializable {
return source; return source;
} }
public String getEventName() { public ClientEventType getEventType() {
return eventName; return eventType;
} }
public int getNumber() { public int getNumber() {

View file

@ -5,10 +5,7 @@
*/ */
package org.mage.card.arcane; package org.mage.card.arcane;
import java.awt.Color; import java.awt.*;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Paint;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
@ -19,7 +16,7 @@ import java.util.regex.Pattern;
/** /**
* @author stravant@gmail.com * @author stravant@gmail.com
* * <p>
* Various static utilities for use in the card renderer * Various static utilities for use in the card renderer
*/ */
public final class CardRendererUtils { public final class CardRendererUtils {
@ -124,6 +121,8 @@ public final class CardRendererUtils {
} }
public static String killReminderText(String rule) { public static String killReminderText(String rule) {
return killReminderTextPattern.matcher(rule).replaceAll(""); return killReminderTextPattern.matcher(rule).replaceAll("")
.replaceAll("<i>", "")
.replaceAll("</i>", "");
} }
} }

View file

@ -41,7 +41,7 @@ public class MageVersion implements Serializable, Comparable<MageVersion> {
public final static int MAGE_VERSION_MAJOR = 1; public final static int MAGE_VERSION_MAJOR = 1;
public final static int MAGE_VERSION_MINOR = 4; public final static int MAGE_VERSION_MINOR = 4;
public final static int MAGE_VERSION_PATCH = 26; public final static int MAGE_VERSION_PATCH = 26;
public final static String MAGE_VERSION_MINOR_PATCH = "V6"; public final static String MAGE_VERSION_MINOR_PATCH = "V7";
public final static String MAGE_VERSION_INFO = ""; public final static String MAGE_VERSION_INFO = "";
private final int major; private final int major;

View file

@ -73,9 +73,7 @@ public class Standard extends Constructed {
} }
} }
banned.add("Aetherworks Marvel"); banned.add("Aetherworks Marvel");
banned.add("Emrakul, the Promised End");
banned.add("Felidar Guardian"); banned.add("Felidar Guardian");
banned.add("Reflector Mage");
banned.add("Smuggler's Copter"); banned.add("Smuggler's Copter");
} }
@ -83,6 +81,6 @@ public class Standard extends Constructed {
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
cal.setTime(set.getReleaseDate()); cal.setTime(set.getReleaseDate());
// Sets from fall block are normally released in September and January // Sets from fall block are normally released in September and January
return cal.get(Calendar.MONTH) > 8 || cal.get(Calendar.MONTH) < 2; return cal.get(Calendar.MONTH) > 7 || cal.get(Calendar.MONTH) < 2;
} }
} }

View file

@ -548,8 +548,6 @@ public class MageServerImpl implements MageServer {
UUID userId = session.get().getUserId(); UUID userId = session.get().getUserId();
ChatManager.instance.leaveChat(chatId, userId); ChatManager.instance.leaveChat(chatId, userId);
} }
} else {
logger.warn("The chatId is null. sessionId = " + sessionId);
} }
}); });
} }

View file

@ -56,7 +56,7 @@ import java.util.*;
*/ */
public class AdmiralBeckettBrass extends CardImpl { public class AdmiralBeckettBrass extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("other Pirates you control"); private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Pirates you control");
private static final FilterNonlandPermanent filter2 = new FilterNonlandPermanent("nonland permanent controlled by a player who was dealt combat damage by three or more Pirates this turn"); private static final FilterNonlandPermanent filter2 = new FilterNonlandPermanent("nonland permanent controlled by a player who was dealt combat damage by three or more Pirates this turn");
static { static {
@ -78,7 +78,7 @@ public class AdmiralBeckettBrass extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, filter, true))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, filter, true)));
// At the beginning of your end step, gain control of target nonland permanent controlled by a player who was dealt combat damage by three or more Pirates this turn. // At the beginning of your end step, gain control of target nonland permanent controlled by a player who was dealt combat damage by three or more Pirates this turn.
Ability ability = new BeginningOfEndStepTriggeredAbility(new GainControlTargetEffect(Duration.Custom), TargetController.YOU, false); Ability ability = new BeginningOfEndStepTriggeredAbility(new GainControlTargetEffect(Duration.Custom, true), TargetController.YOU, false);
ability.addTarget(new TargetNonlandPermanent(filter2)); ability.addTarget(new TargetNonlandPermanent(filter2));
this.addAbility(ability, new DamagedByPiratesWatcher()); this.addAbility(ability, new DamagedByPiratesWatcher());
} }

View file

@ -33,14 +33,17 @@ import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility; import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.PayEnergyCost; import mage.abilities.costs.common.PayEnergyCost;
import mage.abilities.effects.common.ExileSourceEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ReturnToBattlefieldUnderOwnerControlSourceEffect;
import mage.abilities.effects.common.counter.GetEnergyCountersControllerEffect; import mage.abilities.effects.common.counter.GetEnergyCountersControllerEffect;
import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
/** /**
* *
@ -60,9 +63,7 @@ public class AethergeodeMiner extends CardImpl {
this.addAbility(new AttacksTriggeredAbility(new GetEnergyCountersControllerEffect(2), false)); this.addAbility(new AttacksTriggeredAbility(new GetEnergyCountersControllerEffect(2), false));
// Pay {E}{E}: Exile Aethergeode Miner, then return it to the battlefield under its owner's control. // Pay {E}{E}: Exile Aethergeode Miner, then return it to the battlefield under its owner's control.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileSourceEffect(true), new PayEnergyCost(2)); this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AethergeodeMinerEffect(), new PayEnergyCost(2)));
ability.addEffect(new ReturnToBattlefieldUnderOwnerControlSourceEffect());
this.addAbility(ability);
} }
public AethergeodeMiner(final AethergeodeMiner card) { public AethergeodeMiner(final AethergeodeMiner card) {
@ -74,3 +75,34 @@ public class AethergeodeMiner extends CardImpl {
return new AethergeodeMiner(this); return new AethergeodeMiner(this);
} }
} }
class AethergeodeMinerEffect extends OneShotEffect {
public AethergeodeMinerEffect() {
super(Outcome.Neutral);
this.staticText = "Exile {this}, then return it to the battlefield under its owner's control";
}
public AethergeodeMinerEffect(final AethergeodeMinerEffect effect) {
super(effect);
}
@Override
public AethergeodeMinerEffect copy() {
return new AethergeodeMinerEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
if (permanent.moveToExile(source.getSourceId(), "Aethergeode Miner", source.getSourceId(), game)) {
Card card = game.getExile().getCard(source.getSourceId(), game);
if (card != null) {
return card.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, false);
}
}
}
return false;
}
}

View file

@ -67,7 +67,7 @@ public class AgelessSentinels extends CardImpl {
this.addAbility(FlyingAbility.getInstance()); this.addAbility(FlyingAbility.getInstance());
// When Ageless Sentinels blocks, it becomes a Bird Giant, and it loses defender. // When Ageless Sentinels blocks, it becomes a Bird Giant, and it loses defender.
Ability ability = new BlocksTriggeredAbility(new AgelessSentinelsEffect(), false); Ability ability = new BlocksTriggeredAbility(new AgelessSentinelsEffect(), false, false, true);
Effect effect = new LoseAbilitySourceEffect(DefenderAbility.getInstance(), Duration.WhileOnBattlefield); Effect effect = new LoseAbilitySourceEffect(DefenderAbility.getInstance(), Duration.WhileOnBattlefield);
effect.setText("and it loses defender"); effect.setText("and it loses defender");
ability.addEffect(effect); ability.addEffect(effect);
@ -87,7 +87,7 @@ public class AgelessSentinels extends CardImpl {
public AgelessSentinelsEffect() { public AgelessSentinelsEffect() {
super(Duration.WhileOnBattlefield, Outcome.BecomeCreature); super(Duration.WhileOnBattlefield, Outcome.BecomeCreature);
staticText = "it becomes a Bird Giant, "; staticText = "it becomes a Bird Giant,";
} }
public AgelessSentinelsEffect(final AgelessSentinelsEffect effect) { public AgelessSentinelsEffect(final AgelessSentinelsEffect effect) {

View file

@ -0,0 +1,78 @@
/*
* 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.a;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.common.counter.AddCountersAllEffect;
import mage.constants.SubType;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.TargetController;
import mage.counters.CounterType;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
/**
*
* @author TheElk801
*/
public class AkuDjinn extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature each opponent controls");
static {
filter.add(new ControllerPredicate(TargetController.OPPONENT));
}
public AkuDjinn(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}{B}");
this.subtype.add(SubType.DJINN);
this.power = new MageInt(5);
this.toughness = new MageInt(6);
// Trample
this.addAbility(TrampleAbility.getInstance());
// At the beginning of your upkeep, put a +1/+1 counter on each creature each opponent controls.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new AddCountersAllEffect(CounterType.P1P1.createInstance(), filter), TargetController.YOU, false));
}
public AkuDjinn(final AkuDjinn card) {
super(card);
}
@Override
public AkuDjinn copy() {
return new AkuDjinn(this);
}
}

View file

@ -0,0 +1,69 @@
/*
* 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.a;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BlocksTriggeredAbility;
import mage.abilities.effects.common.DestroySourceEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
/**
*
* @author TheElk801
*/
public class AlabornZealot extends CardImpl {
public AlabornZealot(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.SOLDIER);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// When Alaborn Zealot blocks a creature, destroy that creature and Alaborn Zealot.
Ability ability = new BlocksTriggeredAbility(new DestroyTargetEffect().setText("destroy that creature"), false, true, true);
ability.addEffect(new DestroySourceEffect().setText("and {this}"));
this.addAbility(ability);
}
public AlabornZealot(final AlabornZealot card) {
super(card);
}
@Override
public AlabornZealot copy() {
return new AlabornZealot(this);
}
}

View file

@ -32,6 +32,7 @@ import mage.abilities.dynamicvalue.common.DomainValue;
import mage.abilities.effects.common.DrawCardTargetEffect; import mage.abilities.effects.common.DrawCardTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.AbilityWord;
import mage.constants.CardType; import mage.constants.CardType;
import mage.target.TargetPlayer; import mage.target.TargetPlayer;
@ -42,11 +43,13 @@ import mage.target.TargetPlayer;
public class AlliedStrategies extends CardImpl { public class AlliedStrategies extends CardImpl {
public AlliedStrategies(UUID ownerId, CardSetInfo setInfo) { public AlliedStrategies(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{4}{U}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{U}");
// Domain - Target player draws a card for each basic land type among lands he or she controls. // Domain - Target player draws a card for each basic land type among lands he or she controls.
this.getSpellAbility().addEffect(new DrawCardTargetEffect(new DomainValue(true))); this.getSpellAbility().addEffect(new DrawCardTargetEffect(new DomainValue(true)));
this.getSpellAbility().addTarget(new TargetPlayer()); this.getSpellAbility().addTarget(new TargetPlayer());
this.getSpellAbility().setAbilityWord(AbilityWord.DOMAIN);
} }
public AlliedStrategies(final AlliedStrategies card) { public AlliedStrategies(final AlliedStrategies card) {

View file

@ -109,6 +109,6 @@ class AlphaStatusDynamicValue implements DynamicValue {
@Override @Override
public String getMessage() { public String getMessage() {
return "each other creature on the battlefield that shares a creature type with it"; return "other creature on the battlefield that shares a creature type with it";
} }
} }

View file

@ -52,7 +52,7 @@ import mage.game.permanent.Permanent;
public class AncientOoze extends CardImpl { public class AncientOoze extends CardImpl {
public AncientOoze(UUID ownerId, CardSetInfo setInfo) { public AncientOoze(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{G}{G}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{G}{G}");
this.subtype.add(SubType.OOZE); this.subtype.add(SubType.OOZE);
this.color.setGreen(true); this.color.setGreen(true);
@ -60,7 +60,9 @@ public class AncientOoze extends CardImpl {
this.toughness = new MageInt(0); this.toughness = new MageInt(0);
// Ancient Ooze's power and toughness are each equal to the total converted mana cost of other creatures you control. // Ancient Ooze's power and toughness are each equal to the total converted mana cost of other creatures you control.
this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetPowerToughnessSourceEffect(new AncientOozePowerToughnessValue(), Duration.EndOfGame))); this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetPowerToughnessSourceEffect(new AncientOozePowerToughnessValue(), Duration.EndOfGame)
.setText("{this}'s power and toughness are each equal to the total converted mana cost of other creatures you control.")
));
} }
public AncientOoze(final AncientOoze card) { public AncientOoze(final AncientOoze card) {
@ -78,8 +80,8 @@ class AncientOozePowerToughnessValue implements DynamicValue {
@Override @Override
public int calculate(Game game, Ability sourceAbility, Effect effect) { public int calculate(Game game, Ability sourceAbility, Effect effect) {
int value = 0; int value = 0;
for(Permanent creature : game.getBattlefield().getActivePermanents(new FilterControlledCreaturePermanent(), sourceAbility.getControllerId(), game)){ for (Permanent creature : game.getBattlefield().getActivePermanents(new FilterControlledCreaturePermanent(), sourceAbility.getControllerId(), game)) {
if(creature != null && !sourceAbility.getSourceId().equals(creature.getId())){ if (creature != null && !sourceAbility.getSourceId().equals(creature.getId())) {
value += creature.getConvertedManaCost(); value += creature.getConvertedManaCost();
} }
} }

View file

@ -1,3 +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.
*/
package mage.cards.a; package mage.cards.a;
import java.util.UUID; import java.util.UUID;
@ -16,9 +43,13 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.permanent.AnotherPredicate; import mage.filter.predicate.permanent.AnotherPredicate;
import mage.target.common.TargetControlledPermanent; import mage.target.common.TargetControlledPermanent;
/**
*
* @author MajorLazar
*/
public class ApocalypseDemon extends CardImpl { public class ApocalypseDemon extends CardImpl {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("nother creature"); private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature");
static { static {
filter.add(new CardTypePredicate(CardType.CREATURE)); filter.add(new CardTypePredicate(CardType.CREATURE));
@ -37,12 +68,12 @@ public class ApocalypseDemon extends CardImpl {
// At the beginning of your upkeep, tap Apocalypse Demon unless you sacrifice another creature. // At the beginning of your upkeep, tap Apocalypse Demon unless you sacrifice another creature.
TapSourceUnlessPaysEffect tapEffect = new TapSourceUnlessPaysEffect(new SacrificeTargetCost(new TargetControlledPermanent(filter))); TapSourceUnlessPaysEffect tapEffect = new TapSourceUnlessPaysEffect(new SacrificeTargetCost(new TargetControlledPermanent(filter)));
tapEffect.setText("At the beginning of your upkeep, tap Apocalypse Demon unless you sacrifice another creature."); tapEffect.setText("tap {this} unless you sacrifice another creature.");
this.addAbility(new BeginningOfUpkeepTriggeredAbility(tapEffect, TargetController.YOU, false)); this.addAbility(new BeginningOfUpkeepTriggeredAbility(tapEffect, TargetController.YOU, false));
} }
public ApocalypseDemon(final ApocalypseDemon apocalypseDemon) { public ApocalypseDemon(final ApocalypseDemon card) {
super(apocalypseDemon); super(card);
} }
public ApocalypseDemon copy() { public ApocalypseDemon copy() {

View file

@ -0,0 +1,116 @@
/*
* 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.a;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalActivatedAbility;
import mage.abilities.effects.common.ReturnSourceFromGraveyardToBattlefieldEffect;
import mage.constants.SubType;
import mage.abilities.keyword.HasteAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author TheElk801
*/
public class AshenGhoul extends CardImpl {
public AshenGhoul(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}");
this.subtype.add(SubType.ZOMBIE);
this.power = new MageInt(3);
this.toughness = new MageInt(1);
// Haste
this.addAbility(HasteAbility.getInstance());
// {B}: Return Ashen Ghoul from your graveyard to the battlefield. Activate this ability only during your upkeep and only if three or more creature cards are above Ashen Ghoul.
this.addAbility(new ConditionalActivatedAbility(
Zone.GRAVEYARD,
new ReturnSourceFromGraveyardToBattlefieldEffect(),
new ManaCostsImpl("{B}"),
AshenGhoulCondition.instance
));
}
public AshenGhoul(final AshenGhoul card) {
super(card);
}
@Override
public AshenGhoul copy() {
return new AshenGhoul(this);
}
}
enum AshenGhoulCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (!game.getStep().getType().equals(PhaseStep.UPKEEP)
|| !game.getActivePlayerId().equals(source.getControllerId())) {
return false;
}
if (controller != null) {
int cardsAbove = 0;
boolean aboveCards = false;
for (Card card : controller.getGraveyard().getCards(game)) {
if (aboveCards && card.isCreature()) {
cardsAbove++;
if (cardsAbove > 2) {
return true;
}
}
if (card.getId().equals(source.getSourceId())) {
aboveCards = true;
}
}
}
return false;
}
@Override
public String toString() {
return "three or more creature cards are above {this}";
}
}

View file

@ -68,7 +68,7 @@ public class AtalyaSamiteMaster extends CardImpl {
// {X}, {tap}: Choose one - Prevent the next X damage that would be dealt to target creature this turn; or you gain X life. Spend only white mana on X. // {X}, {tap}: Choose one - Prevent the next X damage that would be dealt to target creature this turn; or you gain X life. Spend only white mana on X.
PreventDamageToTargetEffect effect = new PreventDamageToTargetEffect(Duration.EndOfTurn, false, true, new ManacostVariableValue()); PreventDamageToTargetEffect effect = new PreventDamageToTargetEffect(Duration.EndOfTurn, false, true, new ManacostVariableValue());
effect.setText("Prevent the next X damage that would be dealt to target creature this turn"); effect.setText("Prevent the next X damage that would be dealt to target creature this turn. Spend only white mana on X.");
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{X}")); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{X}"));
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
@ -81,7 +81,7 @@ public class AtalyaSamiteMaster extends CardImpl {
// or you gain X life // or you gain X life
Mode mode = new Mode(); Mode mode = new Mode();
mode.getEffects().add(new GainLifeEffect(new ManacostVariableValue())); mode.getEffects().add(new GainLifeEffect(new ManacostVariableValue()).setText("You gain X life. Spend only white mana on X."));
ability.addMode(mode); ability.addMode(mode);
this.addAbility(ability); this.addAbility(ability);

View file

@ -70,7 +70,7 @@ public class AuramancersGuise extends CardImpl {
BoostEnchantedEffect effect = new BoostEnchantedEffect(ptBoost, ptBoost, Duration.WhileOnBattlefield); BoostEnchantedEffect effect = new BoostEnchantedEffect(ptBoost, ptBoost, Duration.WhileOnBattlefield);
effect.setText("Enchanted creature gets +2/+2 for each Aura attached to it"); effect.setText("Enchanted creature gets +2/+2 for each Aura attached to it");
SimpleStaticAbility ability2 = new SimpleStaticAbility(Zone.BATTLEFIELD, effect); SimpleStaticAbility ability2 = new SimpleStaticAbility(Zone.BATTLEFIELD, effect);
ability2.addEffect(new GainAbilityAttachedEffect(VigilanceAbility.getInstance(), AttachmentType.AURA)); ability2.addEffect(new GainAbilityAttachedEffect(VigilanceAbility.getInstance(), AttachmentType.AURA).setText("and has vigilance"));
this.addAbility(ability2); this.addAbility(ability2);
} }

View file

@ -52,11 +52,13 @@ public class BanishingKnack extends CardImpl {
private static final FilterPermanent filter = new FilterNonlandPermanent(); private static final FilterPermanent filter = new FilterNonlandPermanent();
public BanishingKnack(UUID ownerId, CardSetInfo setInfo) { public BanishingKnack(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{U}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{U}");
Ability gainedAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandTargetEffect(), new TapSourceCost()); Ability gainedAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandTargetEffect(), new TapSourceCost());
gainedAbility.addTarget(new TargetPermanent(filter)); gainedAbility.addTarget(new TargetPermanent(filter));
this.getSpellAbility().addEffect(new GainAbilityTargetEffect(gainedAbility, Duration.EndOfTurn)); this.getSpellAbility().addEffect(new GainAbilityTargetEffect(gainedAbility, Duration.EndOfTurn)
.setText("Until end of turn, target creature gains \"{T}: Return target nonland permanent to its owner's hand.\"")
);
this.getSpellAbility().addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addTarget(new TargetCreaturePermanent());
} }

View file

@ -49,7 +49,7 @@ import mage.filter.predicate.permanent.ControllerPredicate;
*/ */
public class BellowingAegisaur extends CardImpl { public class BellowingAegisaur extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("each other creature you control"); private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("other creature you control");
static { static {
filter.add(new ControllerPredicate(TargetController.YOU)); filter.add(new ControllerPredicate(TargetController.YOU));

View file

@ -50,7 +50,7 @@ import mage.filter.predicate.permanent.AnotherPredicate;
*/ */
public class BelltollDragon extends CardImpl { public class BelltollDragon extends CardImpl {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("each other Dragon creature you control"); private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("other Dragon creature you control");
static { static {
filter.add(new AnotherPredicate()); filter.add(new AnotherPredicate());
@ -58,7 +58,7 @@ public class BelltollDragon extends CardImpl {
} }
public BelltollDragon(UUID ownerId, CardSetInfo setInfo) { public BelltollDragon(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{U}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{U}");
this.subtype.add(SubType.DRAGON); this.subtype.add(SubType.DRAGON);
this.power = new MageInt(3); this.power = new MageInt(3);
this.toughness = new MageInt(3); this.toughness = new MageInt(3);

View file

@ -48,7 +48,7 @@ import mage.target.common.TargetCreaturePermanent;
public class Bequeathal extends CardImpl { public class Bequeathal extends CardImpl {
public Bequeathal(UUID ownerId, CardSetInfo setInfo) { public Bequeathal(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{G}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{G}");
this.subtype.add(SubType.AURA); this.subtype.add(SubType.AURA);
// Enchant creature // Enchant creature
@ -59,7 +59,7 @@ public class Bequeathal extends CardImpl {
this.addAbility(ability); this.addAbility(ability);
// When enchanted creature dies, you draw two cards. // When enchanted creature dies, you draw two cards.
this.addAbility( new DiesAttachedTriggeredAbility(new DrawCardSourceControllerEffect(2), "enchanted creature")); this.addAbility(new DiesAttachedTriggeredAbility(new DrawCardSourceControllerEffect(2).setText("you draw two cards"), "enchanted creature"));
} }
public Bequeathal(final Bequeathal card) { public Bequeathal(final Bequeathal card) {

View file

@ -52,7 +52,7 @@ import mage.target.common.TargetControlledCreaturePermanent;
public class BlackCarriage extends CardImpl { public class BlackCarriage extends CardImpl {
public BlackCarriage(UUID ownerId, CardSetInfo setInfo) { public BlackCarriage(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{B}{B}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}{B}");
this.subtype.add(SubType.HORSE); this.subtype.add(SubType.HORSE);
this.power = new MageInt(4); this.power = new MageInt(4);
this.toughness = new MageInt(4); this.toughness = new MageInt(4);
@ -66,7 +66,7 @@ public class BlackCarriage extends CardImpl {
// Sacrifice a creature: Untap Black Carriage. Activate this ability only during your upkeep. // Sacrifice a creature: Untap Black Carriage. Activate this ability only during your upkeep.
this.addAbility(new ConditionalActivatedAbility(Zone.BATTLEFIELD, this.addAbility(new ConditionalActivatedAbility(Zone.BATTLEFIELD,
new UntapSourceEffect(), new SacrificeTargetCost(new TargetControlledCreaturePermanent(new FilterControlledCreaturePermanent("a creature"))), new UntapSourceEffect(), new SacrificeTargetCost(new TargetControlledCreaturePermanent(new FilterControlledCreaturePermanent("a creature"))),
new IsStepCondition(PhaseStep.UPKEEP), null)); new IsStepCondition(PhaseStep.UPKEEP), "Sacrifice a creature: Untap {this}. Activate this ability only during your upkeep."));
} }
public BlackCarriage(final BlackCarriage card) { public BlackCarriage(final BlackCarriage card) {

View file

@ -54,7 +54,6 @@ public class BlackManaBattery extends CardImpl {
public BlackManaBattery(UUID ownerId, CardSetInfo setInfo) { public BlackManaBattery(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}"); super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}");
// {2}, {tap}: Put a charge counter on Black Mana Battery. // {2}, {tap}: Put a charge counter on Black Mana Battery.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.STORAGE.createInstance(1)), new GenericManaCost(2)); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.STORAGE.createInstance(1)), new GenericManaCost(2));
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
@ -65,10 +64,10 @@ public class BlackManaBattery extends CardImpl {
Mana.BlackMana(1), Mana.BlackMana(1),
new IntPlusDynamicValue(1, new RemovedCountersForCostValue()), new IntPlusDynamicValue(1, new RemovedCountersForCostValue()),
new TapSourceCost(), new TapSourceCost(),
"Add {B} to your mana pool, then add {B} to your mana pool for each storage counter removed this way", "Add {B} to your mana pool, then add {B} to your mana pool for each charge counter removed this way",
true, new CountersSourceCount(CounterType.STORAGE)); true, new CountersSourceCount(CounterType.CHARGE));
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance(), ability.addCost(new RemoveVariableCountersSourceCost(CounterType.CHARGE.createInstance(),
"Remove X storage counters from {this}")); "Remove any number of charge counters from {this}"));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -64,10 +64,10 @@ public class BlueManaBattery extends CardImpl {
Mana.BlueMana(1), Mana.BlueMana(1),
new IntPlusDynamicValue(1, new RemovedCountersForCostValue()), new IntPlusDynamicValue(1, new RemovedCountersForCostValue()),
new TapSourceCost(), new TapSourceCost(),
"Add {U} to your mana pool, then add {U} to your mana pool for each storage counter removed this way", "Add {U} to your mana pool, then add {U} to your mana pool for each charge counter removed this way",
true, new CountersSourceCount(CounterType.STORAGE)); true, new CountersSourceCount(CounterType.CHARGE));
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance(), ability.addCost(new RemoveVariableCountersSourceCost(CounterType.CHARGE.createInstance(),
"Remove X storage counters from {this}")); "Remove any number of charge counters from {this}"));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -0,0 +1,69 @@
/*
* 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.b;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.TurnedFaceUpAllTriggeredAbility;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterPermanent;
import mage.target.common.TargetCreatureOrPlayer;
/**
*
* @author TheElk801
*/
public class BonethornValesk extends CardImpl {
public BonethornValesk(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{R}");
this.subtype.add(SubType.BEAST);
this.power = new MageInt(4);
this.toughness = new MageInt(2);
// Whenever a permanent is turned face up, Bonethorn Valesk deals 1 damage to target creature or player.
Ability ability = new TurnedFaceUpAllTriggeredAbility(new DamageTargetEffect(1), new FilterPermanent());
ability.addTarget(new TargetCreatureOrPlayer());
this.addAbility(ability);
}
public BonethornValesk(final BonethornValesk card) {
super(card);
}
@Override
public BonethornValesk copy() {
return new BonethornValesk(this);
}
}

View file

@ -0,0 +1,129 @@
/*
* 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.b;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.PreventionEffectImpl;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.counters.CounterType;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.MulticoloredPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author TheElk801
*/
public class BraceForImpact extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("multicolored creature");
static {
filter.add(new MulticoloredPredicate());
}
public BraceForImpact(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{4}{W}");
// Prevent all damage that would be dealt to target multicolored creature this turn. For each 1 damage prevented this way, put a +1/+1 counter on that creature.
this.getSpellAbility().addEffect(new BraceForImpactPreventDamageTargetEffect(Duration.EndOfTurn));
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter));
}
public BraceForImpact(final BraceForImpact card) {
super(card);
}
@Override
public BraceForImpact copy() {
return new BraceForImpact(this);
}
}
class BraceForImpactPreventDamageTargetEffect extends PreventionEffectImpl {
public BraceForImpactPreventDamageTargetEffect(Duration duration) {
super(duration);
staticText = "Prevent all damage that would be dealt to target multicolored creature this turn. For each 1 damage prevented this way, put a +1/+1 counter on that creature";
}
public BraceForImpactPreventDamageTargetEffect(final BraceForImpactPreventDamageTargetEffect effect) {
super(effect);
}
@Override
public BraceForImpactPreventDamageTargetEffect copy() {
return new BraceForImpactPreventDamageTargetEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
GameEvent preventEvent = new GameEvent(GameEvent.EventType.PREVENT_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), event.getAmount(), false);
if (!game.replaceEvent(preventEvent)) {
int prevented = 0;
int damage = event.getAmount();
event.setAmount(0);
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), damage));
prevented = damage;
// add counters now
if (prevented > 0) {
Permanent targetPermanent = game.getPermanent(source.getTargets().getFirstTarget());
if (targetPermanent != null) {
targetPermanent.addCounters(CounterType.P1P1.createInstance(prevented), source, game);
game.informPlayers(new StringBuilder("Brace for Impact: Prevented ").append(prevented).append(" damage ").toString());
game.informPlayers("Brace for Impact: Adding " + prevented + " +1/+1 counters to " + targetPermanent.getName());
}
}
}
return false;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (!this.used && super.applies(event, source, game)) {
if (source.getTargets().getFirstTarget().equals(event.getTargetId())) {
return true;
}
}
return false;
}
}

View file

@ -47,8 +47,8 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
*/ */
public class BraidsConjurerAdept extends CardImpl { public class BraidsConjurerAdept extends CardImpl {
private static final FilterCard filter = new FilterCard("artifact, creature, or land card") private static final FilterCard filter = new FilterCard("an artifact, creature, or land card");
;
static { static {
filter.add(Predicates.or( filter.add(Predicates.or(
new CardTypePredicate(CardType.ARTIFACT), new CardTypePredicate(CardType.ARTIFACT),
@ -57,7 +57,7 @@ public class BraidsConjurerAdept extends CardImpl {
} }
public BraidsConjurerAdept(UUID ownerId, CardSetInfo setInfo) { public BraidsConjurerAdept(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{U}{U}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}{U}");
addSuperType(SuperType.LEGENDARY); addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN, SubType.WIZARD); this.subtype.add(SubType.HUMAN, SubType.WIZARD);
this.power = new MageInt(2); this.power = new MageInt(2);

View file

@ -53,7 +53,7 @@ import java.util.UUID;
*/ */
public class BrownOuphe extends CardImpl { public class BrownOuphe extends CardImpl {
private final static FilterStackObject filter = new FilterStackObject("ability from an artifact source"); private final static FilterStackObject filter = new FilterStackObject("activated ability from an artifact source");
static { static {
filter.add(new ArtifactSourcePredicate()); filter.add(new ArtifactSourcePredicate());

View file

@ -0,0 +1,83 @@
/*
* 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.b;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.continuous.LoseAbilityTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author TheElk801
*/
public class BurningPalmEfreet extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with flying");
static {
filter.add(new AbilityPredicate(FlyingAbility.class));
}
public BurningPalmEfreet(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}{R}");
this.subtype.add(SubType.EFREET);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// {1}{R}{R}: Burning Palm Efreet deals 2 damage to target creature with flying and that creature loses flying until end of turn.
Ability ability = new SimpleActivatedAbility(new DamageTargetEffect(2), new ManaCostsImpl("{1}{R}{R}"));
ability.addEffect(new LoseAbilityTargetEffect(FlyingAbility.getInstance(), Duration.EndOfTurn)
.setText("and that creature loses flying until end of turn")
);
ability.addTarget(new TargetCreaturePermanent(filter));
this.addAbility(ability);
}
public BurningPalmEfreet(final BurningPalmEfreet card) {
super(card);
}
@Override
public BurningPalmEfreet copy() {
return new BurningPalmEfreet(this);
}
}

View file

@ -42,10 +42,12 @@ import mage.target.TargetPlayer;
public class CabalConditioning extends CardImpl { public class CabalConditioning extends CardImpl {
public CabalConditioning(UUID ownerId, CardSetInfo setInfo) { public CabalConditioning(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{6}{B}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{6}{B}");
// Any number of target players each discard a number of cards equal to the highest converted mana cost among permanents you control. // Any number of target players each discard a number of cards equal to the highest converted mana cost among permanents you control.
this.getSpellAbility().addEffect(new DiscardTargetEffect(new HighestConvertedManaCostValue())); this.getSpellAbility().addEffect(new DiscardTargetEffect(new HighestConvertedManaCostValue())
.setText("Any number of target players each discard a number of cards equal to the highest converted mana cost among permanents you control.")
);
this.getSpellAbility().addTarget(new TargetPlayer(0, Integer.MAX_VALUE, false)); this.getSpellAbility().addTarget(new TargetPlayer(0, Integer.MAX_VALUE, false));
} }

View file

@ -54,7 +54,7 @@ import mage.target.common.TargetCreaturePermanent;
*/ */
public class CaptivatingCrew extends CardImpl { public class CaptivatingCrew extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("target creature an opponent controls"); private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature an opponent controls");
static { static {
filter.add(new ControllerPredicate(TargetController.OPPONENT)); filter.add(new ControllerPredicate(TargetController.OPPONENT));

View file

@ -50,7 +50,7 @@ public class ChillHaunting extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{B}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{B}");
// As an additional cost to cast Chill Haunting, exile X creature cards from your graveyard. // As an additional cost to cast Chill Haunting, exile X creature cards from your graveyard.
this.getSpellAbility().addCost(new ExileXFromYourGraveCost(new FilterCreatureCard("cards from your graveyard"))); this.getSpellAbility().addCost(new ExileXFromYourGraveCost(new FilterCreatureCard("cards from your graveyard"), true));
// Target creature gets -X/-X until end of turn. // Target creature gets -X/-X until end of turn.
this.getSpellAbility().addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addTarget(new TargetCreaturePermanent());

View file

@ -46,7 +46,7 @@ import mage.constants.SubType;
public class CinderWall extends CardImpl { public class CinderWall extends CardImpl {
public CinderWall(UUID ownerId, CardSetInfo setInfo) { public CinderWall(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{R}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{R}");
this.subtype.add(SubType.WALL); this.subtype.add(SubType.WALL);
this.power = new MageInt(3); this.power = new MageInt(3);
@ -55,9 +55,10 @@ public class CinderWall extends CardImpl {
// Defender // Defender
this.addAbility(DefenderAbility.getInstance()); this.addAbility(DefenderAbility.getInstance());
// When Cinder Wall blocks, destroy it at end of combat. // When Cinder Wall blocks, destroy it at end of combat.
this.addAbility( this.addAbility(new BlocksTriggeredAbility(
new BlocksTriggeredAbility(new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(new DestroySourceEffect())) new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(new DestroySourceEffect())),
, false)); false, false, true
));
} }
public CinderWall(final CinderWall card) { public CinderWall(final CinderWall card) {

View file

@ -53,7 +53,7 @@ import mage.game.permanent.Permanent;
public class ClergyOfTheHolyNimbus extends CardImpl { public class ClergyOfTheHolyNimbus extends CardImpl {
public ClergyOfTheHolyNimbus(UUID ownerId, CardSetInfo setInfo) { public ClergyOfTheHolyNimbus(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{W}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}");
this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.CLERIC); this.subtype.add(SubType.CLERIC);
this.power = new MageInt(1); this.power = new MageInt(1);

View file

@ -45,7 +45,7 @@ import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
/** /**
* *
@ -59,7 +59,7 @@ public class CoalitionFlag extends CardImpl {
this.subtype.add(SubType.AURA); this.subtype.add(SubType.AURA);
// Enchant creature you control // Enchant creature you control
TargetPermanent auraTarget = new TargetCreaturePermanent(); TargetPermanent auraTarget = new TargetControlledCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget); this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName()); Ability ability = new EnchantAbility(auraTarget.getTargetName());

View file

@ -36,6 +36,7 @@ import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.GainLifeTargetEffect; import mage.abilities.effects.common.GainLifeTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.AbilityWord;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.TargetController; import mage.constants.TargetController;
@ -47,7 +48,7 @@ import mage.constants.TargetController;
public class CollapsingBorders extends CardImpl { public class CollapsingBorders extends CardImpl {
public CollapsingBorders(UUID ownerId, CardSetInfo setInfo) { public CollapsingBorders(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{3}{R}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{R}");
// Domain - At the beginning of each player's upkeep, that player gains 1 life for each basic land type among lands he or she controls. Then Collapsing Borders deals 3 damage to him or her. // Domain - At the beginning of each player's upkeep, that player gains 1 life for each basic land type among lands he or she controls. Then Collapsing Borders deals 3 damage to him or her.
Effect effect = new GainLifeTargetEffect(new DomainValue(true)); Effect effect = new GainLifeTargetEffect(new DomainValue(true));
@ -56,6 +57,7 @@ public class CollapsingBorders extends CardImpl {
effect = new DamageTargetEffect(3); effect = new DamageTargetEffect(3);
effect.setText("Then {this} deals 3 damage to him or her."); effect.setText("Then {this} deals 3 damage to him or her.");
ability.addEffect(effect); ability.addEffect(effect);
ability.setAbilityWord(AbilityWord.DOMAIN);
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -36,6 +36,7 @@ import mage.abilities.dynamicvalue.common.DomainValue;
import mage.abilities.effects.common.combat.CantAttackYouUnlessPayManaAllEffect; import mage.abilities.effects.common.combat.CantAttackYouUnlessPayManaAllEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.AbilityWord;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
@ -51,7 +52,9 @@ public class CollectiveRestraint extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}");
// Domain - Creatures can't attack you unless their controller pays {X} for each creature he or she controls that's attacking you, where X is the number of basic land types you control. // Domain - Creatures can't attack you unless their controller pays {X} for each creature he or she controls that's attacking you, where X is the number of basic land types you control.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CollectiveRestraintPayManaToAttackAllEffect())); Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new CollectiveRestraintPayManaToAttackAllEffect());
ability.setAbilityWord(AbilityWord.DOMAIN);
this.addAbility(ability);
} }

View file

@ -44,14 +44,14 @@ import mage.target.TargetSpell;
*/ */
public class Confound extends CardImpl { public class Confound extends CardImpl {
private final static FilterSpell filter = new FilterSpell("spell that targets one or more creatures"); private final static FilterSpell filter = new FilterSpell("spell that targets a creature");
static { static {
filter.add(new TargetsPermanentPredicate(new FilterCreaturePermanent())); filter.add(new TargetsPermanentPredicate(new FilterCreaturePermanent()));
} }
public Confound(UUID ownerId, CardSetInfo setInfo) { public Confound(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{U}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}");
// Counter target spell that targets one or more creatures. // Counter target spell that targets one or more creatures.
this.getSpellAbility().addEffect(new CounterTargetEffect()); this.getSpellAbility().addEffect(new CounterTargetEffect());

View file

@ -45,6 +45,7 @@ import mage.constants.AbilityWord;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.SubLayer;
import mage.constants.Zone; import mage.constants.Zone;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
@ -55,7 +56,7 @@ import mage.target.common.TargetCreaturePermanent;
public class CraterElemental extends CardImpl { public class CraterElemental extends CardImpl {
public CraterElemental(UUID ownerId, CardSetInfo setInfo) { public CraterElemental(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{R}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}");
this.subtype.add(SubType.ELEMENTAL); this.subtype.add(SubType.ELEMENTAL);
this.power = new MageInt(0); this.power = new MageInt(0);
this.toughness = new MageInt(6); this.toughness = new MageInt(6);
@ -70,7 +71,7 @@ public class CraterElemental extends CardImpl {
// <i>Formidable</i> - {2}{R}: Crater Elemental has base power 8 until end of turn. Activate this ability only if creatures you control have total power 8 or greater. // <i>Formidable</i> - {2}{R}: Crater Elemental has base power 8 until end of turn. Activate this ability only if creatures you control have total power 8 or greater.
ability = new ActivateIfConditionActivatedAbility( ability = new ActivateIfConditionActivatedAbility(
Zone.BATTLEFIELD, Zone.BATTLEFIELD,
new SetPowerSourceEffect(new StaticValue(8), Duration.EndOfTurn), new SetPowerSourceEffect(new StaticValue(8), Duration.EndOfTurn, SubLayer.SetPT_7b),
new ManaCostsImpl("{2}{R}"), new ManaCostsImpl("{2}{R}"),
FormidableCondition.instance); FormidableCondition.instance);
ability.setAbilityWord(AbilityWord.FORMIDABLE); ability.setAbilityWord(AbilityWord.FORMIDABLE);

View file

@ -41,7 +41,7 @@ import mage.constants.TurnPhase;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.AttackingPredicate; import mage.filter.predicate.permanent.AttackingPredicate;
import mage.filter.predicate.permanent.BlockingPredicate; import mage.filter.predicate.permanent.BlockedPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.combat.CombatGroup; import mage.game.combat.CombatGroup;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
@ -58,11 +58,11 @@ public class CurtainOfLight extends CardImpl {
static { static {
filter.add(new AttackingPredicate()); filter.add(new AttackingPredicate());
filter.add(Predicates.not(new BlockingPredicate())); filter.add(Predicates.not(new BlockedPredicate()));
} }
public CurtainOfLight(UUID ownerId, CardSetInfo setInfo) { public CurtainOfLight(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{W}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{W}");
// Cast Curtain of Light only during combat after blockers are declared. // Cast Curtain of Light only during combat after blockers are declared.
this.addAbility(new CastOnlyDuringPhaseStepSourceAbility(TurnPhase.COMBAT, AfterBlockersAreDeclaredCondition.instance)); this.addAbility(new CastOnlyDuringPhaseStepSourceAbility(TurnPhase.COMBAT, AfterBlockersAreDeclaredCondition.instance));

View file

@ -53,7 +53,7 @@ import mage.players.Player;
public class DarienKingOfKjeldor extends CardImpl { public class DarienKingOfKjeldor extends CardImpl {
public DarienKingOfKjeldor(UUID ownerId, CardSetInfo setInfo) { public DarienKingOfKjeldor(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{W}{W}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{W}{W}");
addSuperType(SuperType.LEGENDARY); addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.SOLDIER); this.subtype.add(SubType.SOLDIER);
@ -74,6 +74,7 @@ public class DarienKingOfKjeldor extends CardImpl {
return new DarienKingOfKjeldor(this); return new DarienKingOfKjeldor(this);
} }
} }
class DarienKingOfKjeldorTriggeredAbility extends TriggeredAbilityImpl { class DarienKingOfKjeldorTriggeredAbility extends TriggeredAbilityImpl {
public DarienKingOfKjeldorTriggeredAbility() { public DarienKingOfKjeldorTriggeredAbility() {
@ -105,7 +106,7 @@ class DarienKingOfKjeldorTriggeredAbility extends TriggeredAbilityImpl {
@Override @Override
public String getRule() { public String getRule() {
return "Whenever you are dealt damage, you may create that many 1/1 white Soldier creature tokens."; return "Whenever you're dealt damage, you may create that many 1/1 white Soldier creature tokens.";
} }
} }

View file

@ -71,6 +71,7 @@ public class DaughterOfAutumn extends CardImpl {
// {W}: The next 1 damage that would be dealt to target white creature this turn is dealt to Daughter of Autumn instead. // {W}: The next 1 damage that would be dealt to target white creature this turn is dealt to Daughter of Autumn instead.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DaughterOfAutumnPreventDamageTargetEffect(Duration.EndOfTurn, 1), new ManaCostsImpl("{W}")); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DaughterOfAutumnPreventDamageTargetEffect(Duration.EndOfTurn, 1), new ManaCostsImpl("{W}"));
ability.addTarget(new TargetCreaturePermanent(filter)); ability.addTarget(new TargetCreaturePermanent(filter));
this.addAbility(ability);
} }
public DaughterOfAutumn(final DaughterOfAutumn card) { public DaughterOfAutumn(final DaughterOfAutumn card) {

View file

@ -45,7 +45,7 @@ import mage.constants.CardType;
import mage.constants.SetTargetPointer; import mage.constants.SetTargetPointer;
import mage.constants.Zone; import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.StaticFilters; import mage.filter.FilterSpell;
import mage.target.TargetSpell; import mage.target.TargetSpell;
/** /**
@ -55,12 +55,12 @@ import mage.target.TargetSpell;
public class DecreeOfSilence extends CardImpl { public class DecreeOfSilence extends CardImpl {
public DecreeOfSilence(UUID ownerId, CardSetInfo setInfo) { public DecreeOfSilence(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{6}{U}{U}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{6}{U}{U}");
// Whenever an opponent casts a spell, counter that spell and put a depletion counter on Decree of Silence. If there are three or more depletion counters on Decree of Silence, sacrifice it. // Whenever an opponent casts a spell, counter that spell and put a depletion counter on Decree of Silence. If there are three or more depletion counters on Decree of Silence, sacrifice it.
Effect effect = new CounterTargetEffect(); Effect effect = new CounterTargetEffect();
effect.setText("counter that spell"); effect.setText("counter that spell");
Ability ability = new SpellCastOpponentTriggeredAbility(Zone.BATTLEFIELD, effect, StaticFilters.FILTER_SPELL, Ability ability = new SpellCastOpponentTriggeredAbility(Zone.BATTLEFIELD, effect, new FilterSpell("a spell"),
false, SetTargetPointer.SPELL); false, SetTargetPointer.SPELL);
effect = new AddCountersSourceEffect(CounterType.DEPLETION.createInstance()); effect = new AddCountersSourceEffect(CounterType.DEPLETION.createInstance());
effect.setText("and put a depletion counter on {this}."); effect.setText("and put a depletion counter on {this}.");

View file

@ -80,7 +80,10 @@ public class DefiantVanguard extends CardImpl {
// When Defiant Vanguard blocks, at end of combat, destroy it and all creatures it blocked this turn. // When Defiant Vanguard blocks, at end of combat, destroy it and all creatures it blocked this turn.
this.addAbility( this.addAbility(
new BlocksTriggeredAbility(new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(new DefiantVanguardEffect())), false), new BlocksTriggeredAbility(
new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(new DefiantVanguardEffect())),
false, false, true
),
new BlockedAttackerWatcher() new BlockedAttackerWatcher()
); );

View file

@ -50,11 +50,10 @@ import mage.counters.CounterType;
public class DeityOfScars extends CardImpl { public class DeityOfScars extends CardImpl {
public DeityOfScars(UUID ownerId, CardSetInfo setInfo) { public DeityOfScars(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{B/G}{B/G}{B/G}{B/G}{B/G}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B/G}{B/G}{B/G}{B/G}{B/G}");
this.subtype.add(SubType.SPIRIT); this.subtype.add(SubType.SPIRIT);
this.subtype.add(SubType.AVATAR); this.subtype.add(SubType.AVATAR);
this.power = new MageInt(7); this.power = new MageInt(7);
this.toughness = new MageInt(7); this.toughness = new MageInt(7);
@ -62,7 +61,7 @@ public class DeityOfScars extends CardImpl {
this.addAbility(TrampleAbility.getInstance()); this.addAbility(TrampleAbility.getInstance());
// Deity of Scars enters the battlefield with two -1/-1 counters on it. // Deity of Scars enters the battlefield with two -1/-1 counters on it.
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.M1M1.createInstance(2)))); this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.M1M1.createInstance(2)), "with two -1/-1 counters on it"));
// {B/G}, Remove a -1/-1 counter from Deity of Scars: Regenerate Deity of Scars. // {B/G}, Remove a -1/-1 counter from Deity of Scars: Regenerate Deity of Scars.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new RegenerateSourceEffect(), new ManaCostsImpl("{B/G}")); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new RegenerateSourceEffect(), new ManaCostsImpl("{B/G}"));

View file

@ -63,7 +63,7 @@ import mage.target.common.TargetNonBasicLandPermanent;
public class Detritivore extends CardImpl { public class Detritivore extends CardImpl {
public Detritivore(UUID ownerId, CardSetInfo setInfo) { public Detritivore(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{R}{R}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}{R}");
this.subtype.add(SubType.LHURGOYF); this.subtype.add(SubType.LHURGOYF);
this.power = new MageInt(0); this.power = new MageInt(0);
@ -132,7 +132,6 @@ class NonBasicLandsInOpponentsGraveyards implements DynamicValue {
filter.add(Predicates.not(new SupertypePredicate(SuperType.BASIC))); filter.add(Predicates.not(new SupertypePredicate(SuperType.BASIC)));
} }
@Override @Override
public int calculate(Game game, Ability sourceAbility, Effect effect) { public int calculate(Game game, Ability sourceAbility, Effect effect) {
int amount = 0; int amount = 0;
@ -162,6 +161,6 @@ class NonBasicLandsInOpponentsGraveyards implements DynamicValue {
@Override @Override
public String getMessage() { public String getMessage() {
return "the number of nonbasic land cards in your opponents' graveyards"; return "nonbasic land cards in your opponents' graveyards";
} }
} }

View file

@ -0,0 +1,70 @@
/*
* 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.d;
import java.util.UUID;
import mage.abilities.common.CastOnlyDuringPhaseStepSourceAbility;
import mage.abilities.condition.common.BeforeBlockersAreDeclaredCondition;
import mage.abilities.effects.common.RemoveFromCombatTargetEffect;
import mage.abilities.effects.common.UntapTargetEffect;
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.TurnPhase;
import mage.target.common.TargetAttackingCreature;
/**
*
* @author TheElk801
*/
public class Disharmony extends CardImpl {
public Disharmony(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{R}");
// Cast Disharmony only during combat before blockers are declared.
this.addAbility(new CastOnlyDuringPhaseStepSourceAbility(TurnPhase.COMBAT, BeforeBlockersAreDeclaredCondition.instance));
// Untap target attacking creature and remove it from combat. Gain control of that creature until end of turn.
this.getSpellAbility().addEffect(new UntapTargetEffect());
this.getSpellAbility().addEffect(new RemoveFromCombatTargetEffect().setText("and remove it from combat."));
this.getSpellAbility().addEffect(new GainControlTargetEffect(Duration.EndOfTurn, true).setText("Gain control of that creature until end of turn."));
this.getSpellAbility().addTarget(new TargetAttackingCreature());
}
public Disharmony(final Disharmony card) {
super(card);
}
@Override
public Disharmony copy() {
return new Disharmony(this);
}
}

View file

@ -50,10 +50,12 @@ public class DivineLight extends CardImpl {
} }
public DivineLight(UUID ownerId, CardSetInfo setInfo) { public DivineLight(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{W}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{W}");
// Prevent all damage that would be dealt this turn to creatures you control. // Prevent all damage that would be dealt this turn to creatures you control.
this.getSpellAbility().addEffect(new PreventAllDamageToAllEffect(Duration.EndOfTurn, filter)); this.getSpellAbility().addEffect(new PreventAllDamageToAllEffect(Duration.EndOfTurn, filter)
.setText("Prevent all damage that would be dealt this turn to creatures you control.")
);
} }
public DivineLight(final DivineLight card) { public DivineLight(final DivineLight card) {

View file

@ -0,0 +1,64 @@
/*
* 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.d;
import java.util.UUID;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.common.FilterAttackingCreature;
import mage.target.common.TargetAttackingCreature;
/**
*
* @author TheElk801
*/
public class DivineRetribution extends CardImpl {
public DivineRetribution(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{W}");
// Divine Retribution deals damage to target attacking creature equal to the number of attacking creatures.
this.getSpellAbility().addEffect(
new DamageTargetEffect(new PermanentsOnBattlefieldCount(new FilterAttackingCreature()))
.setText("{this} deals damage to target attacking creature equal to the number of attacking creatures.")
);
this.getSpellAbility().addTarget(new TargetAttackingCreature());
}
public DivineRetribution(final DivineRetribution card) {
super(card);
}
@Override
public DivineRetribution copy() {
return new DivineRetribution(this);
}
}

View file

@ -65,7 +65,7 @@ import mage.players.Player;
public class DralnusPet extends CardImpl { public class DralnusPet extends CardImpl {
public DralnusPet(UUID ownerId, CardSetInfo setInfo) { public DralnusPet(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}{U}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}{U}");
this.subtype.add(SubType.SHAPESHIFTER); this.subtype.add(SubType.SHAPESHIFTER);
this.power = new MageInt(2); this.power = new MageInt(2);
this.toughness = new MageInt(2); this.toughness = new MageInt(2);
@ -77,7 +77,7 @@ public class DralnusPet extends CardImpl {
this.addAbility(new KickerAbility(kickerCosts)); this.addAbility(new KickerAbility(kickerCosts));
// If Dralnu's Pet was kicked, it enters the battlefield with flying and with X +1/+1 counters on it, where X is the discarded card's converted mana cost. // If Dralnu's Pet was kicked, it enters the battlefield with flying and with X +1/+1 counters on it, where X is the discarded card's converted mana cost.
Ability ability = new EntersBattlefieldAbility(new DralnusPetEffect(), KickedCondition.instance, Ability ability = new EntersBattlefieldAbility(new DralnusPetEffect(), KickedCondition.instance,
"If {this} was kicked, it enters the battlefield with flying and with X +1/+1 counters on it, where X is the discarded card's converted mana cost", ""); "If {this} was kicked, it enters the battlefield with flying and with X +1/+1 counters on it, where X is the discarded card's converted mana cost.", "");
ability.addEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.WhileOnBattlefield)); ability.addEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.WhileOnBattlefield));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -84,7 +84,7 @@ public class DreamcallerSiren extends CardImpl {
ability.addTarget(new TargetNonlandPermanent(0, 2, false)); ability.addTarget(new TargetNonlandPermanent(0, 2, false));
this.addAbility(new ConditionalTriggeredAbility(ability, this.addAbility(new ConditionalTriggeredAbility(ability,
new PermanentsOnTheBattlefieldCondition(filter), new PermanentsOnTheBattlefieldCondition(filter),
"when {this} enters the battlefield, if you control another Pirate, tap up to two nonland permanents.")); "when {this} enters the battlefield, if you control another Pirate, tap up to two target nonland permanents."));
} }
public DreamcallerSiren(final DreamcallerSiren card) { public DreamcallerSiren(final DreamcallerSiren card) {

View file

@ -0,0 +1,69 @@
/*
* 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.d;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.CantBlockAbility;
import mage.abilities.common.DealsCombatDamageTriggeredAbility;
import mage.abilities.effects.common.SacrificeEffect;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterPermanent;
/**
*
* @author TheElk801
*/
public class DrinkerOfSorrow extends CardImpl {
public DrinkerOfSorrow(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}");
this.subtype.add(SubType.HORROR);
this.power = new MageInt(5);
this.toughness = new MageInt(3);
// Drinker of Sorrow can't block.
this.addAbility(new CantBlockAbility());
// Whenever Drinker of Sorrow deals combat damage, sacrifice a permanent.
this.addAbility(new DealsCombatDamageTriggeredAbility(new SacrificeEffect(new FilterPermanent(), 1, ""), false));
}
public DrinkerOfSorrow(final DrinkerOfSorrow card) {
super(card);
}
@Override
public DrinkerOfSorrow copy() {
return new DrinkerOfSorrow(this);
}
}

View file

@ -46,7 +46,7 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
*/ */
public class DroverOfTheMighty extends CardImpl { public class DroverOfTheMighty extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("a Dinosaur"); private static final FilterPermanent filter = new FilterPermanent("Dinosaur");
static { static {
filter.add(new SubtypePredicate(SubType.DINOSAUR)); filter.add(new SubtypePredicate(SubType.DINOSAUR));

View file

@ -53,6 +53,8 @@ public class DubiousChallenge extends CardImpl {
// Look at the top ten cards of your library, exile up to two creature cards from among them, then shuffle your library. Target opponent may choose one of the exiled cards and put it onto the battlefield under his or her control. Put the rest onto the battlefield under your control. // Look at the top ten cards of your library, exile up to two creature cards from among them, then shuffle your library. Target opponent may choose one of the exiled cards and put it onto the battlefield under his or her control. Put the rest onto the battlefield under your control.
getSpellAbility().addEffect(new DubiousChallengeEffect()); getSpellAbility().addEffect(new DubiousChallengeEffect());
getSpellAbility().addTarget(new TargetOpponent()); getSpellAbility().addTarget(new TargetOpponent());
getSpellAbility().addEffect(new DubiousChallengeMoveToBattlefieldEffect());
getSpellAbility().addEffect(new DubiousChallengeMoveToBattlefieldEffect());
} }
public DubiousChallenge(final DubiousChallenge card) { public DubiousChallenge(final DubiousChallenge card) {
@ -69,7 +71,7 @@ class DubiousChallengeEffect extends OneShotEffect {
public DubiousChallengeEffect() { public DubiousChallengeEffect() {
super(Outcome.Benefit); super(Outcome.Benefit);
this.staticText = "Look at the top ten cards of your library, exile up to two creature cards from among them, then shuffle your library. Target opponent may choose one of the exiled cards and put it onto the battlefield under his or her control. Put the rest onto the battlefield under your control"; this.staticText = "Look at the top ten cards of your library, exile up to two creature cards from among them, then shuffle your library. Target opponent may choose one of the exiled cards and put it onto the battlefield under his or her control. Put the rest onto the battlefield under your control.";
} }
public DubiousChallengeEffect(final DubiousChallengeEffect effect) { public DubiousChallengeEffect(final DubiousChallengeEffect effect) {
@ -98,15 +100,17 @@ class DubiousChallengeEffect extends OneShotEffect {
Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source)); Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source));
if (opponent != null) { if (opponent != null) {
TargetCard targetOpponentCreature = new TargetCard(0, 1, Zone.EXILED, new FilterCreatureCard()); TargetCard targetOpponentCreature = new TargetCard(0, 1, Zone.EXILED, new FilterCreatureCard());
DubiousChallengeMoveToBattlefieldEffect opponentEffect = (DubiousChallengeMoveToBattlefieldEffect) source.getEffects().get(1);
DubiousChallengeMoveToBattlefieldEffect controllerEffect = (DubiousChallengeMoveToBattlefieldEffect) source.getEffects().get(2);
if (opponent.choose(outcome, exiledCards, targetOpponentCreature, game)) { if (opponent.choose(outcome, exiledCards, targetOpponentCreature, game)) {
Card card = game.getCard(targetOpponentCreature.getFirstTarget()); Card card = game.getCard(targetOpponentCreature.getFirstTarget());
if (card != null) { if (card != null) {
opponent.moveCards(card, Zone.BATTLEFIELD, source, game); opponentEffect.setPlayerAndCards(opponent, new CardsImpl(card));
exiledCards.remove(card); exiledCards.remove(card);
} }
} }
if (!exiledCards.isEmpty()) { if (!exiledCards.isEmpty()) {
controller.moveCards(exiledCards, Zone.BATTLEFIELD, source, game); controllerEffect.setPlayerAndCards(controller, exiledCards);
} }
} }
} else { } else {
@ -117,3 +121,36 @@ class DubiousChallengeEffect extends OneShotEffect {
return false; return false;
} }
} }
class DubiousChallengeMoveToBattlefieldEffect extends OneShotEffect {
public DubiousChallengeMoveToBattlefieldEffect() {
super(Outcome.Benefit);
}
public DubiousChallengeMoveToBattlefieldEffect(final DubiousChallengeMoveToBattlefieldEffect effect) {
super(effect);
}
@Override
public DubiousChallengeMoveToBattlefieldEffect copy() {
return new DubiousChallengeMoveToBattlefieldEffect(this);
}
public void setPlayerAndCards(Player targetPlayer, Cards targetCards)
{
this.player = targetPlayer;
this.cards = targetCards;
}
@Override
public boolean apply(Game game, Ability source) {
if (cards != null && player != null) {
return player.moveCards(cards, Zone.BATTLEFIELD, source, game);
}
return false;
}
private Cards cards;
private Player player;
}

View file

@ -45,12 +45,12 @@ import mage.filter.common.FilterAttackingCreature;
/** /**
* *
* @author jeffwadsworth * @author jeffwadsworth
*
*/ */
public class DuergarMineCaptain extends CardImpl { public class DuergarMineCaptain extends CardImpl {
public DuergarMineCaptain(UUID ownerId, CardSetInfo setInfo) { public DuergarMineCaptain(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{R/W}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R/W}");
this.subtype.add(SubType.DWARF); this.subtype.add(SubType.DWARF);
this.subtype.add(SubType.SOLDIER); this.subtype.add(SubType.SOLDIER);
@ -58,7 +58,10 @@ public class DuergarMineCaptain extends CardImpl {
this.toughness = new MageInt(1); this.toughness = new MageInt(1);
// {1}{RW}, {untap}: Attacking creatures get +1/+0 until end of turn. // {1}{RW}, {untap}: Attacking creatures get +1/+0 until end of turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 0, Duration.EndOfTurn, new FilterAttackingCreature(), false), new ManaCostsImpl("{1}{R/W}")); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new BoostAllEffect(1, 0, Duration.EndOfTurn, new FilterAttackingCreature("attacking creatures"), false),
new ManaCostsImpl("{1}{R/W}")
);
ability.addCost(new UntapSourceCost()); ability.addCost(new UntapSourceCost());
this.addAbility(ability); this.addAbility(ability);

View file

@ -46,14 +46,14 @@ import mage.target.common.TargetCardInYourGraveyard;
*/ */
public class DutifulAttendant extends CardImpl { public class DutifulAttendant extends CardImpl {
private static final FilterCreatureCard filter = new FilterCreatureCard("another creature card from your graveyard"); private static final FilterCreatureCard filter = new FilterCreatureCard("another target creature card from your graveyard");
static { static {
filter.add(new AnotherCardPredicate()); filter.add(new AnotherCardPredicate());
} }
public DutifulAttendant(UUID ownerId, CardSetInfo setInfo) { public DutifulAttendant(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}");
this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.WARRIOR); this.subtype.add(SubType.WARRIOR);
this.power = new MageInt(1); this.power = new MageInt(1);

View file

@ -46,18 +46,18 @@ import mage.filter.predicate.mageobject.ColorPredicate;
/** /**
* *
* @author LoneFox * @author LoneFox
*
*/ */
public class DwarvenPatrol extends CardImpl { public class DwarvenPatrol extends CardImpl {
private static final FilterSpell filter = new FilterSpell("nonred spell"); private static final FilterSpell filter = new FilterSpell("a nonred spell");
static { static {
filter.add(Predicates.not(new ColorPredicate(ObjectColor.RED))); filter.add(Predicates.not(new ColorPredicate(ObjectColor.RED)));
} }
public DwarvenPatrol(UUID ownerId, CardSetInfo setInfo) { public DwarvenPatrol(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{R}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}");
this.subtype.add(SubType.DWARF); this.subtype.add(SubType.DWARF);
this.power = new MageInt(4); this.power = new MageInt(4);
this.toughness = new MageInt(2); this.toughness = new MageInt(2);

View file

@ -0,0 +1,88 @@
/*
* 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.e;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.OrCost;
import mage.constants.SubType;
import mage.abilities.keyword.TrampleAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.CountersSourceCount;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.keyword.CumulativeUpkeepAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.counters.CounterType;
/**
*
* @author TheElk801
*/
public class EarthenGoo extends CardImpl {
public EarthenGoo(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}");
this.subtype.add(SubType.OOZE);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Trample
this.addAbility(TrampleAbility.getInstance());
// Cumulative upkeep {R} or {G}
this.addAbility(new CumulativeUpkeepAbility(new OrCost(
new ManaCostsImpl("{R}"),
new ManaCostsImpl("{G}"),
"{R} or {G}"
)));
// Earthen Goo gets +1/+1 for each age counter on it.
DynamicValue value = new CountersSourceCount(CounterType.AGE);
this.addAbility(new SimpleStaticAbility(
Zone.BATTLEFIELD,
new BoostSourceEffect(value, value, Duration.WhileOnBattlefield)
.setText("{this} gets +1/+1 for each age counter on it")
));
}
public EarthenGoo(final EarthenGoo card) {
super(card);
}
@Override
public EarthenGoo copy() {
return new EarthenGoo(this);
}
}

View file

@ -0,0 +1,106 @@
/*
* 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.e;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.DiesCreatureTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.SacrificeEffect;
import mage.abilities.effects.common.SacrificeSourceUnlessPaysEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author TheElk801
*/
public class Earthlink extends CardImpl {
public Earthlink(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{B}{R}{G}");
// At the beginning of your upkeep, sacrifice Earthlink unless you pay {2}.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new SacrificeSourceUnlessPaysEffect(new ManaCostsImpl("{2}")), TargetController.YOU, false));
// Whenever a creature dies, that creature's controller sacrifices a land.
this.addAbility(new DiesCreatureTriggeredAbility(new EarthlinkEffect(), false, false, true));
}
public Earthlink(final Earthlink card) {
super(card);
}
@Override
public Earthlink copy() {
return new Earthlink(this);
}
}
class EarthlinkEffect extends OneShotEffect {
public EarthlinkEffect() {
super(Outcome.DrawCard);
this.staticText = "that creature's controller sacrifices a land";
}
public EarthlinkEffect(final EarthlinkEffect effect) {
super(effect);
}
@Override
public EarthlinkEffect copy() {
return new EarthlinkEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = (Permanent) game.getLastKnownInformation(this.getTargetPointer().getFirst(game, source), Zone.BATTLEFIELD);
if (permanent != null) {
Player controller = game.getPlayer(permanent.getControllerId());
if (controller != null) {
Effect effect = new SacrificeEffect(StaticFilters.FILTER_LAND, 1, "that creature's controller");
effect.setTargetPointer(new FixedTarget(controller.getId(), game));
effect.apply(game, source);
}
}
return false;
}
}

View file

@ -0,0 +1,74 @@
/*
* 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.e;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BlocksTriggeredAbility;
import mage.abilities.effects.common.continuous.LoseAbilitySourceEffect;
import mage.constants.SubType;
import mage.abilities.keyword.DefenderAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
/**
*
* @author TheElk801
*/
public class ElderLandWurm extends CardImpl {
public ElderLandWurm(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{W}{W}{W}");
this.subtype.add(SubType.DRAGON);
this.subtype.add(SubType.WURM);
this.power = new MageInt(5);
this.toughness = new MageInt(5);
// Defender
this.addAbility(DefenderAbility.getInstance());
// Trample
this.addAbility(TrampleAbility.getInstance());
// When Elder Land Wurm blocks, it loses defender.
this.addAbility(new BlocksTriggeredAbility(new LoseAbilitySourceEffect(DefenderAbility.getInstance(), Duration.Custom), false, false, true));
}
public ElderLandWurm(final ElderLandWurm card) {
super(card);
}
@Override
public ElderLandWurm copy() {
return new ElderLandWurm(this);
}
}

View file

@ -56,9 +56,9 @@ public class EnergyTap extends CardImpl {
} }
public EnergyTap(UUID ownerId, CardSetInfo setInfo) { public EnergyTap(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{U}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{U}");
// Tap target untapped creature you control. If you do, add X mana of {C} to your mana pool, where X is that creature's converted mana cost. // Tap target untapped creature you control. If you do, add an amount of {C} to your mana pool equal to that creature's converted mana cost.
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent(filter)); this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent(filter));
this.getSpellAbility().addEffect(new EnergyTapEffect()); this.getSpellAbility().addEffect(new EnergyTapEffect());
} }
@ -77,7 +77,7 @@ class EnergyTapEffect extends OneShotEffect {
EnergyTapEffect() { EnergyTapEffect() {
super(Outcome.PutManaInPool); super(Outcome.PutManaInPool);
this.staticText = "Tap target untapped creature you control. If you do, add X mana of {C} to your mana pool, where X is that creature's converted mana cost"; this.staticText = "Tap target untapped creature you control. If you do, add an amount of {C} to your mana pool equal to that creature's converted mana cost";
} }
EnergyTapEffect(final EnergyTapEffect effect) { EnergyTapEffect(final EnergyTapEffect effect) {

View file

@ -52,7 +52,7 @@ import mage.players.Player;
public class EntropicSpecter extends CardImpl { public class EntropicSpecter extends CardImpl {
public EntropicSpecter(UUID ownerId, CardSetInfo setInfo) { public EntropicSpecter(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{B}{B}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}{B}");
this.subtype.add(SubType.SPECTER); this.subtype.add(SubType.SPECTER);
this.subtype.add(SubType.SPIRIT); this.subtype.add(SubType.SPIRIT);
@ -105,7 +105,7 @@ class CardsInTargetPlayerHandCount implements DynamicValue {
@Override @Override
public String getMessage() { public String getMessage() {
return "cards in chosen opponents hand"; return "cards in the chosen player's hand";
} }
@Override @Override

View file

@ -32,6 +32,7 @@ import mage.abilities.dynamicvalue.common.DomainValue;
import mage.abilities.effects.common.CounterUnlessPaysEffect; import mage.abilities.effects.common.CounterUnlessPaysEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.AbilityWord;
import mage.constants.CardType; import mage.constants.CardType;
import mage.target.TargetSpell; import mage.target.TargetSpell;
@ -42,11 +43,12 @@ import mage.target.TargetSpell;
public class EvasiveAction extends CardImpl { public class EvasiveAction extends CardImpl {
public EvasiveAction(UUID ownerId, CardSetInfo setInfo) { public EvasiveAction(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{U}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}");
// Domain - Counter target spell unless its controller pays {1} for each basic land type among lands you control. // Domain - Counter target spell unless its controller pays {1} for each basic land type among lands you control.
this.getSpellAbility().addEffect(new CounterUnlessPaysEffect(new DomainValue())); this.getSpellAbility().addEffect(new CounterUnlessPaysEffect(new DomainValue()));
this.getSpellAbility().addTarget(new TargetSpell()); this.getSpellAbility().addTarget(new TargetSpell());
this.getSpellAbility().setAbilityWord(AbilityWord.DOMAIN);
} }
public EvasiveAction(final EvasiveAction card) { public EvasiveAction(final EvasiveAction card) {

View file

@ -28,6 +28,7 @@
package mage.cards.e; package mage.cards.e;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.DomainValue; import mage.abilities.dynamicvalue.common.DomainValue;
@ -37,6 +38,7 @@ import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
import mage.abilities.keyword.EnchantAbility; import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.AbilityWord;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Duration; import mage.constants.Duration;
@ -51,7 +53,7 @@ import mage.target.TargetPermanent;
public class ExoticCurse extends CardImpl { public class ExoticCurse extends CardImpl {
public ExoticCurse(UUID ownerId, CardSetInfo setInfo) { public ExoticCurse(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{B}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}");
this.subtype.add(SubType.AURA); this.subtype.add(SubType.AURA);
// Enchant creature // Enchant creature
@ -62,8 +64,9 @@ public class ExoticCurse extends CardImpl {
// Domain - Enchanted creature gets -1/-1 for each basic land type among lands you control. // Domain - Enchanted creature gets -1/-1 for each basic land type among lands you control.
DynamicValue unboost = new SignInversionDynamicValue(new DomainValue()); DynamicValue unboost = new SignInversionDynamicValue(new DomainValue());
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(unboost, unboost, Duration.WhileOnBattlefield));
new BoostEnchantedEffect(unboost, unboost, Duration.WhileOnBattlefield))); ability.setAbilityWord(AbilityWord.DOMAIN);
this.addAbility(ability);
} }
public ExoticCurse(final ExoticCurse card) { public ExoticCurse(final ExoticCurse card) {

View file

@ -55,11 +55,15 @@ import mage.target.targetpointer.FixedTarget;
public class FatalFrenzy extends CardImpl { public class FatalFrenzy extends CardImpl {
public FatalFrenzy(UUID ownerId, CardSetInfo setInfo) { public FatalFrenzy(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{R}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{R}");
// Until end of turn, target creature you control gains trample and gets +X/+0, where X is its power. Sacrifice it at the beginning of the next end step. // Until end of turn, target creature you control gains trample and gets +X/+0, where X is its power. Sacrifice it at the beginning of the next end step.
this.getSpellAbility().addEffect(new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn)); this.getSpellAbility().addEffect(new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn)
this.getSpellAbility().addEffect(new BoostTargetEffect(new TargetPermanentPowerCount(), new StaticValue(0), Duration.EndOfTurn, true)); .setText("Until end of turn, target creature you control gains trample")
);
this.getSpellAbility().addEffect(new BoostTargetEffect(new TargetPermanentPowerCount(), new StaticValue(0), Duration.EndOfTurn, true)
.setText("and gets +X/+0, where X is its power.")
);
this.getSpellAbility().addEffect(new FatalFrenzyEffect()); this.getSpellAbility().addEffect(new FatalFrenzyEffect());
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent()); this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());

View file

@ -76,7 +76,7 @@ public class FathomFleetCaptain extends CardImpl {
this.addAbility(new ConditionalTriggeredAbility( this.addAbility(new ConditionalTriggeredAbility(
new AttacksTriggeredAbility(new DoIfCostPaid(new CreateTokenEffect(new PirateToken()), new GenericManaCost(2)), false), new AttacksTriggeredAbility(new DoIfCostPaid(new CreateTokenEffect(new PirateToken()), new GenericManaCost(2)), false),
new PermanentsOnTheBattlefieldCondition(filter), new PermanentsOnTheBattlefieldCondition(filter),
"Whenever {this} attacks, if you control another nontoken Pirate, you may pay {2}. If you do, creature a 2/2 black Pirate creature token with menace")); "Whenever {this} attacks, if you control another nontoken Pirate, you may pay {2}. If you do, create a 2/2 black Pirate creature token with menace"));
} }
public FathomFleetCaptain(final FathomFleetCaptain card) { public FathomFleetCaptain(final FathomFleetCaptain card) {

View file

@ -37,6 +37,7 @@ import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.AbilityWord;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Zone; import mage.constants.Zone;
@ -54,15 +55,14 @@ import mage.target.common.TargetCreatureOrPlayer;
public class FieryBombardment extends CardImpl { public class FieryBombardment extends CardImpl {
public FieryBombardment(UUID ownerId, CardSetInfo setInfo) { public FieryBombardment(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{R}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}");
// Chroma - {2}, Sacrifice a creature: Fiery Bombardment deals damage to target creature or player equal to the number of red mana symbols in the sacrificed creature's mana cost. // Chroma - {2}, Sacrifice a creature: Fiery Bombardment deals damage to target creature or player equal to the number of red mana symbols in the sacrificed creature's mana cost.
Effect effect = new FieryBombardmentEffect(); Effect effect = new FieryBombardmentEffect();
effect.setText("<i>Chroma</i> - Fiery Bombardment deals damage to target creature or player equal to the number of red mana symbols in the sacrificed creature's mana cost.");
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{2}")); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{2}"));
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent())); ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent()));
ability.addTarget(new TargetCreatureOrPlayer()); ability.addTarget(new TargetCreatureOrPlayer());
ability.setAbilityWord(AbilityWord.CHROMA);
this.addAbility(ability); this.addAbility(ability);
} }
@ -81,6 +81,7 @@ class FieryBombardmentEffect extends OneShotEffect {
public FieryBombardmentEffect() { public FieryBombardmentEffect() {
super(Outcome.Benefit); super(Outcome.Benefit);
staticText = "{this} deals damage to target creature or player equal to the number of red mana symbols in the sacrificed creature's mana cost.";
} }
public FieryBombardmentEffect(final FieryBombardmentEffect effect) { public FieryBombardmentEffect(final FieryBombardmentEffect effect) {

View file

@ -54,11 +54,10 @@ public class FireAtWill extends CardImpl {
} }
public FireAtWill(UUID ownerId, CardSetInfo setInfo) { public FireAtWill(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{R/W}{R/W}{R/W}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{R/W}{R/W}{R/W}");
// Fire at Will deals 3 damage divided as you choose among one, two, or three target attacking or blocking creatures. // Fire at Will deals 3 damage divided as you choose among one, two, or three target attacking or blocking creatures.
this.getSpellAbility().addEffect(new DamageMultiEffect(3)); this.getSpellAbility().addEffect(new DamageMultiEffect(3).setText("{this} deals 3 damage divided as you choose among one, two, or three target attacking or blocking creatures."));
this.getSpellAbility().addTarget(new TargetCreaturePermanentAmount(3, filter)); this.getSpellAbility().addTarget(new TargetCreaturePermanentAmount(3, filter));
} }

View file

@ -57,7 +57,7 @@ import mage.target.common.TargetCardInHand;
public class FirebrandRanger extends CardImpl { public class FirebrandRanger extends CardImpl {
public FirebrandRanger(UUID ownerId, CardSetInfo setInfo) { public FirebrandRanger(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{R}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}");
this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.SOLDIER); this.subtype.add(SubType.SOLDIER);
this.power = new MageInt(2); this.power = new MageInt(2);
@ -91,7 +91,7 @@ class PutLandOnBattlefieldEffect extends OneShotEffect {
public PutLandOnBattlefieldEffect() { public PutLandOnBattlefieldEffect() {
super(Outcome.PutLandInPlay); super(Outcome.PutLandInPlay);
this.staticText = "put a basic land card from your hand onto the battlefield"; this.staticText = "you may put a basic land card from your hand onto the battlefield";
} }
public PutLandOnBattlefieldEffect(final PutLandOnBattlefieldEffect effect) { public PutLandOnBattlefieldEffect(final PutLandOnBattlefieldEffect effect) {

View file

@ -32,14 +32,17 @@ import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.ExileSourceEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ReturnToBattlefieldUnderOwnerControlSourceEffect;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
/** /**
* *
@ -48,7 +51,7 @@ import mage.constants.Zone;
public class FlickeringSpirit extends CardImpl { public class FlickeringSpirit extends CardImpl {
public FlickeringSpirit(UUID ownerId, CardSetInfo setInfo) { public FlickeringSpirit(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{W}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}");
this.subtype.add(SubType.SPIRIT); this.subtype.add(SubType.SPIRIT);
this.power = new MageInt(2); this.power = new MageInt(2);
this.toughness = new MageInt(2); this.toughness = new MageInt(2);
@ -57,9 +60,7 @@ public class FlickeringSpirit extends CardImpl {
this.addAbility(FlyingAbility.getInstance()); this.addAbility(FlyingAbility.getInstance());
// {3}{W}: Exile Flickering Spirit, then return it to the battlefield under its owner's control. // {3}{W}: Exile Flickering Spirit, then return it to the battlefield under its owner's control.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileSourceEffect(true), new ManaCostsImpl("{3}{W}")); this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new FlickeringSpiritEffect(), new ManaCostsImpl("{3}{W}")));
ability.addEffect(new ReturnToBattlefieldUnderOwnerControlSourceEffect());
this.addAbility(ability);
} }
@ -72,3 +73,34 @@ public class FlickeringSpirit extends CardImpl {
return new FlickeringSpirit(this); return new FlickeringSpirit(this);
} }
} }
class FlickeringSpiritEffect extends OneShotEffect {
public FlickeringSpiritEffect() {
super(Outcome.Neutral);
this.staticText = "Exile {this}, then return it to the battlefield under its owner's control";
}
public FlickeringSpiritEffect(final FlickeringSpiritEffect effect) {
super(effect);
}
@Override
public FlickeringSpiritEffect copy() {
return new FlickeringSpiritEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
if (permanent.moveToExile(source.getSourceId(), "Flickering Spirit", source.getSourceId(), game)) {
Card card = game.getExile().getCard(source.getSourceId(), game);
if (card != null) {
return card.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, false);
}
}
}
return false;
}
}

View file

@ -0,0 +1,74 @@
/*
* 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.f;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.costs.common.ExileFromGraveCost;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.TargetController;
import mage.counters.CounterType;
import mage.filter.common.FilterLandCard;
import mage.target.common.TargetCardInYourGraveyard;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author TheElk801
*/
public class ForgottenHarvest extends CardImpl {
public ForgottenHarvest(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}");
// At the beginning of your upkeep, you may exile a land card from your graveyard. If you do, put a +1/+1 counter on target creature.
Ability ability = new BeginningOfUpkeepTriggeredAbility(
new DoIfCostPaid(
new AddCountersTargetEffect(CounterType.P1P1.createInstance()),
new ExileFromGraveCost(new TargetCardInYourGraveyard(new FilterLandCard("land card from your graveyard")))
),
TargetController.YOU, false
);
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}
public ForgottenHarvest(final ForgottenHarvest card) {
super(card);
}
@Override
public ForgottenHarvest copy() {
return new ForgottenHarvest(this);
}
}

View file

@ -28,7 +28,6 @@
package mage.cards.f; package mage.cards.f;
import java.util.UUID; import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.ContinuousEffect;
@ -48,8 +47,6 @@ import mage.players.Player;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
import mage.abilities.common.SimpleStaticAbility;
/** /**
* *
@ -58,7 +55,7 @@ import mage.abilities.common.SimpleStaticAbility;
public class FracturedLoyalty extends CardImpl { public class FracturedLoyalty extends CardImpl {
public FracturedLoyalty(UUID ownerId, CardSetInfo setInfo) { public FracturedLoyalty(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{R}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}");
this.subtype.add(SubType.AURA); this.subtype.add(SubType.AURA);
// Enchant creature // Enchant creature
@ -85,7 +82,7 @@ public class FracturedLoyalty extends CardImpl {
public FracturedLoyaltyEffect() { public FracturedLoyaltyEffect() {
super(Outcome.GainControl); super(Outcome.GainControl);
this.staticText = "that player gains control of that creature"; this.staticText = "that spell or ability's controller gains control of that creature";
} }
private FracturedLoyaltyEffect(FracturedLoyaltyEffect effect) { private FracturedLoyaltyEffect(FracturedLoyaltyEffect effect) {
@ -95,21 +92,23 @@ public class FracturedLoyalty extends CardImpl {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId()); Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (enchantment != null) {
Permanent enchantedCreature = game.getPermanent(enchantment.getAttachedTo()); Permanent enchantedCreature = game.getPermanent(enchantment.getAttachedTo());
if (enchantedCreature != null) {
Player controller = game.getPlayer(enchantedCreature.getControllerId()); Player controller = game.getPlayer(enchantedCreature.getControllerId());
Player newController = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (enchantment.getAttachedTo() != null) {
if (enchantment != null && enchantment.getAttachedTo() != null) { if (controller != null && !enchantedCreature.getControllerId().equals(this.getTargetPointer().getFirst(game, source))) {
if (newController != null && controller != null && !controller.equals(newController)) { ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, this.getTargetPointer().getFirst(game, source));
ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, newController.getId());
effect.setTargetPointer(new FixedTarget(enchantment.getAttachedTo())); effect.setTargetPointer(new FixedTarget(enchantment.getAttachedTo()));
game.addEffect(effect, source); game.addEffect(effect, source);
return true; return true;
} }
} }
}
}
return false; return false;
} }
@Override @Override
public Effect copy() { public Effect copy() {
return new FracturedLoyaltyEffect(this); return new FracturedLoyaltyEffect(this);
@ -150,7 +149,6 @@ public class FracturedLoyalty extends CardImpl {
return false; return false;
} }
@Override @Override
public String getRule() { public String getRule() {
return "Whenever enchanted creature becomes the target of a spell or ability, that spell or ability's controller gains control of that creature."; return "Whenever enchanted creature becomes the target of a spell or ability, that spell or ability's controller gains control of that creature.";

View file

@ -48,7 +48,7 @@ import mage.filter.predicate.mageobject.SupertypePredicate;
*/ */
public class FreyalisesRadiance extends CardImpl { public class FreyalisesRadiance extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent(); private static final FilterPermanent filter = new FilterPermanent("snow permanents");
static { static {
filter.add(new SupertypePredicate(SuperType.SNOW)); filter.add(new SupertypePredicate(SuperType.SNOW));

View file

@ -32,6 +32,7 @@ import mage.abilities.dynamicvalue.common.DomainValue;
import mage.abilities.effects.common.continuous.BoostTargetEffect; import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.AbilityWord;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
@ -43,12 +44,12 @@ import mage.target.common.TargetCreaturePermanent;
public class GaeasMight extends CardImpl { public class GaeasMight extends CardImpl {
public GaeasMight(UUID ownerId, CardSetInfo setInfo) { public GaeasMight(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{G}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{G}");
// Domain - Target creature gets +1/+1 until end of turn for each basic land type among lands you control. // Domain - Target creature gets +1/+1 until end of turn for each basic land type among lands you control.
this.getSpellAbility().addEffect(new BoostTargetEffect(new DomainValue(), new DomainValue(), Duration.EndOfTurn)); this.getSpellAbility().addEffect(new BoostTargetEffect(new DomainValue(), new DomainValue(), Duration.EndOfTurn));
this.getSpellAbility().addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.getSpellAbility().setAbilityWord(AbilityWord.DOMAIN);
} }
public GaeasMight(final GaeasMight card) { public GaeasMight(final GaeasMight card) {

View file

@ -56,14 +56,14 @@ import mage.target.common.TargetControlledCreaturePermanent;
*/ */
public class GateSmasher extends CardImpl { public class GateSmasher extends CardImpl {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("creature with 3 or more power"); private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("creature with toughness 4 or greater");
static { static {
filter.add(new ToughnessPredicate(ComparisonType.MORE_THAN, 3)); filter.add(new ToughnessPredicate(ComparisonType.MORE_THAN, 3));
} }
public GateSmasher(UUID ownerId, CardSetInfo setInfo) { public GateSmasher(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}"); super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
this.subtype.add(SubType.EQUIPMENT); this.subtype.add(SubType.EQUIPMENT);
Target target = new TargetControlledCreaturePermanent(1, 1, filter, false); Target target = new TargetControlledCreaturePermanent(1, 1, filter, false);

View file

@ -42,18 +42,19 @@ import mage.target.common.TargetCreatureOrPlayer;
/** /**
* *
* @author LoneFox * @author LoneFox
*
*/ */
public class GhituFire extends CardImpl { public class GhituFire extends CardImpl {
public GhituFire(UUID ownerId, CardSetInfo setInfo) { public GhituFire(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{X}{R}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{R}");
Effect effect = new DamageTargetEffect(new ManacostVariableValue()); Effect effect = new DamageTargetEffect(new ManacostVariableValue());
// You may cast Ghitu Fire as though it had flash if you pay {2} more to cast it. // You may cast Ghitu Fire as though it had flash if you pay {2} more to cast it.
Ability ability = new PayMoreToCastAsThoughtItHadFlashAbility(this, new ManaCostsImpl("{2}")); Ability ability = new PayMoreToCastAsThoughtItHadFlashAbility(this, new ManaCostsImpl("{2}"));
ability.addEffect(effect); ability.addEffect(effect);
ability.addTarget(new TargetCreatureOrPlayer()); ability.addTarget(new TargetCreatureOrPlayer());
ability.setRuleAtTheTop(true);
this.addAbility(ability); this.addAbility(ability);
// Ghitu Fire deals X damage to target creature or player. // Ghitu Fire deals X damage to target creature or player.
this.getSpellAbility().addEffect(effect); this.getSpellAbility().addEffect(effect);

View file

@ -52,7 +52,7 @@ import mage.target.TargetPermanent;
public class GilderBairn extends CardImpl { public class GilderBairn extends CardImpl {
public GilderBairn(UUID ownerId, CardSetInfo setInfo) { public GilderBairn(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{G/U}{G/U}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G/U}{G/U}");
this.subtype.add(SubType.OUPHE); this.subtype.add(SubType.OUPHE);
this.power = new MageInt(1); this.power = new MageInt(1);
@ -80,7 +80,7 @@ class GilderBairnEffect extends OneShotEffect {
public GilderBairnEffect() { public GilderBairnEffect() {
super(Outcome.Benefit); super(Outcome.Benefit);
this.staticText = "For each counter on target permanent, put another of those counters on that permanent"; this.staticText = "Double the number of each kind of counter on target permanent";
} }
public GilderBairnEffect(final GilderBairnEffect effect) { public GilderBairnEffect(final GilderBairnEffect effect) {

View file

@ -58,7 +58,7 @@ import mage.target.common.TargetCreaturePermanent;
public class GleamOfAuthority extends CardImpl { public class GleamOfAuthority extends CardImpl {
public GleamOfAuthority(UUID ownerId, CardSetInfo setInfo) { public GleamOfAuthority(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{W}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
this.subtype.add(SubType.AURA); this.subtype.add(SubType.AURA);
// Enchant creature // Enchant creature
@ -70,13 +70,16 @@ public class GleamOfAuthority extends CardImpl {
// Enchanted creature gets +1/+1 for each +1/+1 counter on other creatures you control // Enchanted creature gets +1/+1 for each +1/+1 counter on other creatures you control
DynamicValue amount = new CountersOnControlledCount(); DynamicValue amount = new CountersOnControlledCount();
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(amount, amount, Duration.WhileOnBattlefield))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(amount, amount, Duration.WhileOnBattlefield)
.setText("Enchanted creature gets +1/+1 for each +1/+1 counter on other creatures you control.")
));
// Enchanted creature has vigilance and "{W}, {T}: Bloster 1." // Enchanted creature has vigilance and "{W}, {T}: Bloster 1."
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(VigilanceAbility.getInstance(), AttachmentType.AURA))); ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(VigilanceAbility.getInstance(), AttachmentType.AURA));
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BolsterEffect(1), new ManaCostsImpl("{W}")); Ability gainedAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BolsterEffect(1), new ManaCostsImpl("{W}"));
ability.addCost(new TapSourceCost()); gainedAbility.addCost(new TapSourceCost());
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(ability, AttachmentType.AURA))); ability.addEffect(new GainAbilityAttachedEffect(ability, AttachmentType.AURA).setText("and \"{W}, {T}: Bloster 1.\""));
this.addAbility(ability);
} }
public GleamOfAuthority(final GleamOfAuthority card) { public GleamOfAuthority(final GleamOfAuthority card) {

View file

@ -111,6 +111,7 @@ class GodPharaohsGiftEffect extends OneShotEffect {
&& cardChosen.moveToExile(exileId, sourceObject.getIdName(), source.getSourceId(), game)) { && cardChosen.moveToExile(exileId, sourceObject.getIdName(), source.getSourceId(), game)) {
EmptyToken token = new EmptyToken(); EmptyToken token = new EmptyToken();
CardUtil.copyTo(token).from(cardChosen); CardUtil.copyTo(token).from(cardChosen);
token.removePTCDA();
token.getPower().modifyBaseValue(4); token.getPower().modifyBaseValue(4);
token.getToughness().modifyBaseValue(4); token.getToughness().modifyBaseValue(4);
token.getColor(game).setColor(ObjectColor.BLACK); token.getColor(game).setColor(ObjectColor.BLACK);

View file

@ -30,9 +30,12 @@ package mage.cards.g;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.MostCommonColorCondition; import mage.abilities.condition.common.MostCommonColorCondition;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalContinuousEffect; import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.common.RegenerateSourceEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
@ -55,6 +58,8 @@ public class GohamDjinn extends CardImpl {
this.toughness = new MageInt(5); this.toughness = new MageInt(5);
// {1}{B}: Regenerate Goham Djinn. // {1}{B}: Regenerate Goham Djinn.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new RegenerateSourceEffect(), new ManaCostsImpl("{1}{B}")));
// Goham Djinn gets -2/-2 as long as black is the most common color among all permanents or is tied for most common. // Goham Djinn gets -2/-2 as long as black is the most common color among all permanents or is tied for most common.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
new ConditionalContinuousEffect(new BoostSourceEffect(-2, -2, Duration.WhileOnBattlefield), new ConditionalContinuousEffect(new BoostSourceEffect(-2, -2, Duration.WhileOnBattlefield),

View file

@ -48,7 +48,9 @@ public class GreatDefender extends CardImpl {
// Target creature gets +0/+X until end of turn, where X is its converted mana cost. // Target creature gets +0/+X until end of turn, where X is its converted mana cost.
this.getSpellAbility().addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.getSpellAbility().addEffect(new BoostTargetEffect(new StaticValue(0), new TargetConvertedManaCost(), Duration.EndOfTurn, true)); this.getSpellAbility().addEffect(new BoostTargetEffect(new StaticValue(0), new TargetConvertedManaCost(), Duration.EndOfTurn, true)
.setText("Target creature gets +0/+X until end of turn, where X is its converted mana cost.")
);
} }
public GreatDefender(final GreatDefender card) { public GreatDefender(final GreatDefender card) {

View file

@ -56,12 +56,13 @@ import mage.target.common.TargetCreaturePermanent;
public class GreaterStoneSpirit extends CardImpl { public class GreaterStoneSpirit extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures with flying"); private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures with flying");
static { static {
filter.add(new AbilityPredicate(FlyingAbility.class)); filter.add(new AbilityPredicate(FlyingAbility.class));
} }
public GreaterStoneSpirit(UUID ownerId, CardSetInfo setInfo) { public GreaterStoneSpirit(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{R}{R}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{R}{R}");
this.subtype.add(SubType.ELEMENTAL); this.subtype.add(SubType.ELEMENTAL);
this.subtype.add(SubType.SPIRIT); this.subtype.add(SubType.SPIRIT);
this.power = new MageInt(4); this.power = new MageInt(4);
@ -72,7 +73,10 @@ public class GreaterStoneSpirit extends CardImpl {
// {2}{R}: Until end of turn, target creature gets +0/+2 and gains "{R}: This creature gets +1/+0 until end of turn." // {2}{R}: Until end of turn, target creature gets +0/+2 and gains "{R}: This creature gets +1/+0 until end of turn."
Ability gainedAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, Ability gainedAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new BoostSourceEffect(1, 0, Duration.EndOfTurn), new ManaCostsImpl("{R}")); new BoostSourceEffect(1, 0, Duration.EndOfTurn)
.setText("until end of turn, target creature gets +0/+2"),
new ManaCostsImpl("{R}")
);
Effect effect = new GainAbilityTargetEffect(gainedAbility, Duration.EndOfTurn); Effect effect = new GainAbilityTargetEffect(gainedAbility, Duration.EndOfTurn);
effect.setText("and gains \"{R}: This creature gets +1/+0 until end of turn.\""); effect.setText("and gains \"{R}: This creature gets +1/+0 until end of turn.\"");
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(0, 2, Duration.EndOfTurn), new ManaCostsImpl("{2}{R}")); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(0, 2, Duration.EndOfTurn), new ManaCostsImpl("{2}{R}"));

View file

@ -64,10 +64,10 @@ public class GreenManaBattery extends CardImpl {
Mana.GreenMana(1), Mana.GreenMana(1),
new IntPlusDynamicValue(1, new RemovedCountersForCostValue()), new IntPlusDynamicValue(1, new RemovedCountersForCostValue()),
new TapSourceCost(), new TapSourceCost(),
"Add {G} to your mana pool, then add {G} to your mana pool for each storage counter removed this way", "Add {G} to your mana pool, then add {G} to your mana pool for each charge counter removed this way",
true, new CountersSourceCount(CounterType.STORAGE)); true, new CountersSourceCount(CounterType.CHARGE));
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance(), ability.addCost(new RemoveVariableCountersSourceCost(CounterType.CHARGE.createInstance(),
"Remove X storage counters from {this}")); "Remove any number of charge counters from {this}"));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -0,0 +1,115 @@
/*
* 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.h;
import java.util.Iterator;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.keyword.LandwalkAbility;
import mage.abilities.mana.RedManaAbility;
import mage.constants.SuperType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author TheElk801
*/
public class Hammerheim extends CardImpl {
public Hammerheim(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
this.addSuperType(SuperType.LEGENDARY);
// {tap}: Add {R} to your mana pool.
this.addAbility(new RedManaAbility());
// {tap}: Target creature loses all landwalk abilities until end of turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new HammerheimEffect(), new TapSourceCost());
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}
public Hammerheim(final Hammerheim card) {
super(card);
}
@Override
public Hammerheim copy() {
return new Hammerheim(this);
}
}
class HammerheimEffect extends ContinuousEffectImpl {
public HammerheimEffect() {
super(Duration.EndOfTurn, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.LoseAbility);
}
public HammerheimEffect(final HammerheimEffect effect) {
super(effect);
}
@Override
public HammerheimEffect copy() {
return new HammerheimEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (permanent != null) {
for (Iterator<Ability> iter = permanent.getAbilities().iterator(); iter.hasNext();) {
Ability ab = iter.next();
if (ab instanceof LandwalkAbility) {
iter.remove();
}
}
}
return true;
}
@Override
public String getText(Mode mode) {
return "Target creature loses all landwalk abilities until end of turn.";
}
}

View file

@ -54,7 +54,7 @@ import java.util.UUID;
public class HedonistsTrove extends CardImpl { public class HedonistsTrove extends CardImpl {
public HedonistsTrove(UUID ownerId, CardSetInfo setInfo) { public HedonistsTrove(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{5}{B}{B}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{5}{B}{B}");
// When Hedonist's Trove enters the battlefield, exile all cards from target opponent's graveyard. // When Hedonist's Trove enters the battlefield, exile all cards from target opponent's graveyard.
Ability ability = new EntersBattlefieldTriggeredAbility(new HedonistsTroveExileEffect()); Ability ability = new EntersBattlefieldTriggeredAbility(new HedonistsTroveExileEffect());
@ -115,7 +115,7 @@ class HedonistsTrovePlayLandEffect extends AsThoughEffectImpl {
public HedonistsTrovePlayLandEffect() { public HedonistsTrovePlayLandEffect() {
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.WhileOnBattlefield, Outcome.Benefit); super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.WhileOnBattlefield, Outcome.Benefit);
staticText = "You may play land cards exiled by {this}"; staticText = "You may play land cards exiled with {this}";
} }
public HedonistsTrovePlayLandEffect(final HedonistsTrovePlayLandEffect effect) { public HedonistsTrovePlayLandEffect(final HedonistsTrovePlayLandEffect effect) {

View file

@ -50,7 +50,7 @@ import mage.counters.CounterType;
*/ */
public class HelixPinnacle extends CardImpl { public class HelixPinnacle extends CardImpl {
static final String rule = "if there are 100 or more tower counters on Helix Pinnacle, you win the game"; static final String rule = "at the beginning of your upkeep, if there are 100 or more tower counters on Helix Pinnacle, you win the game";
public HelixPinnacle(UUID ownerId, CardSetInfo setInfo) { public HelixPinnacle(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{G}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{G}");

View file

@ -50,7 +50,7 @@ import mage.filter.predicate.permanent.AnotherPredicate;
*/ */
public class HerdchaserDragon extends CardImpl { public class HerdchaserDragon extends CardImpl {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("each other Dragon creature you control"); private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("other Dragon creature you control");
static { static {
filter.add(new AnotherPredicate()); filter.add(new AnotherPredicate());
@ -58,7 +58,7 @@ public class HerdchaserDragon extends CardImpl {
} }
public HerdchaserDragon(UUID ownerId, CardSetInfo setInfo) { public HerdchaserDragon(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{G}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{G}");
this.subtype.add(SubType.DRAGON); this.subtype.add(SubType.DRAGON);
this.power = new MageInt(3); this.power = new MageInt(3);
this.toughness = new MageInt(3); this.toughness = new MageInt(3);

Some files were not shown because too many files have changed in this diff Show more