Search in sources :

Example 1 with GainAbilityControlledSpellsEffect

use of mage.abilities.effects.common.continuous.GainAbilityControlledSpellsEffect in project mage by magefree.

the class DomriChaosBringerTriggeredAbility method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    if (!event.getSourceId().equals(spellId)) {
        return false;
    }
    if (game.getTurnNum() != turnNumber) {
        return false;
    }
    MageObject mo = game.getObject(event.getTargetId());
    if (mo == null || !mo.isCreature(game)) {
        return false;
    }
    StackObject stackObject = game.getStack().getStackObject(event.getTargetId());
    if (stackObject == null) {
        return false;
    }
    this.getEffects().clear();
    FilterCard filter = new FilterCard();
    filter.add(new CardIdPredicate(stackObject.getSourceId()));
    this.addEffect(new GainAbilityControlledSpellsEffect(new RiotAbility(), filter));
    return true;
}
Also used : FilterCard(mage.filter.FilterCard) RiotAbility(mage.abilities.keyword.RiotAbility) MageObject(mage.MageObject) StackObject(mage.game.stack.StackObject) CardIdPredicate(mage.filter.predicate.mageobject.CardIdPredicate) GainAbilityControlledSpellsEffect(mage.abilities.effects.common.continuous.GainAbilityControlledSpellsEffect)

Aggregations

MageObject (mage.MageObject)1 GainAbilityControlledSpellsEffect (mage.abilities.effects.common.continuous.GainAbilityControlledSpellsEffect)1 RiotAbility (mage.abilities.keyword.RiotAbility)1 FilterCard (mage.filter.FilterCard)1 CardIdPredicate (mage.filter.predicate.mageobject.CardIdPredicate)1 StackObject (mage.game.stack.StackObject)1