use of mage.abilities.effects.common.counter.RemoveCounterSourceEffect in project mage by magefree.
the class GlyphOfDelusionEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
if (source.getTargets().get(1) != null) {
Permanent targetPermanent = game.getPermanent(source.getTargets().get(1).getFirstTarget());
if (targetPermanent != null) {
targetPermanent.addCounters(CounterType.GLYPH.createInstance(targetPermanent.getPower().getValue()), source.getControllerId(), source, game);
SimpleStaticAbility ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousRuleModifyingEffect(new DontUntapInControllersUntapStepSourceEffect(), new SourceHasCounterCondition(CounterType.GLYPH)).setText("This creature doesn't untap during your untap step if it has a glyph counter on it"));
GainAbilityTargetEffect effect = new GainAbilityTargetEffect(ability, Duration.Custom);
effect.setTargetPointer(new FixedTarget(targetPermanent.getId(), game));
game.addEffect(effect, source);
BeginningOfUpkeepTriggeredAbility ability2 = new BeginningOfUpkeepTriggeredAbility(new RemoveCounterSourceEffect(CounterType.GLYPH.createInstance()), TargetController.YOU, false);
GainAbilityTargetEffect effect2 = new GainAbilityTargetEffect(ability2, Duration.Custom);
effect2.setTargetPointer(new FixedTarget(targetPermanent.getId(), game));
game.addEffect(effect2, source);
}
}
return false;
}
use of mage.abilities.effects.common.counter.RemoveCounterSourceEffect in project mage by magefree.
the class GoblinBombEffect 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 (controller.flipCoin(source, game, true)) {
game.informPlayers("Goblin Bomb: Won flip. Put a fuse counter on Goblin Bomb.");
new AddCountersSourceEffect(CounterType.FUSE.createInstance(1)).apply(game, source);
return true;
} else {
game.informPlayers("Goblin Bomb: Lost flip. Remove a fuse counter from Goblin Bomb.");
new RemoveCounterSourceEffect(CounterType.FUSE.createInstance(1)).apply(game, source);
return true;
}
}
return false;
}
use of mage.abilities.effects.common.counter.RemoveCounterSourceEffect in project mage by magefree.
the class DarigaazReincarnatedReturnEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
MageObject sourceObject = source.getSourceObjectIfItStillExists(game);
if (sourceObject instanceof Card) {
Card card = (Card) sourceObject;
new RemoveCounterSourceEffect(CounterType.EGG.createInstance()).apply(game, source);
if (card.getCounters(game).getCount(CounterType.EGG) == 0) {
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}
return true;
}
return false;
}
use of mage.abilities.effects.common.counter.RemoveCounterSourceEffect in project mage by magefree.
the class JinxedChokerCounterEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (controller != null && sourcePermanent != null) {
if (!sourcePermanent.getCounters(game).containsKey(CounterType.CHARGE) || controller.chooseUse(outcome, "Put a charge counter on? (No removes one)", source, game)) {
return new AddCountersSourceEffect(CounterType.CHARGE.createInstance(), true).apply(game, source);
} else {
return new RemoveCounterSourceEffect(CounterType.CHARGE.createInstance()).apply(game, source);
}
}
return false;
}
use of mage.abilities.effects.common.counter.RemoveCounterSourceEffect in project mage by magefree.
the class ClockworkCondorEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent p = game.getPermanent(source.getSourceId());
if (p != null) {
AtTheEndOfCombatDelayedTriggeredAbility ability = new AtTheEndOfCombatDelayedTriggeredAbility(new RemoveCounterSourceEffect(CounterType.P1P1.createInstance()));
game.addDelayedTriggeredAbility(ability, source);
}
return false;
}
Aggregations