use of mage.game.permanent.token.SalamnderWarriorToken in project mage by magefree.
the class GorMuldrakAmphinologistEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Map<UUID, Integer> creatureMap = new HashMap<>();
game.getState().getPlayersInRange(source.getControllerId(), game).stream().forEach(uuid -> creatureMap.put(uuid, 0));
game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game).stream().filter(Objects::nonNull).map(Controllable::getControllerId).forEach(uuid -> creatureMap.compute(uuid, CardUtil::setOrIncrementValue));
int minValue = creatureMap.values().stream().mapToInt(x -> x).min().orElse(0);
minValue = Math.max(minValue, 0);
Token token = new SalamnderWarriorToken();
for (Map.Entry<UUID, Integer> entry : creatureMap.entrySet()) {
if (entry.getValue() > minValue) {
continue;
}
token.putOntoBattlefield(1, game, source, entry.getKey());
}
return true;
}
use of mage.game.permanent.token.SalamnderWarriorToken in project mage by magefree.
the class AmphinMutineerEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent == null) {
return false;
}
Player player = game.getPlayer(permanent.getControllerId());
if (player == null) {
return false;
}
player.moveCards(permanent, Zone.EXILED, source, game);
new SalamnderWarriorToken().putOntoBattlefield(1, game, source, player.getId());
return true;
}
Aggregations