refactor: simpler processAction syntax (#12458)

* game.processAction() instead of game.getState().processAction(game)

* add simpler method name and docs

* find/replace to new method

* remove old method

* deprecate applyEffects
This commit is contained in:
xenohedron 2024-06-11 22:55:43 -04:00 committed by GitHub
parent e2b1d980b6
commit d61de05eb8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
163 changed files with 218 additions and 217 deletions

View file

@ -73,7 +73,7 @@ class AbstruseAppropriationEffect extends OneShotEffect {
.setToSourceExileZone(true)
.setTargetPointer(getTargetPointer().copy())
.apply(game, source);
game.getState().processAction(game);
game.processAction();
Card card = game.getCard(getTargetPointer().getFirst(game, source));
if (card == null || !game.getState().getZone(card.getId()).equals(Zone.EXILED)) {
return true;
@ -133,4 +133,4 @@ class AbstruseAppropriationAsThoughEffect extends AsThoughEffectImpl implements
}
return null;
}
}
}

View file

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

View file

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

View file

@ -70,7 +70,7 @@ class AnotherChanceEffect extends OneShotEffect {
}
// Make sure the mill has been processed.
game.getState().processAction(game);
game.processAction();
TargetCard target = new TargetCardInYourGraveyard(
0, 2, StaticFilters.FILTER_CARD_CREATURES_YOUR_GRAVEYARD, true

View file

@ -77,7 +77,7 @@ class AnotherRoundEffect extends OneShotEffect {
.map(id -> new MageObjectReference(id, game))
.collect(Collectors.toList())
)).apply(game, source);
game.getState().processAction(game);
game.processAction();
}
return true;
}

View file

@ -91,7 +91,7 @@ class AwakenTheMaelstromEffect extends OneShotEffect {
return false;
}
makeToken(player, game, source);
game.getState().processAction(game);
game.processAction();
distributeCounters(player, game, source);
return true;
}

View file

@ -95,7 +95,7 @@ class BeseechTheMirrorEffect extends OneShotEffect {
// you may cast the exiled card without paying its mana cost if that spell's mana value is 4 or less.
CardUtil.castSpellWithAttributesForFree(controller, source, game, card, filter);
}
game.getState().processAction(game);
game.processAction();
if (game.getState().getZone(card.getId()).equals(Zone.EXILED)) {
// Put the exiled card into your hand if it wasn't cast this way.
@ -108,4 +108,4 @@ class BeseechTheMirrorEffect extends OneShotEffect {
}
return false;
}
}
}

View file

@ -92,7 +92,7 @@ class BillFernyEffect extends OneShotEffect {
game.addEffect(new GainControlTargetEffect(
Duration.Custom, true, opponentToGainControl
).setTargetPointer(new FixedTarget(permanent.getId(), game)), source);
game.getState().processAction(game);
game.processAction();
if (permanent.isControlledBy(opponentToGainControl)) {
removeFromCombat.apply(game, source);
create3TreasureTokens.apply(game, source);

View file

@ -67,7 +67,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.getState().processAction(game);
game.processAction();
Player permanentController = game.getPlayer(permanent.getControllerId());
if (permanentController != null) {

View file

@ -91,7 +91,7 @@ class BlessingOfFrostEffect extends OneShotEffect {
permanent.addCounters(CounterType.P1P1.createInstance(target.getTargetAmount(targetId)), source.getControllerId(), source, game);
}
}
game.getState().processAction(game);
game.processAction();
player.drawCards(game.getBattlefield().count(
filter, source.getControllerId(), source, game
), source, game);

View file

@ -86,7 +86,7 @@ class BlimComedicGeniusEffect extends OneShotEffect {
game.addEffect(new GainControlTargetEffect(
Duration.Custom, true, getTargetPointer().getFirst(game, source)
).setTargetPointer(new FixedTarget(source.getFirstTarget(), game)), source);
game.getState().processAction(game);
game.processAction();
Map<UUID, Cards> cardsMap = new HashMap<>();
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player player = game.getPlayer(playerId);

View file

@ -87,7 +87,7 @@ class BondOfPassionEffect extends OneShotEffect {
ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source);
game.getState().processAction(game);
game.processAction();
permanent.untap(game);
effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(permanent, game));

View file

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

View file

@ -63,7 +63,7 @@ class BreakTheSpellEffect extends OneShotEffect {
boolean followupEffect = permanent.isControlledBy(source.getControllerId())
|| StaticFilters.FILTER_PERMANENT_TOKEN.match(permanent, game);
boolean destroyed = permanent.destroy(source, game, false);
game.getState().processAction(game);
game.processAction();
if (followupEffect && destroyed) {
new DrawCardSourceControllerEffect(1).apply(game, source);

View file

@ -95,7 +95,7 @@ class BringerOfTheLastGiftEffect extends OneShotEffect {
}
// Make sure the sacrifices are processed.
game.getState().processAction(game);
game.processAction();
Set<Card> toReturn = new HashSet<>();
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
@ -112,4 +112,4 @@ class BringerOfTheLastGiftEffect extends OneShotEffect {
return true;
}
}
}

View file

@ -66,7 +66,7 @@ class BuildersBaneEffect extends OneShotEffect {
Permanent permanent = game.getPermanent(targetID);
if (permanent != null) {
if (permanent.destroy(source, game, false)) {
game.getState().processAction(game);
game.processAction();
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

@ -75,7 +75,7 @@ class CallForAidEffect extends OneShotEffect {
//"Gain control of all creatures target opponent controls until end of turn"
new GainControlAllEffect(Duration.EndOfTurn, filter).apply(game, source);
game.getState().processAction(game);
game.processAction();
//"Untap those creatures".
new UntapAllEffect(filter).apply(game, source);

View file

@ -82,7 +82,7 @@ class ChaosMutationEffect extends OneShotEffect {
.filter(Objects::nonNull)
.collect(Collectors.toList());
controller.moveCards(permanents, Zone.EXILED, source, game);
game.getState().processAction(game);
game.processAction();
for (Player player : players) {
Cards cards = new CardsImpl();
Card card = getCreatureCard(player, cards, game);

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, game, false) && permanent.getColor(game).equals(ObjectColor.WHITE)) {
game.getState().processAction(game);
game.processAction();
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

@ -97,7 +97,7 @@ class ClericClassReturnEffect extends OneShotEffect {
return false;
}
player.moveCards(card, Zone.BATTLEFIELD, source, game);
game.getState().processAction(game);
game.processAction();
Permanent permanent = game.getPermanent(card.getId());
int toughness = permanent != null ? permanent.getToughness().getValue() : card.getToughness().getValue();
player.gainLife(toughness, game, source);

View file

@ -75,7 +75,7 @@ class CoercedConfessionMillEffect extends OneShotEffect {
if (controller == null) {
return true;
}
game.getState().processAction(game);
game.processAction();
controller.drawCards(creaturesMilled, source, game);
return true;
}

View file

@ -78,7 +78,7 @@ class ColossalBadgerEffect extends OneShotEffect {
int amount = player.millCards(4, source, game).count(StaticFilters.FILTER_CARD_CREATURE, game);
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (amount > 0 && permanent != null) {
game.getState().processAction(game);
game.processAction();
permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game);
}
return true;

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.getState().processAction(game);
game.processAction();
FilterPermanent zombieFilter = new FilterPermanent();
zombieFilter.add(SubType.ZOMBIE.getPredicate());
if (game.getBattlefield().countAll(zombieFilter, controller.getId(), game) > 0) {

View file

@ -98,7 +98,7 @@ class CovetedFalconEffect extends OneShotEffect {
source);
}
game.getState().processAction(game);
game.processAction();
int cardsToDraw = 0;
for (UUID permanentId : targetPermanentIds) {

View file

@ -90,10 +90,10 @@ class CrabominationEffect extends OneShotEffect {
cards.add(fromHand);
}
opponent.moveCardsToExile(cards.getCards(game), source, game, true, null, "");
game.getState().processAction(game);
game.processAction();
cards.retainZone(Zone.EXILED, game);
CardUtil.castSpellWithAttributesForFree(controller, source, game, cards, StaticFilters.FILTER_CARD);
return true;
}
}
}

View file

@ -94,7 +94,7 @@ class CurseOfTheSwineEffect extends OneShotEffect {
playersWithTargets.getOrDefault(lkiP.getControllerId(), 0) + 1);
}
}
game.getState().processAction(game);
game.processAction();
Boar2Token swineToken = new Boar2Token();
for (Map.Entry<UUID, Integer> exiledByController : playersWithTargets.entrySet()) {
swineToken.putOntoBattlefield(exiledByController.getValue(), game, source, exiledByController.getKey());

View file

@ -90,7 +90,7 @@ class DeclarationInStoneEffect extends OneShotEffect {
}
}
controller.moveCards(cardsToExile, Zone.EXILED, source, game);
game.getState().processAction(game);
game.processAction();
if (nonTokenCount > 0) {
new InvestigateTargetEffect(nonTokenCount)
.setTargetPointer(new FixedTarget(targetPermanent.getControllerId()))

View file

@ -72,7 +72,7 @@ class DecreeOfPainEffect extends OneShotEffect {
}
}
if (destroyedCreature > 0) {
game.getState().processAction(game);
game.processAction();
controller.drawCards(destroyedCreature, source, game);
}
return true;

View file

@ -65,7 +65,7 @@ class DefossilizeEffect extends OneShotEffect {
return false;
}
player.moveCards(card, Zone.BATTLEFIELD, source, game);
game.getState().processAction(game);
game.processAction();
Permanent permanent = game.getPermanent(card.getId());
if (permanent == null) {
return false;

View file

@ -62,7 +62,7 @@ class DeicideExileEffect extends SearchTargetGraveyardHandLibraryForCardNameAndE
return false;
}
controller.moveCards(targetEnchantment, Zone.EXILED, source, game);
game.getState().processAction(game);
game.processAction();
// 4/26/2014
// Deicide looks at the card in exile, not the permanent that was exiled, to determine

View file

@ -75,7 +75,7 @@ class DescentOfTheDragonsEffect extends OneShotEffect {
}
}
}
game.getState().processAction(game);
game.processAction();
DragonToken dragonToken = new DragonToken();
for (Map.Entry<UUID, Integer> amountTokensPerPlayer : playersWithTargets.entrySet()) {
dragonToken.putOntoBattlefield(amountTokensPerPlayer.getValue(), game, source, amountTokensPerPlayer.getKey());

View file

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

View file

@ -53,7 +53,7 @@ class DiminishingReturnsEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
controller.moveCards(controller.getLibrary().getTopCards(game, 10), Zone.EXILED, source, game);
game.getState().processAction(game);
game.processAction();
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {

View file

@ -84,7 +84,7 @@ class DireStrainRampageEffect extends OneShotEffect {
}
boolean landTargeted = permanent.isLand(game);
boolean destroyed = permanent.destroy(source, game, false);
game.getState().processAction(game);
game.processAction();
TargetCardInLibrary target = landTargeted && destroyed ?
new TargetCardInLibrary(0, 2, StaticFilters.FILTER_CARD_BASIC_LANDS) :
new TargetCardInLibrary(1, 1, StaticFilters.FILTER_CARD_BASIC_LAND);

View file

@ -78,7 +78,7 @@ class DisorderInTheCourtEffect extends OneShotEffect {
.collect(Collectors.toCollection(LinkedHashSet::new));
if (!toExile.isEmpty()) {
controller.moveCardsToExile(toExile, source, game, true, CardUtil.getExileZoneId(game, source), CardUtil.getSourceName(game, source));
game.getState().processAction(game);
game.processAction();
}
new InvestigateEffect(ManacostVariableValue.REGULAR).apply(game, source);
if (!toExile.isEmpty()) {

View file

@ -74,7 +74,7 @@ class DreadSummonsEffect extends OneShotEffect {
.count();
}
if (creatureCount > 0) {
game.getState().processAction(game);
game.processAction();
token.putOntoBattlefield(creatureCount, game, source, source.getControllerId(), true, false);
}
return true;

View file

@ -141,7 +141,7 @@ class ElrondOfWhiteCouncilEffect extends OneShotEffect {
).setTargetPointer(blueprintTarget.copy()), source);
// Need to process the control change.
game.getState().processAction(game);
game.processAction();
// Then for each aid vote, put a +1/+1 counter on each creature you control.
int countAid = vote.getVoteCount(false);

View file

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

View file

@ -87,7 +87,7 @@ class EnigmaticIncarnationEffect extends OneShotEffect {
if (permanent == null) {
return false;
}
game.getState().processAction(game);
game.processAction();
int cmc = permanent.getManaValue();
if (!permanent.sacrifice(source, game)) {
return false;

View file

@ -95,7 +95,7 @@ class EtchedSlithPutWhenDoEffect extends OneShotEffect {
}
int beforeP1P1 = permanent.getCounters(game).getCount(CounterType.P1P1);
new AddCountersSourceEffect(CounterType.P1P1.createInstance()).apply(game, source);
game.getState().processAction(game);
game.processAction();
int afterP1P1 = permanent.getCounters(game).getCount(CounterType.P1P1);
for (int i = beforeP1P1 + 1; i <= afterP1P1; ++i) {
// Releases notes rulling:

View file

@ -119,7 +119,7 @@ class EvolvedSleeperPhyrexianEffect extends OneShotEffect {
permanent.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game);
}
Player player = game.getPlayer(source.getControllerId());
game.getState().processAction(game);
game.processAction();
player.drawCards(1, source, game);
player.loseLife(1, game, source, false);
return true;

View file

@ -92,7 +92,7 @@ class ExtraordinaryJourneyEffect extends OneShotEffect {
if (!effect.apply(game, source)) {
return false;
}
game.getState().processAction(game);
game.processAction();
Set<Card> cards = permanents
.stream()

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, game, true);
game.getState().processAction(game);
game.processAction();
if (permanent.getColor(game).isBlack() || permanent.getColor(game).isBlue()) {
player.drawCards(1, source, game);
}

View file

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

View file

@ -125,7 +125,7 @@ class FroghemothEffect extends OneShotEffect {
}
if (!cardsToExile.isEmpty()) {
controller.moveCards(cardsToExile, Zone.EXILED, source, game);
game.getState().processAction(game);
game.processAction();
if (numCounters > 0) {
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
if (permanent != null) {

View file

@ -71,7 +71,7 @@ class FromTheAshesEffect extends OneShotEffect {
playerAmount.merge(controllerId, 1, Integer::sum);
}
}
game.getState().processAction(game);
game.processAction();
// For each land destroyed this way, its controller may search their library for a basic land card and put it onto the battlefield.
for (Map.Entry<UUID, Integer> entry : playerAmount.entrySet()) {
@ -91,7 +91,7 @@ class FromTheAshesEffect extends OneShotEffect {
entry.setValue(0); // no search no shuffling
}
}
game.getState().processAction(game);
game.processAction();
// Then each player who searched their library this way shuffles.
for (Map.Entry<UUID, Integer> entry : playerAmount.entrySet()) {

View file

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

View file

@ -167,7 +167,7 @@ class GaladrielElvenQueenEffect extends OneShotEffect {
game.temptWithTheRing(controller.getId());
// make sure the new ringbearer has been chosen.
game.getState().processAction(game);
game.processAction();
controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
@ -186,4 +186,4 @@ class GaladrielElvenQueenEffect extends OneShotEffect {
return true;
}
}
}
}

View file

@ -77,7 +77,7 @@ class GhastlyConscriptionEffect extends OneShotEffect {
}
Collections.shuffle(cardsToManifest);
game.informPlayers(controller.getLogName() + " shuffles the face-down pile");
game.getState().processAction(game);
game.processAction();
ManifestEffect.doManifestCards(game, source, controller, new LinkedHashSet<>(cardsToManifest));
return true;
}

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.getState().processAction(game);
game.processAction();
if (permanent.isPlaneswalker(game) && permanent.hasSubtype(SubType.GIDEON, game)) {
controller.gainLife(5, game, source);
}

View file

@ -96,7 +96,7 @@ class GilraenDunedainProtectorEffect extends OneShotEffect {
// Exile another target creature you control.
permanent.moveToExile(source.getSourceId(), sourcePermanent.getName(), source, game);
game.getState().processAction(game);
game.processAction();
Card card = game.getExile().getCard(permanent.getId(), game);
boolean choice = controller.chooseUse(Outcome.Neutral, "Return that card to the battlefield now?", source, game);
@ -125,4 +125,4 @@ class GilraenDunedainProtectorEffect extends OneShotEffect {
return true;
}
}
}

View file

@ -96,11 +96,11 @@ class GlimpseTheImpossibleEffect extends OneShotEffect {
}
Cards cards = new CardsImpl(exileZone.getCards(game));
controller.moveCards(cards, Zone.GRAVEYARD, source, game);
game.getState().processAction(game);
game.processAction();
cards.retainZone(Zone.GRAVEYARD, game);
new CreateTokenEffect(new EldraziSpawnToken(), cards.size())
.apply(game, source);
return true;
}
}
}

View file

@ -97,7 +97,7 @@ class GlyphOfReincarnationEffect extends OneShotEffect {
}
}
}
game.getState().processAction(game);
game.processAction();
// For each creature that died this way, put a creature card from the graveyard of the player who controlled that creature the last time it became blocked by that Wall
// onto the battlefield under its owners control
for (Map.Entry<UUID, Player> entry : destroyed.entrySet()) {

View file

@ -75,7 +75,7 @@ class GorgingVultureEffect extends OneShotEffect {
.mapToInt(card -> game.getState().getZone(card.getId()) == Zone.GRAVEYARD ? 1 : 0)
.sum();
if (lifeToGain > 0) {
game.getState().processAction(game);
game.processAction();
player.gainLife(lifeToGain, game, source);
}
return true;

View file

@ -87,7 +87,7 @@ class GraveyardTrespasserEffect extends OneShotEffect {
if (amount < 1) {
return true;
}
game.getState().processAction(game);
game.processAction();
player.gainLife(amount, game, source);
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
Player opponent = game.getPlayer(opponentId);

View file

@ -65,7 +65,7 @@ class HammerHelperEffect extends OneShotEffect {
if (controller != null && targetCreature != null) {
source.getEffects().get(0).setTargetPointer(new FixedTarget(targetCreature.getId(), game));
game.addEffect(new GainControlTargetEffect(Duration.EndOfTurn), source);
game.getState().processAction(game);
game.processAction();
targetCreature.untap(game);
int amount = controller.rollDice(outcome, source, game, 6);
game.addEffect(new BoostTargetEffect(amount, 0, Duration.EndOfTurn), source);

View file

@ -74,7 +74,7 @@ class HeartlessConscriptionEffect extends OneShotEffect {
cards.getCards(game), source, game, true,
CardUtil.getExileZoneId(game, source), CardUtil.getSourceName(game, source)
);
game.getState().processAction(game);
game.processAction();
cards.retainZone(Zone.EXILED, game);
for (Card card : cards.getCards(game)) {
CardUtil.makeCardPlayable(game, source, card, false, Duration.EndOfGame, true);
@ -82,4 +82,4 @@ class HeartlessConscriptionEffect extends OneShotEffect {
return true;
}
}
}

View file

@ -93,7 +93,7 @@ class HeraldOfLeshracCumulativeCost extends CostImpl {
ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfGame);
effect.setTargetPointer(new FixedTarget(target.getFirstTarget(), game));
game.addEffect(effect, ability);
game.getState().processAction(game);
game.processAction();
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.getState().processAction(game);
game.processAction();
Player targetController = game.getPlayer(targetCreature.getControllerId());
if (targetController != null) {
targetController.revealCards(sourceObject.getIdName(), targetController.getHand(), game);

View file

@ -75,7 +75,7 @@ class HourOfNeedExileEffect extends OneShotEffect {
if (tokenCounts.values().stream().noneMatch(i -> (i > 0))) {
return false;
}
game.getState().processAction(game);
game.processAction();
Token token = new HourOfNeedSphinxToken();
for (Map.Entry<UUID, Integer> playerTokenCount : tokenCounts.entrySet()) {
token.putOntoBattlefield(playerTokenCount.getValue(), game, source, playerTokenCount.getKey());

View file

@ -125,7 +125,7 @@ class IndominusRexAlphaCountersEffect extends OneShotEffect {
controller.discard(new CardsImpl(target.getTargets()), false, source, game);
//allow cards to move to graveyard before checking for abilities
game.getState().processAction(game);
game.processAction();
// the basic event is the EntersBattlefieldEvent, so use already applied replacement effects from that event
List<UUID> appliedEffects = (ArrayList<UUID>) this.getValue("appliedEffects");

View file

@ -93,7 +93,7 @@ class JeskaiInfiltratorEffect extends OneShotEffect {
}
Collections.shuffle(cardsToManifest);
game.informPlayers(controller.getLogName() + " shuffles the face-down pile");
game.getState().processAction(game);
game.processAction();
ManifestEffect.doManifestCards(game, source, controller, new LinkedHashSet<>(cardsToManifest));
return true;
}

View file

@ -101,7 +101,7 @@ class JodahTheUnifierEffect extends OneShotEffect {
for (Card card : controller.getLibrary().getCards(game)) {
exiledCards.add(card);
controller.moveCards(card, Zone.EXILED, source, game);
game.getState().processAction(game);
game.processAction();
if (card.isLegendary(game) && !card.isLand(game) && card.getManaValue() < manaValue) {
CardUtil.castSpellWithAttributesForFree(controller, source, game, card);
break;

View file

@ -93,7 +93,7 @@ class JonIrenicusShatteredOneEffect extends OneShotEffect {
ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfGame, opponent.getId());
effect.setTargetPointer(new FixedTarget(creature, game));
game.addEffect(effect, source);
game.getState().processAction(game);
game.processAction();
creature.addCounters(CounterType.P1P1.createInstance(2), source.getControllerId(), source, game);
creature.tap(source, game);
game.addEffect(new GoadTargetEffect()

View file

@ -63,7 +63,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, game, false)) {
game.getState().processAction(game);
game.processAction();
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

@ -91,7 +91,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.getState().processAction(game);
game.processAction();
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,8 +70,8 @@ class KrenkoTinStreetKingpinEffect extends OneShotEffect {
return false;
}
new AddCountersSourceEffect(CounterType.P1P1.createInstance()).apply(game, source);
game.getState().processAction(game);
game.processAction();
int xValue = permanent.getPower().getValue();
return new CreateTokenEffect(new GoblinToken(), xValue).apply(game, source);
}
}
}

View file

@ -74,7 +74,7 @@ class LaezelsAcrobaticsEffect extends RollDieWithResultTableEffect {
}
Cards toFlicker = new CardsImpl(game.getBattlefield().getActivePermanents(creatureFilter, controller.getId(), game));
controller.moveCards(toFlicker, Zone.EXILED, source, game);
game.getState().processAction(game);
game.processAction();
int result = controller.rollDice(outcome, source, game, 20);
if (result >= 1 && result <= 9) {
Effect effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, false);
@ -87,7 +87,7 @@ class LaezelsAcrobaticsEffect extends RollDieWithResultTableEffect {
PutCards.BATTLEFIELD.moveCard(game.getPlayer(card.getOwnerId()), card.getMainCard(), source, game, "card");
}
}
game.getState().processAction(game);
game.processAction();
Effect effect = new ExileReturnBattlefieldNextEndStepTargetEffect();
effect.setTargetPointer(new FixedTargets(toFlicker, game));
effect.apply(game, source);

View file

@ -66,7 +66,7 @@ class LiberatedLivestockEffect extends OneShotEffect {
}
List<Token> tokens = Arrays.asList(new CatToken2(), new BirdToken(), new OxToken());
tokens.forEach(token -> token.putOntoBattlefield(1, game, source, source.getControllerId()));
game.getState().processAction(game);
game.processAction();
for (Token token : tokens) {
for (UUID tokenId : token.getLastAddedTokenIds()) {

View file

@ -106,7 +106,7 @@ class LichKnightsConquestEffect extends OneShotEffect {
new SacrificeTargetEffect()
.setTargetPointer(new FixedTargets(toSacrifice, game))
.apply(game, source);
game.getState().processAction(game);
game.processAction();
int cardsToMove = Math.min(
sacrificeCount,

View file

@ -69,7 +69,7 @@ class LichsMirrorEffect extends ReplacementEffectImpl {
toLib.add(permanent);
}
player.shuffleCardsToLibrary(toLib, game, source);
game.getState().processAction(game);
game.processAction();
player.drawCards(7, source, game); // original event is not a draw event, so skip it in params
player.setLife(20, game, source);
}

View file

@ -84,7 +84,7 @@ class LiegeOfTheHollowsEffect extends OneShotEffect {
token.putOntoBattlefield(entry.getValue(), game, source, player.getId());
}
}
game.getState().processAction(game);
game.processAction();
// prevent undo
controller.resetStoredBookmark(game);

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, game, true);
game.getState().processAction(game);
game.processAction();
if (permanent.isPlaneswalker(game) && permanent.hasSubtype(SubType.LILIANA, game)) {
Player permanentController = game.getPlayer(permanent.getControllerId());
if (permanentController != null) {

View file

@ -75,7 +75,7 @@ class LilianasIndignationEffect extends OneShotEffect {
if (creatures > 0) {
Player targetPlayer = game.getPlayer(source.getFirstTarget());
if (targetPlayer != null) {
game.getState().processAction(game);
game.processAction();
targetPlayer.loseLife(creatures, game, source, false);
}
}

View file

@ -78,7 +78,7 @@ class MalanthropeEffect extends OneShotEffect {
player.moveCards(player.getGraveyard(), Zone.EXILED, source, game);
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
if (permanent != null && count > 0) {
game.getState().processAction(game);
game.processAction();
permanent.addCounters(CounterType.P1P1.createInstance(count), source, game);
}
return true;

View file

@ -66,7 +66,7 @@ class MarchOfSoulsEffect extends OneShotEffect {
playersWithCreatures.put(controllerId, playersWithCreatures.getOrDefault(controllerId, 0) + 1);
}
}
game.getState().processAction(game);
game.processAction();
SpiritWhiteToken token = new SpiritWhiteToken();
for (Map.Entry<UUID, Integer> destroyedCreaturePerPlayer : playersWithCreatures.entrySet()) {
token.putOntoBattlefield(destroyedCreaturePerPlayer.getValue(), game, source, destroyedCreaturePerPlayer.getKey());

View file

@ -87,7 +87,7 @@ class MartyrsCryEffect extends OneShotEffect {
Integer::sum
));
controller.moveCards(new CardsImpl(permanents), Zone.EXILED, source, game);
game.getState().processAction(game);
game.processAction();
for (Map.Entry<UUID, Integer> entry : playerMap.entrySet()) {
Player player = game.getPlayer(entry.getKey());
if (player == null) {

View file

@ -113,7 +113,7 @@ class MasterOfCeremoniesChoiceEffect extends OneShotEffect {
Token treasureOpponent = new TreasureToken();
treasureOpponent.putOntoBattlefield(1, game, source, opponentId);
}
game.getState().processAction(game);
game.processAction();
// Friends - You and that player each create a 1/1 green and white Citizen creature token.
for (UUID opponentId : friendChoosers) {
@ -123,7 +123,7 @@ class MasterOfCeremoniesChoiceEffect extends OneShotEffect {
Token citizenOpponent = new CitizenGreenWhiteToken();
citizenOpponent.putOntoBattlefield(1, game, source, opponentId);
}
game.getState().processAction(game);
game.processAction();
// Secrets - You and that player each draw a card.
for (UUID opponentId : secretsChoosers) {

View file

@ -75,7 +75,7 @@ class MayaelsAriaEffect extends OneShotEffect {
creature.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game);
}
}
game.getState().processAction(game); // needed because otehrwise the +1/+1 counters wouldn't be taken into account
game.processAction(); // 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

@ -67,7 +67,7 @@ class MidnightRitualEffect extends OneShotEffect {
Cards cardsToExile = new CardsImpl(getTargetPointer().getTargets(game, source));
controller.moveCards(cardsToExile, Zone.EXILED, source, game);
if (!cardsToExile.isEmpty()) {
game.getState().processAction(game);
game.processAction();
new ZombieToken().putOntoBattlefield(cardsToExile.size(), game, source, controller.getId());
}
return true;

View file

@ -79,7 +79,7 @@ class MoggInfestationEffect extends OneShotEffect {
if (creaturesDied.isEmpty()) {
return true;
}
game.getState().processAction(game); // Bug #8548
game.processAction(); // Bug #8548
for (UUID uuid : creaturesDied) {
if (game.getState().getZone(uuid) == Zone.GRAVEYARD
|| (game.getLastKnownInformation(uuid, Zone.BATTLEFIELD) instanceof PermanentToken

View file

@ -72,7 +72,7 @@ class MoltenPsycheEffect extends OneShotEffect {
}
}
game.getState().processAction(game); // so effects from creatures that were on the battlefield won't trigger from draw action
game.processAction(); // 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

@ -116,7 +116,7 @@ class NecromentiaEffect extends OneShotEffect {
targetPlayer.shuffleLibrary(source, game);
if (numberOfCardsExiledFromHand > 0) {
game.getState().processAction(game);
game.processAction();
Token zombieToken = new ZombieToken();
zombieToken.putOntoBattlefield(numberOfCardsExiledFromHand, game, source, targetPlayer.getId());
}

View file

@ -81,7 +81,7 @@ class NecronMonolithEffect extends OneShotEffect {
.millCards(3, source, game)
.count(StaticFilters.FILTER_CARD_CREATURE, game);
if (count > 0) {
game.getState().processAction(game);
game.processAction();
new NecronWarriorToken().putOntoBattlefield(count, game, source);
}
return true;

View file

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

View file

@ -92,7 +92,7 @@ class OlorinsSearingLightEffect extends OneShotEffect {
}
}
if (SpellMasteryCondition.instance.apply(game, source)){
game.getState().processAction(game);
game.processAction();
for (Map.Entry<Player, Integer> entry : damageList) {
entry.getKey().damage(entry.getValue(), source, game);
}

View file

@ -89,10 +89,10 @@ class OnceAndFutureEffect extends OneShotEffect {
player.moveCards(cards, Zone.HAND, source, game);
} else {
player.moveCards(card1, Zone.HAND, source, game);
game.getState().processAction(game);
game.processAction();
player.putCardsOnTopOfLibrary(card2, game, source, true);
}
game.getState().processAction(game);
game.processAction();
return new ExileSpellEffect().apply(game, source);
}

View file

@ -82,7 +82,7 @@ class OutOfTimePhaseOutEffect extends OneShotEffect {
Permanent outOfTime = game.getPermanent(source.getSourceId());
if (outOfTime != null) {
new PhaseOutAllEffect(new ArrayList<>(creatureIds)).apply(game, source);
game.getState().processAction(game);
game.processAction();
new AddCountersSourceEffect(CounterType.TIME.createInstance(numCreatures)).apply(game, source);
game.getState().setValue("phasedOutCreatures"
+ source.getId().toString(), creatureIds);

View file

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

View file

@ -66,7 +66,7 @@ class OverwhelmingForcesEffect extends OneShotEffect {
}
}
if (destroyedCreature > 0) {
game.getState().processAction(game);
game.processAction();
new DrawCardSourceControllerEffect(destroyedCreature).apply(game, source);
}
return true;

View file

@ -98,7 +98,7 @@ class PartyThrasherEffect extends OneShotEffect {
return false;
}
controller.moveCardsToExile(cards.getCards(game), source, game, true, null, "");
game.getState().processAction(game);
game.processAction();
cards.retainZone(Zone.EXILED, game);
if (cards.isEmpty()) {
return true;
@ -122,4 +122,4 @@ class PartyThrasherEffect extends OneShotEffect {
return true;
}
}
}

View file

@ -107,7 +107,7 @@ class PhabineBosssConfidantParleyEffect extends OneShotEffect {
if (landCount > 0) {
Token citizenToken = new CitizenGreenWhiteToken();
citizenToken.putOntoBattlefield(landCount, game, source, source.getControllerId(), false, false);
game.getState().processAction(game);
game.processAction();
}
if (nonLandCount > 0) {

View file

@ -97,7 +97,7 @@ class PheliaExuberantShepherdEffect extends OneShotEffect {
}
Set<Card> cards = exileZone.getCards(game);
player.moveCards(cards, Zone.BATTLEFIELD, source, game, false, false, true, null);
game.getState().processAction(game);
game.processAction();
Permanent phelia = source.getSourcePermanentIfItStillExists(game);
if (phelia == null) {

View file

@ -70,7 +70,7 @@ class PresumedDeadEffect extends OneShotEffect {
return false;
}
controller.moveCards(card, Zone.BATTLEFIELD, source, game, false, false, true, null);
game.getState().processAction(game);
game.processAction();
Permanent permanent = game.getPermanent(card.getId());
if (permanent != null) {
permanent.setSuspected(true, game, source);

View file

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

View file

@ -69,7 +69,7 @@ class PureReflectionEffect extends OneShotEffect {
filter.add(SubType.REFLECTION.getPredicate());
game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)
.forEach(permanent -> permanent.destroy(source, game,false));
game.getState().processAction(game);
game.processAction();
// 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.getManaValue());

View file

@ -66,7 +66,7 @@ class RainOfDaggersEffect extends OneShotEffect {
}
}
if (destroyedCreature > 0) {
game.getState().processAction(game);
game.processAction();
new LoseLifeSourceControllerEffect(destroyedCreature * 2).apply(game, source);
}
return true;

View file

@ -68,7 +68,7 @@ class RampageOfTheClansEffect extends OneShotEffect {
playersWithPermanents.put(controllerId, playersWithPermanents.getOrDefault(controllerId, 0) + 1);
}
}
game.getState().processAction(game);
game.processAction();
Token token = new CentaurToken();
for (Map.Entry<UUID, Integer> amountDestroyedByPlayer : playersWithPermanents.entrySet()) {
token.putOntoBattlefield(amountDestroyedByPlayer.getValue(), game, source, amountDestroyedByPlayer.getKey());

View file

@ -76,7 +76,7 @@ class RareBGoneEffect extends OneShotEffect {
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filterPermanent, playerId, game)) {
permanent.sacrifice(source, game);
}
game.getState().processAction(game);
game.processAction();
Cards cards = player.getHand();
player.revealCards(source, cards, game);
player.discard(new CardsImpl(cards.getCards(filterCard, game)), false, source, game);

View file

@ -78,7 +78,7 @@ class RedSunsTwilightEffect extends OneShotEffect {
Permanent permanent = game.getPermanent(targetID);
if (permanent != null) {
if (permanent.destroy(source, game, false)) {
game.getState().processAction(game);
game.processAction();
// Note which were destroyed
destroyedArtifacts.add(permanent);
}

Some files were not shown because too many files have changed in this diff Show more