Merge pull request #4024 from theelk801/master

merge
This commit is contained in:
theelk801 2017-09-18 22:43:31 -04:00 committed by GitHub
commit 21b896d54f
34 changed files with 444 additions and 73 deletions

View file

@ -35,14 +35,11 @@ import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.keyword.DoubleStrikeAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.abilities.text.TextPartSubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.TextPartSubtypePredicate;
import mage.filter.predicate.permanent.TappedPredicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
@ -68,11 +65,7 @@ public class AtarkaWorldRender extends CardImpl {
this.addAbility(TrampleAbility.getInstance());
// Whenever a Dragon you control attacks, it gains double strike until end of turn.
TextPartSubType textPart1 = (TextPartSubType) addTextPart(new TextPartSubType(SubType.DRAGON));
FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("Dragon you control");
filter.add(new TextPartSubtypePredicate(textPart1));
filter.add(Predicates.not(new TappedPredicate()));
this.addAbility(new AtarkaWorldRenderEffect(filter));
this.addAbility(new AtarkaWorldRenderEffect());
}
@ -88,16 +81,18 @@ public class AtarkaWorldRender extends CardImpl {
class AtarkaWorldRenderEffect extends TriggeredAbilityImpl {
FilterControlledCreaturePermanent filter;
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("dragon you control");
public AtarkaWorldRenderEffect(FilterControlledCreaturePermanent filter) {
static {
filter.add(new SubtypePredicate(SubType.DRAGON));
}
public AtarkaWorldRenderEffect() {
super(Zone.BATTLEFIELD, new GainAbilityTargetEffect(DoubleStrikeAbility.getInstance(), Duration.EndOfTurn));
this.filter = filter;
}
public AtarkaWorldRenderEffect(final AtarkaWorldRenderEffect ability) {
super(ability);
this.filter = ability.filter.copy();
}
@Override

View file

@ -0,0 +1,113 @@
/*
* 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.b;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.BecomesFaceDownCreatureAllEffect;
import mage.abilities.keyword.CyclingAbility;
import mage.abilities.keyword.MorphAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicate;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.filter.predicate.permanent.PermanentIdPredicate;
import mage.game.Game;
import mage.target.Target;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author TheElk801
*/
public class Backslide extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with a morph ability");
static {
filter.add(new AbilityPredicate(MorphAbility.class));
}
public Backslide(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}");
// Turn target creature with a morph ability face down.
this.getSpellAbility().addEffect(new BackslideEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter));
// Cycling {U}
this.addAbility(new CyclingAbility(new ManaCostsImpl("{U}")));
}
public Backslide(final Backslide card) {
super(card);
}
@Override
public Backslide copy() {
return new Backslide(this);
}
}
class BackslideEffect extends OneShotEffect {
BackslideEffect() {
super(Outcome.Benefit);
this.staticText = "Turn target creature with a morph ability face down.";
}
BackslideEffect(final BackslideEffect effect) {
super(effect);
}
@Override
public BackslideEffect copy() {
return new BackslideEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Predicate pred = new PermanentIdPredicate(UUID.randomUUID());
for (Target target : source.getTargets()) {
for (UUID targetId : target.getTargets()) {
pred = Predicates.or(pred, new PermanentIdPredicate(targetId));
}
}
FilterCreaturePermanent filter = new FilterCreaturePermanent();
filter.add(pred);
game.addEffect(new BecomesFaceDownCreatureAllEffect(filter), source);
return true;
}
}

View file

@ -85,7 +85,7 @@ public class BloodbondMarch extends CardImpl {
return false;
}
Spell spell = (Spell) game.getStack().getStackObject(targetPointer.getFirst(game, source));
Spell spell = game.getSpellOrLKIStack(this.getTargetPointer().getFirst(game, source));
if (spell == null) {
return false;

View file

@ -48,7 +48,7 @@ import mage.players.Player;
public class BounteousKirin extends CardImpl {
public BounteousKirin(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{G}{G}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{G}{G}");
addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.KIRIN, SubType.SPIRIT);
@ -89,7 +89,7 @@ class BounteousKirinEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Spell spell = game.getState().getStack().getSpell(getTargetPointer().getFirst(game, source));
Spell spell = game.getSpellOrLKIStack(this.getTargetPointer().getFirst(game, source));
if (spell != null) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {

View file

@ -50,7 +50,7 @@ import mage.game.stack.Spell;
public class CelestialKirin extends CardImpl {
public CelestialKirin(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{W}{W}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}{W}");
addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.KIRIN);
this.subtype.add(SubType.SPIRIT);
@ -92,7 +92,7 @@ class CelestialKirinEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Spell spell = game.getState().getStack().getSpell(getTargetPointer().getFirst(game, source));
Spell spell = game.getSpellOrLKIStack(this.getTargetPointer().getFirst(game, source));
if (spell != null) {
int cmc = spell.getConvertedManaCost();
FilterPermanent filter = new FilterPermanent();

View file

@ -91,7 +91,7 @@ public class ChandraTheFirebrand extends CardImpl {
class ChandraTheFirebrandAbility extends DelayedTriggeredAbility {
ChandraTheFirebrandAbility() {
super(new CopyTargetSpellEffect(), Duration.EndOfTurn);
super(new CopyTargetSpellEffect(true), Duration.EndOfTurn);
}
ChandraTheFirebrandAbility(final ChandraTheFirebrandAbility ability) {

View file

@ -54,7 +54,7 @@ import mage.target.TargetPlayer;
public class CloudhoofKirin extends CardImpl {
public CloudhoofKirin(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{U}{U}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}{U}");
addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.KIRIN);
this.subtype.add(SubType.SPIRIT);
@ -98,10 +98,10 @@ class CloudhoofKirinEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
Spell spell = game.getSpellOrLKIStack(this.getTargetPointer().getFirst(game, source));
if (spell != null) {
Player targetPlayer = null;
for(Target target: source.getTargets()) {
for (Target target : source.getTargets()) {
if (target instanceof TargetPlayer) {
targetPlayer = game.getPlayer(target.getFirstTarget());
}

View file

@ -60,7 +60,7 @@ public class ClovenCasting extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{5}{U}{R}");
// Whenever you cast a multicolored instant or sorcery spell, you may pay {1}. If you do, copy that spell. You may choose new targets for the copy.
Effect effect = new CopyTargetSpellEffect();
Effect effect = new CopyTargetSpellEffect(true);
effect.setText("copy that spell. You may choose new targets for the copy");
this.addAbility(new SpellCastControllerTriggeredAbility(new DoIfCostPaid(effect, new GenericManaCost(1)), filter, true, true));
}

View file

@ -58,7 +58,7 @@ import mage.target.targetpointer.FixedTarget;
public class CurseOfEchoes extends CardImpl {
public CurseOfEchoes(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{4}{U}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{U}");
this.subtype.add(SubType.AURA, SubType.CURSE);
// Enchant player
@ -143,7 +143,7 @@ class CurseOfEchoesEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
Spell spell = game.getSpellOrLKIStack(this.getTargetPointer().getFirst(game, source));
if (spell != null) {
String chooseMessage = "Copy target spell? You may choose new targets for the copy.";
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {

View file

@ -36,7 +36,6 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SetTargetPointer;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
@ -92,12 +91,9 @@ class DovescapeEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Spell spell = game.getStack().getSpell(this.getTargetPointer().getFirst(game, source));
Spell spell = game.getSpellOrLKIStack(this.getTargetPointer().getFirst(game, source));
int spellCMC = 0;
UUID spellControllerID = null;
if (spell == null) {
spell = (Spell) game.getLastKnownInformation(this.getTargetPointer().getFirst(game, source), Zone.STACK);
}
if (spell != null) {
spellCMC = spell.getConvertedManaCost();
spellControllerID = spell.getControllerId();

View file

@ -43,7 +43,6 @@ import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.token.ThrullToken;
import mage.game.stack.Spell;
import mage.target.targetpointer.FixedTarget;
/**
* @author LevelX2
@ -95,10 +94,7 @@ class EndrekSahrMasterBreederEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
if (spell == null) {
spell = (Spell) game.getLastKnownInformation(((FixedTarget) getTargetPointer()).getTarget(), Zone.STACK);
}
Spell spell = game.getSpellOrLKIStack(this.getTargetPointer().getFirst(game, source));
if (spell != null) {
int cmc = spell.getConvertedManaCost();
if (cmc > 0) {

View file

@ -50,7 +50,7 @@ import mage.target.targetpointer.FixedTarget;
public class HiveMind extends CardImpl {
public HiveMind(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{5}{U}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{5}{U}");
// Whenever a player casts an instant or sorcery spell, each other player copies that spell. Each of those players may choose new targets for his or her copy.
this.addAbility(new HiveMindTriggeredAbility());
@ -125,11 +125,7 @@ class HiveMindEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Spell spell;
spell = game.getStack().getSpell(((FixedTarget) getTargetPointer()).getTarget());
if (spell == null) { // if spell e.g. was countered
spell = (Spell) game.getLastKnownInformation(((FixedTarget) getTargetPointer()).getTarget(), Zone.STACK);
}
Spell spell = game.getSpellOrLKIStack(this.getTargetPointer().getFirst(game, source));
Player player = game.getPlayer(source.getControllerId());
if (spell != null && player != null) {
for (UUID playerId : game.getState().getPlayersInRange(player.getId(), game)) {

View file

@ -77,7 +77,7 @@ public class HowlOfTheHorde extends CardImpl {
class HowlOfTheHordeDelayedTriggeredAbility extends DelayedTriggeredAbility {
HowlOfTheHordeDelayedTriggeredAbility() {
super(new CopyTargetSpellEffect(), Duration.EndOfTurn);
super(new CopyTargetSpellEffect(true), Duration.EndOfTurn);
}
HowlOfTheHordeDelayedTriggeredAbility(final HowlOfTheHordeDelayedTriggeredAbility ability) {

View file

@ -55,7 +55,7 @@ import mage.target.TargetPlayer;
public class InfernalKirin extends CardImpl {
public InfernalKirin(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}{B}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}{B}");
addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.KIRIN);
this.subtype.add(SubType.SPIRIT);
@ -100,11 +100,11 @@ class InfernalKirinEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
Spell spell = game.getSpellOrLKIStack(this.getTargetPointer().getFirst(game, source));
if (spell != null) {
int cmc = spell.getConvertedManaCost();
Player targetPlayer = null;
for(Target target: source.getTargets()) {
for (Target target : source.getTargets()) {
if (target instanceof TargetPlayer) {
targetPlayer = game.getPlayer(target.getFirstTarget());
}
@ -112,7 +112,7 @@ class InfernalKirinEffect extends OneShotEffect {
if (targetPlayer != null) {
if (!targetPlayer.getHand().isEmpty()) {
targetPlayer.revealCards("Infernal Kirin", targetPlayer.getHand(), game);
for (UUID uuid: targetPlayer.getHand().copy()) {
for (UUID uuid : targetPlayer.getHand().copy()) {
Card card = game.getCard(uuid);
if (card != null && card.getConvertedManaCost() == cmc) {
targetPlayer.discard(card, source, game);

View file

@ -107,6 +107,9 @@ class IxalansBindingReplacementEffect extends ContinuousRuleModifyingEffectImpl
public boolean applies(GameEvent event, Ability source, Game game) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
Card card = game.getCard(event.getSourceId());
if(event.getPlayerId().equals(source.getControllerId())){
return false;
}
if (sourcePermanent != null && card != null) {
UUID exileZone = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter());
if (exileZone != null) {

View file

@ -29,7 +29,6 @@ package mage.cards.k;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.SpellCastOpponentTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
@ -51,7 +50,7 @@ import mage.target.common.TargetCreatureOrPlayer;
public class KaervekTheMerciless extends CardImpl {
public KaervekTheMerciless(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{B}{R}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{B}{R}");
addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.SHAMAN);
@ -94,9 +93,9 @@ class KaervekTheMercilessEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
MageObject spellCast = game.getObject(getTargetPointer().getFirst(game, source));
if (spellCast instanceof Spell) {
int cost = ((Spell) spellCast).getConvertedManaCost();
Spell spell = game.getSpellOrLKIStack(this.getTargetPointer().getFirst(game, source));
if (spell != null) {
int cost = spell.getConvertedManaCost();
Player target = game.getPlayer(source.getFirstTarget());
if (target != null) {
target.damage(cost, source.getSourceId(), game, false, true);

View file

@ -0,0 +1,120 @@
/*
* 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.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.TurnedFaceUpSourceTriggeredAbility;
import mage.constants.SubType;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.BecomesFaceDownCreatureAllEffect;
import mage.abilities.keyword.MorphAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicate;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.filter.predicate.permanent.PermanentIdPredicate;
import mage.game.Game;
import mage.target.Target;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author TheElk801
*/
public class MasterOfTheVeil extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with a morph ability");
static {
filter.add(new AbilityPredicate(MorphAbility.class));
}
public MasterOfTheVeil(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}{U}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(2);
this.toughness = new MageInt(3);
// Morph {2}{U}
this.addAbility(new MorphAbility(this, new ManaCostsImpl("{2}{U}")));
// When Master of the Veil is turned face up, you may turn target creature with a morph ability face down.
Ability ability = new TurnedFaceUpSourceTriggeredAbility(new MasterOfTheVeilEffect(), false, true);
ability.addTarget(new TargetCreaturePermanent(1, 1, filter, false));
this.addAbility(ability);
}
public MasterOfTheVeil(final MasterOfTheVeil card) {
super(card);
}
@Override
public MasterOfTheVeil copy() {
return new MasterOfTheVeil(this);
}
}
class MasterOfTheVeilEffect extends OneShotEffect {
MasterOfTheVeilEffect() {
super(Outcome.Benefit);
this.staticText = "turn target creature with a morph ability face down";
}
MasterOfTheVeilEffect(final MasterOfTheVeilEffect effect) {
super(effect);
}
@Override
public MasterOfTheVeilEffect copy() {
return new MasterOfTheVeilEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Predicate pred = new PermanentIdPredicate(UUID.randomUUID());
for (Target target : source.getTargets()) {
for (UUID targetId : target.getTargets()) {
pred = Predicates.or(pred, new PermanentIdPredicate(targetId));
}
}
FilterCreaturePermanent filter = new FilterCreaturePermanent();
filter.add(pred);
game.addEffect(new BecomesFaceDownCreatureAllEffect(filter), source);
return true;
}
}

View file

@ -79,7 +79,7 @@ public class MavrenFeinDuskApostle extends CardImpl {
class MavrenFeinDuskApostleTriggeredAbility extends TriggeredAbilityImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("nontoken Vampire you control");
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("nontoken Vampires you control");
static {
filter.add(new SubtypePredicate(SubType.VAMPIRE));
@ -109,7 +109,7 @@ class MavrenFeinDuskApostleTriggeredAbility extends TriggeredAbilityImpl {
public boolean checkTrigger(GameEvent event, Game game) {
for (UUID creatureId : game.getCombat().getAttackers()) {
Permanent creature = game.getPermanent(creatureId);
if (creature != null && filter.match(creature, game)) {
if (creature != null && filter.match(creature, game) && creature.getControllerId().equals(controllerId)) {
return true;
}
}

View file

@ -51,7 +51,6 @@ import mage.game.Game;
import mage.game.permanent.token.MetallurgicSummoningsConstructToken;
import mage.game.stack.Spell;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
/**
*
@ -106,10 +105,7 @@ class MetallurgicSummoningsTokenEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
if (spell == null) {
spell = (Spell) game.getLastKnownInformation(((FixedTarget) getTargetPointer()).getTarget(), Zone.STACK);
}
Spell spell = game.getSpellOrLKIStack(this.getTargetPointer().getFirst(game, source));
if (spell != null) {
int cmc = spell.getConvertedManaCost();
if (cmc > 0) {

View file

@ -84,7 +84,7 @@ class MirariTriggeredAbility extends TriggeredAbilityImpl {
}
MirariTriggeredAbility() {
super(Zone.BATTLEFIELD, new DoIfCostPaid(new CopyTargetSpellEffect(), new GenericManaCost(3)), false);
super(Zone.BATTLEFIELD, new DoIfCostPaid(new CopyTargetSpellEffect(true), new GenericManaCost(3)), false);
this.addTarget(new TargetSpell(filter));
}

View file

@ -59,7 +59,7 @@ public class PrimalWellspring extends CardImpl {
this.addAbility(ability);
// When that mana is spent to cast an instant or sorcery spell, copy that spell and you may choose new targets for the copy.
Effect effect = new CopyTargetSpellEffect();
Effect effect = new CopyTargetSpellEffect(true);
effect.setText("copy that spell and you may choose new targets for the copy");
this.addAbility(new PyrimalWellspringTriggeredAbility(ability.getOriginalId(), effect));
}

View file

@ -127,7 +127,7 @@ class PyromancerAscensionQuestTriggeredAbility extends TriggeredAbilityImpl {
class PyromancerAscensionCopyTriggeredAbility extends TriggeredAbilityImpl {
PyromancerAscensionCopyTriggeredAbility() {
super(Zone.BATTLEFIELD, new CopyTargetSpellEffect(), true);
super(Zone.BATTLEFIELD, new CopyTargetSpellEffect(true), true);
}
PyromancerAscensionCopyTriggeredAbility(final PyromancerAscensionCopyTriggeredAbility ability) {

View file

@ -62,7 +62,7 @@ public class PyromancersGoggles extends CardImpl {
this.addAbility(ability);
// When that mana is used to cast a red instant or sorcery spell, copy that spell and you may choose new targets for the copy.
Effect effect = new CopyTargetSpellEffect();
Effect effect = new CopyTargetSpellEffect(true);
effect.setText("copy that spell and you may choose new targets for the copy");
this.addAbility(new PyromancersGogglesTriggeredAbility(ability.getOriginalId(), effect));

View file

@ -101,7 +101,7 @@ class RamosDragonEngineAddCountersEffect extends OneShotEffect {
Player you = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(source.getSourceId());
if (you != null && permanent != null) {
Spell spell = game.getStack().getSpell(this.getTargetPointer().getFirst(game, source));
Spell spell = game.getSpellOrLKIStack(this.getTargetPointer().getFirst(game, source));
if (spell != null) {
int amount = 0;
if (spell.getColor(game).isWhite()) {

View file

@ -78,7 +78,7 @@ public class RikuOfTwoReflections extends CardImpl {
this.toughness = new MageInt(2);
// Whenever you cast an instant or sorcery spell, you may pay {U}{R}. If you do, copy that spell. You may choose new targets for the copy.
Effect effect = new CopyTargetSpellEffect();
Effect effect = new CopyTargetSpellEffect(true);
effect.setText("copy that spell. You may choose new targets for the copy");
this.addAbility(new SpellCastControllerTriggeredAbility(new DoIfCostPaid(effect, new ManaCostsImpl("{U}{R}")), filter, false, true));

View file

@ -92,7 +92,7 @@ class SunbirdsInvocationTriggeredAbility extends SpellCastControllerTriggeredAbi
if (spell != null && spell.getFromZone() == Zone.HAND) {
if (spell.getCard() != null) {
for (Effect effect : getEffects()) {
effect.setTargetPointer(new FixedTarget(spell.getId(), spell.getZoneChangeCounter(game)));
effect.setTargetPointer(new FixedTarget(spell.getId()));
}
return true;
}
@ -125,8 +125,12 @@ class SunbirdsInvocationEffect extends OneShotEffect {
if (controller == null || sourceObject == null) {
return false;
}
Spell spell = game.getSpellOrLKIStack(this.getTargetPointer().getFirst(game, source));
if (spell == null) {
return false;
}
int xValue = spell.getConvertedManaCost();
Cards cards = new CardsImpl();
int xValue = game.getLastKnownInformation(this.getTargetPointer().getFirst(game, source), Zone.STACK).getConvertedManaCost();
cards.addAll(controller.getLibrary().getTopCards(game, xValue));
if (!cards.isEmpty()) {
controller.revealCards(sourceObject.getIdName(), cards, game);
@ -138,7 +142,7 @@ class SunbirdsInvocationEffect extends OneShotEffect {
if (controller.chooseTarget(Outcome.PlayForFree, cards, target, source, game)) {
Card card = cards.get(target.getFirstTarget(), game);
if (card != null) {
if (controller.chooseUse(outcome, "Do you wish to cast " + card.getName(), source, game)) {
if (controller.chooseUse(outcome, "Cast " + card.getLogName() + " without paying its mana cost?", source, game)) {
controller.cast(card.getSpellAbility(), game, true);
cards.remove(card);
}

View file

@ -46,7 +46,7 @@ public class SwarmIntelligence extends CardImpl {
// Whenever you cast an instant or sorcery spell, you may copy that spell. You may choose new targets for the copy.
this.addAbility(new SpellCastControllerTriggeredAbility(
new CopyTargetSpellEffect().setText("you may copy that spell. You may choose new targets for the copy"), new FilterInstantOrSorcerySpell("an instant or sorcery spell"), true, true));
new CopyTargetSpellEffect(true).setText("you may copy that spell. You may choose new targets for the copy"), new FilterInstantOrSorcerySpell("an instant or sorcery spell"), true, true));
}
public SwarmIntelligence(final SwarmIntelligence card) {

View file

@ -0,0 +1,121 @@
/*
* 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.w;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.TurnedFaceUpSourceTriggeredAbility;
import mage.constants.SubType;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.BecomesFaceDownCreatureAllEffect;
import mage.abilities.keyword.MorphAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicate;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.filter.predicate.permanent.PermanentIdPredicate;
import mage.game.Game;
import mage.target.Target;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author TheElk801
*/
public class WeaverOfLies extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("other creatures with a morph ability");
static {
filter.add(new AbilityPredicate(MorphAbility.class));
filter.add(new AnotherPredicate());
}
public WeaverOfLies(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{U}{U}");
this.subtype.add(SubType.BEAST);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
// Morph {4}{U}
this.addAbility(new MorphAbility(this, new ManaCostsImpl("{4}{U}")));
// When Weaver of Lies is turned face up, turn any number of target creatures with a morph ability other than Weaver of Lies face down.
Ability ability = new TurnedFaceUpSourceTriggeredAbility(new WeaverOfLiesEffect(), false, false);
ability.addTarget(new TargetCreaturePermanent(0, Integer.MAX_VALUE, filter, false));
this.addAbility(ability);
}
public WeaverOfLies(final WeaverOfLies card) {
super(card);
}
@Override
public WeaverOfLies copy() {
return new WeaverOfLies(this);
}
}
class WeaverOfLiesEffect extends OneShotEffect {
WeaverOfLiesEffect() {
super(Outcome.Benefit);
this.staticText = "turn any number of target creatures with a morph ability other than {this} face down";
}
WeaverOfLiesEffect(final WeaverOfLiesEffect effect) {
super(effect);
}
@Override
public WeaverOfLiesEffect copy() {
return new WeaverOfLiesEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Predicate pred = new PermanentIdPredicate(UUID.randomUUID());
for (Target target : source.getTargets()) {
for (UUID targetId : target.getTargets()) {
pred = Predicates.or(pred, new PermanentIdPredicate(targetId));
}
}
FilterCreaturePermanent filter = new FilterCreaturePermanent();
filter.add(pred);
game.addEffect(new BecomesFaceDownCreatureAllEffect(filter), source);
return true;
}
}

View file

@ -154,10 +154,7 @@ class ZadaHedronGrinderEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
if (spell == null) {
spell = (Spell) game.getLastKnownInformation(targetPointer.getFirst(game, source), Zone.STACK);
}
Spell spell = game.getSpellOrLKIStack(this.getTargetPointer().getFirst(game, source));
Player controller = game.getPlayer(source.getControllerId());
if (spell != null && controller != null) {
// search the target that targets source

View file

@ -133,6 +133,7 @@ public class Legions extends ExpansionSet {
cards.add(new SetCardInfo("Lowland Tracker", 17, Rarity.COMMON, mage.cards.l.LowlandTracker.class));
cards.add(new SetCardInfo("Macetail Hystrodon", 106, Rarity.COMMON, mage.cards.m.MacetailHystrodon.class));
cards.add(new SetCardInfo("Magma Sliver", 107, Rarity.RARE, mage.cards.m.MagmaSliver.class));
cards.add(new SetCardInfo("Master of the Veil", 43, Rarity.UNCOMMON, mage.cards.m.MasterOfTheVeil.class));
cards.add(new SetCardInfo("Merchant of Secrets", 44, Rarity.COMMON, mage.cards.m.MerchantOfSecrets.class));
cards.add(new SetCardInfo("Mistform Sliver", 46, Rarity.COMMON, mage.cards.m.MistformSliver.class));
cards.add(new SetCardInfo("Mistform Ultimus", 47, Rarity.RARE, mage.cards.m.MistformUltimus.class));
@ -178,6 +179,7 @@ public class Legions extends ExpansionSet {
cards.add(new SetCardInfo("Wall of Hope", 24, Rarity.COMMON, mage.cards.w.WallOfHope.class));
cards.add(new SetCardInfo("Warbreak Trumpeter", 116, Rarity.UNCOMMON, mage.cards.w.WarbreakTrumpeter.class));
cards.add(new SetCardInfo("Ward Sliver", 25, Rarity.UNCOMMON, mage.cards.w.WardSliver.class));
cards.add(new SetCardInfo("Weaver of Lies", 57, Rarity.RARE, mage.cards.w.WeaverOfLies.class));
cards.add(new SetCardInfo("White Knight", 27, Rarity.UNCOMMON, mage.cards.w.WhiteKnight.class));
cards.add(new SetCardInfo("Willbender", 58, Rarity.UNCOMMON, mage.cards.w.Willbender.class));
cards.add(new SetCardInfo("Windborn Muse", 28, Rarity.RARE, mage.cards.w.WindbornMuse.class));

View file

@ -46,6 +46,7 @@ public class Onslaught extends ExpansionSet {
cards.add(new SetCardInfo("Aven Brigadier", 7, Rarity.RARE, mage.cards.a.AvenBrigadier.class));
cards.add(new SetCardInfo("Aven Fateshaper", 69, Rarity.UNCOMMON, mage.cards.a.AvenFateshaper.class));
cards.add(new SetCardInfo("Aven Soulgazer", 8, Rarity.UNCOMMON, mage.cards.a.AvenSoulgazer.class));
cards.add(new SetCardInfo("Backslide", 70, Rarity.COMMON, mage.cards.b.Backslide.class));
cards.add(new SetCardInfo("Barkhide Mauler", 246, Rarity.COMMON, mage.cards.b.BarkhideMauler.class));
cards.add(new SetCardInfo("Barren Moor", 312, Rarity.COMMON, mage.cards.b.BarrenMoor.class));
cards.add(new SetCardInfo("Battering Craghorn", 188, Rarity.COMMON, mage.cards.b.BatteringCraghorn.class));

View file

@ -43,17 +43,30 @@ import mage.players.Player;
*/
public class CopyTargetSpellEffect extends OneShotEffect {
private boolean useLKI = false;
public CopyTargetSpellEffect() {
super(Outcome.Copy);
}
public CopyTargetSpellEffect(boolean useLKI) {
super(Outcome.Copy);
this.useLKI = useLKI;
}
public CopyTargetSpellEffect(final CopyTargetSpellEffect effect) {
super(effect);
this.useLKI = effect.useLKI;
}
@Override
public boolean apply(Game game, Ability source) {
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
Spell spell;
if (useLKI) {
spell = game.getSpellOrLKIStack(targetPointer.getFirst(game, source));
} else {
spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
}
if (spell == null) {
spell = (Spell) game.getLastKnownInformation(targetPointer.getFirst(game, source), Zone.STACK);
}

View file

@ -57,6 +57,7 @@ import mage.game.match.MatchType;
import mage.game.permanent.Battlefield;
import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentCard;
import mage.game.stack.Spell;
import mage.game.stack.SpellStack;
import mage.game.turn.Phase;
import mage.game.turn.Step;
@ -106,6 +107,10 @@ public interface Game extends MageItem, Serializable {
UUID getOwnerId(MageObject object);
Spell getSpell(UUID spellId);
Spell getSpellOrLKIStack(UUID spellId);
Permanent getPermanent(UUID permanentId);
Permanent getPermanentOrLKIBattlefield(UUID permanentId);

View file

@ -445,6 +445,20 @@ public abstract class GameImpl implements Game, Serializable {
return null;
}
@Override
public Spell getSpell(UUID spellId) {
return state.getStack().getSpell(spellId);
}
@Override
public Spell getSpellOrLKIStack(UUID spellId) {
Spell spell = state.getStack().getSpell(spellId);
if (spell == null) {
spell = (Spell) this.getLastKnownInformation(spellId, Zone.STACK);
}
return spell;
}
@Override
public Permanent getPermanent(UUID permanentId) {
return state.getPermanent(permanentId);