mirror of
https://github.com/correl/mage.git
synced 2025-04-08 09:11:04 -09:00
Merge pull request #3890 from theelk801/master
Implemented Mist of Stagnation and Temporal Distortion fixed bugs
This commit is contained in:
commit
c6543a89ff
11 changed files with 277 additions and 16 deletions
Mage.Sets/src/mage
cards
sets
Mage/src/main/java/mage
abilities
common
effects/common/search
counters
game
|
@ -104,8 +104,8 @@ class DuplicantExileTargetEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
if (permanent != null && sourceObject instanceof Permanent) {
|
||||
if (permanent.moveToExile(null, null, source.getSourceId(), game)) {
|
||||
((Permanent) sourceObject).imprint(permanent.getId(), game);
|
||||
if (permanent.moveToExile(null, null, source.getSourceId(), game)
|
||||
&& ((Permanent) sourceObject).imprint(permanent.getId(), game)) {
|
||||
((Permanent) sourceObject).addInfo("imprint", "[Imprinted card - " + permanent.getName() + ']', game);
|
||||
}
|
||||
return true;
|
||||
|
|
119
Mage.Sets/src/mage/cards/m/MistOfStagnation.java
Normal file
119
Mage.Sets/src/mage/cards/m/MistOfStagnation.java
Normal file
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DontUntapInControllersUntapStepAllEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class MistOfStagnation extends CardImpl {
|
||||
|
||||
public MistOfStagnation(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}");
|
||||
|
||||
// Permanents don't untap during their controllers' untap steps.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new DontUntapInControllersUntapStepAllEffect(Duration.WhileOnBattlefield, TargetController.ANY, new FilterPermanent("permanents"))));
|
||||
|
||||
// At the beginning of each player's upkeep, that player chooses a permanent for each card in his or her graveyard, then untaps those permanents.
|
||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new MistOfStagnationEffect(), TargetController.ANY, false));
|
||||
}
|
||||
|
||||
public MistOfStagnation(final MistOfStagnation card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MistOfStagnation copy() {
|
||||
return new MistOfStagnation(this);
|
||||
}
|
||||
}
|
||||
|
||||
class MistOfStagnationEffect extends OneShotEffect {
|
||||
|
||||
MistOfStagnationEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "that player chooses a permanent for each card in his or her graveyard, then untaps those permanents";
|
||||
}
|
||||
|
||||
MistOfStagnationEffect(final MistOfStagnationEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MistOfStagnationEffect copy() {
|
||||
return new MistOfStagnationEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player activePlayer = game.getPlayer(game.getActivePlayerId());
|
||||
if (activePlayer != null) {
|
||||
int cardsInGrave = activePlayer.getGraveyard().size();
|
||||
if (cardsInGrave > 0) {
|
||||
Set<TargetPermanent> targets = new HashSet<>();
|
||||
for (int i = 1; 1 <= cardsInGrave; i++) {
|
||||
TargetPermanent target = new TargetPermanent(1, 1, new FilterPermanent(), true);
|
||||
target.setTargetController(activePlayer.getId());
|
||||
target.setTargetController(activePlayer.getId());
|
||||
if (target.canChoose(source.getSourceId(), activePlayer.getId(), game) && activePlayer.chooseTarget(Outcome.Untap, target, source, game)) {
|
||||
targets.add(target);
|
||||
}
|
||||
}
|
||||
for (TargetPermanent target : targets) {
|
||||
Permanent p = game.getPermanent(target.getFirstTarget());
|
||||
if (p != null) {
|
||||
p.untap(game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
116
Mage.Sets/src/mage/cards/t/TemporalDistortion.java
Normal file
116
Mage.Sets/src/mage/cards/t/TemporalDistortion.java
Normal file
|
@ -0,0 +1,116 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.cards.t;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BecomesTappedTriggeredAbility;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DontUntapInControllersUntapStepAllEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.filter.predicate.permanent.CounterPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class TemporalDistortion extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterPermanent("creature or land");
|
||||
private static final FilterPermanent filter2 = new FilterPermanent("permanents with hourglass counters on them");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.or(new CardTypePredicate(CardType.LAND), new CardTypePredicate(CardType.CREATURE)));
|
||||
filter2.add(new CounterPredicate(CounterType.HOURGLASS));
|
||||
}
|
||||
|
||||
public TemporalDistortion(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}");
|
||||
|
||||
// Whenever a creature or land becomes tapped, put an hourglass counter on it.
|
||||
Effect effect = new AddCountersTargetEffect(CounterType.HOURGLASS.createInstance());
|
||||
effect.setText("put an hourglass counter on it");
|
||||
this.addAbility(new BecomesTappedTriggeredAbility(effect, false, filter, true));
|
||||
|
||||
// Permanents with hourglass counters on them don't untap during their controllers' untap steps.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new DontUntapInControllersUntapStepAllEffect(Duration.WhileOnBattlefield, TargetController.ANY, filter2)));
|
||||
|
||||
// At the beginning of each player's upkeep, remove all hourglass counters from permanents that player controls.
|
||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new TemporalDistortionRemovalEffect(), TargetController.ANY, false));
|
||||
}
|
||||
|
||||
public TemporalDistortion(final TemporalDistortion card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TemporalDistortion copy() {
|
||||
return new TemporalDistortion(this);
|
||||
}
|
||||
}
|
||||
|
||||
class TemporalDistortionRemovalEffect extends OneShotEffect {
|
||||
|
||||
public TemporalDistortionRemovalEffect() {
|
||||
super(Outcome.Neutral);
|
||||
staticText = "remove all hourglass counters from permanents that player controls";
|
||||
}
|
||||
|
||||
public TemporalDistortionRemovalEffect(final TemporalDistortionRemovalEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(game.getActivePlayerId())) {
|
||||
permanent.removeCounters(CounterType.HOURGLASS.createInstance(permanent.getCounters(game).getCount(CounterType.HOURGLASS)), game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TemporalDistortionRemovalEffect copy() {
|
||||
return new TemporalDistortionRemovalEffect(this);
|
||||
}
|
||||
}
|
|
@ -88,7 +88,7 @@ class ViridianRevelTriggeredAbility extends TriggeredAbilityImpl {
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (((ZoneChangeEvent)event).isDiesEvent()) {
|
||||
Card card = game.getCard(event.getTargetId());
|
||||
Card card = game.getPermanentOrLKIBattlefield(event.getTargetId());
|
||||
Player controller = game.getPlayer(getControllerId());
|
||||
if (controller != null && card != null && card.isArtifact()
|
||||
&& controller.hasOpponent(card.getOwnerId(), game)) {
|
||||
|
|
|
@ -320,6 +320,7 @@ public class Invasion extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Teferi's Moat", 279, Rarity.RARE, mage.cards.t.TeferisMoat.class));
|
||||
cards.add(new SetCardInfo("Teferi's Response", 78, Rarity.RARE, mage.cards.t.TeferisResponse.class));
|
||||
cards.add(new SetCardInfo("Tek", 313, Rarity.RARE, mage.cards.t.Tek.class));
|
||||
cards.add(new SetCardInfo("Temporal Distortion", 79, Rarity.RARE, mage.cards.t.TemporalDistortion.class));
|
||||
cards.add(new SetCardInfo("Thicket Elemental", 214, Rarity.RARE, mage.cards.t.ThicketElemental.class));
|
||||
cards.add(new SetCardInfo("Thornscape Apprentice", 215, Rarity.COMMON, mage.cards.t.ThornscapeApprentice.class));
|
||||
cards.add(new SetCardInfo("Thornscape Master", 216, Rarity.RARE, mage.cards.t.ThornscapeMaster.class));
|
||||
|
|
|
@ -127,6 +127,7 @@ public class Judgment extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Mental Note", 46, Rarity.COMMON, mage.cards.m.MentalNote.class));
|
||||
cards.add(new SetCardInfo("Mirari's Wake", 139, Rarity.RARE, mage.cards.m.MirarisWake.class));
|
||||
cards.add(new SetCardInfo("Mirror Wall", 47, Rarity.COMMON, mage.cards.m.MirrorWall.class));
|
||||
cards.add(new SetCardInfo("Mist of Stagnation", 48, Rarity.RARE, mage.cards.m.MistOfStagnation.class));
|
||||
cards.add(new SetCardInfo("Nantuko Monastery", 142, Rarity.UNCOMMON, mage.cards.n.NantukoMonastery.class));
|
||||
cards.add(new SetCardInfo("Nantuko Tracer", 125, Rarity.COMMON, mage.cards.n.NantukoTracer.class));
|
||||
cards.add(new SetCardInfo("Nomad Mythmaker", 15, Rarity.RARE, mage.cards.n.NomadMythmaker.class));
|
||||
|
|
|
@ -11,26 +11,35 @@ import mage.filter.FilterPermanent;
|
|||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jeff
|
||||
*/
|
||||
public class BecomesTappedTriggeredAbility extends TriggeredAbilityImpl{
|
||||
public class BecomesTappedTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
FilterPermanent filter;
|
||||
protected FilterPermanent filter;
|
||||
protected boolean setTargetPointer;
|
||||
|
||||
public BecomesTappedTriggeredAbility(Effect effect, boolean optional) {
|
||||
this(effect, optional, new FilterPermanent("a permanent"));
|
||||
}
|
||||
|
||||
public BecomesTappedTriggeredAbility(Effect effect, boolean optional, FilterPermanent filter) {
|
||||
this(effect, optional, filter, false);
|
||||
}
|
||||
|
||||
public BecomesTappedTriggeredAbility(Effect effect, boolean optional, FilterPermanent filter, boolean setTargetPointer) {
|
||||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
this.filter = filter;
|
||||
this.setTargetPointer = setTargetPointer;
|
||||
}
|
||||
|
||||
public BecomesTappedTriggeredAbility(final BecomesTappedTriggeredAbility ability) {
|
||||
super(ability);
|
||||
this.filter = ability.filter.copy();
|
||||
this.setTargetPointer = ability.setTargetPointer;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -46,7 +55,13 @@ public class BecomesTappedTriggeredAbility extends TriggeredAbilityImpl{
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
return permanent != null && filter.match(permanent, getSourceId(), getControllerId(), game);
|
||||
if (permanent != null && filter.match(permanent, getSourceId(), getControllerId(), game)) {
|
||||
if (setTargetPointer) {
|
||||
this.getEffects().setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -103,21 +103,15 @@ public class SearchLibraryPutInHandOrOnBattlefieldEffect extends SearchEffect {
|
|||
if (card.getName().equals(nameToPutOnBattlefield)) {
|
||||
askToPutOntoBf = true;
|
||||
cardToPutOnBf = card;
|
||||
} else {
|
||||
cards.add(card);
|
||||
}
|
||||
cards.add(card);
|
||||
}
|
||||
}
|
||||
if (askToPutOntoBf && cardToPutOnBf != null) {
|
||||
if (controller.chooseUse(Outcome.PutCardInPlay, "Put " + cardToPutOnBf.getLogName() + " onto the battlefield instead?", source, game)) {
|
||||
controller.moveCards(cards, Zone.BATTLEFIELD, source, game);
|
||||
} else {
|
||||
controller.moveCards(cards, Zone.HAND, source, game);
|
||||
}
|
||||
if (askToPutOntoBf && controller.chooseUse(Outcome.PutCardInPlay, "Put " + cardToPutOnBf.getLogName() + " onto the battlefield instead?", source, game)) {
|
||||
controller.moveCards(cards, Zone.BATTLEFIELD, source, game);
|
||||
} else {
|
||||
controller.moveCards(cards, Zone.HAND, source, game);
|
||||
}
|
||||
|
||||
if (revealCards) {
|
||||
String name = "Reveal";
|
||||
Card sourceCard = game.getCard(source.getSourceId());
|
||||
|
@ -146,7 +140,9 @@ public class SearchLibraryPutInHandOrOnBattlefieldEffect extends SearchEffect {
|
|||
sb.append("a ").append(target.getTargetName()).append(revealCards ? ", reveal it," : "").append(" and put that card into your hand");
|
||||
}
|
||||
if (nameToPutOnBattlefield != null) {
|
||||
sb.append(". If you reveal a card named " + nameToPutOnBattlefield + " you may put it onto the battlefield instead");
|
||||
sb.append(". If you reveal a card named ");
|
||||
sb.append(nameToPutOnBattlefield);
|
||||
sb.append("this way, you may put it onto the battlefield instead");
|
||||
}
|
||||
if (forceShuffle) {
|
||||
sb.append(". Then shuffle your library");
|
||||
|
|
|
@ -72,6 +72,7 @@ public enum CounterType {
|
|||
HEALING("healing"),
|
||||
HOOFPRINT("hoofprint"),
|
||||
HOUR("hour"),
|
||||
HOURGLASS("hourglass"),
|
||||
ICE("ice"),
|
||||
INFECTION("infection"),
|
||||
INTERVENTION("intervention"),
|
||||
|
|
|
@ -118,6 +118,15 @@ public class Exile implements Serializable, Copyable<Exile> {
|
|||
return new Exile(this);
|
||||
}
|
||||
|
||||
public boolean containsId(UUID cardId, Game game) {
|
||||
for (Card card : getAllCards(game)) {
|
||||
if (card.getId().equals(cardId)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
for (ExileZone exile : exileZones.values()) {
|
||||
exile.clear();
|
||||
|
|
|
@ -1210,6 +1210,9 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
|
||||
@Override
|
||||
public boolean imprint(UUID imprintedCard, Game game) {
|
||||
if (!game.getExile().containsId(imprintedCard, game)){
|
||||
return false;
|
||||
}
|
||||
if (connectedCards.containsKey("imprint")) {
|
||||
this.connectedCards.get("imprint").add(imprintedCard);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue