mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
- Refactor Past In Flames
This commit is contained in:
parent
ce1ff40ca0
commit
44e85ca351
1 changed files with 17 additions and 22 deletions
|
@ -95,12 +95,9 @@ class PastInFlamesEffect extends ContinuousEffectImpl {
|
||||||
if (this.affectedObjectsSet) {
|
if (this.affectedObjectsSet) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
for (UUID cardId: player.getGraveyard()) {
|
player.getGraveyard().stream().map((cardId) -> game.getCard(cardId)).filter((card) -> (card.isInstant() || card.isSorcery())).forEachOrdered((card) -> {
|
||||||
Card card = game.getCard(cardId);
|
affectedObjectList.add(new MageObjectReference(card, game));
|
||||||
if (card.isInstant() || card.isSorcery()) {
|
});
|
||||||
affectedObjectList.add(new MageObjectReference(card, game));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,23 +106,21 @@ class PastInFlamesEffect extends ContinuousEffectImpl {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
for (UUID cardId: player.getGraveyard()) {
|
player.getGraveyard().stream().filter((cardId) -> (affectedObjectList.contains(new MageObjectReference(cardId, game)))).forEachOrdered((cardId) -> {
|
||||||
if (affectedObjectList.contains(new MageObjectReference(cardId, game))) {
|
Card card = game.getCard(cardId);
|
||||||
Card card = game.getCard(cardId);
|
FlashbackAbility ability = null;
|
||||||
FlashbackAbility ability = null;
|
if (card.isInstant()) {
|
||||||
if (card.isInstant()) {
|
ability = new FlashbackAbility(card.getManaCost(), TimingRule.INSTANT);
|
||||||
ability = new FlashbackAbility(card.getManaCost(), TimingRule.INSTANT);
|
|
||||||
}
|
|
||||||
else if (card.isSorcery()) {
|
|
||||||
ability = new FlashbackAbility(card.getManaCost(), TimingRule.SORCERY);
|
|
||||||
}
|
|
||||||
if (ability != null) {
|
|
||||||
ability.setSourceId(cardId);
|
|
||||||
ability.setControllerId(card.getOwnerId());
|
|
||||||
game.getState().addOtherAbility(card, ability);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
else if (card.isSorcery()) {
|
||||||
|
ability = new FlashbackAbility(card.getManaCost(), TimingRule.SORCERY);
|
||||||
|
}
|
||||||
|
if (ability != null) {
|
||||||
|
ability.setSourceId(cardId);
|
||||||
|
ability.setControllerId(card.getOwnerId());
|
||||||
|
game.getState().addOtherAbility(card, ability);
|
||||||
|
}
|
||||||
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue