mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +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.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.sets.championsofkamigawa;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.decorator.ConditionalOneShotEffect;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.discard.DiscardControllerEffect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.predicate.mageobject.NamePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
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 FilterCreatureCard filter = new FilterCreatureCard("a card named The Unspeakable");
|
||||
static {
|
||||
filter.add(new NamePredicate("The Unspeakable"));
|
||||
}
|
||||
|
||||
public SiftThroughSands(UUID ownerId) {
|
||||
super(ownerId, 84, "Sift Through Sands", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{U}{U}");
|
||||
this.expansionSetCode = "CHK";
|
||||
this.subtype.add("Arcane");
|
||||
|
||||
this.color.setBlue(true);
|
||||
|
||||
// Draw two cards, then discard a card.
|
||||
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(2));
|
||||
Effect effect = new DiscardControllerEffect(1);
|
||||
effect.setText(", then discard a card");
|
||||
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));
|
||||
this.getSpellAbility().addWatcher(new SiftThroughSandsWatcher());
|
||||
}
|
||||
|
||||
public SiftThroughSands(final SiftThroughSands card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SiftThroughSands copy() {
|
||||
return new SiftThroughSands(this);
|
||||
}
|
||||
}
|
||||
|
||||
class SiftThroughSandsCondition implements Condition {
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
SiftThroughSandsWatcher watcher = (SiftThroughSandsWatcher) game.getState().getWatchers().get("SiftThroughSandsWatcher", source.getControllerId());
|
||||
if (watcher != null) {
|
||||
return watcher.conditionMet();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class SiftThroughSandsWatcher extends Watcher {
|
||||
|
||||
boolean castPeerThroughDepths = false;
|
||||
boolean castReachThroughMists = false;
|
||||
|
||||
public SiftThroughSandsWatcher() {
|
||||
super("SiftThroughSandsWatcher", WatcherScope.PLAYER);
|
||||
}
|
||||
|
||||
public SiftThroughSandsWatcher(final SiftThroughSandsWatcher watcher) {
|
||||
super(watcher);
|
||||
this.castPeerThroughDepths = watcher.castPeerThroughDepths;
|
||||
this.castReachThroughMists = watcher.castReachThroughMists;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SiftThroughSandsWatcher copy() {
|
||||
return new SiftThroughSandsWatcher(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (condition == true) { //no need to check - condition has already occured
|
||||
return;
|
||||
}
|
||||
if (event.getType() == EventType.SPELL_CAST
|
||||
&& controllerId == event.getPlayerId()) {
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
if (spell.getCard().getName().equals("Peer Through Depths")) {
|
||||
castPeerThroughDepths = true;
|
||||
} else if (spell.getCard().getName().equals("Reach Through Mists")) {
|
||||
castReachThroughMists = true;
|
||||
}
|
||||
condition = castPeerThroughDepths && castReachThroughMists;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
this.castPeerThroughDepths = false;
|
||||
this.castReachThroughMists = false;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.sets.championsofkamigawa;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.decorator.ConditionalOneShotEffect;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.discard.DiscardControllerEffect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.predicate.mageobject.NamePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
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 FilterCreatureCard filter = new FilterCreatureCard("a card named The Unspeakable");
|
||||
static {
|
||||
filter.add(new NamePredicate("The Unspeakable"));
|
||||
}
|
||||
|
||||
public SiftThroughSands(UUID ownerId) {
|
||||
super(ownerId, 84, "Sift Through Sands", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{U}{U}");
|
||||
this.expansionSetCode = "CHK";
|
||||
this.subtype.add("Arcane");
|
||||
|
||||
this.color.setBlue(true);
|
||||
|
||||
// Draw two cards, then discard a card.
|
||||
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(2));
|
||||
Effect effect = new DiscardControllerEffect(1);
|
||||
effect.setText(", then discard a card");
|
||||
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));
|
||||
this.getSpellAbility().addWatcher(new SiftThroughSandsWatcher());
|
||||
}
|
||||
|
||||
public SiftThroughSands(final SiftThroughSands card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SiftThroughSands copy() {
|
||||
return new SiftThroughSands(this);
|
||||
}
|
||||
}
|
||||
|
||||
class SiftThroughSandsCondition implements Condition {
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
SiftThroughSandsWatcher watcher = (SiftThroughSandsWatcher) game.getState().getWatchers().get("SiftThroughSandsWatcher", source.getControllerId());
|
||||
if (watcher != null) {
|
||||
return watcher.conditionMet();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class SiftThroughSandsWatcher extends Watcher {
|
||||
|
||||
boolean castPeerThroughDepths = false;
|
||||
boolean castReachThroughMists = false;
|
||||
|
||||
public SiftThroughSandsWatcher() {
|
||||
super("SiftThroughSandsWatcher", WatcherScope.PLAYER);
|
||||
}
|
||||
|
||||
public SiftThroughSandsWatcher(final SiftThroughSandsWatcher watcher) {
|
||||
super(watcher);
|
||||
this.castPeerThroughDepths = watcher.castPeerThroughDepths;
|
||||
this.castReachThroughMists = watcher.castReachThroughMists;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SiftThroughSandsWatcher copy() {
|
||||
return new SiftThroughSandsWatcher(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (condition == true) { //no need to check - condition has already occured
|
||||
return;
|
||||
}
|
||||
if (event.getType() == EventType.SPELL_CAST
|
||||
&& controllerId == event.getPlayerId()) {
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
if (spell.getCard().getName().equals("Peer Through Depths")) {
|
||||
castPeerThroughDepths = true;
|
||||
} else if (spell.getCard().getName().equals("Reach Through Mists")) {
|
||||
castReachThroughMists = true;
|
||||
}
|
||||
condition = castPeerThroughDepths && castReachThroughMists;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
this.castPeerThroughDepths = false;
|
||||
this.castReachThroughMists = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,6 @@ public class DungeonGeists extends CardImpl {
|
|||
this.expansionSetCode = "DKA";
|
||||
this.subtype.add("Spirit");
|
||||
|
||||
this.color.setBlue(true);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
|
@ -112,40 +111,52 @@ class DungeonGeistsEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.UNTAP || event.getType() == GameEvent.EventType.ZONE_CHANGE || event.getType() == GameEvent.EventType.LOST_CONTROL;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
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
|
||||
// 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)
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
Permanent sourcePermanent = (Permanent) source.getSourceObjectIfItStillExists(game);
|
||||
if (sourcePermanent == null || !sourcePermanent.getControllerId().equals(source.getControllerId())) {
|
||||
this.used = true;
|
||||
discard();
|
||||
return false;
|
||||
}
|
||||
if (event.getType() == GameEvent.EventType.LOST_CONTROL) {
|
||||
if (event.getTargetId().equals(source.getSourceId())) {
|
||||
discard();
|
||||
return false;
|
||||
}
|
||||
switch(event.getType()) {
|
||||
case ZONE_CHANGE:
|
||||
// end effect if source does a zone move
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,119 +1,117 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.sets.gatecrash;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.Token;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class MimingSlime extends CardImpl {
|
||||
|
||||
public MimingSlime(UUID ownerId) {
|
||||
super(ownerId, 126, "Miming Slime", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{2}{G}");
|
||||
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());
|
||||
}
|
||||
|
||||
public MimingSlime(final MimingSlime card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MimingSlime copy() {
|
||||
return new MimingSlime(this);
|
||||
}
|
||||
}
|
||||
|
||||
class MimingSlimeEffect extends OneShotEffect {
|
||||
|
||||
public MimingSlimeEffect() {
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MimingSlimeEffect copy() {
|
||||
return new MimingSlimeEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId(), game);
|
||||
int amount = 0;
|
||||
for (Permanent creature : creatures) {
|
||||
int power = creature.getPower().getValue();
|
||||
if (amount < power) {
|
||||
amount = power;
|
||||
}
|
||||
}
|
||||
OozeToken oozeToken = new OozeToken();
|
||||
oozeToken.getPower().initValue(amount);
|
||||
oozeToken.getToughness().initValue(amount);
|
||||
oozeToken.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class OozeToken extends Token {
|
||||
public OozeToken() {
|
||||
super("Ooze", "X/X green Ooze creature token");
|
||||
cardType.add(CardType.CREATURE);
|
||||
subtype.add("Ooze");
|
||||
color.setGreen(true);
|
||||
power = new MageInt(0);
|
||||
toughness = new MageInt(0);
|
||||
setOriginalExpansionSetCode("RTR");
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.sets.gatecrash;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.Token;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class MimingSlime extends CardImpl {
|
||||
|
||||
public MimingSlime(UUID ownerId) {
|
||||
super(ownerId, 126, "Miming Slime", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{2}{G}");
|
||||
this.expansionSetCode = "GTC";
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MimingSlime copy() {
|
||||
return new MimingSlime(this);
|
||||
}
|
||||
}
|
||||
|
||||
class MimingSlimeEffect extends OneShotEffect {
|
||||
|
||||
public MimingSlimeEffect() {
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MimingSlimeEffect copy() {
|
||||
return new MimingSlimeEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId(), game);
|
||||
int amount = 0;
|
||||
for (Permanent creature : creatures) {
|
||||
int power = creature.getPower().getValue();
|
||||
if (amount < power) {
|
||||
amount = power;
|
||||
}
|
||||
}
|
||||
OozeToken oozeToken = new OozeToken();
|
||||
oozeToken.getPower().initValue(amount);
|
||||
oozeToken.getToughness().initValue(amount);
|
||||
oozeToken.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class OozeToken extends Token {
|
||||
public OozeToken() {
|
||||
super("Ooze", "X/X green Ooze creature token");
|
||||
cardType.add(CardType.CREATURE);
|
||||
subtype.add("Ooze");
|
||||
color.setGreen(true);
|
||||
power = new MageInt(0);
|
||||
toughness = new MageInt(0);
|
||||
setOriginalExpansionSetCode("RTR");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,111 +1,109 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.sets.gatecrash;
|
||||
|
||||
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.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.RemoveVariableCountersTargetCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.token.Token;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class OozeFlux extends CardImpl {
|
||||
|
||||
public OozeFlux(UUID ownerId) {
|
||||
super(ownerId, 128, "Ooze Flux", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{G}");
|
||||
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}"));
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OozeFlux copy() {
|
||||
return new OozeFlux(this);
|
||||
}
|
||||
}
|
||||
|
||||
class OozeFluxCreateTokenEffect extends OneShotEffect {
|
||||
|
||||
private Token token;
|
||||
|
||||
public OozeFluxCreateTokenEffect(Token token) {
|
||||
super(Outcome.PutCreatureInPlay);
|
||||
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);
|
||||
this.token = effect.token.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public OozeFluxCreateTokenEffect copy() {
|
||||
return new OozeFluxCreateTokenEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int xValue = 0;
|
||||
for (Cost cost : source.getCosts()) {
|
||||
if (cost instanceof RemoveVariableCountersTargetCost) {
|
||||
xValue = ((RemoveVariableCountersTargetCost) cost).getAmount();
|
||||
break;
|
||||
}
|
||||
}
|
||||
Token tokenCopy = token.copy();
|
||||
tokenCopy.getAbilities().newId();
|
||||
tokenCopy.getPower().initValue(xValue);
|
||||
tokenCopy.getToughness().initValue(xValue);
|
||||
tokenCopy.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.sets.gatecrash;
|
||||
|
||||
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.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.RemoveVariableCountersTargetCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.token.Token;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class OozeFlux extends CardImpl {
|
||||
|
||||
public OozeFlux(UUID ownerId) {
|
||||
super(ownerId, 128, "Ooze Flux", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{G}");
|
||||
this.expansionSetCode = "GTC";
|
||||
|
||||
// {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}"));
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OozeFlux copy() {
|
||||
return new OozeFlux(this);
|
||||
}
|
||||
}
|
||||
|
||||
class OozeFluxCreateTokenEffect extends OneShotEffect {
|
||||
|
||||
private final Token token;
|
||||
|
||||
public OozeFluxCreateTokenEffect(Token token) {
|
||||
super(Outcome.PutCreatureInPlay);
|
||||
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);
|
||||
this.token = effect.token.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public OozeFluxCreateTokenEffect copy() {
|
||||
return new OozeFluxCreateTokenEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int xValue = 0;
|
||||
for (Cost cost : source.getCosts()) {
|
||||
if (cost instanceof RemoveVariableCountersTargetCost) {
|
||||
xValue = ((RemoveVariableCountersTargetCost) cost).getAmount();
|
||||
break;
|
||||
}
|
||||
}
|
||||
Token tokenCopy = token.copy();
|
||||
tokenCopy.getAbilities().newId();
|
||||
tokenCopy.getPower().initValue(xValue);
|
||||
tokenCopy.getToughness().initValue(xValue);
|
||||
tokenCopy.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,10 +30,12 @@ package mage.sets.limitedalpha;
|
|||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
|
@ -81,14 +83,23 @@ class TimetwisterEffect extends OneShotEffect {
|
|||
for (UUID playerId: sourcePlayer.getInRange()) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
player.getLibrary().addAll(player.getHand().getCards(game), game);
|
||||
player.getLibrary().addAll(player.getGraveyard().getCards(game), game);
|
||||
for (Card card: player.getHand().getCards(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.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;
|
||||
}
|
||||
|
||||
|
|
|
@ -106,30 +106,24 @@ class GrandAbolisherEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
boolean spell = event.getType() == GameEvent.EventType.CAST_SPELL;
|
||||
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;
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.CAST_SPELL || event.getType() == GameEvent.EventType.ACTIVATE_ABILITY;
|
||||
}
|
||||
|
||||
@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.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
|
@ -52,7 +55,7 @@ public class PainfulQuandary extends CardImpl {
|
|||
this.expansionSetCode = "SOM";
|
||||
|
||||
// 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) {
|
||||
|
|
|
@ -36,6 +36,7 @@ import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
|||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.mana.ColoredManaCost;
|
||||
import mage.abilities.effects.common.RegenerateSourceEffect;
|
||||
import mage.abilities.effects.common.SacrificeControllerEffect;
|
||||
import mage.abilities.effects.common.SacrificeEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.ColoredManaSymbol;
|
||||
|
@ -54,7 +55,6 @@ public class SpinedFluke extends CardImpl {
|
|||
this.subtype.add("Worm");
|
||||
this.subtype.add("Horror");
|
||||
|
||||
this.color.setBlack(true);
|
||||
this.power = new MageInt(5);
|
||||
this.toughness = new MageInt(1);
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ public class SpinedFluke extends CardImpl {
|
|||
@Override
|
||||
public void build() {
|
||||
// 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.
|
||||
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() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 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, "Cloudshift");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Craw Wurm");
|
||||
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");
|
||||
addTarget(playerA, "Craw Wurm"); // first target Craw Wurm
|
||||
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
@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) {
|
||||
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(filter, controllerId, game);
|
||||
if (permanents.size() > 0) {
|
||||
|
|
|
@ -215,14 +215,20 @@ public abstract class AbilityImpl implements Ability {
|
|||
else {
|
||||
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,
|
||||
* 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
|
||||
* 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()) {
|
||||
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))) {
|
||||
game.rememberLKI(objectId, Zone.BATTLEFIELD, this);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -201,8 +201,8 @@ public class Spell implements StackObject, Card {
|
|||
result |= spellAbility.resolve(game);
|
||||
}
|
||||
}
|
||||
game.getState().handleSimultaneousEvent(game);
|
||||
game.resetShortLivingLKI();
|
||||
// game.getState().handleSimultaneousEvent(game);
|
||||
// game.resetShortLivingLKI();
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ public class CardUtil {
|
|||
* @param increaseCount
|
||||
*/
|
||||
public static void increaseCost(Ability ability, int increaseCount) {
|
||||
adjustCost(ability, -increaseCount);
|
||||
adjustAbilityCost(ability, -increaseCount);
|
||||
adjustAlternativeCosts(ability, -increaseCount);
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,7 @@ public class CardUtil {
|
|||
* @param reduceCount
|
||||
*/
|
||||
public static void reduceCost(Ability ability, int reduceCount) {
|
||||
adjustCost(ability, reduceCount);
|
||||
adjustAbilityCost(ability, reduceCount);
|
||||
adjustAlternativeCosts(ability, reduceCount);
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,7 @@ public class CardUtil {
|
|||
* @param reduceCount
|
||||
*/
|
||||
public static void adjustCost(SpellAbility spellAbility, int reduceCount) {
|
||||
CardUtil.adjustCost((Ability) spellAbility, reduceCount);
|
||||
CardUtil.adjustAbilityCost((Ability) spellAbility, reduceCount);
|
||||
adjustAlternativeCosts(spellAbility, reduceCount);
|
||||
}
|
||||
|
||||
|
@ -208,7 +208,7 @@ public class CardUtil {
|
|||
* @param ability
|
||||
* @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);
|
||||
ability.getManaCostsToPay().clear();
|
||||
ability.getManaCostsToPay().addAll(adjustedCost);
|
||||
|
|
Loading…
Reference in a new issue