use of mage.abilities.effects.common.CreateTokenTargetEffect in project mage by magefree.
the class TransmogrifyingWandEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent creature = game.getPermanent(source.getFirstTarget());
if (creature == null) {
return false;
}
Effect effect = new CreateTokenTargetEffect(new OxToken());
effect.setTargetPointer(new FixedTarget(creature.getControllerId(), game));
new DestroyTargetEffect().apply(game, source);
return effect.apply(game, source);
}
use of mage.abilities.effects.common.CreateTokenTargetEffect in project mage by magefree.
the class AllianceOfArmsEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
int xSum = 0;
xSum += ManaUtil.playerPaysXGenericMana(false, "Alliance of Arms", controller, source, game);
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
if (!Objects.equals(playerId, controller.getId())) {
Player player = game.getPlayer(playerId);
if (player != null) {
xSum += ManaUtil.playerPaysXGenericMana(false, "Alliance of Arms", player, source, game);
}
}
}
if (xSum > 0) {
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Effect effect = new CreateTokenTargetEffect(new SoldierToken(), xSum);
effect.setTargetPointer(new FixedTarget(playerId));
effect.apply(game, source);
}
}
// prevent undo
controller.resetStoredBookmark(game);
return true;
}
return false;
}
use of mage.abilities.effects.common.CreateTokenTargetEffect in project mage by magefree.
the class GrismoldTheDreadsowerEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
game.getState().getPlayersInRange(source.getControllerId(), game).stream().forEach(playerId -> {
Effect effect = new CreateTokenTargetEffect(new GrismoldPlantToken(), 1);
effect.setTargetPointer(new FixedTarget(playerId, game));
effect.apply(game, source);
});
return true;
}
use of mage.abilities.effects.common.CreateTokenTargetEffect in project mage by magefree.
the class CurseOfDisturbanceEffect 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) {
Player enchantedPlayer = game.getPlayer(enchantment.getAttachedTo());
if (enchantedPlayer != null) {
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 ZombieToken());
effect.setTargetPointer(new FixedTarget(player));
effect.apply(game, source);
}
}
return true;
}
return false;
}
use of mage.abilities.effects.common.CreateTokenTargetEffect in project mage by magefree.
the class PhantasmalSphereToken method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Player targetOpponent = game.getPlayer(source.getFirstTarget());
if (controller != null && targetOpponent != null) {
Effect effect = new CreateTokenTargetEffect(new PhantasmalSphereToken(new CountersSourceCount(CounterType.P1P1).calculate(game, source, null)));
effect.setTargetPointer(new FixedTarget(targetOpponent.getId()));
effect.apply(game, source);
}
return false;
}
Aggregations