mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
Fixed some problems with UUID comparing and some problems with card moving.
This commit is contained in:
parent
4d8263ff82
commit
52d0adcac1
45 changed files with 364 additions and 360 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -90,3 +90,4 @@ Mage.Server.Plugins/Mage.Draft.8PlayerBooster/target
|
||||||
*.txt
|
*.txt
|
||||||
Mage.Client/serverlist.txt
|
Mage.Client/serverlist.txt
|
||||||
/bin/
|
/bin/
|
||||||
|
/target/
|
|
@ -184,7 +184,7 @@ public class GameView implements Serializable {
|
||||||
}
|
}
|
||||||
if (isPlayer) {
|
if (isPlayer) {
|
||||||
// has only to be set for active palyer with priority (e.g. pay mana by delve or Quenchable Fire special action)
|
// has only to be set for active palyer with priority (e.g. pay mana by delve or Quenchable Fire special action)
|
||||||
if (state.getPriorityPlayerId() == createdForPlayerId && createdForPlayer != null) {
|
if (createdForPlayer != null && createdForPlayerId.equals(state.getPriorityPlayerId())) {
|
||||||
this.special = state.getSpecialActions().getControlledBy(state.getPriorityPlayerId(), createdForPlayer.isInPayManaMode()).size() > 0;
|
this.special = state.getSpecialActions().getControlledBy(state.getPriorityPlayerId(), createdForPlayer.isInPayManaMode()).size() > 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -60,9 +60,6 @@ public class Thraximundar extends CardImpl {
|
||||||
this.subtype.add("Zombie");
|
this.subtype.add("Zombie");
|
||||||
this.subtype.add("Assassin");
|
this.subtype.add("Assassin");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.power = new MageInt(6);
|
this.power = new MageInt(6);
|
||||||
this.toughness = new MageInt(6);
|
this.toughness = new MageInt(6);
|
||||||
|
|
||||||
|
@ -116,7 +113,8 @@ class ThraximundarTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (event.getSourceId() == this.getSourceId()) {
|
if (event.getSourceId() != null
|
||||||
|
&& event.getSourceId().equals(this.getSourceId())) {
|
||||||
UUID defender = game.getCombat().getDefendingPlayerId(this.getSourceId(), game);
|
UUID defender = game.getCombat().getDefendingPlayerId(this.getSourceId(), game);
|
||||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(defender));
|
this.getEffects().get(0).setTargetPointer(new FixedTarget(defender));
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -25,13 +25,9 @@
|
||||||
* authors and should not be interpreted as representing official policies, either expressed
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package mage.sets.apocalypse;
|
package mage.sets.apocalypse;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
|
@ -41,6 +37,9 @@ import mage.abilities.keyword.FlyingAbility;
|
||||||
import mage.abilities.keyword.KickerAbility;
|
import mage.abilities.keyword.KickerAbility;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Rarity;
|
||||||
import mage.filter.common.FilterLandPermanent;
|
import mage.filter.common.FilterLandPermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
@ -79,6 +78,7 @@ public class DesolationAngel extends CardImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
class DesolationAngelEntersBattlefieldEffect extends OneShotEffect {
|
class DesolationAngelEntersBattlefieldEffect extends OneShotEffect {
|
||||||
|
|
||||||
DesolationAngelEntersBattlefieldEffect() {
|
DesolationAngelEntersBattlefieldEffect() {
|
||||||
super(Outcome.DestroyPermanent);
|
super(Outcome.DestroyPermanent);
|
||||||
staticText = "destroy all lands you control. If it was kicked, destroy all lands instead";
|
staticText = "destroy all lands you control. If it was kicked, destroy all lands instead";
|
||||||
|
@ -93,7 +93,7 @@ class DesolationAngelEntersBattlefieldEffect extends OneShotEffect {
|
||||||
Card p = game.getCard(source.getSourceId());
|
Card p = game.getCard(source.getSourceId());
|
||||||
boolean kicked = KickedCondition.getInstance().apply(game, source);
|
boolean kicked = KickedCondition.getInstance().apply(game, source);
|
||||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterLandPermanent(), source.getControllerId(), source.getSourceId(), game)) {
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterLandPermanent(), source.getControllerId(), source.getSourceId(), game)) {
|
||||||
if ((!kicked && permanent.getControllerId() == source.getControllerId())
|
if ((!kicked && permanent.getControllerId().equals(source.getControllerId()))
|
||||||
|| kicked) {
|
|| kicked) {
|
||||||
permanent.destroy(source.getSourceId(), game, false);
|
permanent.destroy(source.getSourceId(), game, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,7 +143,9 @@ class UlamogAttackTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
Permanent sourcePermanent = game.getPermanent(this.getSourceId());
|
Permanent sourcePermanent = game.getPermanent(this.getSourceId());
|
||||||
if (sourcePermanent != null && event.getSourceId() == this.getSourceId()) {
|
if (sourcePermanent != null
|
||||||
|
&& event.getSourceId() != null
|
||||||
|
&& event.getSourceId().equals(this.getSourceId())) {
|
||||||
UUID defender = game.getCombat().getDefendingPlayerId(this.getSourceId(), game);
|
UUID defender = game.getCombat().getDefendingPlayerId(this.getSourceId(), game);
|
||||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(defender));
|
this.getEffects().get(0).setTargetPointer(new FixedTarget(defender));
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class SpitefulReturned extends CardImpl {
|
||||||
effect.setText("defending player loses 2 life");
|
effect.setText("defending player loses 2 life");
|
||||||
this.addAbility(new SpitefulReturnedTriggeredAbility(effect));
|
this.addAbility(new SpitefulReturnedTriggeredAbility(effect));
|
||||||
// Enchanted creature gets +1/+1.
|
// Enchanted creature gets +1/+1.
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(1,1, Duration.WhileOnBattlefield)));
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(1, 1, Duration.WhileOnBattlefield)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpitefulReturned(final SpitefulReturned card) {
|
public SpitefulReturned(final SpitefulReturned card) {
|
||||||
|
@ -105,7 +105,8 @@ class SpitefulReturnedTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
Permanent sourcePermanent = game.getPermanent(this.getSourceId());
|
Permanent sourcePermanent = game.getPermanent(this.getSourceId());
|
||||||
if (sourcePermanent != null) {
|
if (sourcePermanent != null) {
|
||||||
if (sourcePermanent.getCardType().contains(CardType.CREATURE)) {
|
if (sourcePermanent.getCardType().contains(CardType.CREATURE)) {
|
||||||
if (event.getSourceId() == this.getSourceId()) {
|
if (event.getSourceId() != null
|
||||||
|
&& event.getSourceId().equals(this.getSourceId())) {
|
||||||
UUID defender = game.getCombat().getDefendingPlayerId(this.getSourceId(), game);
|
UUID defender = game.getCombat().getDefendingPlayerId(this.getSourceId(), game);
|
||||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(defender));
|
this.getEffects().get(0).setTargetPointer(new FixedTarget(defender));
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -115,7 +115,10 @@ class HallOfTheBanditLordWatcher extends Watcher {
|
||||||
public void watch(GameEvent event, Game game) {
|
public void watch(GameEvent event, Game game) {
|
||||||
if (event.getType() == EventType.MANA_PAYED) {
|
if (event.getType() == EventType.MANA_PAYED) {
|
||||||
MageObject target = game.getObject(event.getTargetId());
|
MageObject target = game.getObject(event.getTargetId());
|
||||||
if (event.getSourceId() == this.getSourceId() && target != null && target.getCardType().contains(CardType.CREATURE) && event.getFlag()) {
|
if (event.getSourceId() != null
|
||||||
|
&& event.getSourceId().equals(this.getSourceId())
|
||||||
|
&& target != null && target.getCardType().contains(CardType.CREATURE)
|
||||||
|
&& event.getFlag()) {
|
||||||
if (target instanceof Spell) {
|
if (target instanceof Spell) {
|
||||||
this.creatures.add(((Spell) target).getCard().getId());
|
this.creatures.add(((Spell) target).getCard().getId());
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,14 +25,9 @@
|
||||||
* authors and should not be interpreted as representing official policies, either expressed
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package mage.sets.championsofkamigawa;
|
package mage.sets.championsofkamigawa;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
|
@ -44,7 +39,10 @@ import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.Cards;
|
import mage.cards.Cards;
|
||||||
import mage.cards.CardsImpl;
|
import mage.cards.CardsImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.counters.CounterType;
|
import mage.counters.CounterType;
|
||||||
import mage.filter.Filter;
|
import mage.filter.Filter;
|
||||||
import mage.filter.common.FilterNonlandCard;
|
import mage.filter.common.FilterNonlandCard;
|
||||||
|
@ -61,7 +59,7 @@ import mage.target.common.TargetCardInLibrary;
|
||||||
*/
|
*/
|
||||||
public class NightDealings extends CardImpl {
|
public class NightDealings extends CardImpl {
|
||||||
|
|
||||||
public NightDealings (UUID ownerId) {
|
public NightDealings(UUID ownerId) {
|
||||||
super(ownerId, 132, "Night Dealings", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}{B}");
|
super(ownerId, 132, "Night Dealings", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}{B}");
|
||||||
this.expansionSetCode = "CHK";
|
this.expansionSetCode = "CHK";
|
||||||
|
|
||||||
|
@ -74,7 +72,7 @@ public class NightDealings extends CardImpl {
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NightDealings (final NightDealings card) {
|
public NightDealings(final NightDealings card) {
|
||||||
super(card);
|
super(card);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +81,6 @@ public class NightDealings extends CardImpl {
|
||||||
return new NightDealings(this);
|
return new NightDealings(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private class NightDealingsTriggeredAbility extends TriggeredAbilityImpl {
|
private class NightDealingsTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
public NightDealingsTriggeredAbility() {
|
public NightDealingsTriggeredAbility() {
|
||||||
|
@ -110,7 +107,7 @@ public class NightDealings extends CardImpl {
|
||||||
if (this.getControllerId() != event.getTargetId()) {
|
if (this.getControllerId() != event.getTargetId()) {
|
||||||
// a source you control
|
// a source you control
|
||||||
UUID sourceControllerId = game.getControllerId(event.getSourceId());
|
UUID sourceControllerId = game.getControllerId(event.getSourceId());
|
||||||
if (sourceControllerId != null && sourceControllerId == this.getControllerId()) {
|
if (sourceControllerId != null && sourceControllerId.equals(this.getControllerId())) {
|
||||||
// save amount of damage to effect
|
// save amount of damage to effect
|
||||||
this.getEffects().get(0).setValue("damageAmount", event.getAmount());
|
this.getEffects().get(0).setValue("damageAmount", event.getAmount());
|
||||||
return true;
|
return true;
|
||||||
|
@ -181,7 +178,7 @@ public class NightDealings extends CardImpl {
|
||||||
int cmc = 0;
|
int cmc = 0;
|
||||||
for (Cost cost : source.getCosts()) {
|
for (Cost cost : source.getCosts()) {
|
||||||
if (cost instanceof RemoveVariableCountersSourceCost) {
|
if (cost instanceof RemoveVariableCountersSourceCost) {
|
||||||
cmc = ((RemoveVariableCountersSourceCost)cost).getAmount();
|
cmc = ((RemoveVariableCountersSourceCost) cost).getAmount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,8 @@ import mage.abilities.Ability;
|
||||||
import mage.abilities.condition.Condition;
|
import mage.abilities.condition.Condition;
|
||||||
import mage.abilities.decorator.ConditionalOneShotEffect;
|
import mage.abilities.decorator.ConditionalOneShotEffect;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.common.discard.DiscardControllerEffect;
|
|
||||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||||
|
import mage.abilities.effects.common.discard.DiscardControllerEffect;
|
||||||
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
|
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
|
@ -56,6 +56,7 @@ public class SiftThroughSands extends CardImpl {
|
||||||
|
|
||||||
private static final String rule = "If you've cast a spell named Peer Through Depths and a spell named Reach Through Mists this turn, you may search your library for a card named The Unspeakable, put it onto the battlefield, then shuffle your library";
|
private static final String rule = "If you've cast a spell named Peer Through Depths and a spell named Reach Through Mists this turn, you may search your library for a card named The Unspeakable, put it onto the battlefield, then shuffle your library";
|
||||||
private static final FilterCreatureCard filter = new FilterCreatureCard("a card named The Unspeakable");
|
private static final FilterCreatureCard filter = new FilterCreatureCard("a card named The Unspeakable");
|
||||||
|
|
||||||
static {
|
static {
|
||||||
filter.add(new NamePredicate("The Unspeakable"));
|
filter.add(new NamePredicate("The Unspeakable"));
|
||||||
}
|
}
|
||||||
|
@ -65,7 +66,6 @@ public class SiftThroughSands extends CardImpl {
|
||||||
this.expansionSetCode = "CHK";
|
this.expansionSetCode = "CHK";
|
||||||
this.subtype.add("Arcane");
|
this.subtype.add("Arcane");
|
||||||
|
|
||||||
|
|
||||||
// Draw two cards, then discard a card.
|
// Draw two cards, then discard a card.
|
||||||
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(2));
|
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(2));
|
||||||
Effect effect = new DiscardControllerEffect(1);
|
Effect effect = new DiscardControllerEffect(1);
|
||||||
|
@ -125,7 +125,7 @@ class SiftThroughSandsWatcher extends Watcher {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.getType() == EventType.SPELL_CAST
|
if (event.getType() == EventType.SPELL_CAST
|
||||||
&& controllerId == event.getPlayerId()) {
|
&& controllerId.equals(event.getPlayerId())) {
|
||||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||||
if (spell.getCard().getName().equals("Peer Through Depths")) {
|
if (spell.getCard().getName().equals("Peer Through Depths")) {
|
||||||
castPeerThroughDepths = true;
|
castPeerThroughDepths = true;
|
||||||
|
|
|
@ -44,8 +44,8 @@ import mage.filter.FilterCard;
|
||||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||||
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent.EventType;
|
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.events.GameEvent.EventType;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.common.TargetCardInLibrary;
|
import mage.target.common.TargetCardInLibrary;
|
||||||
|
@ -98,7 +98,7 @@ class HibernationsEndAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
return event.getSourceId() == this.getSourceId();
|
return event.getSourceId() != null && event.getSourceId().equals(this.getSourceId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -127,7 +127,7 @@ class HibernationsEndEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||||
if(sourcePermanent != null && player != null) {
|
if (sourcePermanent != null && player != null) {
|
||||||
int newConvertedCost = sourcePermanent.getCounters().getCount("age");
|
int newConvertedCost = sourcePermanent.getCounters().getCount("age");
|
||||||
FilterCard filter = new FilterCard("creature card with converted mana cost " + newConvertedCost);
|
FilterCard filter = new FilterCard("creature card with converted mana cost " + newConvertedCost);
|
||||||
filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, newConvertedCost));
|
filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, newConvertedCost));
|
||||||
|
@ -138,4 +138,3 @@ class HibernationsEndEffect extends OneShotEffect {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ class ChorusOfTheConclaveReplacementEffect extends ReplacementEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getPlayerId() == source.getControllerId()) {
|
if (event.getPlayerId().equals(source.getControllerId())) {
|
||||||
MageObject spellObject = game.getObject(event.getSourceId());
|
MageObject spellObject = game.getObject(event.getSourceId());
|
||||||
if (spellObject != null) {
|
if (spellObject != null) {
|
||||||
return spellObject.getCardType().contains(CardType.CREATURE);
|
return spellObject.getCardType().contains(CardType.CREATURE);
|
||||||
|
|
|
@ -92,9 +92,9 @@ class RubiniaSoulsingerCondition implements Condition {
|
||||||
controllerId = source.getControllerId();
|
controllerId = source.getControllerId();
|
||||||
}
|
}
|
||||||
Permanent permanent = game.getBattlefield().getPermanent(source.getSourceId());
|
Permanent permanent = game.getBattlefield().getPermanent(source.getSourceId());
|
||||||
if (permanent != null){
|
if (permanent != null) {
|
||||||
if (permanent.isTapped()){
|
if (permanent.isTapped()) {
|
||||||
return controllerId == source.getControllerId();
|
return controllerId.equals(source.getControllerId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -61,7 +61,6 @@ public class InfernalOffering extends CardImpl {
|
||||||
super(ownerId, 24, "Infernal Offering", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{4}{B}");
|
super(ownerId, 24, "Infernal Offering", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{4}{B}");
|
||||||
this.expansionSetCode = "C14";
|
this.expansionSetCode = "C14";
|
||||||
|
|
||||||
|
|
||||||
// Choose an opponent. You and that player each sacrifice a creature. Each player who sacrificed a creature this way draws two cards.
|
// Choose an opponent. You and that player each sacrifice a creature. Each player who sacrificed a creature this way draws two cards.
|
||||||
this.getSpellAbility().addEffect(new InfernalOfferingSacrificeEffect());
|
this.getSpellAbility().addEffect(new InfernalOfferingSacrificeEffect());
|
||||||
|
|
||||||
|
@ -106,7 +105,7 @@ class InfernalOfferingSacrificeEffect extends OneShotEffect {
|
||||||
//Choose creatures to sacrifice
|
//Choose creatures to sacrifice
|
||||||
Map<UUID, UUID> toSacrifice = new HashMap<>(2);
|
Map<UUID, UUID> toSacrifice = new HashMap<>(2);
|
||||||
for (UUID playerId : player.getInRange()) {
|
for (UUID playerId : player.getInRange()) {
|
||||||
if (playerId == player.getId() || playerId == opponent.getId()) {
|
if (playerId.equals(player.getId()) || playerId.equals(opponent.getId())) {
|
||||||
target = new TargetControlledCreaturePermanent(1, 1, new FilterControlledCreaturePermanent(), true);
|
target = new TargetControlledCreaturePermanent(1, 1, new FilterControlledCreaturePermanent(), true);
|
||||||
if (target.choose(Outcome.Sacrifice, playerId, source.getControllerId(), game)) {
|
if (target.choose(Outcome.Sacrifice, playerId, source.getControllerId(), game)) {
|
||||||
toSacrifice.put(playerId, target.getFirstTarget());
|
toSacrifice.put(playerId, target.getFirstTarget());
|
||||||
|
|
|
@ -93,7 +93,7 @@ class LichsTombTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (event.getPlayerId() == this.getControllerId()) {
|
if (event.getPlayerId().equals(this.getControllerId())) {
|
||||||
((SacrificeEffect) this.getEffects().get(0)).setAmount(new StaticValue(event.getAmount()));
|
((SacrificeEffect) this.getEffects().get(0)).setAmount(new StaticValue(event.getAmount()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,6 +98,7 @@ class CastBlueSpellThisTurnCondition implements Condition {
|
||||||
class DreamThiefWatcher extends Watcher {
|
class DreamThiefWatcher extends Watcher {
|
||||||
|
|
||||||
private static final FilterSpell filter = new FilterSpell();
|
private static final FilterSpell filter = new FilterSpell();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
filter.add(new ColorPredicate(ObjectColor.BLUE));
|
filter.add(new ColorPredicate(ObjectColor.BLUE));
|
||||||
}
|
}
|
||||||
|
@ -125,7 +126,7 @@ class DreamThiefWatcher extends Watcher {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.getType() == EventType.SPELL_CAST
|
if (event.getType() == EventType.SPELL_CAST
|
||||||
&& controllerId == event.getPlayerId()) {
|
&& controllerId.equals(event.getPlayerId())) {
|
||||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||||
if (!spell.getSourceId().equals(cardId) && filter.match(spell, game)) {
|
if (!spell.getSourceId().equals(cardId) && filter.match(spell, game)) {
|
||||||
condition = true;
|
condition = true;
|
||||||
|
|
|
@ -40,11 +40,13 @@ import mage.constants.Outcome;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.constants.TargetController;
|
import mage.constants.TargetController;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
|
import mage.filter.FilterCard;
|
||||||
import mage.filter.common.FilterLandCard;
|
import mage.filter.common.FilterLandCard;
|
||||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||||
import mage.game.ExileZone;
|
import mage.game.ExileZone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
import mage.target.TargetCard;
|
||||||
import mage.target.common.TargetCardInLibrary;
|
import mage.target.common.TargetCardInLibrary;
|
||||||
import mage.util.CardUtil;
|
import mage.util.CardUtil;
|
||||||
|
|
||||||
|
@ -58,7 +60,6 @@ public class EndlessHorizons extends CardImpl {
|
||||||
super(ownerId, 4, "Endless Horizons", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}");
|
super(ownerId, 4, "Endless Horizons", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}");
|
||||||
this.expansionSetCode = "EVE";
|
this.expansionSetCode = "EVE";
|
||||||
|
|
||||||
|
|
||||||
// When Endless Horizons enters the battlefield, search your library for any number of Plains cards and exile them. Then shuffle your library.
|
// When Endless Horizons enters the battlefield, search your library for any number of Plains cards and exile them. Then shuffle your library.
|
||||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new EndlessHorizonsEffect(), false));
|
this.addAbility(new EntersBattlefieldTriggeredAbility(new EndlessHorizonsEffect(), false));
|
||||||
|
|
||||||
|
@ -122,7 +123,7 @@ class EndlessHorizonsEffect extends SearchEffect {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class EndlessHorizonsEffect2 extends OneShotEffect {
|
class EndlessHorizonsEffect2 extends OneShotEffect {
|
||||||
|
|
||||||
public EndlessHorizonsEffect2() {
|
public EndlessHorizonsEffect2() {
|
||||||
super(Outcome.ReturnToHand);
|
super(Outcome.ReturnToHand);
|
||||||
|
@ -140,16 +141,23 @@ class EndlessHorizonsEffect extends SearchEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
if (controller != null) {
|
||||||
ExileZone exZone = game.getExile().getExileZone(CardUtil.getCardExileZoneId(game, source));
|
ExileZone exZone = game.getExile().getExileZone(CardUtil.getCardExileZoneId(game, source));
|
||||||
if (exZone != null) {
|
if (exZone != null) {
|
||||||
for (Card card : exZone.getCards(game)) {
|
Card card = null;
|
||||||
if (card.getOwnerId() == source.getControllerId()) {
|
if (exZone.size() > 1) {
|
||||||
card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
|
TargetCard target = new TargetCard(Zone.EXILED, new FilterCard());
|
||||||
break; // only one
|
controller.choose(outcome, exZone, target, game);
|
||||||
}
|
card = game.getCard(target.getFirstTarget());
|
||||||
|
} else {
|
||||||
|
card = exZone.getRandom(game);
|
||||||
}
|
}
|
||||||
|
controller.moveCards(card, null, Zone.HAND, source, game);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,7 @@ class CastRedSpellThisTurnCondition implements Condition {
|
||||||
class HotHeadedGiantWatcher extends Watcher {
|
class HotHeadedGiantWatcher extends Watcher {
|
||||||
|
|
||||||
private static final FilterSpell filter = new FilterSpell();
|
private static final FilterSpell filter = new FilterSpell();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
filter.add(new ColorPredicate(ObjectColor.RED));
|
filter.add(new ColorPredicate(ObjectColor.RED));
|
||||||
}
|
}
|
||||||
|
@ -126,7 +127,7 @@ class HotHeadedGiantWatcher extends Watcher {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.getType() == EventType.SPELL_CAST
|
if (event.getType() == EventType.SPELL_CAST
|
||||||
&& controllerId == event.getPlayerId()) {
|
&& controllerId.equals(event.getPlayerId())) {
|
||||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||||
if (!spell.getSourceId().equals(cardId) && filter.match(spell, game)) {
|
if (!spell.getSourceId().equals(cardId) && filter.match(spell, game)) {
|
||||||
condition = true;
|
condition = true;
|
||||||
|
|
|
@ -32,7 +32,6 @@ import mage.ObjectColor;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.condition.Condition;
|
import mage.abilities.condition.Condition;
|
||||||
import mage.abilities.decorator.ConditionalOneShotEffect;
|
import mage.abilities.decorator.ConditionalOneShotEffect;
|
||||||
import mage.abilities.effects.Effect;
|
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
@ -72,7 +71,6 @@ public class SoulReap extends CardImpl {
|
||||||
super(ownerId, 44, "Soul Reap", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{1}{B}");
|
super(ownerId, 44, "Soul Reap", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{1}{B}");
|
||||||
this.expansionSetCode = "EVE";
|
this.expansionSetCode = "EVE";
|
||||||
|
|
||||||
|
|
||||||
// Destroy target nongreen creature. Its controller loses 3 life if you've cast another black spell this turn.
|
// Destroy target nongreen creature. Its controller loses 3 life if you've cast another black spell this turn.
|
||||||
this.getSpellAbility().addEffect(new DestroyTargetEffect());
|
this.getSpellAbility().addEffect(new DestroyTargetEffect());
|
||||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter));
|
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter));
|
||||||
|
@ -134,7 +132,7 @@ class SoulReapWatcher extends Watcher {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.getType() == EventType.SPELL_CAST
|
if (event.getType() == EventType.SPELL_CAST
|
||||||
&& controllerId == event.getPlayerId()) {
|
&& controllerId.equals(event.getPlayerId())) {
|
||||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||||
if (!spell.getSourceId().equals(cardId) && filter.match(spell, game)) {
|
if (!spell.getSourceId().equals(cardId) && filter.match(spell, game)) {
|
||||||
condition = true;
|
condition = true;
|
||||||
|
|
|
@ -34,7 +34,6 @@ import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.condition.Condition;
|
import mage.abilities.condition.Condition;
|
||||||
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
||||||
import mage.abilities.effects.ReplacementEffectImpl;
|
|
||||||
import mage.abilities.keyword.TrampleAbility;
|
import mage.abilities.keyword.TrampleAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
|
@ -159,7 +158,7 @@ class TalarasBattalionWatcher extends Watcher {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.getType() == EventType.SPELL_CAST
|
if (event.getType() == EventType.SPELL_CAST
|
||||||
&& controllerId == event.getPlayerId()) {
|
&& controllerId.equals(event.getPlayerId())) {
|
||||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||||
if (!spell.getSourceId().equals(cardId) && filter.match(spell, game)) {
|
if (!spell.getSourceId().equals(cardId) && filter.match(spell, game)) {
|
||||||
condition = true;
|
condition = true;
|
||||||
|
|
|
@ -99,7 +99,7 @@ class SoltariVisionaryTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
Permanent soltari = game.getPermanent(event.getSourceId());
|
Permanent soltari = game.getPermanent(event.getSourceId());
|
||||||
if (soltari != null && soltari.getId() == this.getSourceId()) {
|
if (soltari != null && soltari.getId().equals(this.getSourceId())) {
|
||||||
FilterEnchantmentPermanent filter = new FilterEnchantmentPermanent("enchantment that player controls.");
|
FilterEnchantmentPermanent filter = new FilterEnchantmentPermanent("enchantment that player controls.");
|
||||||
filter.add(new ControllerIdPredicate(event.getPlayerId()));
|
filter.add(new ControllerIdPredicate(event.getPlayerId()));
|
||||||
filter.setMessage("enchantment controlled by " + game.getPlayer(event.getTargetId()).getLogName());
|
filter.setMessage("enchantment controlled by " + game.getPlayer(event.getTargetId()).getLogName());
|
||||||
|
|
|
@ -99,7 +99,7 @@ class MarduWoeReaperTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (event.getPlayerId().equals(this.getControllerId())) {
|
if (event.getPlayerId().equals(this.getControllerId())) {
|
||||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||||
if (permanent != null && (permanent.getId() == this.getSourceId() || permanent.hasSubtype("Warrior"))) {
|
if (permanent != null && (permanent.getId().equals(this.getSourceId()) || permanent.hasSubtype("Warrior"))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,6 @@ public class WardscaleDragon extends CardImpl {
|
||||||
// As long as Wardscale Dragon is attacking, defending player can't cast spells.
|
// As long as Wardscale Dragon is attacking, defending player can't cast spells.
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new WardscaleDragonRuleEffect()));
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new WardscaleDragonRuleEffect()));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public WardscaleDragon(final WardscaleDragon card) {
|
public WardscaleDragon(final WardscaleDragon card) {
|
||||||
|
@ -105,7 +104,7 @@ class WardscaleDragonRuleEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||||
if (sourcePermanent != null && sourcePermanent.isAttacking()) {
|
if (sourcePermanent != null && sourcePermanent.isAttacking()) {
|
||||||
return event.getPlayerId() == game.getCombat().getDefendingPlayerId(sourcePermanent.getId(), game);
|
return event.getPlayerId().equals(game.getCombat().getDefendingPlayerId(sourcePermanent.getId(), game));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,7 @@ public class InstillEnergy extends CardImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
class CanAttackAsThoughItHadHasteEnchantedEffect extends AsThoughEffectImpl {
|
class CanAttackAsThoughItHadHasteEnchantedEffect extends AsThoughEffectImpl {
|
||||||
|
|
||||||
public CanAttackAsThoughItHadHasteEnchantedEffect(Duration duration) {
|
public CanAttackAsThoughItHadHasteEnchantedEffect(Duration duration) {
|
||||||
super(AsThoughEffectType.ATTACK, duration, Outcome.Benefit);
|
super(AsThoughEffectType.ATTACK, duration, Outcome.Benefit);
|
||||||
staticText = "Enchanted creature can attack as though it had haste";
|
staticText = "Enchanted creature can attack as though it had haste";
|
||||||
|
@ -114,7 +115,7 @@ class CanAttackAsThoughItHadHasteEnchantedEffect extends AsThoughEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||||
Permanent enchantment = game.getPermanent(source.getSourceId());
|
Permanent enchantment = game.getPermanent(source.getSourceId());
|
||||||
return enchantment != null && enchantment.getAttachedTo() != null && enchantment.getAttachedTo() == objectId;
|
return enchantment != null && enchantment.getAttachedTo() != null && enchantment.getAttachedTo().equals(objectId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,14 +52,12 @@ public class Fastbond extends CardImpl {
|
||||||
super(ownerId, 101, "Fastbond", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{G}");
|
super(ownerId, 101, "Fastbond", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{G}");
|
||||||
this.expansionSetCode = "LEA";
|
this.expansionSetCode = "LEA";
|
||||||
|
|
||||||
|
|
||||||
// You may play any number of additional lands on each of your turns.
|
// You may play any number of additional lands on each of your turns.
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PlayAdditionalLandsControllerEffect(Integer.MAX_VALUE, Duration.WhileOnBattlefield)));
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PlayAdditionalLandsControllerEffect(Integer.MAX_VALUE, Duration.WhileOnBattlefield)));
|
||||||
// Whenever you play a land, if it wasn't the first land you played this turn, Fastbond deals 1 damage to you.
|
// Whenever you play a land, if it wasn't the first land you played this turn, Fastbond deals 1 damage to you.
|
||||||
this.addAbility(new PlayALandTriggeredAbility());
|
this.addAbility(new PlayALandTriggeredAbility());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Fastbond(final Fastbond card) {
|
public Fastbond(final Fastbond card) {
|
||||||
super(card);
|
super(card);
|
||||||
}
|
}
|
||||||
|
@ -70,7 +68,6 @@ public class Fastbond extends CardImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class PlayALandTriggeredAbility extends TriggeredAbilityImpl {
|
class PlayALandTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
public PlayALandTriggeredAbility() {
|
public PlayALandTriggeredAbility() {
|
||||||
|
@ -88,14 +85,14 @@ class PlayALandTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
return event.getPlayerId() == this.getControllerId();
|
return event.getPlayerId().equals(this.getControllerId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkInterveningIfClause(Game game) {
|
public boolean checkInterveningIfClause(Game game) {
|
||||||
Player player = game.getPlayer(this.getControllerId());
|
Player player = game.getPlayer(this.getControllerId());
|
||||||
if (player != null){
|
if (player != null) {
|
||||||
if (player.getLandsPlayed() != 1){
|
if (player.getLandsPlayed() != 1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,7 +109,4 @@ class PlayALandTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
return "Whenever you play a land, if it wasn't the first land you played this turn, {source} deals 1 damage to you";
|
return "Whenever you play a land, if it wasn't the first land you played this turn, {source} deals 1 damage to you";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -113,8 +113,8 @@ class GeneratorServantWatcher extends Watcher {
|
||||||
public void watch(GameEvent event, Game game) {
|
public void watch(GameEvent event, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.MANA_PAYED) {
|
if (event.getType() == GameEvent.EventType.MANA_PAYED) {
|
||||||
MageObject target = game.getObject(event.getTargetId());
|
MageObject target = game.getObject(event.getTargetId());
|
||||||
MageObject source = game.getObject(this.getSourceId());
|
if (event.getSourceId() != null
|
||||||
if (event.getSourceId() == this.getSourceId() && target != null && target.getCardType().contains(CardType.CREATURE) && event.getFlag()) {
|
&& event.getSourceId().equals(this.getSourceId()) && target != null && target.getCardType().contains(CardType.CREATURE) && event.getFlag()) {
|
||||||
if (target instanceof Spell) {
|
if (target instanceof Spell) {
|
||||||
this.creatures.add(((Spell) target).getCard().getId());
|
this.creatures.add(((Spell) target).getCard().getId());
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,9 @@ class SigilOfValorTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
if (game.getCombat().attacksAlone()) {
|
if (game.getCombat().attacksAlone()) {
|
||||||
Permanent equipment = game.getPermanent(getSourceId());
|
Permanent equipment = game.getPermanent(getSourceId());
|
||||||
UUID attackerId = game.getCombat().getAttackers().get(0);
|
UUID attackerId = game.getCombat().getAttackers().get(0);
|
||||||
if (equipment != null && equipment.getAttachedTo() == attackerId) {
|
if (equipment != null
|
||||||
|
&& equipment.getAttachedTo() != null
|
||||||
|
&& equipment.getAttachedTo().equals(attackerId)) {
|
||||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(attackerId));
|
this.getEffects().get(0).setTargetPointer(new FixedTarget(attackerId));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ class ThoughtLashTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
return event.getSourceId() == this.getSourceId();
|
return event.getSourceId() != null && event.getSourceId().equals(this.getSourceId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,31 +1,30 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without modification, are
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
* permitted provided that the following conditions are met:
|
* permitted provided that the following conditions are met:
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
* conditions and the following disclaimer.
|
* conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
* 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
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
* provided with the distribution.
|
* provided with the distribution.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
* 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
|
* 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
|
* 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
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 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
|
* 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
|
* 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
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* The views and conclusions contained in the software and documentation are those of the
|
* 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
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package mage.sets.planeshift;
|
package mage.sets.planeshift;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -56,7 +55,6 @@ public class OrimsChant extends CardImpl {
|
||||||
super(ownerId, 11, "Orim's Chant", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{W}");
|
super(ownerId, 11, "Orim's Chant", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{W}");
|
||||||
this.expansionSetCode = "PLS";
|
this.expansionSetCode = "PLS";
|
||||||
|
|
||||||
|
|
||||||
// Kicker {W} (You may pay an additional {W} as you cast this spell.)
|
// Kicker {W} (You may pay an additional {W} as you cast this spell.)
|
||||||
this.addAbility(new KickerAbility("{W}"));
|
this.addAbility(new KickerAbility("{W}"));
|
||||||
|
|
||||||
|
@ -97,12 +95,12 @@ class OrimsChantCantCastEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checksEventType(GameEvent event, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
return event.getType() == GameEvent.EventType.CAST_SPELL;
|
return GameEvent.EventType.CAST_SPELL.equals(event.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
return event.getPlayerId() == getTargetPointer().getFirst(game, source);
|
return event.getPlayerId().equals(getTargetPointer().getFirst(game, source));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,11 +76,10 @@ public class VraskaTheUnseen extends CardImpl {
|
||||||
this.expansionSetCode = "RTR";
|
this.expansionSetCode = "RTR";
|
||||||
this.subtype.add("Vraska");
|
this.subtype.add("Vraska");
|
||||||
|
|
||||||
|
|
||||||
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(5)), false));
|
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(5)), false));
|
||||||
|
|
||||||
// +1: Until your next turn, whenever a creature deals combat damage to Vraska the Unseen, destroy that creature.
|
// +1: Until your next turn, whenever a creature deals combat damage to Vraska the Unseen, destroy that creature.
|
||||||
this.addAbility(new LoyaltyAbility(new VraskaTheUnseenGainAbilityEffect(new VraskaTheUnseenTriggeredAbility()),1));
|
this.addAbility(new LoyaltyAbility(new VraskaTheUnseenGainAbilityEffect(new VraskaTheUnseenTriggeredAbility()), 1));
|
||||||
|
|
||||||
// -3: Destroy target nonland permanent.
|
// -3: Destroy target nonland permanent.
|
||||||
LoyaltyAbility ability = new LoyaltyAbility(new DestroyTargetEffect(), -3);
|
LoyaltyAbility ability = new LoyaltyAbility(new DestroyTargetEffect(), -3);
|
||||||
|
@ -101,7 +100,6 @@ public class VraskaTheUnseen extends CardImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class VraskaTheUnseenGainAbilityEffect extends ContinuousEffectImpl {
|
class VraskaTheUnseenGainAbilityEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
protected Ability ability;
|
protected Ability ability;
|
||||||
|
@ -142,8 +140,7 @@ class VraskaTheUnseenGainAbilityEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isInactive(Ability source, Game game) {
|
public boolean isInactive(Ability source, Game game) {
|
||||||
if (startingTurn != 0 && game.getTurnNum() != startingTurn)
|
if (startingTurn != 0 && game.getTurnNum() != startingTurn) {
|
||||||
{
|
|
||||||
if (game.getActivePlayerId().equals(source.getControllerId())) {
|
if (game.getActivePlayerId().equals(source.getControllerId())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -153,6 +150,7 @@ class VraskaTheUnseenGainAbilityEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
class AssassinToken extends Token {
|
class AssassinToken extends Token {
|
||||||
|
|
||||||
AssassinToken() {
|
AssassinToken() {
|
||||||
super("Assassin", "1/1 black Assassin creature tokens with \"Whenever this creature deals combat damage to a player, that player loses the game.\"");
|
super("Assassin", "1/1 black Assassin creature tokens with \"Whenever this creature deals combat damage to a player, that player loses the game.\"");
|
||||||
cardType.add(CardType.CREATURE);
|
cardType.add(CardType.CREATURE);
|
||||||
|
@ -160,7 +158,7 @@ class AssassinToken extends Token {
|
||||||
subtype.add("Assassin");
|
subtype.add("Assassin");
|
||||||
power = new MageInt(1);
|
power = new MageInt(1);
|
||||||
toughness = new MageInt(1);
|
toughness = new MageInt(1);
|
||||||
addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new LoseGameTargetPlayerEffect(),false, true));
|
addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new LoseGameTargetPlayerEffect(), false, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,7 +184,7 @@ class VraskaTheUnseenTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (((DamagedPlaneswalkerEvent) event).isCombatDamage() && event.getTargetId() == sourceId) {
|
if (((DamagedPlaneswalkerEvent) event).isCombatDamage() && getSourceId().equals(event.getTargetId())) {
|
||||||
Permanent sourceOfDamage = game.getPermanent(event.getSourceId());
|
Permanent sourceOfDamage = game.getPermanent(event.getSourceId());
|
||||||
if (sourceOfDamage != null && sourceOfDamage.getCardType().contains(CardType.CREATURE)) {
|
if (sourceOfDamage != null && sourceOfDamage.getCardType().contains(CardType.CREATURE)) {
|
||||||
Effect effect = this.getEffects().get(0);
|
Effect effect = this.getEffects().get(0);
|
||||||
|
|
|
@ -25,25 +25,24 @@
|
||||||
* authors and should not be interpreted as representing official policies, either expressed
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package mage.sets.scarsofmirrodin;
|
package mage.sets.scarsofmirrodin;
|
||||||
|
|
||||||
import mage.constants.CardType;
|
import java.util.UUID;
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.abilities.effects.common.ExileTargetEffect;
|
import mage.abilities.effects.common.ExileTargetEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Rarity;
|
||||||
import mage.filter.FilterPermanent;
|
import mage.filter.FilterPermanent;
|
||||||
import mage.filter.predicate.Predicates;
|
import mage.filter.predicate.Predicates;
|
||||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Loki
|
* @author Loki
|
||||||
*/
|
*/
|
||||||
public class RevokeExistence extends CardImpl {
|
public class RevokeExistence extends CardImpl {
|
||||||
|
|
||||||
private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment");
|
private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment");
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
@ -52,15 +51,16 @@ public class RevokeExistence extends CardImpl {
|
||||||
new CardTypePredicate(CardType.ENCHANTMENT)));
|
new CardTypePredicate(CardType.ENCHANTMENT)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public RevokeExistence (UUID ownerId) {
|
public RevokeExistence(UUID ownerId) {
|
||||||
super(ownerId, 18, "Revoke Existence", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{1}{W}");
|
super(ownerId, 18, "Revoke Existence", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{1}{W}");
|
||||||
this.expansionSetCode = "SOM";
|
this.expansionSetCode = "SOM";
|
||||||
|
|
||||||
|
// Exile target artifact or enchantment.
|
||||||
this.getSpellAbility().addEffect(new ExileTargetEffect());
|
this.getSpellAbility().addEffect(new ExileTargetEffect());
|
||||||
this.getSpellAbility().addTarget(new TargetPermanent(filter));
|
this.getSpellAbility().addTarget(new TargetPermanent(filter));
|
||||||
}
|
}
|
||||||
|
|
||||||
public RevokeExistence (final RevokeExistence card) {
|
public RevokeExistence(final RevokeExistence card) {
|
||||||
super(card);
|
super(card);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,8 @@ class MossbridgeTrollReplacementEffect extends ReplacementEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
return event.getTargetId() == source.getSourceId();
|
return event.getTargetId() != null
|
||||||
|
&& event.getTargetId().equals(source.getSourceId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -150,7 +151,7 @@ class MossbridgeTrollCost extends CostImpl {
|
||||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||||
int sumPower = 0;
|
int sumPower = 0;
|
||||||
if (targets.choose(Outcome.Tap, controllerId, sourceId, game)) {
|
if (targets.choose(Outcome.Tap, controllerId, sourceId, game)) {
|
||||||
for (UUID targetId: targets.get(0).getTargets()) {
|
for (UUID targetId : targets.get(0).getTargets()) {
|
||||||
Permanent permanent = game.getPermanent(targetId);
|
Permanent permanent = game.getPermanent(targetId);
|
||||||
if (permanent != null && permanent.tap(game)) {
|
if (permanent != null && permanent.tap(game)) {
|
||||||
sumPower += permanent.getPower().getValue();
|
sumPower += permanent.getPower().getValue();
|
||||||
|
@ -165,7 +166,7 @@ class MossbridgeTrollCost extends CostImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
|
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
|
||||||
int sumPower = 0;
|
int sumPower = 0;
|
||||||
for (Permanent permanent :game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), controllerId, game)) {
|
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), controllerId, game)) {
|
||||||
if (!permanent.getId().equals(sourceId)) {
|
if (!permanent.getId().equals(sourceId)) {
|
||||||
sumPower += permanent.getPower().getValue();
|
sumPower += permanent.getPower().getValue();
|
||||||
}
|
}
|
||||||
|
@ -178,4 +179,3 @@ class MossbridgeTrollCost extends CostImpl {
|
||||||
return new MossbridgeTrollCost(this);
|
return new MossbridgeTrollCost(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,6 @@ public class ThoughtweftGambit extends CardImpl {
|
||||||
super(ownerId, 154, "Thoughtweft Gambit", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{4}{W/U}{W/U}");
|
super(ownerId, 154, "Thoughtweft Gambit", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{4}{W/U}{W/U}");
|
||||||
this.expansionSetCode = "SHM";
|
this.expansionSetCode = "SHM";
|
||||||
|
|
||||||
|
|
||||||
// Tap all creatures your opponents control and untap all creatures you control.
|
// Tap all creatures your opponents control and untap all creatures you control.
|
||||||
this.getSpellAbility().addEffect(new ThoughtweftGambitEffect());
|
this.getSpellAbility().addEffect(new ThoughtweftGambitEffect());
|
||||||
|
|
||||||
|
@ -94,7 +93,7 @@ class ThoughtweftGambitEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
|
for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
|
||||||
if (controller.getId() == creature.getControllerId()) {
|
if (controller.getId().equals(creature.getControllerId())) {
|
||||||
creature.untap(game);
|
creature.untap(game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,10 +52,8 @@ public class GatherSpecimens extends CardImpl {
|
||||||
super(ownerId, 45, "Gather Specimens", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{3}{U}{U}{U}");
|
super(ownerId, 45, "Gather Specimens", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{3}{U}{U}{U}");
|
||||||
this.expansionSetCode = "ALA";
|
this.expansionSetCode = "ALA";
|
||||||
|
|
||||||
|
|
||||||
// If a creature would enter the battlefield under an opponent's control this turn, it enters the battlefield under your control instead.
|
// If a creature would enter the battlefield under an opponent's control this turn, it enters the battlefield under your control instead.
|
||||||
this.getSpellAbility().addEffect(new GatherSpecimensReplacementEffect());
|
this.getSpellAbility().addEffect(new GatherSpecimensReplacementEffect());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public GatherSpecimens(final GatherSpecimens card) {
|
public GatherSpecimens(final GatherSpecimens card) {
|
||||||
|
|
|
@ -92,9 +92,9 @@ class HelmOfPossessionCondition implements Condition {
|
||||||
controllerId = source.getControllerId();
|
controllerId = source.getControllerId();
|
||||||
}
|
}
|
||||||
Permanent permanent = game.getBattlefield().getPermanent(source.getSourceId());
|
Permanent permanent = game.getBattlefield().getPermanent(source.getSourceId());
|
||||||
if (permanent != null){
|
if (permanent != null) {
|
||||||
if (permanent.isTapped()){
|
if (permanent.isTapped()) {
|
||||||
return controllerId == source.getControllerId();
|
return controllerId.equals(source.getControllerId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -100,7 +100,7 @@ class TuktukScrapperTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
if (permanent.getId() == this.getSourceId()) {
|
if (permanent.getId().equals(this.getSourceId())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (permanent.hasSubtype("Ally")
|
if (permanent.hasSubtype("Ally")
|
||||||
|
|
|
@ -28,11 +28,6 @@
|
||||||
package mage.sets.worldwake;
|
package mage.sets.worldwake;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
||||||
|
@ -42,6 +37,11 @@ import mage.abilities.keyword.IslandwalkAbility;
|
||||||
import mage.abilities.keyword.SwampwalkAbility;
|
import mage.abilities.keyword.SwampwalkAbility;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.filter.FilterCard;
|
import mage.filter.FilterCard;
|
||||||
import mage.filter.predicate.Predicates;
|
import mage.filter.predicate.Predicates;
|
||||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||||
|
@ -50,7 +50,6 @@ import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.events.GameEvent.EventType;
|
import mage.game.events.GameEvent.EventType;
|
||||||
import mage.game.events.ZoneChangeEvent;
|
import mage.game.events.ZoneChangeEvent;
|
||||||
import mage.game.stack.Spell;
|
|
||||||
import mage.game.stack.StackObject;
|
import mage.game.stack.StackObject;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.Target;
|
import mage.target.Target;
|
||||||
|
@ -160,11 +159,8 @@ class WrexialReplacementEffect extends ReplacementEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||||
if (zEvent.getToZone() == Zone.GRAVEYARD
|
return zEvent.getToZone() == Zone.GRAVEYARD
|
||||||
&& ((ZoneChangeEvent) event).getTargetId() == cardid) {
|
&& ((ZoneChangeEvent) event).getTargetId().equals(cardid);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -173,12 +169,8 @@ class WrexialReplacementEffect extends ReplacementEffectImpl {
|
||||||
StackObject card = game.getStack().getStackObject(eventObject);
|
StackObject card = game.getStack().getStackObject(eventObject);
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (card != null && controller != null) {
|
if (card != null && controller != null) {
|
||||||
if (card instanceof Spell) {
|
|
||||||
game.rememberLKI(card.getId(), Zone.STACK, (Spell) card);
|
|
||||||
}
|
|
||||||
if (card instanceof Card) {
|
if (card instanceof Card) {
|
||||||
controller.moveCardToExileWithInfo((Card)card, null, "", source.getSourceId(), game, game.getState().getZone(event.getTargetId()), true);
|
return controller.moveCards((Card) card, null, Zone.EXILED, source, game);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -90,6 +90,7 @@ public class OblivionRingTest extends CardTestPlayerBase {
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 5);
|
addCard(Zone.BATTLEFIELD, playerA, "Plains", 5);
|
||||||
addCard(Zone.HAND, playerA, "Oblivion Ring");
|
addCard(Zone.HAND, playerA, "Oblivion Ring");
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Jace Beleren");
|
addCard(Zone.BATTLEFIELD, playerA, "Jace Beleren");
|
||||||
|
// Exile target artifact or enchantment.
|
||||||
addCard(Zone.HAND, playerA, "Revoke Existence");
|
addCard(Zone.HAND, playerA, "Revoke Existence");
|
||||||
|
|
||||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "-1: Target player draws a card", playerA);
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "-1: Target player draws a card", playerA);
|
||||||
|
@ -100,7 +101,10 @@ public class OblivionRingTest extends CardTestPlayerBase {
|
||||||
setStopAt(1, PhaseStep.END_TURN);
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
execute();
|
execute();
|
||||||
|
|
||||||
|
assertExileCount("Oblivion Ring", 1);
|
||||||
|
assertGraveyardCount(playerA, "Revoke Existence", 1);
|
||||||
assertPermanentCount(playerA, "Oblivion Ring", 0);
|
assertPermanentCount(playerA, "Oblivion Ring", 0);
|
||||||
|
assertGraveyardCount(playerA, "Jace Beleren", 0);
|
||||||
assertPermanentCount(playerA, "Jace Beleren", 1); // returns back
|
assertPermanentCount(playerA, "Jace Beleren", 1); // returns back
|
||||||
assertHandCount(playerA, 2); // can use ability twice
|
assertHandCount(playerA, 2); // can use ability twice
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,31 +1,30 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without modification, are
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
* permitted provided that the following conditions are met:
|
* permitted provided that the following conditions are met:
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
* conditions and the following disclaimer.
|
* conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
* 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
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
* provided with the distribution.
|
* provided with the distribution.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
* 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
|
* 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
|
* 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
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 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
|
* 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
|
* 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
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* The views and conclusions contained in the software and documentation are those of the
|
* 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
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package mage.abilities.common;
|
package mage.abilities.common;
|
||||||
|
|
||||||
import mage.abilities.StaticAbility;
|
import mage.abilities.StaticAbility;
|
||||||
|
@ -45,9 +44,11 @@ public class EntersBattlefieldAbility extends StaticAbility {
|
||||||
public EntersBattlefieldAbility(Effect effect) {
|
public EntersBattlefieldAbility(Effect effect) {
|
||||||
this(effect, true);
|
this(effect, true);
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
|
/**
|
||||||
*
|
*
|
||||||
* @param effect effect that happens when the permanent enters the battlefield
|
* @param effect effect that happens when the permanent enters the
|
||||||
|
* battlefield
|
||||||
* @param showRule show the rule for this ability
|
* @param showRule show the rule for this ability
|
||||||
*/
|
*/
|
||||||
public EntersBattlefieldAbility(Effect effect, Boolean showRule) {
|
public EntersBattlefieldAbility(Effect effect, Boolean showRule) {
|
||||||
|
@ -57,16 +58,19 @@ public class EntersBattlefieldAbility extends StaticAbility {
|
||||||
public EntersBattlefieldAbility(Effect effect, String effectText) {
|
public EntersBattlefieldAbility(Effect effect, String effectText) {
|
||||||
this(effect, null, true, null, effectText);
|
this(effect, null, true, null, effectText);
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
|
/**
|
||||||
*
|
*
|
||||||
* @param effect effect that happens when the permanent enters the battlefield
|
* @param effect effect that happens when the permanent enters the
|
||||||
|
* battlefield
|
||||||
* @param condition only if this condition is true, the effect will happen
|
* @param condition only if this condition is true, the effect will happen
|
||||||
* @param ruleVisible show the rule for this ability
|
* @param ruleVisible show the rule for this ability
|
||||||
* @param abilityRule rule for this ability (no text from effects will be added)
|
* @param abilityRule rule for this ability (no text from effects will be
|
||||||
|
* added)
|
||||||
* @param effectText this text will be used for the EnterBattlefieldEffect
|
* @param effectText this text will be used for the EnterBattlefieldEffect
|
||||||
*/
|
*/
|
||||||
public EntersBattlefieldAbility(Effect effect, Condition condition, Boolean ruleVisible, String abilityRule, String effectText) {
|
public EntersBattlefieldAbility(Effect effect, Condition condition, Boolean ruleVisible, String abilityRule, String effectText) {
|
||||||
super(Zone.BATTLEFIELD, new EntersBattlefieldEffect(effect, condition, effectText));
|
super(Zone.ALL, new EntersBattlefieldEffect(effect, condition, effectText));
|
||||||
this.setRuleVisible(ruleVisible);
|
this.setRuleVisible(ruleVisible);
|
||||||
this.abilityRule = abilityRule;
|
this.abilityRule = abilityRule;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class DiscardTargetCost extends CostImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||||
this.cards.clear();
|
this.cards.clear();
|
||||||
this.targets.clear();
|
this.targets.clearChosen();;
|
||||||
Player player = game.getPlayer(controllerId);
|
Player player = game.getPlayer(controllerId);
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1246,7 +1246,7 @@ public class ContinuousEffects implements Serializable {
|
||||||
HashSet<Ability> abilities = preventionEffects.getAbility(effect.getId());
|
HashSet<Ability> abilities = preventionEffects.getAbility(effect.getId());
|
||||||
for (Ability ability : abilities) {
|
for (Ability ability : abilities) {
|
||||||
if (ability.getSourceId().equals(sourceId)) {
|
if (ability.getSourceId().equals(sourceId)) {
|
||||||
if (controllerFound == null || controllerFound == ability.getControllerId()) {
|
if (controllerFound == null || controllerFound.equals(ability.getControllerId())) {
|
||||||
controllerFound = ability.getControllerId();
|
controllerFound = ability.getControllerId();
|
||||||
} else {
|
} else {
|
||||||
// not unique controller - No solution yet
|
// not unique controller - No solution yet
|
||||||
|
@ -1260,7 +1260,7 @@ public class ContinuousEffects implements Serializable {
|
||||||
for (Ability ability : abilities) {
|
for (Ability ability : abilities) {
|
||||||
if (ability.getSourceId() != null) {
|
if (ability.getSourceId() != null) {
|
||||||
if (ability.getSourceId().equals(sourceId)) {
|
if (ability.getSourceId().equals(sourceId)) {
|
||||||
if (controllerFound == null || controllerFound == ability.getControllerId()) {
|
if (controllerFound == null || controllerFound.equals(ability.getControllerId())) {
|
||||||
controllerFound = ability.getControllerId();
|
controllerFound = ability.getControllerId();
|
||||||
} else {
|
} else {
|
||||||
// not unique controller - No solution yet
|
// not unique controller - No solution yet
|
||||||
|
|
|
@ -101,8 +101,12 @@ public class ReturnFromExileForSourceEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
ExileZone exile = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source.getSourceId(), zoneChangeCounter));
|
ExileZone exile = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source.getSourceId(), zoneChangeCounter));
|
||||||
if (exile != null) { // null is valid if source left battlefield before enters the battlefield effect resolved
|
if (exile != null) { // null is valid if source left battlefield before enters the battlefield effect resolved
|
||||||
|
if (returnToZone.equals(Zone.BATTLEFIELD)) {
|
||||||
|
controller.moveCards(exile.getCards(game), returnToZone, source, game, false, false, true, null);
|
||||||
|
} else {
|
||||||
controller.moveCards(exile, null, returnToZone, source, game);
|
controller.moveCards(exile, null, returnToZone, source, game);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1,31 +1,30 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without modification, are
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
* permitted provided that the following conditions are met:
|
* permitted provided that the following conditions are met:
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
* conditions and the following disclaimer.
|
* conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
* 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
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
* provided with the distribution.
|
* provided with the distribution.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
* 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
|
* 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
|
* 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
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 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
|
* 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
|
* 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
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* The views and conclusions contained in the software and documentation are those of the
|
* 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
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package mage.abilities.keyword;
|
package mage.abilities.keyword;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -48,27 +47,28 @@ import mage.game.stack.Spell;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This ability has no effect by default and will always return false on the call
|
* This ability has no effect by default and will always return false on the
|
||||||
* to apply. This is because of how the {@link ReboundEffect} works. It will
|
* call to apply. This is because of how the {@link ReboundEffect} works. It
|
||||||
* install the effect if and only if the spell was cast from the {@link Zone#HAND Hand}.
|
* will install the effect if and only if the spell was cast from the
|
||||||
|
* {@link Zone#HAND Hand}.
|
||||||
* <p/>
|
* <p/>
|
||||||
* 702.85. Rebound
|
* 702.85. Rebound
|
||||||
* <p/>
|
* <p/>
|
||||||
* 702.85a Rebound appears on some instants and sorceries. It represents a static
|
* 702.85a Rebound appears on some instants and sorceries. It represents a
|
||||||
* ability that functions while the spell is on the stack and may create a delayed
|
* static ability that functions while the spell is on the stack and may create
|
||||||
* triggered ability. "Rebound" means "If this spell was cast from your hand,
|
* a delayed triggered ability. "Rebound" means "If this spell was cast from
|
||||||
* instead of putting it into your graveyard as it resolves, exile it and, at
|
* your hand, instead of putting it into your graveyard as it resolves, exile it
|
||||||
* the beginning of your next upkeep, you may cast this card from exile without
|
* and, at the beginning of your next upkeep, you may cast this card from exile
|
||||||
* paying its mana cost."
|
* without paying its mana cost."
|
||||||
* <p/>
|
* <p/>
|
||||||
* 702.85b Casting a card without paying its mana cost as the result of a rebound
|
* 702.85b Casting a card without paying its mana cost as the result of a
|
||||||
* ability follows the rules for paying alternative costs in rules 601.2b and 601.2e-g.
|
* rebound ability follows the rules for paying alternative costs in rules
|
||||||
|
* 601.2b and 601.2e-g.
|
||||||
* <p/>
|
* <p/>
|
||||||
* 702.85c Multiple instances of rebound on the same spell are redundant.
|
* 702.85c Multiple instances of rebound on the same spell are redundant.
|
||||||
*
|
*
|
||||||
* @author maurer.it_at_gmail.com, noxx
|
* @author maurer.it_at_gmail.com, noxx
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class ReboundAbility extends SimpleStaticAbility {
|
public class ReboundAbility extends SimpleStaticAbility {
|
||||||
|
|
||||||
public ReboundAbility() {
|
public ReboundAbility() {
|
||||||
|
@ -103,9 +103,10 @@ class ReboundCastFromHandReplacementEffect extends ReplacementEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (((ZoneChangeEvent) event).getFromZone() == Zone.STACK &&
|
if (((ZoneChangeEvent) event).getFromZone() == Zone.STACK
|
||||||
((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD &&
|
&& ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD
|
||||||
event.getSourceId() == source.getSourceId()) { // if countered the source.sourceId is different or null if it fizzles
|
&& event.getSourceId() != null
|
||||||
|
&& event.getSourceId().equals(source.getSourceId())) { // if countered the source.sourceId is different or null if it fizzles
|
||||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||||
if (spell != null && spell.getFromZone().equals(Zone.HAND)) {
|
if (spell != null && spell.getFromZone().equals(Zone.HAND)) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -113,6 +114,7 @@ class ReboundCastFromHandReplacementEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
Spell sourceSpell = game.getStack().getSpell(source.getSourceId());
|
Spell sourceSpell = game.getStack().getSpell(source.getSourceId());
|
||||||
|
@ -144,7 +146,6 @@ class ReboundCastFromHandReplacementEffect extends ReplacementEffectImpl {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class ReboundEffectCastFromExileDelayedTrigger extends DelayedTriggeredAbility {
|
class ReboundEffectCastFromExileDelayedTrigger extends DelayedTriggeredAbility {
|
||||||
|
|
||||||
ReboundEffectCastFromExileDelayedTrigger(UUID cardId, UUID sourceId) {
|
ReboundEffectCastFromExileDelayedTrigger(UUID cardId, UUID sourceId) {
|
||||||
|
@ -171,6 +172,7 @@ class ReboundEffectCastFromExileDelayedTrigger extends DelayedTriggeredAbility {
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
return MyTurnCondition.getInstance().apply(game, this);
|
return MyTurnCondition.getInstance().apply(game, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRule() {
|
public String getRule() {
|
||||||
return "Rebound - You may cast {this} from exile without paying its mana cost.";
|
return "Rebound - You may cast {this} from exile without paying its mana cost.";
|
||||||
|
@ -178,8 +180,8 @@ class ReboundEffectCastFromExileDelayedTrigger extends DelayedTriggeredAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will be triggered by {@link ReboundEffectCastFromExileDelayedTrigger} and will
|
* Will be triggered by {@link ReboundEffectCastFromExileDelayedTrigger} and
|
||||||
* simply cast the spell then remove it from its former home in exile.
|
* will simply cast the spell then remove it from its former home in exile.
|
||||||
*
|
*
|
||||||
* @author maurer.it_at_gmail.com
|
* @author maurer.it_at_gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -507,8 +507,8 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
||||||
break;
|
break;
|
||||||
case EXILED:
|
case EXILED:
|
||||||
if (game.getExile().getCard(getId(), game) != null) {
|
if (game.getExile().getCard(getId(), game) != null) {
|
||||||
game.getExile().removeCard(this, game);
|
removed = game.getExile().removeCard(this, game);
|
||||||
removed = true;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case STACK:
|
case STACK:
|
||||||
|
@ -552,8 +552,9 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
||||||
+ "] source [" + (sourceObject != null ? sourceObject.getName() : "null") + "]");
|
+ "] source [" + (sourceObject != null ? sourceObject.getName() : "null") + "]");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (removed) {
|
||||||
game.rememberLKI(objectId, fromZone, lkiObject != null ? lkiObject : this);
|
game.rememberLKI(objectId, fromZone, lkiObject != null ? lkiObject : this);
|
||||||
if (!removed) {
|
} else {
|
||||||
logger.warn("Couldn't find card in fromZone, card=" + getIdName() + ", fromZone=" + fromZone);
|
logger.warn("Couldn't find card in fromZone, card=" + getIdName() + ", fromZone=" + fromZone);
|
||||||
}
|
}
|
||||||
return removed;
|
return removed;
|
||||||
|
|
|
@ -107,12 +107,13 @@ public class Exile implements Serializable, Copyable<Exile> {
|
||||||
return cards;
|
return cards;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeCard(Card card, Game game) {
|
public boolean removeCard(Card card, Game game) {
|
||||||
for (ExileZone exile : exileZones.values()) {
|
for (ExileZone exile : exileZones.values()) {
|
||||||
if (exile.contains(card.getId())) {
|
if (exile.contains(card.getId())) {
|
||||||
exile.remove(card);
|
return exile.remove(card.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -3052,7 +3052,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
ZoneChangeEvent event = new ZoneChangeEvent(card.getId(), source.getSourceId(), controllingPlayerId, fromZone, Zone.BATTLEFIELD, appliedEffects, tapped);
|
ZoneChangeEvent event = new ZoneChangeEvent(card.getId(), source.getSourceId(), controllingPlayerId, fromZone, Zone.BATTLEFIELD, appliedEffects, tapped);
|
||||||
if (!game.replaceEvent(event)) {
|
if (!game.replaceEvent(event)) {
|
||||||
// get permanent
|
// get permanent
|
||||||
Permanent permanent = new PermanentCard(card, controllingPlayerId, game);
|
Permanent permanent = new PermanentCard(card, event.getPlayerId(), game);// controlling player can be replaced so use event player now
|
||||||
permanents.add(permanent);
|
permanents.add(permanent);
|
||||||
card.checkForCountersToAdd(permanent, game);
|
card.checkForCountersToAdd(permanent, game);
|
||||||
permanent.setTapped(tapped);
|
permanent.setTapped(tapped);
|
||||||
|
|
Loading…
Reference in a new issue