mirror of
https://github.com/correl/mage.git
synced 2025-01-13 19:11:33 +00:00
Merge branch 'master' into auriok-steelshaper
This commit is contained in:
commit
d5215e3e6d
17 changed files with 1356 additions and 1201 deletions
|
@ -1,145 +1,146 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without modification, are
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
* permitted provided that the following conditions are met:
|
* permitted provided that the following conditions are met:
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
* conditions and the following disclaimer.
|
* conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
* 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
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
* provided with the distribution.
|
* provided with the distribution.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
* 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
|
* 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
|
* 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
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 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
|
* 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
|
* 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
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* The views and conclusions contained in the software and documentation are those of the
|
* 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
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
package mage.sets.championsofkamigawa;
|
package mage.sets.championsofkamigawa;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.condition.Condition;
|
import mage.abilities.condition.Condition;
|
||||||
import mage.abilities.decorator.ConditionalOneShotEffect;
|
import mage.abilities.decorator.ConditionalOneShotEffect;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.common.discard.DiscardControllerEffect;
|
import mage.abilities.effects.common.discard.DiscardControllerEffect;
|
||||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||||
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
|
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.constants.WatcherScope;
|
import mage.constants.WatcherScope;
|
||||||
import mage.filter.common.FilterCreatureCard;
|
import mage.filter.common.FilterCreatureCard;
|
||||||
import mage.filter.predicate.mageobject.NamePredicate;
|
import mage.filter.predicate.mageobject.NamePredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.events.GameEvent.EventType;
|
import mage.game.events.GameEvent.EventType;
|
||||||
import mage.game.stack.Spell;
|
import mage.game.stack.Spell;
|
||||||
import mage.target.common.TargetCardInLibrary;
|
import mage.target.common.TargetCardInLibrary;
|
||||||
import mage.watchers.Watcher;
|
import mage.watchers.Watcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
public class SiftThroughSands extends CardImpl {
|
public class SiftThroughSands extends CardImpl {
|
||||||
|
|
||||||
private static final String rule = "If you've cast a spell named Peer Through Depths and a spell named Reach Through Mists this turn, you may search your library for a card named The Unspeakable, put it onto the battlefield, then shuffle your library";
|
private static final String rule = "If you've cast a spell named Peer Through Depths and a spell named Reach Through Mists this turn, you may search your library for a card named The Unspeakable, put it onto the battlefield, then shuffle your library";
|
||||||
private static final FilterCreatureCard filter = new FilterCreatureCard("a card named The Unspeakable");
|
private static final FilterCreatureCard filter = new FilterCreatureCard("a card named The Unspeakable");
|
||||||
static {
|
static {
|
||||||
filter.add(new NamePredicate("The Unspeakable"));
|
filter.add(new NamePredicate("The Unspeakable"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public SiftThroughSands(UUID ownerId) {
|
public SiftThroughSands(UUID ownerId) {
|
||||||
super(ownerId, 84, "Sift Through Sands", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{U}{U}");
|
super(ownerId, 84, "Sift Through Sands", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{U}{U}");
|
||||||
this.expansionSetCode = "CHK";
|
this.expansionSetCode = "CHK";
|
||||||
this.subtype.add("Arcane");
|
this.subtype.add("Arcane");
|
||||||
|
|
||||||
this.color.setBlue(true);
|
this.color.setBlue(true);
|
||||||
|
|
||||||
// Draw two cards, then discard a card.
|
// Draw two cards, then discard a card.
|
||||||
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(2));
|
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(2));
|
||||||
Effect effect = new DiscardControllerEffect(1);
|
Effect effect = new DiscardControllerEffect(1);
|
||||||
effect.setText(", then discard a card");
|
effect.setText(", then discard a card");
|
||||||
this.getSpellAbility().addEffect(effect);
|
this.getSpellAbility().addEffect(effect);
|
||||||
// If you've cast a spell named Peer Through Depths and a spell named Reach Through Mists this turn, you may search your library for a card named The Unspeakable, put it onto the battlefield, then shuffle your library.
|
|
||||||
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter), false, true), new SiftThroughSandsCondition(), rule));
|
// If you've cast a spell named Peer Through Depths and a spell named Reach Through Mists this turn, you may search your library for a card named The Unspeakable, put it onto the battlefield, then shuffle your library.
|
||||||
this.getSpellAbility().addWatcher(new SiftThroughSandsWatcher());
|
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter), false, true), new SiftThroughSandsCondition(), rule));
|
||||||
}
|
this.getSpellAbility().addWatcher(new SiftThroughSandsWatcher());
|
||||||
|
}
|
||||||
public SiftThroughSands(final SiftThroughSands card) {
|
|
||||||
super(card);
|
public SiftThroughSands(final SiftThroughSands card) {
|
||||||
}
|
super(card);
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public SiftThroughSands copy() {
|
@Override
|
||||||
return new SiftThroughSands(this);
|
public SiftThroughSands copy() {
|
||||||
}
|
return new SiftThroughSands(this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
class SiftThroughSandsCondition implements Condition {
|
|
||||||
|
class SiftThroughSandsCondition implements Condition {
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
@Override
|
||||||
SiftThroughSandsWatcher watcher = (SiftThroughSandsWatcher) game.getState().getWatchers().get("SiftThroughSandsWatcher", source.getControllerId());
|
public boolean apply(Game game, Ability source) {
|
||||||
if (watcher != null) {
|
SiftThroughSandsWatcher watcher = (SiftThroughSandsWatcher) game.getState().getWatchers().get("SiftThroughSandsWatcher", source.getControllerId());
|
||||||
return watcher.conditionMet();
|
if (watcher != null) {
|
||||||
}
|
return watcher.conditionMet();
|
||||||
return false;
|
}
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
class SiftThroughSandsWatcher extends Watcher {
|
|
||||||
|
class SiftThroughSandsWatcher extends Watcher {
|
||||||
boolean castPeerThroughDepths = false;
|
|
||||||
boolean castReachThroughMists = false;
|
boolean castPeerThroughDepths = false;
|
||||||
|
boolean castReachThroughMists = false;
|
||||||
public SiftThroughSandsWatcher() {
|
|
||||||
super("SiftThroughSandsWatcher", WatcherScope.PLAYER);
|
public SiftThroughSandsWatcher() {
|
||||||
}
|
super("SiftThroughSandsWatcher", WatcherScope.PLAYER);
|
||||||
|
}
|
||||||
public SiftThroughSandsWatcher(final SiftThroughSandsWatcher watcher) {
|
|
||||||
super(watcher);
|
public SiftThroughSandsWatcher(final SiftThroughSandsWatcher watcher) {
|
||||||
this.castPeerThroughDepths = watcher.castPeerThroughDepths;
|
super(watcher);
|
||||||
this.castReachThroughMists = watcher.castReachThroughMists;
|
this.castPeerThroughDepths = watcher.castPeerThroughDepths;
|
||||||
}
|
this.castReachThroughMists = watcher.castReachThroughMists;
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public SiftThroughSandsWatcher copy() {
|
@Override
|
||||||
return new SiftThroughSandsWatcher(this);
|
public SiftThroughSandsWatcher copy() {
|
||||||
}
|
return new SiftThroughSandsWatcher(this);
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public void watch(GameEvent event, Game game) {
|
@Override
|
||||||
if (condition == true) { //no need to check - condition has already occured
|
public void watch(GameEvent event, Game game) {
|
||||||
return;
|
if (condition == true) { //no need to check - condition has already occured
|
||||||
}
|
return;
|
||||||
if (event.getType() == EventType.SPELL_CAST
|
}
|
||||||
&& controllerId == event.getPlayerId()) {
|
if (event.getType() == EventType.SPELL_CAST
|
||||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
&& controllerId == event.getPlayerId()) {
|
||||||
if (spell.getCard().getName().equals("Peer Through Depths")) {
|
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||||
castPeerThroughDepths = true;
|
if (spell.getCard().getName().equals("Peer Through Depths")) {
|
||||||
} else if (spell.getCard().getName().equals("Reach Through Mists")) {
|
castPeerThroughDepths = true;
|
||||||
castReachThroughMists = true;
|
} else if (spell.getCard().getName().equals("Reach Through Mists")) {
|
||||||
}
|
castReachThroughMists = true;
|
||||||
condition = castPeerThroughDepths && castReachThroughMists;
|
}
|
||||||
}
|
condition = castPeerThroughDepths && castReachThroughMists;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public void reset() {
|
@Override
|
||||||
super.reset();
|
public void reset() {
|
||||||
this.castPeerThroughDepths = false;
|
super.reset();
|
||||||
this.castReachThroughMists = false;
|
this.castPeerThroughDepths = false;
|
||||||
}
|
this.castReachThroughMists = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -70,7 +70,6 @@ public class DungeonGeists extends CardImpl {
|
||||||
this.expansionSetCode = "DKA";
|
this.expansionSetCode = "DKA";
|
||||||
this.subtype.add("Spirit");
|
this.subtype.add("Spirit");
|
||||||
|
|
||||||
this.color.setBlue(true);
|
|
||||||
this.power = new MageInt(3);
|
this.power = new MageInt(3);
|
||||||
this.toughness = new MageInt(3);
|
this.toughness = new MageInt(3);
|
||||||
|
|
||||||
|
@ -112,40 +111,52 @@ class DungeonGeistsEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
return false;
|
return event.getType() == GameEvent.EventType.UNTAP || event.getType() == GameEvent.EventType.ZONE_CHANGE || event.getType() == GameEvent.EventType.LOST_CONTROL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
// Source must be on the battlefield (it's neccessary to check here because if as response to the enter
|
// Source must be on the battlefield (it's neccessary to check here because if as response to the enter
|
||||||
// the battlefield triggered ability the source dies (or will be exiled), then the ZONE_CHANGE or LOST_CONTROL
|
// the battlefield triggered ability the source dies (or will be exiled), then the ZONE_CHANGE or LOST_CONTROL
|
||||||
// event will happen before this effect is applied ever)
|
// event will happen before this effect is applied ever)
|
||||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
Permanent sourcePermanent = (Permanent) source.getSourceObjectIfItStillExists(game);
|
||||||
if (sourcePermanent == null || !sourcePermanent.getControllerId().equals(source.getControllerId())) {
|
if (sourcePermanent == null || !sourcePermanent.getControllerId().equals(source.getControllerId())) {
|
||||||
this.used = true;
|
discard();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (event.getType() == GameEvent.EventType.LOST_CONTROL) {
|
switch(event.getType()) {
|
||||||
if (event.getTargetId().equals(source.getSourceId())) {
|
case ZONE_CHANGE:
|
||||||
discard();
|
// end effect if source does a zone move
|
||||||
return false;
|
if (event.getTargetId().equals(source.getSourceId())) {
|
||||||
}
|
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
|
||||||
|
if (zEvent.getFromZone() == Zone.BATTLEFIELD) {
|
||||||
|
discard();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case UNTAP:
|
||||||
|
// prevent to untap the target creature
|
||||||
|
if (game.getTurn().getStepType() == PhaseStep.UNTAP && event.getTargetId().equals(targetPointer.getFirst(game, source))) {
|
||||||
|
Permanent targetCreature = game.getPermanent(targetPointer.getFirst(game, source));
|
||||||
|
if (targetCreature != null) {
|
||||||
|
return targetCreature.getControllerId().equals(game.getActivePlayerId());
|
||||||
|
} else {
|
||||||
|
discard();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case LOST_CONTROL:
|
||||||
|
// end effect if source control is changed
|
||||||
|
if (event.getTargetId().equals(source.getSourceId())) {
|
||||||
|
discard();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && event.getTargetId().equals(source.getSourceId())) {
|
|
||||||
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
|
|
||||||
if (zEvent.getFromZone() == Zone.BATTLEFIELD) {
|
|
||||||
discard();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (game.getTurn().getStepType() == PhaseStep.UNTAP && event.getType() == GameEvent.EventType.UNTAP) {
|
|
||||||
if (event.getTargetId().equals(targetPointer.getFirst(game, source))) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,119 +1,117 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without modification, are
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
* permitted provided that the following conditions are met:
|
* permitted provided that the following conditions are met:
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
* conditions and the following disclaimer.
|
* conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
* 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
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
* provided with the distribution.
|
* provided with the distribution.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
* 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
|
* 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
|
* 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
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 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
|
* 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
|
* 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
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* The views and conclusions contained in the software and documentation are those of the
|
* 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
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
package mage.sets.gatecrash;
|
package mage.sets.gatecrash;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.game.permanent.token.Token;
|
import mage.game.permanent.token.Token;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
public class MimingSlime extends CardImpl {
|
public class MimingSlime extends CardImpl {
|
||||||
|
|
||||||
public MimingSlime(UUID ownerId) {
|
public MimingSlime(UUID ownerId) {
|
||||||
super(ownerId, 126, "Miming Slime", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{2}{G}");
|
super(ownerId, 126, "Miming Slime", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{2}{G}");
|
||||||
this.expansionSetCode = "GTC";
|
this.expansionSetCode = "GTC";
|
||||||
|
|
||||||
this.color.setGreen(true);
|
// Put an X/X green Ooze creature token onto the battlefield, where X is the greatest power among creatures you control.
|
||||||
|
this.getSpellAbility().addEffect(new MimingSlimeEffect());
|
||||||
// Put an X/X green Ooze creature token onto the battlefield, where X is the greatest power among creatures you control.
|
}
|
||||||
this.getSpellAbility().addEffect(new MimingSlimeEffect());
|
|
||||||
}
|
public MimingSlime(final MimingSlime card) {
|
||||||
|
super(card);
|
||||||
public MimingSlime(final MimingSlime card) {
|
}
|
||||||
super(card);
|
|
||||||
}
|
@Override
|
||||||
|
public MimingSlime copy() {
|
||||||
@Override
|
return new MimingSlime(this);
|
||||||
public MimingSlime copy() {
|
}
|
||||||
return new MimingSlime(this);
|
}
|
||||||
}
|
|
||||||
}
|
class MimingSlimeEffect extends OneShotEffect {
|
||||||
|
|
||||||
class MimingSlimeEffect extends OneShotEffect {
|
public MimingSlimeEffect() {
|
||||||
|
super(Outcome.PutCreatureInPlay);
|
||||||
public MimingSlimeEffect() {
|
staticText = "Put an X/X green Ooze creature token onto the battlefield, where X is the greatest power among creatures you control";
|
||||||
super(Outcome.PutCreatureInPlay);
|
}
|
||||||
staticText = "Put an X/X green Ooze creature token onto the battlefield, where X is the greatest power among creatures you control";
|
|
||||||
}
|
public MimingSlimeEffect(final MimingSlimeEffect effect) {
|
||||||
|
super(effect);
|
||||||
public MimingSlimeEffect(final MimingSlimeEffect effect) {
|
}
|
||||||
super(effect);
|
|
||||||
}
|
@Override
|
||||||
|
public MimingSlimeEffect copy() {
|
||||||
@Override
|
return new MimingSlimeEffect(this);
|
||||||
public MimingSlimeEffect copy() {
|
}
|
||||||
return new MimingSlimeEffect(this);
|
|
||||||
}
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
@Override
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
public boolean apply(Game game, Ability source) {
|
if (player != null) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId(), game);
|
||||||
if (player != null) {
|
int amount = 0;
|
||||||
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId(), game);
|
for (Permanent creature : creatures) {
|
||||||
int amount = 0;
|
int power = creature.getPower().getValue();
|
||||||
for (Permanent creature : creatures) {
|
if (amount < power) {
|
||||||
int power = creature.getPower().getValue();
|
amount = power;
|
||||||
if (amount < power) {
|
}
|
||||||
amount = power;
|
}
|
||||||
}
|
OozeToken oozeToken = new OozeToken();
|
||||||
}
|
oozeToken.getPower().initValue(amount);
|
||||||
OozeToken oozeToken = new OozeToken();
|
oozeToken.getToughness().initValue(amount);
|
||||||
oozeToken.getPower().initValue(amount);
|
oozeToken.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
|
||||||
oozeToken.getToughness().initValue(amount);
|
return true;
|
||||||
oozeToken.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
|
}
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
}
|
class OozeToken extends Token {
|
||||||
|
public OozeToken() {
|
||||||
class OozeToken extends Token {
|
super("Ooze", "X/X green Ooze creature token");
|
||||||
public OozeToken() {
|
cardType.add(CardType.CREATURE);
|
||||||
super("Ooze", "X/X green Ooze creature token");
|
subtype.add("Ooze");
|
||||||
cardType.add(CardType.CREATURE);
|
color.setGreen(true);
|
||||||
subtype.add("Ooze");
|
power = new MageInt(0);
|
||||||
color.setGreen(true);
|
toughness = new MageInt(0);
|
||||||
power = new MageInt(0);
|
setOriginalExpansionSetCode("RTR");
|
||||||
toughness = new MageInt(0);
|
}
|
||||||
setOriginalExpansionSetCode("RTR");
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,111 +1,109 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without modification, are
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
* permitted provided that the following conditions are met:
|
* permitted provided that the following conditions are met:
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
* conditions and the following disclaimer.
|
* conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
* 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
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
* provided with the distribution.
|
* provided with the distribution.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
* 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
|
* 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
|
* 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
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 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
|
* 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
|
* 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
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* The views and conclusions contained in the software and documentation are those of the
|
* 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
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
package mage.sets.gatecrash;
|
package mage.sets.gatecrash;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.costs.Cost;
|
import mage.abilities.costs.Cost;
|
||||||
import mage.abilities.costs.common.RemoveVariableCountersTargetCost;
|
import mage.abilities.costs.common.RemoveVariableCountersTargetCost;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.counters.CounterType;
|
import mage.counters.CounterType;
|
||||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.token.Token;
|
import mage.game.permanent.token.Token;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
public class OozeFlux extends CardImpl {
|
public class OozeFlux extends CardImpl {
|
||||||
|
|
||||||
public OozeFlux(UUID ownerId) {
|
public OozeFlux(UUID ownerId) {
|
||||||
super(ownerId, 128, "Ooze Flux", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{G}");
|
super(ownerId, 128, "Ooze Flux", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{G}");
|
||||||
this.expansionSetCode = "GTC";
|
this.expansionSetCode = "GTC";
|
||||||
|
|
||||||
this.color.setGreen(true);
|
// {1}{G}, Remove one or more +1/+1 counters from among creatures you control: Put an X/X green Ooze creature token onto the battlefield, where X is the number of +1/+1 counters removed this way.
|
||||||
|
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new OozeFluxCreateTokenEffect(new OozeToken()),new ManaCostsImpl("{1}{G}"));
|
||||||
// {1}{G}, Remove one or more +1/+1 counters from among creatures you control: Put an X/X green Ooze creature token onto the battlefield, where X is the number of +1/+1 counters removed this way.
|
ability.addCost(new RemoveVariableCountersTargetCost(new FilterControlledCreaturePermanent("creatures you control"), CounterType.P1P1, "one or more", 1));
|
||||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new OozeFluxCreateTokenEffect(new OozeToken()),new ManaCostsImpl("{1}{G}"));
|
this.addAbility(ability);
|
||||||
ability.addCost(new RemoveVariableCountersTargetCost(new FilterControlledCreaturePermanent("creatures you control"), CounterType.P1P1, "one or more", 1));
|
}
|
||||||
this.addAbility(ability);
|
|
||||||
}
|
public OozeFlux(final OozeFlux card) {
|
||||||
|
super(card);
|
||||||
public OozeFlux(final OozeFlux card) {
|
}
|
||||||
super(card);
|
|
||||||
}
|
@Override
|
||||||
|
public OozeFlux copy() {
|
||||||
@Override
|
return new OozeFlux(this);
|
||||||
public OozeFlux copy() {
|
}
|
||||||
return new OozeFlux(this);
|
}
|
||||||
}
|
|
||||||
}
|
class OozeFluxCreateTokenEffect extends OneShotEffect {
|
||||||
|
|
||||||
class OozeFluxCreateTokenEffect extends OneShotEffect {
|
private final Token token;
|
||||||
|
|
||||||
private Token token;
|
public OozeFluxCreateTokenEffect(Token token) {
|
||||||
|
super(Outcome.PutCreatureInPlay);
|
||||||
public OozeFluxCreateTokenEffect(Token token) {
|
this.token = token;
|
||||||
super(Outcome.PutCreatureInPlay);
|
staticText = "Put an X/X green Ooze creature token onto the battlefield, where X is the number of +1/+1 counters removed this way";
|
||||||
this.token = token;
|
}
|
||||||
staticText = "Put an X/X green Ooze creature token onto the battlefield, where X is the number of +1/+1 counters removed this way";
|
|
||||||
}
|
public OozeFluxCreateTokenEffect(final OozeFluxCreateTokenEffect effect) {
|
||||||
|
super(effect);
|
||||||
public OozeFluxCreateTokenEffect(final OozeFluxCreateTokenEffect effect) {
|
this.token = effect.token.copy();
|
||||||
super(effect);
|
}
|
||||||
this.token = effect.token.copy();
|
|
||||||
}
|
@Override
|
||||||
|
public OozeFluxCreateTokenEffect copy() {
|
||||||
@Override
|
return new OozeFluxCreateTokenEffect(this);
|
||||||
public OozeFluxCreateTokenEffect copy() {
|
}
|
||||||
return new OozeFluxCreateTokenEffect(this);
|
|
||||||
}
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
@Override
|
int xValue = 0;
|
||||||
public boolean apply(Game game, Ability source) {
|
for (Cost cost : source.getCosts()) {
|
||||||
int xValue = 0;
|
if (cost instanceof RemoveVariableCountersTargetCost) {
|
||||||
for (Cost cost : source.getCosts()) {
|
xValue = ((RemoveVariableCountersTargetCost) cost).getAmount();
|
||||||
if (cost instanceof RemoveVariableCountersTargetCost) {
|
break;
|
||||||
xValue = ((RemoveVariableCountersTargetCost) cost).getAmount();
|
}
|
||||||
break;
|
}
|
||||||
}
|
Token tokenCopy = token.copy();
|
||||||
}
|
tokenCopy.getAbilities().newId();
|
||||||
Token tokenCopy = token.copy();
|
tokenCopy.getPower().initValue(xValue);
|
||||||
tokenCopy.getAbilities().newId();
|
tokenCopy.getToughness().initValue(xValue);
|
||||||
tokenCopy.getPower().initValue(xValue);
|
tokenCopy.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
|
||||||
tokenCopy.getToughness().initValue(xValue);
|
return true;
|
||||||
tokenCopy.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
|
}
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -30,10 +30,12 @@ package mage.sets.limitedalpha;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
|
@ -81,14 +83,23 @@ class TimetwisterEffect extends OneShotEffect {
|
||||||
for (UUID playerId: sourcePlayer.getInRange()) {
|
for (UUID playerId: sourcePlayer.getInRange()) {
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
player.getLibrary().addAll(player.getHand().getCards(game), game);
|
for (Card card: player.getHand().getCards(game)) {
|
||||||
player.getLibrary().addAll(player.getGraveyard().getCards(game), game);
|
card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
|
||||||
|
}
|
||||||
|
for (Card card: player.getGraveyard().getCards(game)) {
|
||||||
|
card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
|
||||||
|
}
|
||||||
player.shuffleLibrary(game);
|
player.shuffleLibrary(game);
|
||||||
player.getHand().clear();
|
|
||||||
player.getGraveyard().clear();
|
|
||||||
player.drawCards(7, game);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
game.getState().handleSimultaneousEvent(game); // needed here so state based triggered effects
|
||||||
|
for (UUID playerId: sourcePlayer.getInRange()) {
|
||||||
|
Player player = game.getPlayer(playerId);
|
||||||
|
if (player != null) {
|
||||||
|
player.drawCards(7, game);
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,30 +106,24 @@ class GrandAbolisherEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
boolean spell = event.getType() == GameEvent.EventType.CAST_SPELL;
|
return event.getType() == GameEvent.EventType.CAST_SPELL || event.getType() == GameEvent.EventType.ACTIVATE_ABILITY;
|
||||||
boolean activated = event.getType() == GameEvent.EventType.ACTIVATE_ABILITY;
|
|
||||||
if ((spell || activated) && game.getActivePlayerId().equals(source.getControllerId()) && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
|
|
||||||
|
|
||||||
if (spell) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check source of activated ability
|
|
||||||
Permanent permanent = game.getPermanent(event.getSourceId());
|
|
||||||
if (permanent != null) {
|
|
||||||
return permanent.getCardType().contains(CardType.ARTIFACT) || permanent.getCardType().contains(CardType.CREATURE)
|
|
||||||
|| permanent.getCardType().contains(CardType.ENCHANTMENT);
|
|
||||||
} else {
|
|
||||||
MageObject object = game.getObject(event.getSourceId());
|
|
||||||
if (object != null) {
|
|
||||||
return object.getCardType().contains(CardType.ARTIFACT) || object.getCardType().contains(CardType.CREATURE)
|
|
||||||
|| object.getCardType().contains(CardType.ENCHANTMENT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
|
if (game.getActivePlayerId().equals(source.getControllerId()) && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
|
||||||
|
switch(event.getType()) {
|
||||||
|
case CAST_SPELL:
|
||||||
|
return true;
|
||||||
|
case ACTIVATE_ABILITY:
|
||||||
|
Permanent permanent = game.getPermanent(event.getSourceId());
|
||||||
|
if (permanent != null) {
|
||||||
|
return permanent.getCardType().contains(CardType.ARTIFACT) || permanent.getCardType().contains(CardType.CREATURE)
|
||||||
|
|| permanent.getCardType().contains(CardType.ENCHANTMENT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,9 @@ import mage.cards.CardImpl;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
|
import mage.constants.SetTargetPointer;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.filter.FilterSpell;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.common.TargetCardInHand;
|
import mage.target.common.TargetCardInHand;
|
||||||
|
@ -52,7 +55,7 @@ public class PainfulQuandary extends CardImpl {
|
||||||
this.expansionSetCode = "SOM";
|
this.expansionSetCode = "SOM";
|
||||||
|
|
||||||
// Whenever an opponent casts a spell, that player loses 5 life unless he or she discards a card.
|
// Whenever an opponent casts a spell, that player loses 5 life unless he or she discards a card.
|
||||||
this.addAbility(new SpellCastOpponentTriggeredAbility(new PainfulQuandryEffect(), false));
|
this.addAbility(new SpellCastOpponentTriggeredAbility(Zone.BATTLEFIELD, new PainfulQuandryEffect(), new FilterSpell(), false, SetTargetPointer.PLAYER));
|
||||||
}
|
}
|
||||||
|
|
||||||
public PainfulQuandary(final PainfulQuandary card) {
|
public PainfulQuandary(final PainfulQuandary card) {
|
||||||
|
|
|
@ -36,6 +36,7 @@ import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.costs.mana.ColoredManaCost;
|
import mage.abilities.costs.mana.ColoredManaCost;
|
||||||
import mage.abilities.effects.common.RegenerateSourceEffect;
|
import mage.abilities.effects.common.RegenerateSourceEffect;
|
||||||
|
import mage.abilities.effects.common.SacrificeControllerEffect;
|
||||||
import mage.abilities.effects.common.SacrificeEffect;
|
import mage.abilities.effects.common.SacrificeEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.ColoredManaSymbol;
|
import mage.constants.ColoredManaSymbol;
|
||||||
|
@ -54,7 +55,6 @@ public class SpinedFluke extends CardImpl {
|
||||||
this.subtype.add("Worm");
|
this.subtype.add("Worm");
|
||||||
this.subtype.add("Horror");
|
this.subtype.add("Horror");
|
||||||
|
|
||||||
this.color.setBlack(true);
|
|
||||||
this.power = new MageInt(5);
|
this.power = new MageInt(5);
|
||||||
this.toughness = new MageInt(1);
|
this.toughness = new MageInt(1);
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ public class SpinedFluke extends CardImpl {
|
||||||
@Override
|
@Override
|
||||||
public void build() {
|
public void build() {
|
||||||
// When Spined Fluke enters the battlefield, sacrifice a creature.
|
// When Spined Fluke enters the battlefield, sacrifice a creature.
|
||||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new SacrificeEffect(new FilterCreaturePermanent("a creature"), 1, "")));
|
this.addAbility(new EntersBattlefieldTriggeredAbility(new SacrificeControllerEffect(new FilterCreaturePermanent("a creature"), 1, "")));
|
||||||
// {B}: Regenerate Spined Fluke.
|
// {B}: Regenerate Spined Fluke.
|
||||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new RegenerateSourceEffect(), new ColoredManaCost(ColoredManaSymbol.B)));
|
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new RegenerateSourceEffect(), new ColoredManaCost(ColoredManaSymbol.B)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package org.mage.test.cards.abilities.activated;
|
||||||
|
|
||||||
|
import mage.constants.PhaseStep;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author LevelX2
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class PutOntoBattlefieldTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests to put a token onto the battlefield
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testOozeFlux() {
|
||||||
|
// Enchantment
|
||||||
|
// {1}{G}, Remove one or more +1/+1 counters from among creatures you control: Put an X/X green Ooze creature token onto the battlefield, where X is the number of +1/+1 counters removed this way.
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Ooze Flux");
|
||||||
|
// Trample
|
||||||
|
// Kalonian Hydra enters the battlefield with four +1/+1 counters on it.
|
||||||
|
// Whenever Kalonian Hydra attacks, double the number of +1/+1 counters on each creature you control.
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Kalonian Hydra");
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
|
||||||
|
|
||||||
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}{G},");
|
||||||
|
setChoice(playerA, "X=2"); // Remove how many
|
||||||
|
setChoice(playerA,"Kalonian Hydra");
|
||||||
|
setChoice(playerA, "X=2"); // Remove from Hydra
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertPowerToughness(playerA, "Kalonian Hydra", 2, 2);
|
||||||
|
assertPermanentCount(playerA, "Ooze", 1);
|
||||||
|
assertPowerToughness(playerA, "Ooze", 2, 2);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -74,16 +74,20 @@ public class DungeonGeistsTest extends CardTestPlayerBase {
|
||||||
public void testWithBlink() {
|
public void testWithBlink() {
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
|
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);
|
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);
|
||||||
|
// When Dungeon Geists enters the battlefield, tap target creature an opponent controls.
|
||||||
|
// That creature doesn't untap during its controller's untap step for as long as you control Dungeon Geists.
|
||||||
addCard(Zone.HAND, playerA, "Dungeon Geists");
|
addCard(Zone.HAND, playerA, "Dungeon Geists");
|
||||||
addCard(Zone.HAND, playerA, "Cloudshift");
|
addCard(Zone.HAND, playerA, "Cloudshift");
|
||||||
addCard(Zone.BATTLEFIELD, playerB, "Craw Wurm");
|
addCard(Zone.BATTLEFIELD, playerB, "Craw Wurm");
|
||||||
addCard(Zone.BATTLEFIELD, playerB, "Elite Vanguard");
|
addCard(Zone.BATTLEFIELD, playerB, "Elite Vanguard");
|
||||||
|
|
||||||
addTarget(playerA, "Craw Wurm"); // first target Craw Wurm
|
|
||||||
addTarget(playerA, "Elite Vanguard"); // after Cloudshift effect (return back to battlefield) target Elite Vanguard
|
|
||||||
|
|
||||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Dungeon Geists");
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Dungeon Geists");
|
||||||
|
addTarget(playerA, "Craw Wurm"); // first target Craw Wurm
|
||||||
|
|
||||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Cloudshift", "Dungeon Geists");
|
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Cloudshift", "Dungeon Geists");
|
||||||
|
addTarget(playerA, "Elite Vanguard"); // after Cloudshift effect (return back to battlefield) target Elite Vanguard
|
||||||
|
|
||||||
setStopAt(2, PhaseStep.DRAW);
|
setStopAt(2, PhaseStep.DRAW);
|
||||||
execute();
|
execute();
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package org.mage.test.cards.triggers.state;
|
||||||
|
|
||||||
|
import mage.constants.PhaseStep;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.counters.CounterType;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author LevelX2
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class SynodCenturionTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check that Synod Centurion gets sacrificed if no other artifacts are on the battlefield
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testAlone() {
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 6);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Demon's Horn");
|
||||||
|
addCard(Zone.HAND, playerA, "Shatter");
|
||||||
|
addCard(Zone.HAND, playerA, "Synod Centurion");
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Synod Centurion");
|
||||||
|
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Shatter", "Demon's Horn");
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertGraveyardCount(playerA, "Demon's Horn", 1);
|
||||||
|
assertGraveyardCount(playerA, "Shatter", 1);
|
||||||
|
assertGraveyardCount(playerA, "Synod Centurion", 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check that Synod Centurion gets sacrificed if the only other
|
||||||
|
* artifact left the battlefiled for a short time
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testWithFlicker() {
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Plains", 6);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Bottle Gnomes");
|
||||||
|
addCard(Zone.HAND, playerA, "Cloudshift");
|
||||||
|
addCard(Zone.HAND, playerA, "Synod Centurion");
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Synod Centurion");
|
||||||
|
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Cloudshift", "Bottle Gnomes");
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertPermanentCount(playerA, "Bottle Gnomes", 1);
|
||||||
|
assertGraveyardCount(playerA, "Cloudshift", 1);
|
||||||
|
assertGraveyardCount(playerA, "Synod Centurion", 1);
|
||||||
|
}
|
||||||
|
}
|
|
@ -502,6 +502,18 @@ public class TestPlayer extends ComputerPlayer {
|
||||||
return super.announceXCost(min, max, message, game, ability, null);
|
return super.announceXCost(min, max, message, game, ability, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getAmount(int min, int max, String message, Game game) {
|
||||||
|
if (!choices.isEmpty()) {
|
||||||
|
if (choices.get(0).startsWith("X=")) {
|
||||||
|
int xValue = Integer.parseInt(choices.get(0).substring(2));
|
||||||
|
choices.remove(0);
|
||||||
|
return xValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.getAmount(min, max, message, game);
|
||||||
|
}
|
||||||
|
|
||||||
protected Permanent findPermanent(FilterPermanent filter, UUID controllerId, Game game) {
|
protected Permanent findPermanent(FilterPermanent filter, UUID controllerId, Game game) {
|
||||||
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(filter, controllerId, game);
|
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(filter, controllerId, game);
|
||||||
if (permanents.size() > 0) {
|
if (permanents.size() > 0) {
|
||||||
|
|
|
@ -215,14 +215,20 @@ public abstract class AbilityImpl implements Ability {
|
||||||
else {
|
else {
|
||||||
game.addEffect((ContinuousEffect) effect, this);
|
game.addEffect((ContinuousEffect) effect, this);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* All restrained trigger events are fired now.
|
||||||
|
* To restrain the events is mainly neccessary because of the movement of multiple object at once.
|
||||||
|
* If the event is fired directly as one object moved, other objects are not already in the correct zone
|
||||||
|
* to check for their effects. (e.g. Valakut, the Molten Pinnacle)
|
||||||
|
*/
|
||||||
|
game.getState().handleSimultaneousEvent(game);
|
||||||
|
game.resetShortLivingLKI();
|
||||||
/**
|
/**
|
||||||
* game.applyEffects() has to be done at least for every effect that moves cards/permanent between zones,
|
* game.applyEffects() has to be done at least for every effect that moves cards/permanent between zones,
|
||||||
* so Static effects work as intened if dependant from the moved objects zone it is in
|
* so Static effects work as intened if dependant from the moved objects zone it is in
|
||||||
* Otherwise for example were static abilities with replacement effects deactivated to late
|
* Otherwise for example were static abilities with replacement effects deactivated to late
|
||||||
* Example: {@link org.mage.test.cards.replacement.DryadMilitantTest#testDiesByDestroy testDiesByDestroy}
|
* Example: {@link org.mage.test.cards.replacement.DryadMilitantTest#testDiesByDestroy testDiesByDestroy}
|
||||||
*/
|
*/
|
||||||
// game.applyEffects();
|
|
||||||
// some effects must be applied before next effect is resolved, because effect is dependend.
|
|
||||||
if (effect.applyEffectsAfter()) {
|
if (effect.applyEffectsAfter()) {
|
||||||
game.applyEffects();
|
game.applyEffects();
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -108,7 +108,7 @@ public class PermanentToken extends PermanentImpl {
|
||||||
if (!game.replaceEvent(new ZoneChangeEvent(this, sourceId, this.getControllerId(), Zone.BATTLEFIELD, Zone.EXILED))) {
|
if (!game.replaceEvent(new ZoneChangeEvent(this, sourceId, this.getControllerId(), Zone.BATTLEFIELD, Zone.EXILED))) {
|
||||||
game.rememberLKI(objectId, Zone.BATTLEFIELD, this);
|
game.rememberLKI(objectId, Zone.BATTLEFIELD, this);
|
||||||
if (game.getPlayer(controllerId).removeFromBattlefield(this, game)) {
|
if (game.getPlayer(controllerId).removeFromBattlefield(this, game)) {
|
||||||
game.fireEvent(new ZoneChangeEvent(this, sourceId, this.getControllerId(), Zone.BATTLEFIELD, Zone.EXILED));
|
game.addSimultaneousEvent(new ZoneChangeEvent(this, sourceId, this.getControllerId(), Zone.BATTLEFIELD, Zone.EXILED));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,8 +201,8 @@ public class Spell implements StackObject, Card {
|
||||||
result |= spellAbility.resolve(game);
|
result |= spellAbility.resolve(game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
game.getState().handleSimultaneousEvent(game);
|
// game.getState().handleSimultaneousEvent(game);
|
||||||
game.resetShortLivingLKI();
|
// game.resetShortLivingLKI();
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,7 @@ public class CardUtil {
|
||||||
* @param increaseCount
|
* @param increaseCount
|
||||||
*/
|
*/
|
||||||
public static void increaseCost(Ability ability, int increaseCount) {
|
public static void increaseCost(Ability ability, int increaseCount) {
|
||||||
adjustCost(ability, -increaseCount);
|
adjustAbilityCost(ability, -increaseCount);
|
||||||
adjustAlternativeCosts(ability, -increaseCount);
|
adjustAlternativeCosts(ability, -increaseCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ public class CardUtil {
|
||||||
* @param reduceCount
|
* @param reduceCount
|
||||||
*/
|
*/
|
||||||
public static void reduceCost(Ability ability, int reduceCount) {
|
public static void reduceCost(Ability ability, int reduceCount) {
|
||||||
adjustCost(ability, reduceCount);
|
adjustAbilityCost(ability, reduceCount);
|
||||||
adjustAlternativeCosts(ability, reduceCount);
|
adjustAlternativeCosts(ability, reduceCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ public class CardUtil {
|
||||||
* @param reduceCount
|
* @param reduceCount
|
||||||
*/
|
*/
|
||||||
public static void adjustCost(SpellAbility spellAbility, int reduceCount) {
|
public static void adjustCost(SpellAbility spellAbility, int reduceCount) {
|
||||||
CardUtil.adjustCost((Ability) spellAbility, reduceCount);
|
CardUtil.adjustAbilityCost((Ability) spellAbility, reduceCount);
|
||||||
adjustAlternativeCosts(spellAbility, reduceCount);
|
adjustAlternativeCosts(spellAbility, reduceCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ public class CardUtil {
|
||||||
* @param ability
|
* @param ability
|
||||||
* @param reduceCount
|
* @param reduceCount
|
||||||
*/
|
*/
|
||||||
private static void adjustCost(Ability ability, int reduceCount) {
|
public static void adjustAbilityCost(Ability ability, int reduceCount) {
|
||||||
ManaCosts<ManaCost> adjustedCost = adjustCost(ability.getManaCostsToPay(), reduceCount);
|
ManaCosts<ManaCost> adjustedCost = adjustCost(ability.getManaCostsToPay(), reduceCount);
|
||||||
ability.getManaCostsToPay().clear();
|
ability.getManaCostsToPay().clear();
|
||||||
ability.getManaCostsToPay().addAll(adjustedCost);
|
ability.getManaCostsToPay().addAll(adjustedCost);
|
||||||
|
|
Loading…
Reference in a new issue