Merge remote-tracking branch 'upstream/master'

This commit is contained in:
MTGfan 2016-12-27 20:29:31 -05:00
commit cf93656f0d
263 changed files with 2675 additions and 2243 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

@ -72,7 +72,7 @@ public class AjaniSteadfast extends CardImpl {
}
public AjaniSteadfast(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{3}{W}");
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{3}{W}");
this.subtype.add("Ajani");
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(4));
@ -117,7 +117,7 @@ public class AjaniSteadfast extends CardImpl {
class AjaniSteadfastEmblem extends Emblem {
public AjaniSteadfastEmblem() {
setName("EMBLEM: Ajani Steadfast");
setName("Emblem Ajani");
this.getAbilities().add(new SimpleStaticAbility(Zone.COMMAND, new AjaniSteadfastPreventEffect()));
this.setExpansionSetCodeForImage("M15");
}

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

@ -63,7 +63,7 @@ public class ArlinnEmbracedByTheMoon extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures you control");
public ArlinnEmbracedByTheMoon(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"");
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "");
this.subtype.add("Arlinn");
this.color.setRed(true);
this.color.setGreen(true);
@ -105,7 +105,7 @@ class ArlinnEmbracedByTheMoonEmblem extends Emblem {
// "Creatures you control have haste and '{T}: This creature deals damage equal to its power to target creature or player.'"
public ArlinnEmbracedByTheMoonEmblem() {
this.setName("EMBLEM: Arlinn, Embraced by the Moon");
this.setName("Emblem Arlinn");
FilterPermanent filter = new FilterControlledCreaturePermanent("Creatures");
GainAbilityControlledEffect effect = new GainAbilityControlledEffect(HasteAbility.getInstance(), Duration.EndOfGame, filter);
effect.setText("Creatures you control have haste");

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

@ -1,171 +1,171 @@
/*
* 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.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.LeavesBattlefieldAllTriggeredAbility;
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamageControllerEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.GetEmblemTargetPlayerEffect;
import mage.abilities.effects.common.SetPlayerLifeAllEffect;
import mage.abilities.effects.common.discard.DiscardControllerEffect;
import mage.abilities.effects.common.discard.DiscardHandAllEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.TokenPredicate;
import mage.game.Game;
import mage.game.command.Emblem;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPlayer;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author Styxo
*/
public class AurraSingBaneOfJedi extends CardImpl {
public AurraSingBaneOfJedi(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{B}{R}");
this.subtype.add("Aurra");
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(3));
// +1:You may have {this} deal 2 damage to target creature. If you don't, {this} deals 1 damage to you.
Ability ability = new LoyaltyAbility(new AurraSingBaneOfJediEffect(), +1);
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
// -4:Target player gets an emblem wiht "Whenever a nontoken creature you control leave the battlefied, discard a card.".
ability = new LoyaltyAbility(new GetEmblemTargetPlayerEffect(new AurraSingBaneOfJediEmblem()), -4);
ability.addTarget(new TargetPlayer());
this.addAbility(ability);
// -6:Each player discards his or her hand and sacrificies all creatures he or she controls. Each player's life total becomes 1."
ability = new LoyaltyAbility(new DiscardHandAllEffect(), -6);
ability.addEffect(new SacrificeAllEffect());
Effect effect = new SetPlayerLifeAllEffect(1, TargetController.ANY);
ability.addEffect(effect);
this.addAbility(ability);
}
public AurraSingBaneOfJedi(final AurraSingBaneOfJedi card) {
super(card);
}
@Override
public AurraSingBaneOfJedi copy() {
return new AurraSingBaneOfJedi(this);
}
}
class AurraSingBaneOfJediEffect extends OneShotEffect {
public AurraSingBaneOfJediEffect() {
super(Outcome.Damage);
staticText = "You may have {this} deal 2 damage to target creature. If you don't, {this} deals 1 damage to you";
}
public AurraSingBaneOfJediEffect(final AurraSingBaneOfJediEffect effect) {
super(effect);
}
@Override
public AurraSingBaneOfJediEffect copy() {
return new AurraSingBaneOfJediEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
if (controller.chooseUse(outcome, "Deal 2 damage to " + game.getPermanent(getTargetPointer().getFirst(game, source)).getName() + "?", source, game)) {
new DamageTargetEffect(2).apply(game, source);
} else {
new DamageControllerEffect(1).apply(game, source);
}
return true;
}
return false;
}
}
class SacrificeAllEffect extends OneShotEffect {
SacrificeAllEffect() {
super(Outcome.DestroyPermanent);
staticText = "and sacrificies all creatures he or she controls";
}
SacrificeAllEffect(final SacrificeAllEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
List<Permanent> permanents = game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), source.getId(), game);
for (Permanent p : permanents) {
p.sacrifice(source.getSourceId(), game);
}
return true;
}
@Override
public SacrificeAllEffect copy() {
return new SacrificeAllEffect(this);
}
}
class AurraSingBaneOfJediEmblem extends Emblem {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("a nontoken creature you control");
static {
filter.add(Predicates.not(new TokenPredicate()));
}
// Whenever a nontoken creature you control leave the battlefied, discard a card."
public AurraSingBaneOfJediEmblem() {
this.setName("Emblem - Aurra");
getAbilities().add(new LeavesBattlefieldAllTriggeredAbility(Zone.COMMAND, new DiscardControllerEffect(1), filter, false));
}
}
/*
* 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.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.LeavesBattlefieldAllTriggeredAbility;
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamageControllerEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.GetEmblemTargetPlayerEffect;
import mage.abilities.effects.common.SetPlayerLifeAllEffect;
import mage.abilities.effects.common.discard.DiscardControllerEffect;
import mage.abilities.effects.common.discard.DiscardHandAllEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.TokenPredicate;
import mage.game.Game;
import mage.game.command.Emblem;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPlayer;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author Styxo
*/
public class AurraSingBaneOfJedi extends CardImpl {
public AurraSingBaneOfJedi(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{B}{R}");
this.subtype.add("Aurra");
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(3));
// +1:You may have {this} deal 2 damage to target creature. If you don't, {this} deals 1 damage to you.
Ability ability = new LoyaltyAbility(new AurraSingBaneOfJediEffect(), +1);
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
// -4:Target player gets an emblem wiht "Whenever a nontoken creature you control leave the battlefied, discard a card.".
ability = new LoyaltyAbility(new GetEmblemTargetPlayerEffect(new AurraSingBaneOfJediEmblem()), -4);
ability.addTarget(new TargetPlayer());
this.addAbility(ability);
// -6:Each player discards his or her hand and sacrificies all creatures he or she controls. Each player's life total becomes 1."
ability = new LoyaltyAbility(new DiscardHandAllEffect(), -6);
ability.addEffect(new SacrificeAllEffect());
Effect effect = new SetPlayerLifeAllEffect(1, TargetController.ANY);
ability.addEffect(effect);
this.addAbility(ability);
}
public AurraSingBaneOfJedi(final AurraSingBaneOfJedi card) {
super(card);
}
@Override
public AurraSingBaneOfJedi copy() {
return new AurraSingBaneOfJedi(this);
}
}
class AurraSingBaneOfJediEffect extends OneShotEffect {
public AurraSingBaneOfJediEffect() {
super(Outcome.Damage);
staticText = "You may have {this} deal 2 damage to target creature. If you don't, {this} deals 1 damage to you";
}
public AurraSingBaneOfJediEffect(final AurraSingBaneOfJediEffect effect) {
super(effect);
}
@Override
public AurraSingBaneOfJediEffect copy() {
return new AurraSingBaneOfJediEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
if (controller.chooseUse(outcome, "Deal 2 damage to " + game.getPermanent(getTargetPointer().getFirst(game, source)).getName() + "?", source, game)) {
new DamageTargetEffect(2).apply(game, source);
} else {
new DamageControllerEffect(1).apply(game, source);
}
return true;
}
return false;
}
}
class SacrificeAllEffect extends OneShotEffect {
SacrificeAllEffect() {
super(Outcome.DestroyPermanent);
staticText = "and sacrificies all creatures he or she controls";
}
SacrificeAllEffect(final SacrificeAllEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
List<Permanent> permanents = game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), source.getId(), game);
for (Permanent p : permanents) {
p.sacrifice(source.getSourceId(), game);
}
return true;
}
@Override
public SacrificeAllEffect copy() {
return new SacrificeAllEffect(this);
}
}
class AurraSingBaneOfJediEmblem extends Emblem {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("a nontoken creature you control");
static {
filter.add(Predicates.not(new TokenPredicate()));
}
// Whenever a nontoken creature you control leave the battlefied, discard a card."
public AurraSingBaneOfJediEmblem() {
this.setName("Emblem Aurra Sing, Bane of Jedi");
getAbilities().add(new LeavesBattlefieldAllTriggeredAbility(Zone.COMMAND, new DiscardControllerEffect(1), filter, false));
}
}

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

@ -43,13 +43,12 @@ import mage.target.common.TargetCreaturePermanent;
public class BecomeImmense extends CardImpl {
public BecomeImmense(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{5}{G}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{5}{G}");
// Delve
// Delve (Each card you exile from your graveyard while casting this spell pays for {1}.)
this.addAbility(new DelveAbility());
// Target creature gets +6/+6 until end of turn
this.getSpellAbility().addEffect(new BoostTargetEffect(6,6,Duration.EndOfTurn));
this.getSpellAbility().addEffect(new BoostTargetEffect(6, 6, Duration.EndOfTurn));
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}

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

@ -56,7 +56,7 @@ import mage.target.common.TargetCreaturePermanent;
public class ChandraRoaringFlame extends CardImpl {
public ChandraRoaringFlame(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"");
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "");
this.subtype.add("Chandra");
this.color.setRed(true);
@ -120,7 +120,7 @@ class ChandraRoaringFlameEmblemEffect extends OneShotEffect {
}
}
for (Player opponent : opponentsEmblem) {
game.addEmblem(new ChandraRoaringFlameEmblem(), source, opponent.getId());
game.addEmblem(new ChandraRoaringFlameEmblem(), source.getSourceObject(game), opponent.getId());
}
}
return false;
@ -134,7 +134,8 @@ class ChandraRoaringFlameEmblemEffect extends OneShotEffect {
class ChandraRoaringFlameEmblem extends Emblem {
public ChandraRoaringFlameEmblem() {
setName("EMBLEM: Chandra, Roaring Flame");
setName("Emblem Chandra");
setExpansionSetCodeForImage("ORI");
Effect effect = new DamageTargetEffect(3);
effect.setText("this emblem deals 3 damage to you");
this.getAbilities().add(new BeginningOfUpkeepTriggeredAbility(Zone.COMMAND, effect, TargetController.YOU, false, true));

View file

@ -63,7 +63,7 @@ import mage.target.common.TargetCreaturePermanent;
public class ChandraTorchOfDefiance extends CardImpl {
public ChandraTorchOfDefiance(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{2}{R}{R}");
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{R}{R}");
this.subtype.add("Chandra");
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(4));
@ -142,7 +142,7 @@ class ChandraTorchOfDefianceEmblem extends Emblem {
// You get an emblem with "Whenever you cast a spell, this emblem deals 5 damage to target creature or player."
public ChandraTorchOfDefianceEmblem() {
this.setName("Emblem - Chandra, Torch of Defiance");
this.setName("Emblem Chandra");
Effect effect = new DamageTargetEffect(5);
effect.setText("this emblem deals 5 damage to target creature or player");
Ability ability = new SpellCastControllerTriggeredAbility(Zone.COMMAND, effect, new FilterSpell("a spell"), false, 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

@ -67,7 +67,7 @@ import mage.target.common.TargetArtifactPermanent;
public class DackFayden extends CardImpl {
public DackFayden(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{1}{U}{R}");
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{1}{U}{R}");
this.subtype.add("Dack");
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(3));
@ -107,7 +107,7 @@ public class DackFayden extends CardImpl {
class DackFaydenEmblem extends Emblem {
DackFaydenEmblem() {
this.setName("EMBLEM: Dack Fayden");
this.setName("Emblem Dack");
this.getAbilities().add(new DackFaydenEmblemTriggeredAbility());
}
}

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

@ -68,7 +68,7 @@ import mage.target.targetpointer.FixedTarget;
public class DarettiScrapSavant extends CardImpl {
public DarettiScrapSavant(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{3}{R}");
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{3}{R}");
this.subtype.add("Daretti");
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(3));
@ -176,7 +176,6 @@ class DarettiScrapSavantEmblem extends Emblem {
// You get an emblem with "Whenever an artifact is put into your graveyard from the battlefield, return that card to the battlefield at the beginning of the next end step."
public DarettiScrapSavantEmblem() {
this.setName("Emblem - Daretti");
this.getAbilities().add(new DarettiScrapSavantTriggeredAbility());
}
}

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

@ -28,13 +28,14 @@
package mage.cards.d;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.game.Game;
import mage.players.Player;
/**
*
@ -43,13 +44,10 @@ import mage.game.Game;
public class DebtToTheDeathless extends CardImpl {
public DebtToTheDeathless(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{X}{W}{W}{B}{B}");
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{W}{W}{B}{B}");
// Each opponent loses two times X life. You gain life equal to the life lost this way.
this.getSpellAbility().addEffect(new DebtToTheDeathlessEffect());
}
public DebtToTheDeathless(final DebtToTheDeathless card) {
@ -80,12 +78,19 @@ class DebtToTheDeathlessEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
int damage = 0;
int xValue = source.getManaCostsToPay().getX();
for (UUID opponentId: game.getOpponents(source.getControllerId())) {
damage += game.getPlayer(opponentId).damage(xValue * 2, source.getSourceId(), game, false, true);
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
int lifeLost = 0;
int xValue = source.getManaCostsToPay().getX();
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
Player opponent = game.getPlayer(opponentId);
if (opponent != null) {
lifeLost += opponent.loseLife(xValue * 2, game, false);
}
}
controller.gainLife(lifeLost, game);
return true;
}
game.getPlayer(source.getControllerId()).gainLife(damage, game);
return true;
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

@ -66,7 +66,7 @@ import mage.target.common.TargetCreaturePermanent;
public class DomriRade extends CardImpl {
public DomriRade(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{1}{R}{G}");
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{1}{R}{G}");
this.subtype.add("Domri");
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(3));
@ -79,7 +79,7 @@ public class DomriRade extends CardImpl {
TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent();
target.setTargetTag(1);
ability2.addTarget(target);
FilterCreaturePermanent filter = new FilterCreaturePermanent("another creature to fight");
filter.add(new AnotherTargetPredicate(2));
TargetCreaturePermanent target2 = new TargetCreaturePermanent(filter);
@ -145,7 +145,7 @@ class DomriRadeEmblem extends Emblem {
// "Creatures you control have double strike, trample, hexproof and haste."
public DomriRadeEmblem() {
this.setName("EMBLEM: Domri Rade");
this.setName("Emblem Domri");
FilterPermanent filter = new FilterControlledCreaturePermanent("Creatures");
GainAbilityControlledEffect effect = new GainAbilityControlledEffect(DoubleStrikeAbility.getInstance(), Duration.EndOfGame, filter);
Ability ability = new SimpleStaticAbility(Zone.COMMAND, effect);

View file

@ -1,158 +1,158 @@
/*
* 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.d;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.RestrictionUntapNotMoreThanEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.GetEmblemEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.common.FilterControlledPermanent;
import mage.game.Game;
import mage.game.command.Emblem;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author emerald000
*/
public class DovinBaan extends CardImpl {
public DovinBaan(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{2}{W}{U}");
this.subtype.add("Dovin");
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(3));
// +1: Until your next turn, up to one target creature gets -3/-0 and its activated abilities can't be activated.
Effect effect = new BoostTargetEffect(-3, 0, Duration.UntilYourNextTurn);
effect.setText("Until your next turn, up to one target creature gets -3/-0");
Ability ability = new LoyaltyAbility(effect, 1);
ability.addTarget(new TargetCreaturePermanent(0, 1));
ability.addEffect(new DovinBaanCantActivateAbilitiesEffect());
this.addAbility(ability);
// -1: You gain 2 life and draw a card.
ability = new LoyaltyAbility(new GainLifeEffect(2), -1);
effect = new DrawCardSourceControllerEffect(1);
effect.setText("and draw a card");
ability.addEffect(effect);
this.addAbility(ability);
// -7: You get an emblem with "Your opponents can't untap more than two permanents during their untap steps."
this.addAbility(new LoyaltyAbility(new GetEmblemEffect(new DovinBaanEmblem()), -7));
}
public DovinBaan(final DovinBaan card) {
super(card);
}
@Override
public DovinBaan copy() {
return new DovinBaan(this);
}
}
class DovinBaanCantActivateAbilitiesEffect extends ContinuousRuleModifyingEffectImpl {
DovinBaanCantActivateAbilitiesEffect() {
super(Duration.UntilYourNextTurn, Outcome.UnboostCreature);
staticText = "and its activated abilities can't be activated";
}
DovinBaanCantActivateAbilitiesEffect(final DovinBaanCantActivateAbilitiesEffect effect) {
super(effect);
}
@Override
public DovinBaanCantActivateAbilitiesEffect copy() {
return new DovinBaanCantActivateAbilitiesEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == EventType.ACTIVATE_ABILITY;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return event.getSourceId().equals(this.getTargetPointer().getFirst(game, source));
}
}
class DovinBaanEmblem extends Emblem {
DovinBaanEmblem() {
this.setName("EMBLEM: Dovin Baan");
Ability ability = new SimpleStaticAbility(Zone.COMMAND, new DovinBaanCantUntapEffect());
this.getAbilities().add(ability);
}
}
class DovinBaanCantUntapEffect extends RestrictionUntapNotMoreThanEffect {
DovinBaanCantUntapEffect() {
super(Duration.WhileOnBattlefield, 2, new FilterControlledPermanent());
staticText = "Your opponents can't untap more than two permanents during their untap steps.";
}
DovinBaanCantUntapEffect(final DovinBaanCantUntapEffect effect) {
super(effect);
}
@Override
public boolean applies(Player player, Ability source, Game game) {
return game.getOpponents(source.getControllerId()).contains(player.getId());
}
@Override
public DovinBaanCantUntapEffect copy() {
return new DovinBaanCantUntapEffect(this);
}
}
/*
* 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.d;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.RestrictionUntapNotMoreThanEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.GetEmblemEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.common.FilterControlledPermanent;
import mage.game.Game;
import mage.game.command.Emblem;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author emerald000
*/
public class DovinBaan extends CardImpl {
public DovinBaan(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{W}{U}");
this.subtype.add("Dovin");
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(3));
// +1: Until your next turn, up to one target creature gets -3/-0 and its activated abilities can't be activated.
Effect effect = new BoostTargetEffect(-3, 0, Duration.UntilYourNextTurn);
effect.setText("Until your next turn, up to one target creature gets -3/-0");
Ability ability = new LoyaltyAbility(effect, 1);
ability.addTarget(new TargetCreaturePermanent(0, 1));
ability.addEffect(new DovinBaanCantActivateAbilitiesEffect());
this.addAbility(ability);
// -1: You gain 2 life and draw a card.
ability = new LoyaltyAbility(new GainLifeEffect(2), -1);
effect = new DrawCardSourceControllerEffect(1);
effect.setText("and draw a card");
ability.addEffect(effect);
this.addAbility(ability);
// -7: You get an emblem with "Your opponents can't untap more than two permanents during their untap steps."
this.addAbility(new LoyaltyAbility(new GetEmblemEffect(new DovinBaanEmblem()), -7));
}
public DovinBaan(final DovinBaan card) {
super(card);
}
@Override
public DovinBaan copy() {
return new DovinBaan(this);
}
}
class DovinBaanCantActivateAbilitiesEffect extends ContinuousRuleModifyingEffectImpl {
DovinBaanCantActivateAbilitiesEffect() {
super(Duration.UntilYourNextTurn, Outcome.UnboostCreature);
staticText = "and its activated abilities can't be activated";
}
DovinBaanCantActivateAbilitiesEffect(final DovinBaanCantActivateAbilitiesEffect effect) {
super(effect);
}
@Override
public DovinBaanCantActivateAbilitiesEffect copy() {
return new DovinBaanCantActivateAbilitiesEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == EventType.ACTIVATE_ABILITY;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return event.getSourceId().equals(this.getTargetPointer().getFirst(game, source));
}
}
class DovinBaanEmblem extends Emblem {
DovinBaanEmblem() {
this.setName("Emblem Dovin");
Ability ability = new SimpleStaticAbility(Zone.COMMAND, new DovinBaanCantUntapEffect());
this.getAbilities().add(ability);
}
}
class DovinBaanCantUntapEffect extends RestrictionUntapNotMoreThanEffect {
DovinBaanCantUntapEffect() {
super(Duration.WhileOnBattlefield, 2, new FilterControlledPermanent());
staticText = "Your opponents can't untap more than two permanents during their untap steps.";
}
DovinBaanCantUntapEffect(final DovinBaanCantUntapEffect effect) {
super(effect);
}
@Override
public boolean applies(Player player, Ability source, Game game) {
return game.getOpponents(source.getControllerId()).contains(player.getId());
}
@Override
public DovinBaanCantUntapEffect copy() {
return new DovinBaanCantUntapEffect(this);
}
}

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

@ -60,7 +60,7 @@ import mage.target.common.TargetCreaturePermanent;
public class ElspethKnightErrant extends CardImpl {
public ElspethKnightErrant(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{2}{W}{W}");
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{W}{W}");
this.subtype.add("Elspeth");
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(4));
@ -100,7 +100,7 @@ public class ElspethKnightErrant extends CardImpl {
class ElspethKnightErrantEmblem extends Emblem {
public ElspethKnightErrantEmblem() {
this.setName("EMBLEM: Elspeth, Knight-Errant");
this.setName("Emblem Elspeth");
FilterControlledPermanent filter = new FilterControlledPermanent("Artifacts, creatures, enchantments, and lands you control");
filter.add(Predicates.or(
new CardTypePredicate(CardType.ARTIFACT),

View file

@ -62,7 +62,7 @@ public class ElspethSunsChampion extends CardImpl {
}
public ElspethSunsChampion(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{4}{W}{W}");
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{4}{W}{W}");
this.subtype.add("Elspeth");
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(4));
@ -91,7 +91,7 @@ class ElspethSunsChampionEmblem extends Emblem {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures");
public ElspethSunsChampionEmblem() {
this.setName("EMBLEM: Elspeth, Sun's Champion");
this.setName("Emblem Elspeth");
Ability ability = new SimpleStaticAbility(Zone.COMMAND, new BoostControlledEffect(2, 2, Duration.EndOfGame, filter, false));
ability.addEffect(new GainAbilityControlledEffect(FlyingAbility.getInstance(), Duration.EndOfGame, filter));
this.getAbilities().add(ability);

View file

@ -28,11 +28,11 @@
package mage.cards.e;
import java.util.UUID;
import mage.constants.CardType;
import mage.MageInt;
import mage.abilities.keyword.CascadeAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
/**
*
@ -41,14 +41,13 @@ import mage.cards.CardSetInfo;
public class EnlistedWurm extends CardImpl {
public EnlistedWurm(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{G}{W}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}{W}");
this.subtype.add("Wurm");
this.power = new MageInt(5);
this.toughness = new MageInt(5);
// Cascade (When you cast this spell, exile cards from the top of your library until you exile a nonland card that costs less. You may cast it without paying its mana cost. Put the exiled cards on the bottom in a random order.)
this.addAbility(new CascadeAbility());
}

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

@ -1,114 +1,114 @@
/*
* 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.f;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.counters.CounterType;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.CounterPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author Styxo
*/
public class FulfillContract extends CardImpl {
private static final FilterCreaturePermanent filterBountyCreature = new FilterCreaturePermanent("creature with a bounty counter on it");
private static final FilterControlledCreaturePermanent filterRogueOrHunter = new FilterControlledCreaturePermanent("Rogue or Hunter you control");
static {
filterBountyCreature.add(new CounterPredicate(CounterType.BOUNTY));
filterRogueOrHunter.add(Predicates.or(new SubtypePredicate("Rogue"), new SubtypePredicate("Hunter")));
}
public FulfillContract(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{B/R}{B/R}");
// Destroy target creature with a bounty counter on it. If that creature is destroyed this way, you may put a +1/+1 counter on target Rogue or Hunter you control.
this.getSpellAbility().addEffect(new FulfillContractEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filterBountyCreature));
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent(filterRogueOrHunter));
}
public FulfillContract(final FulfillContract card) {
super(card);
}
@Override
public FulfillContract copy() {
return new FulfillContract(this);
}
}
class FulfillContractEffect extends OneShotEffect {
public FulfillContractEffect() {
super(Outcome.Benefit);
this.staticText = "Destroy target creature with a bounty counter on it. If that creature is destroyed this way, you may put a +1/+1 counter on target Rogue or Hunter you control";
}
public FulfillContractEffect(final FulfillContractEffect effect) {
super(effect);
}
@Override
public FulfillContractEffect copy() {
return new FulfillContractEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent permanentToDestroy = game.getPermanent(getTargetPointer().getFirst(game, source));
Permanent permanentToPutCounter = game.getPermanent(getTargetPointer().getTargets(game, source).get(1));
if (controller != null) {
if (permanentToDestroy != null && permanentToDestroy.destroy(source.getSourceId(), game, false)) {
if (permanentToPutCounter != null) {
permanentToPutCounter.addCounters(CounterType.P1P1.createInstance(), game);
}
}
return true;
}
return false;
}
}
/*
* 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.f;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.counters.CounterType;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.CounterPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author Styxo
*/
public class FulfillContract extends CardImpl {
private static final FilterCreaturePermanent filterBountyCreature = new FilterCreaturePermanent("creature with a bounty counter on it");
private static final FilterControlledCreaturePermanent filterRogueOrHunter = new FilterControlledCreaturePermanent("Rogue or Hunter you control");
static {
filterBountyCreature.add(new CounterPredicate(CounterType.BOUNTY));
filterRogueOrHunter.add(Predicates.or(new SubtypePredicate("Rogue"), new SubtypePredicate("Hunter")));
}
public FulfillContract(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{B/R}{B/R}");
// Destroy target creature with a bounty counter on it. If that creature is destroyed this way, you may put a +1/+1 counter on target Rogue or Hunter you control.
this.getSpellAbility().addEffect(new FulfillContractEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filterBountyCreature));
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent(filterRogueOrHunter));
}
public FulfillContract(final FulfillContract card) {
super(card);
}
@Override
public FulfillContract copy() {
return new FulfillContract(this);
}
}
class FulfillContractEffect extends OneShotEffect {
public FulfillContractEffect() {
super(Outcome.Benefit);
this.staticText = "Destroy target creature with a bounty counter on it. If that creature is destroyed this way, you may put a +1/+1 counter on target Rogue or Hunter you control";
}
public FulfillContractEffect(final FulfillContractEffect effect) {
super(effect);
}
@Override
public FulfillContractEffect copy() {
return new FulfillContractEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent permanentToDestroy = game.getPermanent(getTargetPointer().getFirst(game, source));
Permanent permanentToPutCounter = game.getPermanent(source.getTargets().get(1).getFirstTarget());
if (controller != null) {
if (permanentToDestroy != null && permanentToDestroy.destroy(source.getSourceId(), game, false)) {
if (permanentToPutCounter != null) {
permanentToPutCounter.addCounters(CounterType.P1P1.createInstance(), source, game);
}
}
return true;
}
return false;
}
}

View file

@ -75,7 +75,7 @@ public class GarrukApexPredator extends CardImpl {
}
public GarrukApexPredator(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{5}{B}{G}");
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{5}{B}{G}");
this.subtype.add("Garruk");
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(5));
@ -166,7 +166,7 @@ class GarrukApexPredatorBeastToken extends Token {
class GarrukApexPredatorEmblem extends Emblem {
public GarrukApexPredatorEmblem() {
setName("EMBLEM: Garruk, Apex Predator");
setName("Emblem Garruk");
Effect effect = new BoostTargetEffect(5, 5, Duration.EndOfTurn);
effect.setText("it gets +5/+5");
Ability ability = new AttackedByCreatureTriggeredAbility(Zone.COMMAND, effect, false, SetTargetPointer.PERMANENT);

View file

@ -63,7 +63,7 @@ public class GarrukCallerOfBeasts extends CardImpl {
}
public GarrukCallerOfBeasts(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{4}{G}{G}");
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{4}{G}{G}");
this.subtype.add("Garruk");
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(4));
@ -102,7 +102,7 @@ class GarrukCallerOfBeastsEmblem extends Emblem {
}
public GarrukCallerOfBeastsEmblem() {
this.setName("EMBLEM: Garruk, Caller of Beasts");
this.setName("Emblem Garruk");
Effect effect = new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(new FilterCreatureCard("creature card")), false, true, Outcome.PutCreatureInPlay);
Ability ability = new SpellCastControllerTriggeredAbility(Zone.COMMAND, effect, filter, true, false);
this.getAbilities().add(ability);

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

@ -55,7 +55,7 @@ import mage.game.permanent.token.Token;
public class GideonAllyOfZendikar extends CardImpl {
public GideonAllyOfZendikar(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{2}{W}{W}");
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{W}{W}");
this.subtype.add("Gideon");
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(4));
@ -87,7 +87,7 @@ public class GideonAllyOfZendikar extends CardImpl {
class GideonAllyOfZendikarEmblem extends Emblem {
public GideonAllyOfZendikarEmblem() {
this.setName("EMBLEM: Gideon, Ally of Zendikar");
this.setName("Emblem Gideon");
BoostControlledEffect effect = new BoostControlledEffect(1, 1, Duration.EndOfGame);
Ability ability = new SimpleStaticAbility(Zone.COMMAND, effect);
this.getAbilities().add(ability);

View file

@ -61,7 +61,7 @@ public class GildedDrake extends CardImpl {
}
public GildedDrake(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}");
this.subtype.add("Drake");
this.power = new MageInt(3);
@ -105,20 +105,22 @@ class GildedDrakeEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent sourceObject = game.getPermanent(source.getSourceId());
Permanent targetPermanent;
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
if (targetPointer.getFirst(game, source) != null) {
targetPermanent = game.getPermanent(targetPointer.getFirst(game, source));
if (targetPermanent != null) {
ContinuousEffect effect = new ExchangeControlTargetEffect(Duration.EndOfGame, "", true);
effect.setTargetPointer(targetPointer);
game.addEffect(effect, source);
return true;
Permanent sourceObject = game.getPermanent(source.getSourceId());
if (sourceObject != null) {
if (targetPointer.getFirst(game, source) != null) {
Permanent targetPermanent = game.getPermanent(targetPointer.getFirst(game, source));
if (targetPermanent != null) {
ContinuousEffect effect = new ExchangeControlTargetEffect(Duration.EndOfGame, "", true);
effect.setTargetPointer(targetPointer);
game.addEffect(effect, source);
return true;
}
}
sourceObject.sacrifice(source.getSourceId(), game);
}
sourceObject.sacrifice(source.getSourceId(), game);
return true;
}
return false;

View file

@ -99,7 +99,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

@ -0,0 +1,159 @@
/*
* 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.h;
import java.util.UUID;
import mage.MageObject;
import mage.Mana;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUntapTriggeredAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.choices.ChoiceColor;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ManaEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.util.CardUtil;
/**
*
* @author LevelX2
*/
public class HallOfGemstone extends CardImpl {
public HallOfGemstone(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}{G}");
this.supertype.add("World");
// At the beginning of each player's upkeep, that player chooses a color. Until end of turn, lands tapped for mana produce mana of the chosen color instead of any other color.
this.addAbility(new BeginningOfUntapTriggeredAbility(new HallOfGemstoneEffect(), TargetController.ANY, false));
}
public HallOfGemstone(final HallOfGemstone card) {
super(card);
}
@Override
public HallOfGemstone copy() {
return new HallOfGemstone(this);
}
}
class HallOfGemstoneEffect extends ReplacementEffectImpl {
HallOfGemstoneEffect() {
super(Duration.EndOfTurn, Outcome.Neutral);
staticText = "that player chooses a color. Until end of turn, lands tapped for mana produce mana of the chosen color instead of any other color";
}
HallOfGemstoneEffect(final HallOfGemstoneEffect effect) {
super(effect);
}
@Override
public HallOfGemstoneEffect copy() {
return new HallOfGemstoneEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public void init(Ability source, Game game) {
super.init(source, game);
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
MageObject mageObject = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (player != null && mageObject != null) {
ChoiceColor choice = new ChoiceColor();
while (!choice.isChosen()) {
player.choose(outcome, choice, game);
if (!player.canRespond()) {
return;
}
}
if (!game.isSimulation()) {
game.informPlayers(mageObject.getLogName() + ": " + player.getLogName() + " has chosen " + choice.getChoice());
}
game.getState().setValue(mageObject.getId() + "_color", choice.getColor());
if (mageObject instanceof Permanent) {
((Permanent) mageObject).addInfo("chosen color", CardUtil.addToolTipMarkTags("Chosen color: " + choice.getChoice()), game);
}
}
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
ObjectColor colorChosen = (ObjectColor) game.getState().getValue(source.getSourceId() + "_color");
if (colorChosen != null) {
ManaEvent manaEvent = (ManaEvent) event;
Mana mana = manaEvent.getMana();
int amount = mana.count();
switch (colorChosen.getColoredManaSymbol()) {
case W:
mana.setToMana(Mana.WhiteMana(amount));
break;
case U:
mana.setToMana(Mana.BlueMana(amount));
break;
case B:
mana.setToMana(Mana.BlackMana(amount));
break;
case R:
mana.setToMana(Mana.RedMana(amount));
break;
case G:
mana.setToMana(Mana.GreenMana(amount));
break;
}
}
return false;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId());
return permanent != null && permanent.getCardType().contains(CardType.LAND);
}
}

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

@ -0,0 +1,134 @@
/*
* 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.h;
import java.util.UUID;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.AsEntersBattlefieldAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.RedirectionEffect;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.ChooseColorEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterInPlay;
import mage.filter.common.FilterInstantOrSorceryCard;
import mage.game.Game;
import mage.game.events.DamagePlayerEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.stack.Spell;
import mage.game.stack.StackObject;
import mage.target.TargetPlayer;
/**
*
* @author anonymous
*/
public class HarshJudgment extends CardImpl {
public HarshJudgment(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}{W}");
// As Harsh Judgment enters the battlefield, choose a color.
this.addAbility(new AsEntersBattlefieldAbility(new ChooseColorEffect(Outcome.Benefit)));
// If an instant or sorcery spell of the chosen color would deal damage to you, it deals that damage to its controller instead.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new HarshJudgmentEffect()));
}
public HarshJudgment(final HarshJudgment card) {
super(card);
}
@Override
public HarshJudgment copy() {
return new HarshJudgment(this);
}
}
class HarshJudgmentEffect extends RedirectionEffect {
private static final FilterInstantOrSorceryCard instantOrSorceryFilter = new FilterInstantOrSorceryCard();
public HarshJudgmentEffect() {
super(Duration.WhileOnBattlefield);
staticText = "If an instant or sorcery spell of the chosen color would deal damage to you, it deals that damage to its controller instead";
}
public HarshJudgmentEffect(final HarshJudgmentEffect effect) {
super(effect);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER);
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if(event.getTargetId().equals(source.getControllerId())) {
Spell spell = null;
StackObject stackObject = game.getStack().getStackObject(event.getSourceId());
if (stackObject == null) {
stackObject = (StackObject) game.getLastKnownInformation(event.getSourceId(), Zone.STACK);
}
if (stackObject instanceof Spell) {
spell = (Spell) stackObject;
}
//Checks if damage is from a sorcery or instants and spell is of chosen color
Permanent permanent = game.getPermanent(source.getSourceId());
ObjectColor color = (ObjectColor) game.getState().getValue(permanent.getId() + "_color");
if (spell != null && instantOrSorceryFilter.match(spell.getCard(), game) && spell.getColor(game).contains(color)) {
TargetPlayer target = new TargetPlayer();
target.add(spell.getControllerId(), game);
redirectTarget = target;
return true;
}
}
return false;
}
@Override
public HarshJudgmentEffect copy() {
return new HarshJudgmentEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
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

@ -67,7 +67,7 @@ import mage.target.targetpointer.FixedTarget;
public class JaceTelepathUnbound extends CardImpl {
public JaceTelepathUnbound(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"");
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "");
this.subtype.add("Jace");
this.color.setBlue(true);
@ -207,7 +207,7 @@ class JaceTelepathUnboundEmblem extends Emblem {
// You get an emblem with "Whenever you cast a spell, target opponent puts the top five cards of his or her library into his or her graveyard".
public JaceTelepathUnboundEmblem() {
this.setName("Emblem - Jace");
this.setName("Emblem Jace");
Effect effect = new PutTopCardOfLibraryIntoGraveTargetEffect(5);
effect.setText("target opponent puts the top five cards of his or her library into his or her graveyard");
Ability ability = new SpellCastControllerTriggeredAbility(Zone.COMMAND, effect, new FilterSpell("a spell"), false, false);

View file

@ -59,7 +59,7 @@ import mage.watchers.common.SpellsCastWatcher;
public class JaceUnravelerOfSecrets extends CardImpl {
public JaceUnravelerOfSecrets(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{3}{U}{U}");
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{3}{U}{U}");
this.subtype.add("Jace");
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(5));
@ -99,7 +99,8 @@ public class JaceUnravelerOfSecrets extends CardImpl {
class JaceUnravelerOfSecretsEmblem extends Emblem {
public JaceUnravelerOfSecretsEmblem() {
this.setName("EMBLEM: Jace, Unraveler of Secrets");
this.setName("Emblem Jace");
setExpansionSetCodeForImage("SOI");
Effect effect = new CounterTargetEffect();
effect.setText("counter that spell");
this.getAbilities().add(new JaceUnravelerOfSecretsTriggeredAbility(effect, false));

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

@ -67,7 +67,7 @@ import mage.target.common.TargetLandPermanent;
public class KioraMasterOfTheDepths extends CardImpl {
public KioraMasterOfTheDepths(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{2}{G}{U}");
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{G}{U}");
this.subtype.add("Kiora");
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(4));
@ -203,7 +203,7 @@ class KioraMasterOfTheDepthsEmblem extends Emblem {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures");
public KioraMasterOfTheDepthsEmblem() {
this.setName("EMBLEM: Kiora, Master of the Depths");
this.setName("Emblem Kiora");
Ability ability = new EntersBattlefieldControlledTriggeredAbility(Zone.COMMAND,
new KioraFightEffect(), filter, true, SetTargetPointer.PERMANENT,

View file

@ -68,7 +68,7 @@ public class KioraTheCrashingWave extends CardImpl {
}
public KioraTheCrashingWave(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{2}{G}{U}");
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{G}{U}");
this.subtype.add("Kiora");
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(2));
@ -164,7 +164,7 @@ class KioraPreventionEffect extends PreventionEffectImpl {
class KioraEmblem extends Emblem {
public KioraEmblem() {
this.setName("EMBLEM: Kiora, the Crashing Wave");
this.setName("Emblem Kiora");
Ability ability = new BeginningOfEndStepTriggeredAbility(Zone.COMMAND, new CreateTokenEffect(new KioraKrakenToken()), TargetController.YOU, null, false);
this.getAbilities().add(ability);
}

View file

@ -77,7 +77,7 @@ public class KothOfTheHammer extends CardImpl {
}
public KothOfTheHammer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{2}{R}{R}");
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{R}{R}");
this.subtype.add("Koth");
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(3));
@ -122,7 +122,7 @@ class KothOfTheHammerEmblem extends Emblem {
// "Mountains you control have '{T}: This land deals 1 damage to target creature or player.'"
public KothOfTheHammerEmblem() {
this.setName("EMBLEM: Koth of the Hammer");
this.setName("Emblem Koth");
this.getAbilities().add(new SimpleStaticAbility(Zone.COMMAND, new KothOfTheHammerThirdEffect()));
}
}

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;
}

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