use of mage.abilities.effects.common.CreateTokenTargetEffect in project mage by magefree.
the class CurseOfOpulenceEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
// In the case that the enchantment is blinked
Permanent enchantment = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (enchantment == null) {
// It was not blinked, use the standard method
enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
}
if (enchantment == null) {
return false;
}
Player enchantedPlayer = game.getPlayer(enchantment.getAttachedTo());
if (enchantedPlayer == null) {
return false;
}
Set<UUID> players = new HashSet<>();
for (UUID attacker : game.getCombat().getAttackers()) {
UUID defender = game.getCombat().getDefenderId(attacker);
if (defender.equals(enchantedPlayer.getId()) && game.getPlayer(source.getControllerId()).hasOpponent(game.getPermanent(attacker).getControllerId(), game)) {
players.add(game.getPermanent(attacker).getControllerId());
}
}
players.add(source.getControllerId());
for (UUID player : players) {
game.getPlayer(player);
Effect effect = new CreateTokenTargetEffect(new GoldToken());
effect.setTargetPointer(new FixedTarget(player));
effect.apply(game, source);
}
return true;
}
use of mage.abilities.effects.common.CreateTokenTargetEffect in project mage by magefree.
the class CurseOfShallowEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player attacker = game.getPlayer(this.getTargetPointer().getFirst(game, source));
if (attacker != null && attacker.chooseUse(outcome, "create a tapped 2/2 black Zombie creature token?", source, game)) {
Effect effect = new CreateTokenTargetEffect(new ZombieToken(), StaticValue.get(1), true, false);
effect.setTargetPointer(targetPointer);
return effect.apply(game, source);
}
return false;
}
Aggregations