use of mage.game.permanent.token.SaprolingBurstToken in project mage by magefree.
the class SaprolingBurstDestroyEffect method apply.
@Override
@SuppressWarnings("unchecked")
public boolean apply(Game game, Ability source) {
Token token = new SaprolingBurstToken(new MageObjectReference(source.getSourceObject(game), game));
token.putOntoBattlefield(1, game, source, source.getControllerId());
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
Object object = game.getState().getValue(CardUtil.getCardZoneString("_tokensCreated", source.getSourceId(), game));
Set<UUID> tokensCreated;
if (object != null) {
tokensCreated = (Set<UUID>) object;
} else {
tokensCreated = new HashSet<>();
}
for (UUID tokenId : token.getLastAddedTokenIds()) {
tokensCreated.add(tokenId);
}
game.getState().setValue(CardUtil.getCardZoneString("_tokensCreated", source.getSourceId(), game), tokensCreated);
}
return true;
}
Aggregations