Refactor Past In Flames
@@ -95,12 +95,9 @@ class PastInFlamesEffect extends ContinuousEffectImpl {
if (this.affectedObjectsSet) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
- for (UUID cardId: player.getGraveyard()) {
- Card card = game.getCard(cardId);
- if (card.isInstant() || card.isSorcery()) {
+ player.getGraveyard().stream().map((cardId) -> game.getCard(cardId)).filter((card) -> (card.isInstant() || card.isSorcery())).forEachOrdered((card) -> {
affectedObjectList.add(new MageObjectReference(card, game));
- }
- }
+ });
}
}
}
@@ -109,8 +106,7 @@ class PastInFlamesEffect extends ContinuousEffectImpl {
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
- for (UUID cardId: player.getGraveyard()) {
- if (affectedObjectList.contains(new MageObjectReference(cardId, game))) {
+ player.getGraveyard().stream().filter((cardId) -> (affectedObjectList.contains(new MageObjectReference(cardId, game)))).forEachOrdered((cardId) -> {
Card card = game.getCard(cardId);
FlashbackAbility ability = null;
if (card.isInstant()) {
@@ -124,8 +120,7 @@ class PastInFlamesEffect extends ContinuousEffectImpl {
ability.setControllerId(card.getOwnerId());
game.getState().addOtherAbility(card, ability);
}
- }
- }
+ });
return true;
}
return false;
