Merge branch 'master' into feature/HASCON2017Promos

This commit is contained in:
Eleros 2017-08-09 22:11:19 +02:00 committed by GitHub
commit b770e8ba51
332 changed files with 27691 additions and 3161 deletions

267
.gitignore vendored
View file

@ -1,133 +1,134 @@
syntax: glob
# Mage.Client
Mage.Client/*.dck
Mage.Client/db
Mage.Client/gamelogs
Mage.Client/mageclient.log
Mage.Client/plugins/images
Mage.Client/plugins/plugin.data
Mage.Client/target
Mage.Common/target
/db
/gamelogs
/mageclient.log
# Mage.Plugins
Mage.Plugins/Mage.Card.Plugin/target
Mage.Plugins/Mage.Counter.Plugin/target
Mage.Plugins/Mage.Theme.Plugin/target
Mage.Plugins/Mage.Rating.Plugin/target
# Mage.Server
Mage.Server/config/init.txt
Mage.Server/saved
Mage.Server/target
Mage.Server/db
Mage.Server/cache
Mage.Server/mageserver.log
Mage.Server/magediag.log
Mage.Server/extensions
/saved
/db
/cache
/mageserver.log
/magediag.log
/extensions
Mage.Server.Console/target/
Mage.Server.Console/mageadmin.log
Mage.Server.Plugins/Mage.Deck.Constructed/target
Mage.Server.Plugins/Mage.Deck.Limited/target
Mage.Server.Plugins/Mage.Game.CanadianHighlanderDuel/target
Mage.Server.Plugins/Mage.Game.CommanderDuel/target
Mage.Server.Plugins/Mage.Game.CommanderFreeForAll/target/
Mage.Server.Plugins/Mage.Game.FreeForAll/target
Mage.Server.Plugins/Mage.Game.MomirDuel/target
Mage.Server.Plugins/Mage.Game.TinyLeadersDuel/target
Mage.Server.Plugins/Mage.Game.TwoPlayerDuel/target
Mage.Server.Plugins/Mage.Player.AI.DraftBot/target
Mage.Server.Plugins/Mage.Player.AI.MA/target
Mage.Server.Plugins/Mage.Player.AI/target
Mage.Server.Plugins/Mage.Player.AIMCTS/target
Mage.Server.Plugins/Mage.Player.AIMinimax/target
Mage.Server.Plugins/Mage.Player.Human/target
Mage.Server.Plugins/Mage.Tournament.BoosterDraft/target
Mage.Server.Plugins/Mage.Tournament.Constructed/target
Mage.Server.Plugins/Mage.Tournament.Sealed/target
# Mage.Sets
Mage.Sets/target
# Mage.Stats
Mage.Stats/server.log
Mage.Stats/mageserver.log
Mage.Stats/magediag.log
# Mage.Tests
Mage.Tests/target
Mage.Tests/cache
Mage.Tests/db
Mage.Tests/Mage.log
Mage.Tests/watchdog.log
# Mage
Mage/target
# Mage.Updater
Mage.Updater/target
mage.updater.client/target
# Mage.Verify
Mage.Verify/target
Mage.Verify/AllCards.json.zip
Mage.Verify/AllSets.json.zip
releases
Utils/author.txt
.DS_Store
.metadata
.project
.settings
.idea
syntax: regexp
\.class
\.jar
\.iml
\.ipr
\.iws
\.log
nbactions.xml
nbactions-*.xml
nb-configuration.xml
glob:Mage.Client/cheat.dck
glob:Mage.Client/test.dck
mage-bundle.zip
mage-stats-ws.war
Mage.Server.Plugins/Mage.Draft.8PlayerBooster/target
\.orig\..*$
\.orig$
\.chg\..*$
\.rej$
\.conflict\~$
/Mage.Server.Plugins/Mage.Player.AIMCTS/target/
*.classpath
*.iml
hs_err*.log
/submitted
/Mage.Server/config/ai.please.cast.this.txt
/Mage.Stats/target/
/Utils/*_unimplemented.txt
*.netbeans_automatic_build
*.txt
Mage.Client/serverlist.txt
/bin/
/out/
/target/
client_secrets.json
dependency-reduced-pom.xml
syntax: glob
# Mage.Client
Mage.Client/*.dck
Mage.Client/db
Mage.Client/gamelogs
Mage.Client/mageclient.log
Mage.Client/plugins/images
Mage.Client/plugins/plugin.data
Mage.Client/target
Mage.Common/target
/db
/gamelogs
/mageclient.log
# Mage.Plugins
Mage.Plugins/Mage.Card.Plugin/target
Mage.Plugins/Mage.Counter.Plugin/target
Mage.Plugins/Mage.Theme.Plugin/target
Mage.Plugins/Mage.Rating.Plugin/target
# Mage.Server
Mage.Server/config/init.txt
Mage.Server/saved
Mage.Server/target
Mage.Server/db
Mage.Server/cache
Mage.Server/mageserver.log
Mage.Server/magediag.log
Mage.Server/extensions
/saved
/db
/cache
/mageserver.log
/magediag.log
/extensions
Mage.Server.Console/target/
Mage.Server.Console/mageadmin.log
Mage.Server.Plugins/Mage.Deck.Constructed/target
Mage.Server.Plugins/Mage.Deck.Limited/target
Mage.Server.Plugins/Mage.Game.CanadianHighlanderDuel/target
Mage.Server.Plugins/Mage.Game.CommanderDuel/target
Mage.Server.Plugins/Mage.Game.CommanderFreeForAll/target/
Mage.Server.Plugins/Mage.Game.FreeForAll/target
Mage.Server.Plugins/Mage.Game.MomirDuel/target
Mage.Server.Plugins/Mage.Game.TinyLeadersDuel/target
Mage.Server.Plugins/Mage.Game.TwoPlayerDuel/target
Mage.Server.Plugins/Mage.Player.AI.DraftBot/target
Mage.Server.Plugins/Mage.Player.AI.MA/target
Mage.Server.Plugins/Mage.Player.AI/target
Mage.Server.Plugins/Mage.Player.AIMCTS/target
Mage.Server.Plugins/Mage.Player.AIMinimax/target
Mage.Server.Plugins/Mage.Player.Human/target
Mage.Server.Plugins/Mage.Tournament.BoosterDraft/target
Mage.Server.Plugins/Mage.Tournament.Constructed/target
Mage.Server.Plugins/Mage.Tournament.Sealed/target
# Mage.Sets
Mage.Sets/target
# Mage.Stats
Mage.Stats/server.log
Mage.Stats/mageserver.log
Mage.Stats/magediag.log
# Mage.Tests
Mage.Tests/target
Mage.Tests/cache
Mage.Tests/db
Mage.Tests/Mage.log
Mage.Tests/watchdog.log
# Mage
Mage/target
# Mage.Updater
Mage.Updater/target
mage.updater.client/target
# Mage.Verify
Mage.Verify/target
Mage.Verify/AllCards.json.zip
Mage.Verify/AllSets.json.zip
releases
Utils/author.txt
.DS_Store
.metadata
.project
.settings
.idea
syntax: regexp
\.class
\.jar
\.iml
\.ipr
\.iws
\.log
nbactions.xml
nbactions-*.xml
nb-configuration.xml
glob:Mage.Client/cheat.dck
glob:Mage.Client/test.dck
mage-bundle.zip
mage-stats-ws.war
Mage.Server.Plugins/Mage.Draft.8PlayerBooster/target
\.orig\..*$
\.orig$
\.chg\..*$
\.rej$
\.conflict\~$
/Mage.Server.Plugins/Mage.Player.AIMCTS/target/
*.classpath
*.iml
hs_err*.log
/submitted
/Mage.Server/config/ai.please.cast.this.txt
/Mage.Stats/target/
/Utils/*_unimplemented.txt
*.netbeans_automatic_build
*.txt
Mage.Client/serverlist.txt
/bin/
/out/
/target/
client_secrets.json
dependency-reduced-pom.xml
/Mage.Server.Plugins/Mage.Game.PennyDreadfulCommanderFreeForAll/target/

View file

@ -206,6 +206,18 @@
</Component>
<Component class="javax.swing.JToolBar$Separator" name="jSeparator2">
</Component>
<Component class="javax.swing.JCheckBox" name="chkPennyDreadful">
<Properties>
<Property name="text" type="java.lang.String" value="Penny Dreadful Only"/>
<Property name="toolTipText" type="java.lang.String" value="Will only allow Penny Dreadful legal cards to be shown."/>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="4"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="chkPilesActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="btnBooster">
<Properties>
<Property name="text" type="java.lang.String" value="Open Booster"/>
@ -528,16 +540,18 @@
<Component id="chkRules" alignment="1" max="32767" attributes="0"/>
<Component id="chkNames" alignment="1" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jButtonRemoveFromMain" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jButtonAddToSideboard" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jButtonRemoveFromSideboard" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jTextFieldSearch" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButtonSearch" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButtonClean" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="cardCount" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButtonAddToMain" alignment="3" max="-2" attributes="0"/>
<Component id="cardCountLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jTextFieldSearch" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButtonSearch" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButtonClean" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="cardCount" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButtonAddToMain" alignment="3" max="-2" attributes="0"/>
<Component id="cardCountLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>

View file

@ -36,6 +36,7 @@ package mage.client.deckeditor;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.util.Map.Entry;
import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
import mage.MageObject;
@ -74,6 +75,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
private BigCard bigCard;
private boolean limited = false;
private final SortSetting sortSetting;
private static final Map<String, Integer> pdAllowed = new HashMap<>();
private final ActionListener searchAction = evt -> jButtonSearchActionPerformed(evt);
@ -372,6 +374,12 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
try {
java.util.List<Card> filteredCards = new ArrayList<>();
setCursor(new Cursor(Cursor.WAIT_CURSOR));
boolean chkPD = chkPennyDreadful.isSelected();
if (chkPD) {
generatePennyDreadfulHash();
}
if (limited) {
for (Card card : cards) {
if (filter.match(card, null)) {
@ -383,6 +391,11 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
for (CardInfo cardInfo : foundCards) {
Card card = cardInfo.getMockCard();
if (filter.match(card, null)) {
if (chkPD) {
if (!pdAllowed.containsKey(card.getName())) {
continue;
}
}
filteredCards.add(card);
}
}
@ -419,6 +432,22 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
}
}
public void generatePennyDreadfulHash() {
if (pdAllowed.size() > 0) {
return;
}
Properties properties = new Properties();
try {
properties.load(CardSelector.class.getResourceAsStream("pennydreadful.properties"));
} catch (Exception e) {
e.printStackTrace();
}
for (final Entry<Object, Object> entry : properties.entrySet()) {
pdAllowed.put((String) entry.getKey(), 1);
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
@ -439,6 +468,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
jSeparator1 = new javax.swing.JToolBar.Separator();
cbExpansionSet = new javax.swing.JComboBox<>();
jSeparator2 = new javax.swing.JToolBar.Separator();
chkPennyDreadful = new javax.swing.JCheckBox();
btnBooster = new javax.swing.JButton();
btnClear = new javax.swing.JButton();
tbTypes = new javax.swing.JToolBar();
@ -583,6 +613,27 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
tbColor.add(cbExpansionSet);
tbColor.add(jSeparator2);
chkPennyDreadful.setText("Penny Dreadful");
chkPennyDreadful.setToolTipText("Will only allow Penny Dreadful legal cards to be shown.");
chkPennyDreadful.setFocusable(false);
chkPennyDreadful.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
chkPennyDreadful.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
chkPennyDreadful.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
chkPilesActionPerformed(evt);
}
});
JPopupMenu filterByFormatPopup = new JPopupMenu();
filterByFormatPopup.add(chkPennyDreadful);
filterByFormatPopup.setLayout(new GridBagLayout());
ButtonGroup selectByTypeModeGroup = new ButtonGroup();
JButton filterByFormatButton = new JButton ("Filter by Format");
makeButtonPopup(filterByFormatButton, filterByFormatPopup);
tbColor.add(filterByFormatButton);
btnBooster.setText("Open Booster");
btnBooster.setToolTipText("(CURRENTLY NOT WORKING) Generates a booster of the selected set and adds the cards to the card selector.");
btnBooster.setFocusable(false);
@ -939,16 +990,17 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
.addComponent(chkRules, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(chkNames, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(cardSelectorBottomPanelLayout.createSequentialGroup()
.addGroup(cardSelectorBottomPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addGroup(cardSelectorBottomPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButtonRemoveFromMain, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButtonAddToSideboard, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButtonRemoveFromSideboard, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextFieldSearch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButtonSearch)
.addComponent(jButtonClean)
.addComponent(cardCount)
.addComponent(jButtonAddToMain, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cardCountLabel))
.addGroup(cardSelectorBottomPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextFieldSearch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButtonSearch)
.addComponent(jButtonClean)
.addComponent(cardCount)
.addComponent(jButtonAddToMain, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cardCountLabel)))
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
@ -1204,6 +1256,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
private javax.swing.JComboBox<String> cbExpansionSet;
private javax.swing.JComboBox<SortBy> cbSortBy;
private javax.swing.JCheckBox chkNames;
private javax.swing.JCheckBox chkPennyDreadful;
private javax.swing.JCheckBox chkPiles;
private javax.swing.JCheckBox chkRules;
private javax.swing.JCheckBox chkTypes;
@ -1287,4 +1340,8 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
public void dragCardDrop(MouseEvent e, DragCardSource source, Collection<CardView> cards) {
// Need to add cards back to tally
}
private static void makeButtonPopup(final AbstractButton button, final JPopupMenu popup) {
button.addActionListener(e -> popup.show(button, 0, button.getHeight()));
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,180 @@
/*
* Copyright 2011 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.deck;
import java.util.*;
import java.util.Map.Entry;
import mage.abilities.common.CanBeYourCommanderAbility;
import mage.abilities.keyword.PartnerAbility;
import mage.cards.Card;
import mage.cards.ExpansionSet;
import mage.cards.Sets;
import mage.cards.decks.Constructed;
import mage.cards.decks.Deck;
import mage.constants.SetType;
import mage.filter.FilterMana;
/**
*
* @author spjspj
*/
public class PennyDreadfulCommander extends Constructed {
protected List<String> bannedCommander = new ArrayList<>();
private static final Map<String, Integer> pdAllowed = new HashMap<>();
private static boolean setupAllowed = false;
public PennyDreadfulCommander() {
this("Penny Dreadful Commander");
for (ExpansionSet set : Sets.getInstance().values()) {
if (set.getSetType() != SetType.CUSTOM_SET) {
setCodes.add(set.getCode());
}
}
}
public PennyDreadfulCommander(String name) {
super(name);
}
@Override
public boolean validate(Deck deck) {
boolean valid = true;
FilterMana colorIdentity = new FilterMana();
if (deck.getCards().size() + deck.getSideboard().size() != 100) {
invalid.put("Deck", "Must contain 100 cards: has " + (deck.getCards().size() + deck.getSideboard().size()) + " cards");
valid = false;
}
List<String> basicLandNames = new ArrayList<>(Arrays.asList("Forest", "Island", "Mountain", "Swamp", "Plains", "Wastes"));
Map<String, Integer> counts = new HashMap<>();
countCards(counts, deck.getCards());
countCards(counts, deck.getSideboard());
for (Map.Entry<String, Integer> entry : counts.entrySet()) {
if (entry.getValue() > 1) {
if (!basicLandNames.contains(entry.getKey())) {
invalid.put(entry.getKey(), "Too many: " + entry.getValue());
valid = false;
}
}
}
generatePennyDreadfulHash();
for (String wantedCard : counts.keySet()) {
if (!(pdAllowed.containsKey(wantedCard))) {
invalid.put(wantedCard, "Banned");
valid = false;
}
}
if (deck.getSideboard().size() < 1 || deck.getSideboard().size() > 2) {
invalid.put("Commander", "Sideboard must contain only the commander(s)");
valid = false;
} else {
for (Card commander : deck.getSideboard()) {
if ((!commander.isCreature() || !commander.isLegendary())
&& (!commander.isPlaneswalker() || !commander.getAbilities().contains(CanBeYourCommanderAbility.getInstance()))) {
invalid.put("Commander", "Commander invalid (" + commander.getName() + ')');
valid = false;
}
if (deck.getSideboard().size() == 2 && !commander.getAbilities().contains(PartnerAbility.getInstance())) {
invalid.put("Commander", "Commander without Partner (" + commander.getName() + ')');
valid = false;
}
FilterMana commanderColor = commander.getColorIdentity();
if (commanderColor.isWhite()) {
colorIdentity.setWhite(true);
}
if (commanderColor.isBlue()) {
colorIdentity.setBlue(true);
}
if (commanderColor.isBlack()) {
colorIdentity.setBlack(true);
}
if (commanderColor.isRed()) {
colorIdentity.setRed(true);
}
if (commanderColor.isGreen()) {
colorIdentity.setGreen(true);
}
}
}
for (Card card : deck.getCards()) {
if (!cardHasValidColor(colorIdentity, card)) {
invalid.put(card.getName(), "Invalid color (" + colorIdentity.toString() + ')');
valid = false;
}
}
for (Card card : deck.getCards()) {
if (!isSetAllowed(card.getExpansionSetCode())) {
if (!legalSets(card)) {
invalid.put(card.getName(), "Not allowed Set: " + card.getExpansionSetCode());
valid = false;
}
}
}
for (Card card : deck.getSideboard()) {
if (!isSetAllowed(card.getExpansionSetCode())) {
if (!legalSets(card)) {
invalid.put(card.getName(), "Not allowed Set: " + card.getExpansionSetCode());
valid = false;
}
}
}
return valid;
}
public boolean cardHasValidColor(FilterMana commander, Card card) {
FilterMana cardColor = card.getColorIdentity();
return !(cardColor.isBlack() && !commander.isBlack()
|| cardColor.isBlue() && !commander.isBlue()
|| cardColor.isGreen() && !commander.isGreen()
|| cardColor.isRed() && !commander.isRed()
|| cardColor.isWhite() && !commander.isWhite());
}
public void generatePennyDreadfulHash() {
if (setupAllowed == false) {
setupAllowed = true;
} else {
return;
}
Properties properties = new Properties();
try {
properties.load(PennyDreadfulCommander.class.getResourceAsStream("pennydreadful.properties"));
} catch (Exception e) {
e.printStackTrace();
}
for (final Entry<Object, Object> entry : properties.entrySet()) {
pdAllowed.put((String) entry.getKey(), 1);
}
}
}

View file

@ -0,0 +1,49 @@
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.25</version>
</parent>
<artifactId>mage-game-pennydreadfulcommanderfreeforall</artifactId>
<packaging>jar</packaging>
<name>Mage Game Penny Dreadful Commander Free For All</name>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mage</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
<finalName>mage-game-freeforall</finalName>
</build>
<properties/>
</project>

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.game;
import java.util.UUID;
import mage.constants.MultiplayerAttackOption;
import mage.constants.RangeOfInfluence;
import mage.game.match.MatchType;
/**
*
* @author spjspj
*/
public class PennyDreadfulCommanderFreeForAll extends GameCommanderImpl {
private int numPlayers;
public PennyDreadfulCommanderFreeForAll(MultiplayerAttackOption attackOption, RangeOfInfluence range, int freeMulligans, int startLife) {
super(attackOption, range, freeMulligans, startLife);
}
public PennyDreadfulCommanderFreeForAll(final PennyDreadfulCommanderFreeForAll game) {
super(game);
this.numPlayers = game.numPlayers;
}
@Override
protected void init(UUID choosingPlayerId) {
startingPlayerSkipsDraw = false;
super.init(choosingPlayerId);
}
@Override
public MatchType getGameType() {
return new PennyDreadfulCommanderFreeForAllType();
}
@Override
public int getNumPlayers() {
return numPlayers;
}
public void setNumPlayers(int numPlayers) {
this.numPlayers = numPlayers;
}
@Override
public PennyDreadfulCommanderFreeForAll copy() {
return new PennyDreadfulCommanderFreeForAll(this);
}
}

View file

@ -0,0 +1,60 @@
/*
* 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.game;
import mage.game.match.MatchImpl;
import mage.game.match.MatchOptions;
/**
*
* @author spjspj
*/
public class PennyDreadfulCommanderFreeForAllMatch extends MatchImpl {
public PennyDreadfulCommanderFreeForAllMatch(MatchOptions options) {
super(options);
}
@Override
public void startGame() throws GameException {
int startLife = 40;
boolean alsoHand = true;
if (options.getDeckType().equals("Variant Magic - Duel Penny Dreadful Commander")) {
startLife = 30;
alsoHand = true; // commander going to hand allowed to go to command zone effective July 17, 2015
}
PennyDreadfulCommanderFreeForAll game = new PennyDreadfulCommanderFreeForAll(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), startLife);
game.setStartMessage(this.createGameStartMessage());
game.setAlsoHand(alsoHand);
game.setAlsoLibrary(true);
initGame(game);
games.add(game);
}
}

View file

@ -0,0 +1,58 @@
/*
* 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.game;
import mage.game.match.MatchType;
/**
*
* @author spjspj
*/
public class PennyDreadfulCommanderFreeForAllType extends MatchType {
public PennyDreadfulCommanderFreeForAllType() {
this.name = "Penny Dreadful Commander Free For All";
this.maxPlayers = 10;
this.minPlayers = 3;
this.numTeams = 0;
this.useAttackOption = true;
this.useRange = true;
this.sideboardingAllowed = false;
}
protected PennyDreadfulCommanderFreeForAllType(final PennyDreadfulCommanderFreeForAllType matchType) {
super(matchType);
}
@Override
public PennyDreadfulCommanderFreeForAllType copy() {
return new PennyDreadfulCommanderFreeForAllType(this);
}
}

View file

@ -0,0 +1,5 @@
#Generated by Maven
#Thu Aug 03 09:40:46 AEST 2017
version=1.4.25
groupId=org.mage
artifactId=mage-game-pennydreadfulcommanderfreeforall

View file

@ -23,6 +23,7 @@
<module>Mage.Game.MomirDuel</module>
<module>Mage.Game.TinyLeadersDuel</module>
<module>Mage.Game.CanadianHighlanderDuel</module>
<module>Mage.Game.PennyDreadfulCommanderFreeForAll</module>
<module>Mage.Game.TwoPlayerDuel</module>
<module>Mage.Player.AI</module>
<module>Mage.Player.AIMinimax</module>

View file

@ -75,6 +75,7 @@
<gameType name="Commander Free For All" jar="mage-game-commanderfreeforall.jar" className="mage.game.CommanderFreeForAllMatch" typeName="mage.game.CommanderFreeForAllType"/>
<gameType name="Tiny Leaders Two Player Duel" jar="mage-game-tinyleadersduel.jar" className="mage.game.TinyLeadersDuelMatch" typeName="mage.game.TinyLeadersDuelType"/>
<gameType name="Canadian Highlander Two Player Duel" jar="mage-game-canadianhighlanderduel.jar" className="mage.game.CanadianHighlanderDuelMatch" typeName="mage.game.CanadianHighlanderDuelType"/>
<gameType name="Penny Dreadful Commander Free For All" jar="mage-game-pennydreadfulcommanderfreeforall.jar" className="mage.game.PennyDreadfulCommanderFreeForAllMatch" typeName="mage.game.PennyDreadfulCommanderFreeForAllType"/>
<gameType name="Momir Basic Two Player Duel" jar="mage-game-momirduel.jar" className="mage.game.MomirDuelMatch" typeName="mage.game.MomirDuelType"/>
</gameTypes>
<tournamentTypes>
@ -148,6 +149,7 @@
<deckType name="Variant Magic - MTGO 1v1 Commander" jar="mage-deck-constructed.jar" className="mage.deck.MTGO1v1Commander"/>
<deckType name="Variant Magic - Tiny Leaders" jar="mage-deck-constructed.jar" className="mage.deck.TinyLeaders"/>
<deckType name="Variant Magic - Momir Basic" jar="mage-deck-constructed.jar" className="mage.deck.Momir"/>
<deckType name="Variant Magic - Penny Dreadful Commander" jar="mage-deck-pennydreadfulconstructed.jar" className="mage.deck.PennyDreadfulCommander"/>
<deckType name="Block Constructed - Amonkhet" jar="mage-deck-constructed.jar" className="mage.deck.AmonkhetBlock"/>
<deckType name="Block Constructed - Battle for Zendikar" jar="mage-deck-constructed.jar" className="mage.deck.BattleForZendikarBlock"/>
<deckType name="Block Constructed - Innistrad" jar="mage-deck-constructed.jar" className="mage.deck.InnistradBlock"/>

View file

@ -148,6 +148,12 @@
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mage-game-pennydreadfulcommanderfreeforall</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mage-game-momirduel</artifactId>

View file

@ -72,6 +72,7 @@
<gameType name="Commander Free For All" jar="mage-game-commanderfreeforall-${project.version}.jar" className="mage.game.CommanderFreeForAllMatch" typeName="mage.game.CommanderFreeForAllType"/>
<gameType name="Tiny Leaders Two Player Duel" jar="mage-game-tinyleadersduel-${project.version}.jar" className="mage.game.TinyLeadersDuelMatch" typeName="mage.game.TinyLeadersDuelType"/>
<gameType name="Canadian Highlander Two Player Duel" jar="mage-game-canadianhighlanderduel-${project.version}.jar" className="mage.game.CanadianHighlanderDuelMatch" typeName="mage.game.CanadianHighlanderDuelType"/>
<gameType name="Penny Dreadful Commander Free For All" jar="mage-game-pennydreadfulcommanderfreeforall-${project.version}.jar" className="mage.game.PennyDreadfulCommanderFreeForAllMatch" typeName="mage.game.PennyDreadfulCommanderFreeForAllType"/>
<gameType name="Momir Basic Two Player Duel" jar="mage-game-momirduel-${project.version}.jar" className="mage.game.MomirDuelMatch" typeName="mage.game.MomirDuelType"/>
</gameTypes>
<tournamentTypes>
@ -145,6 +146,7 @@
<deckType name="Variant Magic - MTGO 1v1 Commander" jar="mage-deck-constructed.jar" className="mage.deck.MTGO1v1Commander"/>
<deckType name="Variant Magic - Tiny Leaders" jar="mage-deck-constructed-${project.version}.jar" className="mage.deck.TinyLeaders"/>
<deckType name="Variant Magic - Momir Basic" jar="mage-deck-constructed-${project.version}.jar" className="mage.deck.Momir"/>
<deckType name="Variant Magic - Penny Dreadful Commander" jar="mage-deck-constructed-${project.version}.jar" className="mage.deck.PennyDreadfulCommander"/>
<deckType name="Block Constructed - Amonkhet" jar="mage-deck-constructed.jar" className="mage.deck.AmonkhetBlock"/>
<deckType name="Block Constructed - Battle for Zendikar" jar="mage-deck-constructed.jar" className="mage.deck.BattleForZendikarBlock"/>
<deckType name="Block Constructed - Innistrad" jar="mage-deck-constructed-${project.version}.jar" className="mage.deck.InnistradBlock"/>

File diff suppressed because it is too large Load diff

View file

@ -44,11 +44,11 @@ import mage.target.common.TargetCreaturePermanent;
public class AcceleratedMutation extends CardImpl {
public AcceleratedMutation(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{3}{G}{G}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{G}{G}");
// Target creature gets +X/+X until end of turn, where X is the highest converted mana cost among permanents you control.
DynamicValue amount = new HighestConvertedManaCostValue();
this.getSpellAbility().addEffect(new BoostTargetEffect(amount, amount, Duration.EndOfTurn));
this.getSpellAbility().addEffect(new BoostTargetEffect(amount, amount, Duration.EndOfTurn, true));
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.a;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AsEntersBattlefieldAbility;
@ -44,6 +43,8 @@ import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
* @author nantuko
*/
@ -98,7 +99,7 @@ class AdaptiveAutomatonAddSubtypeEffect extends ContinuousEffectImpl {
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
String subtype = (String) game.getState().getValue(permanent.getId() + "_type");
SubType subtype = (SubType) game.getState().getValue(permanent.getId() + "_type");
if (subtype != null && !permanent.getSubtype(game).contains(subtype)) {
permanent.getSubtype(game).add(subtype);
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.a;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
@ -47,6 +46,8 @@ import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetOpponent;
import java.util.UUID;
/**
*
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
@ -96,7 +97,7 @@ class AetherChargeTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent.isCreature() && permanent.hasSubtype("Beast", game)
if (permanent.isCreature() && permanent.hasSubtype(SubType.BEAST, game)
&& permanent.getControllerId().equals(this.controllerId)) {
Effect effect = this.getEffects().get(0);
effect.setValue("damageSource", event.getTargetId());

View file

@ -27,7 +27,6 @@
*/
package mage.cards.a;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
@ -47,6 +46,8 @@ import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCardInOpponentsGraveyard;
import java.util.UUID;
/**
*
* @author jeffwadsworth
@ -98,7 +99,7 @@ class AgadeemOccultistEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
int allycount = 0;
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(source.getControllerId())) {
if (permanent.hasSubtype("Ally", game)) {
if (permanent.hasSubtype(SubType.ALLY, game)) {
allycount++;
}
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.a;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
@ -47,6 +46,8 @@ import mage.players.Player;
import mage.target.common.TargetCreatureOrPlayer;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
*
* @author fireshoes
@ -146,7 +147,7 @@ class AkoumHellkiteDamageEffect extends OneShotEffect {
Permanent land = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
Player player = game.getPlayer(source.getFirstTarget());
if (land != null && player != null) {
if (land.hasSubtype("Mountain", game)) {
if (land.hasSubtype(SubType.MOUNTAIN, game)) {
player.damage(2, source.getSourceId(), game, false, true);
} else {
player.damage(1, source.getSourceId(), game, false, true);
@ -155,7 +156,7 @@ class AkoumHellkiteDamageEffect extends OneShotEffect {
}
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (land != null && permanent != null) {
if (land.hasSubtype("Mountain", game)) {
if (land.hasSubtype(SubType.MOUNTAIN, game)) {
permanent.damage(2, source.getSourceId(), game, false, true);
} else {
permanent.damage(1, source.getSourceId(), game, false, true);

View file

@ -50,13 +50,14 @@ import mage.filter.predicate.permanent.ControllerPredicate;
public class AkroanHoplite extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("attacking creatures you control");
static {
filter.add(new ControllerPredicate(TargetController.YOU));
filter.add(new AttackingPredicate());
}
public AkroanHoplite(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{R}{W}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{R}{W}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.SOLDIER);
@ -64,7 +65,7 @@ public class AkroanHoplite extends CardImpl {
this.toughness = new MageInt(2);
// Whenever Akroan Hoplite attacks, it gets +X/+0 until end of turn, where X is the number of attacking creatures you control.
this.addAbility(new AttacksTriggeredAbility(new BoostSourceEffect(new PermanentsOnBattlefieldCount(filter), new StaticValue(0), Duration.EndOfTurn), false));
this.addAbility(new AttacksTriggeredAbility(new BoostSourceEffect(new PermanentsOnBattlefieldCount(filter), new StaticValue(0), Duration.EndOfTurn, true), false));
}
public AkroanHoplite(final AkroanHoplite card) {

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.abilities.Ability;
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ColorlessManaCost;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.target.TargetPermanent;
/**
*
* @author TheElk801
*/
public class AmuletOfUnmaking extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("artifact, creature, or enchantment");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.ARTIFACT),
new CardTypePredicate(CardType.CREATURE),
new CardTypePredicate(CardType.ENCHANTMENT)));
}
public AmuletOfUnmaking(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{5}");
// {5}, {tap}, Exile Amulet of Unmaking: Exile target artifact, creature, or land. Activate this ability only any time you could cast a sorcery.
Ability ability = new ActivateAsSorceryActivatedAbility(Zone.BATTLEFIELD, new ExileTargetEffect("Exile target artifact, creature or land"), new ColorlessManaCost(5));
ability.addCost(new TapSourceCost());
ability.addTarget(new TargetPermanent(filter));
this.addAbility(ability);
}
public AmuletOfUnmaking(final AmuletOfUnmaking card) {
super(card);
}
@Override
public AmuletOfUnmaking copy() {
return new AmuletOfUnmaking(this);
}
}

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.a;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.TurnedFaceUpSourceTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.abilities.keyword.MorphAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author TheElk801
*/
public class AphettoExterminator extends CardImpl {
public AphettoExterminator(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}");
this.subtype.add("Human");
this.subtype.add("Wizard");
this.power = new MageInt(3);
this.toughness = new MageInt(1);
// Morph {3}{B}
this.addAbility(new MorphAbility(this, new ManaCostsImpl("{3}{B}")));
// When Aphetto Exterminator is turned face up, target creature gets -3/-3 until end of turn.
Ability ability = new TurnedFaceUpSourceTriggeredAbility(new BoostTargetEffect(-3,-3,Duration.EndOfTurn));
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}
public AphettoExterminator(final AphettoExterminator card) {
super(card);
}
@Override
public AphettoExterminator copy() {
return new AphettoExterminator(this);
}
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.a;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.decorator.ConditionalOneShotEffect;
@ -44,6 +43,8 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetLandPermanent;
import java.util.UUID;
/**
*
* @author ilcartographer
@ -65,7 +66,7 @@ public class AquitectsWill extends CardImpl {
this.getSpellAbility().addTarget(new TargetLandPermanent());
// That land is an Island in addition to its other types for as long as it has a flood counter on it.
this.getSpellAbility().addEffect(new AquitectsWillEffect(Duration.Custom, false, false, "Island"));
this.getSpellAbility().addEffect(new AquitectsWillEffect(Duration.Custom, false, false, SubType.ISLAND));
// If you control a Merfolk, draw a card.
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
@ -86,7 +87,7 @@ public class AquitectsWill extends CardImpl {
class AquitectsWillEffect extends BecomesBasicLandTargetEffect {
public AquitectsWillEffect(Duration duration, boolean chooseLandType, boolean loseType, String... landNames) {
public AquitectsWillEffect(Duration duration, boolean chooseLandType, boolean loseType, SubType... landNames) {
super(duration, chooseLandType, loseType, landNames);
staticText = "That land is an Island in addition to its other types for as long as it has a flood counter on it";
}

View file

@ -0,0 +1,114 @@
/*
* 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.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FearAbility;
import mage.abilities.keyword.ModularAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author TheElk801
*/
public class ArcboundFiend extends CardImpl {
public ArcboundFiend(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{6}");
this.subtype.add("Horror");
this.power = new MageInt(0);
this.toughness = new MageInt(0);
// Fear
this.addAbility(FearAbility.getInstance());
// At the beginning of your upkeep, you may move a +1/+1 counter from target creature onto Arcbound Fiend.
Ability ability = new BeginningOfUpkeepTriggeredAbility(new MoveCounterFromTargetToSourceEffect(), TargetController.YOU, true);
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
// Modular 3
this.addAbility(new ModularAbility(this, 3));
}
public ArcboundFiend(final ArcboundFiend card) {
super(card);
}
@Override
public ArcboundFiend copy() {
return new ArcboundFiend(this);
}
}
class MoveCounterFromTargetToSourceEffect extends OneShotEffect {
public MoveCounterFromTargetToSourceEffect() {
super(Outcome.Detriment);
this.staticText = "move a +1/+1 counter from target creature onto {this}";
}
public MoveCounterFromTargetToSourceEffect(final MoveCounterFromTargetToSourceEffect effect) {
super(effect);
}
@Override
public MoveCounterFromTargetToSourceEffect copy() {
return new MoveCounterFromTargetToSourceEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent sourceObject = game.getPermanent(source.getSourceId());
if (sourceObject != null && controller != null) {
Permanent fromPermanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (fromPermanent != null && fromPermanent.getCounters(game).getCount(CounterType.P1P1) > 0) {
fromPermanent.removeCounters(CounterType.P1P1.createInstance(), game);
sourceObject.addCounters(CounterType.P1P1.createInstance(), source, game);
game.informPlayers("Moved a +1/+1 counter from " + fromPermanent.getLogName() + " to " + sourceObject.getLogName());
}
return true;
}
return false;
}
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.a;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.AsEntersBattlefieldAbility;
import mage.abilities.common.SimpleStaticAbility;
@ -41,6 +40,8 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.UUID;
/**
*
* @author emerald000
@ -83,7 +84,7 @@ class AshesOfTheFallenEffect extends ContinuousEffectImpl {
Player controller = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(source.getSourceId());
if (controller != null && permanent != null) {
String subtype = (String) game.getState().getValue(permanent.getId() + "_type");
SubType subtype = (SubType) game.getState().getValue(permanent.getId() + "_type");
for (UUID cardId : controller.getGraveyard()) {
Card card = game.getCard(cardId);
if (card != null && card.isCreature() && !card.getSubtype(game).contains(subtype)) {

View file

@ -49,7 +49,7 @@ import mage.target.common.TargetCreaturePermanent;
public class AuriokBladewarden extends CardImpl {
public AuriokBladewarden(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{W}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.SOLDIER);
@ -57,7 +57,7 @@ public class AuriokBladewarden extends CardImpl {
this.toughness = new MageInt(1);
// {tap}: Target creature gets +X/+X until end of turn, where X is Auriok Bladewarden's power.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(new SourcePermanentPowerCount(), new SourcePermanentPowerCount(), Duration.EndOfTurn), new TapSourceCost());
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(new SourcePermanentPowerCount(), new SourcePermanentPowerCount(), Duration.EndOfTurn, true), new TapSourceCost());
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.a;
import java.util.UUID;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost;
@ -46,6 +45,8 @@ import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.SpiritWhiteToken;
import java.util.UUID;
/**
*
* @author North
@ -99,7 +100,7 @@ class AvacynsCollarTriggeredAbility extends TriggeredAbilityImpl {
public boolean checkTrigger(GameEvent event, Game game) {
if (((ZoneChangeEvent) event).isDiesEvent()) {
Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
if (permanent.getAttachments().contains(this.getSourceId()) && permanent.hasSubtype("Human", game)) {
if (permanent.getAttachments().contains(this.getSourceId()) && permanent.hasSubtype(SubType.HUMAN, game)) {
return true;
}
}

View file

@ -0,0 +1,91 @@
/*
* 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.common.TapSourceCost;
import mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SupertypePredicate;
import mage.game.permanent.token.Token;
import mage.target.TargetPermanent;
/**
*
* @author TheElk801
*/
public class BalduvianConjurer extends CardImpl {
private static final FilterLandPermanent filter = new FilterLandPermanent("snow land");
static {
filter.add(new SupertypePredicate(SuperType.SNOW));
}
public BalduvianConjurer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}");
this.subtype.add("Human");
this.subtype.add("Wizard");
this.power = new MageInt(0);
this.toughness = new MageInt(2);
// {tap}: Target snow land becomes a 2/2 creature until end of turn. It's still a land.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureTargetEffect(new AnimatedLand(), false, true, Duration.EndOfTurn), new TapSourceCost());
ability.addTarget(new TargetPermanent(filter));
this.addAbility(ability);
}
public BalduvianConjurer(final BalduvianConjurer card) {
super(card);
}
@Override
public BalduvianConjurer copy() {
return new BalduvianConjurer(this);
}
}
class AnimatedLand extends Token {
public AnimatedLand() {
super("", "2/2 creature");
this.cardType.add(CardType.CREATURE);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
}
}

View file

@ -0,0 +1,99 @@
/*
* 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.condition.Condition;
import mage.abilities.condition.common.MostCommonColorCondition;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author TheElk801
*/
public class BarrinsUnmaking extends CardImpl {
public BarrinsUnmaking(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}");
// Return target permanent to its owner's hand if that permanent shares a color with the most common color among all permanents or a color tied for most common.
this.getSpellAbility().addEffect(new BarrinsUnmakingEffect());
this.getSpellAbility().addTarget(new TargetPermanent());
}
public BarrinsUnmaking(final BarrinsUnmaking card) {
super(card);
}
@Override
public BarrinsUnmaking copy() {
return new BarrinsUnmaking(this);
}
}
class BarrinsUnmakingEffect extends OneShotEffect {
public BarrinsUnmakingEffect() {
super(Outcome.Detriment);
this.staticText = "Return target permanent to its owner's hand if that permanent shares a color with the most common color among all permanents or a color tied for most common.";
}
public BarrinsUnmakingEffect(final BarrinsUnmakingEffect effect) {
super(effect);
}
@Override
public BarrinsUnmakingEffect copy() {
return new BarrinsUnmakingEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
Condition condition = new MostCommonColorCondition(permanent.getColor(game));
if (condition.apply(game, source)) {
Effect effect = new ReturnToHandTargetEffect();
effect.setTargetPointer(new FixedTarget(permanent.getId()));
return effect.apply(game, source);
}
}
return false;
}
}

View file

@ -69,7 +69,7 @@ public class Berserk extends CardImpl {
Effect effect = new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn);
effect.setText("Target creature gains trample");
this.getSpellAbility().addEffect(effect);
effect = new BoostTargetEffect(new TargetPermanentPowerCount(), new StaticValue(0), Duration.EndOfTurn);
effect = new BoostTargetEffect(new TargetPermanentPowerCount(), new StaticValue(0), Duration.EndOfTurn, true);
effect.setText("and gets +X/+0 until end of turn, where X is its power");
this.getSpellAbility().addEffect(effect);
this.getSpellAbility().addEffect(new BerserkDestroyEffect());

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.Mana;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.RemoveVariableCountersSourceCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.dynamicvalue.IntPlusDynamicValue;
import mage.abilities.dynamicvalue.common.CountersSourceCount;
import mage.abilities.dynamicvalue.common.RemovedCountersForCostValue;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.mana.DynamicManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.counters.CounterType;
/**
*
* @author TheElk801
*/
public class BlackManaBattery extends CardImpl {
public BlackManaBattery(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}");
// {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.addCost(new TapSourceCost());
this.addAbility(ability);
// {tap}, Remove any number of charge counters from Black Mana Battery: Add {B} to your mana pool, then add an additional {B} to your mana pool for each charge counter removed this way.
ability = new DynamicManaAbility(
Mana.BlackMana(1),
new IntPlusDynamicValue(1, new RemovedCountersForCostValue()),
new TapSourceCost(),
"Add {B} to your mana pool, then add {B} to your mana pool for each storage counter removed this way",
true, new CountersSourceCount(CounterType.STORAGE));
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance(),
"Remove X storage counters from {this}"));
this.addAbility(ability);
}
public BlackManaBattery(final BlackManaBattery card) {
super(card);
}
@Override
public BlackManaBattery copy() {
return new BlackManaBattery(this);
}
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.b;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.continuous.AddCardSubtypeAllEffect;
@ -35,13 +34,12 @@ import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
import mage.abilities.mana.BlackManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.DependencyType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.constants.*;
import mage.filter.StaticFilters;
import mage.filter.common.FilterLandPermanent;
import java.util.UUID;
/**
*
* @author Galatolol
@ -55,7 +53,7 @@ public class BlanketOfNight extends CardImpl {
// Each land is a Swamp in addition to its other land types.
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(new BlackManaAbility(), Duration.WhileOnBattlefield, new FilterLandPermanent(),
"Each land is a Swamp in addition to its other land types"));
ability.addEffect(new AddCardSubtypeAllEffect(StaticFilters.FILTER_LAND, "Swamp", DependencyType.BecomeSwamp));
ability.addEffect(new AddCardSubtypeAllEffect(StaticFilters.FILTER_LAND, SubType.SWAMP, DependencyType.BecomeSwamp));
this.addAbility(ability);
}

View file

@ -27,8 +27,6 @@
*/
package mage.cards.b;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
@ -48,6 +46,9 @@ import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreatureOrPlayer;
import java.util.List;
import java.util.UUID;
/**
*
* @author North
@ -104,7 +105,7 @@ class BlazingTorchEvasionEffect extends RestrictionEffect {
@Override
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) {
return !blocker.hasSubtype("Vampire", game) && !blocker.hasSubtype("Zombie", game);
return !blocker.hasSubtype(SubType.VAMPIRE, game) && !blocker.hasSubtype(SubType.ZOMBIE, game);
}
@Override

View file

@ -29,9 +29,12 @@ package mage.cards.b;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.keyword.IntimidateAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -42,12 +45,13 @@ import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game;
import mage.game.events.DamagedPlayerEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.game.stack.Spell;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
/**
*
@ -56,7 +60,7 @@ import mage.target.common.TargetCreaturePermanent;
public class BlindZealot extends CardImpl {
public BlindZealot(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{B}{B}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}{B}");
this.subtype.add(SubType.HUMAN, SubType.CLERIC);
this.power = new MageInt(2);
@ -64,7 +68,9 @@ public class BlindZealot extends CardImpl {
this.addAbility(IntimidateAbility.getInstance());
// Whenever Blind Zealot deals combat damage to a player, you may sacrifice it. If you do, destroy target creature that player controls.
this.addAbility(new BlindZealotTriggeredAbility());
Ability ability = new BlindZealotTriggeredAbility();
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}
public BlindZealot(final BlindZealot card) {
@ -80,7 +86,7 @@ public class BlindZealot extends CardImpl {
class BlindZealotTriggeredAbility extends TriggeredAbilityImpl {
public BlindZealotTriggeredAbility() {
super(Zone.BATTLEFIELD, new BlindZealotEffect(), false);
super(Zone.BATTLEFIELD, new BlindZealotEffect(), true);
}
public BlindZealotTriggeredAbility(final BlindZealotTriggeredAbility ability) {
@ -99,34 +105,20 @@ class BlindZealotTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getSourceId().equals(this.sourceId)
&& ((DamagedPlayerEvent) event).isCombatDamage()) {
Player player = game.getPlayer(this.getControllerId());
Permanent sourcePermanent = game.getPermanent(this.getSourceId());
if (player != null && sourcePermanent != null) {
StringBuilder sb = new StringBuilder();
sb.append("Do you wish to sacrifice ").append(sourcePermanent.getIdName());
sb.append(" to destroy target creature controlled by ");
sb.append(game.getPlayer(event.getTargetId()).getLogName()).append('?');
if (player.chooseUse(Outcome.DestroyPermanent, sb.toString(), this, game)) {
FilterCreaturePermanent filter = new FilterCreaturePermanent();
filter.add(new ControllerIdPredicate(event.getTargetId()));
filter.setMessage("creature controlled by " + game.getPlayer(event.getTargetId()).getLogName());
this.getTargets().clear();
this.addTarget(new TargetCreaturePermanent(filter));
return true;
}
}
Player opponent = game.getPlayer(event.getPlayerId());
if (opponent != null && event.getSourceId().equals(this.sourceId)) {
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature " + opponent.getLogName() + " controls");
filter.add(new ControllerIdPredicate(opponent.getId()));
this.getTargets().clear();
this.addTarget(new TargetCreaturePermanent(filter));
return true;
}
return false;
}
@Override
public String getRule() {
return "Whenever Blind Zealot deals combat damage to a player, you may sacrifice it. If you do, destroy target creature that player controls.";
return "Whenever {this} deals combat damage to a player, you may sacrifice it. If you do, destroy target creature that player controls";
}
}
@ -134,6 +126,7 @@ class BlindZealotEffect extends OneShotEffect {
public BlindZealotEffect() {
super(Outcome.DestroyPermanent);
staticText = "sacrifice {this}";
}
public BlindZealotEffect(final BlindZealotEffect effect) {
@ -147,15 +140,26 @@ class BlindZealotEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
Permanent targetPermanent = game.getPermanent(source.getFirstTarget());
if (sourcePermanent != null && targetPermanent != null) {
if (sourcePermanent.sacrifice(source.getSourceId(), game)) {
targetPermanent.destroy(source.getSourceId(), game, false);
MageObject sourceObject = source.getSourceObjectIfItStillExists(game);
if (sourceObject == null) {
if (source.getSourceObject(game) instanceof Spell) {
sourceObject = game.getPermanent(source.getSourceId());
if (sourceObject != null && sourceObject.getZoneChangeCounter(game) > source.getSourceObjectZoneChangeCounter() + 1) {
return false;
}
}
}
if (sourceObject instanceof Permanent) {
Permanent permanent = (Permanent) sourceObject;
if (source.getControllerId().equals(permanent.getControllerId())) {
Effect effect = new DestroyTargetEffect();
effect.setTargetPointer(new FixedTarget(targetPermanent.getId()));
effect.apply(game, source);
return permanent.sacrifice(source.getSourceId(), game);
}
return true;
}
return false;
}
}

View file

@ -0,0 +1,136 @@
/*
* 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.TriggeredAbilityImpl;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.RemoveAllCountersSourceEffect;
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.counters.CounterType;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
/**
*
* @author TheElk801
*/
public class BloodHound extends CardImpl {
public BloodHound(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}");
this.subtype.add("Hound");
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// Whenever you're dealt damage, you may put that many +1/+1 counters on Blood Hound.
this.addAbility(new BloodHoundTriggeredAbility());
// At the beginning of your end step, remove all +1/+1 counters from Blood Hound.
this.addAbility(new BeginningOfEndStepTriggeredAbility(new RemoveAllCountersSourceEffect(CounterType.P1P1), TargetController.YOU, false));
}
public BloodHound(final BloodHound card) {
super(card);
}
@Override
public BloodHound copy() {
return new BloodHound(this);
}
}
class BloodHoundTriggeredAbility extends TriggeredAbilityImpl {
public BloodHoundTriggeredAbility() {
super(Zone.BATTLEFIELD, new BloodHoundEffect(), true);
}
public BloodHoundTriggeredAbility(final BloodHoundTriggeredAbility ability) {
super(ability);
}
@Override
public BloodHoundTriggeredAbility copy() {
return new BloodHoundTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getTargetId().equals(this.getControllerId())) {
this.getEffects().get(0).setValue("damageAmount", event.getAmount());
return true;
}
return false;
}
@Override
public String getRule() {
return "Whenever you are dealt damage, you may put that many +1/+1 counters on {this}.";
}
}
class BloodHoundEffect extends OneShotEffect {
public BloodHoundEffect() {
super(Outcome.Benefit);
}
public BloodHoundEffect(final BloodHoundEffect effect) {
super(effect);
}
@Override
public BloodHoundEffect copy() {
return new BloodHoundEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
permanent.addCounters(CounterType.P1P1.createInstance((Integer) this.getValue("damageAmount")), source, game);
}
return true;
}
}

View file

@ -27,8 +27,6 @@
*/
package mage.cards.b;
import java.util.UUID;
import java.util.stream.Collectors;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
@ -37,7 +35,7 @@ import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.OneShotEffect;
import mage.cards.*;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
import mage.choices.ChoiceCreatureType;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
@ -47,6 +45,8 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.players.Player;
import java.util.UUID;
/**
*
* @author fireshoes
@ -98,9 +98,7 @@ class BloodlineShamanEffect extends OneShotEffect {
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null) {
// Choose a creature type.
Choice typeChoice = new ChoiceImpl(true);
typeChoice.setMessage("Choose a creature type:");
typeChoice.setChoices(SubType.getCreatureTypes(false).stream().map(SubType::toString).collect(Collectors.toSet()));
Choice typeChoice = new ChoiceCreatureType();
while (!controller.choose(outcome, typeChoice, game)) {
if (!controller.canRespond()) {
return false;

View file

@ -0,0 +1,82 @@
/*
* 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.Mana;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.RemoveVariableCountersSourceCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.dynamicvalue.IntPlusDynamicValue;
import mage.abilities.dynamicvalue.common.CountersSourceCount;
import mage.abilities.dynamicvalue.common.RemovedCountersForCostValue;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.mana.DynamicManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.counters.CounterType;
/**
*
* @author TheElk801
*/
public class BlueManaBattery extends CardImpl {
public BlueManaBattery(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}");
// {2}, {tap}: Put a charge counter on Blue Mana Battery.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.STORAGE.createInstance(1)), new GenericManaCost(2));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
// {tap}, Remove any number of charge counters from Blue Mana Battery: Add {U} to your mana pool, then add an additional {U} to your mana pool for each charge counter removed this way.
ability = new DynamicManaAbility(
Mana.BlueMana(1),
new IntPlusDynamicValue(1, new RemovedCountersForCostValue()),
new TapSourceCost(),
"Add {U} to your mana pool, then add {U} to your mana pool for each storage counter removed this way",
true, new CountersSourceCount(CounterType.STORAGE));
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance(),
"Remove X storage counters from {this}"));
this.addAbility(ability);
}
public BlueManaBattery(final BlueManaBattery card) {
super(card);
}
@Override
public BlueManaBattery copy() {
return new BlueManaBattery(this);
}
}

View file

@ -0,0 +1,66 @@
/*
* 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.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
/**
*
* @author TheElk801
*/
public class BoaConstrictor extends CardImpl {
public BoaConstrictor(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}");
this.subtype.add("Snake");
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// {tap}: Boa Constrictor gets +3/+3 until end of turn.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(3, 3, Duration.EndOfTurn), new TapSourceCost()));
}
public BoaConstrictor(final BoaConstrictor card) {
super(card);
}
@Override
public BoaConstrictor copy() {
return new BoaConstrictor(this);
}
}

View file

@ -0,0 +1,76 @@
/*
* 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.common.DiscardCardCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.combat.CantBlockTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author TheElk801
*/
public class BolaWarrior extends CardImpl {
public BolaWarrior(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}");
this.subtype.add("Human");
this.subtype.add("Spellshaper");
this.subtype.add("Warrior");
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// {R}, {tap}, Discard a card: Target creature can't block this turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CantBlockTargetEffect(Duration.EndOfTurn), new ManaCostsImpl("{R}"));
ability.addCost(new TapSourceCost());
ability.addCost(new DiscardCardCost());
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}
public BolaWarrior(final BolaWarrior card) {
super(card);
}
@Override
public BolaWarrior copy() {
return new BolaWarrior(this);
}
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.b;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
@ -46,6 +45,8 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author fireshoes
@ -110,8 +111,8 @@ class BoldwyrIntimidatorEffect extends RestrictionEffect {
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
if (attacker != null && blocker != null) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (sourcePermanent != null && attacker.hasSubtype("Warrior", game)) {
return !blocker.hasSubtype("Coward", game);
if (sourcePermanent != null && attacker.hasSubtype(SubType.WARRIOR, game)) {
return !blocker.hasSubtype(SubType.COWARD, game);
}
}
return true;

View file

@ -27,7 +27,11 @@
*/
package mage.cards.b;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
@ -35,6 +39,7 @@ import mage.cards.*;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.StaticFilters;
import mage.game.Game;
@ -43,10 +48,6 @@ import mage.target.Target;
import mage.target.common.TargetCardInLibrary;
import mage.target.common.TargetDiscard;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
/**
*
* @author fireshoes
@ -79,8 +80,8 @@ class BorderlandExplorerEffect extends OneShotEffect {
public BorderlandExplorerEffect() {
super(Outcome.Neutral);
this.staticText = "each player may discard a card. Each player who discarded a card this way may search his or her library " +
"for a basic land card, reveal it, put it into his or her hand, then shuffle his or her library";
this.staticText = "each player may discard a card. Each player who discarded a card this way may search his or her library "
+ "for a basic land card, reveal it, put it into his or her hand, then shuffle his or her library";
}
public BorderlandExplorerEffect(final BorderlandExplorerEffect effect) {
@ -95,11 +96,13 @@ class BorderlandExplorerEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
// Store for each player the cards to discard, that's important because all discard shall happen at the same time
Map<UUID, Cards> cardsToDiscard = new HashMap<>();
// Store for each player the lands to reveal, that's important because all reveals shall happen at the same time
Map<UUID, Cards> cardsToReveal = new HashMap<>();
if (controller != null) {
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null) {
// Store for each player the cards to discard, that's important because all discard shall happen at the same time
Map<UUID, Cards> cardsToDiscard = new HashMap<>();
// Store for each player the lands to reveal, that's important because all reveals shall happen at the same time
Map<UUID, Cards> cardsToReveal = new HashMap<>();
// choose cards to discard
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
@ -131,7 +134,7 @@ class BorderlandExplorerEffect extends OneShotEffect {
Player player = game.getPlayer(playerId);
if (player != null) {
Cards cardsPlayer = cardsToDiscard.get(playerId);
if (cardsPlayer != null) {
if (cardsPlayer != null && !cardsPlayer.isEmpty()) {
TargetCardInLibrary target = new TargetCardInLibrary(0, 1, StaticFilters.FILTER_BASIC_LAND_CARD);
if (player.searchLibrary(target, game)) {
if (!target.getTargets().isEmpty()) {
@ -152,8 +155,8 @@ class BorderlandExplorerEffect extends OneShotEffect {
for (UUID cardId : cardsPlayer) {
Cards cards = new CardsImpl(game.getCard(cardId));
Card card = game.getCard(cardId);
player.revealCards(card.getIdName() + " (" + player.getName() + ')', cards, game);
player.moveCardToHandWithInfo(card, source.getSourceId(), game);
player.revealCards(sourceObject.getIdName() + " (" + player.getName() + ')', cards, game);
player.moveCards(card, Zone.HAND, source, game);
player.shuffleLibrary(source, game);
}
}

View file

@ -0,0 +1,85 @@
/*
* 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.common.SacrificeSourceCost;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author TheElk801
*/
public class BrassTalonChimera extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Beast creature you control");
static {
filter.add(new SubtypePredicate(SubType.CHIMERA));
}
public BrassTalonChimera(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{4}");
this.subtype.add("Chimera");
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// First strike
this.addAbility(FirstStrikeAbility.getInstance());
// Sacrifice Brass-Talon Chimera: Put a +2/+2 counter on target Chimera creature. It gains first strike.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersTargetEffect(CounterType.P2P2.createInstance()), new SacrificeSourceCost());
ability.addEffect(new GainAbilityTargetEffect(FirstStrikeAbility.getInstance(), Duration.WhileOnBattlefield));
ability.addTarget(new TargetCreaturePermanent(filter));
}
public BrassTalonChimera(final BrassTalonChimera card) {
super(card);
}
@Override
public BrassTalonChimera copy() {
return new BrassTalonChimera(this);
}
}

View file

@ -0,0 +1,66 @@
/*
* 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.common.AttackedByCreatureTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SetTargetPointer;
import mage.constants.Zone;
/**
*
* @author TheElk801
*/
public class BriarPatch extends CardImpl {
public BriarPatch(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}{G}");
// Whenever a creature attacks you, it gets -1/-0 until end of turn.
Effect effect = new BoostTargetEffect(-1, 0, Duration.EndOfTurn);
effect.setText("it gets -1/-0");
Ability ability = new AttackedByCreatureTriggeredAbility(Zone.BATTLEFIELD, effect, false, SetTargetPointer.PERMANENT);
this.getAbilities().add(ability);
}
public BriarPatch(final BriarPatch card) {
super(card);
}
@Override
public BriarPatch copy() {
return new BriarPatch(this);
}
}

View file

@ -0,0 +1,93 @@
/*
* 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.common.SacrificeTargetCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CounterTargetEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.target.TargetSpell;
import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author TheElk801
*/
public class BrineShaman extends CardImpl {
private static final FilterSpell filter = new FilterSpell("noncreature spell");
static {
filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE)));
}
public BrineShaman(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}");
this.subtype.add("Human");
this.subtype.add("Cleric");
this.subtype.add("Shaman");
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// {tap}, Sacrifice a creature: Target creature gets +2/+2 until end of turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(2, 2, Duration.EndOfTurn), new SacrificeTargetCost(new TargetControlledCreaturePermanent()));
ability.addCost(new TapSourceCost());
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
// {1}{U}{U}, Sacrifice a creature: Counter target creature spell.
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CounterTargetEffect(), new SacrificeTargetCost(new TargetControlledCreaturePermanent()));
ability.addCost(new ManaCostsImpl("{1}{U}{U}"));
ability.addTarget(new TargetSpell(filter));
this.addAbility(ability);
}
public BrineShaman(final BrineShaman card) {
super(card);
}
@Override
public BrineShaman copy() {
return new BrineShaman(this);
}
}

View file

@ -0,0 +1,101 @@
/*
* 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.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CounterTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AbilityType;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.filter.FilterStackObject;
import mage.filter.predicate.Predicate;
import mage.game.Game;
import mage.game.stack.StackAbility;
import mage.target.common.TargetActivatedOrTriggeredAbility;
/**
*
* @author TheElk801
*/
public class BrownOuphe extends CardImpl {
private final static FilterStackObject filter = new FilterStackObject("ability from an artifact source");
static {
filter.add(new ArtifactSourcePredicate());
}
public BrownOuphe(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G}");
this.subtype.add("Ouphe");
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// {1}{G}, {tap}: Counter target activated ability from an artifact source.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CounterTargetEffect(), new ManaCostsImpl<>("{1}{G}"));
ability.addCost(new TapSourceCost());
ability.addTarget(new TargetActivatedOrTriggeredAbility(filter));
this.addAbility(ability);
}
public BrownOuphe(final BrownOuphe card) {
super(card);
}
@Override
public BrownOuphe copy() {
return new BrownOuphe(this);
}
}
class ArtifactSourcePredicate implements Predicate<Ability> {
public ArtifactSourcePredicate() {
}
@Override
public boolean apply(Ability input, Game game) {
if (input instanceof StackAbility) {
return input.getSourceObject(game).isArtifact() && input.getAbilityType() == AbilityType.ACTIVATED;
}
return false;
}
@Override
public String toString() {
return "Source(Artifact)";
}
}

View file

@ -27,17 +27,13 @@
*/
package mage.cards.c;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.NameACardEffect;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.*;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.TimingRule;
@ -47,6 +43,8 @@ import mage.players.Player;
import mage.target.TargetPlayer;
import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
/**
*
* @author jonubuu
@ -98,6 +96,15 @@ class CabalTherapyEffect extends OneShotEffect {
Cards hand = targetPlayer.getHand();
for (Card card : hand.getCards(game)) {
if(card.isSplitCard()){
SplitCard splitCard = (SplitCard) card;
if(splitCard.getLeftHalfCard().getName().equals(cardName)){
targetPlayer.discard(card, source, game);
}
else if(splitCard.getRightHalfCard().getName().equals(cardName)){
targetPlayer.discard(card, source, game);
}
}
if (card.getName().equals(cardName)) {
targetPlayer.discard(card, source, game);
}

View file

@ -0,0 +1,171 @@
/*
* 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.c;
import java.util.UUID;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.StateTriggeredAbility;
import mage.abilities.common.AsEntersBattlefieldAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.MostCommonColorCondition;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.ChooseColorEffect;
import mage.abilities.effects.common.ChooseOpponentEffect;
import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.abilities.effects.common.continuous.BoostAllEffect;
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.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
* @author TheElk801
*/
public class CallToArms extends CardImpl {
public CallToArms(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
// As Call to Arms enters the battlefield, choose a color and an opponent.
Effect effect = new ChooseColorEffect(Outcome.Detriment);
// effect.setText("choose a color and an opponent");
Ability ability = new AsEntersBattlefieldAbility(effect);
effect = new ChooseOpponentEffect(Outcome.Benefit);
effect.setText("then choose an opponent");
ability.addEffect(effect);
this.addAbility(ability);
// White creatures get +1/+1 as long as the chosen color is the most common color among nontoken permanents the chosen player controls but isn't tied for most common.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CallToArmsEffect()));
// When the chosen color isn't the most common color among nontoken permanents the chosen player controls or is tied for most common, sacrifice Call to Arms.
this.addAbility(new SacAbility());
}
public CallToArms(final CallToArms card) {
super(card);
}
@Override
public CallToArms copy() {
return new CallToArms(this);
}
}
class CallToArmsEffect extends ContinuousEffectImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("White creatures");
static {
filter.add(new ColorPredicate(ObjectColor.WHITE));
}
public CallToArmsEffect() {
super(Duration.WhileOnBattlefield, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, Outcome.Benefit);
staticText = "The chosen player's maximum hand size is four";
}
public CallToArmsEffect(final CallToArmsEffect effect) {
super(effect);
}
@Override
public CallToArmsEffect copy() {
return new CallToArmsEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
UUID playerId = (UUID) game.getState().getValue(source.getSourceId() + ChooseOpponentEffect.VALUE_KEY);
if (permanent != null) {
Player opponent = game.getPlayer(playerId);
if (opponent != null) {
ObjectColor color = (ObjectColor) game.getState().getValue(permanent.getId() + "_color");
Condition condition = new MostCommonColorCondition(color, true, new ControllerIdPredicate(playerId));
if (condition.apply(game, source)) {
Effect effect = new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, filter, false);
return effect.apply(game, source);
}
}
}
return false;
}
}
class SacAbility extends StateTriggeredAbility {
public SacAbility() {
super(Zone.BATTLEFIELD, new SacrificeSourceEffect());
}
public SacAbility(final SacAbility ability) {
super(ability);
}
@Override
public SacAbility copy() {
return new SacAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent permanent = game.getPermanent(getSourceId());
UUID playerId = (UUID) game.getState().getValue(getSourceId() + ChooseOpponentEffect.VALUE_KEY);
if (permanent != null) {
Player opponent = game.getPlayer(playerId);
if (opponent != null) {
ObjectColor color = (ObjectColor) game.getState().getValue(permanent.getId() + "_color");
Condition condition = new MostCommonColorCondition(color, true, new ControllerIdPredicate(playerId));
return !condition.apply(game, this);
}
}
return false;
}
@Override
public String getRule() {
return "When the chosen color isn't the most common color among nontoken permanents the chosen player controls or is tied for most common, sacrifice {this}";
}
}

View file

@ -27,8 +27,6 @@
*/
package mage.cards.c;
import java.util.UUID;
import java.util.stream.Collectors;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
@ -41,17 +39,15 @@ import mage.abilities.effects.common.continuous.SetToughnessSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.choices.ChoiceCreatureType;
import mage.constants.*;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.ChosenSubtypePredicate;
import mage.game.Game;
import mage.players.Player;
import java.util.UUID;
/**
*
* @author jeffwadsworth
@ -133,9 +129,7 @@ class ChooseCreatureTypeEffect extends OneShotEffect { // code by LevelX2, but t
Player controller = game.getPlayer(source.getControllerId());
MageObject mageObject = game.getObject(source.getSourceId());
if (controller != null && mageObject != null) {
Choice typeChoice = new ChoiceImpl(true);
typeChoice.setMessage("Choose creature type");
typeChoice.setChoices(SubType.getCreatureTypes(false).stream().map(SubType::toString).collect(Collectors.toSet()));
Choice typeChoice = new ChoiceCreatureType();
while (!controller.choose(outcome, typeChoice, game)) {
if (!controller.canRespond()) {
return false;
@ -144,7 +138,7 @@ class ChooseCreatureTypeEffect extends OneShotEffect { // code by LevelX2, but t
if (!game.isSimulation()) {
game.informPlayers(mageObject.getName() + ": " + controller.getLogName() + " has chosen " + typeChoice.getChoice());
}
game.getState().setValue(mageObject.getId() + "_type", typeChoice.getChoice());
game.getState().setValue(mageObject.getId() + "_type", SubType.byDescription(typeChoice.getChoice()));
return true;
}
return false;

View file

@ -0,0 +1,113 @@
/*
* 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.c;
import java.util.UUID;
import mage.target.common.TargetEquipmentPermanent;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continuous.ControlEnchantedEffect;
import mage.constants.Outcome;
import mage.target.TargetPermanent;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author TheElk801
*/
public class CarryAway extends CardImpl {
public CarryAway(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{U}{U}");
this.subtype.add("Aura");
// Enchant Equipment
TargetPermanent auraTarget = new TargetEquipmentPermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Benefit));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// When Carry Away enters the battlefield, unattach enchanted Equipment.
ability = new EntersBattlefieldTriggeredAbility(new CarryAwayEffect());
this.addAbility(ability);
// You control enchanted Equipment.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ControlEnchantedEffect("equipment")));
}
public CarryAway(final CarryAway card) {
super(card);
}
@Override
public CarryAway copy() {
return new CarryAway(this);
}
}
class CarryAwayEffect extends OneShotEffect {
public CarryAwayEffect() {
super(Outcome.Detriment);
this.staticText = "unattach enchanted equipment.";
}
public CarryAwayEffect(final CarryAwayEffect effect) {
super(effect);
}
@Override
public CarryAwayEffect copy() {
return new CarryAwayEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
Permanent enchantedEquipment = game.getPermanent(permanent.getAttachedTo());
if (enchantedEquipment != null) {
Permanent equippedCreature = game.getPermanent(enchantedEquipment.getAttachedTo());
if (equippedCreature != null) {
return equippedCreature.removeAttachment(enchantedEquipment.getId(), game);
}
}
}
return false;
}
}

View file

@ -27,9 +27,6 @@
*/
package mage.cards.c;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.ConditionalMana;
import mage.MageObject;
import mage.Mana;
@ -53,6 +50,10 @@ import mage.game.stack.Spell;
import mage.players.Player;
import mage.watchers.Watcher;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/**
*
* @author noxx
@ -90,9 +91,9 @@ class CavernOfSoulsManaBuilder extends ConditionalManaBuilder {
@Override
public ConditionalManaBuilder setMana(Mana mana, Ability source, Game game) {
Object value = game.getState().getValue(source.getSourceId() + "_type");
if (value != null && value instanceof String) {
creatureType = SubType.byDescription((String) value);
SubType value = (SubType) game.getState().getValue(source.getSourceId() + "_type");
if (value != null ) {
creatureType = value;
}
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());

View file

@ -0,0 +1,123 @@
/*
* 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.c;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.RestrictionEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SuperType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.constants.Zone;
/**
*
* @author TheElk801
*/
public class CavernsOfDespair extends CardImpl {
public CavernsOfDespair(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}{R}");
this.addSuperType(SuperType.WORLD);
// No more than two creatures can attack each combat.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CavernsOfDespairAttackRestrictionEffect()));
// No more than two creatures can block each combat.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CavernsOfDespairBlockRestrictionEffect()));
}
public CavernsOfDespair(final CavernsOfDespair card) {
super(card);
}
@Override
public CavernsOfDespair copy() {
return new CavernsOfDespair(this);
}
}
class CavernsOfDespairAttackRestrictionEffect extends RestrictionEffect {
public CavernsOfDespairAttackRestrictionEffect() {
super(Duration.WhileOnBattlefield);
staticText = "No more than two creatures can attack each combat";
}
public CavernsOfDespairAttackRestrictionEffect(final CavernsOfDespairAttackRestrictionEffect effect) {
super(effect);
}
@Override
public CavernsOfDespairAttackRestrictionEffect copy() {
return new CavernsOfDespairAttackRestrictionEffect(this);
}
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
return true;
}
@Override
public boolean canAttack(Permanent attacker, UUID defenderId, Ability source, Game game) {
return game.getCombat().getAttackers().size() < 2;
}
}
class CavernsOfDespairBlockRestrictionEffect extends RestrictionEffect {
public CavernsOfDespairBlockRestrictionEffect() {
super(Duration.WhileOnBattlefield);
staticText = "No more than two creatures can block each combat";
}
public CavernsOfDespairBlockRestrictionEffect(final CavernsOfDespairBlockRestrictionEffect effect) {
super(effect);
}
@Override
public CavernsOfDespairBlockRestrictionEffect copy() {
return new CavernsOfDespairBlockRestrictionEffect(this);
}
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
return true;
}
@Override
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
return game.getCombat().getBlockers().size() < 2;
}
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.c;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
@ -35,12 +34,15 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInYourGraveyard;
import java.util.UUID;
/**
*
* @author fireshoes
@ -88,7 +90,7 @@ class CemeteryRecruitmentEffect extends OneShotEffect {
Card card = game.getCard(targetPointer.getFirst(game, source));
if (card != null) {
if (controller.moveCards(card, Zone.HAND, source, game)
&& card.hasSubtype("Zombie", game)) {
&& card.hasSubtype(SubType.ZOMBIE, game)) {
controller.drawCards(1, game);
}
}

View file

@ -0,0 +1,87 @@
/*
* 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.c;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.condition.CompoundCondition;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.IsStepCondition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.effects.common.ReturnSourceFromGraveyardToBattlefieldEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.PhaseStep;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.common.FilterControlledLandPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.target.common.TargetControlledPermanent;
/**
*
* @author TheElk801
*/
public class CoffinPuppets extends CardImpl {
private static final FilterControlledPermanent filter = new FilterControlledPermanent("you control a Swamp");
static {
filter.add(new SubtypePredicate(SubType.SWAMP));
}
public CoffinPuppets(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}{B}");
this.subtype.add("Zombie");
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// Sacrifice two lands: Return Coffin Puppets from your graveyard to the battlefield. Activate this ability only during your upkeep and only if you control a Swamp.
Condition condition = new CompoundCondition("during your upkeep and only if you control a Swamp",new PermanentsOnTheBattlefieldCondition(filter), new IsStepCondition(PhaseStep.UPKEEP));
Ability ability = new ActivateIfConditionActivatedAbility(Zone.GRAVEYARD,
new ReturnSourceFromGraveyardToBattlefieldEffect(),
new SacrificeTargetCost(new TargetControlledPermanent(2, 2, new FilterControlledLandPermanent("two lands"), true)),
condition);
this.addAbility(ability);
}
public CoffinPuppets(final CoffinPuppets card) {
super(card);
}
@Override
public CoffinPuppets copy() {
return new CoffinPuppets(this);
}
}

View file

@ -0,0 +1,91 @@
/*
* 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.c;
import java.util.UUID;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author TheElk801
*/
public class CommonCause extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Nonartifact creatures");
static {
filter.add(Predicates.not(new CardTypePredicate(CardType.ARTIFACT)));
}
public CommonCause(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}");
// Nonartifact creatures get +2/+2 as long as they all share a color.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new BoostAllEffect(2, 2, Duration.WhileOnBattlefield, filter, false),
new AllColorCondition(),
"nonartifact creatures get +2/+2 as long as they all share a color.")));
}
public CommonCause(final CommonCause card) {
super(card);
}
@Override
public CommonCause copy() {
return new CommonCause(this);
}
}
class AllColorCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
FilterCreaturePermanent filter = new FilterCreaturePermanent("Nonartifact creatures");
filter.add(Predicates.not(new CardTypePredicate(CardType.ARTIFACT)));
ObjectColor allColor = new ObjectColor("WUBRG");
for (Permanent thing : game.getBattlefield().getAllActivePermanents(filter, game)) {
allColor = allColor.intersection(thing.getColor(game));
}
return !allColor.isColorless();
}
}

View file

@ -27,9 +27,6 @@
*/
package mage.cards.c;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldAbility;
@ -48,6 +45,10 @@ import mage.game.stack.StackObject;
import mage.players.Player;
import mage.util.SubTypeList;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
/**
*
* @author anonymous
@ -92,34 +93,33 @@ class ConspiracyEffect extends ContinuousEffectImpl {
@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId());
String choice = (String) game.getState().getValue(source.getSourceId().toString() + "_type");
SubType chosenSubtype = SubType.byDescription(choice);
SubType choice = (SubType) game.getState().getValue(source.getSourceId().toString() + "_type");
if (controller != null && choice != null) {
// Creature cards you own that aren't on the battlefield
// in graveyard
for (UUID cardId : controller.getGraveyard()) {
Card card = game.getCard(cardId);
if (card.isCreature()) {
setCreatureSubtype(card, chosenSubtype, game);
setCreatureSubtype(card, choice, game);
}
}
// on Hand
for (UUID cardId : controller.getHand()) {
Card card = game.getCard(cardId);
if (card.isCreature()) {
setCreatureSubtype(card, chosenSubtype, game);
setCreatureSubtype(card, choice, game);
}
}
// in Exile
for (Card card : game.getState().getExile().getAllCards(game)) {
if (card.getOwnerId().equals(controller.getId()) && card.isCreature()) {
setCreatureSubtype(card, chosenSubtype, game);
setCreatureSubtype(card, choice, game);
}
}
// in Library (e.g. for Mystical Teachings)
for (Card card : controller.getLibrary().getCards(game)) {
if (card.getOwnerId().equals(controller.getId()) && card.isCreature()) {
setCreatureSubtype(card, chosenSubtype, game);
setCreatureSubtype(card, choice, game);
}
}
// commander in command zone
@ -127,7 +127,7 @@ class ConspiracyEffect extends ContinuousEffectImpl {
if (game.getState().getZone(commanderId) == Zone.COMMAND) {
Card card = game.getCard(commanderId);
if (card.isCreature()) {
setCreatureSubtype(card, chosenSubtype, game);
setCreatureSubtype(card, choice, game);
}
}
}
@ -138,14 +138,14 @@ class ConspiracyEffect extends ContinuousEffectImpl {
stackObject.getControllerId().equals(source.getControllerId()) &&
stackObject.isCreature()) {
Card card = ((Spell) stackObject).getCard();
setCreatureSubtype(card, chosenSubtype, game);
setCreatureSubtype(card, choice, game);
}
}
// creatures you control
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(
new FilterControlledCreaturePermanent(), source.getControllerId(), game);
for (Permanent creature : creatures) {
setCreatureSubtype(creature, chosenSubtype, game);
setCreatureSubtype(creature, choice, game);
}
return true;
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.c;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.BecomesTappedAttachedTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
@ -39,10 +38,13 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.target.TargetPermanent;
import mage.target.common.TargetLandPermanent;
import java.util.UUID;
/**
* @author Loki
*/
@ -61,7 +63,7 @@ public class ContaminatedGround extends CardImpl {
this.addAbility(ability);
// Enchanted land is a Swamp.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesBasicLandEnchantedEffect("Swamp")));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesBasicLandEnchantedEffect(SubType.SWAMP)));
// Whenever enchanted land becomes tapped, its controller loses 2 life.
this.addAbility(new BecomesTappedAttachedTriggeredAbility(new LoseLifeControllerAttachedEffect(2), "enchanted land"));

View file

@ -27,14 +27,12 @@
*/
package mage.cards.c;
import java.util.UUID;
import java.util.stream.Collectors;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
import mage.choices.ChoiceCreatureType;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
@ -45,6 +43,8 @@ import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetAttackingOrBlockingCreature;
import java.util.UUID;
/**
*
* @author emerald000
@ -89,9 +89,7 @@ class CoordinatedBarrageEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Choice choice = new ChoiceImpl(true);
choice.setMessage("Choose a creature type");
choice.setChoices(SubType.getCreatureTypes(false).stream().map(SubType::toString).collect(Collectors.toSet()));
Choice choice = new ChoiceCreatureType();
if (controller.choose(Outcome.Damage, choice, game)) {
String chosenType = choice.getChoice();
FilterControlledPermanent filter = new FilterControlledPermanent();

View file

@ -27,7 +27,6 @@
*/
package mage.cards.c;
import java.util.UUID;
import mage.abilities.common.AsEntersBattlefieldAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.ChooseCreatureTypeEffect;
@ -35,14 +34,13 @@ import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
import mage.abilities.keyword.FearAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.constants.*;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
*
* @author LevelX2
@ -87,8 +85,8 @@ class FilterCoverOfDarkness extends FilterCreaturePermanent {
@Override
public boolean match(Permanent permanent, UUID sourceId, UUID playerId, Game game) {
if (super.match(permanent, sourceId, playerId, game)) {
String subtype = (String) game.getState().getValue(sourceId + "_type");
if (subtype != null && !subtype.isEmpty() && permanent.hasSubtype(subtype, game)) {
SubType subtype = (SubType) game.getState().getValue(sourceId + "_type");
if (subtype != null && permanent.hasSubtype(subtype, game)) {
return true;
}
}

View file

@ -0,0 +1,176 @@
/*
* 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.c;
import java.util.UUID;
import mage.target.common.TargetCreaturePermanent;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
import mage.constants.Outcome;
import mage.target.TargetPermanent;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.SubLayer;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterControlledLandPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetControlledPermanent;
import mage.target.common.TargetOpponent;
import mage.target.targetpointer.FixedTarget;
import mage.util.CardUtil;
/**
*
* @author TheElk801
*/
public class CustodyBattle extends CardImpl {
private static final FilterControlledPermanent filter = new FilterControlledLandPermanent();
public CustodyBattle(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}");
this.subtype.add("Aura");
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Enchanted creature has "At the beginning of your upkeep, target opponent gains control of this creature unless you sacrifice a land."
ability = new BeginningOfUpkeepTriggeredAbility(new CustodyBattleUnlessPaysEffect(new SacrificeTargetCost(new TargetControlledPermanent(filter))), TargetController.YOU, false);
ability.addTarget(new TargetOpponent());
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(ability, AttachmentType.AURA)));
}
public CustodyBattle(final CustodyBattle card) {
super(card);
}
@Override
public CustodyBattle copy() {
return new CustodyBattle(this);
}
}
class GiveControlEffect extends ContinuousEffectImpl {
public GiveControlEffect() {
super(Duration.Custom, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl);
staticText = "Target opponent gains control of {this}";
}
public GiveControlEffect(final GiveControlEffect effect) {
super(effect);
}
@Override
public GiveControlEffect copy() {
return new GiveControlEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game);
if (permanent != null) {
return permanent.changeControllerId(source.getFirstTarget(), game);
} else {
discard();
}
return false;
}
}
class CustodyBattleUnlessPaysEffect extends OneShotEffect {
protected Cost cost;
public CustodyBattleUnlessPaysEffect(Cost cost) {
super(Outcome.Sacrifice);
staticText = "target opponent gains control of {this} unless you sacrifice a land";
this.cost = cost;
}
public CustodyBattleUnlessPaysEffect(final CustodyBattleUnlessPaysEffect effect) {
super(effect);
this.cost = effect.cost.copy();
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (controller != null && sourcePermanent != null) {
String message = "sacrifice a land?";
message = CardUtil.replaceSourceName(message, sourcePermanent.getLogName());
message = Character.toUpperCase(message.charAt(0)) + message.substring(1);
if (cost.canPay(source, source.getSourceId(), source.getControllerId(), game)
&& controller.chooseUse(Outcome.Benefit, message, source, game)) {
cost.clearPaid();
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) {
return true;
}
}
if (source.getSourceObjectZoneChangeCounter() == game.getState().getZoneChangeCounter(source.getSourceId())
&& game.getState().getZone(source.getSourceId()) == Zone.BATTLEFIELD) {
ContinuousEffect effect = new GiveControlEffect();
effect.setTargetPointer(new FixedTarget(source.getFirstTarget()));
game.addEffect(effect, source);
game.informPlayers(game.getPlayer(source.getFirstTarget()).getLogName() + " gains control of " + sourcePermanent.getIdName());
}
return true;
}
return false;
}
@Override
public CustodyBattleUnlessPaysEffect copy() {
return new CustodyBattleUnlessPaysEffect(this);
}
}

View file

@ -27,10 +27,6 @@
*/
package mage.cards.c;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
@ -61,6 +57,11 @@ import mage.target.common.TargetLandPermanent;
import mage.target.targetpointer.FixedTarget;
import mage.watchers.Watcher;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
/**
*
* @author MTGfan
@ -80,7 +81,7 @@ public class CyclopeanTomb extends CardImpl {
Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD, new AddCountersTargetEffect(CounterType.MIRE.createInstance()), new GenericManaCost(2), new IsStepCondition(PhaseStep.UPKEEP), "{2}, {T}: Put a mire counter on target non-Swamp land. That land is a Swamp for as long as it has a mire counter on it. Activate this ability only during your upkeep.");
ability.addCost(new TapSourceCost());
ability.addTarget(new TargetLandPermanent(filter));
ability.addEffect(new BecomeSwampEffect(Duration.Custom, false, true, "Swamp"));
ability.addEffect(new BecomeSwampEffect(Duration.Custom, false, true, SubType.SWAMP));
this.addAbility(ability, new CyclopeanTombCounterWatcher());
// When Cyclopean Tomb is put into a graveyard from the battlefield, at the beginning of each of your upkeeps for the rest of the game, remove all mire counters from a land that a mire counter was put onto with Cyclopean Tomb but that a mire counter has not been removed from with Cyclopean Tomb.
this.addAbility(new PutIntoGraveFromBattlefieldSourceTriggeredAbility(new CyclopeanTombCreateTriggeredEffect()));
@ -98,7 +99,7 @@ public class CyclopeanTomb extends CardImpl {
class BecomeSwampEffect extends BecomesBasicLandTargetEffect {
public BecomeSwampEffect(Duration duration, boolean chooseLandType, boolean loseOther, String... landNames) {
public BecomeSwampEffect(Duration duration, boolean chooseLandType, boolean loseOther, SubType... landNames) {
super(duration, chooseLandType, loseOther, landNames);
staticText = "That land is a Swamp for as long as it has a mire counter on it";
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.d;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
@ -35,10 +34,7 @@ import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.constants.*;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
@ -46,6 +42,8 @@ import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
* @author nantuko
*/
@ -93,7 +91,7 @@ class DearlyDepartedEntersBattlefieldEffect extends ReplacementEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (permanent != null && permanent.getControllerId().equals(source.getControllerId()) && permanent.hasSubtype("Human", game)) {
if (permanent != null && permanent.getControllerId().equals(source.getControllerId()) && permanent.hasSubtype(SubType.HUMAN, game)) {
return true;
}
return false;

View file

@ -27,7 +27,6 @@
*/
package mage.cards.d;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
@ -35,12 +34,15 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author North
@ -88,7 +90,7 @@ class DeathsCaressEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Permanent creature = (Permanent) game.getLastKnownInformation(source.getFirstTarget(), Zone.BATTLEFIELD);
if (player != null && creature != null && creature.hasSubtype("Human", game)) {
if (player != null && creature != null && creature.hasSubtype(SubType.HUMAN, game)) {
player.gainLife(creature.getToughness().getValue(), game);
return true;
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.d;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
@ -44,6 +43,8 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import java.util.UUID;
/**
*
* @author MarcoMarin
@ -67,7 +68,7 @@ public class DesertNomads extends CardImpl {
this.addAbility(new LandwalkAbility(filter));
// Prevent all damage that would be dealt to Desert Nomads by Deserts.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PreventDamageToSourceBySubtypeEffect("Desert")));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PreventDamageToSourceBySubtypeEffect(SubType.DESERT)));
}
public DesertNomads(final DesertNomads card) {
@ -82,13 +83,9 @@ public class DesertNomads extends CardImpl {
class PreventDamageToSourceBySubtypeEffect extends PreventAllDamageToSourceEffect {
private String subtype;
public PreventDamageToSourceBySubtypeEffect(){
this("a");
}
private SubType subtype;
public PreventDamageToSourceBySubtypeEffect(String sub){
public PreventDamageToSourceBySubtypeEffect(SubType sub){
super(Duration.WhileOnBattlefield);
subtype = sub;
}

View file

@ -40,8 +40,8 @@ import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.counters.CounterType;
import mage.filter.FilterCard;
import mage.filter.FilterSpell;
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -87,7 +87,7 @@ public class DiregrafColossus extends CardImpl {
class DiregrafColossusEffect extends OneShotEffect {
private static final FilterCreatureCard filter = new FilterCreatureCard();
private static final FilterCard filter = new FilterCard();
static {
filter.add(new SubtypePredicate(SubType.ZOMBIE));

View file

@ -27,8 +27,6 @@
*/
package mage.cards.d;
import java.util.UUID;
import java.util.stream.Collectors;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.OneShotEffect;
@ -36,7 +34,7 @@ import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
import mage.choices.ChoiceCreatureType;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
@ -45,6 +43,8 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.players.Player;
import java.util.UUID;
/**
*
* @author emerald000
@ -89,9 +89,7 @@ class DistantMelodyEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
Choice typeChoice = new ChoiceImpl(true);
typeChoice.setMessage("Choose a creature type:");
typeChoice.setChoices(SubType.getCreatureTypes(false).stream().map(SubType::toString).collect(Collectors.toSet()));
Choice typeChoice = new ChoiceCreatureType();
while (!player.choose(Outcome.BoostCreature, typeChoice, game)) {
if (!player.canRespond()) {
return false;

View file

@ -27,7 +27,6 @@
*/
package mage.cards.d;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.AsEntersBattlefieldAbility;
@ -49,6 +48,8 @@ import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.game.stack.Spell;
import java.util.UUID;
/**
*
* @author Plopman
@ -101,11 +102,11 @@ class AddCounterAbility extends TriggeredAbilityImpl {
public boolean checkTrigger(GameEvent event, Game game) {
Permanent doorOfDestinies = game.getPermanent(getSourceId());
if (doorOfDestinies != null) {
String subtype = (String) game.getState().getValue(doorOfDestinies.getId() + "_type");
SubType subtype = (SubType) game.getState().getValue(doorOfDestinies.getId() + "_type");
if (subtype != null) {
FilterSpell filter = new FilterSpell();
filter.add(new ControllerPredicate(TargetController.YOU));
filter.add(new SubtypePredicate(SubType.byDescription(subtype)));
filter.add(new SubtypePredicate(subtype));
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null && filter.match(spell, getSourceId(), getControllerId(), game)) {
return true;
@ -142,7 +143,7 @@ class BoostCreatureEffectEffect extends ContinuousEffectImpl {
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
String subtype = (String) game.getState().getValue(permanent.getId() + "_type");
SubType subtype = (SubType) game.getState().getValue(permanent.getId() + "_type");
if (subtype != null) {
for (Permanent perm : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURES, source.getControllerId(), game)) {
if (perm.hasSubtype(subtype, game)) {

View file

@ -62,7 +62,7 @@ public class DownhillCharge extends CardImpl {
// You may sacrifice a Mountain rather than pay Downhill Charge's mana cost.
this.addAbility(new AlternativeCostSourceAbility(new SacrificeTargetCost(new TargetControlledPermanent(filter))));
// Target creature gets +X/+0 until end of turn, where X is the number of Mountains you control.
Effect effect = new BoostTargetEffect(new PermanentsOnBattlefieldCount(filter), new StaticValue(0), Duration.EndOfTurn);
Effect effect = new BoostTargetEffect(new PermanentsOnBattlefieldCount(filter), new StaticValue(0), Duration.EndOfTurn, true);
effect.setText("Target creature gets +X/+0 until end of turn, where X is the number of Mountains you control.");
this.getSpellAbility().addEffect(effect);
this.getSpellAbility().addTarget(new TargetCreaturePermanent());

View file

@ -27,7 +27,6 @@
*/
package mage.cards.d;
import java.util.UUID;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
@ -40,6 +39,8 @@ import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
*
* @author brikr
@ -78,8 +79,8 @@ class DralnusCrusadeEffect extends ContinuousEffectImpl {
for (Permanent permanent : game.getState().getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE_GOBLINS, source.getControllerId(), source.getSourceId(), game)) {
switch (layer) {
case TypeChangingEffects_4:
if (!permanent.hasSubtype("Zombie", game)) {
permanent.getSubtype(game).add("Zombie");
if (!permanent.hasSubtype(SubType.ZOMBIE, game)) {
permanent.getSubtype(game).add(SubType.ZOMBIE);
}
break;
case ColorChangingEffects_5:

View file

@ -27,7 +27,6 @@
*/
package mage.cards.d;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
@ -49,6 +48,8 @@ import mage.target.Target;
import mage.target.common.TargetControlledPermanent;
import mage.target.common.TargetLandPermanent;
import java.util.UUID;
/**
*
* @author cbt33, LevelX2 (Walk the Aeons), KholdFuzion (Dandan)
@ -65,7 +66,7 @@ public class Dreamwinder extends CardImpl {
// Dreamwinder can't attack unless defending player controls an Island.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(new FilterLandPermanent(SubType.ISLAND,"an Island"))));
// {U}, Sacrifice an Island: Target land becomes an Island until end of turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesBasicLandTargetEffect(Duration.EndOfTurn, "Island"), new ManaCostsImpl("{U}"));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesBasicLandTargetEffect(Duration.EndOfTurn, SubType.ISLAND), new ManaCostsImpl("{U}"));
Target target = new TargetLandPermanent();
ability.addTarget(target);
FilterControlledLandPermanent filter = new FilterControlledLandPermanent("an Island");

View file

@ -0,0 +1,75 @@
/*
* 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.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.effects.common.SacrificeSourceUnlessPaysEffect;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.TargetController;
import mage.filter.common.FilterControlledEnchantmentPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.target.common.TargetControlledPermanent;
/**
*
* @author TheElk801
*/
public class EndlessWurm extends CardImpl {
private static final FilterControlledPermanent filter = new FilterControlledEnchantmentPermanent();
public EndlessWurm(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}{G}");
this.subtype.add("Wurm");
this.power = new MageInt(9);
this.toughness = new MageInt(9);
// Trample
this.addAbility(TrampleAbility.getInstance());
// At the beginning of your upkeep, sacrifice Endless Wurm unless you sacrifice an enchantment.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new SacrificeSourceUnlessPaysEffect(new SacrificeTargetCost(new TargetControlledPermanent(filter))), TargetController.YOU, false));
}
public EndlessWurm(final EndlessWurm card) {
super(card);
}
@Override
public EndlessWurm copy() {
return new EndlessWurm(this);
}
}

View file

@ -0,0 +1,108 @@
/*
* 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.Iterator;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.condition.InvertCondition;
import mage.abilities.condition.common.CardsInControllerGraveCondition;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.SacrificeEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPlayer;
/**
*
* @author TheElk801
*/
public class Epicenter extends CardImpl {
public Epicenter(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{R}");
// Target player sacrifices a land.
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
new SacrificeEffect(StaticFilters.FILTER_LAND, 1, "Target player"),
new InvertCondition(new CardsInControllerGraveCondition(7)),
"Target player sacrifices a land"));
// Threshold - Each player sacrifices all lands he or she controls instead if seven or more cards are in your graveyard.
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
new EpicenterEffect(),
new CardsInControllerGraveCondition(7),
"<br/><br/><i>Threshold</i> - Each player sacrifices all lands he or she controls instead if seven or more cards are in your graveyard."));
this.getSpellAbility().addTarget(new TargetPlayer());
}
public Epicenter(final Epicenter card) {
super(card);
}
@Override
public Epicenter copy() {
return new Epicenter(this);
}
}
class EpicenterEffect extends OneShotEffect {
EpicenterEffect() {
super(Outcome.DestroyPermanent);
staticText = "Each player sacrifices all lands he or she controls";
}
EpicenterEffect(final EpicenterEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Iterator<Permanent> permanents = game.getBattlefield().getActivePermanents(source.getControllerId(), game).iterator();
while (permanents.hasNext()) {
Permanent p = permanents.next();
if (p.isLand()) {
p.sacrifice(source.getSourceId(), game);
}
}
return true;
}
@Override
public EpicenterEffect copy() {
return new EpicenterEffect(this);
}
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.e;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
@ -37,6 +36,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
@ -44,6 +44,8 @@ import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.UUID;
/**
*
* @author cbt33
@ -97,7 +99,7 @@ class DealsDamageAllTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent creature = game.getPermanent(event.getSourceId());
if (creature != null && creature.hasSubtype("Sliver", game)) {
if (creature != null && creature.hasSubtype(SubType.SLIVER, game)) {
for (Effect effect : this.getEffects()) {
effect.setValue("damage", event.getAmount());
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.e;
import java.util.UUID;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continuous.BecomesBasicLandEnchantedEffect;
@ -36,10 +35,13 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.target.TargetPermanent;
import mage.target.common.TargetLandPermanent;
import java.util.UUID;
/**
*
* @author North
@ -57,7 +59,7 @@ public class EvilPresence extends CardImpl {
this.addAbility(new EnchantAbility(auraTarget.getTargetName()));
// Enchanted land is a Swamp.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesBasicLandEnchantedEffect("Swamp")));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesBasicLandEnchantedEffect(SubType.SWAMP)));
}
public EvilPresence(final EvilPresence card) {

View file

@ -27,7 +27,6 @@
*/
package mage.cards.f;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
@ -38,15 +37,14 @@ import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.constants.*;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
/**
*
* @author North
@ -101,7 +99,7 @@ class FalkenrathTorturerEffect extends OneShotEffect {
if (cost instanceof SacrificeTargetCost) {
Permanent sacrificedCreature = ((SacrificeTargetCost) cost).getPermanents().get(0);
Permanent sourceCreature = game.getPermanent(source.getSourceId());
if (sacrificedCreature.hasSubtype("Human", game) && sourceCreature != null) {
if (sacrificedCreature.hasSubtype(SubType.HUMAN, game) && sourceCreature != null) {
sourceCreature.addCounters(CounterType.P1P1.createInstance(), source, game);
return true;
}

View file

@ -0,0 +1,77 @@
/*
* 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.target.common.TargetCreaturePermanent;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.DamageAttachedEffect;
import mage.constants.Outcome;
import mage.target.TargetPermanent;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.TargetController;
/**
*
* @author TheElk801
*/
public class FatalAttraction extends CardImpl {
public FatalAttraction(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}");
this.subtype.add("Aura");
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// When Fatal Attraction enters the battlefield, it deals 2 damage to enchanted creature.
this.addAbility(new EntersBattlefieldTriggeredAbility(new DamageAttachedEffect(2)));
// At the beginning of your upkeep, Fatal Attraction deals 4 damage to enchanted creature.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new DamageAttachedEffect(4), TargetController.YOU, false));
}
public FatalAttraction(final FatalAttraction card) {
super(card);
}
@Override
public FatalAttraction copy() {
return new FatalAttraction(this);
}
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.f;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect;
@ -35,12 +34,15 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.counters.CounterType;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCardInYourGraveyard;
import java.util.UUID;
/**
*
* @author fireshoes
@ -85,7 +87,7 @@ class FearsomeAwakeningEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null && permanent.hasSubtype("Dragon", game)) {
if (permanent != null && permanent.hasSubtype(SubType.DRAGON, game)) {
permanent.addCounters(CounterType.P1P1.createInstance(2), source, game);
return true;
}

View file

@ -58,7 +58,7 @@ public class FeedingFrenzy extends CardImpl {
// Target creature gets -X/-X until end of turn, where X is the number of Zombies on the battlefield.
DynamicValue x = new PermanentsOnBattlefieldCount(filter, -1);
Effect effect = new BoostTargetEffect(x, x, Duration.EndOfTurn);
Effect effect = new BoostTargetEffect(x, x, Duration.EndOfTurn, true);
effect.setText("Target creature gets -X/-X until end of turn, where X is the number of Zombies on the battlefield");
this.getSpellAbility().addEffect(effect);
this.getSpellAbility().addTarget(new TargetCreaturePermanent());

View file

@ -0,0 +1,100 @@
/*
* 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.effects.OneShotEffect;
import mage.abilities.effects.common.PreventDamageByTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.filter.common.FilterBlockingCreature;
import mage.game.Game;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author TheElk801
*/
public class FightingChance extends CardImpl {
private static final FilterBlockingCreature filter = new FilterBlockingCreature("Blocking creatures");
public FightingChance(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{R}");
// For each blocking creature, flip a coin. If you win the flip, prevent all combat damage that would be dealt by that creature this turn.
this.getSpellAbility().addEffect(new FightingChanceEffect());
}
public FightingChance(final FightingChance card) {
super(card);
}
@Override
public FightingChance copy() {
return new FightingChance(this);
}
}
class FightingChanceEffect extends OneShotEffect {
FightingChanceEffect() {
super(Outcome.Detriment);
staticText = "For each blocking creature, flip a coin. If you win the flip, prevent all combat damage that would be dealt by that creature this turn.";
}
FightingChanceEffect(final FightingChanceEffect effect) {
super(effect);
}
@Override
public FightingChanceEffect copy() {
return new FightingChanceEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
for (UUID blocker : game.getCombat().getBlockers()) {
if (player.flipCoin(game)) {
PreventDamageByTargetEffect effect = new PreventDamageByTargetEffect(Duration.EndOfTurn, true);
effect.setTargetPointer(new FixedTarget(blocker));
game.addEffect(effect, source);
}
}
return true;
}
return false;
}
}

View file

@ -0,0 +1,111 @@
/*
* 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.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SetTargetPointer;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author TheElk801
*/
public class FlameKinWarScout extends CardImpl {
private static FilterCreaturePermanent filter = new FilterCreaturePermanent("another creature");
static {
filter.add(new AnotherPredicate());
}
public FlameKinWarScout(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}");
this.subtype.add("Elemental");
this.subtype.add("Scout");
this.power = new MageInt(2);
this.toughness = new MageInt(4);
// When another creature enters the battlefield, sacrifice Flame-Kin War Scout. If you do, Flame-Kin War Scout deals 4 damage to that creature.
this.addAbility(new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, new FlameKinWarScourEffect(), filter, false, SetTargetPointer.PERMANENT, null));
}
public FlameKinWarScout(final FlameKinWarScout card) {
super(card);
}
@Override
public FlameKinWarScout copy() {
return new FlameKinWarScout(this);
}
}
class FlameKinWarScourEffect extends OneShotEffect {
FlameKinWarScourEffect() {
super(Outcome.DestroyPermanent);
this.staticText = "sacrifice {this}. If you do, {this} deals 4 damage to that creature.";
}
FlameKinWarScourEffect(final FlameKinWarScourEffect effect) {
super(effect);
}
@Override
public FlameKinWarScourEffect copy() {
return new FlameKinWarScourEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game);
if (permanent != null) {
if (permanent.sacrifice(source.getSourceId(), game)) {
Effect effect = new DamageTargetEffect(4).setText("{this} deals 4 damage to it");
effect.setTargetPointer(this.getTargetPointer());
return effect.apply(game, source);
}
}
return false;
}
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.f;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldAbility;
@ -48,6 +47,8 @@ import mage.counters.CounterType;
import mage.filter.common.FilterLandPermanent;
import mage.target.common.TargetLandPermanent;
import java.util.UUID;
/**
*
* @author fireshoes
@ -67,7 +68,7 @@ public class Floodchaser extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(new FilterLandPermanent(SubType.ISLAND,"an Island"))));
// {U}, Remove a +1/+1 counter from Floodchaser: Target land becomes an Island until end of turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesBasicLandTargetEffect(Duration.EndOfTurn, "Island"), new ManaCostsImpl("{U}"));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesBasicLandTargetEffect(Duration.EndOfTurn, SubType.ISLAND), new ManaCostsImpl("{U}"));
ability.addCost(new RemoveCountersSourceCost(CounterType.P1P1.createInstance(1)));
ability.addTarget(new TargetLandPermanent());
this.addAbility(ability);

View file

@ -27,7 +27,6 @@
*/
package mage.cards.g;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
@ -55,6 +54,8 @@ import mage.game.combat.CombatGroup;
import mage.game.permanent.Permanent;
import mage.target.common.TargetLandPermanent;
import java.util.UUID;
/**
*
* @author anonymous
@ -81,7 +82,7 @@ public class GaeasLiege extends CardImpl {
new InvertCondition(SourceAttackingCondition.instance),
"As long as {this} isn't attacking, its power and toughness are each equal to the number of Forests you control. As long as {this} is attacking, its power and toughness are each equal to the number of Forests defending player controls.")));
// {tap}: Target land becomes a Forest until Gaea's Liege leaves the battlefield.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesBasicLandTargetEffect(Duration.WhileOnBattlefield, "Forest"), new TapSourceCost());
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesBasicLandTargetEffect(Duration.WhileOnBattlefield, SubType.FOREST), new TapSourceCost());
ability.addTarget(new TargetLandPermanent());
this.addAbility(ability);
}

View file

@ -61,7 +61,7 @@ public class GeneralTazri extends CardImpl {
}
public GeneralTazri(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{W}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{W}");
addSuperType(SuperType.LEGENDARY);
this.subtype.add("Human");
this.subtype.add("Ally");
@ -73,9 +73,11 @@ public class GeneralTazri extends CardImpl {
new TargetCardInLibrary(filter), true, true), true));
// {W}{U}{B}{R}{G}: Ally creatures you control get +X/+X until end of turn, where X is the number of colors among those creatures.
DynamicValue xValue = new GeneralTazriColorCount();
BoostControlledEffect effect = new BoostControlledEffect(xValue, xValue, Duration.EndOfTurn, new FilterCreaturePermanent(SubType.ALLY, "Ally creatures"), false);
effect.setLockedIn(true);
this.addAbility(new SimpleActivatedAbility(
Zone.BATTLEFIELD,
new BoostControlledEffect(xValue, xValue, Duration.EndOfTurn, new FilterCreaturePermanent(SubType.ALLY, "Ally creatures"), false),
effect,
new ManaCostsImpl("{W}{U}{B}{R}{G}")));
}

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.g;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.AmplifyEffect;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.ReturnSourceFromGraveyardToHandEffect;
import mage.abilities.keyword.AmplifyAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author TheElk801
*/
public class GhastlyRemains extends CardImpl {
public GhastlyRemains(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B}{B}{B}");
this.subtype.add("Zombie");
this.power = new MageInt(0);
this.toughness = new MageInt(0);
// Amplify 1
this.addAbility(new AmplifyAbility(AmplifyEffect.AmplifyFactor.Amplify1));
// At the beginning of your upkeep, if Ghastly Remains is in your graveyard, you may pay {B}{B}{B}. If you do, return Ghastly Remains to your hand.
this.addAbility(new GhastlyRemainsTriggeredAbility());
}
public GhastlyRemains(final GhastlyRemains card) {
super(card);
}
@Override
public GhastlyRemains copy() {
return new GhastlyRemains(this);
}
}
class GhastlyRemainsTriggeredAbility extends BeginningOfUpkeepTriggeredAbility {
public GhastlyRemainsTriggeredAbility() {
super(Zone.GRAVEYARD, new DoIfCostPaid(new ReturnSourceFromGraveyardToHandEffect(), new ManaCostsImpl("{B}{B}{B}")), TargetController.YOU, false);
}
public GhastlyRemainsTriggeredAbility(GhastlyRemainsTriggeredAbility ability) {
super(ability);
}
@Override
public BeginningOfUpkeepTriggeredAbility copy() {
return new GhastlyRemainsTriggeredAbility(this);
}
@Override
public boolean checkInterveningIfClause(Game game) {
Player controller = game.getPlayer(controllerId);
if (controller != null && controller.getGraveyard().contains(sourceId)) {
return super.checkInterveningIfClause(game);
}
return false;
}
@Override
public String getRule() {
return "At the beginning of your upkeep, if {source} is in your graveyard, you may pay {B}{B}{B}. If you do, return {source} to your hand";
}
}

View file

@ -46,11 +46,11 @@ import mage.target.common.TargetCreaturePermanent;
public class GhoulsFeast extends CardImpl {
public GhoulsFeast(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{B}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{B}");
// Target creature gets +X/+0 until end of turn, where X is the number of creature cards in your graveyard.
DynamicValue xValue = new CardsInControllerGraveyardCount(new FilterCreatureCard("creature card"));
this.getSpellAbility().addEffect(new BoostTargetEffect(xValue, new StaticValue(0), Duration.EndOfTurn));
this.getSpellAbility().addEffect(new BoostTargetEffect(xValue, new StaticValue(0), Duration.EndOfTurn, true));
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.g;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
@ -49,6 +48,8 @@ import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
import mage.watchers.Watcher;
import java.util.UUID;
/**
*
* @author fireshoes
@ -167,7 +168,7 @@ class GisaAndGeralfWatcher extends Watcher {
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getZone() == Zone.GRAVEYARD) {
Spell spell = (Spell) game.getObject(event.getTargetId());
if (spell.isCreature() && spell.hasSubtype("Zombie", game)) {
if (spell.isCreature() && spell.hasSubtype(SubType.ZOMBIE, game)) {
abilityUsed = true;
}
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.g;
import java.util.UUID;
import mage.ConditionalMana;
import mage.MageInt;
import mage.MageObject;
@ -54,6 +53,8 @@ import mage.filter.predicate.permanent.AttackingPredicate;
import mage.game.Game;
import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
/**
*
* @author LevelX2
@ -117,7 +118,7 @@ class GnarlrootTrapperManaCondition extends CreatureCastManaCondition {
public boolean apply(Game game, Ability source) {
if (super.apply(game, source)) {
MageObject object = game.getObject(source.getSourceId());
if (object.hasSubtype("Elf", game)
if (object.hasSubtype(SubType.ELF, game)
&& object.isCreature()) {
return true;
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.g;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.Condition;
@ -37,16 +36,15 @@ import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.constants.*;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import mage.target.common.TargetLandPermanent;
import java.util.UUID;
/**
*
* @author nigelzor
@ -88,7 +86,7 @@ class AttachedToBasicMountainCondition implements Condition {
if (enchantment != null) {
Permanent enchanted = game.getPermanent(enchantment.getAttachedTo());
if (enchanted != null) {
if (enchanted.hasSubtype("Mountain", game) && enchanted.isBasic()) {
if (enchanted.hasSubtype(SubType.MOUNTAIN, game) && enchanted.isBasic()) {
return true;
}
}

View file

@ -0,0 +1,72 @@
/*
* 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.g;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.MostCommonColorCondition;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
/**
*
* @author TheElk801
*/
public class GohamDjinn extends CardImpl {
public GohamDjinn(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{B}");
this.subtype.add("Djinn");
this.power = new MageInt(5);
this.toughness = new MageInt(5);
// {1}{B}: Regenerate Goham Djinn.
// 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,
new ConditionalContinuousEffect(new BoostSourceEffect(-2, -2, Duration.WhileOnBattlefield),
new MostCommonColorCondition(new ObjectColor(ObjectColor.BLACK)),
"{this} gets -2/-2 as long as black is the most common color among all permanents or is tied for most common")));
}
public GohamDjinn(final GohamDjinn card) {
super(card);
}
@Override
public GohamDjinn copy() {
return new GohamDjinn(this);
}
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.g;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
@ -37,9 +36,12 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.target.Target;
import mage.target.common.TargetLandPermanent;
import java.util.UUID;
/**
*
* @author cbt33, Loki (Contaminated Ground), Plopman (Larceny)
@ -56,7 +58,7 @@ public class GracefulAntelope extends CardImpl {
// Plainswalk
this.addAbility(new PlainswalkAbility());
// Whenever Graceful Antelope deals combat damage to a player, you may have target land become a Plains until Graceful Antelope leaves the battlefield.
Ability ability = new DealsCombatDamageToAPlayerTriggeredAbility(new BecomesBasicLandTargetEffect(Duration.WhileOnBattlefield,"Plains"), true);
Ability ability = new DealsCombatDamageToAPlayerTriggeredAbility(new BecomesBasicLandTargetEffect(Duration.WhileOnBattlefield, SubType.PLAINS), true);
Target target = new TargetLandPermanent();
ability.addTarget(target);
this.addAbility(ability);

View file

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

View file

@ -27,7 +27,6 @@
*/
package mage.cards.g;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
@ -46,6 +45,8 @@ import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.UUID;
/**
*
* @author jeffwadsworth
@ -110,7 +111,7 @@ class GreatbowDoyenTriggeredAbility extends TriggeredAbilityImpl {
Permanent damagedCreature = game.getPermanent(event.getTargetId());
if (creature != null && damagedCreature != null
&& creature.isCreature()
&& creature.hasSubtype("Archer", game)
&& creature.hasSubtype(SubType.ARCHER, game)
&& creature.getControllerId().equals(controllerId)) {
this.getEffects().get(0).setValue("damageAmount", event.getAmount());
this.getEffects().get(0).setValue("controller", damagedCreature.getControllerId());

View file

@ -0,0 +1,82 @@
/*
* 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.g;
import java.util.UUID;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.RemoveVariableCountersSourceCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.dynamicvalue.IntPlusDynamicValue;
import mage.abilities.dynamicvalue.common.CountersSourceCount;
import mage.abilities.dynamicvalue.common.RemovedCountersForCostValue;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.mana.DynamicManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.counters.CounterType;
/**
*
* @author TheElk801
*/
public class GreenManaBattery extends CardImpl {
public GreenManaBattery(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}");
// {2}, {tap}: Put a charge counter on Green Mana Battery.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.STORAGE.createInstance(1)), new GenericManaCost(2));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
// {tap}, Remove any number of charge counters from Green Mana Battery: Add {G} to your mana pool, then add an additional {G} to your mana pool for each charge counter removed this way.
ability = new DynamicManaAbility(
Mana.GreenMana(1),
new IntPlusDynamicValue(1, new RemovedCountersForCostValue()),
new TapSourceCost(),
"Add {G} to your mana pool, then add {G} to your mana pool for each storage counter removed this way",
true, new CountersSourceCount(CounterType.STORAGE));
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance(),
"Remove X storage counters from {this}"));
this.addAbility(ability);
}
public GreenManaBattery(final GreenManaBattery card) {
super(card);
}
@Override
public GreenManaBattery copy() {
return new GreenManaBattery(this);
}
}

View file

@ -0,0 +1,190 @@
/*
* 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.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.condition.Condition;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalActivatedAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DestroyAllEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.PhaseStep;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.CardIdPredicate;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.other.AuraCardCanAttachToPermanentId;
import mage.filter.predicate.permanent.AttachedToPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.Target;
import mage.target.common.TargetCardInYourGraveyard;
/**
*
* @author jeffwadsworth
*/
public class HakimLoreweaver extends CardImpl {
private final static String rule = "Return target Aura card from your graveyard to the battlefield attached to Hakim, Loreweaver. Activate this ability only during your upkeep and only if Hakim isn't enchanted.";
UUID originalId;
public HakimLoreweaver(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}");
addSuperType(SuperType.LEGENDARY);
this.subtype.add("Human");
this.subtype.add("Wizard");
this.power = new MageInt(2);
this.toughness = new MageInt(4);
// Flying
this.addAbility(FlyingAbility.getInstance());
// {U}{U}: Return target Aura card from your graveyard to the battlefield attached to Hakim, Loreweaver. Activate this ability only during your upkeep and only if Hakim isn't enchanted.
Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD, new HakimLoreweaverEffect(), new ManaCostsImpl("{U}{U}"), new HakimLoreweaverCondition(), rule);
ability.addTarget(new TargetCardInYourGraveyard());
originalId = ability.getOriginalId();
this.addAbility(ability);
// {U}{U}, {tap}: Destroy all Auras attached to Hakim.
FilterPermanent filterAurasOnHakim = new FilterPermanent("Auras attached to Hakim");
filterAurasOnHakim.add(new CardTypePredicate(CardType.ENCHANTMENT));
filterAurasOnHakim.add(new SubtypePredicate(SubType.AURA));
FilterPermanent filterSourceId = new FilterPermanent();
filterSourceId.add(new CardIdPredicate(this.getId()));
filterAurasOnHakim.add(new AttachedToPredicate(filterSourceId));
Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyAllEffect(filterAurasOnHakim), new ManaCostsImpl("{U}{U}"));
ability2.addCost(new TapSourceCost());
this.addAbility(ability2);
}
@Override
public void adjustTargets(Ability ability, Game game) {
if (ability.getOriginalId().equals(originalId)) {
Player controller = game.getPlayer(ability.getControllerId());
if (controller != null) {
ability.getTargets().clear();
FilterCard filterAuraCard = new FilterCard("target Aura card from your graveyard");
filterAuraCard.add(new CardTypePredicate(CardType.ENCHANTMENT));
filterAuraCard.add(new SubtypePredicate(SubType.AURA));
filterAuraCard.add(new AuraCardCanAttachToPermanentId(ability.getSourceId()));
TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(filterAuraCard);
ability.addTarget(target);
}
}
}
public HakimLoreweaver(final HakimLoreweaver card) {
super(card);
this.originalId = card.originalId;
}
@Override
public HakimLoreweaver copy() {
return new HakimLoreweaver(this);
}
}
class HakimLoreweaverEffect extends OneShotEffect {
public HakimLoreweaverEffect() {
super(Outcome.Benefit);
this.staticText = "Return target Aura card from your graveyard to the battlefield attached to {this}. Activate this ability only during your upkeep and only if Hakim isn't enchanted";
}
public HakimLoreweaverEffect(final HakimLoreweaverEffect effect) {
super(effect);
}
@Override
public HakimLoreweaverEffect copy() {
return new HakimLoreweaverEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent hakimLoreweaver = game.getPermanent(source.getSourceId());
Card targetAuraCard = game.getCard(source.getFirstTarget());
if (controller != null
&& hakimLoreweaver != null
&& controller.canRespond()
&& targetAuraCard != null) {
Target target = targetAuraCard.getSpellAbility().getTargets().get(0);
if (target != null) {
game.getState().setValue("attachTo:" + targetAuraCard.getId(), hakimLoreweaver);
controller.moveCards(targetAuraCard, Zone.BATTLEFIELD, source, game);
return hakimLoreweaver.addAttachment(targetAuraCard.getId(), game);
}
}
return false;
}
}
class HakimLoreweaverCondition implements Condition {
static private final FilterPermanent auras = new FilterPermanent();
static {
auras.add(new CardTypePredicate(CardType.ENCHANTMENT));
}
@Override
public boolean apply(Game game, Ability source) {
Permanent hakimLoreweaver = game.getPermanent(source.getSourceId());
if (hakimLoreweaver != null) {
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(auras, game)) {
if (permanent != null
&& hakimLoreweaver.getAttachments().contains(permanent.getId())) {
return false;
}
}
return PhaseStep.UPKEEP == game.getStep().getType()
&& game.getActivePlayerId().equals(source.getControllerId());
}
return false;
}
}

View file

@ -0,0 +1,75 @@
/*
* 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.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.MostCommonColorCondition;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
/**
*
* @author TheElk801
*/
public class HalamDjinn extends CardImpl {
public HalamDjinn(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{R}");
this.subtype.add("Djinn");
this.power = new MageInt(6);
this.toughness = new MageInt(5);
// Haste
this.addAbility(HasteAbility.getInstance());
// Halam Djinn gets -2/-2 as long as red is the most common color among all permanents or is tied for most common.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
new ConditionalContinuousEffect(new BoostSourceEffect(-2, -2, Duration.WhileOnBattlefield),
new MostCommonColorCondition(new ObjectColor(ObjectColor.RED)),
"{this} gets -2/-2 as long as red is the most common color among all permanents or is tied for most common")));
}
public HalamDjinn(final HalamDjinn card) {
super(card);
}
@Override
public HalamDjinn copy() {
return new HalamDjinn(this);
}
}

View file

@ -49,12 +49,12 @@ import mage.game.Game;
/**
*
* @author jeffwadsworth
*
*/
public class HeartlashCinder extends CardImpl {
public HeartlashCinder(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("Elemental");
this.subtype.add("Warrior");
@ -63,12 +63,12 @@ public class HeartlashCinder extends CardImpl {
// Haste
this.addAbility(HasteAbility.getInstance());
// Chroma - When Heartlash Cinder enters the battlefield, it gets +X/+0 until end of turn, where X is the number of red mana symbols in the mana costs of permanents you control.
ContinuousEffect effect = new BoostSourceEffect(new ChromaHeartlashCinderCount(), new StaticValue(0), Duration.EndOfTurn);
ContinuousEffect effect = new BoostSourceEffect(new ChromaHeartlashCinderCount(), new StaticValue(0), Duration.EndOfTurn, true);
effect.setText("<i>Chroma</i> - When Heartlash Cinder enters the battlefield, it gets +X/+0 until end of turn, where X is the number of red mana symbols in the mana costs of permanents you control.");
this.addAbility(new EntersBattlefieldTriggeredAbility(effect, false, true));
}
public HeartlashCinder(final HeartlashCinder card) {

View file

@ -25,7 +25,6 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.cards.h;
import java.util.UUID;
@ -53,12 +52,13 @@ import mage.filter.predicate.permanent.ControllerPredicate;
public class HellkiteIgniter extends CardImpl {
private static final FilterArtifactPermanent filter = new FilterArtifactPermanent("artifact you control");
static {
filter.add(new ControllerPredicate(TargetController.YOU));
}
public HellkiteIgniter (UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{R}{R}");
public HellkiteIgniter(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{R}{R}");
this.subtype.add("Dragon");
this.power = new MageInt(5);
@ -72,11 +72,12 @@ public class HellkiteIgniter extends CardImpl {
new BoostSourceEffect(
new PermanentsOnBattlefieldCount(filter),
new StaticValue(0),
Duration.EndOfTurn),
Duration.EndOfTurn,
true),
new ManaCostsImpl("{1}{R}")));
}
public HellkiteIgniter (final HellkiteIgniter card) {
public HellkiteIgniter(final HellkiteIgniter card) {
super(card);
}

View file

@ -0,0 +1,102 @@
/*
* 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.UUID;
import mage.target.common.TargetCreaturePermanent;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.MostCommonColorCondition;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
import mage.constants.Outcome;
import mage.target.TargetPermanent;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author TheElk801
*/
public class HeroicDefiance extends CardImpl {
public HeroicDefiance(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
this.subtype.add("Aura");
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Enchanted creature gets +3/+3 unless it shares a color with the most common color among all permanents or a color tied for most common.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
new ConditionalContinuousEffect(new BoostEnchantedEffect(3, 3, Duration.WhileOnBattlefield),
new HeroicDefianceCondition(),
"Enchanted creature gets +3/+3 unless it shares a color with the most common color among all permanents or a color tied for most common")));
}
public HeroicDefiance(final HeroicDefiance card) {
super(card);
}
@Override
public HeroicDefiance copy() {
return new HeroicDefiance(this);
}
}
class HeroicDefianceCondition implements Condition {
public HeroicDefianceCondition() {
}
@Override
public boolean apply(Game game, Ability source) {
Permanent enchantment = game.getPermanent(source.getSourceId());
if (enchantment != null) {
Permanent creature = game.getPermanent(enchantment.getAttachedTo());
if (creature != null) {
Condition condition = new MostCommonColorCondition(creature.getColor(game));
return !condition.apply(game, source);
}
}
return false;
}
}

View file

@ -27,9 +27,6 @@
*/
package mage.cards.h;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
@ -45,6 +42,10 @@ import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
/**
*
* @author LevelX2
@ -93,7 +94,7 @@ class HourOfGloryEffect extends OneShotEffect {
Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
if (targetCreature != null) {
controller.moveCards(targetCreature, Zone.EXILED, source, game);
if (targetCreature.hasSubtype(SubType.GOD.getDescription(), game)) {
if (targetCreature.hasSubtype(SubType.GOD, game)) {
game.applyEffects();
Player targetController = game.getPlayer(targetCreature.getControllerId());
if (targetController != null) {

View file

@ -0,0 +1,82 @@
/*
* 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.i;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SpellCastOpponentTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.DefenderAbility;
import mage.abilities.keyword.ProtectionAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterSpell;
import mage.filter.common.FilterArtifactCard;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.permanent.token.InsectToken;
/**
*
* @author TheElk801
*/
public class InfestedRoothold extends CardImpl {
private final static FilterSpell filter = new FilterSpell("an artifact spell");
static {
filter.add(new CardTypePredicate(CardType.ARTIFACT));
}
public InfestedRoothold(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}");
this.subtype.add("Wall");
this.power = new MageInt(0);
this.toughness = new MageInt(3);
// Defender
this.addAbility(DefenderAbility.getInstance());
// Protection from artifacts
this.addAbility(new ProtectionAbility(new FilterArtifactCard("artifacts")));
// Whenever an opponent casts an artifact spell, you may create a 1/1 green Insect creature token.
this.addAbility(new SpellCastOpponentTriggeredAbility(new CreateTokenEffect(new InsectToken()), filter, true));
}
public InfestedRoothold(final InfestedRoothold card) {
super(card);
}
@Override
public InfestedRoothold copy() {
return new InfestedRoothold(this);
}
}

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