Merge pull request #26 from magefree/master

merge
This commit is contained in:
theelk801 2017-08-14 17:35:16 -04:00 committed by GitHub
commit ee3d36f2cd
24 changed files with 948 additions and 70 deletions

View file

@ -613,7 +613,7 @@ public class GameController implements GameCallback {
if (viewLimitedDeckPlayer != null) {
if (viewLimitedDeckPlayer.isHuman()) {
for (MatchPlayer p : TableManager.instance.getTable(tableId).getMatch().getPlayers()) {
if (p.getPlayer().getId() == userIdRequester) {
if (p.getPlayer().getId().equals(userIdRequester)) {
Optional<User> u = UserManager.instance.getUser(origId);
if (u != null && u.isPresent() && p.getDeck() != null) {
u.get().ccViewLimitedDeck(p.getDeck(), tableId, requestsOpen, true);

View file

@ -181,7 +181,7 @@ class AbandonedSarcophagusReplacementEffect extends ReplacementEffectImpl {
Card card = game.getCard(event.getTargetId());
if (card != null
&& watcher != null
&& card.getOwnerId() == controller.getId()) {
&& card.getOwnerId().equals(controller.getId())) {
for (Ability ability : card.getAbilities()) {
if (ability instanceof CyclingAbility) {
cardHasCycling = true;
@ -224,8 +224,8 @@ class AbandonedSarcophagusWatcher extends Watcher {
Card card = game.getCard(event.getSourceId());
Player controller = game.getPlayer(event.getPlayerId());
if (card != null
&& controller != null
&& card.getOwnerId() == controller.getId()) {
&& controller != null
&& card.getOwnerId().equals(controller.getId())) {
Cards c = getCardsCycledThisTurn(event.getPlayerId());
c.add(card);
cycledCardsThisTurn.put(event.getPlayerId(), c);

View file

@ -115,7 +115,7 @@ class AzoriusAEthermageAbility extends TriggeredAbilityImpl {
}
if (permanentThatMoved != null
&& filter.match(permanentThatMoved, sourceId, controllerId, game)
&& zEvent.getPlayerId() == controllerId) { //The controller's hand is where the permanent moved to.
&& zEvent.getPlayerId().equals(controllerId)) { //The controller's hand is where the permanent moved to.
return true;
}
}

View file

@ -125,7 +125,7 @@ class ConsumingFerocityEffect extends OneShotEffect {
player.damage(creature.getPower().getValue(), creature.getId(), game, false, true);
}
effect = new DestroyTargetEffect(true);
effect.setTargetPointer(new FixedTarget(creature.getId()));
effect.setTargetPointer(new FixedTarget(creature, game));
effect.apply(game, source);
return true;
}

View file

@ -50,8 +50,8 @@ import mage.target.common.TargetCreaturePermanent;
*/
public class CrashLanding extends CardImpl {
private static final FilterControlledPermanent filter = new FilterControlledPermanent();
private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent();
private static final FilterControlledPermanent filter = new FilterControlledPermanent("Forests you control");
private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent("creature with flying");
static {
filter.add(new SubtypePredicate(SubType.FOREST));
@ -66,7 +66,7 @@ public class CrashLanding extends CardImpl {
this.getSpellAbility().addEffect(new LoseAbilityTargetEffect(
FlyingAbility.getInstance(), Duration.EndOfTurn));
this.getSpellAbility().addEffect(new DamageTargetEffect(amount));
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter2));
}
public CrashLanding(final CrashLanding card) {

View file

@ -27,7 +27,6 @@
*/
package mage.cards.c;
import java.util.Iterator;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
@ -36,9 +35,9 @@ import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
@ -77,7 +76,7 @@ class CreditVoucherEffect extends OneShotEffect {
CreditVoucherEffect() {
super(Outcome.Neutral);
this.staticText = "Shuffle any number of from your hand into your library, then draw that many cards";
this.staticText = "Shuffle any number of cards from your hand into your library, then draw that many cards";
}
CreditVoucherEffect(final CreditVoucherEffect effect) {
@ -100,14 +99,8 @@ class CreditVoucherEffect extends OneShotEffect {
int amountShuffled = 0;
if (target.canChoose(source.getControllerId(), game) && target.choose(Outcome.Neutral, source.getControllerId(), source.getSourceId(), game)) {
if (!target.getTargets().isEmpty()) {
Iterator<UUID> targets = target.getTargets().iterator();
while (targets.hasNext()) {
Card card = game.getCard(targets.next());
if (card != null) {
controller.moveCards(card, Zone.LIBRARY, source, game);
amountShuffled++;
}
}
amountShuffled = target.getTargets().size();
controller.moveCards(new CardsImpl(target.getTargets()), Zone.LIBRARY, source, game);
}
}
controller.shuffleLibrary(source, game);

View file

@ -54,8 +54,8 @@ import mage.target.common.TargetCreaturePermanent;
*/
public class CrookclawElder extends CardImpl {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped Merfolk you control");
private static final FilterControlledCreaturePermanent filter2 = new FilterControlledCreaturePermanent("untapped Merfolk you control");
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped Bird you control");
private static final FilterControlledCreaturePermanent filter2 = new FilterControlledCreaturePermanent("untapped Wizards you control");
static {
filter.add(new SubtypePredicate(SubType.BIRD));
@ -78,7 +78,7 @@ public class CrookclawElder extends CardImpl {
// Tap two untapped Birds you control: Draw a card.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), new TapTargetCost(new TargetControlledCreaturePermanent(2, 2, filter, true)));
this.addAbility(ability);
// Tap two untapped Wizards you control: Target creature gains flying until end of turn.
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilityTargetEffect(FlyingAbility.getInstance(), Duration.EndOfTurn), new TapTargetCost(new TargetControlledCreaturePermanent(2, 2, filter2, true)));
ability.addTarget(new TargetCreaturePermanent());

View file

@ -91,29 +91,32 @@ class CrookedScalesEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent yourGuy = game.getPermanent(getTargetPointer().getFirst(game, source));
Permanent theirGuy = game.getPermanent(source.getTargets().get(1).getFirstTarget());
boolean keepGoing;
Cost cost;
String message = "You lost the flip. Pay {3} to prevent your creature from being destroyed?";
do {
if (controller.flipCoin(game)) {
if (theirGuy != null) {
theirGuy.destroy(controller.getId(), game, false);
}
keepGoing = false;
} else {
cost = new GenericManaCost(3);
if (!(controller.chooseUse(Outcome.Benefit, message, source, game) && cost.pay(source, game, controller.getId(), controller.getId(), false, null))) {
if (yourGuy != null) {
yourGuy.destroy(controller.getId(), game, false);
if (controller != null) {
Permanent yourGuy = game.getPermanent(getTargetPointer().getFirst(game, source));
Permanent theirGuy = game.getPermanent(source.getTargets().get(1).getFirstTarget());
boolean keepGoing;
Cost cost;
String message = "You lost the flip. Pay {3} to prevent your creature from being destroyed?";
do {
if (controller.flipCoin(game)) {
if (theirGuy != null) {
theirGuy.destroy(controller.getId(), game, false);
}
keepGoing = false;
} else {
keepGoing = true;
cost = new GenericManaCost(3);
if (!(controller.chooseUse(Outcome.Benefit, message, source, game) && cost.pay(source, game, controller.getId(), controller.getId(), false, null))) {
if (yourGuy != null) {
yourGuy.destroy(controller.getId(), game, false);
}
keepGoing = false;
} else {
keepGoing = true;
}
}
}
} while (keepGoing);
return true;
} while (keepGoing && controller.isInGame());
return true;
}
return false;
}
}

View file

@ -0,0 +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.c;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.TargetPlayer;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.UntapAllControllerEffect;
import mage.filter.StaticFilters;
import mage.filter.common.FilterNonlandPermanent;
import mage.players.Player;
/**
*
* @author Saga
*/
public class CurseOfBounty extends CardImpl {
public CurseOfBounty(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{G}");
this.subtype.add(SubType.AURA, SubType.CURSE);
// Enchant player
TargetPlayer auraTarget = new TargetPlayer();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment));
this.addAbility(new EnchantAbility(auraTarget.getTargetName()));
// Whenever enchanted player is attacked, untap all nonland permanents you control.
// Each opponent attacking that player untaps all nonland permanents he or she controls.
Ability ability = new CurseOfBountyTriggeredAbility();
ability.addEffect(new UntapAllControllerEffect(new FilterNonlandPermanent()));
this.addAbility(ability);
}
public CurseOfBounty(final CurseOfBounty card) {
super(card);
}
@Override
public CurseOfBounty copy() {
return new CurseOfBounty(this);
}
}
class CurseOfBountyTriggeredAbility extends TriggeredAbilityImpl {
public CurseOfBountyTriggeredAbility() {
super(Zone.BATTLEFIELD, new UntapAllNonlandsTargetEffect(), false);
}
public CurseOfBountyTriggeredAbility(final CurseOfBountyTriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DECLARED_ATTACKERS;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent enchantment = game.getPermanentOrLKIBattlefield(this.getSourceId());
UUID controller = this.getControllerId();
if (enchantment != null
&& enchantment.getAttachedTo() != null
&& game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) {
if (!game.getCombat().getAttackerId().equals(controller)) {
for (Effect effect: this.getEffects()) {
effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId()));
}
}
return true;
}
return false;
}
@Override
public String getRule() {
return "Whenever enchanted player is attacked, untap all nonland permanents you control. "
+ "Each opponent attacking that player untaps all nonland permanents he or she controls.";
}
@Override
public CurseOfBountyTriggeredAbility copy() {
return new CurseOfBountyTriggeredAbility(this);
}
}
class UntapAllNonlandsTargetEffect extends OneShotEffect {
public UntapAllNonlandsTargetEffect() {
super(Outcome.Untap);
}
public UntapAllNonlandsTargetEffect(final UntapAllNonlandsTargetEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source));
if (player != null) {
for (Permanent nonland: game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_NON_LAND, player.getId(), game)) {
nonland.untap(game);
}
return true;
}
return false;
}
@Override
public UntapAllNonlandsTargetEffect copy() {
return new UntapAllNonlandsTargetEffect(this);
}
}

View file

@ -0,0 +1,126 @@
/*
* 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.c;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.TargetPlayer;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.CreateTokenTargetEffect;
import mage.game.permanent.token.ZombieToken;
/**
*
* @author Saga
*/
public class CurseOfDisturbance extends CardImpl {
public CurseOfDisturbance(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{B}");
this.subtype.add(SubType.AURA, SubType.CURSE);
// Enchant player
TargetPlayer auraTarget = new TargetPlayer();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment));
this.addAbility(new EnchantAbility(auraTarget.getTargetName()));
// Whenever enchanted player is attacked, create a 2/2 black Zombie creature token. Each opponent attacking that player does the same.
Ability ability = new CurseOfDisturbanceTriggeredAbility();
ability.addEffect(new CreateTokenEffect(new ZombieToken()));
this.addAbility(ability);
}
public CurseOfDisturbance(final CurseOfDisturbance card) {
super(card);
}
@Override
public CurseOfDisturbance copy() {
return new CurseOfDisturbance(this);
}
}
class CurseOfDisturbanceTriggeredAbility extends TriggeredAbilityImpl {
public CurseOfDisturbanceTriggeredAbility() {
super(Zone.BATTLEFIELD, new CreateTokenTargetEffect(new ZombieToken()), false);
}
public CurseOfDisturbanceTriggeredAbility(final CurseOfDisturbanceTriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DECLARED_ATTACKERS;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent enchantment = game.getPermanentOrLKIBattlefield(this.getSourceId());
UUID controller = this.getControllerId();
if (enchantment != null
&& enchantment.getAttachedTo() != null
&& game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) {
if (!game.getCombat().getAttackerId().equals(controller)) {
for (Effect effect: this.getEffects()) {
effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId()));
}
}
return true;
}
return false;
}
@Override
public String getRule() {
return "Whenever enchanted player is attacked, create a 2/2 black Zombie creature token. Each opponent attacking that player does the same.";
}
@Override
public CurseOfDisturbanceTriggeredAbility copy() {
return new CurseOfDisturbanceTriggeredAbility(this);
}
}

View file

@ -0,0 +1,128 @@
/*
* 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.c;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.TargetPlayer;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.CreateTokenTargetEffect;
import mage.game.permanent.token.GoldToken;
/**
*
* @author Saga
*/
public class CurseOfOpulence extends CardImpl {
public CurseOfOpulence(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{R}");
this.subtype.add(SubType.AURA, SubType.CURSE);
// Enchant player
TargetPlayer auraTarget = new TargetPlayer();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment));
this.addAbility(new EnchantAbility(auraTarget.getTargetName()));
// Whenever enchanted player is attacked, create a colorless artifact token named Gold.
// It has "sacrifice this artifact: Add one mana of any color to your mana pool." Each opponent attacking that player does the same.
Ability ability = new CurseOfOpulenceTriggeredAbility();
ability.addEffect(new CreateTokenEffect(new GoldToken()));
this.addAbility(ability);
}
public CurseOfOpulence(final CurseOfOpulence card) {
super(card);
}
@Override
public CurseOfOpulence copy() {
return new CurseOfOpulence(this);
}
}
class CurseOfOpulenceTriggeredAbility extends TriggeredAbilityImpl {
public CurseOfOpulenceTriggeredAbility() {
super(Zone.BATTLEFIELD, new CreateTokenTargetEffect(new GoldToken()), false);
}
public CurseOfOpulenceTriggeredAbility(final CurseOfOpulenceTriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DECLARED_ATTACKERS;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent enchantment = game.getPermanentOrLKIBattlefield(this.getSourceId());
UUID controller = this.getControllerId();
if (enchantment != null
&& enchantment.getAttachedTo() != null
&& game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) {
if (!game.getCombat().getAttackerId().equals(controller)) {
for (Effect effect: this.getEffects()) {
effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId()));
}
}
return true;
}
return false;
}
@Override
public String getRule() {
return "Whenever enchanted player is attacked, create a colorless artifact token named Gold. "
+ "It has \"sacrifice this artifact: Add one mana of any color to your mana pool.\" Each opponent attacking that player does the same.";
}
@Override
public CurseOfOpulenceTriggeredAbility copy() {
return new CurseOfOpulenceTriggeredAbility(this);
}
}

View file

@ -0,0 +1,125 @@
/*
* 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.c;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.TargetPlayer;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.DrawCardTargetEffect;
/**
*
* @author Saga
*/
public class CurseOfVerbosity extends CardImpl {
public CurseOfVerbosity(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{U}");
this.subtype.add(SubType.AURA, SubType.CURSE);
// Enchant player
TargetPlayer auraTarget = new TargetPlayer();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment));
this.addAbility(new EnchantAbility(auraTarget.getTargetName()));
// Whenever enchanted player is attacked, draw a card. Each opponent attacking that player does the same.
Ability ability = new CurseOfVerbosityTriggeredAbility();
ability.addEffect(new DrawCardSourceControllerEffect(1));
this.addAbility(ability);
}
public CurseOfVerbosity(final CurseOfVerbosity card) {
super(card);
}
@Override
public CurseOfVerbosity copy() {
return new CurseOfVerbosity(this);
}
}
class CurseOfVerbosityTriggeredAbility extends TriggeredAbilityImpl {
public CurseOfVerbosityTriggeredAbility() {
super(Zone.BATTLEFIELD, new DrawCardTargetEffect(1), false);
}
public CurseOfVerbosityTriggeredAbility(final CurseOfVerbosityTriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DECLARED_ATTACKERS;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent enchantment = game.getPermanentOrLKIBattlefield(this.getSourceId());
UUID controller = this.getControllerId();
if (enchantment != null
&& enchantment.getAttachedTo() != null
&& game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) {
if (!game.getCombat().getAttackerId().equals(controller)) {
for (Effect effect: this.getEffects()) {
effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId()));
}
}
return true;
}
return false;
}
@Override
public String getRule() {
return "Whenever enchanted player is attacked, draw a card. Each opponent attacking that player does the same.";
}
@Override
public CurseOfVerbosityTriggeredAbility copy() {
return new CurseOfVerbosityTriggeredAbility(this);
}
}

