Search in sources :

Example 1 with VecnaToken

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

the class TheBookOfVileDarknessEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Set<MageObjectReference> morSet = (Set<MageObjectReference>) getValue("BookEyeHand");
    if (morSet == null) {
        return false;
    }
    Token token = new VecnaToken();
    for (MageObjectReference mor : morSet) {
        // the card object in the mor doesn't work, so the permanent object is used
        Permanent card = mor.getPermanentOrLKIBattlefield(game);
        if (card == null) {
            continue;
        }
        for (Ability ability : card.getAbilities(game)) {
            if (ability instanceof TriggeredAbility) {
                Ability copyAbility = ability.copy();
                copyAbility.newId();
                copyAbility.setControllerId(source.getControllerId());
                token.addAbility(copyAbility);
            }
        }
    }
    return token.putOntoBattlefield(1, game, source, source.getControllerId());
}
Also used : BeginningOfEndStepTriggeredAbility(mage.abilities.common.BeginningOfEndStepTriggeredAbility) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) TriggeredAbility(mage.abilities.TriggeredAbility) Ability(mage.abilities.Ability) HashSet(java.util.HashSet) Set(java.util.Set) FilterPermanent(mage.filter.FilterPermanent) FilterControlledArtifactPermanent(mage.filter.common.FilterControlledArtifactPermanent) Permanent(mage.game.permanent.Permanent) TargetPermanent(mage.target.TargetPermanent) VecnaToken(mage.game.permanent.token.VecnaToken) Token(mage.game.permanent.token.Token) ZombieToken(mage.game.permanent.token.ZombieToken) VecnaToken(mage.game.permanent.token.VecnaToken) BeginningOfEndStepTriggeredAbility(mage.abilities.common.BeginningOfEndStepTriggeredAbility) TriggeredAbility(mage.abilities.TriggeredAbility) MageObjectReference(mage.MageObjectReference)

Aggregations

HashSet (java.util.HashSet)1 Set (java.util.Set)1 MageObjectReference (mage.MageObjectReference)1 Ability (mage.abilities.Ability)1 TriggeredAbility (mage.abilities.TriggeredAbility)1 BeginningOfEndStepTriggeredAbility (mage.abilities.common.BeginningOfEndStepTriggeredAbility)1 SimpleActivatedAbility (mage.abilities.common.SimpleActivatedAbility)1 FilterPermanent (mage.filter.FilterPermanent)1 FilterControlledArtifactPermanent (mage.filter.common.FilterControlledArtifactPermanent)1 Permanent (mage.game.permanent.Permanent)1 Token (mage.game.permanent.token.Token)1 VecnaToken (mage.game.permanent.token.VecnaToken)1 ZombieToken (mage.game.permanent.token.ZombieToken)1 TargetPermanent (mage.target.TargetPermanent)1