use of mage.game.permanent.token.BearToken in project mage by magefree.
the class PathToTheWorldTreeEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
controller.gainLife(2, game, source);
controller.drawCards(2, source, game);
}
for (UUID targetId : source.getTargets().stream().map(Target::getTargets).flatMap(Collection::stream).collect(Collectors.toList())) {
Player player = game.getPlayer(targetId);
if (player != null) {
player.loseLife(2, game, source, false);
}
Permanent permanent = game.getPermanent(targetId);
if (permanent != null) {
permanent.damage(2, source.getSourceId(), source, game);
}
}
new BearToken().putOntoBattlefield(1, game, source, source.getControllerId());
return true;
}
use of mage.game.permanent.token.BearToken in project mage by magefree.
the class KamahlsSummonsEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null && sourceObject != null) {
Map<UUID, Integer> revealedCards = new HashMap<>();
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
if (player.getHand().count(StaticFilters.FILTER_CARD_CREATURE, game) > 0) {
TargetCardInHand target = new TargetCardInHand(0, Integer.MAX_VALUE, StaticFilters.FILTER_CARD_CREATURE);
if (player.choose(outcome, target, source.getSourceId(), game)) {
Cards cards = new CardsImpl(target.getTargets());
controller.revealCards(sourceObject.getIdName(), cards, game);
revealedCards.put(playerId, target.getTargets().size());
}
}
}
}
Token token = new BearToken();
for (Map.Entry<UUID, Integer> revealedCardsByPlayer : revealedCards.entrySet()) {
int value = revealedCardsByPlayer.getValue();
if (value > 0) {
token.putOntoBattlefield(value, game, source, revealedCardsByPlayer.getKey());
}
}
return true;
}
return false;
}
use of mage.game.permanent.token.BearToken in project mage by magefree.
the class WordsOfWildingEffect method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
new CreateTokenEffect(new BearToken()).apply(game, source);
discard();
return true;
}
return false;
}
Aggregations