Search in sources :

Example 1 with CentaurToken

use of mage.game.permanent.token.CentaurToken in project mage by magefree.

the class RampageOfTheClansEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Map<UUID, Integer> playersWithPermanents = new HashMap<>();
    for (Permanent p : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_ARTIFACT_OR_ENCHANTMENT, source.getControllerId(), source.getSourceId(), game)) {
        UUID controllerId = p.getControllerId();
        if (p.destroy(source, game, false)) {
            playersWithPermanents.put(controllerId, playersWithPermanents.getOrDefault(controllerId, 0) + 1);
        }
    }
    Token token = new CentaurToken();
    for (Map.Entry<UUID, Integer> amountDestroyedByPlayer : playersWithPermanents.entrySet()) {
        token.putOntoBattlefield(amountDestroyedByPlayer.getValue(), game, source, amountDestroyedByPlayer.getKey());
    }
    return true;
}
Also used : CentaurToken(mage.game.permanent.token.CentaurToken) Permanent(mage.game.permanent.Permanent) HashMap(java.util.HashMap) CentaurToken(mage.game.permanent.token.CentaurToken) Token(mage.game.permanent.token.Token) UUID(java.util.UUID) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

HashMap (java.util.HashMap)1 Map (java.util.Map)1 UUID (java.util.UUID)1 Permanent (mage.game.permanent.Permanent)1 CentaurToken (mage.game.permanent.token.CentaurToken)1 Token (mage.game.permanent.token.Token)1