View file

@ -0,0 +1,125 @@
/*
* 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.c;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.TargetPlayer;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.GainLifeTargetEffect;
/**
*
* @author Saga
*/
public class CurseOfVitality extends CardImpl {
public CurseOfVitality(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{W}");
this.subtype.add(SubType.AURA, SubType.CURSE);
// Enchant player
TargetPlayer auraTarget = new TargetPlayer();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment));
this.addAbility(new EnchantAbility(auraTarget.getTargetName()));
// Whenever enchanted player is attacked, you gain 2 life. Each opponent attacking that player does the same.
Ability ability = new CurseOfVitalityTriggeredAbility();
ability.addEffect(new GainLifeEffect(2));
this.addAbility(ability);
}
public CurseOfVitality(final CurseOfVitality card) {
super(card);
}
@Override
public CurseOfVitality copy() {
return new CurseOfVitality(this);
}
}
class CurseOfVitalityTriggeredAbility extends TriggeredAbilityImpl {
public CurseOfVitalityTriggeredAbility() {
super(Zone.BATTLEFIELD, new GainLifeTargetEffect(2), false);
}
public CurseOfVitalityTriggeredAbility(final CurseOfVitalityTriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DECLARED_ATTACKERS;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent enchantment = game.getPermanentOrLKIBattlefield(this.getSourceId());
UUID controller = this.getControllerId();
if (enchantment != null
&& enchantment.getAttachedTo() != null
&& game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) {
if (!game.getCombat().getAttackerId().equals(controller)) {
for (Effect effect: this.getEffects()) {
effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId()));
}
}
return true;
}
return false;
}
@Override
public String getRule() {
return "Whenever enchanted player is attacked, you gain 2 life. Each opponent attacking that player does the same.";
}
@Override
public CurseOfVitalityTriggeredAbility copy() {
return new CurseOfVitalityTriggeredAbility(this);
}
}

View file

@ -0,0 +1,99 @@
/*
* 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.abilities.effects.common.PutTokenOntoBattlefieldCopyTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetNonlandPermanent;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author spjspj
*/
public class FracturedIdentity extends CardImpl {
public FracturedIdentity(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{W}{U}");
// Exile target nonland permanent. Each player other than its controller creates a token that's a copy of it.
this.getSpellAbility().addEffect(new FracturedIdentityEffect());
this.getSpellAbility().addTarget(new TargetNonlandPermanent());
}
public FracturedIdentity(final FracturedIdentity card) {
super(card);
}
@Override
public FracturedIdentity copy() {
return new FracturedIdentity(this);
}
}
class FracturedIdentityEffect extends OneShotEffect {
public FracturedIdentityEffect() {
super(Outcome.Exile);
this.staticText = "Exile target nonland permanent. Each player other than its controller creates a token that's a copy of it";
}
public FracturedIdentityEffect(final FracturedIdentityEffect effect) {
super(effect);
}
@Override
public FracturedIdentityEffect copy() {
return new FracturedIdentityEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent == null) {
return false;
}
permanent.moveToExile(null, null, source.getSourceId(), game);
UUID controllerId = permanent.getControllerId();
for (UUID opponentId : game.getOpponents(controllerId)) {
PutTokenOntoBattlefieldCopyTargetEffect effect = new PutTokenOntoBattlefieldCopyTargetEffect(opponentId, null, true);
effect.setTargetPointer(new FixedTarget(permanent, game));
effect.apply(game, source);
}
return true;
}
}

