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());
}
Aggregations