Cyclopean Tomb - Update.

This commit is contained in:
LevelX2 2016-12-28 02:02:57 +01:00
parent cebfadbf34
commit ecc18072cf
177 changed files with 581 additions and 646 deletions

View file

@ -1,96 +1,96 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.cards.a;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.costs.Cost;
import mage.abilities.costs.CostImpl;
import mage.abilities.keyword.CumulativeUpkeepAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author Styxo
*/
public class Aboroth extends CardImpl {
public Aboroth(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}{G}");
this.subtype.add("Elemental");
this.power = new MageInt(9);
this.toughness = new MageInt(9);
// Cumulative upkeep-Put a -1/-1 counter on Aboroth.
this.addAbility(new CumulativeUpkeepAbility(new AborothCost()));
}
public Aboroth(final Aboroth card) {
super(card);
}
@Override
public Aboroth copy() {
return new Aboroth(this);
}
}
class AborothCost extends CostImpl {
public AborothCost() {
this.text = "Put a -1/-1 counter on Aboroth";
}
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
Permanent permanent = game.getPermanent(sourceId);
if (permanent != null) {
permanent.addCounters(CounterType.M1M1.createInstance(), game);
this.paid = true;
return true;
}
return false;
}
@Override
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
return true;
}
@Override
public AborothCost copy() {
return new AborothCost();
}
}
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.cards.a;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.costs.Cost;
import mage.abilities.costs.CostImpl;
import mage.abilities.keyword.CumulativeUpkeepAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author Styxo
*/
public class Aboroth extends CardImpl {
public Aboroth(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}{G}");
this.subtype.add("Elemental");
this.power = new MageInt(9);
this.toughness = new MageInt(9);
// Cumulative upkeep-Put a -1/-1 counter on Aboroth.
this.addAbility(new CumulativeUpkeepAbility(new AborothCost()));
}
public Aboroth(final Aboroth card) {
super(card);
}
@Override
public Aboroth copy() {
return new Aboroth(this);
}
}
class AborothCost extends CostImpl {
public AborothCost() {
this.text = "Put a -1/-1 counter on Aboroth";
}
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
Permanent permanent = game.getPermanent(sourceId);
if (permanent != null) {
permanent.addCounters(CounterType.M1M1.createInstance(), ability, game);
this.paid = true;
return true;
}
return false;
}
@Override
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
return true;
}
@Override
public AborothCost copy() {
return new AborothCost();
}
}

View file

@ -119,7 +119,7 @@ class AetherbornMarauderEffect extends OneShotEffect {
}
if (numberToMove > 0) {
fromPermanent.removeCounters(CounterType.P1P1.createInstance(numberToMove), game);
sourceObject.addCounters(CounterType.P1P1.createInstance(numberToMove), game);
sourceObject.addCounters(CounterType.P1P1.createInstance(numberToMove), source, game);
}
}
}

View file

@ -132,7 +132,7 @@ class AngelheartVialEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
permanent.addCounters(CounterType.CHARGE.createInstance((Integer) this.getValue("damageAmount")), game);
permanent.addCounters(CounterType.CHARGE.createInstance((Integer) this.getValue("damageAmount")), source, game);
}
return true;
}

View file

@ -147,7 +147,7 @@ class AnimationModuleEffect extends OneShotEffect {
if (permanent.getCounters(game).size() == 1) {
for (Counter counter : permanent.getCounters(game).values()) {
Counter newCounter = new Counter(counter.getName());
permanent.addCounters(newCounter, game);
permanent.addCounters(newCounter, source, game);
}
}
else {
@ -162,7 +162,7 @@ class AnimationModuleEffect extends OneShotEffect {
for (Counter counter : permanent.getCounters(game).values()) {
if (counter.getName().equals(choice.getChoice())) {
Counter newCounter = new Counter(counter.getName());
permanent.addCounters(newCounter, game);
permanent.addCounters(newCounter, source, game);
break;
}
}

View file

@ -101,7 +101,7 @@ class AnthroplasmEffect extends OneShotEffect {
//Remove all +1/+1 counters
permanent.removeCounters(permanent.getCounters(game).get(CounterType.P1P1.getName()), game);
//put X +1/+1 counters
permanent.addCounters(CounterType.P1P1.createInstance(source.getManaCostsToPay().getX()), game);
permanent.addCounters(CounterType.P1P1.createInstance(source.getManaCostsToPay().getX()), source, game);
return true;
}
return false;

View file

@ -103,9 +103,9 @@ class ApocalypseHydraEffect extends OneShotEffect {
int amount = spellAbility.getManaCostsToPay().getX();
if (amount > 0) {
if (amount < 5) {
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game);
} else {
permanent.addCounters(CounterType.P1P1.createInstance(amount * 2), game);
permanent.addCounters(CounterType.P1P1.createInstance(amount * 2), source, game);
}
}
}

View file

@ -125,7 +125,7 @@ class ArbiterOfTheIdealEffect extends OneShotEffect {
card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), source.getControllerId());
Permanent permanent = game.getPermanent(card.getId());
if (permanent != null) {
permanent.addCounters(new Counter("Manifestation"), game);
permanent.addCounters(new Counter("Manifestation"), source, game);
ContinuousEffect effect = new AddCardTypeTargetEffect(CardType.ENCHANTMENT, Duration.Custom);
effect.setTargetPointer(new FixedTarget(permanent.getId()));
game.addEffect(effect, source);

View file

@ -108,7 +108,7 @@ class ArsenalThresherEffect extends OneShotEffect {
}
if (arsenalThresher != null) {
controller.revealCards(arsenalThresher.getIdName(), cards, game);
arsenalThresher.addCounters(CounterType.P1P1.createInstance(cards.size()), game);
arsenalThresher.addCounters(CounterType.P1P1.createInstance(cards.size()), source, game);
}
}
}

View file

@ -127,7 +127,7 @@ class AzorsElocutorsEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
permanent.addCounters(new Counter("filibuster"), game);
permanent.addCounters(new Counter("filibuster"), source, game);
if (permanent.getCounters(game).getCount("filibuster") > 4) {
Player player = game.getPlayer(permanent.getControllerId());
if (player != null) {

View file

@ -117,7 +117,7 @@ class MoveCounterFromTargetToTargetEffect extends OneShotEffect {
int amountToMove = controller.getAmount(0, amountCounters, "How many counters do you want to move?", game);
if (amountToMove > 0) {
fromPermanent.removeCounters(CounterType.P1P1.createInstance(amountToMove), game);
toPermanent.addCounters(CounterType.P1P1.createInstance(amountToMove), game);
toPermanent.addCounters(CounterType.P1P1.createInstance(amountToMove), source, game);
}
}
return true;

View file

@ -81,7 +81,7 @@ class BlackSunsZenithEffect extends OneShotEffect {
int amount = source.getManaCostsToPay().getX();
for (Permanent permanent : game.getBattlefield().getAllActivePermanents()) {
if (permanent != null && permanent.getCardType().contains(CardType.CREATURE)) {
permanent.addCounters(CounterType.M1M1.createInstance(amount), game);
permanent.addCounters(CounterType.M1M1.createInstance(amount), source, game);
}
}
return true;

View file

@ -130,9 +130,9 @@ class BladeOfTheBloodchiefEffect extends OneShotEffect {
Permanent creature = game.getPermanent(enchantment.getAttachedTo());
if (creature != null) {
if (creature.hasSubtype("Vampire", game)) {
creature.addCounters(CounterType.P1P1.createInstance(2), game);
creature.addCounters(CounterType.P1P1.createInstance(2), source, game);
} else {
creature.addCounters(CounterType.P1P1.createInstance(), game);
creature.addCounters(CounterType.P1P1.createInstance(), source, game);
}
}
}

View file

@ -148,7 +148,7 @@ class BloodTyrantEffect extends OneShotEffect {
}
Permanent bloodTyrant = game.getPermanent(source.getSourceId());
if (bloodTyrant != null && counters > 0) {
bloodTyrant.addCounters(CounterType.P1P1.createInstance(counters), game);
bloodTyrant.addCounters(CounterType.P1P1.createInstance(counters), source, game);
}
return true;
}

View file

@ -107,7 +107,7 @@ class BloodsporeThrinaxEntersBattlefieldEffect extends ReplacementEffectImpl {
if (sourceCreature != null && creature != null) {
int amount = sourceCreature.getCounters(game).getCount(CounterType.P1P1);
if (amount > 0) {
creature.addCounters(CounterType.P1P1.createInstance(amount), game);
creature.addCounters(CounterType.P1P1.createInstance(amount), source, game);
}
}
return false;

View file

@ -111,7 +111,7 @@ class BlowflyInfestationEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Permanent creature = game.getPermanent(source.getFirstTarget());
if (creature != null) {
creature.addCounters(CounterType.M1M1.createInstance(), game);
creature.addCounters(CounterType.M1M1.createInstance(), source, game);
return true;
}
return false;

View file

@ -201,7 +201,7 @@ class BombSquadBeginningEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Card card = game.getCard(source.getSourceId());
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
permanent.addCounters(CounterType.FUSE.createInstance(), game);
permanent.addCounters(CounterType.FUSE.createInstance(), source, game);
game.informPlayers(new StringBuilder(card.getName()).append(" puts a fuse counter on ").append(permanent.getName()).toString());
}

View file

@ -119,7 +119,7 @@ class BramblewoodParagonReplacementEffect extends ReplacementEffectImpl {
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
if (creature != null) {
creature.addCounters(CounterType.P1P1.createInstance(), game);
creature.addCounters(CounterType.P1P1.createInstance(), source, game);
}
return false;
}

View file

@ -103,7 +103,7 @@ class CankerAbominationEffect extends OneShotEffect {
game.informPlayers(cankerAbomination.getName() + ": " + controller.getLogName() + " has chosen " + opponent.getLogName());
int amount = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), opponent.getId(), game).size();
if (amount > 0) {
cankerAbomination.addCounters(CounterType.M1M1.createInstance(amount), game);
cankerAbomination.addCounters(CounterType.M1M1.createInstance(amount), source, game);
}
return true;
}

View file

@ -100,7 +100,7 @@ class CannibalizeEffect extends OneShotEffect {
controller.moveCardToExileWithInfo(creature, null, "", source.getSourceId(), game, Zone.BATTLEFIELD, true);
exileDone = true;
} else {
creature.addCounters(CounterType.P1P1.createInstance(2), game);
creature.addCounters(CounterType.P1P1.createInstance(2), source, game);
game.informPlayers("Added two +1/+1 counters on " + creature.getLogName());
}
count++;

View file

@ -93,7 +93,7 @@ class CarnifexDemonEffect extends OneShotEffect {
if (p != null) {
for (Permanent t : game.getBattlefield().getAllActivePermanents()) {
if (t.getCardType().contains(CardType.CREATURE) && !t.getId().equals(source.getSourceId()))
t.addCounters(CounterType.M1M1.createInstance(), game);
t.addCounters(CounterType.M1M1.createInstance(), source, game);
}
}
return false;

View file

@ -121,7 +121,7 @@ class ChargingCinderhornDamageTargetEffect extends OneShotEffect{
public boolean apply(Game game, Ability source) {
Permanent chargingCinderhoof = game.getPermanent(source.getSourceId());
if (chargingCinderhoof != null) {
chargingCinderhoof.addCounters(CounterType.FURY.createInstance(), game);
chargingCinderhoof.addCounters(CounterType.FURY.createInstance(), source, game);
} else {
chargingCinderhoof = game.getPermanentOrLKIBattlefield(source.getSourceId());
}

View file

@ -200,7 +200,7 @@ class ChorusOfTheConclaveReplacementEffect2 extends ReplacementEffectImpl {
String key = event.getSourceId().toString() + (game.getState().getZoneChangeCounter(event.getSourceId()) - 1);
int xValue = spellX.get(key);
if (xValue > 0) {
creature.addCounters(CounterType.P1P1.createInstance(xValue), game);
creature.addCounters(CounterType.P1P1.createInstance(xValue), source, game);
game.informPlayers(sourceObject.getLogName() + ": " + creature.getLogName() + " enters the battlefield with " + xValue + " +1/+1 counter" + (xValue > 1 ? "s" : "") + " on it");
}
spellX.remove(key);

View file

@ -131,7 +131,7 @@ class CollectiveEffortEffect extends OneShotEffect {
Player target = game.getPlayer(source.getFirstTarget());
if (target != null) {
for (Permanent p : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), target.getId(), game)) {
p.addCounters(CounterType.P1P1.createInstance(), game);
p.addCounters(CounterType.P1P1.createInstance(), source, game);
}
return true;
}

View file

@ -84,12 +84,12 @@ class CommonBondEffect extends OneShotEffect {
int affectedTargets = 0;
Permanent permanent = game.getPermanent(source.getTargets().get(0).getFirstTarget());
if (permanent != null) {
permanent.addCounters(CounterType.P1P1.createInstance(1), game);
permanent.addCounters(CounterType.P1P1.createInstance(1), source, game);
affectedTargets ++;
}
permanent = game.getPermanent(source.getTargets().get(1).getFirstTarget());
if (permanent != null) {
permanent.addCounters(CounterType.P1P1.createInstance(1), game);
permanent.addCounters(CounterType.P1P1.createInstance(1), source, game);
affectedTargets ++;
}
return affectedTargets > 0;

View file

@ -96,7 +96,7 @@ class ContagionEngineEffect extends OneShotEffect {
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
if (targetPlayer != null) {
for (Permanent creature : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), targetPlayer.getId(), game)) {
creature.addCounters(CounterType.M1M1.createInstance(), game);
creature.addCounters(CounterType.M1M1.createInstance(), source, game);
}
return true;
}

View file

@ -129,7 +129,7 @@ class CradleOfVitalityEffect extends OneShotEffect {
Integer amount = (Integer) getValue("amount");
for (UUID uuid : targetPointer.getTargets(game, source)) {
Permanent permanent = game.getPermanent(uuid);
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game);
affectedTargets ++;
}
return affectedTargets > 0;

View file

@ -91,7 +91,7 @@ class CryptbornHorrorEffect extends OneShotEffect {
if (permanent != null) {
int oll = new OpponentsLostLifeCount().calculate(game, source, this);
if (oll > 0) {
permanent.addCounters(CounterType.P1P1.createInstance(oll), game);
permanent.addCounters(CounterType.P1P1.createInstance(oll), source, game);
}
return true;
}

View file

@ -29,24 +29,19 @@ package mage.cards.c;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import mage.MageObject;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.common.PutIntoGraveFromBattlefieldSourceTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.common.delayed.AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility;
import mage.abilities.condition.common.IsStepCondition;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.decorator.ConditionalActivatedAbility;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
import mage.abilities.effects.common.continuous.BecomesBasicLandTargetEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.abilities.effects.common.counter.RemoveAllCountersTargetEffect;
@ -62,17 +57,15 @@ import mage.constants.WatcherScope;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.Predicate;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.CounterPredicate;
import mage.filter.predicate.permanent.PermanentIdPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetLandPermanent;
import mage.target.targetpointer.FixedTarget;
import mage.util.CardUtil;
import mage.watchers.Watcher;
/**
@ -80,9 +73,9 @@ import mage.watchers.Watcher;
* @author MTGfan
*/
public class CyclopeanTomb extends CardImpl {
private static final FilterLandPermanent filter = new FilterLandPermanent();
static {
filter.add(Predicates.not(new SubtypePredicate("Swamp")));
}
@ -97,9 +90,7 @@ public class CyclopeanTomb extends CardImpl {
ability.addEffect(new BecomeSwampEffect(Duration.Custom, false, true, "Swamp"));
this.addAbility(ability, new CyclopeanTombCounterWatcher());
// When Cyclopean Tomb is put into a graveyard from the battlefield, at the beginning of each of your upkeeps for the rest of the game, remove all mire counters from a land that a mire counter was put onto with Cyclopean Tomb but that a mire counter has not been removed from with Cyclopean Tomb.
Effect effect = new CreateDelayedTriggeredAbilityEffect(new CyclopeanTombDelayedTriggeredAbility());
effect.setText("at the beginning of each of your upkeeps for the rest of the game, remove all mire counters from a land that a mire counter was put onto with {this} but that a mire counter has not been removed from with {this}.");
this.addAbility(new PutIntoGraveFromBattlefieldSourceTriggeredAbility(effect));
this.addAbility(new PutIntoGraveFromBattlefieldSourceTriggeredAbility(new CyclopeanTombCreateTriggeredEffect()));
}
public CyclopeanTomb(final CyclopeanTomb card) {
@ -113,16 +104,16 @@ public class CyclopeanTomb extends CardImpl {
}
class BecomeSwampEffect extends BecomesBasicLandTargetEffect {
public BecomeSwampEffect(Duration duration, boolean chooseLandType, boolean loseOther, String... landNames) {
super(duration, chooseLandType, loseOther, landNames);
staticText = "That land is a Swamp for as long as it has a mire counter on it.";
staticText = "That land is a Swamp for as long as it has a mire counter on it";
}
public BecomeSwampEffect(final BecomeSwampEffect effect) {
super(effect);
}
@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
Permanent land = game.getPermanent(this.targetPointer.getFirst(game, source));
@ -135,36 +126,42 @@ class BecomeSwampEffect extends BecomesBasicLandTargetEffect {
}
return true;
}
@Override
public BecomeSwampEffect copy() {
return new BecomeSwampEffect(this);
}
}
class CyclopeanTombDelayedTriggeredAbility extends DelayedTriggeredAbility {
class CyclopeanTombCreateTriggeredEffect extends OneShotEffect {
CyclopeanTombDelayedTriggeredAbility() {
super(new CyclopeanTombEffect(), Duration.OneUse, true, false);
public CyclopeanTombCreateTriggeredEffect() {
super(Outcome.Benefit);
this.staticText = "At the beginning of each of your upkeeps for the rest of the game, remove all mire counters from a land that a mire counter was put onto with {this} but that a mire counter has not been removed from with {this}";
}
CyclopeanTombDelayedTriggeredAbility(CyclopeanTombDelayedTriggeredAbility ability) {
super(ability);
public CyclopeanTombCreateTriggeredEffect(final CyclopeanTombCreateTriggeredEffect effect) {
super(effect);
}
@Override
public CyclopeanTombDelayedTriggeredAbility copy() {
return new CyclopeanTombDelayedTriggeredAbility(this);
public CyclopeanTombCreateTriggeredEffect copy() {
return new CyclopeanTombCreateTriggeredEffect(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.BEGINNING_PHASE_PRE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return event.getPlayerId().equals(this.controllerId);
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Permanent tomb = game.getPermanentOrLKIBattlefield(source.getSourceId()); // we need to set the correct source object
DelayedTriggeredAbility ability = new AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility(new CyclopeanTombEffect(), Duration.EndOfGame, false);
ability.setSourceObject(tomb, game);
ability.setControllerId(source.getControllerId());
ability.setSourceId(source.getSourceId());
game.addDelayedTriggeredAbility(ability);
return true;
}
return false;
}
}
@ -172,9 +169,9 @@ class CyclopeanTombEffect extends OneShotEffect {
public CyclopeanTombEffect() {
super(Outcome.Benefit);
this.staticText = "at the beginning of each of your upkeeps for the rest of the game, remove all mire counters from a land that a mire counter was put onto with {this} but that a mire counter has not been removed from with {this}.";
this.staticText = "At the beginning of each of your upkeeps for the rest of the game, remove all mire counters from a land that a mire counter was put onto with {this} but that a mire counter has not been removed from with {this}";
}
public CyclopeanTombEffect(final CyclopeanTombEffect effect) {
super(effect);
}
@ -187,121 +184,52 @@ class CyclopeanTombEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if(controller != null){
new ChooseLandEffect().apply(game, source);
Effect effect = new RemoveAllCountersTargetEffect(CounterType.MIRE);
effect.setTargetPointer(new FixedTarget((UUID) game.getState().getValue(source.getSourceId().toString() + "_land")));
effect.apply(game, source);
//CyclopianTombEffect and CyclopeanTombDelayedTriggeredAbility will maintain a loop
//as long as there are one or more mire counters left to be removed
new ConditionalOneShotEffect(new CreateDelayedTriggeredAbilityEffect(new CyclopeanTombDelayedTriggeredAbility(), false), new CyclopeanTombCounterCondition()).apply(game, source);
return true;
}
return false;
}
}
class CyclopeanTombCounterCondition implements Condition {
private static final FilterLandPermanent mireFilter = new FilterLandPermanent();
static {
mireFilter.add(new CounterPredicate(CounterType.MIRE));
}
public CyclopeanTombCounterCondition() {
}
@Override
public boolean apply(Game game, Ability source) {
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(mireFilter, game);
Permanent cyclopeanTombInstance = game.getPermanentOrLKIBattlefield(source.getSourceId());
MageObjectReference mor = new MageObjectReference(source.getSourceId(), source.getSourceObjectZoneChangeCounter(), game);
CyclopeanTombCounterWatcher watcher = (CyclopeanTombCounterWatcher) game.getState().getWatchers().get(CyclopeanTombCounterWatcher.class.getName());
for(Permanent land : permanents) {
if(watcher.landMiredByCyclopeanTombInstance(land, cyclopeanTombInstance, game)) {
return land.getCounters(game).getCount(CounterType.MIRE) > 0;
if (controller != null && watcher != null) {
Set<MageObjectReference> landRef = watcher.landMiredByCyclopeanTombInstance(mor, game);
if (landRef == null || landRef.isEmpty()) { // no lands got mire counter from that instance
return true;
}
}
return false;
}
}
class ChooseLandEffect extends OneShotEffect {
public ChooseLandEffect() {
super(Outcome.Neutral);
this.staticText = "choose a land that a mire counter was put onto with Cyclopean Tomb but that a mire counter has not been removed from with Cyclopean Tomb";
}
public ChooseLandEffect(final ChooseLandEffect effect) {
super(effect);
}
@Override
public ChooseLandEffect copy() {
return new ChooseLandEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject mageObject = game.getPermanentEntering(source.getSourceId());
if (mageObject == null) {
mageObject = game.getObject(source.getSourceId());
}
FilterLandPermanent filter = new FilterLandPermanent();
filter.add(new LandIdPredicate(source));
if(controller != null && mageObject != null){
FilterLandPermanent filter = new FilterLandPermanent("a land with a mire counter added from the Cyclopean Tomb instance (" + landRef.size() + " left)");
Set<PermanentIdPredicate> idPref = new HashSet<>();
for (MageObjectReference ref : landRef) {
Permanent land = ref.getPermanent(game);
if (land != null) {
idPref.add(new PermanentIdPredicate(land.getId()));
}
}
filter.add(Predicates.or(idPref));
TargetLandPermanent target = new TargetLandPermanent(1, 1, filter, true);
/*Player must choose a land each upkeep. Using the message are above the player hand where frequent interactions
* take place is the most logical way to prompt for this scenario. A new constructor added to provide a not optional
* option for any cards like this where the player must choose a target in such the way this card requires.
*/
if (controller.chooseTarget(Outcome.Neutral, target, source, game, false)) {
*/
if (controller.chooseTarget(Outcome.Neutral, target, source, game)) {
Permanent chosenLand = game.getPermanent(target.getFirstTarget());
if(chosenLand != null) {
game.getState().setValue(mageObject.getId() + "_land", target.getFirstTarget());
if (mageObject instanceof Permanent) {
((Permanent) mageObject).addInfo("chosen land", CardUtil.addToolTipMarkTags("Chosen player: " + chosenLand.getLogName()), game);
}
return true;
if (chosenLand != null) {
Effect effect = new RemoveAllCountersTargetEffect(CounterType.MIRE);
effect.setTargetPointer(new FixedTarget(chosenLand, game));
effect.apply(game, source);
landRef.remove(new MageObjectReference(chosenLand, game));
}
}
return true;
}
return false;
}
}
class LandIdPredicate implements Predicate<Permanent> {
public Ability source;
public LandIdPredicate(Ability source) {
this.source = source;
}
@Override
public boolean apply(Permanent input, Game game) {
Permanent cyclopeanTombInstance = game.getPermanentOrLKIBattlefield(source.getSourceId());
CyclopeanTombCounterWatcher watcher = (CyclopeanTombCounterWatcher) game.getState().getWatchers().get(CyclopeanTombCounterWatcher.class.getName());
return watcher.landMiredByCyclopeanTombInstance(input, cyclopeanTombInstance, game);
}
}
class CyclopeanTombCounterWatcher extends Watcher {
public HashMap<MageObjectReference, Set<MageObjectReference>> counterData = new HashMap<>();
public CyclopeanTombCounterWatcher() {
super(CyclopeanTombCounterWatcher.class.getName(), WatcherScope.GAME);
}
public CyclopeanTombCounterWatcher(final CyclopeanTombCounterWatcher watcher) {
super(watcher);
for (MageObjectReference mageObjectReference : watcher.counterData.keySet()) {
@ -310,7 +238,7 @@ class CyclopeanTombCounterWatcher extends Watcher {
counterData.put(mageObjectReference, miredLands);
}
}
@Override
public CyclopeanTombCounterWatcher copy() {
return new CyclopeanTombCounterWatcher(this);
@ -318,27 +246,32 @@ class CyclopeanTombCounterWatcher extends Watcher {
@Override
public void watch(GameEvent event, Game game) {
if(event.getType() == GameEvent.EventType.COUNTER_ADDED || event.getType() == GameEvent.EventType.COUNTERS_ADDED) {
MageObjectReference cylopeanTombInstance = new MageObjectReference(/*ID needs to go here*/, game);
Set<MageObjectReference> miredLands = counterData.get(cylopeanTombInstance);
if (miredLands != null) {
if (event.getType() == GameEvent.EventType.COUNTERS_ADDED && event.getData().equals(CounterType.MIRE.getName()) && event.getAmount() > 0) {
Permanent tomb = game.getPermanentOrLKIBattlefield(event.getSourceId());
if (tomb != null) {
MageObjectReference cylopeanTombInstance = new MageObjectReference(tomb, game);
Set<MageObjectReference> miredLands;
if (counterData.containsKey(cylopeanTombInstance)) {
miredLands = counterData.get(cylopeanTombInstance);
} else {
miredLands = new HashSet<>();
counterData.put(cylopeanTombInstance, miredLands);
}
miredLands.add(new MageObjectReference(event.getTargetId(), game));
} else {
miredLands = new HashSet<>();
miredLands.add(new MageObjectReference(event.getTargetId(), game));
counterData.put(cylopeanTombInstance, miredLands);
}
}
}
@Override
public void reset() {
super.reset();
counterData.clear();
}
public boolean landMiredByCyclopeanTombInstance(Permanent land, Permanent cylopeanTombInstance, Game game) {
Set<MageObjectReference> miredLands = counterData.get(new MageObjectReference(cylopeanTombInstance, game));
return miredLands != null && miredLands.contains(new MageObjectReference(land, game));
public Set<MageObjectReference> landMiredByCyclopeanTombInstance(MageObjectReference mor, Game game) {
if (counterData.containsKey(mor)) {
return counterData.get(mor);
}
return null;
}
}

View file

@ -115,7 +115,7 @@ class CytoplastRootKinEffect extends OneShotEffect {
&& !sourcePermanent.getId().equals(targetPermanent.getId())
&& targetPermanent.getCounters(game).getCount(CounterType.P1P1) > 0) {
targetPermanent.removeCounters(CounterType.P1P1.createInstance(), game);
sourcePermanent.addCounters(CounterType.P1P1.createInstance(), game);
sourcePermanent.addCounters(CounterType.P1P1.createInstance(), source, game);
return true;
}
return false;

View file

@ -114,7 +114,7 @@ class MoveCounterFromTargetToTargetEffect extends OneShotEffect {
Permanent toPermanent = game.getPermanent(source.getTargets().get(1).getFirstTarget());
if (toPermanent != null) {
fromPermanent.removeCounters(CounterType.P1P1.createInstance(), game);
toPermanent.addCounters(CounterType.P1P1.createInstance(), game);
toPermanent.addCounters(CounterType.P1P1.createInstance(), source, game);
game.informPlayers(sourceObject.getLogName() + ": Moved a +1/+1 counter from " + fromPermanent.getLogName() +" to " + toPermanent.getLogName());
}
}

View file

@ -232,7 +232,7 @@ class DarkIntimationsReplacementEffect extends ReplacementEffectImpl {
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
if (creature != null) {
creature.addCounters(CounterType.LOYALTY.createInstance(), game);
creature.addCounters(CounterType.LOYALTY.createInstance(), source, game);
}
return false;
}

View file

@ -103,7 +103,7 @@ class DearlyDepartedEntersBattlefieldEffect extends ReplacementEffectImpl {
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent target = ((EntersTheBattlefieldEvent) event).getTarget();
if (target != null) {
target.addCounters(CounterType.P1P1.createInstance(), game);
target.addCounters(CounterType.P1P1.createInstance(), source, game);
}
return false;
}

View file

@ -98,7 +98,7 @@ class DeepglowSkateEffect extends OneShotEffect {
if (permanent != null) {
for (Counter counter : permanent.getCounters(game).values()) {
Counter newCounter = new Counter(counter.getName(), counter.getCount());
permanent.addCounters(newCounter, game);
permanent.addCounters(newCounter, source, game);
didOne = true;
}
}

View file

@ -87,7 +87,7 @@ class DefyDeathEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null && permanent.hasSubtype("Angel", game)) {
permanent.addCounters(CounterType.P1P1.createInstance(2), game);
permanent.addCounters(CounterType.P1P1.createInstance(2), source, game);
return true;
}
return false;

View file

@ -100,7 +100,7 @@ class DelayEffect extends OneShotEffect {
boolean hasSuspend = card.getAbilities().containsClass(SuspendAbility.class);
UUID exileId = SuspendAbility.getSuspendExileId(controller.getId(), game);
if (controller.moveCardToExileWithInfo(card, exileId, "Suspended cards of " + controller.getLogName(), source.getSourceId(), game, Zone.HAND, true)) {
card.addCounters(CounterType.TIME.createInstance(3), game);
card.addCounters(CounterType.TIME.createInstance(3), source, game);
if (!hasSuspend) {
game.addEffect(new GainSuspendEffect(new MageObjectReference(card, game)), source);
}

View file

@ -112,7 +112,7 @@ class DelifsCubeEffect extends OneShotEffect{
public boolean apply(Game game, Ability source) {
Permanent perm = game.getPermanent(cubeId);
if (perm == null) return false;
perm.addCounters(CounterType.CUBE.createInstance(), game);
perm.addCounters(CounterType.CUBE.createInstance(), source, game);
return true;
}
}

View file

@ -111,7 +111,7 @@ class DescentIntoMadnessEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (sourcePermanent != null && controller != null) {
sourcePermanent.addCounters(CounterType.DESPAIR.createInstance(), game);
sourcePermanent.addCounters(CounterType.DESPAIR.createInstance(), source, game);
}
if (sourcePermanent == null) {
sourcePermanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);

View file

@ -110,7 +110,7 @@ class DesecrationDemonEffect extends OneShotEffect {
permanent.sacrifice(source.getSourceId(), game);
game.informPlayers(opponent.getLogName() + " sacrifices " + permanent.getLogName() + " to tap " + descrationDemon.getLogName() + ". A +1/+1 counter was put on it");
descrationDemon.tap(game);
descrationDemon.addCounters(CounterType.P1P1.createInstance(), game);
descrationDemon.addCounters(CounterType.P1P1.createInstance(), source, game);
}
}
}

View file

@ -109,7 +109,7 @@ class DiregrafColossusEffect extends OneShotEffect {
int amount = 0;
amount += player.getGraveyard().count(filter, game);
if (amount > 0) {
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game);
}
return true;
}

View file

@ -29,7 +29,6 @@ package mage.cards.d;
import java.util.List;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.Mode;
@ -53,12 +52,12 @@ import mage.players.Player;
/**
*
* @author Gal Lerman
*
*/
public class DustOfMoments extends CardImpl {
public DustOfMoments(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{W}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{W}");
// Choose one - Remove two time counters from each permanent and each suspended card
this.getSpellAbility().addEffect(new RemoveCountersEffect());
@ -78,171 +77,172 @@ public class DustOfMoments extends CardImpl {
return new DustOfMoments(this);
}
//TODO: PermanentImpl.getCounters() and CardImpl.getCounters(game) don't return the same value for the same Card
//TODO: This means I can't use a Card generic for Permanents and Exiled cards and use Card.getCounters(game)
//TODO: This is the reason i've copy pasted some logic in DustOfMomentsEffect
//TODO: After this issue is fixed/explained i'll refactor the code
public abstract static class DustOfMomentsEffect extends OneShotEffect {
//TODO: PermanentImpl.getCounters() and CardImpl.getCounters(game) don't return the same value for the same Card
//TODO: This means I can't use a Card generic for Permanents and Exiled cards and use Card.getCounters(game)
//TODO: This is the reason i've copy pasted some logic in DustOfMomentsEffect
//TODO: After this issue is fixed/explained i'll refactor the code
public abstract static class DustOfMomentsEffect extends OneShotEffect {
private final Counter counter;
private final Filter<Card> permFilter;
private final Filter<Card> exiledFilter;
private final Counter counter;
private final Filter<Card> permFilter;
private final Filter<Card> exiledFilter;
public DustOfMomentsEffect() {
super(Outcome.Benefit);
this.counter = new Counter(CounterType.TIME.getName(), 2);
this.permFilter = new FilterCard("permanent and each suspended card");
permFilter.add(new CounterPredicate(CounterType.TIME));
public DustOfMomentsEffect() {
super(Outcome.Benefit);
this.counter = new Counter(CounterType.TIME.getName(), 2);
this.permFilter = new FilterCard("permanent and each suspended card");
permFilter.add(new CounterPredicate(CounterType.TIME));
this.exiledFilter = new FilterCard("permanent and each suspended card");
exiledFilter.add(new CardCounterPredicate(CounterType.TIME));
setText();
}
public DustOfMomentsEffect(final DustOfMomentsEffect effect) {
super(effect);
this.counter = effect.counter.copy();
this.permFilter = effect.permFilter.copy();
this.exiledFilter = effect.exiledFilter.copy();
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null && sourceObject != null) {
updatePermanents(game, controller, sourceObject);
updateSuspended(game, controller, sourceObject);
return true;
}
return false;
}
private void updateSuspended(final Game game, final Player controller, final MageObject sourceObject) {
final List<Card> exiledCards = game.getExile().getAllCards(game);
execute(game, controller, sourceObject, exiledCards);
}
private void updatePermanents(final Game game, final Player controller, final MageObject sourceObject) {
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents();
executeP(game, controller, sourceObject, permanents);
}
private void executeP(final Game game, final Player controller, final MageObject sourceObject, final List<Permanent> cards) {
if (cards == null || cards.isEmpty()) {
return;
}
for (Permanent card : cards) {
if (permFilter.match(card, game)) {
final String counterName = counter.getName();
if (shouldRemoveCounters()) {
final Counter existingCounterOfSameType = card.getCounters(game).get(counterName);
final int countersToRemove = Math.min(existingCounterOfSameType.getCount(), counter.getCount());
final Counter modifiedCounter = new Counter(counterName, countersToRemove);
card.removeCounters(modifiedCounter, game);
} else {
card.addCounters(counter, game);
}
if (!game.isSimulation())
game.informPlayers(new StringBuilder(sourceObject.getName()).append(": ")
.append(controller.getLogName()).append(getActionStr()).append("s")
.append(counter.getCount()).append(" ").append(counterName.toLowerCase())
.append(" counter on ").append(card.getName()).toString());
}
}
}
private void execute(final Game game, final Player controller, final MageObject sourceObject, final List<Card> cards) {
if (cards == null || cards.isEmpty()) {
return;
}
for (Card card : cards) {
if (exiledFilter.match(card, game)) {
final String counterName = counter.getName();
if (shouldRemoveCounters()) {
final Counter existingCounterOfSameType = card.getCounters(game).get(counterName);
final int countersToRemove = Math.min(existingCounterOfSameType.getCount(), counter.getCount());
final Counter modifiedCounter = new Counter(counterName, countersToRemove);
card.removeCounters(modifiedCounter, game);
} else {
card.addCounters(counter, game);
}
if (!game.isSimulation())
game.informPlayers(new StringBuilder(sourceObject.getName()).append(": ")
.append(controller.getLogName()).append(getActionStr()).append("s ")
.append(counter.getCount()).append(" ").append(counterName.toLowerCase())
.append(" counter on ").append(card.getName()).toString());
this.exiledFilter = new FilterCard("permanent and each suspended card");
exiledFilter.add(new CardCounterPredicate(CounterType.TIME));
setText();
}
public DustOfMomentsEffect(final DustOfMomentsEffect effect) {
super(effect);
this.counter = effect.counter.copy();
this.permFilter = effect.permFilter.copy();
this.exiledFilter = effect.exiledFilter.copy();
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null && sourceObject != null) {
updatePermanents(source, game, controller, sourceObject);
updateSuspended(source, game, controller, sourceObject);
return true;
}
return false;
}
private void updateSuspended(final Ability source, final Game game, final Player controller, final MageObject sourceObject) {
final List<Card> exiledCards = game.getExile().getAllCards(game);
execute(source, game, controller, sourceObject, exiledCards);
}
private void updatePermanents(final Ability source, final Game game, final Player controller, final MageObject sourceObject) {
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents();
executeP(source, game, controller, sourceObject, permanents);
}
private void executeP(final Ability source, final Game game, final Player controller, final MageObject sourceObject, final List<Permanent> cards) {
if (cards == null || cards.isEmpty()) {
return;
}
for (Permanent card : cards) {
if (permFilter.match(card, game)) {
final String counterName = counter.getName();
if (shouldRemoveCounters()) {
final Counter existingCounterOfSameType = card.getCounters(game).get(counterName);
final int countersToRemove = Math.min(existingCounterOfSameType.getCount(), counter.getCount());
final Counter modifiedCounter = new Counter(counterName, countersToRemove);
card.removeCounters(modifiedCounter, game);
} else {
card.addCounters(counter, source, game);
}
if (!game.isSimulation()) {
game.informPlayers(new StringBuilder(sourceObject.getName()).append(": ")
.append(controller.getLogName()).append(getActionStr()).append("s")
.append(counter.getCount()).append(" ").append(counterName.toLowerCase())
.append(" counter on ").append(card.getName()).toString());
}
}
}
}
private void execute(final Ability source, final Game game, final Player controller, final MageObject sourceObject, final List<Card> cards) {
if (cards == null || cards.isEmpty()) {
return;
}
for (Card card : cards) {
if (exiledFilter.match(card, game)) {
final String counterName = counter.getName();
if (shouldRemoveCounters()) {
final Counter existingCounterOfSameType = card.getCounters(game).get(counterName);
final int countersToRemove = Math.min(existingCounterOfSameType.getCount(), counter.getCount());
final Counter modifiedCounter = new Counter(counterName, countersToRemove);
card.removeCounters(modifiedCounter, game);
} else {
card.addCounters(counter, source, game);
}
if (!game.isSimulation()) {
game.informPlayers(new StringBuilder(sourceObject.getName()).append(": ")
.append(controller.getLogName()).append(getActionStr()).append("s ")
.append(counter.getCount()).append(" ").append(counterName.toLowerCase())
.append(" counter on ").append(card.getName()).toString());
}
}
}
}
protected abstract boolean shouldRemoveCounters();
protected abstract String getActionStr();
private void setText() {
StringBuilder sb = new StringBuilder();
sb.append(getActionStr());
if (counter.getCount() > 1) {
sb.append(Integer.toString(counter.getCount())).append(" ").append(counter.getName().toLowerCase()).append(" counters on each ");
} else {
sb.append("a ").append(counter.getName().toLowerCase()).append(" counter on each ");
}
sb.append(permFilter.getMessage());
staticText = sb.toString();
}
}
}
protected abstract boolean shouldRemoveCounters();
public static class AddCountersEffect extends DustOfMomentsEffect {
protected abstract String getActionStr();
public AddCountersEffect() {
super();
}
private void setText() {
StringBuilder sb = new StringBuilder();
sb.append(getActionStr());
if (counter.getCount() > 1) {
sb.append(Integer.toString(counter.getCount())).append(" ").append(counter.getName().toLowerCase()).append(" counters on each ");
} else {
sb.append("a ").append(counter.getName().toLowerCase()).append(" counter on each ");
}
sb.append(permFilter.getMessage());
staticText = sb.toString();
}
}
public AddCountersEffect(final DustOfMomentsEffect effect) {
super(effect);
}
public static class AddCountersEffect extends DustOfMomentsEffect {
@Override
protected boolean shouldRemoveCounters() {
return false;
}
public AddCountersEffect() {
super();
@Override
protected String getActionStr() {
return "add";
}
@Override
public Effect copy() {
return new AddCountersEffect(this);
}
}
public AddCountersEffect(final DustOfMomentsEffect effect) {
super(effect);
}
public static class RemoveCountersEffect extends DustOfMomentsEffect {
@Override
protected boolean shouldRemoveCounters() {
return false;
}
public RemoveCountersEffect() {
super();
}
@Override
protected String getActionStr() {
return "add";
}
public RemoveCountersEffect(final DustOfMomentsEffect effect) {
super(effect);
}
@Override
public Effect copy() {
return new AddCountersEffect(this);
}
}
@Override
protected boolean shouldRemoveCounters() {
return true;
}
public static class RemoveCountersEffect extends DustOfMomentsEffect {
@Override
protected String getActionStr() {
return "remove";
}
public RemoveCountersEffect() {
super();
@Override
public Effect copy() {
return new RemoveCountersEffect(this);
}
}
public RemoveCountersEffect(final DustOfMomentsEffect effect) {
super(effect);
}
@Override
protected boolean shouldRemoveCounters() {
return true;
}
@Override
protected String getActionStr() {
return "remove";
}
@Override
public Effect copy() {
return new RemoveCountersEffect(this);
}
}
}

View file

@ -115,7 +115,7 @@ class EbonPraetorEffect extends OneShotEffect {
Permanent sacrificedCreature = ((SacrificeTargetCost) cost).getPermanents().get(0);
Permanent sourceCreature = game.getPermanent(source.getSourceId());
if (sacrificedCreature.hasSubtype("Thrull", game) && sourceCreature != null) {
sourceCreature.addCounters(CounterType.P1P0.createInstance(), game);
sourceCreature.addCounters(CounterType.P1P0.createInstance(), source, game);
return true;
}
}

View file

@ -96,9 +96,9 @@ class ElderCatharAddCountersTargetEffect extends OneShotEffect {
if (permanent != null) {
if (counter != null) {
if (permanent.hasSubtype("Human", game)) {
permanent.addCounters(counter2.copy(), game);
permanent.addCounters(counter2.copy(), source, game);
} else {
permanent.addCounters(counter.copy(), game);
permanent.addCounters(counter.copy(), source, game);
}
return true;
}

View file

@ -108,7 +108,7 @@ class EpochrasiteEffect extends OneShotEffect {
if (game.getState().getZone(card.getId()).equals(Zone.GRAVEYARD)) {
UUID exileId = SuspendAbility.getSuspendExileId(controller.getId(), game);
controller.moveCardToExileWithInfo(card, exileId, "Suspended cards of " + controller.getName(), source.getSourceId(), game, Zone.GRAVEYARD, true);
card.addCounters(CounterType.TIME.createInstance(3), game);
card.addCounters(CounterType.TIME.createInstance(3), source, game);
game.addEffect(new GainSuspendEffect(new MageObjectReference(card, game)), source);
}
return true;

View file

@ -86,7 +86,7 @@ class EternityVesselEffect extends OneShotEffect {
if (vessel != null && controller != null) {
int amount = controller.getLife();
if (amount > 0) {
vessel.addCounters(CounterType.CHARGE.createInstance(amount), game);
vessel.addCounters(CounterType.CHARGE.createInstance(amount), source, game);
}
return true;

View file

@ -105,7 +105,7 @@ class DamageDealtAsIfSourceHadWitherEffect extends ReplacementEffectImpl {
Counter counter = CounterType.M1M1.createInstance(damageAmount);
Permanent creatureDamaged = game.getPermanent(event.getTargetId());
if (creatureDamaged != null) {
creatureDamaged.addCounters(counter, game);
creatureDamaged.addCounters(counter, source, game);
}
}
return true;

View file

@ -96,7 +96,7 @@ class EvolutionaryEscalationEffect extends OneShotEffect {
for (Target target: source.getTargets()) {
Permanent targetPermanent = game.getPermanent(target.getFirstTarget());
if (targetPermanent != null) {
targetPermanent.addCounters(counter.copy(), game);
targetPermanent.addCounters(counter.copy(), source, game);
addedCounters = true;
}
}

View file

@ -123,7 +123,7 @@ class EyeOfDoomEffect extends OneShotEffect {
} while (!player.getId().equals(game.getActivePlayerId()));
for (Permanent permanent: permanents) {
permanent.addCounters(CounterType.DOOM.createInstance(), game);
permanent.addCounters(CounterType.DOOM.createInstance(), source, game);
}
return true;

View file

@ -119,7 +119,7 @@ class EzuriClawOfProgressEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
int amount = controller.getCounters().getCount(CounterType.EXPERIENCE);
target.addCounters(CounterType.P1P1.createInstance(amount), game);
target.addCounters(CounterType.P1P1.createInstance(amount), source, game);
}
return false;
}

View file

@ -106,7 +106,7 @@ class FalkenrathAristocratEffect extends OneShotEffect {
Permanent sacrificedCreature = ((SacrificeTargetCost) cost).getPermanents().get(0);
Permanent sourceCreature = game.getPermanent(source.getSourceId());
if (sacrificedCreature.hasSubtype("Human", game) && sourceCreature != null) {
sourceCreature.addCounters(CounterType.P1P1.createInstance(), game);
sourceCreature.addCounters(CounterType.P1P1.createInstance(), source, game);
return true;
}
}

View file

@ -102,7 +102,7 @@ class FalkenrathTorturerEffect extends OneShotEffect {
Permanent sacrificedCreature = ((SacrificeTargetCost) cost).getPermanents().get(0);
Permanent sourceCreature = game.getPermanent(source.getSourceId());
if (sacrificedCreature.hasSubtype("Human", game) && sourceCreature != null) {
sourceCreature.addCounters(CounterType.P1P1.createInstance(), game);
sourceCreature.addCounters(CounterType.P1P1.createInstance(), source, game);
return true;
}
}

View file

@ -103,7 +103,7 @@ class FateTransferEffect extends OneShotEffect {
Permanent copyCreature = creatureToMoveCountersFrom.copy();
for (Counter counter : copyCreature.getCounters(game).values()) {
creatureToMoveCountersFrom.removeCounters(counter, game);
creatureToMoveCountersTo.addCounters(counter, game);
creatureToMoveCountersTo.addCounters(counter, source, game);
}
return true;
}

View file

@ -86,7 +86,7 @@ class FearsomeAwakeningEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null && permanent.hasSubtype("Dragon", game)) {
permanent.addCounters(CounterType.P1P1.createInstance(2), game);
permanent.addCounters(CounterType.P1P1.createInstance(2), source, game);
return true;
}
return false;

View file

@ -104,7 +104,7 @@ class FleshEffect extends OneShotEffect {
if (power > 0) {
Permanent targetCreature = game.getPermanent(source.getTargets().get(1).getFirstTarget());
if (targetCreature != null) {
targetCreature.addCounters(CounterType.P1P1.createInstance(power), game);
targetCreature.addCounters(CounterType.P1P1.createInstance(power), source, game);
}
}
return true;

View file

@ -149,7 +149,7 @@ public class ForgottenAncient extends CardImpl {
//Move all the counters for each chosen creature
for(CounterMovement cm: counterMovements) {
sourcePermanent.removeCounters(CounterType.P1P1.createInstance(cm.counters), game);
game.getPermanent(cm.target).addCounters(CounterType.P1P1.createInstance(cm.counters), game);
game.getPermanent(cm.target).addCounters(CounterType.P1P1.createInstance(cm.counters), source, game);
}
return true;
}

View file

@ -104,7 +104,7 @@ class FulfillContractEffect extends OneShotEffect {
if (controller != null) {
if (permanentToDestroy != null && permanentToDestroy.destroy(source.getSourceId(), game, false)) {
if (permanentToPutCounter != null) {
permanentToPutCounter.addCounters(CounterType.P1P1.createInstance(), game);
permanentToPutCounter.addCounters(CounterType.P1P1.createInstance(), source, game);
}
}
return true;

View file

@ -149,7 +149,7 @@ class GemstoneCavernsEffect extends OneShotEffect {
if (card.putOntoBattlefield(game, Zone.HAND, source.getSourceId(), source.getControllerId())) {
Permanent permanent = game.getPermanent(card.getId());
if (permanent != null) {
permanent.addCounters(CounterType.LUCK.createInstance(), game);
permanent.addCounters(CounterType.LUCK.createInstance(), source, game);
Cost cost = new ExileFromHandCost(new TargetCardInHand());
if (cost.canPay(source, source.getSourceId(), source.getControllerId(), game)) {
cost.pay(source, game, source.getSourceId(), source.getControllerId(), true, null);

View file

@ -107,7 +107,7 @@ class GilderBairnEffect extends OneShotEffect {
}
for (Counter counter : target.getCounters(game).values()) {
Counter newCounter = new Counter(counter.getName(), counter.getCount());
target.addCounters(newCounter, game);
target.addCounters(newCounter, source, game);
}
return false;
}

View file

@ -102,7 +102,7 @@ class GlisteningOilEffect extends OneShotEffect {
if (enchantment != null && enchantment.getAttachedTo() != null) {
Permanent creature = game.getPermanent(enchantment.getAttachedTo());
if (creature != null) {
creature.addCounters(CounterType.M1M1.createInstance(), game);
creature.addCounters(CounterType.M1M1.createInstance(), source, game);
}
}
return true;

View file

@ -107,7 +107,7 @@ class GolgariGraveTrollEffect extends OneShotEffect {
if (permanent != null && player != null) {
int amount = player.getGraveyard().count(filter, game);
if (amount > 0) {
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game);
}
return true;
}

View file

@ -146,7 +146,7 @@ class GraveBetrayalEffect extends OneShotEffect {
Zone currentZone = game.getState().getZone(card.getId());
if (card.putOntoBattlefield(game, currentZone, source.getSourceId(), source.getControllerId())) {
Permanent creature = game.getPermanent(card.getId());
creature.addCounters(CounterType.P1P1.createInstance(), game);
creature.addCounters(CounterType.P1P1.createInstance(), source, game);
ContinuousEffect effect = new GraveBetrayalContiniousEffect();
effect.setTargetPointer(new FixedTarget(creature.getId()));
game.addEffect(effect, source);

View file

@ -97,7 +97,7 @@ class GriefTyrantEffect extends OneShotEffect {
Permanent griefTyrant = game.getPermanentOrLKIBattlefield(source.getSourceId());
int countersOnGriefTyrant = griefTyrant.getCounters(game).getCount(CounterType.M1M1);
if (targetCreature != null) {
targetCreature.addCounters(CounterType.M1M1.createInstance(countersOnGriefTyrant), game);
targetCreature.addCounters(CounterType.M1M1.createInstance(countersOnGriefTyrant), source, game);
return true;
}
return false;

View file

@ -109,7 +109,7 @@ class GwafaHazidProfiteerEffect1 extends OneShotEffect {
Permanent targetCreature = game.getPermanent(source.getFirstTarget());
if (targetCreature != null) {
Player controller = game.getPlayer(targetCreature.getControllerId());
targetCreature.addCounters(CounterType.BRIBERY.createInstance(), game);
targetCreature.addCounters(CounterType.BRIBERY.createInstance(), source, game);
if (controller != null) {
controller.drawCards(1, game);
}

View file

@ -131,7 +131,7 @@ class HamletbackGoliathEffect extends OneShotEffect {
creature = (Permanent) game.getLastKnownInformation(targetPointer.getFirst(game, source), Zone.BATTLEFIELD);
}
if (creature != null && sourceObject != null) {
sourceObject.addCounters(CounterType.P1P1.createInstance(creature.getPower().getValue()), game);
sourceObject.addCounters(CounterType.P1P1.createInstance(creature.getPower().getValue()), source, game);
}
return true;
}

View file

@ -106,7 +106,7 @@ class HankyuAddCounterEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Permanent equipment = game.getPermanent(this.effectGivingEquipmentId);
if (equipment != null) {
equipment.addCounters(CounterType.AIM.createInstance(), game);
equipment.addCounters(CounterType.AIM.createInstance(), source, game);
}
return true;
}

View file

@ -56,7 +56,7 @@ import mage.target.common.TargetCreatureOrPlayer;
public class HatchetBully extends CardImpl {
public HatchetBully(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{R}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}");
this.subtype.add("Goblin");
this.subtype.add("Warrior");
@ -104,7 +104,7 @@ class HatchetBullyCost extends CostImpl {
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
Permanent permanent = game.getPermanent(ability.getTargets().get(1).getFirstTarget());
if (permanent != null) {
permanent.addCounters(CounterType.M1M1.createInstance(), game);
permanent.addCounters(CounterType.M1M1.createInstance(), ability, game);
this.paid = true;
}
return paid;
@ -117,7 +117,7 @@ class HatchetBullyCost extends CostImpl {
}
class HatchetBullyEffect extends OneShotEffect {
public HatchetBullyEffect() {
super(Outcome.Damage);
staticText = "{this} deals 2 damage to target creature or player";

View file

@ -103,7 +103,7 @@ class ImmaculateMagistrateEffect extends OneShotEffect {
if (permanent != null) {
int count = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game);
if (count > 0) {
permanent.addCounters(CounterType.P1P1.createInstance(count), game);
permanent.addCounters(CounterType.P1P1.createInstance(count), source, game);
return true;
}
}

View file

@ -91,7 +91,7 @@ class IncreasingSavageryEffect extends OneShotEffect {
}
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
if (permanent != null) {
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game);
}
return true;
}

View file

@ -105,7 +105,7 @@ class IncrementalBlightEffect extends OneShotEffect {
i++;
Permanent creature = game.getPermanent(target.getFirstTarget());
if (creature != null) {
creature.addCounters(CounterType.M1M1.createInstance(i), game);
creature.addCounters(CounterType.M1M1.createInstance(i), source, game);
}
}
return false;

View file

@ -106,7 +106,7 @@ class IncrementalGrowthEffect extends OneShotEffect {
i++;
Permanent creature = game.getPermanent(target.getFirstTarget());
if (creature != null) {
creature.addCounters(CounterType.P1P1.createInstance(i), game);
creature.addCounters(CounterType.P1P1.createInstance(i), source, game);
}
}
return false;

View file

@ -91,7 +91,7 @@ class InsatiableRakghoulEffect extends OneShotEffect {
if (watcher != null && watcher.conditionMet()) {
Permanent permanent = game.getPermanentEntering(source.getSourceId());
if (permanent != null) {
permanent.addCounters(CounterType.P1P1.createInstance(1), game);
permanent.addCounters(CounterType.P1P1.createInstance(1), source, game);
}
}
return true;

View file

@ -118,7 +118,7 @@ class JhoiraOfTheGhituSuspendEffect extends OneShotEffect {
UUID exileId = SuspendAbility.getSuspendExileId(controller.getId(), game);
if (controller.moveCardToExileWithInfo(card, exileId, "Suspended cards of " + controller.getName(), source.getSourceId(), game, Zone.HAND, true)) {
card.addCounters(CounterType.TIME.createInstance(4), game);
card.addCounters(CounterType.TIME.createInstance(4), source, game);
if (!hasSuspend) {
game.addEffect(new GainSuspendEffect(new MageObjectReference(card, game)), source);
}

View file

@ -106,7 +106,7 @@ class JhoirasTimebugEffect extends OneShotEffect {
Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source));
if (permanent != null && permanent.getCounters(game).containsKey(CounterType.TIME)) {
if (controller.chooseUse(Outcome.Benefit, "Add a time counter? (Otherwise remove one)", source, game)) {
permanent.addCounters(CounterType.TIME.createInstance(), game);
permanent.addCounters(CounterType.TIME.createInstance(), source, game);
}
else {
permanent.removeCounters(CounterType.TIME.createInstance(), game);
@ -116,7 +116,7 @@ class JhoirasTimebugEffect extends OneShotEffect {
Card card = game.getExile().getCard(this.getTargetPointer().getFirst(game, source), game);
if (card != null) {
if (controller.chooseUse(Outcome.Detriment, "Add a time counter? (Otherwise remove one)", source, game)) {
card.addCounters(CounterType.TIME.createInstance(), game);
card.addCounters(CounterType.TIME.createInstance(), source, game);
}
else {
card.removeCounters(CounterType.TIME.createInstance(), game);

View file

@ -109,7 +109,7 @@ class KalonianHydraEffect extends OneShotEffect {
for (Permanent permanent : permanents) {
int existingCounters = permanent.getCounters(game).getCount(CounterType.P1P1);
if (existingCounters > 0) {
permanent.addCounters(CounterType.P1P1.createInstance(existingCounters), game);
permanent.addCounters(CounterType.P1P1.createInstance(existingCounters), source, game);
}
}
return true;

View file

@ -131,7 +131,7 @@ class KavuPredatorEffect extends OneShotEffect {
if (permanent != null) {
Integer gainedLife = (Integer) this.getValue("gainedLife");
if (gainedLife != null) {
permanent.addCounters(CounterType.P1P1.createInstance(gainedLife.intValue()), game);
permanent.addCounters(CounterType.P1P1.createInstance(gainedLife.intValue()), source, game);
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
game.informPlayers(new StringBuilder(player.getLogName()).append(" puts ").append(gainedLife).append(" +1/+1 counter on ").append(permanent.getName()).toString());

View file

@ -89,7 +89,7 @@ class KreshTheBloodbraidedEffect extends OneShotEffect {
if (permanent != null && kreshTheBloodbraided != null) {
int amount = permanent.getPower().getValue();
if (amount > 0) {
kreshTheBloodbraided.addCounters(CounterType.P1P1.createInstance(amount), game);
kreshTheBloodbraided.addCounters(CounterType.P1P1.createInstance(amount), source, game);
}
return true;
}

View file

@ -129,7 +129,7 @@ class LeechBonderEffect extends OneShotEffect {
if (counterType != null) {
Counter counter = counterType.createInstance();
fromPermanent.removeCounters(counter, game);
toPermanent.addCounters(counter, game);
toPermanent.addCounters(counter, source, game);
return true;
}
}

View file

@ -97,7 +97,7 @@ class LieutenantsOfTheGuardDilemmaEffect extends CouncilsDilemmaVoteEffect {
//Strength Votes
//If strength received zero votes or the permanent is no longer on the battlefield, do not attempt to put P1P1 counters on it.
if (voteOneCount > 0 && permanent != null)
permanent.addCounters(CounterType.P1P1.createInstance(voteOneCount), game);
permanent.addCounters(CounterType.P1P1.createInstance(voteOneCount), source, game);
//Numbers Votes
if (voteTwoCount > 0) {

View file

@ -140,7 +140,7 @@ class LightningStormAddCounterEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Spell spell = game.getStack().getSpell(source.getSourceId());
if (spell != null) {
spell.addCounters(CounterType.CHARGE.createInstance(2), game);
spell.addCounters(CounterType.CHARGE.createInstance(2), source, game);
return spell.chooseNewTargets(game, ((ActivatedAbilityImpl) source).getActivatorId(), false, false, null);
}
return false;

View file

@ -89,7 +89,7 @@ public class LivingArmor extends CardImpl {
Permanent creature = game.getPermanent(source.getTargets().getFirstTarget());
if (creature != null) {
int amount = creature.getConvertedManaCost();
creature.addCounters(new BoostCounter(0, 1, amount), game);
creature.addCounters(new BoostCounter(0, 1, amount), source, game);
return true;
}
return false;

View file

@ -99,7 +99,7 @@ class LockjawSnapperEffect extends OneShotEffect {
}
for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
if (creature != null) {
creature.addCounters(CounterType.M1M1.createInstance(), game);
creature.addCounters(CounterType.M1M1.createInstance(), source, game);
applied = true;
}
}

View file

@ -189,7 +189,7 @@ class LongRoadHomeEntersBattlefieldEffect extends ReplacementEffectImpl {
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (permanent != null) {
permanent.addCounters(CounterType.P1P1.createInstance(), game);
permanent.addCounters(CounterType.P1P1.createInstance(), source, game);
discard(); // use only once
}
return false;

View file

@ -107,7 +107,7 @@ class MasterBiomancerEntersBattlefieldEffect extends ReplacementEffectImpl {
if (sourceCreature != null && creature != null) {
int power = sourceCreature.getPower().getValue();
if (power > 0) {
creature.addCounters(CounterType.P1P1.createInstance(power), game);
creature.addCounters(CounterType.P1P1.createInstance(power), source, game);
}
ContinuousEffect effect = new AddCardSubTypeTargetEffect("Mutant", Duration.Custom);
effect.setTargetPointer(new FixedTarget(creature.getId(), creature.getZoneChangeCounter(game) + 1));

View file

@ -97,7 +97,7 @@ class MayaelsAriaEffect extends OneShotEffect {
filter.add(new PowerPredicate(Filter.ComparisonType.GreaterThan, 4));
if (game.getState().getBattlefield().countAll(filter, controller.getId(), game) > 0) {
for (Permanent creature : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game)) {
creature.addCounters(CounterType.P1P1.createInstance(), game);
creature.addCounters(CounterType.P1P1.createInstance(), source, game);
}
}
game.applyEffects(); // needed because otehrwise the +1/+1 counters wouldn't be taken into account

View file

@ -91,7 +91,7 @@ class MeadowboonEffect extends OneShotEffect {
Player target = game.getPlayer(source.getFirstTarget());
if (target != null) {
for (Permanent p : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), target.getId(), game)) {
p.addCounters(CounterType.P1P1.createInstance(), game);
p.addCounters(CounterType.P1P1.createInstance(), source, game);
}
return true;
}

View file

@ -99,7 +99,7 @@ class MessengerJaysDilemmaEffect extends CouncilsDilemmaVoteEffect {
//Feathers Votes
//If feathers received zero votes or the permanent is no longer on the battlefield, do not attempt to put P1P1 counter on it.
if (voteOneCount > 0 && permanent != null)
permanent.addCounters(CounterType.P1P1.createInstance(voteOneCount), game);
permanent.addCounters(CounterType.P1P1.createInstance(voteOneCount), source, game);
//Quill Votes
//Only let the controller loot the appropriate amount of cards if it was voted for.

View file

@ -90,7 +90,7 @@ class MiraculousRecoveryEffect extends OneShotEffect {
// targetPointer can't be used because target moved from graveyard to battlefield
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
permanent.addCounters(CounterType.P1P1.createInstance(), game);
permanent.addCounters(CounterType.P1P1.createInstance(), source, game);
}
return false;
}

View file

@ -91,7 +91,7 @@ class NantukoCultivatorEffect extends OneShotEffect {
}
Permanent permanent = game.getPermanent(source.getSourceId());
if(permanent != null) {
permanent.addCounters(CounterType.P1P1.createInstance(count), game);
permanent.addCounters(CounterType.P1P1.createInstance(count), source, game);
}
player.drawCards(count, game);
}

View file

@ -154,7 +154,7 @@ class NayaSoulbeastReplacementEffect extends ReplacementEffectImpl {
Permanent permanent = game.getPermanentEntering(source.getSourceId());
if (permanent != null && object instanceof Integer) {
int amount = ((Integer) object);
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game);
}
return false;
}

View file

@ -93,7 +93,7 @@ class NecromanticSummoningEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
permanent.addCounters(CounterType.P1P1.createInstance(2), game);
permanent.addCounters(CounterType.P1P1.createInstance(2), source, game);
return true;
}
return false;

View file

@ -143,7 +143,7 @@ public class NightDealings extends CardImpl {
if (damageAmount != null) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
permanent.addCounters(CounterType.THEFT.createInstance(damageAmount), game);
permanent.addCounters(CounterType.THEFT.createInstance(damageAmount), source, game);
return true;
}
}

View file

@ -97,7 +97,7 @@ class NovijenHeartOfProgressEffect extends OneShotEffect {
if (controller != null && sourceObject != null) {
for (Permanent permanent: game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game)) {
if (permanent.getTurnsOnBattlefield() == 0) {
permanent.addCounters(CounterType.P1P1.createInstance(), game);
permanent.addCounters(CounterType.P1P1.createInstance(), source, game);
game.informPlayers(sourceObject.getLogName()+ ": " + controller.getLogName() + " puts a +1/+1 counter on " + permanent.getLogName());
}
}

View file

@ -106,7 +106,7 @@ class OathOfGideonReplacementEffect extends ReplacementEffectImpl {
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
if (creature != null) {
creature.addCounters(CounterType.LOYALTY.createInstance(), game);
creature.addCounters(CounterType.LOYALTY.createInstance(), source, game);
}
return false;
}

View file

@ -121,7 +121,7 @@ class OonasBlackguardReplacementEffect extends ReplacementEffectImpl {
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
if (creature != null) {
creature.addCounters(CounterType.P1P1.createInstance(), game);
creature.addCounters(CounterType.P1P1.createInstance(), source, game);
}
return false;
}

View file

@ -167,7 +167,7 @@ class OpalPalaceEntersBattlefieldEffect extends ReplacementEffectImpl {
if (permanent != null) {
Integer castCount = (Integer) game.getState().getValue(permanent.getId() + "_castCount");
if (castCount != null && castCount > 0) {
permanent.addCounters(CounterType.P1P1.createInstance(castCount), game);
permanent.addCounters(CounterType.P1P1.createInstance(castCount), source, game);
}
}
return false;

View file

@ -144,9 +144,9 @@ class OranRiefHydraEffect extends OneShotEffect {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (land != null && sourcePermanent != null) {
if (land.hasSubtype("Forest", game)) {
sourcePermanent.addCounters(CounterType.P1P1.createInstance(2), game);
sourcePermanent.addCounters(CounterType.P1P1.createInstance(2), source, game);
} else {
sourcePermanent.addCounters(CounterType.P1P1.createInstance(), game);
sourcePermanent.addCounters(CounterType.P1P1.createInstance(), source, game);
}
return true;
}

View file

@ -95,7 +95,7 @@ class OranRiefTheVastwoodEffect extends OneShotEffect {
filter.add(new ColorPredicate(ObjectColor.GREEN));
for (Permanent permanent: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
if (permanent.getTurnsOnBattlefield() == 0) {
permanent.addCounters(CounterType.P1P1.createInstance(), game);
permanent.addCounters(CounterType.P1P1.createInstance(), source, game);
}
}
return true;

View file

@ -95,7 +95,7 @@ class OrchardElementalDilemmaEffect extends CouncilsDilemmaVoteEffect {
//Sprout Votes
//If sprout received zero votes or the permanent is no longer on the battlefield, do not attempt to put P1P1 counter on it.
if (voteOneCount > 0 && permanent != null)
permanent.addCounters(CounterType.P1P1.createInstance(voteOneCount * 2), game);
permanent.addCounters(CounterType.P1P1.createInstance(voteOneCount * 2), source, game);
//Harvest Votes
if (voteTwoCount > 0) {

View file

@ -117,7 +117,7 @@ class OrzhovAdvokistEffect extends OneShotEffect {
for (UUID creatureId : creatures) {
Permanent creature = game.getPermanent(creatureId);
if (creature != null) {
creature.addCounters(CounterType.P1P1.createInstance(2), game);
creature.addCounters(CounterType.P1P1.createInstance(2), source, game);
}
}
for (UUID playerId : players) {

View file

@ -184,7 +184,7 @@ class OtherworldlyJourneyEntersBattlefieldEffect extends ReplacementEffectImpl {
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (permanent != null) {
permanent.addCounters(CounterType.P1P1.createInstance(), game);
permanent.addCounters(CounterType.P1P1.createInstance(), source, game);
discard(); // use only once
}
return false;

View file

@ -114,7 +114,7 @@ class PardicDragonEffect extends OneShotEffect {
Card sourceCard = game.getCard(source.getSourceId());
if (opponent != null && sourceCard != null) {
if (opponent.chooseUse(outcome, new StringBuilder("Put a time counter on ").append(sourceCard.getName()).append("?").toString(), source, game)) {
sourceCard.addCounters(CounterType.TIME.createInstance(), game);
sourceCard.addCounters(CounterType.TIME.createInstance(), source, game);
}
return true;
}

Some files were not shown because too many files have changed in this diff Show more