* Changed the method for step end processing of spells with multiple steps (608.2) from game.applyEffects() to game.getState().processAction(game);

This commit is contained in:
LevelX2 2020-06-08 15:40:13 +02:00
parent 919fa282ce
commit d8fb962030
48 changed files with 52 additions and 52 deletions

View file

@ -74,7 +74,7 @@ class AladdinsLampEffect extends ReplacementEffectImpl {
cards.remove(target.getFirstTarget());
}
controller.putCardsOnBottomOfLibrary(cards, game, source, false);
game.applyEffects();
game.getState().processAction(game);
controller.drawCards(1, event.getSourceId(), game, event.getAppliedEffects());
discard();
return true;

View file

@ -98,7 +98,7 @@ class AngrathMinotaurPirateThirdAbilityEffect extends OneShotEffect {
permanent.destroy(source.getSourceId(), game, false);
powerSum += permanent.getPower().getValue();
}
game.applyEffects();
game.getState().processAction(game);
targetOpponent.damage(powerSum, source.getSourceId(), game);
}
return true;

View file

@ -74,7 +74,7 @@ class BlessedReincarnationEffect extends OneShotEffect {
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (permanent != null && controller != null) {
controller.moveCards(permanent, Zone.EXILED, source, game);
game.applyEffects();
game.getState().processAction(game);
Player permanentController = game.getPlayer(permanent.getControllerId());
if (permanentController != null) {

View file

@ -86,7 +86,7 @@ class BoundEffect extends OneShotEffect {
Permanent toSacrifice = game.getPermanent(target.getFirstTarget());
if (toSacrifice != null) {
toSacrifice.sacrifice(source.getSourceId(), game);
game.applyEffects();
game.getState().processAction(game);
int colors = toSacrifice.getColor(game).getColorCount();
if (colors > 0) {
TargetCardInYourGraveyard targetCard = new TargetCardInYourGraveyard(0, colors,

View file

@ -77,7 +77,7 @@ class BuildersBaneEffect extends OneShotEffect {
Permanent permanent = game.getPermanent(targetID);
if (permanent != null) {
if (permanent.destroy(source.getSourceId(), game, false)) {
game.applyEffects();
game.getState().processAction(game);
if (permanent.getZoneChangeCounter(game) + 1 == game.getState().getZoneChangeCounter(permanent.getId())
&& game.getState().getZone(permanent.getId()) != Zone.GRAVEYARD) {
// A replacement effect has moved the card to another zone as grvayard

View file

@ -59,7 +59,7 @@ class CinderCloudEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (permanent != null && permanent.destroy(source.getSourceId(), game, false) && permanent.getColor(game).equals(ObjectColor.WHITE)) {
game.applyEffects();
game.getState().processAction(game);
if (permanent.getZoneChangeCounter(game) + 1 == game.getState().getZoneChangeCounter(permanent.getId())
&& game.getState().getZone(permanent.getId()) != Zone.GRAVEYARD) {
// A replacement effect has moved the card to another zone as grvayard

View file

@ -63,7 +63,7 @@ class CompellingDeterrenceEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && player != null) {
player.moveCards(target, Zone.HAND, source, game);
game.applyEffects();
game.getState().processAction(game);
FilterPermanent zombieFilter = new FilterPermanent();
zombieFilter.add(SubType.ZOMBIE.getPredicate());
if (game.getState().getBattlefield().countAll(zombieFilter, controller.getId(), game) > 0) {

View file

@ -88,7 +88,7 @@ class DeclarationInStoneEffect extends OneShotEffect {
}
}
controller.moveCards(cardsToExile, Zone.EXILED, source, game);
game.applyEffects();
game.getState().processAction(game);
if (nonTokenCount > 0) {
new ClueArtifactToken().putOntoBattlefield(nonTokenCount, game, source.getSourceId(), targetPermanent.getControllerId(), false, false);
}

View file

@ -73,7 +73,7 @@ class DevourFleshSacrificeEffect extends OneShotEffect {
if (permanent != null) {
int gainLife = permanent.getToughness().getValue();
permanent.sacrifice(source.getSourceId(), game);
game.applyEffects();
game.getState().processAction(game);
player.gainLife(gainLife, game, source);
} else {
return false;

View file

@ -78,7 +78,7 @@ class DomrisAmbushEffect extends OneShotEffect {
return false;
}
permanent.addCounters(CounterType.P1P1.createInstance(), source, game);
game.applyEffects();
game.getState().processAction(game);
return new DamageWithPowerFromOneToAnotherTargetEffect().apply(game, source);
}
}

View file

@ -88,7 +88,7 @@ class EmpoweredAutogeneratorManaEffect extends ManaEffect {
if (game == null) {
return mana;
}
game.applyEffects();
game.getState().processAction(game);
Permanent sourcePermanent = game.getState().getPermanent(source.getSourceId());
if (sourcePermanent == null) {
return mana;

View file

@ -61,7 +61,7 @@ class FiligreeFractureEffect extends OneShotEffect {
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (player != null && permanent != null) {
permanent.destroy(source.getSourceId(), game, true);
game.applyEffects();
game.getState().processAction(game);
if (permanent.getColor(game).isBlack() || permanent.getColor(game).isBlue()) {
player.drawCards(1, source.getSourceId(), game);
}

View file

@ -67,7 +67,7 @@ class FracturingGustDestroyEffect extends OneShotEffect {
++destroyedPermanents;
}
}
game.applyEffects(); // needed in case a destroyed permanent did prevent life gain
game.getState().processAction(game); // needed in case a destroyed permanent did prevent life gain
if (destroyedPermanents > 0) {
controller.gainLife(2 * destroyedPermanents, game, source);
}

View file

@ -76,7 +76,7 @@ class FromTheAshesEffect extends OneShotEffect {
playerAmount.put(playerId, amount);
}
}
game.applyEffects();
game.getState().processAction(game);
for (Map.Entry<UUID, Integer> entry : playerAmount.entrySet()) {
Player player = game.getPlayer(entry.getKey());
if (player != null && player.chooseUse(outcome, "Search your library for up to " + entry.getValue() + " basic land card(s) to put it onto the battlefield?", source, game)) {
@ -90,7 +90,7 @@ class FromTheAshesEffect extends OneShotEffect {
entry.setValue(0); // no search no shuffling
}
}
game.applyEffects();
game.getState().processAction(game);
for (Map.Entry<UUID, Integer> entry : playerAmount.entrySet()) {
Player player = game.getPlayer(entry.getKey());
if (player != null && entry.getValue() > 0) {

View file

@ -62,7 +62,7 @@ class FumigateEffect extends OneShotEffect {
destroyedCreature++;
}
}
game.applyEffects();
game.getState().processAction(game);
if (destroyedCreature > 0) {
controller.gainLife(destroyedCreature, game, source);
}

View file

@ -81,7 +81,7 @@ class GhostlyFlickerEffect extends OneShotEffect {
}
}
controller.moveCards(toExile, Zone.EXILED, source, game);
game.applyEffects();
game.getState().processAction(game);
Set<Card> toBattlefield = new HashSet<>();
for (Card card : toExile) {
Zone currentZone = game.getState().getZone(card.getId());

View file

@ -71,7 +71,7 @@ class GideonsDefeatEffect extends OneShotEffect {
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (controller != null && permanent != null) {
controller.moveCards(permanent, Zone.EXILED, source, game);
game.applyEffects();
game.getState().processAction(game);
if (permanent.isPlaneswalker() && permanent.hasSubtype(SubType.GIDEON, game)) {
controller.gainLife(5, game, source);
}

View file

@ -97,7 +97,7 @@ class HeraldOfLeshracCumulativeCost extends CostImpl {
ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfGame);
effect.setTargetPointer(new FixedTarget(target.getFirstTarget()));
game.addEffect(effect, ability);
game.applyEffects();
game.getState().processAction(game);
paid = true;
}
return paid;

View file

@ -69,7 +69,7 @@ class HourOfGloryEffect extends OneShotEffect {
if (targetCreature != null) {
controller.moveCards(targetCreature, Zone.EXILED, source, game);
if (targetCreature.hasSubtype(SubType.GOD, game)) {
game.applyEffects();
game.getState().processAction(game);
Player targetController = game.getPlayer(targetCreature.getControllerId());
if (targetController != null) {
targetController.revealCards(sourceObject.getIdName(), targetController.getHand(), game);

View file

@ -76,7 +76,7 @@ class InducedAmnesiaExileEffect extends OneShotEffect {
card.setFaceDown(true, game);
}
game.informPlayers(sourcePermanent.getLogName() + ": " + targetPlayer.getLogName() + " exiles their hand face down (" + numberOfCards + "card" + (numberOfCards > 1 ? "s" : "") + ')');
game.applyEffects();
game.getState().processAction(game);
targetPlayer.drawCards(numberOfCards, source.getSourceId(), game);
}
return true;

View file

@ -69,7 +69,7 @@ class InfernalJudgmentEffect extends OneShotEffect {
}
int creaturePower = permanent.getPower().getValue();
permanent.moveToExile(null, null, source.getSourceId(), game);
game.applyEffects();
game.getState().processAction(game);
player.gainLife(creaturePower, game, source);
return true;
}

View file

@ -76,7 +76,7 @@ class JoustEffect extends OneShotEffect {
if (creature2 == null) {
return true;
}
game.applyEffects();
game.getState().processAction(game);
return creature1.fight(creature2, source, game);
}
}

View file

@ -78,7 +78,7 @@ class KaerveksPurgeEffect extends OneShotEffect {
// Destroy target creature with converted mana cost X.
Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
if (targetCreature != null && targetCreature.destroy(source.getSourceId(), game, false)) {
game.applyEffects();
game.getState().processAction(game);
if (targetCreature.getZoneChangeCounter(game) + 1 == game.getState().getZoneChangeCounter(targetCreature.getId())
&& game.getState().getZone(targetCreature.getId()) != Zone.GRAVEYARD) {
// A replacement effect has moved the card to another zone as graveyard

View file

@ -95,7 +95,7 @@ class KraulHarpoonerEffect extends OneShotEffect {
}
int xValue = player.getGraveyard().count(StaticFilters.FILTER_CARD_CREATURE, game);
game.addEffect(new BoostSourceEffect(xValue, 0, Duration.EndOfTurn), source);
game.applyEffects();
game.getState().processAction(game);
Permanent creature = game.getPermanent(source.getFirstTarget());
if (creature == null || !player.chooseUse(outcome, "Have " + sourcePerm.getLogName() + " fight " + creature.getLogName() + "?", source, game)) {
return true;

View file

@ -70,7 +70,7 @@ class KrenkoTinStreetKingpinEffect extends OneShotEffect {
return false;
}
new AddCountersSourceEffect(CounterType.P1P1.createInstance()).apply(game, source);
game.applyEffects();
game.getState().processAction(game);
int xValue = permanent.getPower().getValue();
return new CreateTokenEffect(new GoblinToken("WAR"), xValue).apply(game, source);
}

View file

@ -67,7 +67,7 @@ class LilianasDefeatEffect extends OneShotEffect {
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (player != null && permanent != null) {
permanent.destroy(source.getSourceId(), game, true);
game.applyEffects();
game.getState().processAction(game);
if (permanent.isPlaneswalker() && permanent.hasSubtype(SubType.LILIANA, game)) {
Player permanentController = game.getPlayer(permanent.getControllerId());
if (permanentController != null) {

View file

@ -76,13 +76,13 @@ class LivingDeathEffect extends OneShotEffect {
}
}
}
game.applyEffects();
game.getState().processAction(game);
// Sacrifice all creatures
for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game)) {
permanent.sacrifice(source.getSourceId(), game);
}
game.applyEffects();
game.getState().processAction(game);
// Exiled cards are put onto the battlefield at the same time under their owner's control
Set<Card> cardsToReturnFromExile = new HashSet<>();

View file

@ -75,7 +75,7 @@ class MayaelsAriaEffect extends OneShotEffect {
creature.addCounters(CounterType.P1P1.createInstance(), source, game);
}
}
game.applyEffects(); // needed because otehrwise the +1/+1 counters wouldn't be taken into account
game.getState().processAction(game); // needed because otehrwise the +1/+1 counters wouldn't be taken into account
// Then you gain 10 life if you control a creature with power 10 or greater.
filter = new FilterCreaturePermanent();

View file

@ -73,7 +73,7 @@ class MoltenPsycheEffect extends OneShotEffect {
}
}
game.applyEffects(); // so effects from creatures that were on the battlefield won't trigger from draw action
game.getState().processAction(game); // so effects from creatures that were on the battlefield won't trigger from draw action
for (UUID playerId : cardsToDraw.keySet()) {
Player player = game.getPlayer(playerId);

View file

@ -63,7 +63,7 @@ class OblationEffect extends OneShotEffect {
player.moveCardToLibraryWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD, true, true);
player.shuffleLibrary(source, game);
game.applyEffects(); // so effects from creatures that were on the battlefield won't trigger from draw
game.getState().processAction(game); // so effects from creatures that were on the battlefield won't trigger from draw
player.drawCards(2, source.getSourceId(), game);
return true;

View file

@ -83,7 +83,7 @@ class OutmuscleEffect extends OneShotEffect {
if (creature == null) {
return true;
}
game.applyEffects();
game.getState().processAction(game);
return creature.fight(permanent, source, game);
}
}

View file

@ -76,7 +76,7 @@ class ProfaneProcessionEffect extends OneShotEffect {
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && exileId != null && sourceObject != null) {
new ExileTargetEffect(exileId, sourceObject.getIdName()).setTargetPointer(targetPointer).apply(game, source);
game.applyEffects();
game.getState().processAction(game);
ExileZone exileZone = game.getExile().getExileZone(exileId);
if (exileZone != null && exileZone.size() > 2) {
new TransformSourceEffect(true).apply(game, source);

View file

@ -71,7 +71,7 @@ public final class PureReflection extends CardImpl {
game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game).forEach((permanent) -> {
permanent.destroy(source.getSourceId(), game,false);
});
game.applyEffects();
game.getState().processAction(game);
// Then that player creates an X/X white Reflection creature token, where X is the converted mana cost of that spell.
ReflectionPureToken token = new ReflectionPureToken(spell.getConvertedManaCost());

View file

@ -70,7 +70,7 @@ class SavageSwipeEffect extends OneShotEffect {
ContinuousEffect effect = new BoostTargetEffect(2, 2, Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source);
game.applyEffects();
game.getState().processAction(game);
}
return new FightTargetsEffect().apply(game, source);
}

View file

@ -101,7 +101,7 @@ class SorinLordOfInnistradEffect extends OneShotEffect {
}
}
}
game.applyEffects();
game.getState().processAction(game);
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
return controller.moveCards(toBattlefield, Zone.BATTLEFIELD, source, game);

View file

@ -133,7 +133,7 @@ class TahngarthFirstMateEffect extends OneShotEffect {
ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfCombat, player.getId());
effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source);
game.applyEffects();
game.getState().processAction(game);
return game.getCombat().addAttackerToCombat(permanent.getId(), target.getFirstTarget(), game);
}
}

View file

@ -77,7 +77,7 @@ class TeleminPerformanceEffect extends OneShotEffect {
opponent.revealCards(source, reveal, game);
opponent.moveCards(nonCreatures, Zone.GRAVEYARD, source, game);
if (creature != null) {
game.applyEffects();
game.getState().processAction(game);
controller.moveCards(creature, Zone.BATTLEFIELD, source, game);
}
}

View file

@ -88,7 +88,7 @@ class TerastodonEffect extends OneShotEffect {
}
}
}
game.applyEffects();
game.getState().processAction(game);
ElephantToken elephantToken = new ElephantToken();
for (Entry<UUID, Integer> entry : destroyedPermanents.entrySet()) {
elephantToken.putOntoBattlefield(entry.getValue(), game, source.getSourceId(), entry.getKey());

View file

@ -90,7 +90,7 @@ class TheGreatAuroraEffect extends OneShotEffect {
}
}
game.applyEffects(); // so effects from creatures that were on the battlefield won't trigger from draw or put into play
game.getState().processAction(game); // so effects from creatures that were on the battlefield won't trigger from draw or put into play
// Draw cards
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {

View file

@ -90,7 +90,7 @@ class ThoughtDissectorEffect extends OneShotEffect {
}
targetOpponent.revealCards(source, reveal, game);
if (artifact != null) {
game.applyEffects();
game.getState().processAction(game);
controller.moveCards(artifact, Zone.BATTLEFIELD, source, game);
Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game);
if (sourcePermanent != null) {

View file

@ -86,7 +86,7 @@ class TwilightProphetEffect extends OneShotEffect {
if (card != null) {
controller.revealCards(sourceObject.getIdName(), new CardsImpl(card), game);
controller.moveCards(card, Zone.HAND, source, game);
game.applyEffects();
game.getState().processAction(game);
int amount = card.getConvertedManaCost();
if (amount > 0) {
new LoseLifeOpponentsEffect(amount).apply(game, source);

View file

@ -120,7 +120,7 @@ class VesuvanShapeshifterEffect extends OneShotEffect {
if (copyFromCreature != null) {
game.copyPermanent(Duration.Custom, copyFromCreature, copyToCreature.getId(), source, new VesuvanShapeShifterFaceUpApplier());
source.getTargets().clear();
game.applyEffects(); // needed to get effects ready if copy happens in replacment and the copied abilities react of the same event (e.g. turn face up)
game.getState().processAction(game); // needed to get effects ready if copy happens in replacment and the copied abilities react of the same event (e.g. turn face up)
return true;
}
}

View file

@ -64,7 +64,7 @@ class VictimizeEffect extends OneShotEffect {
if (controller != null) {
SacrificeTargetCost cost = new SacrificeTargetCost(new TargetControlledCreaturePermanent(FILTER_CONTROLLED_CREATURE_SHORT_TEXT));
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) {
game.applyEffects(); // To end effects of the sacrificed creature
game.getState().processAction(game); // To end effects of the sacrificed creature
controller.moveCards(new CardsImpl(getTargetPointer().getTargets(game, source)).getCards(game),
Zone.BATTLEFIELD, source, game, true, false, false, null);
}

View file

@ -97,7 +97,7 @@ class WarpWorldEffect extends OneShotEffect {
}
}
game.applyEffects(); // so effects from creatures that were on the battlefield won't trigger from draw or later put into play
game.getState().processAction(game); // so effects from creatures that were on the battlefield won't trigger from draw or later put into play
Map<UUID, CardsImpl> cardsRevealed = new HashMap<>();
@ -111,7 +111,7 @@ class WarpWorldEffect extends OneShotEffect {
cardsRevealed.put(player.getId(), cards);
}
}
game.applyEffects();
game.getState().processAction(game);
// put artifacts, creaturs and lands onto the battlefield
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player player = game.getPlayer(playerId);
@ -129,7 +129,7 @@ class WarpWorldEffect extends OneShotEffect {
player.moveCards(toBattlefield, Zone.BATTLEFIELD, source, game);
}
}
game.applyEffects();
game.getState().processAction(game);
// put enchantments onto the battlefield
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player player = game.getPlayer(playerId);

View file

@ -92,7 +92,7 @@ class WaveOfVitriolEffect extends OneShotEffect {
}
}
}
game.applyEffects();
game.getState().processAction(game);
Cards toBattlefield = new CardsImpl();
Set<Player> playersToShuffle = new LinkedHashSet<>();
for (Map.Entry<Player, Integer> entry : sacrificedLands.entrySet()) {

View file

@ -61,7 +61,7 @@ class WidespreadBrutalityEffect extends OneShotEffect {
if (amassedArmy == null) {
return false;
}
game.applyEffects();
game.getState().processAction(game);
int power = amassedArmy.getPower().getValue();
for (Permanent permanent : game.getBattlefield().getActivePermanents(source.getControllerId(), game)) {
if (permanent != null && permanent.isCreature() && !permanent.hasSubtype(SubType.ARMY, game)) {

View file

@ -93,7 +93,7 @@ class YorvoLordOfGarenbrigEffect extends OneShotEffect {
if (permanent == null) {
return true;
}
game.applyEffects();
game.getState().processAction(game);
if (permanent.getPower().getValue() > sourcePerm.getPower().getValue()) {
sourcePerm.addCounters(CounterType.P1P1.createInstance(), source, game);
}

View file

@ -66,7 +66,7 @@ class ZombieApocalypseEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
controller.moveCards(controller.getGraveyard().getCards(filterZombie, game), Zone.BATTLEFIELD, source, game, true, false, false, null);
game.applyEffects();
game.getState().processAction(game);
for (Permanent permanent : game.getBattlefield().getActivePermanents(
new FilterPermanent(SubType.HUMAN, "Humans"), source.getControllerId(), game)) {
permanent.destroy(source.getSourceId(), game, false);