* Kormus Bell - Fixed a bug with order land type changing effects are applied (fixes #3470).

This commit is contained in:
LevelX2 2017-07-28 16:56:31 +02:00
parent 4e8026fe59
commit b9dff66fcb
8 changed files with 136 additions and 34 deletions

View file

@ -51,6 +51,8 @@ public class KormusBell extends CardImpl {
// All Swamps are 1/1 black creatures that are still lands.
ContinuousEffect effect = new BecomesCreatureAllEffect(new KormusBellToken(), "lands", new FilterPermanent(SubType.SWAMP, "Swamps"), Duration.WhileOnBattlefield);
effect.setDependedToType(DependencyType.BecomeSwamp);
effect.addDependedToType(DependencyType.BecomeIsland);
effect.addDependedToType(DependencyType.BecomeMountain);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
}
@ -71,7 +73,7 @@ class KormusBellToken extends Token {
cardType.add(CardType.CREATURE);
power = new MageInt(1);
toughness = new MageInt(1);
color.setBlack(true); //Check Oracle, yes they are black
color.setBlack(true); // black creatures
}
}

View file

@ -49,8 +49,7 @@ import mage.game.permanent.Permanent;
public class MarchOfTheMachines extends CardImpl {
public MarchOfTheMachines(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{3}{U}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}");
// Each noncreature artifact is an artifact creature with power and toughness each equal to its converted mana cost.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new MarchOfTheMachinesEffect()));
@ -69,13 +68,15 @@ public class MarchOfTheMachines extends CardImpl {
class MarchOfTheMachinesEffect extends ContinuousEffectImpl {
private static final FilterArtifactPermanent filter = new FilterArtifactPermanent();
static {
filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE)));
}
public MarchOfTheMachinesEffect() {
super(Duration.WhileOnBattlefield, Outcome.BecomeCreature);
staticText = "Each noncreature artifact is an artifact creature with power and toughness each equal to its converted mana cost";
dependendToType = DependencyType.ArtifactAddingRemoving;
dependendToTypes.add(DependencyType.ArtifactAddingRemoving);
}
public MarchOfTheMachinesEffect(final MarchOfTheMachinesEffect effect) {
@ -93,8 +94,8 @@ class MarchOfTheMachinesEffect extends ContinuousEffectImpl {
case TypeChangingEffects_4:
if (sublayer == SubLayer.NA) {
affectedObjectList.clear();
for(Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)){
if(permanent != null){
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) {
if (permanent != null) {
affectedObjectList.add(new MageObjectReference(permanent, game));
permanent.addCardType(CardType.CREATURE);
}
@ -106,7 +107,7 @@ class MarchOfTheMachinesEffect extends ContinuousEffectImpl {
if (sublayer == SubLayer.SetPT_7b) {
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) {
Permanent permanent = it.next().getPermanent(game);
if (permanent != null){
if (permanent != null) {
int manaCost = permanent.getConvertedManaCost();
permanent.getPower().setValue(manaCost);
permanent.getToughness().setValue(manaCost);
@ -122,7 +123,6 @@ class MarchOfTheMachinesEffect extends ContinuousEffectImpl {
return false;
}
@Override
public boolean hasLayer(Layer layer) {
return layer == Layer.PTChangingEffects_7 || layer == Layer.TypeChangingEffects_4;

View file

@ -33,6 +33,7 @@ import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.BecomesBasicLandTargetEffect;
@ -104,7 +105,9 @@ class QuicksilverFountainEffect extends OneShotEffect {
if (player.choose(Outcome.Neutral, targetNonIslandLand, source.getId(), game)) {
Permanent landChosen = game.getPermanent(targetNonIslandLand.getFirstTarget());
landChosen.addCounters(CounterType.FLOOD.createInstance(), source, game);
ConditionalContinuousEffect effect = new ConditionalContinuousEffect(new BecomesBasicLandTargetEffect(Duration.OneUse, "Island"), new LandHasFloodCounterCondition(this), staticText);
ContinuousEffect becomesBasicLandTargetEffect = new BecomesBasicLandTargetEffect(Duration.OneUse, "Island");
becomesBasicLandTargetEffect.addDependencyType(DependencyType.BecomeIsland);
ConditionalContinuousEffect effect = new ConditionalContinuousEffect(becomesBasicLandTargetEffect, new LandHasFloodCounterCondition(this), staticText);
this.setTargetPointer(new FixedTarget(landChosen, game));
effect.setTargetPointer(new FixedTarget(landChosen, game));
game.addEffect(effect, source);
@ -160,7 +163,7 @@ class AllLandsAreSubtypeCondition implements Condition {
int landCount = game.getBattlefield().getAllActivePermanents(CardType.LAND).size();
return game.getBattlefield().getAllActivePermanents(filterLand, game).size() == landCount;
}
@Override
public String toString() {
return "if all lands on the battlefield are " + subtype + "s";
@ -178,7 +181,7 @@ class LandHasFloodCounterCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(effect.getTargetPointer().getFirst(game, source));
return permanent != null
&& permanent.getCounters(game).getCount(CounterType.FLOOD) > 0;
return permanent != null
&& permanent.getCounters(game).getCount(CounterType.FLOOD) > 0;
}
}

View file

@ -41,7 +41,6 @@ import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.filter.common.FilterBasicLandCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInLibrary;
@ -53,7 +52,7 @@ import mage.target.common.TargetCardInLibrary;
public class VeteranExplorer extends CardImpl {
public VeteranExplorer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{G}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G}");
this.subtype.add("Human");
this.subtype.add("Soldier");
this.subtype.add("Scout");
@ -74,6 +73,7 @@ public class VeteranExplorer extends CardImpl {
return new VeteranExplorer(this);
}
}
class VeteranExplorerEffect extends OneShotEffect {
public VeteranExplorerEffect() {
@ -96,7 +96,7 @@ class VeteranExplorerEffect extends OneShotEffect {
if (controller != null) {
List<Player> usingPlayers = new ArrayList<>();
this.chooseAndSearchLibrary(usingPlayers, controller, source, game);
for (UUID playerId: game.getState().getPlayersInRange(controller.getId(), game)) {
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
if (!playerId.equals(controller.getId())) {
Player player = game.getPlayer(playerId);
if (player != null) {
@ -104,7 +104,7 @@ class VeteranExplorerEffect extends OneShotEffect {
}
}
}
for (Player player: usingPlayers) {
for (Player player : usingPlayers) {
player.shuffleLibrary(source, game);
}
return true;
@ -118,7 +118,7 @@ class VeteranExplorerEffect extends OneShotEffect {
TargetCardInLibrary target = new TargetCardInLibrary(0, 2, StaticFilters.FILTER_BASIC_LAND_CARD);
if (player.searchLibrary(target, game)) {
if (!target.getTargets().isEmpty()) {
for (UUID cardId: (List<UUID>)target.getTargets()) {
for (UUID cardId : (List<UUID>) target.getTargets()) {
Card card = player.getLibrary().getCard(cardId, game);
if (card != null) {
card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), player.getId());
@ -128,5 +128,5 @@ class VeteranExplorerEffect extends OneShotEffect {
}
}
}
}