use of mage.game.permanent.token.Token in project mage by magefree.
the class DivineVisitationEffect method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
if (event instanceof CreateTokenEvent) {
int amount = 0;
CreateTokenEvent tokenEvent = (CreateTokenEvent) event;
Iterator<Map.Entry<Token, Integer>> it = tokenEvent.getTokens().entrySet().iterator();
while (it.hasNext()) {
Map.Entry<Token, Integer> entry = it.next();
if (entry.getKey().isCreature(game)) {
amount += entry.getValue();
it.remove();
}
}
if (amount > 0) {
tokenEvent.getTokens().put(new AngelVigilanceToken(), amount);
}
}
return false;
}
use of mage.game.permanent.token.Token in project mage by magefree.
the class EiganjoUprisingEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
int amount = source.getManaCostsToPay().getX();
if (amount < 1) {
return false;
}
Token token = new SamuraiToken();
token.putOntoBattlefield(amount, game, source);
game.addEffect(new GainAbilityTargetEffect(new MenaceAbility(false)).setTargetPointer(new FixedTargets(token, game)), source);
game.addEffect(new GainAbilityTargetEffect(HasteAbility.getInstance()).setTargetPointer(new FixedTargets(token, game)), source);
if (amount < 2) {
return true;
}
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
token.putOntoBattlefield(amount - 1, game, source, opponentId);
}
return true;
}
use of mage.game.permanent.token.Token in project mage by magefree.
the class SpyMasterGoblinCreateTokenEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(game.getActivePlayerId());
if (player != null) {
Token token = new SpyMasterGoblinToken();
token.putOntoBattlefield(1, game, source, player.getId());
}
return true;
}
use of mage.game.permanent.token.Token in project mage by magefree.
the class PurphorossInterventionEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Token token = new PurphorossInterventionToken(source.getManaCostsToPay().getX());
token.putOntoBattlefield(1, game, source, source.getControllerId());
token.getLastAddedTokenIds().stream().forEach(uuid -> game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new SacrificeTargetEffect().setText("sacrifice this creature").setTargetPointer(new FixedTarget(uuid, game))), source));
return true;
}
use of mage.game.permanent.token.Token in project mage by magefree.
the class RebellionOfTheFlamekinEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Token token = new ElementalShamanToken("LRW");
token.putOntoBattlefield(1, game, source, source.getControllerId());
List<Permanent> permanents = token.getLastAddedTokenIds().stream().map(game::getPermanent).filter(Objects::nonNull).collect(Collectors.toList());
if (!permanents.isEmpty() && (boolean) this.getValue("clash")) {
game.addEffect(new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn).setTargetPointer(new FixedTargets(permanents, game)), source);
}
return true;
}
Aggregations