This commit is contained in:
maurer.it 2011-01-07 12:45:46 -05:00
commit 79c2a124af
21 changed files with 967 additions and 35 deletions

View file

@ -0,0 +1,19 @@
NAME:Architect Ramp
2 [SOM:180] Myr Battlesphere
3 [ZEN:234] Island
3 [ZEN:236] Island
2 [ZEN:223] Scalding Tarn
3 [M11:70] Preordain
3 [ZEN:235] Island
3 [ZEN:237] Island
4 [ROE:66] Enclave Cryptologist
4 [ROE:85] Sea Gate Oracle
3 [WWK:137] Halimar Depths
4 [ZEN:50] Kraken Hatchling
4 [SOM:33] Grand Architect
3 [SOM:177] Molten-Tail Masticore
4 [ROE:75] Lighthouse Chronologist
4 [WWK:145] Tectonic Edge
4 [ZEN:220] Misty Rainforest
3 [WWK:31] Jace, the Mind Sculptor
4 [SOM:223] Wurmcoil Engine

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" ?>
<?xml version="1.1" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<Properties>

View file

@ -39,6 +39,10 @@ import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.beans.Beans;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.UUID;
import mage.cards.MageCard;
@ -66,12 +70,19 @@ public class CardsList extends javax.swing.JPanel implements MouseListener {
}
public void loadCards(CardsView showCards, BigCard bigCard, UUID gameId) {
loadCards(showCards, bigCard, gameId, false);
}
public void loadCards(CardsView showCards, BigCard bigCard, UUID gameId, boolean sorted) {
//FIXME: why we remove all cards? for performance it's better to merge changes
cardArea.removeAll();
if (showCards != null && showCards.size() > 0) {
Rectangle rectangle = new Rectangle(Config.dimensions.frameWidth, Config.dimensions.frameHeight);
int count = 0;
for (CardView card: showCards.values()) {
List<CardView> sortedCards = new ArrayList<CardView>(showCards.values());
if (sorted)
Collections.sort(sortedCards, new CardViewComparator());
for (CardView card: sortedCards) {
addCard(card, bigCard, gameId, rectangle);
if (count >= 10) {
rectangle.translate(Config.dimensions.frameWidth, -200);
@ -164,3 +175,12 @@ public class CardsList extends javax.swing.JPanel implements MouseListener {
}
}
class CardViewComparator implements Comparator<CardView> {
@Override
public int compare(CardView o1, CardView o2) {
return o1.getName().compareTo(o2.getName());
}
}

View file

@ -37,7 +37,7 @@ package mage.client.deckeditor;
import mage.cards.Card;
import mage.cards.decks.Deck;
import mage.client.MageFrame;
import mage.client.deckeditor.collection.viewer.Huerotator2;
//import mage.client.deckeditor.collection.viewer.Huerotator2;
import mage.client.plugins.impl.Plugins;
import mage.client.util.Event;
import mage.client.util.Listener;
@ -149,8 +149,8 @@ public class DeckEditorPanel extends javax.swing.JPanel {
try {
setCursor(new Cursor(Cursor.WAIT_CURSOR));
this.txtDeckName.setText(deck.getName());
deckArea.getDeckList().loadCards(new CardsView(deck.getCards()), bigCard, null);
deckArea.getSideboardList().loadCards(new CardsView(deck.getSideboard()), bigCard, null);
deckArea.getDeckList().loadCards(new CardsView(deck.getCards()), bigCard, null, true);
deckArea.getSideboardList().loadCards(new CardsView(deck.getSideboard()), bigCard, null, true);
}
finally {
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));

View file

@ -83,7 +83,7 @@ public class AncientHellkite extends CardImpl<AncientHellkite> {
class AncientHellkiteAbility extends ActivatedAbilityImpl<AncientHellkiteAbility> {
private FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defender player controls");
private FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls");
public AncientHellkiteAbility() {
super(Zone.BATTLEFIELD, new DamageTargetEffect(1));
@ -104,13 +104,7 @@ class AncientHellkiteAbility extends ActivatedAbilityImpl<AncientHellkiteAbility
@Override
public boolean activate(Game game, boolean noMana) {
UUID defenderId = null;
for (CombatGroup group: game.getCombat().getGroups()) {
if (group.getAttackers().contains(this.sourceId)) {
defenderId = group.getDefenderId();
break;
}
}
UUID defenderId = game.getCombat().getDefendingPlayer(sourceId);
if (defenderId != null) {
filter.getControllerId().clear();
filter.getControllerId().add(defenderId);

View file

@ -91,16 +91,10 @@ class CyclopsGladiatorEffect extends OneShotEffect<CyclopsGladiatorEffect> {
@Override
public boolean apply(Game game, Ability source) {
Player defender = null;
for (CombatGroup group: game.getCombat().getGroups()) {
if (group.getAttackers().contains(source.getSourceId())) {
defender = game.getPlayer(group.getDefenderId());
break;
}
}
if (defender != null) {
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player owns");
filter.getControllerId().add(defender.getId());
UUID defenderId = game.getCombat().getDefendingPlayer(source.getSourceId());
if (defenderId != null) {
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls");
filter.getControllerId().add(defenderId);
TargetCreaturePermanent target = new TargetCreaturePermanent(filter);
Player player = game.getPlayer(source.getControllerId());
player.choose(Outcome.Damage, target, game);

View file

@ -0,0 +1,85 @@
/*
* Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.riseoftheeldrazi;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.Abilities;
import mage.abilities.AbilitiesImpl;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.DrawCardControllerEffect;
import mage.abilities.effects.common.DrawDiscardControllerEffect;
import mage.abilities.keyword.LevelAbility;
import mage.abilities.keyword.LevelUpAbility;
import mage.cards.LevelerCard;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class EnclaveCryptologist extends LevelerCard<EnclaveCryptologist> {
public EnclaveCryptologist (UUID ownerId) {
super(ownerId, 66, "Enclave Cryptologist", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{U}");
this.expansionSetCode = "ROE";
this.subtype.add("Merfolk");
this.subtype.add("Wizard");
this.color.setBlue(true);
this.power = new MageInt(0);
this.toughness = new MageInt(1);
this.addAbility(new LevelUpAbility(new ManaCostsImpl("{1}{U}")));
Abilities<Ability> abilities1 = new AbilitiesImpl<Ability>();
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawDiscardControllerEffect(), new TapSourceCost());
abilities1.add(ability);
this.getLevels().add(new LevelAbility(1, 2, abilities1, 0, 1));
Abilities<Ability> abilities2 = new AbilitiesImpl<Ability>();
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardControllerEffect(1), new TapSourceCost());
abilities2.add(ability);
this.getLevels().add(new LevelAbility(3, -1, abilities2, 0, 1));
}
public EnclaveCryptologist (final EnclaveCryptologist card) {
super(card);
}
@Override
public EnclaveCryptologist copy() {
return new EnclaveCryptologist(this);
}
}

View file

@ -0,0 +1,136 @@
/*
* Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.riseoftheeldrazi;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.Abilities;
import mage.abilities.AbilitiesImpl;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.LevelAbility;
import mage.abilities.keyword.LevelUpAbility;
import mage.cards.LevelerCard;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.turn.TurnMod;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class LighthouseChronologist extends LevelerCard<LighthouseChronologist> {
public LighthouseChronologist (UUID ownerId) {
super(ownerId, 75, "Lighthouse Chronologist", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{1}{U}");
this.expansionSetCode = "ROE";
this.subtype.add("Human");
this.subtype.add("Wizard");
this.color.setBlue(true);
this.power = new MageInt(1);
this.toughness = new MageInt(3);
this.addAbility(new LevelUpAbility(new ManaCostsImpl("{U}")));
Abilities<Ability> abilities1 = new AbilitiesImpl<Ability>();
this.getLevels().add(new LevelAbility(4, 6, abilities1, 2, 4));
Abilities<Ability> abilities2 = new AbilitiesImpl<Ability>();
abilities2.add(new LighthouseChronologistAbility());
this.getLevels().add(new LevelAbility(7, -1, abilities2, 3, 5));
}
public LighthouseChronologist (final LighthouseChronologist card) {
super(card);
}
@Override
public LighthouseChronologist copy() {
return new LighthouseChronologist(this);
}
}
class LighthouseChronologistAbility extends TriggeredAbilityImpl<LighthouseChronologistAbility> {
public LighthouseChronologistAbility() {
super(Constants.Zone.BATTLEFIELD, new LighthouseChronologistEffect(), false);
}
public LighthouseChronologistAbility(final LighthouseChronologistAbility ability) {
super(ability);
}
@Override
public LighthouseChronologistAbility copy() {
return new LighthouseChronologistAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.END_TURN_STEP_PRE && !game.getActivePlayerId().equals(this.controllerId)) {
return true;
}
return false;
}
@Override
public String getRule() {
return "At the beginning of each end step, if it's not your turn, take an extra turn after this one.";
}
}
class LighthouseChronologistEffect extends OneShotEffect<LighthouseChronologistEffect> {
public LighthouseChronologistEffect() {
super(Outcome.ExtraTurn);
}
public LighthouseChronologistEffect(final LighthouseChronologistEffect effect) {
super(effect);
}
@Override
public LighthouseChronologistEffect copy() {
return new LighthouseChronologistEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
game.getState().getTurnMods().add(new TurnMod(source.getControllerId(), false));
return true;
}
}

View file

@ -0,0 +1,134 @@
/*
* Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.scarsofmirrodin;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Layer;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.SubLayer;
import mage.Constants.Zone;
import mage.MageInt;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.TapTargetCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.common.BoostControlledEffect;
import mage.abilities.effects.common.ManaEffect;
import mage.abilities.mana.SimpleManaAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetControlledCreaturePermanent;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class GrandArchitect extends CardImpl<GrandArchitect> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("blue creatures");
private static final FilterControlledCreaturePermanent filter2 = new FilterControlledCreaturePermanent("untapped blue creature");
static {
filter.getColor().setBlue(true);
filter.setUseColor(true);
filter2.getColor().setBlue(true);
filter2.setUseColor(true);
filter2.setTapped(false);
filter2.setUseTapped(true);
}
public GrandArchitect(UUID ownerId) {
super(ownerId, 33, "Grand Architect", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{U}{U}");
this.expansionSetCode = "SOM";
this.subtype.add("Vedalken");
this.subtype.add("Artificer");
this.color.setBlue(true);
this.power = new MageInt(1);
this.toughness = new MageInt(3);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, filter, true)));
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new GrandArchitectEffect(), new ManaCostsImpl("{U}")));
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new ManaEffect(Mana.ColorlessMana(2)), new TapTargetCost(new TargetControlledCreaturePermanent(1, 1, filter2, true))));
//TODO: add filter to mana
}
public GrandArchitect(final GrandArchitect card) {
super(card);
}
@Override
public GrandArchitect copy() {
return new GrandArchitect(this);
}
}
class GrandArchitectEffect extends ContinuousEffectImpl<GrandArchitectEffect> {
public GrandArchitectEffect() {
super(Duration.EndOfTurn, Layer.ColorChangingEffects_5, SubLayer.NA, Outcome.Detriment);
}
public GrandArchitectEffect(final GrandArchitectEffect effect) {
super(effect);
}
@Override
public GrandArchitectEffect copy() {
return new GrandArchitectEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
permanent.getColor().setRed(true);
permanent.getColor().setWhite(false);
permanent.getColor().setGreen(false);
permanent.getColor().setBlue(false);
permanent.getColor().setBlack(false);
return true;
}
return false;
}
@Override
public String getText(Ability source) {
return "Target artifact creature becomes blue until end of turn";
}
}

View file

@ -0,0 +1,169 @@
/*
* Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.scarsofmirrodin;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.costs.common.TapVariableTargetCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.BoostPowerXSourceEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.token.Token;
import mage.players.Player;
import mage.target.common.TargetControlledCreaturePermanent;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class MyrBattlesphere extends CardImpl<MyrBattlesphere> {
public MyrBattlesphere(UUID ownerId) {
super(ownerId, 180, "Myr Battlesphere", Rarity.RARE, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{7}");
this.expansionSetCode = "SOM";
this.subtype.add("Myr");
this.subtype.add("Construct");
this.power = new MageInt(4);
this.toughness = new MageInt(7);
this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new MyrToken(), 4), false));
this.addAbility(new MyrBattlesphereAbility());
}
public MyrBattlesphere(final MyrBattlesphere card) {
super(card);
}
@Override
public MyrBattlesphere copy() {
return new MyrBattlesphere(this);
}
}
class MyrToken extends Token {
public MyrToken() {
super("Myr", "1/1 colorless Myr artifact creature");
cardType.add(CardType.CREATURE);
cardType.add(CardType.ARTIFACT);
subtype.add("Myr");
power = new MageInt(1);
toughness = new MageInt(1);
}
}
class MyrBattlesphereAbility extends TriggeredAbilityImpl<MyrBattlesphereAbility> {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped Myr");
static {
filter.getSubtype().add("Myr");
filter.setTapped(false);
filter.setUseTapped(true);
}
public MyrBattlesphereAbility() {
super(Zone.BATTLEFIELD, new BoostPowerXSourceEffect(Duration.EndOfTurn), true);
this.addEffect(new MyrBattlesphereEffect());
this.addCost(new TapVariableTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, false)));
}
public MyrBattlesphereAbility(final MyrBattlesphereAbility ability) {
super(ability);
}
@Override
public boolean checkInterveningIfClause(Game game) {
if (costs.isPaid())
return true;
return costs.pay(game, this.getId(), this.getControllerId(), false);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId()) ) {
costs.clearPaid();
return true;
}
return false;
}
@Override
public String getRule() {
return "When Myr Battlesphere attacks, " + super.getRule();
}
@Override
public MyrBattlesphereAbility copy() {
return new MyrBattlesphereAbility(this);
}
}
class MyrBattlesphereEffect extends OneShotEffect<MyrBattlesphereEffect> {
public MyrBattlesphereEffect() {
super(Outcome.Damage);
}
public MyrBattlesphereEffect(final MyrBattlesphereEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
UUID defenderId = game.getCombat().getDefendingPlayer(source.getSourceId());
Player defender = game.getPlayer(defenderId);
if (defender != null) {
defender.damage(source.getCosts().getVariableCosts().get(0).getAmount(), source.getSourceId(), game, false, false);
return true;
}
return false;
}
@Override
public MyrBattlesphereEffect copy() {
return new MyrBattlesphereEffect(this);
}
}

View file

@ -0,0 +1,124 @@
/*
* Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.worldwake;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTappedAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.mana.BlueManaAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class HalimarDepths extends CardImpl<HalimarDepths> {
public HalimarDepths(UUID ownerId) {
super(ownerId, 137, "Halimar Depths", Rarity.COMMON, new CardType[]{CardType.LAND}, null);
this.expansionSetCode = "WWK";
this.addAbility(new EntersBattlefieldTappedAbility());
this.addAbility(new EntersBattlefieldTriggeredAbility(new HalimarDepthsEffect()));
this.addAbility(new BlueManaAbility());
}
public HalimarDepths(final HalimarDepths card) {
super(card);
}
@Override
public HalimarDepths copy() {
return new HalimarDepths(this);
}
}
class HalimarDepthsEffect extends OneShotEffect<HalimarDepthsEffect> {
protected static FilterCard filter2 = new FilterCard("card to put on the top of your library");
public HalimarDepthsEffect() {
super(Outcome.Benefit);
}
public HalimarDepthsEffect(final HalimarDepthsEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Cards cards = new CardsImpl(Zone.PICK);
for (int i = 0; i < 3; i++) {
Card card = player.getLibrary().removeFromTop(game);
cards.add(card);
game.setZone(card.getId(), Zone.PICK);
}
if (cards.size() > 1) {
TargetCard target2 = new TargetCard(Zone.PICK, filter2);
target2.setRequired(true);
while (cards.size() > 1) {
player.choose(cards, target2, game);
Card card = cards.get(target2.getFirstTarget(), game);
cards.remove(card);
card.moveToZone(Zone.LIBRARY, source.getId(), game, true);
target2.clearChosen();
}
}
if (cards.size() == 1) {
Card card = cards.get(cards.iterator().next(), game);
card.moveToZone(Zone.LIBRARY, source.getId(), game, true);
}
return true;
}
@Override
public HalimarDepthsEffect copy() {
return new HalimarDepthsEffect(this);
}
@Override
public String getText(Ability source) {
return "look at the top three cards of your library, then put them back in any order";
}
}

View file

@ -97,13 +97,8 @@ class GoblinGuideEffect extends OneShotEffect<GoblinGuideEffect> {
@Override
public boolean apply(Game game, Ability source) {
Player defender = null;
for (CombatGroup group: game.getCombat().getGroups()) {
if (group.getAttackers().contains(source.getSourceId())) {
defender = game.getPlayer(group.getDefenderId());
break;
}
}
UUID defenderId = game.getCombat().getDefendingPlayer(source.getSourceId());
Player defender = game.getPlayer(defenderId);
if (defender != null) {
Cards cards = new CardsImpl();
Card card = defender.getLibrary().getFromTop(game);

View file

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

View file

@ -31,6 +31,6 @@ public class BeginningOfControllerUpkeepTriggeredAbility extends TriggeredAbilit
@Override
public String getRule() {
return "At the beginning of your upkeep, " + effects.getText(this);
return "At the beginning of your upkeep, " + effects.getText(this) + ".";
}
}

View file

@ -0,0 +1,100 @@
/*
* Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.costs.common;
import java.util.List;
import java.util.UUID;
import mage.Constants.Outcome;
import mage.abilities.costs.CostImpl;
import mage.abilities.costs.VariableCost;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetControlledPermanent;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class TapVariableTargetCost extends CostImpl<TapVariableTargetCost> implements VariableCost {
protected int amountPaid = 0;
protected TargetControlledPermanent target;
public TapVariableTargetCost(TargetControlledPermanent target) {
this.target = target;
this.text = "tap X " + target.getTargetName() + " you control";
}
public TapVariableTargetCost(final TapVariableTargetCost cost) {
super(cost);
this.target = cost.target.copy();
this.amountPaid = cost.amountPaid;
}
@Override
public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
return target.canChoose(controllerId, game);
}
@Override
public boolean pay(Game game, UUID sourceId, UUID controllerId, boolean noMana) {
amountPaid = 0;
while (true) {
target.clearChosen();
if (target.choose(Outcome.Tap, controllerId, game)) {
Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null && permanent.tap(game)) {
amountPaid++;
}
}
else {
break;
}
}
paid = true;
return true;
}
@Override
public void clearPaid() {
paid = false;
amountPaid = 0;
}
@Override
public int getAmount() {
return amountPaid;
}
@Override
public TapVariableTargetCost copy() {
return new TapVariableTargetCost(this);
}
}

View file

@ -42,6 +42,7 @@ public class AddCountersSourceEffect extends OneShotEffect<AddCountersSourceEffe
private int amount;
private String name;
private Counter counter;
public AddCountersSourceEffect(String name, int amount) {
super(Outcome.Benefit);
@ -52,20 +53,25 @@ public class AddCountersSourceEffect extends OneShotEffect<AddCountersSourceEffe
public AddCountersSourceEffect(Counter counter) {
super(Outcome.Benefit);
this.name = counter.getName();
this.amount = counter.getCount();
this.counter = counter;
}
public AddCountersSourceEffect(final AddCountersSourceEffect effect) {
super(effect);
this.amount = effect.amount;
this.name = effect.name;
this.counter = effect.counter;
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
permanent.addCounters(name, amount);
if (counter != null) {
permanent.addCounters(counter);
} else {
permanent.addCounters(name, amount);
}
}
return true;
}

View file

@ -58,7 +58,7 @@ public class BoostPowerXSourceEffect extends ContinuousEffectImpl<BoostPowerXSou
@Override
public boolean apply(Game game, Ability source) {
int amount = source.getManaCosts().getVariableCosts().get(0).getAmount();
int amount = source.getCosts().getVariableCosts().get(0).getAmount();
Permanent target = (Permanent) game.getPermanent(source.getSourceId());
if (target != null) {
target.addPower(amount);

View file

@ -56,7 +56,7 @@ public class DamageXTargetEffect extends OneShotEffect<DamageXTargetEffect> {
@Override
public boolean apply(Game game, Ability source) {
int amount = source.getManaCosts().getVariableCosts().get(0).getAmount();
int amount = source.getCosts().getVariableCosts().get(0).getAmount();
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
permanent.damage(amount, source.getId(), game, true, false);

View file

@ -0,0 +1,73 @@
/*
* Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.effects.common;
import mage.Constants.Outcome;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class DrawDiscardControllerEffect extends OneShotEffect<DrawDiscardControllerEffect> {
public DrawDiscardControllerEffect() {
super(Outcome.DrawCard);
}
public DrawDiscardControllerEffect(final DrawDiscardControllerEffect effect) {
super(effect);
}
@Override
public DrawDiscardControllerEffect copy() {
return new DrawDiscardControllerEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
player.drawCards(1, game);
player.discard(1, source, game);
return true;
}
return false;
}
@Override
public String getText(Ability source) {
return "Draw a card, then discard a card";
}
}

View file

@ -191,11 +191,15 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
@Override
public Player getPlayer(UUID playerId) {
if (playerId == null)
return null;
return state.getPlayer(playerId);
}
@Override
public MageObject getObject(UUID objectId) {
if (objectId == null)
return null;
MageObject object;
if (state.getBattlefield().containsPermanent(objectId)) {
object = state.getBattlefield().getPermanent(objectId);
@ -217,16 +221,22 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
@Override
public Permanent getPermanent(UUID permanentId) {
if (permanentId == null)
return null;
return state.getPermanent(permanentId);
}
@Override
public Card getCard(UUID cardId) {
if (cardId == null)
return null;
return gameCards.get(cardId);
}
@Override
public Zone getZone(UUID objectId) {
if (objectId == null)
return null;
return state.getZone(objectId);
}

View file

@ -318,6 +318,17 @@ public class Combat implements Serializable, Copyable<Combat> {
return false;
}
public UUID getDefendingPlayer(UUID attackerId) {
UUID defenderId = null;
for (CombatGroup group: groups) {
if (group.getAttackers().contains(attackerId)) {
defenderId = group.getDefenderId();
break;
}
}
return defenderId;
}
private Set<UUID> getPlayerDefenders(Game game) {
Set<UUID> playerDefenders = new HashSet<UUID>();
for (CombatGroup group: groups) {