mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
[ZNR] updated implementation of Skyclave Apparition
This commit is contained in:
parent
d8059b6e74
commit
9ed81725ac
1 changed files with 15 additions and 9 deletions
|
@ -1,6 +1,7 @@
|
||||||
package mage.cards.s;
|
package mage.cards.s;
|
||||||
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.common.LeavesBattlefieldTriggeredAbility;
|
import mage.abilities.common.LeavesBattlefieldTriggeredAbility;
|
||||||
|
@ -21,8 +22,9 @@ import mage.game.permanent.token.CustomIllusionToken;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
import mage.util.CardUtil;
|
import mage.util.CardUtil;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -99,13 +101,17 @@ class SkyclaveApparitionEffect extends OneShotEffect {
|
||||||
// that player creates a token with power and toughness equal to the sum of those cards' converted mana costs.
|
// that player creates a token with power and toughness equal to the sum of those cards' converted mana costs.
|
||||||
// If the first ability exiled cards owned by more than one player, each of those players creates a token
|
// If the first ability exiled cards owned by more than one player, each of those players creates a token
|
||||||
// with power and toughness equal to the sum of the converted mana costs of all cards exiled by the first ability.
|
// with power and toughness equal to the sum of the converted mana costs of all cards exiled by the first ability.
|
||||||
Map<UUID, Integer> map = new HashMap<>();
|
Set<UUID> owners = new HashSet<>();
|
||||||
exile.getCards(game).stream().forEach(card -> map.compute(
|
int totalCMC = exile
|
||||||
card.getOwnerId(), (u, i) -> i == null ? card.getConvertedManaCost() : Integer.sum(card.getConvertedManaCost(), i)
|
.getCards(game)
|
||||||
));
|
.stream()
|
||||||
for (Map.Entry<UUID, Integer> entry : map.entrySet()) {
|
.filter(Objects::nonNull)
|
||||||
new CustomIllusionToken(entry.getValue()).putOntoBattlefield(
|
.map(card -> owners.add(card.getOwnerId()) ? card : card)
|
||||||
1, game, source.getSourceId(), entry.getKey()
|
.mapToInt(MageObject::getConvertedManaCost)
|
||||||
|
.sum();
|
||||||
|
for (UUID playerId : owners) {
|
||||||
|
new CustomIllusionToken(totalCMC).putOntoBattlefield(
|
||||||
|
1, game, source.getSourceId(), playerId
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue