use of mage.game.permanent.token.ElfWarriorToken in project mage by magefree.
the class ReturnUponTheTideEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Card card = game.getCard(source.getFirstTarget());
if (player == null || card == null) {
return false;
}
player.moveCards(card, Zone.BATTLEFIELD, source, game);
Permanent permanent = game.getPermanent(card.getId());
if (permanent == null) {
return false;
}
if (permanent.hasSubtype(SubType.ELF, game)) {
new ElfWarriorToken().putOntoBattlefield(2, game, source, player.getId());
}
return true;
}
use of mage.game.permanent.token.ElfWarriorToken in project mage by magefree.
the class GiltLeafAmbushCreateTokenEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
CreateTokenEffect effect = new CreateTokenEffect(new ElfWarriorToken(), 2);
effect.apply(game, source);
if (ClashEffect.getInstance().apply(game, source)) {
for (UUID tokenId : effect.getLastAddedTokenIds()) {
Permanent token = game.getPermanent(tokenId);
if (token != null) {
ContinuousEffect continuousEffect = new GainAbilityTargetEffect(DeathtouchAbility.getInstance(), Duration.EndOfTurn);
continuousEffect.setTargetPointer(new FixedTarget(tokenId));
game.addEffect(continuousEffect, source);
}
}
}
return true;
}
return false;
}
use of mage.game.permanent.token.ElfWarriorToken in project mage by magefree.
the class NadierAgentOfTheDuskenelEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Object obj = getValue("permanentLeftBattlefield");
if (!(obj instanceof Permanent)) {
return false;
}
Permanent permanent = (Permanent) obj;
if (!permanent.isCreature(game) || permanent.getPower().getValue() < 1) {
return false;
}
return new ElfWarriorToken().putOntoBattlefield(permanent.getPower().getValue(), game, source, source.getControllerId());
}
use of mage.game.permanent.token.ElfWarriorToken in project mage by magefree.
the class SylvanOfferingEffect2 method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Target target = new TargetOpponent(true);
target.choose(Outcome.Sacrifice, source.getControllerId(), source.getSourceId(), game);
Player opponent = game.getPlayer(target.getFirstTarget());
if (opponent != null) {
int xValue = source.getManaCostsToPay().getX();
Effect effect = new CreateTokenTargetEffect(new ElfWarriorToken(), xValue);
effect.setTargetPointer(new FixedTarget(controller.getId()));
effect.apply(game, source);
effect.setTargetPointer(new FixedTarget(opponent.getId()));
effect.apply(game, source);
return true;
}
}
return false;
}
Aggregations