Search in sources :

Example 1 with BloodToken

use of mage.game.permanent.token.BloodToken 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 2 with BloodToken

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

the class OliviasAttendantsTriggeredAbility method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    int amount = ((DamagedBatchEvent) event).getEvents().stream().filter(e -> e.getSourceId().equals(getSourceId())).mapToInt(GameEvent::getAmount).sum();
    if (amount < 1) {
        return false;
    }
    this.getEffects().clear();
    this.addEffect(new CreateTokenEffect(new BloodToken(), amount));
    return true;
}
Also used : DamagedBatchEvent(mage.game.events.DamagedBatchEvent) BloodToken(mage.game.permanent.token.BloodToken) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect)

Example 3 with BloodToken

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

the class LacerateFleshEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent permanent = game.getPermanent(source.getFirstTarget());
    if (permanent == null) {
        return false;
    }
    int lethal = Math.min(permanent.getLethalDamage(source.getSourceId(), game), 4);
    permanent.damage(4, source.getSourceId(), source, game);
    if (lethal < 4) {
        new BloodToken().putOntoBattlefield(4 - lethal, game, source);
    }
    return true;
}
Also used : BloodToken(mage.game.permanent.token.BloodToken) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent)

Example 4 with BloodToken

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

the class OdricBloodCursedEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    int flying = 0;
    int firstStrike = 0;
    int doubleStrike = 0;
    int deathtouch = 0;
    int haste = 0;
    int hexproof = 0;
    int indestructible = 0;
    int lifelink = 0;
    int menance = 0;
    int reach = 0;
    int trample = 0;
    int vigilance = 0;
    for (Permanent permanent : game.getBattlefield().getAllActivePermanents(source.getControllerId())) {
        if (permanent.isCreature(game)) {
            for (Ability ability : permanent.getAbilities(game)) {
                if (ability instanceof FlyingAbility) {
                    flying = 1;
                }
                if (ability instanceof FirstStrikeAbility) {
                    firstStrike = 1;
                }
                if (ability instanceof DoubleStrikeAbility) {
                    doubleStrike = 1;
                }
                if (ability instanceof DeathtouchAbility) {
                    deathtouch = 1;
                }
                if (ability instanceof HasteAbility) {
                    haste = 1;
                }
                if (ability instanceof HexproofAbility) {
                    hexproof = 1;
                }
                if (ability instanceof IndestructibleAbility) {
                    indestructible = 1;
                }
                if (ability instanceof LifelinkAbility) {
                    lifelink = 1;
                }
                if (ability instanceof MenaceAbility) {
                    menance = 1;
                }
                if (ability instanceof ReachAbility) {
                    reach = 1;
                }
                if (ability instanceof TrampleAbility) {
                    trample = 1;
                }
                if (ability instanceof VigilanceAbility) {
                    vigilance = 1;
                }
            }
        }
    }
    int numTokens = flying + firstStrike + doubleStrike + deathtouch + haste + hexproof + indestructible + lifelink + menance + reach + trample + vigilance;
    if (numTokens < 1) {
        return false;
    }
    return new BloodToken().putOntoBattlefield(numTokens, game, source, source.getControllerId());
}
Also used : EntersBattlefieldTriggeredAbility(mage.abilities.common.EntersBattlefieldTriggeredAbility) Ability(mage.abilities.Ability) BloodToken(mage.game.permanent.token.BloodToken) Permanent(mage.game.permanent.Permanent)

Aggregations

BloodToken (mage.game.permanent.token.BloodToken)4 Permanent (mage.game.permanent.Permanent)2 Ability (mage.abilities.Ability)1 EntersBattlefieldTriggeredAbility (mage.abilities.common.EntersBattlefieldTriggeredAbility)1 CreateTokenEffect (mage.abilities.effects.common.CreateTokenEffect)1 Cards (mage.cards.Cards)1 DamagedBatchEvent (mage.game.events.DamagedBatchEvent)1 InsectToken (mage.game.permanent.token.InsectToken)1 TreasureToken (mage.game.permanent.token.TreasureToken)1 Player (mage.players.Player)1 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)1