Search in sources :

Example 6 with TreasureToken

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

the class TemptingContractEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller == null) {
        return false;
    }
    int counter = 0;
    for (UUID playerId : game.getOpponents(source.getControllerId())) {
        Player opponent = game.getPlayer(playerId);
        if (opponent != null && opponent.chooseUse(outcome, "Create a Treasure token?", "If you do, " + controller.getName() + " will create one as well", "Yes", "No", source, game) && new TreasureToken().putOntoBattlefield(1, game, source, opponent.getId())) {
            counter++;
        }
    }
    if (counter > 0) {
        new TreasureToken().putOntoBattlefield(counter, game, source, source.getControllerId());
        return true;
    }
    return false;
}
Also used : Player(mage.players.Player) TreasureToken(mage.game.permanent.token.TreasureToken) UUID(java.util.UUID)

Example 7 with TreasureToken

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

the class TirelessProvisionerEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player == null) {
        return false;
    }
    Token token = player.chooseUse(outcome, "Create a Food token or a Treasure token?", null, "Food", "Treasure", source, game) ? new FoodToken() : new TreasureToken();
    return token.putOntoBattlefield(1, game, source, source.getControllerId());
}
Also used : Player(mage.players.Player) TreasureToken(mage.game.permanent.token.TreasureToken) FoodToken(mage.game.permanent.token.FoodToken) Token(mage.game.permanent.token.Token) TreasureToken(mage.game.permanent.token.TreasureToken) FoodToken(mage.game.permanent.token.FoodToken)

Example 8 with TreasureToken

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

the class XornReplacementEffect method replaceEvent.

@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
    if (event instanceof CreateTokenEvent) {
        CreateTokenEvent tokenEvent = (CreateTokenEvent) event;
        TreasureToken treasureToken = null;
        Map<Token, Integer> tokens = tokenEvent.getTokens();
        for (Token token : tokens.keySet()) {
            if (token instanceof TreasureToken) {
                treasureToken = (TreasureToken) token;
                break;
            }
        }
        if (treasureToken == null) {
            treasureToken = new TreasureToken();
        }
        tokens.put(treasureToken, tokens.getOrDefault(treasureToken, 0) + 1);
    }
    return false;
}
Also used : TreasureToken(mage.game.permanent.token.TreasureToken) Token(mage.game.permanent.token.Token) TreasureToken(mage.game.permanent.token.TreasureToken) CreateTokenEvent(mage.game.events.CreateTokenEvent)

Example 9 with TreasureToken

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

the class OldRutsteinEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player == null) {
        return false;
    }
    Cards cards = player.millCards(1, source, game);
    if (cards.getCards(game).stream().anyMatch(card -> card.isLand(game))) {
        new TreasureToken().putOntoBattlefield(1, game, source, source.getControllerId());
    }
    if (cards.getCards(game).stream().anyMatch(card -> card.isCreature(game))) {
        new InsectToken().putOntoBattlefield(1, game, source, source.getControllerId());
    }
    if (cards.getCards(game).stream().anyMatch(card -> !card.isCreature(game) && !card.isLand(game))) {
        new BloodToken().putOntoBattlefield(1, game, source, source.getControllerId());
    }
    return true;
}
Also used : Player(mage.players.Player) BloodToken(mage.game.permanent.token.BloodToken) InsectToken(mage.game.permanent.token.InsectToken) TreasureToken(mage.game.permanent.token.TreasureToken) Cards(mage.cards.Cards)

Example 10 with TreasureToken

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

the class SmashingSuccessEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent permanent = game.getPermanent(source.getFirstTarget());
    if (permanent != null && permanent.isPhasedIn() && !permanent.isPhasedOutIndirectly()) {
        if (permanent.isArtifact(game)) {
            if (permanent.destroy(source, game, false)) {
                Token token = new TreasureToken();
                token.putOntoBattlefield(1, game, source, source.getControllerId());
                return true;
            }
        } else {
            return permanent.destroy(source, game, false);
        }
    }
    return false;
}
Also used : FilterPermanent(mage.filter.FilterPermanent) Permanent(mage.game.permanent.Permanent) TargetPermanent(mage.target.TargetPermanent) TreasureToken(mage.game.permanent.token.TreasureToken) Token(mage.game.permanent.token.Token) TreasureToken(mage.game.permanent.token.TreasureToken)

Aggregations

TreasureToken (mage.game.permanent.token.TreasureToken)17 Player (mage.players.Player)12 Permanent (mage.game.permanent.Permanent)9 UUID (java.util.UUID)4 Token (mage.game.permanent.token.Token)4 TargetPermanent (mage.target.TargetPermanent)3 HashSet (java.util.HashSet)2 CreateTokenEffect (mage.abilities.effects.common.CreateTokenEffect)2 Cards (mage.cards.Cards)2 CardsImpl (mage.cards.CardsImpl)2 CreateTokenEvent (mage.game.events.CreateTokenEvent)2 FoodToken (mage.game.permanent.token.FoodToken)2 Map (java.util.Map)1 Ability (mage.abilities.Ability)1 SimpleActivatedAbility (mage.abilities.common.SimpleActivatedAbility)1 Cost (mage.abilities.costs.Cost)1 TapSourceCost (mage.abilities.costs.common.TapSourceCost)1 GenericManaCost (mage.abilities.costs.mana.GenericManaCost)1 OneShotEffect (mage.abilities.effects.OneShotEffect)1 DamagePlayersEffect (mage.abilities.effects.common.DamagePlayersEffect)1