forked from External/mage
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:
parent
e2b1d980b6
commit
d61de05eb8
163 changed files with 218 additions and 217 deletions
|
|
@ -248,7 +248,7 @@ public abstract class AbilityImpl implements Ability {
|
|||
* abilities with replacement effects deactivated too late Example:
|
||||
* {@link org.mage.test.cards.replacement.DryadMilitantTest#testDiesByDestroy testDiesByDestroy}
|
||||
*/
|
||||
game.getState().processAction(game);
|
||||
game.processAction();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ class AnimateDeadPutOntoBattlefieldEffect extends OneShotEffect {
|
|||
}
|
||||
// Put card onto the battlefield under your control...
|
||||
player.moveCards(card, Zone.BATTLEFIELD, source, game, tapped, false, false, null);
|
||||
game.getState().processAction(game);
|
||||
game.processAction();
|
||||
|
||||
Permanent creature = game.getPermanent(CardUtil.getDefaultCardSideForBattlefield(game, card).getId());
|
||||
if (creature == null) {
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ public class DevourEffect extends ReplacementEffectImpl {
|
|||
+ filterDevoured.getMessage() + (devouredCreatures > 1 ? "s" : "")
|
||||
);
|
||||
|
||||
game.getState().processAction(game); // need for multistep effects
|
||||
game.processAction(); // need for multistep effects
|
||||
|
||||
int amountCounters;
|
||||
if (devourFactor == Integer.MAX_VALUE) {
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public class ExileThenReturnTargetEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
controller.moveCards(toFlicker, Zone.EXILED, source, game);
|
||||
game.getState().processAction(game);
|
||||
game.processAction();
|
||||
for (Card card : toFlicker) {
|
||||
putCards.moveCard(
|
||||
yourControl ? controller : game.getPlayer(card.getOwnerId()),
|
||||
|
|
|
|||
|
|
@ -47,14 +47,14 @@ public class LivingDeathEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
}
|
||||
game.getState().processAction(game);
|
||||
game.processAction();
|
||||
|
||||
// Sacrifice all creatures
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game)) {
|
||||
permanent.sacrifice(source, game);
|
||||
}
|
||||
|
||||
game.getState().processAction(game);
|
||||
game.processAction();
|
||||
|
||||
// Exiled cards are put onto the battlefield at the same time under their owner's control
|
||||
Set<Card> cardsToReturnFromExile = new HashSet<>();
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public class ShuffleHandIntoLibraryDrawThatManySourceEffect extends OneShotEffec
|
|||
if (cardsHand > 0) {
|
||||
controller.moveCards(controller.getHand(), Zone.LIBRARY, source, game);
|
||||
controller.shuffleLibrary(source, game);
|
||||
game.getState().processAction(game); // then
|
||||
game.processAction(); // then
|
||||
controller.drawCards(cardsHand, source, game);
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class GainControlAllUntapGainHasteEffect extends OneShotEffect {
|
|||
FilterPermanent affectedFilter = new FilterPermanent();
|
||||
affectedFilter.add(new PermanentReferenceInCollectionPredicate(affectedObjects, game));
|
||||
new GainControlAllEffect(Duration.EndOfTurn, affectedFilter).apply(game, source);
|
||||
game.getState().processAction(game);
|
||||
game.processAction();
|
||||
new UntapAllEffect(affectedFilter).apply(game, source);
|
||||
game.addEffect(new GainAbilityAllEffect(HasteAbility.getInstance(), Duration.EndOfTurn, affectedFilter), source);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ public class DiscoverEffect extends OneShotEffect {
|
|||
for (Card card : player.getLibrary().getCards(game)) {
|
||||
cards.add(card);
|
||||
player.moveCards(card, Zone.EXILED, source, game);
|
||||
game.getState().processAction(game);
|
||||
game.processAction();
|
||||
if (filter.match(card, game)) {
|
||||
return card;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ public class ExploreSourceEffect extends OneShotEffect {
|
|||
// the exploring creature receives a +1/+1 counter.
|
||||
addCounter(game, permanent, source);
|
||||
}
|
||||
game.getState().processAction(game);
|
||||
game.processAction();
|
||||
// 701.40b A permanent “explores” after the process described in rule 701.40a is complete, even if some or all of
|
||||
// those actions were impossible.
|
||||
game.fireEvent(new ExploredEvent(permanent, source, card));
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ class CascadeEffect extends OneShotEffect {
|
|||
cardsToExile.add(card);
|
||||
// the card move is sequential, not all at once.
|
||||
controller.moveCards(card, Zone.EXILED, source, game);
|
||||
game.getState().processAction(game); // Laelia, the Blade Reforged
|
||||
game.processAction(); // Laelia, the Blade Reforged
|
||||
if (!card.isLand(game)
|
||||
&& card.getManaValue() < sourceCost) {
|
||||
cardToCast = card;
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ class MadnessReplacementEffect extends ReplacementEffectImpl {
|
|||
}
|
||||
|
||||
// needed to add Madness ability to cards (e.g. by Falkenrath Gorger)
|
||||
game.getState().processAction(game);
|
||||
game.processAction();
|
||||
|
||||
GameEvent gameEvent = new MadnessCardExiledEvent(card.getId(), source, controller.getId());
|
||||
game.fireEvent(gameEvent);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue