Search in sources :

Example 1 with SalamnderWarriorToken

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;
}
Also used : HashMap(java.util.HashMap) SalamnderWarriorToken(mage.game.permanent.token.SalamnderWarriorToken) Objects(java.util.Objects) Token(mage.game.permanent.token.Token) SalamnderWarriorToken(mage.game.permanent.token.SalamnderWarriorToken) UUID(java.util.UUID) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with SalamnderWarriorToken

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;
}
Also used : Player(mage.players.Player) FilterPermanent(mage.filter.FilterPermanent) Permanent(mage.game.permanent.Permanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) TargetPermanent(mage.target.TargetPermanent) SalamnderWarriorToken(mage.game.permanent.token.SalamnderWarriorToken)

Aggregations

SalamnderWarriorToken (mage.game.permanent.token.SalamnderWarriorToken)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Objects (java.util.Objects)1 UUID (java.util.UUID)1 FilterPermanent (mage.filter.FilterPermanent)1 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)1 Permanent (mage.game.permanent.Permanent)1 Token (mage.game.permanent.token.Token)1 Player (mage.players.Player)1 TargetPermanent (mage.target.TargetPermanent)1