use of mage.abilities.effects.common.counter.RemoveCounterSourceEffect in project mage by magefree.
the class ClockworkVorracEffect 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;
}
use of mage.abilities.effects.common.counter.RemoveCounterSourceEffect in project mage by magefree.
the class DreadWightCounterCondition method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
if (permanent != null) {
// add paralyzation counter
Effect effect = new AddCountersTargetEffect(CounterType.PARALYZATION.createInstance());
effect.setTargetPointer(new FixedTarget(permanent, game));
effect.apply(game, source);
// tap permanent
permanent.tap(source, game);
// does not untap while paralyzation counter is on it
ContinuousRuleModifyingEffect effect2 = new DreadWightDoNotUntapEffect(Duration.WhileOnBattlefield, permanent.getId());
effect2.setText("This creature doesn't untap during its controller's untap step for as long as it has a paralyzation counter on it");
Condition condition = new DreadWightCounterCondition(permanent.getId());
ConditionalContinuousRuleModifyingEffect conditionalEffect = new ConditionalContinuousRuleModifyingEffect(effect2, condition);
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, conditionalEffect);
ContinuousEffect effect3 = new GainAbilityTargetEffect(ability, Duration.WhileOnBattlefield);
ability.setRuleVisible(true);
effect3.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect3, source);
// each gains 4: remove paralyzation counter
Ability activatedAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, new RemoveCounterSourceEffect(CounterType.PARALYZATION.createInstance()), new ManaCostsImpl("{4}"));
ContinuousEffect effect4 = new GainAbilityTargetEffect(activatedAbility, Duration.WhileOnBattlefield);
effect4.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect4, source);
return true;
}
return false;
}
use of mage.abilities.effects.common.counter.RemoveCounterSourceEffect in project mage by magefree.
the class PlagueBoilerSacrificeDestroyEffect 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.PLAGUE) || controller.chooseUse(outcome, "Put a plague counter on? (No removes one)", source, game)) {
return new AddCountersSourceEffect(CounterType.PLAGUE.createInstance(), true).apply(game, source);
} else {
return new RemoveCounterSourceEffect(CounterType.PLAGUE.createInstance()).apply(game, source);
}
}
return false;
}
use of mage.abilities.effects.common.counter.RemoveCounterSourceEffect in project mage by magefree.
the class ChaoticGooEffect 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("Chaotic Goo: Won flip. Put a +1/+1 counter on Chaotic Goo.");
new AddCountersSourceEffect(CounterType.P1P1.createInstance(1)).apply(game, source);
return true;
} else {
game.informPlayers("Chaotic Goo: Lost flip. Remove a +1/+1 counter on Chaotic Goo.");
new RemoveCounterSourceEffect(CounterType.P1P1.createInstance(1)).apply(game, source);
return true;
}
}
return false;
}
use of mage.abilities.effects.common.counter.RemoveCounterSourceEffect in project mage by magefree.
the class ClockworkDragonEffect 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