mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
* Mirari - Fixed that it can select any spell instead triggered use.
This commit is contained in:
parent
9d7c59fed9
commit
e5bdb85076
3 changed files with 32 additions and 14 deletions
|
@ -1,7 +1,5 @@
|
||||||
|
|
||||||
package mage.cards.m;
|
package mage.cards.m;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.abilities.costs.mana.GenericManaCost;
|
import mage.abilities.costs.mana.GenericManaCost;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
|
@ -19,17 +17,17 @@ import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.events.GameEvent.EventType;
|
import mage.game.events.GameEvent.EventType;
|
||||||
import mage.game.stack.Spell;
|
import mage.game.stack.Spell;
|
||||||
import mage.target.TargetSpell;
|
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
public final class Mirari extends CardImpl {
|
public final class Mirari extends CardImpl {
|
||||||
|
|
||||||
public Mirari(UUID ownerId, CardSetInfo setInfo) {
|
public Mirari(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{5}");
|
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{5}");
|
||||||
addSuperType(SuperType.LEGENDARY);
|
addSuperType(SuperType.LEGENDARY);
|
||||||
|
|
||||||
// Whenever you cast an instant or sorcery spell, you may pay {3}. If you do, copy that spell. You may choose new targets for the copy.
|
// Whenever you cast an instant or sorcery spell, you may pay {3}. If you do, copy that spell. You may choose new targets for the copy.
|
||||||
|
@ -58,8 +56,9 @@ class MirariTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
MirariTriggeredAbility() {
|
MirariTriggeredAbility() {
|
||||||
super(Zone.BATTLEFIELD, new DoIfCostPaid(new CopyTargetSpellEffect(true), new GenericManaCost(3)), false);
|
super(Zone.BATTLEFIELD, new DoIfCostPaid(
|
||||||
this.addTarget(new TargetSpell(filter));
|
new CopyTargetSpellEffect(true),
|
||||||
|
new GenericManaCost(3)), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
MirariTriggeredAbility(final MirariTriggeredAbility ability) {
|
MirariTriggeredAbility(final MirariTriggeredAbility ability) {
|
||||||
|
@ -82,7 +81,11 @@ class MirariTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||||
if (isControlledInstantOrSorcery(spell)) {
|
if (isControlledInstantOrSorcery(spell)) {
|
||||||
for (Effect effect : getEffects()) {
|
for (Effect effect : getEffects()) {
|
||||||
effect.setTargetPointer(new FixedTarget(spell.getId()));
|
if (effect instanceof DoIfCostPaid) {
|
||||||
|
for (Effect execEffect : ((DoIfCostPaid) effect).getExecutingEffects()) {
|
||||||
|
execEffect.setTargetPointer(new FixedTarget(spell.getId()));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
package mage.abilities.effects.common;
|
package mage.abilities.effects.common;
|
||||||
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -13,7 +12,6 @@ import mage.players.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class CopyTargetSpellEffect extends OneShotEffect {
|
public class CopyTargetSpellEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
@ -79,7 +77,14 @@ public class CopyTargetSpellEffect extends OneShotEffect {
|
||||||
return staticText;
|
return staticText;
|
||||||
}
|
}
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("copy target ").append(mode.getTargets().get(0).getTargetName()).append(". You may choose new targets for the copy");
|
sb.append("copy ");
|
||||||
|
if (!mode.getTargets().isEmpty()) {
|
||||||
|
sb.append("target ").append(mode.getTargets().get(0).getTargetName());
|
||||||
|
} else {
|
||||||
|
sb.append("that spell");
|
||||||
|
}
|
||||||
|
sb.append(". You may choose new targets for the copy");
|
||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package mage.abilities.effects.common;
|
package mage.abilities.effects.common;
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.Mode;
|
import mage.abilities.Mode;
|
||||||
|
@ -14,6 +13,8 @@ import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.util.CardUtil;
|
import mage.util.CardUtil;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class DoIfCostPaid extends OneShotEffect {
|
public class DoIfCostPaid extends OneShotEffect {
|
||||||
|
|
||||||
protected Effects executingEffects = new Effects();
|
protected Effects executingEffects = new Effects();
|
||||||
|
@ -27,9 +28,10 @@ public class DoIfCostPaid extends OneShotEffect {
|
||||||
}
|
}
|
||||||
|
|
||||||
public DoIfCostPaid(Effect effect, Effect effect2, Cost cost) {
|
public DoIfCostPaid(Effect effect, Effect effect2, Cost cost) {
|
||||||
this(effect,effect2,cost,true);
|
this(effect, effect2, cost, true);
|
||||||
}
|
}
|
||||||
public DoIfCostPaid(Effect effect, Effect effect2, Cost cost,boolean optional) {
|
|
||||||
|
public DoIfCostPaid(Effect effect, Effect effect2, Cost cost, boolean optional) {
|
||||||
this(effect, cost, null, optional);
|
this(effect, cost, null, optional);
|
||||||
this.otherwiseEffects.add(effect2);
|
this.otherwiseEffects.add(effect2);
|
||||||
}
|
}
|
||||||
|
@ -62,6 +64,14 @@ public class DoIfCostPaid extends OneShotEffect {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Effects getExecutingEffects() {
|
||||||
|
return this.executingEffects;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Effects getOtherwiseEffects() {
|
||||||
|
return this.otherwiseEffects;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = getPayingPlayer(game, source);
|
Player player = getPayingPlayer(game, source);
|
||||||
|
|
Loading…
Reference in a new issue