Search in sources :

Example 66 with Token

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

the class AcademyManufactorEffect method replaceEvent.

@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
    int amount = 0;
    Map<Token, Integer> tokens = ((CreateTokenEvent) event).getTokens();
    for (Iterator<Map.Entry<Token, Integer>> iter = tokens.entrySet().iterator(); iter.hasNext(); ) {
        Map.Entry<Token, Integer> entry = iter.next();
        Token token = entry.getKey();
        if (token.hasSubtype(SubType.CLUE, game) || token.hasSubtype(SubType.FOOD, game) || token.hasSubtype(SubType.TREASURE, game)) {
            amount += entry.getValue();
            iter.remove();
        }
    }
    tokens.put(new ClueArtifactToken(), amount);
    tokens.put(new FoodToken(), amount);
    tokens.put(new TreasureToken(), amount);
    return false;
}
Also used : ClueArtifactToken(mage.game.permanent.token.ClueArtifactToken) TreasureToken(mage.game.permanent.token.TreasureToken) FoodToken(mage.game.permanent.token.FoodToken) ClueArtifactToken(mage.game.permanent.token.ClueArtifactToken) Token(mage.game.permanent.token.Token) TreasureToken(mage.game.permanent.token.TreasureToken) Map(java.util.Map) CreateTokenEvent(mage.game.events.CreateTokenEvent) FoodToken(mage.game.permanent.token.FoodToken)

Example 67 with Token

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

the class ArchfiendsVesselEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent archfiendsVessel = source.getSourcePermanentIfItStillExists(game);
    if (archfiendsVessel != null) {
        Player controller = game.getPlayer(source.getControllerId());
        if (controller != null) {
            boolean moved = controller.moveCards(archfiendsVessel, Zone.EXILED, source, game);
            if (moved) {
                Token token = new DemonToken();
                token.putOntoBattlefield(1, game, source, controller.getId());
            }
            return true;
        }
    }
    return false;
}
Also used : DemonToken(mage.game.permanent.token.DemonToken) Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) DemonToken(mage.game.permanent.token.DemonToken) Token(mage.game.permanent.token.Token)

Example 68 with Token

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

the class DeathByDragonsEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
        for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
            if (!playerId.equals(this.getTargetPointer().getFirst(game, source))) {
                Token token = new DragonToken2();
                token.putOntoBattlefield(1, game, source, playerId);
            }
        }
        return true;
    }
    return false;
}
Also used : TargetPlayer(mage.target.TargetPlayer) Player(mage.players.Player) DragonToken2(mage.game.permanent.token.DragonToken2) Token(mage.game.permanent.token.Token) UUID(java.util.UUID)

Aggregations

Token (mage.game.permanent.token.Token)68 Permanent (mage.game.permanent.Permanent)30 Player (mage.players.Player)29 UUID (java.util.UUID)28 FixedTargets (mage.target.targetpointer.FixedTargets)9 Map (java.util.Map)7 Effect (mage.abilities.effects.Effect)6 OneShotEffect (mage.abilities.effects.OneShotEffect)6 SacrificeTargetEffect (mage.abilities.effects.common.SacrificeTargetEffect)6 GainAbilityTargetEffect (mage.abilities.effects.common.continuous.GainAbilityTargetEffect)6 FixedTarget (mage.target.targetpointer.FixedTarget)6 AtTheBeginOfNextEndStepDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility)5 FilterControlledPermanent (mage.filter.common.FilterControlledPermanent)5 TargetPermanent (mage.target.TargetPermanent)5 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)5 FilterPermanent (mage.filter.FilterPermanent)4 CreateTokenEvent (mage.game.events.CreateTokenEvent)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 Objects (java.util.Objects)3