View file

@ -0,0 +1,101 @@
/*
* 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.k;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DestroyAllEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.abilities.effects.common.ChooseCreatureTypeEffect;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author caldover
*/
public class KindredDominance extends CardImpl {
public KindredDominance(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{5}{B}{B}");
// Choose a creature type. Destroy all creatures that are not the chosen type.
this.getSpellAbility().addEffect(new ChooseCreatureTypeEffect(Outcome.DestroyPermanent));
this.getSpellAbility().addEffect(new KindredDominanceEffect());
}
public KindredDominance(final KindredDominance card) {
super(card);
}
@Override
public KindredDominance copy() {
return new KindredDominance(this);
}
}
class KindredDominanceEffect extends OneShotEffect {
public KindredDominanceEffect() {
super(Outcome.DestroyPermanent);
this.staticText = "Destroy all creatures that are not the chosen type.";
}
public KindredDominanceEffect(final KindredDominanceEffect effect) {
super(effect);
}
@Override
public KindredDominanceEffect copy() {
return new KindredDominanceEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject mageObject = game.getObject(source.getSourceId());
if (controller != null & mageObject != null) {
String creatureType = game.getState().getValue(mageObject.getId() + "_type").toString();
FilterPermanent filter = new FilterCreaturePermanent("creatures");
filter.add(Predicates.not(new SubtypePredicate(SubType.byDescription(creatureType))));
return new DestroyAllEffect(filter).apply(game, source);
}
return false;
}
}

View file

@ -27,6 +27,9 @@
*/
package mage.cards.m;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
@ -42,10 +45,6 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
/**
*
* @author jeffwadsworth
@ -123,7 +122,7 @@ class MenacingOgreEffect extends OneShotEffect {
game.informPlayers(player.getLogName() + " chose number " + numberChosen.get(player));
if (numberChosen.get(player) >= highestNumber) {
player.loseLife(highestNumber, game, false);
if (player.getId() == source.getControllerId()
if (player.getId().equals(source.getControllerId())
&& menacingOgre != null) {
menacingOgre.addCounters(CounterType.P1P1.createInstance(2), source, game);
}

View file

@ -183,7 +183,7 @@ class SpellWasNotCastCondition implements Condition {
List<Spell> spells = watcher.getSpellsCastThisTurn(source.getControllerId());
if (spells != null) {
for (Spell spell : spells) {
if (spell.getSourceId() == cardId) {
if (spell.getSourceId().equals(cardId)) {
return false;
}
}

View file

@ -49,11 +49,10 @@ public class Reparations extends CardImpl {
public Reparations(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}{U}");
// Whenever an opponent casts a spell that targets you or a creature you control, you may draw a card.
this.addAbility(new ReparationsTriggeredAbility());
}
public Reparations(final Reparations card) {
@ -96,12 +95,12 @@ class ReparationsTriggeredAbility extends TriggeredAbilityImpl {
Player targetPlayer = game.getPlayer(stackObject.getStackAbility().getFirstTarget());
Permanent targetPermanent = game.getPermanent(stackObject.getStackAbility().getFirstTarget());
if (targetPlayer != null
&& targetPlayer.getId() == controllerId) {
&& targetPlayer.getId().equals(controllerId)) {
return true;
}
if (targetPermanent != null
&& targetPermanent.isCreature()
&& targetPermanent.getControllerId() == controllerId) {
&& targetPermanent.getControllerId().equals(controllerId)) {
return true;
}
}

View file

@ -49,9 +49,15 @@ public class Commander2017 extends ExpansionSet {
cards.add(new SetCardInfo("Balan, Wandering Knight", 2, Rarity.RARE, mage.cards.b.BalanWanderingKnight.class));
cards.add(new SetCardInfo("Bloodsworn Steward", 22, Rarity.RARE, mage.cards.b.BloodswornSteward.class));
cards.add(new SetCardInfo("Curse of Bounty", 30, Rarity.UNCOMMON, mage.cards.c.CurseOfBounty.class));
cards.add(new SetCardInfo("Curse of Disturbance", 16, Rarity.UNCOMMON, mage.cards.c.CurseOfDisturbance.class));
cards.add(new SetCardInfo("Curse of Opulence", 24, Rarity.UNCOMMON, mage.cards.c.CurseOfOpulence.class));
cards.add(new SetCardInfo("Curse of Verbosity", 9, Rarity.UNCOMMON, mage.cards.c.CurseOfVerbosity.class));
cards.add(new SetCardInfo("Curse of Vitality", 3, Rarity.UNCOMMON, mage.cards.c.CurseOfVitality.class));
cards.add(new SetCardInfo("Herald's Horn", 53, Rarity.UNCOMMON, mage.cards.h.HeraldsHorn.class));
cards.add(new SetCardInfo("Hungry Lynx", 31, Rarity.RARE, mage.cards.h.HungryLynx.class));
cards.add(new SetCardInfo("Crimson Honor Guard", 23, Rarity.RARE, mage.cards.c.CrimsonHonorGuard.class));
cards.add(new SetCardInfo("Fractured Identity", 37, Rarity.RARE, mage.cards.f.FracturedIdentity.class));
cards.add(new SetCardInfo("Nazahn, Revered Bladesmith", 44, Rarity.MYTHIC, mage.cards.n.NazahnReveredBladesmith.class));
cards.add(new SetCardInfo("O-Kagachi, Vengeful Kami", 45, Rarity.MYTHIC, mage.cards.o.OKagachiVengefulKami.class));
cards.add(new SetCardInfo("Patron of the Vein", 20, Rarity.RARE, mage.cards.p.PatronOfTheVein.class));
@ -63,6 +69,8 @@ public class Commander2017 extends ExpansionSet {
cards.add(new SetCardInfo("Teferi's Protection", 8, Rarity.RARE, mage.cards.t.TeferisProtection.class));
cards.add(new SetCardInfo("Traverse the Outlands", 34, Rarity.RARE, mage.cards.t.TraverseTheOutlands.class));
cards.add(new SetCardInfo("Wasitora, Nekoru Queen", 49, Rarity.MYTHIC, mage.cards.w.WasitoraNekoruQueen.class));
cards.add(new SetCardInfo("Kindred Dominance", 18, Rarity.RARE, mage.cards.w.WasitoraNekoruQueen.class));
}
}

View file

@ -58,7 +58,7 @@ public class PlayerDiedStackTargetHandlingTest extends CardTestMultiPlayerBase {
execute();
assertGraveyardCount(playerA, "Lightning Helix", 2);
Assert.assertTrue("Active player has to be player C", currentGame.getActivePlayerId() == playerC.getId());
Assert.assertTrue("Active player has to be player C", currentGame.getActivePlayerId().equals(playerC.getId()));
assertLife(playerA, 6);
@ -93,7 +93,7 @@ public class PlayerDiedStackTargetHandlingTest extends CardTestMultiPlayerBase {
assertPermanentCount(playerA, "Silvercoat Lion", 2);
assertGraveyardCount(playerA, "Tendrils of Agony", 1);
Assert.assertTrue("Active player has to be player C", currentGame.getActivePlayerId() == playerC.getId());
Assert.assertTrue("Active player has to be player C", currentGame.getActivePlayerId().equals(playerC.getId()));
assertLife(playerA, 7);

View file

@ -25,7 +25,6 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.common;
import mage.abilities.TriggeredAbilityImpl;
@ -33,14 +32,14 @@ import mage.abilities.effects.Effect;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.combat.CombatGroup;
import mage.game.events.GameEvent.EventType;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
public class AttacksAndIsNotBlockedTriggeredAbility extends TriggeredAbilityImpl {
private boolean setTargetPointer;
private final boolean setTargetPointer;
public AttacksAndIsNotBlockedTriggeredAbility(Effect effect) {
this(effect, false, false);
@ -72,14 +71,12 @@ public class AttacksAndIsNotBlockedTriggeredAbility extends TriggeredAbilityImpl
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent sourcePermanent = game.getPermanent(getSourceId());
if(sourcePermanent.isAttacking()) {
for(CombatGroup combatGroup: game.getCombat().getGroups()) {
if(combatGroup.getBlockers().isEmpty() && combatGroup.getAttackers().contains(getSourceId())) {
if(setTargetPointer) {
for(Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(game.getCombat().getDefendingPlayerId(getSourceId(), game)));
}
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(getSourceId());
if (sourcePermanent != null && sourcePermanent.isAttacking()) {
for (CombatGroup combatGroup : game.getCombat().getGroups()) {
if (combatGroup.getBlockers().isEmpty() && combatGroup.getAttackers().contains(getSourceId())) {
if (setTargetPointer) {
this.getEffects().setTargetPointer(new FixedTarget(game.getCombat().getDefendingPlayerId(getSourceId(), game)));
}
return true;
}

View file

@ -180,7 +180,7 @@ class AftermathExileAsResolvesFromGraveyard extends ReplacementEffectImpl {
sourceId = sourceCard.getId();
}
if (event.getTargetId() == sourceId) {
if (event.getTargetId().equals(sourceId)) {
// Moving this spell from stack to yard
Spell spell = game.getStack().getSpell(source.getSourceId());
if (spell != null && spell.getFromZone() == Zone.GRAVEYARD) {

View file

@ -28,6 +28,9 @@
package mage.game.permanent.token;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.effects.common.AddManaOfAnyColorEffect;
import mage.abilities.mana.SimpleManaAbility;
@ -39,10 +42,24 @@ import mage.constants.Zone;
* @author LevelX2
*/
public class GoldToken extends Token {
final static private List<String> tokenImageSets = new ArrayList<>();
static {
tokenImageSets.addAll(Arrays.asList("BNG", "C17"));
}
public GoldToken() {
this(null, 0);
}
public GoldToken(String setCode) {
this(setCode, 0);
}
public GoldToken(String setCode, int tokenType) {
super("Gold", "colorless artifact token named Gold onto the battlefield. It has \"Sacrifice this artifact: Add one mana of any color to your mana pool.\"");
this.setOriginalExpansionSetCode("BNG");
availableImageSetCodes = tokenImageSets;
setOriginalExpansionSetCode(setCode);
cardType.add(CardType.ARTIFACT);
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(), new SacrificeSourceCost()));

View file

@ -44,7 +44,7 @@ public class ZombieToken extends Token {
final static private List<String> tokenImageSets = new ArrayList<>();
static {
tokenImageSets.addAll(Arrays.asList("10E", "M10", "M11", "M12", "M13", "M14", "M15", "MBS", "ALA", "ISD", "C14", "C15", "C16", "CNS",
tokenImageSets.addAll(Arrays.asList("10E", "M10", "M11", "M12", "M13", "M14", "M15", "MBS", "ALA", "ISD", "C14", "C15", "C16", "C17", "CNS",
"MMA", "BNG", "KTK", "DTK", "ORI", "OGW", "SOI", "EMN", "EMA", "MM3", "AKH", "CMA", "E01"));
}