mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
[GTC] small rework of Luminate Primordial (#8798)
This commit is contained in:
parent
254ed6a94e
commit
defc1a40b7
1 changed files with 11 additions and 6 deletions
|
@ -13,6 +13,7 @@ import mage.constants.SubType;
|
|||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.game.Controllable;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
@ -98,19 +99,23 @@ class LuminatePrimordialEffect extends OneShotEffect {
|
|||
Set<Permanent> permanents = source
|
||||
.getTargets()
|
||||
.stream()
|
||||
.map(Target::getFirstTarget)
|
||||
.map(Target::getTargets)
|
||||
.flatMap(Collection::stream)
|
||||
.map(game::getPermanent)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
Map<UUID, Integer> map = new HashMap<>();
|
||||
permanents.stream().map(p -> map.put(p.getControllerId(), p.getPower().getValue()));
|
||||
Map<UUID, Integer> map = permanents
|
||||
.stream()
|
||||
.collect(Collectors.toMap(
|
||||
Controllable::getControllerId,
|
||||
permanent -> permanent.getPower().getValue()
|
||||
));
|
||||
controller.moveCards(permanents, Zone.EXILED, source, game);
|
||||
for (Map.Entry<UUID, Integer> entry : map.entrySet()) {
|
||||
Player player = game.getPlayer(entry.getKey());
|
||||
if (player == null || entry.getValue() < 1) {
|
||||
continue;
|
||||
if (player != null && entry.getValue() > 0) {
|
||||
player.gainLife(entry.getValue(), game, source);
|
||||
}
|
||||
player.gainLife(entry.getValue(), game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue