Merge pull request #14 from magefree/master

update
This commit is contained in:
Li REN 2013-06-22 18:49:46 -07:00
commit 32dcfa6fc3
86 changed files with 4615 additions and 439 deletions

View file

@ -25,41 +25,49 @@
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="16" max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="lbDeckType" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="lblGameType" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="lblName" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="30" max="-2" attributes="0"/>
<Component id="lbDeckType" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="cbGameType" min="-2" pref="398" max="-2" attributes="1"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="lblFreeMulligans" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spnFreeMulligans" min="-2" pref="50" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="cbDeckType" alignment="0" max="32767" attributes="1"/>
<Group type="102" alignment="0" attributes="0">
<Component id="cbGameType" min="-2" pref="398" max="-2" attributes="1"/>
<Component id="txtName" min="-2" pref="546" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Component id="cbDeckType" max="32767" attributes="1"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="lbTimeLimit" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="lblFreeMulligans" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spnFreeMulligans" pref="50" max="32767" attributes="0"/>
<Component id="cbTimeLimit" min="-2" pref="126" max="-2" attributes="1"/>
</Group>
<Component id="txtName" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace min="0" pref="29" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="btnOK" min="-2" max="-2" attributes="0"/>
@ -88,6 +96,7 @@
</Group>
</Group>
<Component id="jSeparator2" alignment="1" max="32767" attributes="0"/>
<Component id="player1Panel" alignment="0" max="32767" attributes="0"/>
<Component id="pnlOtherPlayers" alignment="1" max="32767" attributes="0"/>
<Component id="jSeparator1" alignment="0" max="32767" attributes="0"/>
</Group>
@ -98,7 +107,7 @@
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jSeparator3" pref="625" max="32767" attributes="0"/>
<Component id="jSeparator3" pref="633" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
@ -107,17 +116,19 @@
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="lblName" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="txtName" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="lbDeckType" min="-2" max="-2" attributes="0"/>
<Component id="cbDeckType" min="-2" max="-2" attributes="0"/>
<Component id="lblName" min="-2" max="-2" attributes="0"/>
<Component id="txtName" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="cbDeckType" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="cbTimeLimit" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lbDeckType" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lbTimeLimit" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="103" alignment="0" groupAlignment="3" attributes="0">
<Component id="spnFreeMulligans" alignment="3" min="-2" max="-2" attributes="0"/>
@ -157,10 +168,12 @@
<Component id="jSeparator2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="27" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Component id="player1Panel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="pnlOtherPlayers" pref="205" max="32767" attributes="0"/>
<Component id="pnlOtherPlayers" pref="144" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jSeparator1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
@ -174,7 +187,7 @@
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="201" max="-2" attributes="0"/>
<Component id="jSeparator3" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="248" max="32767" attributes="0"/>
<EmptySpace pref="244" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
@ -198,6 +211,13 @@
</Component>
<Component class="javax.swing.JComboBox" name="cbDeckType">
</Component>
<Component class="javax.swing.JLabel" name="lbTimeLimit">
<Properties>
<Property name="text" type="java.lang.String" value="Time Limit:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="cbTimeLimit">
</Component>
<Component class="javax.swing.JLabel" name="lblGameType">
<Properties>
<Property name="text" type="java.lang.String" value="Game Type:"/>
@ -281,6 +301,8 @@
<Property name="text" type="java.lang.String" value="Player 1 (You)"/>
</Properties>
</Component>
<Component class="mage.client.table.NewPlayerPanel" name="player1Panel">
</Component>
<Component class="javax.swing.JSeparator" name="jSeparator3">
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">

View file

@ -27,21 +27,23 @@
*/
package mage.client.dialog;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import javax.swing.*;
import mage.constants.MultiplayerAttackOption;
import mage.constants.RangeOfInfluence;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JOptionPane;
import javax.swing.SpinnerNumberModel;
import mage.cards.decks.importer.DeckImporterUtil;
import mage.client.MageFrame;
import mage.client.components.MageComponents;
import mage.client.table.*;
import mage.client.table.TablePlayerPanel;
import mage.client.util.Event;
import mage.client.util.Listener;
import mage.constants.MatchTimeLimit;
import mage.constants.MultiplayerAttackOption;
import mage.constants.RangeOfInfluence;
import mage.game.match.MatchOptions;
import mage.remote.Session;
import mage.view.GameTypeView;
@ -85,6 +87,8 @@ public class NewTableDialog extends MageDialog {
txtName = new javax.swing.JTextField();
lbDeckType = new javax.swing.JLabel();
cbDeckType = new javax.swing.JComboBox();
lbTimeLimit = new javax.swing.JLabel();
cbTimeLimit = new javax.swing.JComboBox();
lblGameType = new javax.swing.JLabel();
cbGameType = new javax.swing.JComboBox();
lblFreeMulligans = new javax.swing.JLabel();
@ -114,6 +118,8 @@ public class NewTableDialog extends MageDialog {
lbDeckType.setText("Deck Type:");
lbTimeLimit.setText("Time Limit:");
lblGameType.setText("Game Type:");
cbGameType.addActionListener(new java.awt.event.ActionListener() {
@ -177,33 +183,39 @@ public class NewTableDialog extends MageDialog {
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel2))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(16, 16, 16)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(lbDeckType)
.addComponent(lblGameType)
.addComponent(lblName))
.addComponent(lblName)))
.addGroup(layout.createSequentialGroup()
.addGap(30, 30, 30)
.addComponent(lbDeckType)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(cbGameType, javax.swing.GroupLayout.PREFERRED_SIZE, 398, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(lblFreeMulligans)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spnFreeMulligans, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(cbDeckType, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(cbGameType, javax.swing.GroupLayout.PREFERRED_SIZE, 398, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, 546, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addComponent(cbDeckType, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(lbTimeLimit)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(lblFreeMulligans)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spnFreeMulligans, javax.swing.GroupLayout.DEFAULT_SIZE, 50, Short.MAX_VALUE))
.addComponent(txtName))))
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(cbTimeLimit, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE))))))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(btnOK)
@ -233,27 +245,30 @@ public class NewTableDialog extends MageDialog {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jSeparator3, javax.swing.GroupLayout.DEFAULT_SIZE, 625, Short.MAX_VALUE)
.addComponent(jSeparator3, javax.swing.GroupLayout.DEFAULT_SIZE, 633, Short.MAX_VALUE)
.addContainerGap()))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(lblName)
.addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(lbDeckType)
.addComponent(cbDeckType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cbGameType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblGameType)
.addComponent(cbDeckType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cbTimeLimit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lbDeckType)
.addComponent(lbTimeLimit))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spnFreeMulligans, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblFreeMulligans)))
.addComponent(lblFreeMulligans))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cbGameType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblGameType)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
@ -282,7 +297,7 @@ public class NewTableDialog extends MageDialog {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(pnlOtherPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, 140, Short.MAX_VALUE)
.addComponent(pnlOtherPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, 144, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
@ -294,7 +309,7 @@ public class NewTableDialog extends MageDialog {
.addGroup(layout.createSequentialGroup()
.addGap(201, 201, 201)
.addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(240, Short.MAX_VALUE)))
.addContainerGap(244, Short.MAX_VALUE)))
);
pack();
@ -315,6 +330,7 @@ public class NewTableDialog extends MageDialog {
}
options.setDeckType((String) this.cbDeckType.getSelectedItem());
options.setLimited(false);
options.setMatchTimeLimit((MatchTimeLimit) this.cbTimeLimit.getSelectedItem());
options.setAttackOption((MultiplayerAttackOption) this.cbAttackOption.getSelectedItem());
options.setRange((RangeOfInfluence) this.cbRange.getSelectedItem());
options.setWinsNeeded((Integer)this.spnNumWins.getValue());
@ -422,6 +438,7 @@ public class NewTableDialog extends MageDialog {
cbGameType.setModel(new DefaultComboBoxModel(session.getGameTypes().toArray()));
cbDeckType.setModel(new DefaultComboBoxModel(session.getDeckTypes()));
selectLimitedByDefault();
cbTimeLimit.setModel(new DefaultComboBoxModel(MatchTimeLimit.values()));
cbRange.setModel(new DefaultComboBoxModel(RangeOfInfluence.values()));
cbAttackOption.setModel(new DefaultComboBoxModel(MultiplayerAttackOption.values()));
@ -464,13 +481,19 @@ public class NewTableDialog extends MageDialog {
break;
}
}
int timeLimit = Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_TIME_LIMIT, "0"));
for (MatchTimeLimit mtl :MatchTimeLimit.values()) {
if (mtl.getTimeLimit() == timeLimit) {
this.cbTimeLimit.setSelectedItem(mtl);
break;
}
}
cbDeckType.setSelectedItem(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_DECK_TYPE, "Limited"));
String deckFile = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_DECK_FILE, null);
if (deckFile != null) {
this.player1Panel.setDeckFile(deckFile);
}
this.spnNumWins.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_OF_WINS, "2")));
this.spnFreeMulligans.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_OF_FREE_MULLIGANS, "0")));
this.spnNumPlayers.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_PLAYERS, "2")));
int range = Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_RANGE, "1"));
for (RangeOfInfluence roi :RangeOfInfluence.values()) {
@ -497,9 +520,9 @@ public class NewTableDialog extends MageDialog {
private void saveGameSettingsToPrefs(MatchOptions options, String deckFile) {
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_NAME, options.getName());
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_DECK_TYPE, options.getDeckType());
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_TIME_LIMIT, Integer.toString(options.getPriorityTime()));
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_GAME_TYPE, options.getGameType());
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_OF_WINS, Integer.toString(options.getWinsNeeded()));
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_OF_FREE_MULLIGANS, Integer.toString(options.getFreeMulligans()));
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_DECK_FILE, deckFile);
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_PLAYERS, spnNumPlayers.getValue().toString());
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_RANGE, Integer.toString(options.getRange().getRange()));
@ -513,12 +536,14 @@ public class NewTableDialog extends MageDialog {
private javax.swing.JComboBox cbDeckType;
private javax.swing.JComboBox cbGameType;
private javax.swing.JComboBox cbRange;
private javax.swing.JComboBox cbTimeLimit;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JSeparator jSeparator2;
private javax.swing.JSeparator jSeparator3;
private javax.swing.JLabel lbDeckType;
private javax.swing.JLabel lbTimeLimit;
private javax.swing.JLabel lblAttack;
private javax.swing.JLabel lblFreeMulligans;
private javax.swing.JLabel lblGameType;

View file

@ -27,54 +27,57 @@
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
<Component id="pnlPacks" alignment="1" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Component id="lblName" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="txtName" max="32767" attributes="0"/>
<Component id="cbTournamentType" pref="330" max="32767" attributes="0"/>
</Group>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="lblFreeMulligans" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spnFreeMulligans" max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="lblNumWins" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="-2" pref="19" max="-2" attributes="0"/>
<Component id="lblConstructionTime" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="spnConstructTime" pref="48" max="32767" attributes="0"/>
<Component id="spnNumWins" max="32767" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="btnOk" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="btnCancel" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spnNumPlayers" min="-2" pref="45" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="pnlDraftOptions" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="jLabel5" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="103" alignment="0" groupAlignment="1" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spnNumPlayers" min="-2" pref="45" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="pnlDraftOptions" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="jLabel5" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="lblName" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="txtName" min="-2" pref="233" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="lbTimeLimit" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="cbTimeLimit" pref="115" max="32767" attributes="1"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="cbTournamentType" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="lblConstructionTime" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spnConstructTime" min="-2" pref="50" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="lblFreeMulligans" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spnFreeMulligans" min="-2" pref="40" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="lblNumWins" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="spnNumWins" min="-2" pref="41" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
@ -85,39 +88,30 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Component id="txtName" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lblName" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="cbTournamentType" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Component id="lblConstructionTime" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spnConstructTime" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="spnNumWins" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lblNumWins" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spnFreeMulligans" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lblFreeMulligans" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="txtName" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lblName" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lbTimeLimit" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="cbTimeLimit" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lblConstructionTime" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spnConstructTime" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="cbTournamentType" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lblFreeMulligans" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spnFreeMulligans" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lblNumWins" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spnNumWins" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="pnlPacks" pref="65" max="32767" attributes="0"/>
<Component id="pnlPacks" pref="62" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="11" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spnNumPlayers" alignment="0" pref="28" max="32767" attributes="1"/>
<Component id="spnNumPlayers" alignment="0" pref="25" max="32767" attributes="1"/>
<Component id="pnlDraftOptions" max="32767" attributes="1"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
</Group>
@ -140,6 +134,13 @@
</Component>
<Component class="javax.swing.JTextField" name="txtName">
</Component>
<Component class="javax.swing.JLabel" name="lbTimeLimit">
<Properties>
<Property name="text" type="java.lang.String" value="Time Limit:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="cbTimeLimit">
</Component>
<Component class="javax.swing.JLabel" name="lblConstructionTime">
<Properties>
<Property name="text" type="java.lang.String" value="Construction Time (Minutes):"/>
@ -233,7 +234,7 @@
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="txtPlayer1Name" pref="638" max="32767" attributes="0"/>
<Component id="txtPlayer1Name" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>

View file

@ -41,12 +41,13 @@ import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JOptionPane;
import javax.swing.SpinnerNumberModel;
import mage.constants.MultiplayerAttackOption;
import mage.constants.RangeOfInfluence;
import mage.cards.ExpansionSet;
import mage.cards.Sets;
import mage.client.MageFrame;
import mage.client.table.TournamentPlayerPanel;
import mage.constants.MatchTimeLimit;
import mage.constants.MultiplayerAttackOption;
import mage.constants.RangeOfInfluence;
import mage.game.draft.DraftOptions;
import mage.game.draft.DraftOptions.TimingOption;
import mage.game.tournament.LimitedOptions;
@ -86,6 +87,7 @@ public class NewTournamentDialog extends MageDialog {
session = MageFrame.getSession();
this.txtPlayer1Name.setText(session.getUserName());
cbTournamentType.setModel(new DefaultComboBoxModel(session.getTournamentTypes().toArray()));
cbTimeLimit.setModel(new DefaultComboBoxModel(MatchTimeLimit.values()));
cbDraftTiming.setModel(new DefaultComboBoxModel(DraftOptions.TimingOption.values()));
this.setModal(true);
setTournamentOptions();
@ -104,6 +106,8 @@ public class NewTournamentDialog extends MageDialog {
lblName = new javax.swing.JLabel();
txtName = new javax.swing.JTextField();
lbTimeLimit = new javax.swing.JLabel();
cbTimeLimit = new javax.swing.JComboBox();
lblConstructionTime = new javax.swing.JLabel();
spnConstructTime = new javax.swing.JSpinner();
jLabel1 = new javax.swing.JLabel();
@ -131,6 +135,8 @@ public class NewTournamentDialog extends MageDialog {
lblName.setText("Name:");
lbTimeLimit.setText("Time Limit:");
lblConstructionTime.setText("Construction Time (Minutes):");
jLabel1.setText("Tournament Type:");
@ -198,7 +204,7 @@ public class NewTournamentDialog extends MageDialog {
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtPlayer1Name, javax.swing.GroupLayout.DEFAULT_SIZE, 638, Short.MAX_VALUE)))
.addComponent(txtPlayer1Name)))
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
@ -247,76 +253,76 @@ public class NewTournamentDialog extends MageDialog {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(pnlPacks, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(lblName)
.addComponent(jLabel1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(txtName)
.addComponent(cbTournamentType, 0, 330, Short.MAX_VALUE))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(lblFreeMulligans)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spnFreeMulligans)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(lblNumWins))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(19, 19, 19)
.addComponent(lblConstructionTime)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(spnConstructTime, javax.swing.GroupLayout.DEFAULT_SIZE, 48, Short.MAX_VALUE)
.addComponent(spnNumWins)))
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(btnOk)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnCancel))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spnNumPlayers, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(pnlDraftOptions, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel5, javax.swing.GroupLayout.Alignment.LEADING))
.addGap(0, 0, Short.MAX_VALUE)))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spnNumPlayers, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(pnlDraftOptions, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel5, javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(lblName)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, 233, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(lbTimeLimit)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cbTimeLimit, 0, 115, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cbTournamentType, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(lblConstructionTime)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spnConstructTime, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(lblFreeMulligans)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spnFreeMulligans, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(lblNumWins)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(spnNumWins, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE))))))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblName))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(cbTournamentType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblConstructionTime)
.addComponent(spnConstructTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spnNumWins, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblNumWins)
.addComponent(spnFreeMulligans, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblFreeMulligans))))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblName)
.addComponent(lbTimeLimit)
.addComponent(cbTimeLimit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblConstructionTime)
.addComponent(spnConstructTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(cbTournamentType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblFreeMulligans)
.addComponent(spnFreeMulligans, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblNumWins)
.addComponent(spnNumWins, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(pnlPacks, javax.swing.GroupLayout.DEFAULT_SIZE, 65, Short.MAX_VALUE)
.addComponent(pnlPacks, javax.swing.GroupLayout.DEFAULT_SIZE, 62, Short.MAX_VALUE)
.addGap(11, 11, 11)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spnNumPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, 28, Short.MAX_VALUE)
.addComponent(spnNumPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, 25, Short.MAX_VALUE)
.addComponent(pnlDraftOptions, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
@ -357,6 +363,7 @@ public class NewTournamentDialog extends MageDialog {
tOptions.getLimitedOptions().getSetCodes().add(((ExpansionSet) pack.getSelectedItem()).getCode());
}
}
tOptions.getMatchOptions().setMatchTimeLimit((MatchTimeLimit) this.cbTimeLimit.getSelectedItem());
tOptions.getMatchOptions().setDeckType("Limited");
tOptions.getMatchOptions().setWinsNeeded((Integer)this.spnNumWins.getValue());
tOptions.getMatchOptions().setFreeMulligans((Integer)this.spnFreeMulligans.getValue());
@ -512,6 +519,7 @@ public class NewTournamentDialog extends MageDialog {
private javax.swing.JButton btnCancel;
private javax.swing.JButton btnOk;
private javax.swing.JComboBox cbDraftTiming;
private javax.swing.JComboBox cbTimeLimit;
private javax.swing.JComboBox cbTournamentType;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
@ -520,6 +528,7 @@ public class NewTournamentDialog extends MageDialog {
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JPanel jPanel1;
private javax.swing.JLabel lbTimeLimit;
private javax.swing.JLabel lblConstructionTime;
private javax.swing.JLabel lblFreeMulligans;
private javax.swing.JLabel lblName;

View file

@ -92,6 +92,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
// default setting for new table dialog
public static final String KEY_NEW_TABLE_NAME = "newTableName";
public static final String KEY_NEW_TABLE_DECK_TYPE = "newTableDeckType";
public static final String KEY_NEW_TABLE_TIME_LIMIT = "newTableTimeLimit";
public static final String KEY_NEW_TABLE_GAME_TYPE = "newTableGameType";
public static final String KEY_NEW_TABLE_NUMBER_OF_WINS = "newTableNumberOfWins";
public static final String KEY_NEW_TABLE_NUMBER_OF_FREE_MULLIGANS = "newTableNumberOfFreeMulligans";

View file

@ -353,7 +353,7 @@ public final class GamePanel extends javax.swing.JPanel {
}
}
PlayerView player = game.getPlayers().get(playerSeat);
PlayAreaPanel sessionPlayer = new PlayAreaPanel(player, bigCard, gameId, true);
PlayAreaPanel sessionPlayer = new PlayAreaPanel(player, bigCard, gameId, true, game.getPriorityTime());
players.put(player.getPlayerId(), sessionPlayer);
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.BOTH;
@ -385,7 +385,7 @@ public final class GamePanel extends javax.swing.JPanel {
col = numColumns - 1;
}
player = game.getPlayers().get(playerNum);
PlayAreaPanel playerPanel = new PlayAreaPanel(player, bigCard, gameId, false);
PlayAreaPanel playerPanel = new PlayAreaPanel(player, bigCard, gameId, false, game.getPriorityTime());
players.put(player.getPlayerId(), playerPanel);
c = new GridBagConstraints();
c.fill = GridBagConstraints.BOTH;

View file

@ -64,9 +64,9 @@ public class PlayAreaPanel extends javax.swing.JPanel {
addPopupMenu();
}
public PlayAreaPanel(PlayerView player, BigCard bigCard, UUID gameId, boolean me) {
public PlayAreaPanel(PlayerView player, BigCard bigCard, UUID gameId, boolean me, int priorityTime) {
this();
init(player, bigCard, gameId);
init(player, bigCard, gameId, priorityTime);
update(player);
}
@ -99,8 +99,8 @@ public class PlayAreaPanel extends javax.swing.JPanel {
});
}
public final void init(PlayerView player, BigCard bigCard, UUID gameId) {
this.playerPanel.init(gameId, player.getPlayerId(), bigCard);
public final void init(PlayerView player, BigCard bigCard, UUID gameId, int priorityTime) {
this.playerPanel.init(gameId, player.getPlayerId(), bigCard, priorityTime);
this.battlefieldPanel.init(gameId, bigCard);
this.gameId = gameId;
if (MageFrame.getSession().isTestMode()) {

View file

@ -52,7 +52,6 @@ import mage.client.util.Command;
import mage.client.util.ImageHelper;
import mage.client.util.gui.BufferedImageBuilder;
import mage.components.ImagePanel;
import mage.constants.Constants;
import mage.remote.Session;
import mage.utils.timer.PriorityTimer;
import mage.view.CardView;
@ -112,7 +111,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
initComponents();
}
public void init(UUID gameId, UUID playerId, BigCard bigCard) {
public void init(UUID gameId, UUID playerId, BigCard bigCard, int priorityTime) {
this.gameId = gameId;
this.playerId = playerId;
this.bigCard = bigCard;
@ -120,24 +119,27 @@ public class PlayerPanelExt extends javax.swing.JPanel {
cheat.setVisible(session.isTestMode());
cheat.setFocusable(false);
long delay = 1000L;
timer = new PriorityTimer(Constants.PRIORITY_TIME_SEC, delay, new mage.interfaces.Action() {
@Override
public void execute() throws MageException {
// do nothing
}
});
final PriorityTimer pt = timer;
timer.setTaskOnTick(new mage.interfaces.Action() {
@Override
public void execute() throws MageException {
int priorityTimeValue = pt.getCount();
String text = getPriorityTimeLeftString(priorityTimeValue);
PlayerPanelExt.this.avatar.setTopText(text);
PlayerPanelExt.this.avatar.repaint();
}
});
timer.init();
if (priorityTime > 0) {
long delay = 1000L;
timer = new PriorityTimer(priorityTime, delay, new mage.interfaces.Action() {
@Override
public void execute() throws MageException {
// do nothing
}
});
final PriorityTimer pt = timer;
timer.setTaskOnTick(new mage.interfaces.Action() {
@Override
public void execute() throws MageException {
int priorityTimeValue = pt.getCount();
String text = getPriorityTimeLeftString(priorityTimeValue);
PlayerPanelExt.this.avatar.setTopText(text);
PlayerPanelExt.this.avatar.repaint();
}
});
timer.init();
}
}
public void update(PlayerView player) {
@ -206,11 +208,19 @@ public class PlayerPanelExt extends javax.swing.JPanel {
}
}
this.avatar.setText(player.getName());
if (player.getPriorityTimeLeft() != Integer.MAX_VALUE) {
if (this.timer != null) {
if (player.getPriorityTimeLeft() != Integer.MAX_VALUE) {
String priorityTimeValue = getPriorityTimeLeftString(player);
this.timer.setCount(player.getPriorityTimeLeft());
this.avatar.setTopText(priorityTimeValue);
}
if (player.hasPriority()) {
this.timer.resume();
} else {
this.timer.pause();
}
}
this.btnPlayer.setText(player.getName());
if (player.isActive()) {
this.avatar.setBorder(greenBorder);
@ -223,11 +233,6 @@ public class PlayerPanelExt extends javax.swing.JPanel {
this.btnPlayer.setBorder(emptyBorder);
}
if (player.hasPriority()) {
this.timer.resume();
} else {
this.timer.pause();
}
synchronized (this) {
if (player.getTopCard() != null) {

View file

@ -47,6 +47,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.abilities.Mode;
import mage.abilities.Modes;
import mage.abilities.SpellAbility;
import mage.abilities.costs.mana.ManaCosts;
import mage.cards.SplitCard;
@ -184,15 +185,19 @@ public class CardView extends SimpleCardView {
if (card instanceof Spell) {
Spell<?> spell = (Spell<?>) card;
for (SpellAbility spellAbility: spell.getSpellAbilities()) {
if (spellAbility.getTargets().size() > 0) {
setTargets(spellAbility.getTargets());
for(UUID modeId : spellAbility.getModes().getSelectedModes()) {
spellAbility.getModes().setMode(spellAbility.getModes().get(modeId));
if (spellAbility.getTargets().size() > 0) {
setTargets(spellAbility.getTargets());
}
}
}
// show for modal spell, which mode was choosen
if (spell.getSpellAbility().isModal()) {
Mode activeMode = spell.getSpellAbility().getModes().getMode();
if (activeMode != null) {
this.rules.add("<span color='green'><i>Chosen mode: " + activeMode.getEffects().getText(activeMode)+"</i></span>");
Modes modes = spell.getSpellAbility().getModes();
for(UUID modeId : modes.getSelectedModes()) {
modes.setMode(modes.get(modeId));
this.rules.add("<span color='green'><i>Chosen mode: " + spell.getSpellAbility().getEffects().getText(modes.get(modeId))+"</i></span>");
}
}
}

View file

@ -59,6 +59,7 @@ import mage.players.Player;
public class GameView implements Serializable {
private static final long serialVersionUID = 1L;
private int priorityTime;
private List<PlayerView> players = new ArrayList<PlayerView>();
private SimpleCardsView hand;
private Map<String, SimpleCardsView> opponentHands;
@ -75,7 +76,9 @@ public class GameView implements Serializable {
private int turn;
private boolean special = false;
public GameView(GameState state, Game game) {
priorityTime = game.getPriorityTime();
for (Player player: state.getPlayers().values()) {
players.add(new PlayerView(player, state, game));
}
@ -255,4 +258,9 @@ public class GameView implements Serializable {
public boolean getSpecial() {
return special;
}
public int getPriorityTime() {
return priorityTime;
}
}

View file

@ -28,17 +28,17 @@
package mage.view;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Modes;
import mage.abilities.effects.Effect;
import mage.game.Game;
import mage.game.stack.StackAbility;
import mage.target.targetpointer.FixedTarget;
import mage.target.targetpointer.TargetPointer;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/**
*
* @author BetaSteward_at_googlemail.com
@ -68,30 +68,43 @@ public class StackAbilityView extends CardView {
}
private void updateTargets(Game game, StackAbility ability) {
if (ability.getTargets().size() > 0) {
setTargets(ability.getTargets());
} else {
List<UUID> targetList = new ArrayList<UUID>();
for (Effect effect : ability.getEffects()) {
TargetPointer targetPointer = effect.getTargetPointer();
if (targetPointer instanceof FixedTarget) {
targetList.add(((FixedTarget) targetPointer).getTarget());
}
}
if (targetList.size() > 0) {
overrideTargets(targetList);
List<String> names = new ArrayList<String>();
for (UUID uuid : targetList) {
MageObject mageObject = game.getObject(uuid);
if (mageObject != null) {
names.add(mageObject.getName());
List<String> names = new ArrayList<String>();
for(UUID modeId : ability.getModes().getSelectedModes()) {
ability.getModes().setMode(ability.getModes().get(modeId));
if (ability.getTargets().size() > 0) {
setTargets(ability.getTargets());
} else {
List<UUID> targetList = new ArrayList<UUID>();
for (Effect effect : ability.getEffects()) {
TargetPointer targetPointer = effect.getTargetPointer();
if (targetPointer instanceof FixedTarget) {
targetList.add(((FixedTarget) targetPointer).getTarget());
}
}
if (!names.isEmpty()) {
getRules().add("<i>Targets: " + names.toString() + "</i>");
if (targetList.size() > 0) {
overrideTargets(targetList);
for (UUID uuid : targetList) {
MageObject mageObject = game.getObject(uuid);
if (mageObject != null) {
names.add(mageObject.getName());
}
}
}
}
}
if (!names.isEmpty()) {
getRules().add("<i>Targets: " + names.toString() + "</i>");
}
// show for modal ability, which mode was choosen
if (ability.isModal()) {
Modes modes = ability.getModes();
for(UUID modeId : modes.getSelectedModes()) {
modes.setMode(modes.get(modeId));
this.rules.add("<span color='green'><i>Chosen mode: " + ability.getEffects().getText(modes.get(modeId))+"</i></span>");
}
}
}
public CardView getSourceCard() {

View file

@ -1230,7 +1230,13 @@ public class ComputerPlayer<T extends ComputerPlayer<T>> extends PlayerImpl<T> i
return modes.getMode();
}
//TODO: improve this;
return modes.values().iterator().next();
for (Mode mode: modes.values()) {
if (!modes.getSelectedModes().contains(mode.getId()) // select only modes not already selected
&& mode.getTargets().canChoose(source.getSourceId(), source.getControllerId(), game)) { // and where targets are available
return mode;
}
}
return null;
}
@Override

View file

@ -782,18 +782,23 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
MageObject obj = game.getObject(source.getSourceId());
Map<UUID, String> modeMap = new LinkedHashMap<UUID, String>();
for (Mode mode: modes.values()) {
String modeText = mode.getEffects().getText(mode);
if (obj != null) {
modeText = modeText.replace("{source}", obj.getName());
if (!modes.getSelectedModes().contains(mode.getId()) // show only modes not already selected
&& mode.getTargets().canChoose(source.getSourceId(), source.getControllerId(), game)) { // and where targets are available
String modeText = mode.getEffects().getText(mode);
if (obj != null) {
modeText = modeText.replace("{source}", obj.getName());
}
modeMap.put(mode.getId(), modeText);
}
modeMap.put(mode.getId(), modeText);
}
game.fireGetModeEvent(playerId, "Choose Mode", modeMap);
waitForResponse(game);
if (response.getUUID() != null) {
for (Mode mode: modes.values()) {
if (mode.getId().equals(response.getUUID())) {
return mode;
if (modeMap.size() > 0) {
game.fireGetModeEvent(playerId, "Choose Mode", modeMap);
waitForResponse(game);
if (response.getUUID() != null) {
for (Mode mode: modes.values()) {
if (mode.getId().equals(response.getUUID())) {
return mode;
}
}
}
}

View file

@ -137,7 +137,7 @@ public class GameController implements GameCallback {
throw new IllegalStateException("INIT_TIMER: playerId can't be null");
}
long delay = 250L; // run each 250 ms
timer = new PriorityTimer(Constants.PRIORITY_TIME_SEC, delay, new Action() {
timer = new PriorityTimer(game.getPriorityTime(), delay, new Action() {
@Override
public void execute() throws MageException {
game.concede(initPlayerId);
@ -433,10 +433,12 @@ public class GameController implements GameCallback {
}
private synchronized void updateGame() {
for (Player player: game.getState().getPlayers().values()) {
PriorityTimer timer = timers.get(player.getId());
if (timer != null) {
player.setPriorityTimeLeft(timer.getCount());
if (!timers.isEmpty()) {
for (Player player: game.getState().getPlayers().values()) {
PriorityTimer timer = timers.get(player.getId());
if (timer != null) {
player.setPriorityTimeLeft(timer.getCount());
}
}
}
for (final GameSession gameSession: gameSessions.values()) {

View file

@ -0,0 +1,52 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.championsofkamigawa;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class KodamasReach extends mage.sets.commander.KodamasReach {
public KodamasReach(UUID ownerId) {
super(ownerId);
this.cardNumber = 225;
this.expansionSetCode = "CHK";
}
public KodamasReach(final KodamasReach card) {
super(card);
}
@Override
public KodamasReach copy() {
return new KodamasReach(this);
}
}

View file

@ -0,0 +1,88 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.commander;
import java.util.UUID;
import mage.abilities.Mode;
import mage.abilities.effects.common.DestroyAllEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.filter.Filter;
import mage.filter.common.FilterArtifactPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.common.FilterEnchantmentPermanent;
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
/**
*
* @author LevelX2
*/
public class AustereCommand extends CardImpl<AustereCommand> {
private static final FilterCreaturePermanent filter3orLess = new FilterCreaturePermanent("creatures with converted mana cost 3 or less");
private static final FilterCreaturePermanent filter4orMore = new FilterCreaturePermanent("creatures with converted mana cost 4 or greater");
static {
filter3orLess.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, 4));
filter4orMore.add(new ConvertedManaCostPredicate(Filter.ComparisonType.GreaterThan, 3));
}
public AustereCommand(UUID ownerId) {
super(ownerId, 8, "Austere Command", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{4}{W}{W}");
this.expansionSetCode = "CMD";
this.color.setWhite(true);
// Choose two -
this.getSpellAbility().getModes().setMinModes(2);
this.getSpellAbility().getModes().setMaxModes(2);
// Destroy all artifacts;
this.getSpellAbility().addEffect(new DestroyAllEffect(new FilterArtifactPermanent("artifacts")));
// or destroy all enchantments;
Mode mode = new Mode();
mode.getEffects().add(new DestroyAllEffect(new FilterEnchantmentPermanent("enchantments")));
this.getSpellAbility().getModes().addMode(mode);
// or destroy all creatures with converted mana cost 3 or less;
mode = new Mode();
mode.getEffects().add(new DestroyAllEffect(filter3orLess));
this.getSpellAbility().getModes().addMode(mode);
// or destroy all creatures with converted mana cost 4 or greater.
mode = new Mode();
mode.getEffects().add(new DestroyAllEffect(filter4orMore));
this.getSpellAbility().getModes().addMode(mode);
}
public AustereCommand(final AustereCommand card) {
super(card);
}
@Override
public AustereCommand copy() {
return new AustereCommand(this);
}
}

View file

@ -0,0 +1,139 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.commander;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.common.FilterBasicLandCard;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.common.TargetCardInLibrary;
/**
*
* @author LevelX2
*/
public class KodamasReach extends CardImpl<KodamasReach> {
public KodamasReach(UUID ownerId) {
super(ownerId, 163, "Kodama's Reach", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{2}{G}");
this.expansionSetCode = "CMD";
this.subtype.add("Arcane");
this.color.setGreen(true);
// Search your library for up to two basic land cards, reveal those cards, and put one onto the battlefield tapped and the other into your hand. Then shuffle your library.
this.getSpellAbility().addEffect(new KodamasReachEffect());
}
public KodamasReach(final KodamasReach card) {
super(card);
}
@Override
public KodamasReach copy() {
return new KodamasReach(this);
}
}
class KodamasReachEffect extends OneShotEffect<KodamasReachEffect> {
protected static final FilterCard filter = new FilterCard("card to put on the battlefield tapped");
public KodamasReachEffect() {
super(Outcome.PutLandInPlay);
staticText = "Search your library for up to two basic land cards, reveal those cards, and put one onto the battlefield tapped and the other into your hand. Then shuffle your library";
}
public KodamasReachEffect(final KodamasReachEffect effect) {
super(effect);
}
@Override
public KodamasReachEffect copy() {
return new KodamasReachEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
TargetCardInLibrary target = new TargetCardInLibrary(0, 2, new FilterBasicLandCard());
Player player = game.getPlayer(source.getControllerId());
if (player.searchLibrary(target, game)) {
if (target.getTargets().size() > 0) {
Cards revealed = new CardsImpl();
for (UUID cardId: (List<UUID>)target.getTargets()) {
Card card = player.getLibrary().getCard(cardId, game);
revealed.add(card);
}
player.revealCards("Kodama's Reach", revealed, game);
if (target.getTargets().size() == 2) {
TargetCard target2 = new TargetCard(Zone.PICK, filter);
target2.setRequired(true);
player.choose(Outcome.Benefit, revealed, target2, game);
Card card = revealed.get(target2.getFirstTarget(), game);
card.putOntoBattlefield(game, Zone.LIBRARY, source.getId(), source.getControllerId());
revealed.remove(card);
Permanent permanent = game.getPermanent(card.getId());
if (permanent != null) {
permanent.setTapped(true);
}
card = revealed.getCards(game).iterator().next();
card.moveToZone(Zone.HAND, source.getId(), game, false);
}
else if (target.getTargets().size() == 1) {
Card card = revealed.getCards(game).iterator().next();
card.putOntoBattlefield(game, Zone.LIBRARY, source.getId(), source.getControllerId());
Permanent permanent = game.getPermanent(card.getId());
if (permanent != null) {
permanent.setTapped(true);
}
}
}
player.shuffleLibrary(game);
return true;
}
player.shuffleLibrary(game);
return false;
}
}

View file

@ -0,0 +1,52 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.darksteel;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class StirThePride extends mage.sets.modernmasters.StirThePride {
public StirThePride(UUID ownerId) {
super(ownerId);
this.cardNumber = 16;
this.expansionSetCode = "DST";
}
public StirThePride(final StirThePride card) {
super(card);
}
@Override
public StirThePride copy() {
return new StirThePride(this);
}
}

View file

@ -0,0 +1,158 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.elspethvstezzeret;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.TapTargetEffect;
import mage.abilities.keyword.EntwineAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.PhaseStep;
import mage.constants.Rarity;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author LevelX2
*/
public class BlindingBeam extends CardImpl<BlindingBeam> {
public BlindingBeam(UUID ownerId) {
super(ownerId, 28, "Blinding Beam", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{2}{W}");
this.expansionSetCode = "DDF";
this.color.setWhite(true);
// Choose one -
this.getSpellAbility().getModes().setMinModes(1);
this.getSpellAbility().getModes().setMaxModes(1);
// Tap two target creatures;
this.getSpellAbility().addEffect(new TapTargetEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent(2,2));
// or creatures don't untap during target player's next untap step.
Mode mode = new Mode();
mode.getEffects().add(new BlindingBeamEffect());
this.getSpellAbility().getModes().addMode(mode);
// Entwine {1}
this.addAbility(new EntwineAbility("{1}"));
}
public BlindingBeam(final BlindingBeam card) {
super(card);
}
@Override
public BlindingBeam copy() {
return new BlindingBeam(this);
}
}
class BlindingBeamEffect extends OneShotEffect<BlindingBeamEffect> {
public BlindingBeamEffect() {
super(Outcome.Tap);
staticText = "creatures don't untap during target player's next untap step";
}
public BlindingBeamEffect(final BlindingBeamEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getFirstTarget());
if (player != null) {
for (Permanent creature: game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId(), game)) {
game.addEffect(new BlindingBeamEffect2(creature.getId()), source);
}
return true;
}
return false;
}
@Override
public BlindingBeamEffect copy() {
return new BlindingBeamEffect(this);
}
}
class BlindingBeamEffect2 extends ReplacementEffectImpl<BlindingBeamEffect2> {
protected UUID creatureId;
public BlindingBeamEffect2(UUID creatureId) {
super(Duration.OneUse, Outcome.Detriment);
this.creatureId = creatureId;
}
public BlindingBeamEffect2(final BlindingBeamEffect2 effect) {
super(effect);
creatureId = effect.creatureId;
}
@Override
public BlindingBeamEffect2 copy() {
return new BlindingBeamEffect2(this);
}
@Override
public boolean apply(Game game, Ability source) {
return false;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
used = true;
return true;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (game.getTurn().getStepType() == PhaseStep.UNTAP &&
event.getType() == EventType.UNTAP &&
event.getTargetId().equals(creatureId)) {
return true;
}
return false;
}
}

View file

@ -0,0 +1,105 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.eventide;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.IslandwalkAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author LevelX2
*/
public class ColdEyedSelkie extends CardImpl<ColdEyedSelkie> {
public ColdEyedSelkie(UUID ownerId) {
super(ownerId, 149, "Cold-Eyed Selkie", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{G/U}{G/U}");
this.expansionSetCode = "EVE";
this.subtype.add("Merfolk");
this.subtype.add("Rogue");
this.color.setBlue(true);
this.color.setGreen(true);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// Islandwalk
this.addAbility(new IslandwalkAbility());
// Whenever Cold-Eyed Selkie deals combat damage to a player, you may draw that many cards.
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new ColdEyeSelkieEffect(), true, true));
}
public ColdEyedSelkie(final ColdEyedSelkie card) {
super(card);
}
@Override
public ColdEyedSelkie copy() {
return new ColdEyedSelkie(this);
}
}
class ColdEyeSelkieEffect extends OneShotEffect<ColdEyeSelkieEffect> {
public ColdEyeSelkieEffect() {
super(Outcome.DrawCard);
this.staticText = "draw that many cards";
}
public ColdEyeSelkieEffect(final ColdEyeSelkieEffect effect) {
super(effect);
}
@Override
public ColdEyeSelkieEffect copy() {
return new ColdEyeSelkieEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
int amount = (Integer) getValue("damage");
if (amount > 0) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
controller.drawCards(amount, game);
return true;
}
}
return false;
}
}

View file

@ -0,0 +1,84 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.eventide;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.RetraceAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.TimingRule;
import mage.filter.common.FilterLandCard;
import mage.game.permanent.token.Token;
/**
*
* @author LevelX2
*/
public class WormHarvest extends CardImpl<WormHarvest> {
public WormHarvest(UUID ownerId) {
super(ownerId, 131, "Worm Harvest", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{2}{B/G}{B/G}{B/G}");
this.expansionSetCode = "EVE";
this.color.setGreen(true);
this.color.setBlack(true);
// Put a 1/1 black and green Worm creature token onto the battlefield for each land card in your graveyard.
CardsInControllerGraveyardCount value = new CardsInControllerGraveyardCount(new FilterLandCard());
this.getSpellAbility().addEffect(new CreateTokenEffect(new WormHarvestToken(), value));
// Retrace
this.addAbility(new RetraceAbility(new ManaCostsImpl("{2}{B/G}{B/G}{B/G}"), TimingRule.SORCERY));
}
public WormHarvest(final WormHarvest card) {
super(card);
}
@Override
public WormHarvest copy() {
return new WormHarvest(this);
}
}
class WormHarvestToken extends Token {
WormHarvestToken() {
super("Worm", "1/1 black and green Worm creature token");
cardType.add(CardType.CREATURE);
color.setBlack(true);
color.setGreen(true);
subtype.add("Worm");
power = new MageInt(1);
toughness = new MageInt(1);
}
}

View file

@ -0,0 +1,52 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.fifthdawn;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class RudeAwakening extends mage.sets.modernmasters.RudeAwakening {
public RudeAwakening(UUID ownerId) {
super(ownerId);
this.cardNumber = 92;
this.expansionSetCode = "5DN";
}
public RudeAwakening(final RudeAwakening card) {
super(card);
}
@Override
public RudeAwakening copy() {
return new RudeAwakening(this);
}
}

View file

@ -0,0 +1,54 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.futuresight;
import java.util.UUID;
import mage.constants.Rarity;
/**
*
* @author LevelX2
*/
public class GrinningIgnus extends mage.sets.modernmasters.GrinningIgnus {
public GrinningIgnus(UUID ownerId) {
super(ownerId);
this.cardNumber = 116;
this.expansionSetCode = "FUT";
this.rarity = Rarity.COMMON;
}
public GrinningIgnus(final GrinningIgnus card) {
super(card);
}
@Override
public GrinningIgnus copy() {
return new GrinningIgnus(this);
}
}

View file

@ -0,0 +1,54 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.futuresight;
import java.util.UUID;
import mage.constants.Rarity;
/**
*
* @author LevelX2
*/
public class Imperiosaur extends mage.sets.modernmasters.Imperiosaur {
public Imperiosaur(UUID ownerId) {
super(ownerId);
this.cardNumber = 145;
this.expansionSetCode = "FUT";
this.rarity = Rarity.UNCOMMON;
}
public Imperiosaur(final Imperiosaur card) {
super(card);
}
@Override
public Imperiosaur copy() {
return new Imperiosaur(this);
}
}

View file

@ -0,0 +1,52 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.futuresight;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class Riftsweeper extends mage.sets.modernmasters.Riftsweeper {
public Riftsweeper(UUID ownerId) {
super(ownerId);
this.cardNumber = 136;
this.expansionSetCode = "FUT";
}
public Riftsweeper(final Riftsweeper card) {
super(card);
}
@Override
public Riftsweeper copy() {
return new Riftsweeper(this);
}
}

View file

@ -64,44 +64,23 @@ public class ClanDefiance extends CardImpl<ClanDefiance> {
this.color.setRed(true);
this.color.setGreen(true);
// Choose one or more - Clan Defiance deals X damage to target creature with flying; Clan Defiance deals X damage to target creature without flying; and/or Clan Defiance deals X damage to target player.
// Choose one or more -
this.getSpellAbility().getModes().setMinModes(1);
this.getSpellAbility().getModes().setMaxModes(3);
// Clan Defiance deals X damage to target creature with flying;
this.getSpellAbility().addEffect(new DamageTargetEffect(new ManacostVariableValue()));
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter));
// Clan Defiance deals X damage to target creature without flying;
Mode mode1 = new Mode();
mode1.getEffects().add(new DamageTargetEffect(new ManacostVariableValue()));
mode1.getTargets().add(new TargetCreaturePermanent(filter2));
this.getSpellAbility().addMode(mode1);
// and/or Clan Defiance deals X damage to target player.
Mode mode2 = new Mode();
mode2.getEffects().add(new DamageTargetEffect(new ManacostVariableValue()));
mode2.getTargets().add(new TargetPlayer());
this.getSpellAbility().addMode(mode2);
Mode mode3 = new Mode();
mode3.getEffects().add(new DamageTargetEffect(new ManacostVariableValue(), true, "target creature with flying, then deals X damage to target creature without flying"));
mode3.getTargets().add(new TargetCreaturePermanent(filter));
mode3.getTargets().add(new TargetCreaturePermanent(filter2));
this.getSpellAbility().addMode(mode3);
Mode mode4 = new Mode();
mode4.getEffects().add(new DamageTargetEffect(new ManacostVariableValue(), true, "target creature with flying, then deals X damage to target player"));
mode4.getTargets().add(new TargetCreaturePermanent(filter));
mode4.getTargets().add(new TargetPlayer());
this.getSpellAbility().addMode(mode4);
Mode mode5 = new Mode();
mode5.getEffects().add(new DamageTargetEffect(new ManacostVariableValue(), true, "target creature without flying, then deals X damage to target player"));
mode5.getTargets().add(new TargetCreaturePermanent(filter2));
mode5.getTargets().add(new TargetPlayer());
this.getSpellAbility().addMode(mode5);
Mode mode6 = new Mode();
mode6.getEffects().add(new DamageTargetEffect(new ManacostVariableValue(), true, "target creature with flying, then deals X damage to target creature without flying, then deals X damage to target player"));
mode6.getTargets().add(new TargetCreaturePermanent(filter));
mode6.getTargets().add(new TargetCreaturePermanent(filter2));
mode6.getTargets().add(new TargetPlayer());
this.getSpellAbility().addMode(mode6);
}
public ClanDefiance(final ClanDefiance card) {

View file

@ -0,0 +1,52 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.lorwyn;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class AustereCommand extends mage.sets.commander.AustereCommand {
public AustereCommand(UUID ownerId) {
super(ownerId);
this.cardNumber = 3;
this.expansionSetCode = "LRW";
}
public AustereCommand(final AustereCommand card) {
super(card);
}
@Override
public AustereCommand copy() {
return new AustereCommand(this);
}
}

View file

@ -0,0 +1,52 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.lorwyn;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class BlindSpotGiant extends mage.sets.modernmasters.BlindSpotGiant {
public BlindSpotGiant(UUID ownerId) {
super(ownerId);
this.cardNumber = 153;
this.expansionSetCode = "LRW";
}
public BlindSpotGiant(final BlindSpotGiant card) {
super(card);
}
@Override
public BlindSpotGiant copy() {
return new BlindSpotGiant(this);
}
}

View file

@ -0,0 +1,54 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.lorwyn;
import java.util.UUID;
import mage.constants.Rarity;
/**
*
* @author LevelX2
*/
public class CrushUnderfoot extends mage.sets.modernmasters.CrushUnderfoot {
public CrushUnderfoot(UUID ownerId) {
super(ownerId);
this.cardNumber = 162;
this.expansionSetCode = "LRW";
this.rarity = Rarity.UNCOMMON;
}
public CrushUnderfoot(final CrushUnderfoot card) {
super(card);
}
@Override
public CrushUnderfoot copy() {
return new CrushUnderfoot(this);
}
}

View file

@ -45,7 +45,6 @@ import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPlayer;
import mage.target.TargetSpell;
import mage.target.common.TargetCreaturePermanent;
@ -61,41 +60,25 @@ public class CrypticCommand extends CardImpl<CrypticCommand> {
this.color.setBlue(true);
// Choose two - Counter target spell; or return target permanent to its owner's hand; or tap all creatures your opponents control; or draw a card.
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
// Choose two -
this.getSpellAbility().getModes().setMinModes(2);
this.getSpellAbility().getModes().setMaxModes(2);
// Counter target spell;
this.getSpellAbility().addEffect(new CounterTargetEffect());
this.getSpellAbility().addTarget(new TargetSpell());
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect());
this.getSpellAbility().addEffect(new CounterSecondTargetEffect());
Mode mode1 = new Mode();
mode1.getTargets().add(new TargetSpell());
mode1.getEffects().add(new CounterTargetEffect());
mode1.getEffects().add(new CrypticCommandEffect());
this.getSpellAbility().addMode(mode1);
Mode mode2 = new Mode();
mode2.getTargets().add(new TargetSpell());
mode2.getEffects().add(new CounterTargetEffect());
mode2.getEffects().add(new DrawCardControllerEffect(1));
this.getSpellAbility().addMode(mode2);
Mode mode3 = new Mode();
mode3.getTargets().add(new TargetCreaturePermanent());
mode3.getEffects().add(new ReturnToHandTargetEffect());
mode3.getEffects().add(new CrypticCommandEffect());
this.getSpellAbility().addMode(mode3);
Mode mode4 = new Mode();
mode4.getTargets().add(new TargetCreaturePermanent());
mode4.getEffects().add(new ReturnToHandTargetEffect());
mode4.getEffects().add(new DrawCardControllerEffect(1));
this.getSpellAbility().addMode(mode4);
Mode mode5 = new Mode();
mode5.getTargets().add(new TargetPlayer());
mode5.getEffects().add(new CrypticCommandEffect());
mode5.getEffects().add(new DrawCardControllerEffect(1));
this.getSpellAbility().addMode(mode5);
// or return target permanent to its owner's hand;
Mode mode = new Mode();
mode.getEffects().add(new ReturnToHandTargetEffect());
mode.getTargets().add(new TargetCreaturePermanent());
this.getSpellAbility().getModes().addMode(mode);
// or tap all creatures your opponents control;
mode = new Mode();
mode.getEffects().add(new CrypticCommandEffect());
this.getSpellAbility().getModes().addMode(mode);
// or draw a card.
mode = new Mode();
mode.getEffects().add(new DrawCardControllerEffect(1));
this.getSpellAbility().getModes().addMode(mode);
}
public CrypticCommand(final CrypticCommand card) {

View file

@ -0,0 +1,52 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.lorwyn;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class DreamspoilerWitches extends mage.sets.modernmasters.DreamspoilerWitches {
public DreamspoilerWitches(UUID ownerId) {
super(ownerId);
this.cardNumber = 108;
this.expansionSetCode = "LRW";
}
public DreamspoilerWitches(final DreamspoilerWitches card) {
super(card);
}
@Override
public DreamspoilerWitches copy() {
return new DreamspoilerWitches(this);
}
}

View file

@ -0,0 +1,54 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.lorwyn;
import java.util.UUID;
import mage.constants.Rarity;
/**
*
* @author LevelX2
*/
public class MaskedAdmirers extends mage.sets.modernmasters.MaskedAdmirers {
public MaskedAdmirers(UUID ownerId) {
super(ownerId);
this.cardNumber = 230;
this.expansionSetCode = "LRW";
this.rarity = Rarity.RARE;
}
public MaskedAdmirers(final MaskedAdmirers card) {
super(card);
}
@Override
public MaskedAdmirers copy() {
return new MaskedAdmirers(this);
}
}

View file

@ -0,0 +1,131 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.lorwyn;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.GainLifeTargetEffect;
import mage.abilities.effects.common.PutOnLibraryTargetEffect;
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.Target;
import mage.target.TargetPermanent;
import mage.target.TargetPlayer;
import mage.target.common.TargetCardInLibrary;
/**
*
* @author LevelX2
*/
public class PrimalCommand extends CardImpl<PrimalCommand> {
private static final FilterPermanent filterNonCreature = new FilterPermanent("noncreature permanent");
static {
filterNonCreature.add(Predicates.not(new CardTypePredicate(CardType.CREATURE)));
}
public PrimalCommand(UUID ownerId) {
super(ownerId, 233, "Primal Command", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{3}{G}{G}");
this.expansionSetCode = "LRW";
this.color.setGreen(true);
// Choose two -
this.getSpellAbility().getModes().setMinModes(2);
this.getSpellAbility().getModes().setMaxModes(2);
// Target player gains 7 life;
this.getSpellAbility().addEffect(new GainLifeTargetEffect(7));
this.getSpellAbility().addTarget(new TargetPlayer(true));
// or put target noncreature permanent on top of its owner's library;
Mode mode = new Mode();
mode.getEffects().add(new PutOnLibraryTargetEffect(true));
Target target = new TargetPermanent(filterNonCreature);
target.setRequired(true);
mode.getTargets().add(target);
this.getSpellAbility().getModes().addMode(mode);
// or target player shuffles his or her graveyard into his or her library;
mode = new Mode();
mode.getEffects().add(new PrimalCommandShuffleGraveyardEffect());
mode.getTargets().add(new TargetPlayer());
this.getSpellAbility().getModes().addMode(mode);
// or search your library for a creature card, reveal it, put it into your hand, then shuffle your library.
mode = new Mode();
mode.getEffects().add(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(new FilterCreatureCard()), true, true));
this.getSpellAbility().getModes().addMode(mode);
}
public PrimalCommand(final PrimalCommand card) {
super(card);
}
@Override
public PrimalCommand copy() {
return new PrimalCommand(this);
}
}
class PrimalCommandShuffleGraveyardEffect extends OneShotEffect<PrimalCommandShuffleGraveyardEffect> {
public PrimalCommandShuffleGraveyardEffect() {
super(Outcome.Neutral);
this.staticText = "target player shuffles his or her graveyard into his or her library";
}
public PrimalCommandShuffleGraveyardEffect(final PrimalCommandShuffleGraveyardEffect effect) {
super(effect);
}
@Override
public PrimalCommandShuffleGraveyardEffect copy() {
return new PrimalCommandShuffleGraveyardEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getFirstTarget());
if (player != null) {
player.getLibrary().addAll(player.getGraveyard().getCards(game), game);
player.getGraveyard().clear();
player.getLibrary().shuffle();
return true;
}
return false;
}
}

View file

@ -0,0 +1,52 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.lorwyn;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class ThievingSprite extends mage.sets.modernmasters.ThievingSprite {
public ThievingSprite(UUID ownerId) {
super(ownerId);
this.cardNumber = 143;
this.expansionSetCode = "LRW";
}
public ThievingSprite(final ThievingSprite card) {
super(card);
}
@Override
public ThievingSprite copy() {
return new ThievingSprite(this);
}
}

View file

@ -0,0 +1,52 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.mercadianmasques;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class SqueeGoblinNabob extends mage.sets.tenth.SqueeGoblinNabob {
public SqueeGoblinNabob(UUID ownerId) {
super(ownerId);
this.cardNumber = 214;
this.expansionSetCode = "MMQ";
}
public SqueeGoblinNabob(final SqueeGoblinNabob card) {
super(card);
}
@Override
public SqueeGoblinNabob copy() {
return new SqueeGoblinNabob(this);
}
}

View file

@ -0,0 +1,52 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.mirrodin;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class BlindingBeam extends mage.sets.elspethvstezzeret.BlindingBeam {
public BlindingBeam(UUID ownerId) {
super(ownerId);
this.cardNumber = 7;
this.expansionSetCode = "MRD";
}
public BlindingBeam(final BlindingBeam card) {
super(card);
}
@Override
public BlindingBeam copy() {
return new BlindingBeam(this);
}
}

View file

@ -0,0 +1,52 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.mirrodin;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class ToothAndNail extends mage.sets.modernmasters.ToothAndNail {
public ToothAndNail(UUID ownerId) {
super(ownerId);
this.cardNumber = 134;
this.expansionSetCode = "MRD";
}
public ToothAndNail(final ToothAndNail card) {
super(card);
}
@Override
public ToothAndNail copy() {
return new ToothAndNail(this);
}
}

View file

@ -0,0 +1,119 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.modernmasters;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.RestrictionEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
public class BlindSpotGiant extends CardImpl<BlindSpotGiant> {
public BlindSpotGiant(UUID ownerId) {
super(ownerId, 105, "Blind-Spot Giant", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{R}");
this.expansionSetCode = "MMA";
this.subtype.add("Giant");
this.subtype.add("Warrior");
this.color.setRed(true);
this.power = new MageInt(4);
this.toughness = new MageInt(3);
// Blind-Spot Giant can't attack or block unless you control another Giant.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BlindSpotGiantEffect()));
}
public BlindSpotGiant(final BlindSpotGiant card) {
super(card);
}
@Override
public BlindSpotGiant copy() {
return new BlindSpotGiant(this);
}
}
class BlindSpotGiantEffect extends RestrictionEffect<BlindSpotGiantEffect> {
private static final FilterControlledPermanent filter = new FilterControlledPermanent("another Giant");
static {
filter.add(new SubtypePredicate("Giant"));
filter.add(new AnotherPredicate());
}
public BlindSpotGiantEffect() {
super(Duration.WhileOnBattlefield);
staticText = "{this} can't attack or block unless you control another Giant";
}
public BlindSpotGiantEffect(final BlindSpotGiantEffect effect) {
super(effect);
}
@Override
public BlindSpotGiantEffect copy() {
return new BlindSpotGiantEffect(this);
}
@Override
public boolean canAttack(Game game) {
return false;
}
@Override
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
return false;
}
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
if (permanent.getId().equals(source.getSourceId())) {
if (game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game) > 0) {
return false;
}
return true;
} // do not apply to other creatures.
return false;
}
}

View file

@ -0,0 +1,52 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.modernmasters;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class BlindingBeam extends mage.sets.elspethvstezzeret.BlindingBeam {
public BlindingBeam(UUID ownerId) {
super(ownerId);
this.cardNumber = 7;
this.expansionSetCode = "MMA";
}
public BlindingBeam(final BlindingBeam card) {
super(card);
}
@Override
public BlindingBeam copy() {
return new BlindingBeam(this);
}
}

View file

@ -0,0 +1,52 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.modernmasters;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class ColdEyedSelkie extends mage.sets.eventide.ColdEyedSelkie {
public ColdEyedSelkie(UUID ownerId) {
super(ownerId);
this.cardNumber = 186;
this.expansionSetCode = "MMA";
}
public ColdEyedSelkie(final ColdEyedSelkie card) {
super(card);
}
@Override
public ColdEyedSelkie copy() {
return new ColdEyedSelkie(this);
}
}

View file

@ -0,0 +1,119 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.modernmasters;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.Target;
import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author LevelX2
*/
public class CrushUnderfoot extends CardImpl<CrushUnderfoot> {
public CrushUnderfoot(UUID ownerId) {
super(ownerId, 109, "Crush Underfoot", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{R}");
this.expansionSetCode = "MMA";
this.supertype.add("Tribal");
this.subtype.add("Giant");
this.color.setRed(true);
// Choose a Giant creature you control. It deals damage equal to its power to target creature.
this.getSpellAbility().addEffect(new CrushUnderfootEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("creature damage is dealt to")));
}
public CrushUnderfoot(final CrushUnderfoot card) {
super(card);
}
@Override
public CrushUnderfoot copy() {
return new CrushUnderfoot(this);
}
}
class CrushUnderfootEffect extends OneShotEffect<CrushUnderfootEffect> {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("Giant you control");
static {
filter.add(new SubtypePredicate("Giant"));
}
public CrushUnderfootEffect() {
super(Outcome.Damage);
this.staticText = "Choose a Giant creature you control. It deals damage equal to its power to target creature";
}
public CrushUnderfootEffect(final CrushUnderfootEffect effect) {
super(effect);
}
@Override
public CrushUnderfootEffect copy() {
return new CrushUnderfootEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
// Choose a Giant creature you control (not targeted, happens during effect resolving )
Target target = new TargetControlledCreaturePermanent(1,1, filter,false);
if (target.canChoose(source.getSourceId(), controller.getId(), game)
&& controller.chooseTarget(outcome, target, source, game)) {
Permanent giant = game.getPermanent(target.getFirstTarget());
if (giant != null) {
game.informPlayers(new StringBuilder("Crush Underfoot: Choosen Giant is").append(giant.getName()).toString());
Permanent targetCreature = game.getPermanent(this.getTargetPointer().getFirst(game, source));
if (targetCreature != null) {
targetCreature.damage(giant.getPower().getValue(), source.getSourceId(), game, true, false);
return true;
}
}
}
}
return false;
}
}

View file

@ -0,0 +1,107 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.modernmasters;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.continious.BoostTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author LevelX2
*/
public class DreamspoilerWitches extends CardImpl<DreamspoilerWitches> {
public DreamspoilerWitches(UUID ownerId) {
super(ownerId, 81, "Dreamspoiler Witches", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{B}");
this.expansionSetCode = "MMA";
this.subtype.add("Faerie");
this.subtype.add("Wizard");
this.color.setBlack(true);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Whenever you cast a spell during an opponent's turn, you may have target creature get -1/-1 until end of turn.
this.addAbility(new DreamspoilerWitchesTriggeredAbility());
}
public DreamspoilerWitches(final DreamspoilerWitches card) {
super(card);
}
@Override
public DreamspoilerWitches copy() {
return new DreamspoilerWitches(this);
}
}
class DreamspoilerWitchesTriggeredAbility extends TriggeredAbilityImpl<DreamspoilerWitchesTriggeredAbility> {
DreamspoilerWitchesTriggeredAbility() {
super(Zone.BATTLEFIELD, new BoostTargetEffect(-1,-1, Duration.EndOfTurn), true);
this.addTarget(new TargetCreaturePermanent(true));
}
DreamspoilerWitchesTriggeredAbility(final DreamspoilerWitchesTriggeredAbility ability) {
super(ability);
}
@Override
public DreamspoilerWitchesTriggeredAbility copy() {
return new DreamspoilerWitchesTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SPELL_CAST
&& event.getPlayerId().equals(this.controllerId)
&& game.getOpponents(this.controllerId).contains(game.getActivePlayerId())) {
return true;
}
return false;
}
@Override
public String getRule() {
return "Whenever you cast a spell during an opponent's turn, " + super.getRule();
}
}

View file

@ -0,0 +1,52 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.modernmasters;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class FuryCharm extends mage.sets.planarchaos.FuryCharm {
public FuryCharm(UUID ownerId) {
super(ownerId);
this.cardNumber = 114;
this.expansionSetCode = "MMA";
}
public FuryCharm(final FuryCharm card) {
super(card);
}
@Override
public FuryCharm copy() {
return new FuryCharm(this);
}
}

View file

@ -0,0 +1,71 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.modernmasters;
import java.util.UUID;
import mage.MageInt;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.costs.common.ReturnToHandSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.mana.ActivateAsSorceryManaAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
/**
*
* @author LevelX2
*/
public class GrinningIgnus extends CardImpl<GrinningIgnus> {
public GrinningIgnus(UUID ownerId) {
super(ownerId, 118, "Grinning Ignus", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{R}");
this.expansionSetCode = "MMA";
this.subtype.add("Elemental");
this.color.setRed(true);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// {R}, Return Grinning Ignus to its owner's hand: Add {2}{R} to your mana pool. Activate this ability only any time you could cast a sorcery.
Ability ability = new ActivateAsSorceryManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 0, 2, 0), new ManaCostsImpl("{R}"));
ability.addCost(new ReturnToHandSourceCost());
this.addAbility(ability);
}
public GrinningIgnus(final GrinningIgnus card) {
super(card);
}
@Override
public GrinningIgnus copy() {
return new GrinningIgnus(this);
}
}

View file

@ -0,0 +1,96 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.modernmasters;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.StaticAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SupertypePredicate;
/**
*
* @author LevelX2
*/
public class Imperiosaur extends CardImpl<Imperiosaur> {
private static final FilterLandPermanent filter = new FilterLandPermanent();
static {
filter.add(new SupertypePredicate("Basic"));
}
public Imperiosaur(UUID ownerId) {
super(ownerId, 148, "Imperiosaur", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{G}{G}");
this.expansionSetCode = "MMA";
this.subtype.add("Lizard");
this.color.setGreen(true);
this.power = new MageInt(5);
this.toughness = new MageInt(5);
// Spend only mana produced by basic lands to cast Imperiosaur.
this.addAbility(new ImperiosaurStaticAbility());
this.getSpellAbility().getManaCostsToPay().setSourceFilter(filter);
this.getSpellAbility().getManaCosts().setSourceFilter(filter);
}
public Imperiosaur(final Imperiosaur card) {
super(card);
}
@Override
public Imperiosaur copy() {
return new Imperiosaur(this);
}
}
class ImperiosaurStaticAbility extends StaticAbility<ImperiosaurStaticAbility> {
public ImperiosaurStaticAbility() {
super(Zone.STACK, null);
}
public ImperiosaurStaticAbility(ImperiosaurStaticAbility ability) {
super(ability);
}
@Override
public ImperiosaurStaticAbility copy() {
return new ImperiosaurStaticAbility(this);
}
@Override
public String getRule() {
return "Spend only mana produced by basic lands to cast {this}.";
}
}

View file

@ -0,0 +1,52 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.modernmasters;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class KodamasReach extends mage.sets.commander.KodamasReach {
public KodamasReach(UUID ownerId) {
super(ownerId);
this.cardNumber = 151;
this.expansionSetCode = "MMA";
}
public KodamasReach(final KodamasReach card) {
super(card);
}
@Override
public KodamasReach copy() {
return new KodamasReach(this);
}
}

View file

@ -0,0 +1,84 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.modernmasters;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SpellCastTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.DrawCardControllerEffect;
import mage.abilities.effects.common.ReturnToHandSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.CardTypePredicate;
/**
*
* @author LevelX2
*/
public class MaskedAdmirers extends CardImpl<MaskedAdmirers> {
private static final FilterSpell filter = new FilterSpell("a creature spell");
static {
filter.add(new CardTypePredicate(CardType.CREATURE));
}
public MaskedAdmirers(UUID ownerId) {
super(ownerId, 154, "Masked Admirers", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{G}{G}");
this.expansionSetCode = "MMA";
this.subtype.add("Elf");
this.subtype.add("Shaman");
this.color.setGreen(true);
this.power = new MageInt(3);
this.toughness = new MageInt(2);
// When Masked Admirers enters the battlefield, draw a card.
this.addAbility(new EntersBattlefieldTriggeredAbility(new DrawCardControllerEffect(1), false));
// Whenever you cast a creature spell, you may pay {G}{G}. If you do, return Masked Admirers from your graveyard to your hand.
OneShotEffect effect = new ReturnToHandSourceEffect();
effect.setText("return {this} from your graveyard to your hand");
this.addAbility(new SpellCastTriggeredAbility(
Zone.GRAVEYARD, new DoIfCostPaid(effect, new ManaCostsImpl("{G}{G}")), filter, false, false));
}
public MaskedAdmirers(final MaskedAdmirers card) {
super(card);
}
@Override
public MaskedAdmirers copy() {
return new MaskedAdmirers(this);
}
}

View file

@ -0,0 +1,52 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.modernmasters;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class OonaQueenOfTheFae extends mage.sets.shadowmoor.OonaQueenOfTheFae {
public OonaQueenOfTheFae(UUID ownerId) {
super(ownerId);
this.cardNumber = 193;
this.expansionSetCode = "MMA";
}
public OonaQueenOfTheFae(final OonaQueenOfTheFae card) {
super(card);
}
@Override
public OonaQueenOfTheFae copy() {
return new OonaQueenOfTheFae(this);
}
}

View file

@ -0,0 +1,115 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.modernmasters;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.HauntAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.other.FaceDownPredicate;
import mage.game.Game;
import mage.target.common.TargetCardInExile;
/**
*
* @author LevelX2
*/
public class Riftsweeper extends CardImpl<Riftsweeper> {
private static final FilterCard filter = new FilterCard("face-up exiled card");
static {
filter.add(Predicates.not(new FaceDownPredicate()));
}
public Riftsweeper(UUID ownerId) {
super(ownerId, 159, "Riftsweeper", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{G}");
this.expansionSetCode = "MMA";
this.subtype.add("Elf");
this.subtype.add("Shaman");
this.color.setGreen(true);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// When Riftsweeper enters the battlefield, choose target face-up exiled card. Its owner shuffles it into his or her library.
Ability ability = new EntersBattlefieldTriggeredAbility(new RiftsweeperEffect(), false);
ability.addTarget(new TargetCardInExile(1, 1, filter, null, true));
this.addAbility(ability);
}
public Riftsweeper(final Riftsweeper card) {
super(card);
}
@Override
public Riftsweeper copy() {
return new Riftsweeper(this);
}
}
class RiftsweeperEffect extends OneShotEffect<RiftsweeperEffect> {
public RiftsweeperEffect() {
super(Outcome.Benefit);
this.staticText = "choose target face-up exiled card. Its owner shuffles it into his or her library";
}
public RiftsweeperEffect(final RiftsweeperEffect effect) {
super(effect);
}
@Override
public RiftsweeperEffect copy() {
return new RiftsweeperEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Card card = game.getCard(targetPointer.getFirst(game, source));
if (card != null) {
// remove exiting suspend counters
card.getCounters().clear();
// move to exile
card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
game.getState().getPlayer(card.getOwnerId()).getLibrary().shuffle();
game.informPlayers(new StringBuilder("Riftsweeper: Choosen card was ").append(card.getName()).toString());
return true;
}
return false;
}
}

View file

@ -0,0 +1,88 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.modernmasters;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Mode;
import mage.abilities.effects.common.UntapAllLandsControllerEffect;
import mage.abilities.effects.common.continious.BecomesCreatureAllEffect;
import mage.abilities.keyword.EntwineAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.filter.common.FilterControlledLandPermanent;
import mage.game.permanent.token.Token;
/**
*
* @author LevelX2
*/
public class RudeAwakening extends CardImpl<RudeAwakening> {
public RudeAwakening(UUID ownerId) {
super(ownerId, 160, "Rude Awakening", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{4}{G}");
this.expansionSetCode = "MMA";
this.color.setGreen(true);
// Choose one -
this.getSpellAbility().getModes().setMinModes(1);
this.getSpellAbility().getModes().setMaxModes(1);
// Untap all lands you control;
this.getSpellAbility().addEffect(new UntapAllLandsControllerEffect());
// or until end of turn, lands you control become 2/2 creatures that are still lands.
Mode mode = new Mode();
mode.getEffects().add(new BecomesCreatureAllEffect(new RudeAwakeningToken(), "lands", new FilterControlledLandPermanent("lands you control"), Duration.EndOfTurn));
this.getSpellAbility().getModes().addMode(mode);
// Entwine {2}{G}
this.addAbility(new EntwineAbility("{2}{G}"));
}
public RudeAwakening(final RudeAwakening card) {
super(card);
}
@Override
public RudeAwakening copy() {
return new RudeAwakening(this);
}
}
class RudeAwakeningToken extends Token {
public RudeAwakeningToken() {
super("", "2/2 creature");
cardType.add(CardType.CREATURE);
power = new MageInt(2);
toughness = new MageInt(2);
}
}

View file

@ -0,0 +1,52 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.modernmasters;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class SqueeGoblinNabob extends mage.sets.tenth.SqueeGoblinNabob {
public SqueeGoblinNabob(UUID ownerId) {
super(ownerId);
this.cardNumber = 130;
this.expansionSetCode = "MMA";
}
public SqueeGoblinNabob(final SqueeGoblinNabob card) {
super(card);
}
@Override
public SqueeGoblinNabob copy() {
return new SqueeGoblinNabob(this);
}
}

View file

@ -0,0 +1,155 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.modernmasters;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continious.BoostControlledEffect;
import mage.abilities.effects.common.continious.GainAbilityControlledEffect;
import mage.abilities.keyword.EntwineAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.players.Player;
/**
*
* @author LevelX2
*/
public class StirThePride extends CardImpl<StirThePride> {
public StirThePride(UUID ownerId) {
super(ownerId, 30, "Stir the Pride", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{4}{W}");
this.expansionSetCode = "MMA";
this.color.setWhite(true);
// Choose one -
this.getSpellAbility().getModes().setMinModes(1);
this.getSpellAbility().getModes().setMaxModes(1);
// Creatures you control get +2/+2 until end of turn;
this.getSpellAbility().addEffect(new BoostControlledEffect(2,2, Duration.EndOfTurn));
// or until end of turn, creatures you control gain "Whenever this creature deals damage, you gain that much life."
Mode mode = new Mode();
Effect effect = new GainAbilityControlledEffect(new StirThePrideTriggeredAbility(), Duration.EndOfTurn);
effect.setText("until end of turn, creatures you control gain \"Whenever this creature deals damage, you gain that much life.\"");
mode.getEffects().add(effect);
this.getSpellAbility().getModes().addMode(mode);
// Entwine {1}{W}
this.addAbility(new EntwineAbility("{1}{W}"));
}
public StirThePride(final StirThePride card) {
super(card);
}
@Override
public StirThePride copy() {
return new StirThePride(this);
}
}
class StirThePrideTriggeredAbility extends TriggeredAbilityImpl<StirThePrideTriggeredAbility> {
public StirThePrideTriggeredAbility() {
super(Zone.BATTLEFIELD, new StirThePrideGainLifeEffect(), false);
}
public StirThePrideTriggeredAbility(final StirThePrideTriggeredAbility ability) {
super(ability);
}
@Override
public StirThePrideTriggeredAbility copy() {
return new StirThePrideTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType().equals(EventType.DAMAGED_CREATURE)
|| event.getType().equals(GameEvent.EventType.DAMAGED_PLAYER)
|| event.getType().equals(GameEvent.EventType.DAMAGED_PLANESWALKER)) {
if (event.getSourceId().equals(this.getSourceId())) {
for (Effect effect : this.getEffects()) {
effect.setValue("damage", event.getAmount());
}
return true;
}
}
return false;
}
@Override
public String getRule() {
return "Whenever {this} deals damage, " + super.getRule();
}
}
class StirThePrideGainLifeEffect extends OneShotEffect<StirThePrideGainLifeEffect> {
public StirThePrideGainLifeEffect() {
super(Outcome.GainLife);
this.staticText = "you gain that much life";
}
public StirThePrideGainLifeEffect(final StirThePrideGainLifeEffect effect) {
super(effect);
}
@Override
public StirThePrideGainLifeEffect copy() {
return new StirThePrideGainLifeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
int amount = (Integer) getValue("damage");
if (amount > 0) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
controller.gainLife(amount, game);
return true;
}
}
return false;
}
}

View file

@ -0,0 +1,150 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.modernmasters;
import java.util.List;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.TargetPlayer;
/**
*
* @author LevelX2
*/
public class ThievingSprite extends CardImpl<ThievingSprite> {
public ThievingSprite(UUID ownerId) {
super(ownerId, 101, "Thieving Sprite", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{B}");
this.expansionSetCode = "MMA";
this.subtype.add("Faerie");
this.subtype.add("Rogue");
this.color.setBlack(true);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// Flying
this.addAbility(FlyingAbility.getInstance());
// When Thieving Sprite enters the battlefield, target player reveals X cards from his or her hand, where X is the number of Faeries you control. You choose one of those cards. That player discards that card.
Ability ability = new EntersBattlefieldTriggeredAbility(new ThievingSpriteEffect(), false);
TargetPlayer target = new TargetPlayer();
target.setRequired(true);
ability.addTarget(target);
this.addAbility(ability);
}
public ThievingSprite(final ThievingSprite card) {
super(card);
}
@Override
public ThievingSprite copy() {
return new ThievingSprite(this);
}
}
class ThievingSpriteEffect extends OneShotEffect<ThievingSpriteEffect> {
public ThievingSpriteEffect() {
super(Outcome.Discard);
this.staticText = "target player reveals X cards from his or her hand, where X is the number of Faeries you control. You choose one of those cards. That player discards that card";
}
public ThievingSpriteEffect(final ThievingSpriteEffect effect) {
super(effect);
}
@Override
public ThievingSpriteEffect copy() {
return new ThievingSpriteEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player targetPlayer = game.getPlayer(source.getFirstTarget());
Player controller = game.getPlayer(source.getControllerId());
if (targetPlayer == null || controller == null) {
return false;
}
FilterControlledPermanent filter = new FilterControlledPermanent();
filter.add(new SubtypePredicate("Faerie"));
int numberOfFaeries = game.getBattlefield().countAll(filter, controller.getId(), game);
Cards cardsInHand = new CardsImpl(Zone.PICK);
cardsInHand.addAll(targetPlayer.getHand());
int count = Math.min(cardsInHand.size(), numberOfFaeries);
TargetCard target = new TargetCard(count, Zone.PICK, new FilterCard());
target.setRequired(true);
Cards revealedCards = new CardsImpl();
if (targetPlayer.choose(Outcome.Discard, cardsInHand, target, game)) {
List<UUID> targets = target.getTargets();
for (UUID targetId : targets) {
Card card = game.getCard(targetId);
if (card != null) {
revealedCards.add(card);
}
}
}
TargetCard targetInHand = new TargetCard(Zone.PICK, new FilterCard("card to discard"));
targetInHand.setRequired(true);
if (!revealedCards.isEmpty()) {
targetPlayer.revealCards("Thieving Sprite", revealedCards, game);
controller.choose(Outcome.Discard, revealedCards, targetInHand, game);
Card card = revealedCards.get(targetInHand.getFirstTarget(), game);
if (card != null) {
targetPlayer.discard(card, source, game);
game.informPlayers(new StringBuilder("Thieving Sprite").append(targetPlayer.getName()).append("discarded ").append(card.getName()).toString());
}
}
return true;
}
}

View file

@ -0,0 +1,117 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.modernmasters;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
import mage.abilities.keyword.EntwineAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInHand;
import mage.target.common.TargetCardInLibrary;
/**
*
* @author LevelX2
*/
public class ToothAndNail extends CardImpl<ToothAndNail> {
public ToothAndNail(UUID ownerId) {
super(ownerId, 170, "Tooth and Nail", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{5}{G}{G}");
this.expansionSetCode = "MMA";
this.color.setGreen(true);
// Choose one -
// Search your library for up to two creature cards, reveal them, put them into your hand, then shuffle your library;
this.getSpellAbility().addEffect(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(0, 2, new FilterCreatureCard())));
// or put up to two creature cards from your hand onto the battlefield.
Mode mode = new Mode();
mode.getEffects().add(new ToothAndNailPutCreatureOnBattlefieldEffect());
this.getSpellAbility().getModes().addMode(mode);
// Entwine {2}
this.addAbility(new EntwineAbility("{2}"));
}
public ToothAndNail(final ToothAndNail card) {
super(card);
}
@Override
public ToothAndNail copy() {
return new ToothAndNail(this);
}
}
class ToothAndNailPutCreatureOnBattlefieldEffect extends OneShotEffect<ToothAndNailPutCreatureOnBattlefieldEffect> {
public ToothAndNailPutCreatureOnBattlefieldEffect() {
super(Outcome.PutCreatureInPlay);
this.staticText = "Put up to two creature cards from your hand onto the battlefield";
}
public ToothAndNailPutCreatureOnBattlefieldEffect(final ToothAndNailPutCreatureOnBattlefieldEffect effect) {
super(effect);
}
@Override
public ToothAndNailPutCreatureOnBattlefieldEffect copy() {
return new ToothAndNailPutCreatureOnBattlefieldEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
TargetCardInHand target = new TargetCardInHand(0, 2, new FilterCreatureCard("creature cards"));
if (player.choose(Outcome.PutCreatureInPlay, target, source.getSourceId(), game)) {
for (UUID targetId: target.getTargets()) {
Card card = game.getCard(targetId);
if (card != null) {
card.putOntoBattlefield(game, Zone.HAND, source.getId(), source.getControllerId());
}
}
return true;
}
return false;
}
}

View file

@ -0,0 +1,52 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.modernmasters;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class TrompTheDomains extends mage.sets.timespiral.TrompTheDomains {
public TrompTheDomains(UUID ownerId) {
super(ownerId);
this.cardNumber = 171;
this.expansionSetCode = "MMA";
}
public TrompTheDomains(final TrompTheDomains card) {
super(card);
}
@Override
public TrompTheDomains copy() {
return new TrompTheDomains(this);
}
}

View file

@ -0,0 +1,54 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.modernmasters;
import java.util.UUID;
import mage.constants.Rarity;
/**
*
* @author LevelX2
*/
public class WormHarvest extends mage.sets.eventide.WormHarvest {
public WormHarvest(UUID ownerId) {
super(ownerId);
this.cardNumber = 195;
this.expansionSetCode = "MMA";
this.rarity = Rarity.UNCOMMON;
}
public WormHarvest(final WormHarvest card) {
super(card);
}
@Override
public WormHarvest copy() {
return new WormHarvest(this);
}
}

View file

@ -28,10 +28,12 @@
package mage.sets.newphyrexia;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.StaticAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.cards.CardImpl;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
/**
@ -51,6 +53,7 @@ public class MyrSuperion extends CardImpl<MyrSuperion> {
this.toughness = new MageInt(6);
// Spend only mana produced by creatures to cast Myr Superion.
this.addAbility(new MyrSuperionStaticAbility());
this.getSpellAbility().getManaCostsToPay().setSourceFilter(filter);
this.getSpellAbility().getManaCosts().setSourceFilter(filter);
}
@ -64,3 +67,25 @@ public class MyrSuperion extends CardImpl<MyrSuperion> {
return new MyrSuperion(this);
}
}
class MyrSuperionStaticAbility extends StaticAbility<MyrSuperionStaticAbility> {
public MyrSuperionStaticAbility() {
super(Zone.STACK, null);
}
public MyrSuperionStaticAbility(MyrSuperionStaticAbility ability) {
super(ability);
}
@Override
public MyrSuperionStaticAbility copy() {
return new MyrSuperionStaticAbility(this);
}
@Override
public String getRule() {
return "Spend only mana produced by creatures to cast {this}.";
}
}

View file

@ -0,0 +1,163 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.planarchaos;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.SpellAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.continious.BoostTargetEffect;
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
import mage.abilities.keyword.SuspendAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.counters.CounterType;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.filter.predicate.permanent.CounterPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.Target;
import mage.target.common.TargetArtifactPermanent;
import mage.target.common.TargetCardInExile;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author LevelX2
*/
public class FuryCharm extends CardImpl<FuryCharm> {
private static final FilterCard filter = new FilterCard("suspended card");
static {
filter.add(new CounterPredicate(CounterType.TIME));
filter.add(new AbilityPredicate(SuspendAbility.class));
}
public FuryCharm(UUID ownerId) {
super(ownerId, 100, "Fury Charm", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{R}");
this.expansionSetCode = "PLC";
this.color.setRed(true);
// Choose one -
this.getSpellAbility().getModes().setMinModes(1);
this.getSpellAbility().getModes().setMaxModes(1);
// Destroy target artifact;
this.getSpellAbility().addEffect(new DestroyTargetEffect());
this.getSpellAbility().addTarget(new TargetArtifactPermanent());
// or target creature gets +1/+1 and gains trample until end of turn;
Mode mode = new Mode();
mode.getEffects().add(new BoostTargetEffect(1,1, Duration.EndOfTurn));
mode.getEffects().add(new GainAbilityTargetEffect(TrampleAbility.getInstance(),Duration.EndOfTurn));
mode.getTargets().add(new TargetCreaturePermanent());
this.getSpellAbility().getModes().addMode(mode);
// or remove two time counters from target permanent or suspended card.
mode = new Mode();
Choice targetChoice = new ChoiceImpl();
targetChoice.setMessage("Choose what to target");
targetChoice.getChoices().add("Permanent");
targetChoice.getChoices().add("Suspended Card");
mode.getChoices().add(targetChoice);
mode.getEffects().add(new FuryCharmRemoveCounterEffect());
this.getSpellAbility().getModes().addMode(mode);
}
@Override
public void adjustTargets(Ability ability, Game game) {
if (ability instanceof SpellAbility) {
for(Effect effect :ability.getEffects()) {
if (effect instanceof FuryCharmRemoveCounterEffect) {
Choice targetChoice = ability.getChoices().get(0);
if (targetChoice.getChoice().equals("Permanent")) {
ability.addTarget(new TargetCreaturePermanent(true));
}
if (targetChoice.getChoice().equals("Suspended Card")) {
Target target = new TargetCardInExile(1,1, filter, null, true);
target.setRequired(true);
ability.addTarget(target);
}
}
}
}
}
public FuryCharm(final FuryCharm card) {
super(card);
}
@Override
public FuryCharm copy() {
return new FuryCharm(this);
}
}
class FuryCharmRemoveCounterEffect extends OneShotEffect<FuryCharmRemoveCounterEffect> {
public FuryCharmRemoveCounterEffect() {
super(Outcome.Benefit);
this.staticText = "remove two time counters from target permanent or suspended card";
}
public FuryCharmRemoveCounterEffect(final FuryCharmRemoveCounterEffect effect) {
super(effect);
}
@Override
public FuryCharmRemoveCounterEffect copy() {
return new FuryCharmRemoveCounterEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source));
if (permanent != null) {
permanent.getCounters().removeCounter(CounterType.TIME, 2);
return true;
}
Card card = game.getCard(this.getTargetPointer().getFirst(game, source));
if (card != null) {
card.getCounters().removeCounter(CounterType.TIME, 2);
return true;
}
return false;
}
}

View file

@ -66,7 +66,7 @@ public class DeathDenied extends CardImpl<DeathDenied> {
if (ability instanceof SpellAbility) {
ability.getTargets().clear();
int xValue = ability.getManaCostsToPay().getX();
Target target = new TargetCardInYourGraveyard(xValue, new FilterCreatureCard(new StringBuilder(xValue).append(xValue != 1?" creatures":"creature").toString()));
Target target = new TargetCardInYourGraveyard(xValue, new FilterCreatureCard(new StringBuilder(xValue).append(xValue != 1?" creature cards":"creature card").append(" from your graveyard").toString()));
ability.addTarget(target);
}
}

View file

@ -0,0 +1,145 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.shadowmoor;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.choices.ChoiceColor;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.token.Token;
import mage.players.Player;
import mage.target.common.TargetOpponent;
/**
*
* @author LevelX2
*/
public class OonaQueenOfTheFae extends CardImpl<OonaQueenOfTheFae> {
public OonaQueenOfTheFae(UUID ownerId) {
super(ownerId, 172, "Oona, Queen of the Fae", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{U/B}{U/B}{U/B}");
this.expansionSetCode = "SHM";
this.supertype.add("Legendary");
this.subtype.add("Faerie");
this.subtype.add("Wizard");
this.color.setBlue(true);
this.color.setBlack(true);
this.power = new MageInt(5);
this.toughness = new MageInt(5);
// Flying
this.addAbility(FlyingAbility.getInstance());
// {X}{UB}: Choose a color. Target opponent exiles the top X cards of his or her library. For each card of the chosen color exiled this way, put a 1/1 blue and black Faerie Rogue creature token with flying onto the battlefield.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new OonaQueenOfTheFaeEffect(), new ManaCostsImpl("{X}{U/B}"));
ability.addTarget(new TargetOpponent(true));
this.addAbility(ability);
}
public OonaQueenOfTheFae(final OonaQueenOfTheFae card) {
super(card);
}
@Override
public OonaQueenOfTheFae copy() {
return new OonaQueenOfTheFae(this);
}
}
class OonaQueenOfTheFaeEffect extends OneShotEffect<OonaQueenOfTheFaeEffect> {
public OonaQueenOfTheFaeEffect() {
super(Outcome.PutCreatureInPlay);
this.staticText = "Choose a color. Target opponent exiles the top X cards of his or her library. For each card of the chosen color exiled this way, put a 1/1 blue and black Faerie Rogue creature token with flying onto the battlefield";
}
public OonaQueenOfTheFaeEffect(final OonaQueenOfTheFaeEffect effect) {
super(effect);
}
@Override
public OonaQueenOfTheFaeEffect copy() {
return new OonaQueenOfTheFaeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source));
if (controller == null || opponent == null) {
return false;
}
ChoiceColor choice = new ChoiceColor();
controller.choose(outcome, choice, game);
if (choice.getColor() != null) {
int cardsWithColor = 0;
int cardsToExile = Math.min(opponent.getLibrary().size(), source.getManaCostsToPay().getX());
for(int i = 0; i < cardsToExile; i++) {
Card card = opponent.getLibrary().removeFromTop(game);
if (card != null) {
if (card.getColor().contains(choice.getColor())) {
cardsWithColor++;
}
card.moveToExile(null, null, source.getSourceId(), game);
}
}
if (cardsWithColor > 0) {
new CreateTokenEffect(new OonaQueenFaerieToken(), cardsWithColor).apply(game, source);
}
game.informPlayers(new StringBuilder("Oona: ").append(cardsWithColor).append(" Token").append(cardsWithColor != 1?"s":"").append(" created").toString());
return true;
}
return false;
}
}
class OonaQueenFaerieToken extends Token {
OonaQueenFaerieToken() {
super("Faerie Rogue", "1/1 blue and black Faerie Rogue creature token with flying");
cardType.add(CardType.CREATURE);
color.setBlue(true);
color.setBlack(true);
subtype.add("Faerie");
subtype.add("Rogue");
power = new MageInt(1);
toughness = new MageInt(1);
this.addAbility(FlyingAbility.getInstance());
}
}

View file

@ -65,7 +65,10 @@ public class BranchingBolt extends CardImpl<BranchingBolt> {
this.color.setRed(true);
this.color.setGreen(true);
// Choose one or both - Branching Bolt deals 3 damage to target creature with flying;
// Choose one or both -
this.getSpellAbility().getModes().setMinModes(1);
this.getSpellAbility().getModes().setMaxModes(2);
// Branching Bolt deals 3 damage to target creature with flying;
this.getSpellAbility().addEffect(new DamageTargetEffect(3));
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filterFlying));
// or Branching Bolt deals 3 damage to target creature without flying.
@ -73,12 +76,6 @@ public class BranchingBolt extends CardImpl<BranchingBolt> {
mode.getEffects().add(new DamageTargetEffect(3));
mode.getTargets().add(new TargetCreaturePermanent(filterNotFlying));
this.getSpellAbility().addMode(mode);
// both
mode = new Mode();
mode.getEffects().add(new DamageTargetEffect(3));
mode.getTargets().add(new TargetCreaturePermanent(filterFlying));
mode.getTargets().add(new TargetCreaturePermanent(filterNotFlying));
this.getSpellAbility().addMode(mode);
}
public BranchingBolt(final BranchingBolt card) {

View file

@ -0,0 +1,69 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.tenth;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.common.ReturnToHandSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
/**
*
* @author LevelX2
*/
public class SqueeGoblinNabob extends CardImpl<SqueeGoblinNabob> {
public SqueeGoblinNabob(UUID ownerId) {
super(ownerId, 239, "Squee, Goblin Nabob", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{R}");
this.expansionSetCode = "10E";
this.supertype.add("Legendary");
this.subtype.add("Goblin");
this.color.setRed(true);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// At the beginning of your upkeep, you may return Squee, Goblin Nabob from your graveyard to your hand.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.GRAVEYARD, new ReturnToHandSourceEffect(), TargetController.YOU, true));
}
public SqueeGoblinNabob(final SqueeGoblinNabob card) {
super(card);
}
@Override
public SqueeGoblinNabob copy() {
return new SqueeGoblinNabob(this);
}
}

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.sets.timespiral;
import java.util.UUID;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.DomainValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continious.BoostControlledEffect;
import mage.abilities.effects.common.continious.GainAbilityControlledEffect;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterCreaturePermanent;
/**
*
* @author LevelX2
*/
public class TrompTheDomains extends CardImpl<TrompTheDomains> {
public TrompTheDomains(UUID ownerId) {
super(ownerId, 230, "Tromp the Domains", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{5}{G}");
this.expansionSetCode = "TSP";
this.color.setGreen(true);
// Domain - Until end of turn, creatures you control gain trample and get +1/+1 for each basic land type among lands you control.
Effect effect = new GainAbilityControlledEffect(TrampleAbility.getInstance(), Duration.EndOfTurn);
effect.setText("<i>Domain</i> - Until end of turn, creatures you control gain Trample");
this.getSpellAbility().addEffect(effect);
DynamicValue domain = new DomainValue();
effect = new BoostControlledEffect(domain, domain, Duration.EndOfTurn, new FilterCreaturePermanent(), false);
effect.setText(" and get +1/+1 for each basic land type among lands you control");
this.getSpellAbility().addEffect(effect);
}
public TrompTheDomains(final TrompTheDomains card) {
super(card);
}
@Override
public TrompTheDomains copy() {
return new TrompTheDomains(this);
}
}

View file

@ -152,7 +152,7 @@ class BalaGedThiefEffect extends OneShotEffect<BalaGedThiefEffect> {
Card card = revealedCards.get(targetInHand.getFirstTarget(), game);
if (card != null) {
targetPlayer.discard(card, source, game);
game.informPlayers(targetPlayer + "discarded " + card.getName());
game.informPlayers(new StringBuilder("Bala Ged Thief: ").append(targetPlayer.getName()).append(" discarded ").append(card.getName()).toString());
}
}
return true;

View file

@ -28,9 +28,6 @@
package mage.sets.zendikar;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.RemoveCountersSourceCost;
@ -38,10 +35,14 @@ import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.DamagedCreatureEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
/**
@ -94,9 +95,15 @@ class QuestForTheGembladesTriggeredAbility extends TriggeredAbilityImpl<QuestFor
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE && event.getPlayerId().equals(controllerId)) {
if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE) {
if (((DamagedCreatureEvent) event).isCombatDamage()) {
return true;
Permanent permanent = game.getPermanent(event.getSourceId());
if (permanent == null) {
permanent = (Permanent) game.getLastKnownInformation(event.getSourceId(), Zone.BATTLEFIELD);
}
if (permanent != null && permanent.getCardType().contains(CardType.CREATURE) && permanent.getControllerId().equals(this.getControllerId())) {
return true;
}
}
}
return false;

View file

@ -16,7 +16,17 @@ public class DearlyDepartedTest extends CardTestPlayerBase {
@Test
public void testEnteringWithCounters() {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 5);
// Dearly Departed
// Creature Spirit 5/5, 4WW (6)
// Flying
// As long as Dearly Departed is in your graveyard, each Human creature you control enters the battlefield with an additional +1/+1 counter on it.
addCard(Zone.GRAVEYARD, playerA, "Dearly Departed");
/**
* Thraben Doomsayer
* Creature Human Cleric 2/2, 1WW (3)
* {T}: Put a 1/1 white Human creature token onto the battlefield.
* Fateful hour As long as you have 5 or less life, other creatures you control get +2/+2.
*/
addCard(Zone.BATTLEFIELD, playerA, "Thraben Doomsayer");
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Put a 1/1 white Human creature token onto the battlefield.");

View file

@ -52,6 +52,7 @@ import org.apache.log4j.Logger;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.abilities.keyword.EntwineAbility;
/**
@ -170,9 +171,12 @@ public abstract class AbilityImpl<T extends AbilityImpl<T>> implements Ability {
if (card != null) {
card.adjustChoices(this, game);
}
if (getChoices().size() > 0 && getChoices().choose(game, this) == false) {
logger.debug("activate failed - choice");
return false;
for (UUID modeId :this.getModes().getSelectedModes()) {
this.getModes().setMode(this.getModes().get(modeId));
if (getChoices().size() > 0 && getChoices().choose(game, this) == false) {
logger.debug("activate failed - choice");
return false;
}
}
// 20121001 - 601.2b
@ -188,7 +192,8 @@ public abstract class AbilityImpl<T extends AbilityImpl<T>> implements Ability {
break;
}
}
if (ability instanceof OptionalAdditionalSourceCosts) {
if (ability instanceof OptionalAdditionalSourceCosts
&& !(ability instanceof EntwineAbility)) {
((OptionalAdditionalSourceCosts)ability).addOptionalAdditionalCosts(this, game);
}
}
@ -198,33 +203,37 @@ public abstract class AbilityImpl<T extends AbilityImpl<T>> implements Ability {
// its mana cost; see rule 107.3), the player announces the value of that variable.
VariableManaCost variableManaCost = handleXCosts(game, noMana);
//20121001 - 601.2c
// 601.2c The player announces his or her choice of an appropriate player, object, or zone for
// each target the spell requires. A spell may require some targets only if an alternative or
// additional cost (such as a buyback or kicker cost), or a particular mode, was chosen for it;
// otherwise, the spell is cast as though it did not require those targets. If the spell has a
// variable number of targets, the player announces how many targets he or she will choose before
// he or she announces those targets. The same target can't be chosen multiple times for any one
// instance of the word "target" on the spell. However, if the spell uses the word "target" in
// multiple places, the same object, player, or zone can be chosen once for each instance of the
// word "target" (as long as it fits the targeting criteria). If any effects say that an object
// or player must be chosen as a target, the player chooses targets so that he or she obeys the
// maximum possible number of such effects without violating any rules or effects that say that
// an object or player can't be chosen as a target. The chosen players, objects, and/or zones
// each become a target of that spell. (Any abilities that trigger when those players, objects,
// and/or zones become the target of a spell trigger at this point; they'll wait to be put on
// the stack until the spell has finished being cast.)
if (card != null) {
card.adjustTargets(this, game);
}
if (getTargets().size() > 0 && getTargets().chooseTargets(getEffects().get(0).getOutcome(), this.controllerId, this, game) == false) {
if (variableManaCost != null) {
game.informPlayers(new StringBuilder(card.getName()).append(": no valid targets with this value of X").toString());
} else {
logger.debug("activate failed - target");
for (UUID modeId :this.getModes().getSelectedModes()) {
this.getModes().setMode(this.getModes().get(modeId));
//20121001 - 601.2c
// 601.2c The player announces his or her choice of an appropriate player, object, or zone for
// each target the spell requires. A spell may require some targets only if an alternative or
// additional cost (such as a buyback or kicker cost), or a particular mode, was chosen for it;
// otherwise, the spell is cast as though it did not require those targets. If the spell has a
// variable number of targets, the player announces how many targets he or she will choose before
// he or she announces those targets. The same target can't be chosen multiple times for any one
// instance of the word "target" on the spell. However, if the spell uses the word "target" in
// multiple places, the same object, player, or zone can be chosen once for each instance of the
// word "target" (as long as it fits the targeting criteria). If any effects say that an object
// or player must be chosen as a target, the player chooses targets so that he or she obeys the
// maximum possible number of such effects without violating any rules or effects that say that
// an object or player can't be chosen as a target. The chosen players, objects, and/or zones
// each become a target of that spell. (Any abilities that trigger when those players, objects,
// and/or zones become the target of a spell trigger at this point; they'll wait to be put on
// the stack until the spell has finished being cast.)
if (card != null) {
card.adjustTargets(this, game);
}
return false;
}
if (getTargets().size() > 0 && getTargets().chooseTargets(getEffects().get(0).getOutcome(), this.controllerId, this, game) == false) {
if (variableManaCost != null) {
game.informPlayers(new StringBuilder(card != null ? card.getName(): "").append(": no valid targets with this value of X").toString());
} else {
logger.debug("activate failed - target");
}
return false;
}
} // end modes
// TODO: Handle optionalCosts at the same time as already OptionalAdditionalSourceCosts are handled.
for (Cost cost : optionalCosts) {

View file

@ -261,6 +261,22 @@ public abstract class ActivatedAbilityImpl<T extends ActivatedAbilityImpl<T>> ex
}
}
}
} else if (object instanceof Spell && ((Spell) object).getSpellAbility().getModes().size() > 1) {
Modes modes = ((Spell) object).getSpellAbility().getModes();
int item = 0;
for (Mode mode : modes.values()) {
item++;
if (modes.getSelectedModes().contains(mode.getId())) {
modes.setMode(mode);
sb.append(" (mode ").append(item).append(")");
if (getTargets().size() > 0) {
sb.append(" targeting ");
for (Target target: getTargets()) {
sb.append(target.getTargetedName(game));
}
}
}
}
} else {
if (getTargets().size() > 0) {
sb.append(" targeting ");

View file

@ -28,8 +28,12 @@
package mage.abilities;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import mage.abilities.costs.OptionalAdditionalModeSourceCosts;
import mage.cards.Card;
import mage.game.Game;
import mage.players.Player;
@ -40,11 +44,18 @@ import mage.players.Player;
public class Modes extends LinkedHashMap<UUID, Mode> {
private UUID modeId;
private Set<UUID> selectedModes = new LinkedHashSet<UUID>();
private int minModes;
private int maxModes;
public Modes() {
Mode mode = new Mode();
this.put(mode.getId(), mode);
this.modeId = mode.getId();
this.minModes = 1;
this.maxModes = 1;
this.selectedModes.add(modeId);
}
public Modes(Modes modes) {
@ -52,6 +63,9 @@ public class Modes extends LinkedHashMap<UUID, Mode> {
for (Map.Entry<UUID, Mode> entry: modes.entrySet()) {
this.put(entry.getKey(), entry.getValue().copy());
}
this.minModes = modes.minModes;
this.maxModes = modes.maxModes;
this.selectedModes.addAll(modes.selectedModes);
}
public Modes copy() {
@ -62,9 +76,30 @@ public class Modes extends LinkedHashMap<UUID, Mode> {
return get(modeId);
}
public Set<UUID> getSelectedModes() {
return selectedModes;
}
public void setMinModes(int minModes) {
this.minModes = minModes;
}
public int getMinModes() {
return this.minModes;
}
public void setMaxModes(int maxModes) {
this.maxModes = maxModes;
}
public int getMaxModes() {
return this.maxModes;
}
public void setMode(Mode mode) {
if (this.containsKey(mode.getId())) {
this.modeId = mode.getId();
this.selectedModes.add(mode.getId());
}
}
@ -74,40 +109,78 @@ public class Modes extends LinkedHashMap<UUID, Mode> {
public boolean choose(Game game, Ability source) {
if (this.size() > 1) {
Player player = game.getPlayer(source.getControllerId());
Mode choice = player.chooseMode(this, source, game);
if (choice == null) {
return false;
this.selectedModes.clear();
// check if mode modifying abilities exist
Card card = game.getCard(source.getSourceId());
if (card != null) {
for (Ability modeModifyingAbility : card.getAbilities()) {
if (modeModifyingAbility instanceof OptionalAdditionalModeSourceCosts) {
((OptionalAdditionalModeSourceCosts)modeModifyingAbility).addOptionalAdditionalModeCosts(source, game);
}
}
}
// check if all modes can be activated automatically
if (this.size() == this.getMinModes()) {
for (Mode mode: this.values()) {
if (mode.getTargets().canChoose(source.getSourceId(), source.getControllerId(), game)) {
this.selectedModes.add(mode.getId());
}
}
return selectedModes.size() > 0;
}
// player chooses modes manually
Player player = game.getPlayer(source.getControllerId());
while (this.selectedModes.size() < this.getMaxModes()) {
Mode choice = player.chooseMode(this, source, game);
if (choice == null) {
return this.selectedModes.size() >= this.getMinModes();
}
setMode(choice);
this.selectedModes.add(choice.getId());
}
setMode(choice);
return true;
}
this.modeId = this.values().iterator().next().getId();
this.selectedModes.add(modeId);
return true;
}
public String getText() {
String andOr = "";
StringBuilder sb = new StringBuilder();
if (this.size() > 1) {
sb.append("Choose one - ");
if (this.getMinModes() == 1 && this.getMaxModes() == 3) {
sb.append("Choose one or more - ");
andOr = "; and/or ";
}else if (this.getMinModes() == 1 && this.getMaxModes() == 2) {
sb.append("Choose one or both - ");
andOr = "; and/or ";
} else if (this.getMinModes() == 2 && this.getMaxModes() == 2) {
sb.append("Choose two - ");
andOr = "; or ";
} else {
sb.append("Choose one - ");
andOr = "; or ";
}
}
for (Mode mode: this.values()) {
sb.append(mode.getEffects().getText(mode)).append("; or ");
sb.append(mode.getEffects().getText(mode));
if (this.size() > 1) {
if (sb.length() > 2 && sb.substring(sb.length()-2, sb.length()).equals(". ")) {
sb.delete(sb.length()-2, sb.length());
}
sb.append(andOr);
}
}
if (this.size() > 1) {
sb.delete(sb.length() - andOr.length(), sb.length());
sb.append(".");
}
sb.delete(sb.length() - 5, sb.length());
return sb.toString();
}
public String getText(String sourceName) {
StringBuilder sb = new StringBuilder();
if (this.size() > 1) {
sb.append("Choose one - ");
}
for (Mode mode: this.values()) {
sb.append(mode.getEffects().getText(mode)).append("; or ");
}
sb.delete(sb.length() - 5, sb.length());
String text = sb.toString();
String text = getText();
text = text.replace("{this}", sourceName);
text = text.replace("{source}", sourceName);
return text;

View file

@ -51,8 +51,7 @@ public class SpellCastTriggeredAbility extends TriggeredAbilityImpl<SpellCastTri
protected boolean rememberSource = false;
public SpellCastTriggeredAbility(Effect effect, boolean optional) {
super(Zone.BATTLEFIELD, effect, optional);
this.filter = spellCard;
this(Zone.BATTLEFIELD, effect, spellCard, optional, false);
}
public SpellCastTriggeredAbility(Effect effect, FilterSpell filter, boolean optional) {
@ -60,7 +59,11 @@ public class SpellCastTriggeredAbility extends TriggeredAbilityImpl<SpellCastTri
}
public SpellCastTriggeredAbility(Effect effect, FilterSpell filter, boolean optional, boolean rememberSource) {
super(Zone.BATTLEFIELD, effect, optional);
this(Zone.BATTLEFIELD, effect, filter, optional, rememberSource);
}
public SpellCastTriggeredAbility(Zone zone, Effect effect, FilterSpell filter, boolean optional, boolean rememberSource) {
super(zone, effect, optional);
this.filter = filter;
this.rememberSource = rememberSource;
}

View file

@ -69,11 +69,11 @@ public class SuspendedCondition implements Condition {
break;
}
}
}
if (found) {
if (game.getState().getZone(card.getId()) == Zone.EXILED &&
card.getCounters().getCount(CounterType.TIME) > 0) {
return true;
if (found) {
if (game.getState().getZone(card.getId()) == Zone.EXILED &&
card.getCounters().getCount(CounterType.TIME) > 0) {
return true;
}
}
}
return false;

View file

@ -0,0 +1,42 @@
/*
* 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.abilities.costs;
import mage.abilities.Ability;
import mage.game.Game;
/**
*
* @author LevelX2
*/
public interface OptionalAdditionalModeSourceCosts {
void addOptionalAdditionalModeCosts(Ability ability, Game game);
String getCastMessageSuffix();
}

View file

@ -49,24 +49,25 @@ public class SunburstCount implements DynamicValue{
@Override
public int calculate(Game game, Ability source) {
int count = 0;
StackObject spell = game.getStack().getFirst();
if (spell != null && spell instanceof Spell && ((Spell)spell).getSourceId().equals(source.getSourceId())) {
Mana mana = ((Spell)spell).getSpellAbility().getManaCostsToPay().getPayment();
if(mana.getBlack() > 0) {
count++;
}
if(mana.getBlue() > 0) {
count++;
}
if(mana.getGreen() > 0) {
count++;
}
if(mana.getRed() > 0) {
count++;
}
if(mana.getWhite() > 0) {
count++;
if (!game.getStack().isEmpty()) {
StackObject spell = game.getStack().getFirst();
if (spell != null && spell instanceof Spell && ((Spell)spell).getSourceId().equals(source.getSourceId())) {
Mana mana = ((Spell)spell).getSpellAbility().getManaCostsToPay().getPayment();
if(mana.getBlack() > 0) {
count++;
}
if(mana.getBlue() > 0) {
count++;
}
if(mana.getGreen() > 0) {
count++;
}
if(mana.getRed() > 0) {
count++;
}
if(mana.getWhite() > 0) {
count++;
}
}
}
return count;

View file

@ -0,0 +1,160 @@
/*
* 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.abilities.keyword;
import java.util.Iterator;
import mage.constants.Zone;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.StaticAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.Costs;
import mage.abilities.costs.OptionalAdditionalCost;
import mage.abilities.costs.OptionalAdditionalCostImpl;
import mage.abilities.costs.OptionalAdditionalModeSourceCosts;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.constants.Outcome;
import mage.game.Game;
import mage.players.Player;
/**
* 702.40. Entwine
*
* 702.40a Entwine is a static ability of modal spells (see rule 700.2) that functions
* while the spell is on the stack. "Entwine [cost]" means "You may choose all modes
* of this spell instead of just one. If you do, you pay an additional [cost]." Using
* the entwine ability follows the rules for choosing modes and paying additional costs
* in rules 601.2b and 601.2e-g.
*
* 702.40b If the entwine cost was paid, follow the text of each of the modes in the order
* written on the card when the spell resolves.
*
* @author LevelX2
*/
public class EntwineAbility extends StaticAbility<EntwineAbility> implements OptionalAdditionalModeSourceCosts {
private static final String keywordText = "Entwine";
private static final String reminderText = "<i> (Choose both if you pay the entwine cost.)</i>";
protected OptionalAdditionalCost additionalCost;
public EntwineAbility(String manaString) {
super(Zone.STACK, null);
this.additionalCost = new OptionalAdditionalCostImpl(keywordText, reminderText, new ManaCostsImpl(manaString));
}
public EntwineAbility(Cost cost) {
super(Zone.STACK, null);
this.additionalCost = new OptionalAdditionalCostImpl(keywordText, "-", reminderText, cost);
setRuleAtTheTop(true);
}
public EntwineAbility(final EntwineAbility ability) {
super(ability);
additionalCost = ability.additionalCost;
}
@Override
public EntwineAbility copy() {
return new EntwineAbility(this);
}
@Override
public void addCost(Cost cost) {
if (additionalCost != null) {
((Costs) additionalCost).add(cost);
}
}
public boolean isActivated() {
if (additionalCost != null) {
return additionalCost.isActivated();
}
return false;
}
public void resetCosts() {
if (additionalCost != null) {
additionalCost.reset();
}
}
@Override
public void addOptionalAdditionalModeCosts(Ability ability, Game game) {
if (ability instanceof SpellAbility) {
Player player = game.getPlayer(controllerId);
if (player != null) {
this.resetCosts();
if (additionalCost != null) {
if (player.chooseUse(Outcome.Benefit,new StringBuilder("Pay ").append(additionalCost.getText(false)).append(" ?").toString(), game)) {
additionalCost.activate();
for (Iterator it = ((Costs) additionalCost).iterator(); it.hasNext();) {
Cost cost = (Cost) it.next();
if (cost instanceof ManaCostsImpl) {
ability.getManaCostsToPay().add((ManaCostsImpl) cost.copy());
} else {
ability.getCosts().add(cost.copy());
}
}
ability.getModes().setMinModes(2);
ability.getModes().setMaxModes(2);
}
}
}
}
}
@Override
public String getRule() {
StringBuilder sb = new StringBuilder();
if (additionalCost != null) {
sb.append(additionalCost.getText(false));
sb.append(" ").append(additionalCost.getReminderText());
}
return sb.toString();
}
@Override
public String getCastMessageSuffix() {
if (additionalCost != null) {
return additionalCost.getCastSuffixMessage(0);
} else {
return "";
}
}
public String getReminderText() {
if (additionalCost != null) {
return additionalCost.getReminderText();
} else {
return "";
}
}
}

View file

@ -67,9 +67,7 @@ public class RetraceAbility extends ActivatedAbilityImpl<RetraceAbility> {
@Override
public String getRule() {
StringBuilder sbRule = new StringBuilder("Retrace");
return sbRule.toString();
return "Retrace <i>(You may cast this card from your graveyard by discarding a land card in addition to paying its other costs.)</i>";
}
}
class RetraceEffect extends OneShotEffect<RetraceEffect> {

View file

@ -0,0 +1,56 @@
/*
* 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.abilities.mana;
import mage.Mana;
import mage.abilities.costs.Cost;
import mage.constants.TimingRule;
import mage.constants.Zone;
/**
*
* @author LevelX2
*/
public class ActivateAsSorceryManaAbility extends SimpleManaAbility {
public ActivateAsSorceryManaAbility(Zone zone, Mana mana, Cost cost) {
super(zone, mana, cost);
timing = TimingRule.SORCERY;
}
public ActivateAsSorceryManaAbility(final ActivateAsSorceryManaAbility ability) {
super(ability);
}
@Override
public ActivateAsSorceryManaAbility copy() {
return new ActivateAsSorceryManaAbility(this);
}
}

View file

@ -402,6 +402,9 @@ public abstract class CardImpl<T extends CardImpl<T>> extends MageObjectImpl<T>
case LIBRARY:
game.getPlayer(ownerId).removeFromLibrary(this, game);
break;
case EXILED:
game.getExile().removeCard(this, game);
break;
default:
logger.warn("moveToExile, not fully implemented: from="+fromZone);
}

View file

@ -0,0 +1,37 @@
package mage.constants;
/**
*
* @author LevelX2
*/
public enum MatchTimeLimit {
NONE(0,"None"),
MIN__20(1200, "20 Minutes"),
MIN__30(1800, "30 Minutes"),
MIN__40(2400, "40 Minutes"),
MIN__50(3000, "50 Minutes"),
MIN__60(3600, "60 Minutes"),
MIN__90(5400, "90 Minutes"),
MIN_120(7200, "120 Minutes");
private int matchSeconds;
private String name;
MatchTimeLimit(int matchSeconds, String name) {
this.matchSeconds = matchSeconds;
this.name = name;
}
public int getTimeLimit() {
return matchSeconds;
}
public String getName() {
return name;
}
@Override
public String toString() {
return name;
}
}

View file

@ -27,16 +27,16 @@
*/
package mage.filter.predicate.permanent;
import mage.cards.Card;
import mage.counters.CounterType;
import mage.filter.predicate.Predicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author jeff
*/
public class CounterPredicate implements Predicate<Permanent> {
public class CounterPredicate implements Predicate<Card> {
private final CounterType counter;
@ -45,7 +45,7 @@ public class CounterPredicate implements Predicate<Permanent> {
}
@Override
public boolean apply(Permanent input, Game game) {
public boolean apply(Card input, Game game) {
return input.getCounters().containsKey(counter);
}

View file

@ -230,4 +230,6 @@ public interface Game extends MageItem, Serializable {
void initTimer(UUID playerId);
void resumeTimer(UUID playerId);
void pauseTimer(UUID playerId);
int getPriorityTime();
void setPriorityTime(int priorityTime);
}

View file

@ -155,6 +155,8 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
// used to indicate that currently applied replacement effects have to check for scope relevance (614.12 13/01/18)
private boolean scopeRelevant = false;
private int priorityTime;
@Override
public abstract T copy();
@ -198,6 +200,7 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
this.stateCheckRequired = game.stateCheckRequired;
this.scorePlayer = game.scorePlayer;
this.scopeRelevant = game.scopeRelevant;
this.priorityTime = game.priorityTime;
}
@Override
@ -589,7 +592,9 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
protected void init(UUID choosingPlayerId, GameOptions gameOptions) {
for (Player player: state.getPlayers().values()) {
player.beginTurn(this);
initTimer(player.getId());
if (priorityTime > 0) {
initTimer(player.getId());
}
}
if (startMessage == null || startMessage.isEmpty()) {
startMessage = "Game has started";
@ -1949,17 +1954,32 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
@Override
public void initTimer(UUID playerId) {
tableEventSource.fireTableEvent(EventType.INIT_TIMER, playerId, null, this);
if (priorityTime > 0) {
tableEventSource.fireTableEvent(EventType.INIT_TIMER, playerId, null, this);
}
}
@Override
public void resumeTimer(UUID playerId) {
tableEventSource.fireTableEvent(EventType.RESUME_TIMER, playerId, null, this);
if (priorityTime > 0) {
tableEventSource.fireTableEvent(EventType.RESUME_TIMER, playerId, null, this);
}
}
@Override
public void pauseTimer(UUID playerId) {
tableEventSource.fireTableEvent(EventType.PAUSE_TIMER, playerId, null, this);
if (priorityTime > 0) {
tableEventSource.fireTableEvent(EventType.PAUSE_TIMER, playerId, null, this);
}
}
@Override
public int getPriorityTime() {
return priorityTime;
}
@Override
public void setPriorityTime(int priorityTime) {
this.priorityTime = priorityTime;
}
}

View file

@ -162,6 +162,7 @@ public abstract class MatchImpl implements Match {
game.loadCards(matchPlayer.getDeck().getSideboard(), matchPlayer.getPlayer().getId());
game.addPlayer(matchPlayer.getPlayer(), matchPlayer.getDeck());
}
game.setPriorityTime(options.getPriorityTime());
}
protected void shufflePlayers() {

View file

@ -31,6 +31,7 @@ package mage.game.match;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import mage.constants.MatchTimeLimit;
import mage.constants.MultiplayerAttackOption;
import mage.constants.RangeOfInfluence;
@ -49,6 +50,10 @@ public class MatchOptions implements Serializable {
protected String deckType;
protected boolean limited;
protected List<String> playerTypes = new ArrayList<String>();
/**
* Time each player has during the game to play using his\her priority.
*/
protected MatchTimeLimit matchTimeLimit; // 0 = no priorityTime handling
public MatchOptions(String name, String gameType) {
this.name = name;
@ -90,6 +95,7 @@ public class MatchOptions implements Serializable {
public void setFreeMulligans(int freeMulligans) {
this.freeMulligans = freeMulligans;
}
public String getGameType() {
return gameType;
}
@ -117,4 +123,16 @@ public class MatchOptions implements Serializable {
public void setLimited(boolean limited) {
this.limited = limited;
}
public int getPriorityTime() {
if (matchTimeLimit == null) {
return MatchTimeLimit.NONE.getTimeLimit();
}
return matchTimeLimit.getTimeLimit();
}
public void setMatchTimeLimit(MatchTimeLimit matchTimeLimit) {
this.matchTimeLimit = matchTimeLimit;
}
}

View file

@ -138,10 +138,13 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
result = false;
boolean legalParts = false;
for(SpellAbility spellAbility: this.spellAbilities) {
if (spellAbility.getTargets().stillLegal(spellAbility, game)) {
legalParts = true;
updateOptionalCosts(index);
result |= spellAbility.resolve(game);
for (UUID modeId :spellAbility.getModes().getSelectedModes()) {
spellAbility.getModes().setMode(spellAbility.getModes().get(modeId));
if (spellAbility.getTargets().stillLegal(spellAbility, game)) {
legalParts = true;
updateOptionalCosts(index);
result |= spellAbility.resolve(game);
}
}
index++;
}
@ -226,13 +229,16 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
String name = null;
if (object == null) {
Player targetPlayer = game.getPlayer(targetId);
if (targetPlayer != null) name = targetPlayer.getName();
if (targetPlayer != null) {
name = targetPlayer.getName();
}
} else {
name = object.getName();
}
if (name != null && player.chooseUse(spellAbility.getEffects().get(0).getOutcome(), "Change target from " + name + "?", game)) {
if (!player.chooseTarget(spellAbility.getEffects().get(0).getOutcome(), newTarget, spellAbility, game))
if (!player.chooseTarget(spellAbility.getEffects().get(0).getOutcome(), newTarget, spellAbility, game)) {
newTarget.addTarget(targetId, spellAbility, game, false);
}
}
else {
newTarget.addTarget(targetId, spellAbility, game, false);

View file

@ -27,15 +27,17 @@
*/
package mage.target.common;
import mage.constants.Zone;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.abilities.Ability;
import mage.cards.Card;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.game.ExileZone;
import mage.game.Game;
import mage.target.TargetCard;
import java.util.UUID;
/**
*
@ -44,26 +46,67 @@ import java.util.UUID;
public class TargetCardInExile extends TargetCard<TargetCardInExile> {
private UUID zoneId;
private boolean allExileZones;
public TargetCardInExile(FilterCard filter, UUID zoneId) {
this(1, 1, filter, zoneId);
}
public TargetCardInExile(int minNumTargets, int maxNumTargets, FilterCard filter, UUID zoneId) {
this(minNumTargets, maxNumTargets, filter, zoneId, false);
}
public TargetCardInExile(int minNumTargets, int maxNumTargets, FilterCard filter, UUID zoneId, boolean allExileZones) {
super(minNumTargets, maxNumTargets, Zone.EXILED, filter);
this.zoneId = zoneId;
this.allExileZones = allExileZones;
this.targetName = filter.getMessage();
}
public TargetCardInExile(final TargetCardInExile target) {
super(target);
this.zoneId = target.zoneId;
this.allExileZones = target.allExileZones;
}
@Override
@Override
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
if (allExileZones) {
Set<UUID> possibleTargets = new HashSet<UUID>();
for (Card card : game.getExile().getAllCards(game)) {
if (filter.match(card, sourceControllerId, game)) {
possibleTargets.add(card.getId());
}
}
return possibleTargets;
} else {
return super.possibleTargets(sourceId, sourceControllerId, game);
}
}
@Override
public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) {
if (allExileZones) {
int numberTargets = 0;
for(ExileZone exileZone : game.getExile().getExileZones()) {
numberTargets += exileZone.count(filter, sourceId, sourceControllerId, game);
if (numberTargets >= this.minNumberOfTargets) {
return true;
}
}
return false;
} else {
return super.canChoose(sourceControllerId, game);
}
}
@Override
public boolean canTarget(UUID id, Ability source, Game game) {
Card card = game.getCard(id);
if (card != null && game.getState().getZone(card.getId()) == Zone.EXILED) {
if (allExileZones) {
return filter.match(card, source.getControllerId(), game);
}
ExileZone exile;
if (zoneId != null) {
exile = game.getExile().getExileZone(zoneId);

View file

@ -3,6 +3,7 @@ Bloodthirst|number|
Bushido|number|
Dredge|number|
Evoke|card, manaString|
Entwine|manaString|
Soulshift|number|
Basic landcycling|cost|
Forestcycling|cost|