Search in sources :

Example 6 with MenaceAbility

use of mage.abilities.keyword.MenaceAbility 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;
}
Also used : MenaceAbility(mage.abilities.keyword.MenaceAbility) FixedTargets(mage.target.targetpointer.FixedTargets) GainAbilityTargetEffect(mage.abilities.effects.common.continuous.GainAbilityTargetEffect) SamuraiToken(mage.game.permanent.token.SamuraiToken) Token(mage.game.permanent.token.Token) SamuraiToken(mage.game.permanent.token.SamuraiToken) UUID(java.util.UUID)

Example 7 with MenaceAbility

use of mage.abilities.keyword.MenaceAbility in project mage by magefree.

the class BladeOfTheOniEffect method apply.

@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
    Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game);
    if (sourcePermanent == null) {
        return false;
    }
    Permanent permanent = game.getPermanent(sourcePermanent.getAttachedTo());
    if (permanent == null) {
        return false;
    }
    switch(layer) {
        case AbilityAddingRemovingEffects_6:
            permanent.addAbility(new MenaceAbility(false), source.getSourceId(), game);
            return true;
        case ColorChangingEffects_5:
            permanent.getColor(game).setBlack(true);
            return true;
        case TypeChangingEffects_4:
            permanent.addSubType(game, SubType.DEMON);
            return true;
        case PTChangingEffects_7:
            if (sublayer != SubLayer.SetPT_7b) {
                return false;
            }
            permanent.getPower().setValue(5);
            permanent.getToughness().setValue(5);
            return true;
    }
    return false;
}
Also used : MenaceAbility(mage.abilities.keyword.MenaceAbility) Permanent(mage.game.permanent.Permanent)

Aggregations

MenaceAbility (mage.abilities.keyword.MenaceAbility)7 Permanent (mage.game.permanent.Permanent)3 Test (org.junit.Test)3 Player (mage.players.Player)2 UUID (java.util.UUID)1 BecomesCreatureTargetEffect (mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect)1 GainAbilitySourceEffect (mage.abilities.effects.common.continuous.GainAbilitySourceEffect)1 GainAbilityTargetEffect (mage.abilities.effects.common.continuous.GainAbilityTargetEffect)1 SamuraiToken (mage.game.permanent.token.SamuraiToken)1 Token (mage.game.permanent.token.Token)1 CreatureToken (mage.game.permanent.token.custom.CreatureToken)1 FixedTargets (mage.target.targetpointer.FixedTargets)1 Ignore (org.junit.Ignore)1