forked from External/mage
Merge pull request #3869 from theelk801/master
Fixed bug #3865, also fixed other cards which didn't properly use LKI
This commit is contained in:
commit
b45ea3977d
8 changed files with 36 additions and 14 deletions
|
|
@ -45,6 +45,7 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -97,7 +98,7 @@ class CloudstoneCurioEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Permanent triggeringCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
Permanent triggeringCreature = ((FixedTarget) getTargetPointer()).getTargetedPermanentOrLKIBattlefield(game);
|
||||
if (triggeringCreature == null) {
|
||||
triggeringCreature = (Permanent) game.getLastKnownInformation(getTargetPointer().getFirst(game, source), Zone.BATTLEFIELD);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -89,7 +90,7 @@ class CreamOfTheCropEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanentOrLKIBattlefield(this.getTargetPointer().getFirst(game, source));
|
||||
Permanent permanent = ((FixedTarget) getTargetPointer()).getTargetedPermanentOrLKIBattlefield(game);
|
||||
if (player != null && permanent != null) {
|
||||
int numLooked = Math.min(permanent.getPower().getValue(), player.getLibrary().size());
|
||||
if (numLooked > 0) {
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCreatureOrPlayer;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -60,7 +61,7 @@ public class DragonTempest extends CardImpl {
|
|||
}
|
||||
|
||||
public DragonTempest(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}");
|
||||
|
||||
// Whenever a creature with flying enters the battlefield under your control, it gains haste until the end of turn.
|
||||
Effect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
|
||||
|
|
@ -119,7 +120,7 @@ class DragonTempestDamageEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
int amount = game.getBattlefield().countAll(dragonFilter, controller.getId(), game);
|
||||
if (amount > 0) {
|
||||
Permanent targetCreature = game.getPermanent(source.getTargets().getFirstTarget());
|
||||
Permanent targetCreature = ((FixedTarget) getTargetPointer()).getTargetedPermanentOrLKIBattlefield(game);
|
||||
if (targetCreature != null) {
|
||||
targetCreature.damage(amount, getTargetPointer().getFirst(game, source), game, false, true);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -67,7 +67,8 @@ public class FlameshadowConjuring extends CardImpl {
|
|||
|
||||
// Whenever a nontoken creature enters the battlefield under your control, you may pay {R}. If you do, create a token that's a copy of that creature. That token gains haste. Exile it at the beginning of the next end step.
|
||||
Ability ability = new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, new DoIfCostPaid(
|
||||
new FlameshadowConjuringEffect(), new ManaCostsImpl("{R}"), "Pay {R} to create a token that's a copy of that creature that entered the battlefield?"), filterNontoken, false, SetTargetPointer.PERMANENT,
|
||||
new FlameshadowConjuringEffect(), new ManaCostsImpl("{R}"), "Pay {R} to create a token that's a copy of that creature that entered the battlefield?"),
|
||||
filterNontoken, false, SetTargetPointer.PERMANENT,
|
||||
"Whenever a nontoken creature enters the battlefield under your control, "
|
||||
+ "you may pay {R}. If you do, create a token that's a copy of that creature. "
|
||||
+ "That token gains haste. Exile it at the beginning of the next end step");
|
||||
|
|
@ -102,7 +103,7 @@ class FlameshadowConjuringEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
|
||||
Permanent permanent = ((FixedTarget) getTargetPointer()).getTargetedPermanentOrLKIBattlefield(game);
|
||||
if (permanent != null) {
|
||||
PutTokenOntoBattlefieldCopyTargetEffect effect = new PutTokenOntoBattlefieldCopyTargetEffect(null, null, true);
|
||||
effect.setTargetPointer(getTargetPointer());
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ import mage.constants.Zone;
|
|||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||
import mage.filter.predicate.permanent.TappedPredicate;
|
||||
import mage.filter.predicate.permanent.TokenPredicate;
|
||||
import mage.game.Game;
|
||||
|
|
@ -69,12 +70,13 @@ import mage.target.targetpointer.FixedTarget;
|
|||
*/
|
||||
public class InallaArchmageRitualist extends CardImpl {
|
||||
|
||||
private static final FilterControlledPermanent filter = new FilterControlledPermanent("Wizard");
|
||||
private static final FilterControlledPermanent filter = new FilterControlledPermanent("another nontoken Wizard");
|
||||
private static final FilterControlledPermanent filter2 = new FilterControlledPermanent("untapped Wizards you control");
|
||||
|
||||
static {
|
||||
filter.add(new SubtypePredicate(SubType.WIZARD));
|
||||
filter.add(Predicates.not(new TokenPredicate()));
|
||||
filter.add(new AnotherPredicate());
|
||||
filter2.add(new SubtypePredicate(SubType.WIZARD));
|
||||
filter2.add(Predicates.not(new TappedPredicate()));
|
||||
}
|
||||
|
|
@ -94,7 +96,7 @@ public class InallaArchmageRitualist extends CardImpl {
|
|||
new InallaArchmageRitualistEffect(), new ManaCostsImpl("{1}"), "Pay {1} to create a token copy?"),
|
||||
filter, false, SetTargetPointer.PERMANENT, ""),
|
||||
SourceOnBattlefieldOrCommandZoneCondition.instance,
|
||||
"<i>Eminence</i> - Whenever a nontoken Wizard enters the battlefield under your control, "
|
||||
"<i>Eminence</i> - Whenever another nontoken Wizard enters the battlefield under your control, "
|
||||
+ "{this} is in the command zone or on the battlefield, "
|
||||
+ "you may pay {1}. If you do, create a token that's a copy of that Wizard. "
|
||||
+ "That token gains haste. Exile it at the beginning of the next end step");
|
||||
|
|
@ -135,7 +137,7 @@ class InallaArchmageRitualistEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
|
||||
Permanent permanent = ((FixedTarget) getTargetPointer()).getTargetedPermanentOrLKIBattlefield(game);
|
||||
if (permanent != null) {
|
||||
PutTokenOntoBattlefieldCopyTargetEffect effect = new PutTokenOntoBattlefieldCopyTargetEffect(null, null, true);
|
||||
effect.setTargetPointer(getTargetPointer());
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ public class Mirrorworks extends CardImpl {
|
|||
|
||||
// Whenever another nontoken artifact enters the battlefield under your control, you may pay {2}.
|
||||
// If you do, create a token that's a copy of that artifact.
|
||||
Effect effect = new DoIfCostPaid(new PutTokenOntoBattlefieldCopyTargetEffect(),
|
||||
Effect effect = new DoIfCostPaid(new PutTokenOntoBattlefieldCopyTargetEffect(true),
|
||||
new ManaCostsImpl("{2}"), "Create a token that's a copy of that artifact?");
|
||||
effect.setText("you may pay {2}. If you do, create a token that's a copy of that artifact");
|
||||
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, effect, filter, false, SetTargetPointer.PERMANENT, null));
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ public class RikuOfTwoReflections extends CardImpl {
|
|||
this.addAbility(new SpellCastControllerTriggeredAbility(new DoIfCostPaid(effect, new ManaCostsImpl("{U}{R}")), filter, false, true));
|
||||
|
||||
// Whenever another nontoken creature enters the battlefield under your control, you may pay {G}{U}. If you do, create a token that's a copy of that creature.
|
||||
effect = new DoIfCostPaid(new PutTokenOntoBattlefieldCopyTargetEffect(),
|
||||
effect = new DoIfCostPaid(new PutTokenOntoBattlefieldCopyTargetEffect(true),
|
||||
new ManaCostsImpl("{G}{U}"), "Create a token that's a copy of that creature?");
|
||||
effect.setText("you may pay {G}{U}. If you do, create a token that's a copy of that creature");
|
||||
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, effect, filterPermanent, false, SetTargetPointer.PERMANENT, null));
|
||||
|
|
|
|||
|
|
@ -70,6 +70,12 @@ public class PutTokenOntoBattlefieldCopyTargetEffect extends OneShotEffect {
|
|||
private boolean gainsFlying;
|
||||
private boolean becomesArtifact;
|
||||
private ObjectColor color;
|
||||
private boolean useLKI = false;
|
||||
|
||||
public PutTokenOntoBattlefieldCopyTargetEffect(boolean useLKI) {
|
||||
this();
|
||||
this.useLKI = useLKI;
|
||||
}
|
||||
|
||||
public PutTokenOntoBattlefieldCopyTargetEffect() {
|
||||
super(Outcome.PutCreatureInPlay);
|
||||
|
|
@ -149,6 +155,7 @@ public class PutTokenOntoBattlefieldCopyTargetEffect extends OneShotEffect {
|
|||
this.gainsFlying = effect.gainsFlying;
|
||||
this.becomesArtifact = effect.becomesArtifact;
|
||||
this.color = effect.color;
|
||||
this.useLKI = effect.useLKI;
|
||||
}
|
||||
|
||||
public void setBecomesArtifact(boolean becomesArtifact) {
|
||||
|
|
@ -163,7 +170,12 @@ public class PutTokenOntoBattlefieldCopyTargetEffect extends OneShotEffect {
|
|||
} else {
|
||||
targetId = getTargetPointer().getFirst(game, source);
|
||||
}
|
||||
Permanent permanent = game.getPermanentOrLKIBattlefield(targetId);
|
||||
Permanent permanent;
|
||||
if (useLKI) {
|
||||
permanent = ((FixedTarget) getTargetPointer()).getTargetedPermanentOrLKIBattlefield(game);
|
||||
} else {
|
||||
permanent = game.getPermanentOrLKIBattlefield(targetId);
|
||||
}
|
||||
Card copyFrom;
|
||||
ApplyToPermanent applier = new EmptyApplyToPermanent();
|
||||
if (permanent != null) {
|
||||
|
|
@ -220,7 +232,7 @@ public class PutTokenOntoBattlefieldCopyTargetEffect extends OneShotEffect {
|
|||
if (onlySubType != null && !token.getSubtype(game).contains(onlySubType)) {
|
||||
token.getSubtype(game).clear();
|
||||
token.getSubtype(game).add(onlySubType);
|
||||
}
|
||||
}
|
||||
if (color != null) {
|
||||
token.getColor(game).setColor(color);
|
||||
}
|
||||
|
|
@ -279,8 +291,12 @@ public class PutTokenOntoBattlefieldCopyTargetEffect extends OneShotEffect {
|
|||
public void setOnlySubType(String onlySubType) {
|
||||
this.onlySubType = onlySubType;
|
||||
}
|
||||
|
||||
|
||||
public void setOnlyColor(ObjectColor color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public void setUseLKI(boolean useLKI) {
|
||||
this.useLKI = useLKI;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue