use of mage.abilities.effects.common.CreateTokenEffect in project mage by magefree.
the class OldGrowthTrollContinuousEffect method makeAbility.
private static final Ability makeAbility() {
Ability activatedAbility = new SimpleActivatedAbility(new CreateTokenEffect(new TrollWarriorToken(), 1, true, false), new GenericManaCost(1));
activatedAbility.addCost(new TapSourceCost());
Cost cost = new SacrificeSourceCost();
cost.setText("sacrifice this land");
activatedAbility.addCost(cost);
Ability ability = new SimpleStaticAbility(new GainAbilityAttachedEffect(new SimpleManaAbility(Zone.BATTLEFIELD, Mana.GreenMana(2), new TapSourceCost()), AttachmentType.AURA).setText("enchanted Forest has \"{T}: Add {G}{G}\""));
ability.addEffect(new GainAbilityAttachedEffect(activatedAbility, AttachmentType.AURA).setText("and \"{1}, {T}, Sacrifice this land: Create a tapped 4/4 green Troll Warrior creature token with trample.\""));
return ability;
}
use of mage.abilities.effects.common.CreateTokenEffect in project mage by magefree.
the class OliviasAttendantsTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
int amount = ((DamagedBatchEvent) event).getEvents().stream().filter(e -> e.getSourceId().equals(getSourceId())).mapToInt(GameEvent::getAmount).sum();
if (amount < 1) {
return false;
}
this.getEffects().clear();
this.addEffect(new CreateTokenEffect(new BloodToken(), amount));
return true;
}
use of mage.abilities.effects.common.CreateTokenEffect in project mage by magefree.
the class PromiseOfBunreiEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(source.getSourceId());
if (controller != null && permanent != null) {
if (permanent.sacrifice(source, game)) {
return new CreateTokenEffect(new SpiritToken(), 4).apply(game, source);
}
return true;
}
return false;
}
use of mage.abilities.effects.common.CreateTokenEffect in project mage by magefree.
the class ReignOfThePitEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
int totalPowerSacrificed = 0;
List<UUID> perms = new ArrayList<>();
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent(1, 1, new FilterControlledCreaturePermanent(), true);
if (target.canChoose(source.getSourceId(), player.getId(), game)) {
while (!target.isChosen() && player.canRespond()) {
player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
}
perms.addAll(target.getTargets());
}
}
}
for (UUID permID : perms) {
Permanent permanent = game.getPermanent(permID);
if (permanent != null) {
int power = permanent.getPower().getValue();
if (permanent.sacrifice(source, game)) {
totalPowerSacrificed += power;
}
}
}
new CreateTokenEffect(new DemonFlyingToken(totalPowerSacrificed)).apply(game, source);
return true;
}
use of mage.abilities.effects.common.CreateTokenEffect in project mage by magefree.
the class SplinteringWindDelayedTriggeredAbility method apply.
@Override
public boolean apply(Game game, Ability source) {
Player sourceController = game.getPlayer(source.getControllerId());
Permanent sourceObject = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (sourceController != null && sourceObject != null) {
CreateTokenEffect effect = new CreateTokenEffect(new SplinterToken());
effect.apply(game, source);
game.getState().setValue(source.getSourceId() + "_token", effect.getLastAddedTokenIds());
for (UUID addedTokenId : effect.getLastAddedTokenIds()) {
game.addDelayedTriggeredAbility(new SplinteringWindDelayedTriggeredAbility(addedTokenId), source);
}
return true;
}
return false;
}
Aggregations