use of mage.game.permanent.token.ElephantToken in project mage by magefree.
the class TerastodonEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Map<UUID, Integer> destroyedPermanents = new HashMap<>();
for (UUID targetID : this.targetPointer.getTargets(game, source)) {
Permanent permanent = game.getPermanent(targetID);
if (permanent != null) {
if (permanent.destroy(source, game, false)) {
if (game.getState().getZone(permanent.getId()) == Zone.GRAVEYARD) {
int numberPermanents = destroyedPermanents.getOrDefault(permanent.getControllerId(), 0);
destroyedPermanents.put(permanent.getControllerId(), numberPermanents + 1);
}
}
}
}
game.getState().processAction(game);
ElephantToken elephantToken = new ElephantToken();
for (Entry<UUID, Integer> entry : destroyedPermanents.entrySet()) {
elephantToken.putOntoBattlefield(entry.getValue(), game, source, entry.getKey());
}
return true;
}
use of mage.game.permanent.token.ElephantToken in project mage by magefree.
the class GenerousGiftEffect 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());
permanent.destroy(source, game, false);
if (player == null) {
return false;
}
Effect effect = new CreateTokenTargetEffect(new ElephantToken());
effect.setTargetPointer(new FixedTarget(player.getId(), game));
return effect.apply(game, source);
}
Aggregations