mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 19:11:59 -08:00
[AVR] Second Guest + tests. Refactored filters.
This commit is contained in:
parent
3fac42fc3c
commit
32e29392d2
184 changed files with 823 additions and 562 deletions
|
|
@ -190,13 +190,13 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
setCursor(new Cursor(Cursor.WAIT_CURSOR));
|
setCursor(new Cursor(Cursor.WAIT_CURSOR));
|
||||||
if (limited) {
|
if (limited) {
|
||||||
for (Card card: cards) {
|
for (Card card: cards) {
|
||||||
if (filter.match(card))
|
if (filter.match(card, null))
|
||||||
filteredCards.add(card);
|
filteredCards.add(card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (Card card: CardsStorage.getAllCards()) {
|
for (Card card: CardsStorage.getAllCards()) {
|
||||||
if (filter.match(card))
|
if (filter.match(card, null))
|
||||||
filteredCards.add(card);
|
filteredCards.add(card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,27 +28,9 @@
|
||||||
|
|
||||||
package mage.client.deckeditor.table;
|
package mage.client.deckeditor.table;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Cursor;
|
|
||||||
import java.awt.event.ComponentEvent;
|
|
||||||
import java.awt.event.ComponentListener;
|
|
||||||
import java.awt.event.MouseAdapter;
|
|
||||||
import java.awt.event.MouseEvent;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import javax.swing.DefaultComboBoxModel;
|
|
||||||
import javax.swing.JTable;
|
|
||||||
import javax.swing.table.DefaultTableCellRenderer;
|
|
||||||
|
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.ExpansionSet;
|
import mage.cards.ExpansionSet;
|
||||||
import mage.cards.MageCard;
|
|
||||||
import mage.client.cards.BigCard;
|
import mage.client.cards.BigCard;
|
||||||
import mage.client.cards.CardEventSource;
|
import mage.client.cards.CardEventSource;
|
||||||
import mage.client.cards.CardsStorage;
|
import mage.client.cards.CardsStorage;
|
||||||
|
|
@ -60,6 +42,16 @@ import mage.filter.FilterCard;
|
||||||
import mage.sets.Sets;
|
import mage.sets.Sets;
|
||||||
import mage.view.CardsView;
|
import mage.view.CardsView;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import javax.swing.table.DefaultTableCellRenderer;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.ComponentEvent;
|
||||||
|
import java.awt.event.ComponentListener;
|
||||||
|
import java.awt.event.MouseAdapter;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com, nantuko
|
* @author BetaSteward_at_googlemail.com, nantuko
|
||||||
|
|
@ -156,13 +148,13 @@ public class CardTableSelector extends javax.swing.JPanel implements ComponentLi
|
||||||
setCursor(new Cursor(Cursor.WAIT_CURSOR));
|
setCursor(new Cursor(Cursor.WAIT_CURSOR));
|
||||||
if (!cards.isEmpty()) {
|
if (!cards.isEmpty()) {
|
||||||
for (Card card: cards) {
|
for (Card card: cards) {
|
||||||
if (filter.match(card))
|
if (filter.match(card, null))
|
||||||
filteredCards.add(card);
|
filteredCards.add(card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (Card card: CardsStorage.getAllCards()) {
|
for (Card card: CardsStorage.getAllCards()) {
|
||||||
if (filter.match(card))
|
if (filter.match(card, null))
|
||||||
filteredCards.add(card);
|
filteredCards.add(card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -899,7 +899,7 @@ public class ComputerPlayer6 extends ComputerPlayer<ComputerPlayer6> implements
|
||||||
int defenderForcesForBlock = 0;
|
int defenderForcesForBlock = 0;
|
||||||
|
|
||||||
FilterCreatureForCombat filter = new FilterCreatureForCombat();
|
FilterCreatureForCombat filter = new FilterCreatureForCombat();
|
||||||
for (Permanent possibleAttacker : game.getBattlefield().getAllActivePermanents(filter, defender.getId())) {
|
for (Permanent possibleAttacker : game.getBattlefield().getAllActivePermanents(filter, defender.getId(), game)) {
|
||||||
//TODO: it can be improved with next turn emulation
|
//TODO: it can be improved with next turn emulation
|
||||||
if (!possibleAttacker.getAbilities().contains(DefenderAbility.getInstance())) {
|
if (!possibleAttacker.getAbilities().contains(DefenderAbility.getInstance())) {
|
||||||
counterAttackList.add(possibleAttacker);
|
counterAttackList.add(possibleAttacker);
|
||||||
|
|
@ -923,7 +923,7 @@ public class ComputerPlayer6 extends ComputerPlayer<ComputerPlayer6> implements
|
||||||
int possibleAttackersDamage = 0;
|
int possibleAttackersDamage = 0;
|
||||||
int ourForces = 0;
|
int ourForces = 0;
|
||||||
|
|
||||||
for (Permanent possibleAttacker : game.getBattlefield().getAllActivePermanents(filter, playerId)) {
|
for (Permanent possibleAttacker : game.getBattlefield().getAllActivePermanents(filter, playerId, game)) {
|
||||||
//TODO: it can be improved with next turn emulation
|
//TODO: it can be improved with next turn emulation
|
||||||
if (!possibleAttacker.getAbilities().contains(DefenderAbility.getInstance())) {
|
if (!possibleAttacker.getAbilities().contains(DefenderAbility.getInstance())) {
|
||||||
possibleAttackersList.add(possibleAttacker);
|
possibleAttackersList.add(possibleAttacker);
|
||||||
|
|
@ -1006,7 +1006,7 @@ public class ComputerPlayer6 extends ComputerPlayer<ComputerPlayer6> implements
|
||||||
int totalFirstStrikeBlockPower = 0;
|
int totalFirstStrikeBlockPower = 0;
|
||||||
|
|
||||||
if (!attacker.getAbilities().contains(FirstStrikeAbility.getInstance()) && !attacker.getAbilities().contains(DoubleStrikeAbility.getInstance())) {
|
if (!attacker.getAbilities().contains(FirstStrikeAbility.getInstance()) && !attacker.getAbilities().contains(DoubleStrikeAbility.getInstance())) {
|
||||||
for (Permanent blockerWithFSorDB : game.getBattlefield().getAllActivePermanents(filter, playerId)) {
|
for (Permanent blockerWithFSorDB : game.getBattlefield().getAllActivePermanents(filter, playerId, game)) {
|
||||||
if (blockerWithFSorDB.getAbilities().contains(DoubleStrikeAbility.getInstance())) {
|
if (blockerWithFSorDB.getAbilities().contains(DoubleStrikeAbility.getInstance())) {
|
||||||
totalFirstStrikeBlockPower += 2 * blockerWithFSorDB.getPower().getValue();
|
totalFirstStrikeBlockPower += 2 * blockerWithFSorDB.getPower().getValue();
|
||||||
} else
|
} else
|
||||||
|
|
|
||||||
|
|
@ -1411,7 +1411,7 @@ public class ComputerPlayer<T extends ComputerPlayer<T>> extends PlayerImpl<T> i
|
||||||
|
|
||||||
protected List<Permanent> getOpponentBlockers(UUID opponentId, Game game) {
|
protected List<Permanent> getOpponentBlockers(UUID opponentId, Game game) {
|
||||||
FilterCreatureForCombat blockFilter = new FilterCreatureForCombat();
|
FilterCreatureForCombat blockFilter = new FilterCreatureForCombat();
|
||||||
List<Permanent> blockers = game.getBattlefield().getAllActivePermanents(blockFilter, opponentId);
|
List<Permanent> blockers = game.getBattlefield().getAllActivePermanents(blockFilter, opponentId, game);
|
||||||
return blockers;
|
return blockers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1515,7 +1515,7 @@ public class ComputerPlayer<T extends ComputerPlayer<T>> extends PlayerImpl<T> i
|
||||||
|
|
||||||
protected List<Permanent> threats(UUID playerId, UUID sourceId, FilterPermanent filter, Game game, List<UUID> targets) {
|
protected List<Permanent> threats(UUID playerId, UUID sourceId, FilterPermanent filter, Game game, List<UUID> targets) {
|
||||||
List<Permanent> threats = playerId == null ?
|
List<Permanent> threats = playerId == null ?
|
||||||
game.getBattlefield().getAllActivePermanents(filter) :
|
game.getBattlefield().getAllActivePermanents(filter, game) :
|
||||||
game.getBattlefield().getActivePermanents(filter, playerId, sourceId, game);
|
game.getBattlefield().getActivePermanents(filter, playerId, sourceId, game);
|
||||||
|
|
||||||
Iterator<Permanent> it = threats.iterator();
|
Iterator<Permanent> it = threats.iterator();
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ class BogGnarrTriggeredAbility extends TriggeredAbilityImpl<BogGnarrTriggeredAbi
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
|
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
|
||||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||||
if (spell != null && filter.match(spell)) {
|
if (spell != null && filter.match(spell, game)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,15 +27,12 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.apocalypse;
|
package mage.sets.apocalypse;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import mage.Constants;
|
import mage.Constants;
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.ObjectColor;
|
import mage.ObjectColor;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.abilities.common.SpellCastTriggeredAbility;
|
|
||||||
import mage.abilities.effects.common.continious.BoostSourceEffect;
|
import mage.abilities.effects.common.continious.BoostSourceEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.filter.FilterCard;
|
import mage.filter.FilterCard;
|
||||||
|
|
@ -43,6 +40,8 @@ import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.stack.Spell;
|
import mage.game.stack.Spell;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Loki
|
* @author Loki
|
||||||
*/
|
*/
|
||||||
|
|
@ -90,7 +89,7 @@ class GladeGnarrTriggeredAbility extends TriggeredAbilityImpl<GladeGnarrTriggere
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
|
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
|
||||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||||
if (spell != null && filter.match(spell)) {
|
if (spell != null && filter.match(spell, game)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ class TranquilPathEffect extends OneShotEffect<TranquilPathEffect> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter)) {
|
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) {
|
||||||
permanent.destroy(source.getId(), game, false);
|
permanent.destroy(source.getId(), game, false);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ class AngelOfGlorysRiseEffect extends OneShotEffect<AngelOfGlorysRiseEffect> {
|
||||||
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());
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
for (Permanent zombie : game.getBattlefield().getAllActivePermanents(filterZombie)) {
|
for (Permanent zombie : game.getBattlefield().getAllActivePermanents(filterZombie, game)) {
|
||||||
zombie.moveToExile(source.getId(), zombie.getName(), source.getSourceId(), game);
|
zombie.moveToExile(source.getId(), zombie.getName(), source.getSourceId(), game);
|
||||||
}
|
}
|
||||||
for (Card human : player.getGraveyard().getCards(filterHuman, game)) {
|
for (Card human : player.getGraveyard().getCards(filterHuman, game)) {
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.avacynrestored;
|
package mage.sets.avacynrestored;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Outcome;
|
import mage.Constants.Outcome;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
|
|
@ -41,6 +40,8 @@ import mage.players.Player;
|
||||||
import mage.target.Target;
|
import mage.target.Target;
|
||||||
import mage.target.common.TargetControlledPermanent;
|
import mage.target.common.TargetControlledPermanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author North
|
* @author North
|
||||||
|
|
@ -91,7 +92,7 @@ class BarterInBloodEffect extends OneShotEffect<BarterInBloodEffect> {
|
||||||
for (UUID playerId : controller.getInRange()) {
|
for (UUID playerId : controller.getInRange()) {
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
int amount = Math.min(2, game.getBattlefield().countAll(filter, player.getId()));
|
int amount = Math.min(2, game.getBattlefield().countAll(filter, player.getId(), game));
|
||||||
Target target = new TargetControlledPermanent(amount, amount, filter, false);
|
Target target = new TargetControlledPermanent(amount, amount, filter, false);
|
||||||
target.setRequired(true);
|
target.setRequired(true);
|
||||||
if (amount > 0 && target.canChoose(player.getId(), game)
|
if (amount > 0 && target.canChoose(player.getId(), game)
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ class BonfireOfTheDamnedEffect extends OneShotEffect<BonfireOfTheDamnedEffect> {
|
||||||
int damage = source.getManaCostsToPay().getX();
|
int damage = source.getManaCostsToPay().getX();
|
||||||
if (damage > 0) {
|
if (damage > 0) {
|
||||||
player.damage(damage, source.getId(), game, false, true);
|
player.damage(damage, source.getId(), game, false, true);
|
||||||
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, player.getId())) {
|
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, player.getId(), game)) {
|
||||||
perm.damage(damage, source.getId(), game, true, false);
|
perm.damage(damage, source.getId(), game, true, false);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ class DescendantsPathEffect extends OneShotEffect<DescendantsPathEffect> {
|
||||||
FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();
|
FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();
|
||||||
filter.getSubtype().addAll(card.getSubtype());
|
filter.getSubtype().addAll(card.getSubtype());
|
||||||
filter.setScopeSubtype(Filter.ComparisonScope.Any);
|
filter.setScopeSubtype(Filter.ComparisonScope.Any);
|
||||||
int count = game.getBattlefield().getAllActivePermanents(filter, player.getId()).size();
|
int count = game.getBattlefield().getAllActivePermanents(filter, player.getId(), game).size();
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
game.informPlayers("DescendantsPath: Found a creature that shares a creature type with the revealed card.");
|
game.informPlayers("DescendantsPath: Found a creature that shares a creature type with the revealed card.");
|
||||||
if (player.chooseUse(Constants.Outcome.Benefit, "Cast the card?", game)) {
|
if (player.chooseUse(Constants.Outcome.Benefit, "Cast the card?", game)) {
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ class DevastationTideEffect extends OneShotEffect<DevastationTideEffect> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
for (Permanent creature : game.getBattlefield().getAllActivePermanents(new FilterNonlandPermanent())) {
|
for (Permanent creature : game.getBattlefield().getAllActivePermanents(new FilterNonlandPermanent(), game)) {
|
||||||
creature.moveToZone(Constants.Zone.HAND, source.getSourceId(), game, true);
|
creature.moveToZone(Constants.Zone.HAND, source.getSourceId(), game, true);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ class EssenceHarvestEffect extends OneShotEffect<EssenceHarvestEffect> {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
Player targetPlayer = game.getPlayer(source.getFirstTarget());
|
Player targetPlayer = game.getPlayer(source.getFirstTarget());
|
||||||
if (player != null && targetPlayer != null) {
|
if (player != null && targetPlayer != null) {
|
||||||
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId());
|
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId(), game);
|
||||||
int amount = 0;
|
int amount = 0;
|
||||||
for (Permanent creature : creatures) {
|
for (Permanent creature : creatures) {
|
||||||
int power = creature.getPower().getValue();
|
int power = creature.getPower().getValue();
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,6 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.avacynrestored;
|
package mage.sets.avacynrestored;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Outcome;
|
import mage.Constants.Outcome;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
|
|
@ -43,6 +39,11 @@ import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author North
|
* @author North
|
||||||
|
|
@ -100,7 +101,7 @@ class KillingWaveEffect extends OneShotEffect<KillingWaveEffect> {
|
||||||
FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||||
for (UUID playerId : controller.getInRange()) {
|
for (UUID playerId : controller.getInRange()) {
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(filter, playerId);
|
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(filter, playerId, game);
|
||||||
|
|
||||||
int lifePaid = 0;
|
int lifePaid = 0;
|
||||||
int playerLife = player.getLife();
|
int playerLife = player.getLife();
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ class LoneRevenantTriggeredAbility extends TriggeredAbilityImpl<LoneRevenantTrig
|
||||||
if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER && event.getSourceId().equals(this.sourceId)
|
if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER && event.getSourceId().equals(this.sourceId)
|
||||||
&& ((DamagedPlayerEvent) event).isCombatDamage()) {
|
&& ((DamagedPlayerEvent) event).isCombatDamage()) {
|
||||||
Permanent permanent = game.getPermanent(event.getSourceId());
|
Permanent permanent = game.getPermanent(event.getSourceId());
|
||||||
int number = game.getBattlefield().countAll(filter, controllerId);
|
int number = game.getBattlefield().countAll(filter, controllerId, game);
|
||||||
|
|
||||||
if (permanent != null && number != 1) {
|
if (permanent != null && number != 1) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,7 @@ class RidersOfGavonyGainAbilityControlledEffect extends ContinuousEffectImpl<Rid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (protectionFilter != null) {
|
if (protectionFilter != null) {
|
||||||
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, source.getControllerId())) {
|
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
||||||
perm.addAbility(new ProtectionAbility(protectionFilter), game);
|
perm.addAbility(new ProtectionAbility(protectionFilter), game);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ class RiteOfRuinEffect extends OneShotEffect<RiteOfRuinEffect> {
|
||||||
filter.getCardType().add(cardType);
|
filter.getCardType().add(cardType);
|
||||||
|
|
||||||
for (UUID playerId : controller.getInRange()) {
|
for (UUID playerId : controller.getInRange()) {
|
||||||
int amount = Math.min(count, game.getBattlefield().countAll(filter, playerId));
|
int amount = Math.min(count, game.getBattlefield().countAll(filter, playerId, game));
|
||||||
TargetControlledPermanent target = new TargetControlledPermanent(amount, amount, filter, false);
|
TargetControlledPermanent target = new TargetControlledPermanent(amount, amount, filter, false);
|
||||||
target.setRequired(true);
|
target.setRequired(true);
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
|
|
|
||||||
134
Mage.Sets/src/mage/sets/avacynrestored/SecondGuess.java
Normal file
134
Mage.Sets/src/mage/sets/avacynrestored/SecondGuess.java
Normal file
|
|
@ -0,0 +1,134 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
* permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
* provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* The views and conclusions contained in the software and documentation are those of the
|
||||||
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
|
*/
|
||||||
|
package mage.sets.avacynrestored;
|
||||||
|
|
||||||
|
import mage.Constants;
|
||||||
|
import mage.Constants.CardType;
|
||||||
|
import mage.Constants.Rarity;
|
||||||
|
import mage.abilities.effects.common.CounterTargetEffect;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.filter.FilterSpell;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.stack.Spell;
|
||||||
|
import mage.game.stack.StackObject;
|
||||||
|
import mage.target.TargetSpell;
|
||||||
|
import mage.watchers.common.CastSpellLastTurnWatcher;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author noxx
|
||||||
|
*/
|
||||||
|
public class SecondGuess extends CardImpl<SecondGuess> {
|
||||||
|
|
||||||
|
public SecondGuess(UUID ownerId) {
|
||||||
|
super(ownerId, 74, "Second Guess", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{1}{U}");
|
||||||
|
this.expansionSetCode = "AVR";
|
||||||
|
|
||||||
|
this.color.setBlue(true);
|
||||||
|
|
||||||
|
// Counter target spell that's the second spell cast this turn.
|
||||||
|
this.getSpellAbility().addEffect(new CounterTargetEffect());
|
||||||
|
this.getSpellAbility().addTarget(new TargetSpell(new FilterSecondSpell()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SecondGuess(final SecondGuess card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SecondGuess copy() {
|
||||||
|
return new SecondGuess(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class FilterSecondSpell extends FilterSpell<FilterSecondSpell> {
|
||||||
|
|
||||||
|
public FilterSecondSpell() {
|
||||||
|
super("spell that's the second spell cast this turn");
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterSecondSpell(final FilterSecondSpell filter) {
|
||||||
|
super(filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean match(StackObject spell, Game game) {
|
||||||
|
if (!super.match(spell, game))
|
||||||
|
return notFilter;
|
||||||
|
|
||||||
|
if (spell instanceof Spell) {
|
||||||
|
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get("CastSpellLastTurnWatcher");
|
||||||
|
|
||||||
|
int index = watcher.getSpellOrder((Spell)spell);
|
||||||
|
|
||||||
|
if (index == 2) {
|
||||||
|
return !notFilter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return notFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean match(StackObject spell, UUID playerId, Game game) {
|
||||||
|
if (!super.match(spell, playerId, game))
|
||||||
|
return notFilter;
|
||||||
|
|
||||||
|
if (spell instanceof Spell) {
|
||||||
|
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get("CastSpellLastTurnWatcher");
|
||||||
|
|
||||||
|
int index = watcher.getSpellOrder((Spell)spell);
|
||||||
|
|
||||||
|
if (index == 2) {
|
||||||
|
return notFilter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return !notFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FilterSecondSpell copy() {
|
||||||
|
return new FilterSecondSpell(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFromZone(Constants.Zone fromZone) {
|
||||||
|
this.fromZone = fromZone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNotFromZone(boolean notFromZone) {
|
||||||
|
this.notFromZone = notFromZone;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -96,7 +96,7 @@ class TyrantOfDiscordEffect extends OneShotEffect<TyrantOfDiscordEffect> {
|
||||||
if (opponent != null) {
|
if (opponent != null) {
|
||||||
boolean stop = false;
|
boolean stop = false;
|
||||||
while (!stop) {
|
while (!stop) {
|
||||||
int count = game.getBattlefield().countAll(new FilterPermanent(), opponent.getId());
|
int count = game.getBattlefield().countAll(new FilterPermanent(), opponent.getId(), game);
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
int random = (int)(Math.random()*count);
|
int random = (int)(Math.random()*count);
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,6 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.betrayersofkamigawa;
|
package mage.sets.betrayersofkamigawa;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import mage.Constants;
|
import mage.Constants;
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
|
|
@ -40,6 +38,8 @@ import mage.filter.FilterPermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Loki
|
* @author Loki
|
||||||
|
|
@ -85,7 +85,7 @@ class FinalJudgmentEffect extends OneShotEffect<FinalJudgmentEffect> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter)) {
|
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) {
|
||||||
permanent.moveToExile(null, null,source.getId(), game);
|
permanent.moveToExile(null, null,source.getId(), game);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ class CalltoGloryFirstEffect extends OneShotEffect<CalltoGloryFirstEffect> {
|
||||||
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());
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
for (Permanent creature : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId())) {
|
for (Permanent creature : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId(), game)) {
|
||||||
creature.untap(game);
|
creature.untap(game);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ class PainwrackerOniTriggeredAbility1 extends TriggeredAbilityImpl<PainwrackerOn
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkInterveningIfClause(Game game) {
|
public boolean checkInterveningIfClause(Game game) {
|
||||||
return game.getBattlefield().countAll(filter, this.controllerId) < 1;
|
return game.getBattlefield().countAll(filter, this.controllerId, game) < 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ class PartTheVeilEffect extends OneShotEffect<PartTheVeilEffect> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
for (Permanent creature : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getControllerId())) {
|
for (Permanent creature : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game)) {
|
||||||
creature.moveToZone(Constants.Zone.HAND, source.getSourceId(), game, true);
|
creature.moveToZone(Constants.Zone.HAND, source.getSourceId(), game, true);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,6 @@
|
||||||
|
|
||||||
package mage.sets.championsofkamigawa;
|
package mage.sets.championsofkamigawa;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import mage.Constants;
|
import mage.Constants;
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
|
|
@ -44,6 +42,8 @@ import mage.filter.common.FilterControlledCreaturePermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Loki
|
* @author Loki
|
||||||
*/
|
*/
|
||||||
|
|
@ -99,7 +99,7 @@ class TakenoSamuraiGeneralEffect extends ContinuousEffectImpl<TakenoSamuraiGener
|
||||||
public void init(Ability source, Game game) {
|
public void init(Ability source, Game game) {
|
||||||
super.init(source, game);
|
super.init(source, game);
|
||||||
if (this.affectedObjectsSet) {
|
if (this.affectedObjectsSet) {
|
||||||
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, source.getControllerId())) {
|
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
||||||
if (!perm.getId().equals(source.getSourceId())) {
|
if (!perm.getId().equals(source.getSourceId())) {
|
||||||
for (Ability ability : perm.getAbilities()) {
|
for (Ability ability : perm.getAbilities()) {
|
||||||
if (ability instanceof BushidoAbility) {
|
if (ability instanceof BushidoAbility) {
|
||||||
|
|
@ -113,7 +113,7 @@ class TakenoSamuraiGeneralEffect extends ContinuousEffectImpl<TakenoSamuraiGener
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, source.getControllerId())) {
|
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
||||||
if (!this.affectedObjectsSet || objects.contains(perm.getId())) {
|
if (!this.affectedObjectsSet || objects.contains(perm.getId())) {
|
||||||
if (!perm.getId().equals(source.getSourceId())) {
|
if (!perm.getId().equals(source.getSourceId())) {
|
||||||
for (Ability ability : perm.getAbilities()) {
|
for (Ability ability : perm.getAbilities()) {
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@
|
||||||
|
|
||||||
package mage.sets.conflux;
|
package mage.sets.conflux;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
import mage.Constants.Zone;
|
import mage.Constants.Zone;
|
||||||
|
|
@ -43,6 +42,8 @@ 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 java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author loki
|
* @author loki
|
||||||
|
|
@ -103,7 +104,7 @@ class BloodhallOozeTriggeredAbility1 extends TriggeredAbilityImpl<BloodhallOozeT
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkInterveningIfClause(Game game) {
|
public boolean checkInterveningIfClause(Game game) {
|
||||||
return game.getBattlefield().countAll(filter, this.controllerId) >= 1;
|
return game.getBattlefield().countAll(filter, this.controllerId, game) >= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -144,7 +145,7 @@ class BloodhallOozeTriggeredAbility2 extends TriggeredAbilityImpl<BloodhallOozeT
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkInterveningIfClause(Game game) {
|
public boolean checkInterveningIfClause(Game game) {
|
||||||
return game.getBattlefield().countAll(filter, this.controllerId) >= 1;
|
return game.getBattlefield().countAll(filter, this.controllerId, game) >= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,6 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.conflux;
|
package mage.sets.conflux;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Duration;
|
import mage.Constants.Duration;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
|
|
@ -44,6 +42,9 @@ import mage.filter.common.FilterArtifactPermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author North
|
* @author North
|
||||||
|
|
@ -79,7 +80,7 @@ class ControlsAnotherArtifactCondition implements Condition {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
List<Permanent> controlledArtifacts = game.getBattlefield().getAllActivePermanents(new FilterArtifactPermanent(), source.getControllerId());
|
List<Permanent> controlledArtifacts = game.getBattlefield().getAllActivePermanents(new FilterArtifactPermanent(), source.getControllerId(), game);
|
||||||
for (Permanent permanent : controlledArtifacts) {
|
for (Permanent permanent : controlledArtifacts) {
|
||||||
if (!permanent.getId().equals(game.getObject(source.getSourceId()).getId())) {
|
if (!permanent.getId().equals(game.getObject(source.getSourceId()).getId())) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.conflux;
|
package mage.sets.conflux;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Outcome;
|
import mage.Constants.Outcome;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
|
|
@ -39,6 +38,8 @@ import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author North
|
* @author North
|
||||||
|
|
@ -93,7 +94,7 @@ class DarkTemperEffect extends OneShotEffect<DarkTemperEffect> {
|
||||||
filter.getColor().setBlack(true);
|
filter.getColor().setBlack(true);
|
||||||
filter.setUseColor(true);
|
filter.setUseColor(true);
|
||||||
|
|
||||||
if (game.getBattlefield().countAll(filter, source.getControllerId()) == 0) {
|
if (game.getBattlefield().countAll(filter, source.getControllerId(), game) == 0) {
|
||||||
permanent.damage(2, source.getSourceId(), game, true, false);
|
permanent.damage(2, source.getSourceId(), game, true, false);
|
||||||
} else {
|
} else {
|
||||||
permanent.destroy(source.getId(), game, false);
|
permanent.destroy(source.getId(), game, false);
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,6 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.conflux;
|
package mage.sets.conflux;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import mage.Constants;
|
import mage.Constants;
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
|
|
@ -42,6 +40,8 @@ import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Loki
|
* @author Loki
|
||||||
|
|
@ -82,7 +82,7 @@ class GleamOfResistanceEffect extends OneShotEffect<GleamOfResistanceEffect> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
for (Permanent perm: game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getControllerId())) {
|
for (Permanent perm: game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game)) {
|
||||||
if (perm.isTapped()) {
|
if (perm.isTapped()) {
|
||||||
perm.untap(game);
|
perm.untap(game);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.conflux;
|
package mage.sets.conflux;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Duration;
|
import mage.Constants.Duration;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
|
|
@ -42,6 +41,8 @@ import mage.filter.FilterPermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author North
|
* @author North
|
||||||
|
|
@ -92,7 +93,7 @@ class ViewFromAboveEffect extends PostResolveEffect<ViewFromAboveEffect> {
|
||||||
filter.getColor().setWhite(true);
|
filter.getColor().setWhite(true);
|
||||||
filter.setUseColor(true);
|
filter.setUseColor(true);
|
||||||
|
|
||||||
if (game.getBattlefield().countAll(filter, source.getControllerId()) > 0) {
|
if (game.getBattlefield().countAll(filter, source.getControllerId(), game) > 0) {
|
||||||
card.moveToZone(Zone.HAND, source.getId(), game, false);
|
card.moveToZone(Zone.HAND, source.getId(), game, false);
|
||||||
} else {
|
} else {
|
||||||
card.moveToZone(Zone.GRAVEYARD, source.getId(), game, false);
|
card.moveToZone(Zone.GRAVEYARD, source.getId(), game, false);
|
||||||
|
|
|
||||||
|
|
@ -27,13 +27,10 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.darkascension;
|
package mage.sets.darkascension;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.Constants;
|
import mage.Constants;
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.dynamicvalue.DynamicValue;
|
|
||||||
import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount;
|
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
|
|
@ -42,6 +39,8 @@ import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author BetaSteward
|
* @author BetaSteward
|
||||||
|
|
@ -96,10 +95,10 @@ class AlphaBrawlEffect extends OneShotEffect<AlphaBrawlEffect> {
|
||||||
Player player = game.getPlayer(creature.getControllerId());
|
Player player = game.getPlayer(creature.getControllerId());
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
int power = creature.getPower().getValue();
|
int power = creature.getPower().getValue();
|
||||||
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, player.getId())) {
|
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, player.getId(), game)) {
|
||||||
perm.damage(power, creature.getId(), game, true, false);
|
perm.damage(power, creature.getId(), game, true, false);
|
||||||
}
|
}
|
||||||
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, player.getId())) {
|
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, player.getId(), game)) {
|
||||||
creature.damage(perm.getPower().getValue(), perm.getId(), game, true, false);
|
creature.damage(perm.getPower().getValue(), perm.getId(), game, true, false);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.darkascension;
|
package mage.sets.darkascension;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Duration;
|
import mage.Constants.Duration;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
|
|
@ -43,6 +42,8 @@ import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author North
|
* @author North
|
||||||
|
|
@ -95,7 +96,7 @@ class BeguilerOfWillsTarget extends TargetPermanent {
|
||||||
@Override
|
@Override
|
||||||
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
|
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
|
||||||
Permanent permanent = game.getPermanent(id);
|
Permanent permanent = game.getPermanent(id);
|
||||||
int count = game.getBattlefield().countAll(this.filter, source.getControllerId());
|
int count = game.getBattlefield().countAll(this.filter, source.getControllerId(), game);
|
||||||
|
|
||||||
if (permanent != null && permanent.getPower().getValue() <= count) {
|
if (permanent != null && permanent.getPower().getValue() <= count) {
|
||||||
return super.canTarget(controllerId, id, source, game);
|
return super.canTarget(controllerId, id, source, game);
|
||||||
|
|
|
||||||
|
|
@ -27,22 +27,17 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.darkascension;
|
package mage.sets.darkascension;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import mage.Constants;
|
import mage.Constants;
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.common.ZoneChangeTriggeredAbility;
|
|
||||||
import mage.abilities.effects.common.LoseLifeTargetEffect;
|
import mage.abilities.effects.common.LoseLifeTargetEffect;
|
||||||
import mage.abilities.effects.common.continious.BoostControlledEffect;
|
import mage.abilities.effects.common.continious.BoostControlledEffect;
|
||||||
import mage.abilities.keyword.DeathtouchAbility;
|
import mage.abilities.keyword.DeathtouchAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.filter.Filter;
|
import mage.filter.Filter;
|
||||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
|
||||||
import mage.filter.common.FilterControlledPermanent;
|
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
|
@ -50,6 +45,8 @@ import mage.game.events.ZoneChangeEvent;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.common.TargetOpponent;
|
import mage.target.common.TargetOpponent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Loki
|
* @author Loki
|
||||||
|
|
@ -115,7 +112,7 @@ class DiregrafCaptainTriggeredAbility extends TriggeredAbilityImpl<DiregrafCapta
|
||||||
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
|
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
|
||||||
if (zEvent.getFromZone() == Constants.Zone.BATTLEFIELD && zEvent.getToZone() == Constants.Zone.GRAVEYARD) {
|
if (zEvent.getFromZone() == Constants.Zone.BATTLEFIELD && zEvent.getToZone() == Constants.Zone.GRAVEYARD) {
|
||||||
Permanent p = (Permanent) game.getLastKnownInformation(event.getTargetId(), Constants.Zone.BATTLEFIELD);
|
Permanent p = (Permanent) game.getLastKnownInformation(event.getTargetId(), Constants.Zone.BATTLEFIELD);
|
||||||
if (p != null && p.getControllerId().equals(this.controllerId) && filter.match(p)) {
|
if (p != null && p.getControllerId().equals(this.controllerId) && filter.match(p, game)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.darkascension;
|
package mage.sets.darkascension;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.Constants;
|
import mage.Constants;
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
|
|
@ -43,6 +42,8 @@ import mage.filter.Filter;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author BetaSteward
|
* @author BetaSteward
|
||||||
|
|
@ -109,7 +110,7 @@ class GravecrawlerPlayEffect extends AsThoughEffectImpl<GravecrawlerPlayEffect>
|
||||||
if (sourceId.equals(source.getSourceId())) {
|
if (sourceId.equals(source.getSourceId())) {
|
||||||
Card card = game.getCard(source.getSourceId());
|
Card card = game.getCard(source.getSourceId());
|
||||||
if (card != null && game.getState().getZone(source.getSourceId()) == Constants.Zone.GRAVEYARD) {
|
if (card != null && game.getState().getZone(source.getSourceId()) == Constants.Zone.GRAVEYARD) {
|
||||||
if (game.getBattlefield().countAll(filter, source.getControllerId()) > 0)
|
if (game.getBattlefield().countAll(filter, source.getControllerId(), game) > 0)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.darkascension;
|
package mage.sets.darkascension;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.Constants;
|
import mage.Constants;
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
|
|
@ -44,6 +43,8 @@ import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author BetaSteward
|
* @author BetaSteward
|
||||||
|
|
@ -129,7 +130,7 @@ class ImmerwolfEffect extends ReplacementEffectImpl<ImmerwolfEffect> {
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.TRANSFORM) {
|
if (event.getType() == GameEvent.EventType.TRANSFORM) {
|
||||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||||
if (permanent != null && permanent.getControllerId().equals(source.getControllerId()) && filterWerewolf.match(permanent) && filterNonhuman.match(permanent)) {
|
if (permanent != null && permanent.getControllerId().equals(source.getControllerId()) && filterWerewolf.match(permanent, game) && filterNonhuman.match(permanent, game)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ class PyreheartWolfEffect extends OneShotEffect<PyreheartWolfEffect> {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
|
|
||||||
FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||||
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, source.getControllerId())) {
|
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
||||||
CantBeBlockedByOneEffect effect = new CantBeBlockedByOneEffect(2, Duration.EndOfTurn);
|
CantBeBlockedByOneEffect effect = new CantBeBlockedByOneEffect(2, Duration.EndOfTurn);
|
||||||
SimpleStaticAbility ability = new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, effect);
|
SimpleStaticAbility ability = new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, effect);
|
||||||
perm.addAbility(ability, game);
|
perm.addAbility(ability, game);
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,6 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.darkascension;
|
package mage.sets.darkascension;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.Constants;
|
import mage.Constants;
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Outcome;
|
import mage.Constants.Outcome;
|
||||||
|
|
@ -43,6 +41,9 @@ import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.TargetPlayer;
|
import mage.target.TargetPlayer;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author BetaSteward
|
* @author BetaSteward
|
||||||
|
|
@ -85,9 +86,9 @@ class SuddenDisappearanceEffect extends OneShotEffect<SuddenDisappearanceEffect>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
List<Permanent> perms = game.getBattlefield().getAllActivePermanents(filter, source.getFirstTarget());
|
List<Permanent> perms = game.getBattlefield().getAllActivePermanents(filter, source.getFirstTarget(), game);
|
||||||
if (perms.size() > 0) {
|
if (perms.size() > 0) {
|
||||||
for (Permanent permanent: game.getBattlefield().getAllActivePermanents(filter, source.getFirstTarget())) {
|
for (Permanent permanent: game.getBattlefield().getAllActivePermanents(filter, source.getFirstTarget(), game)) {
|
||||||
permanent.moveToExile(source.getSourceId(), "Sudden Disappearance", source.getSourceId(), game);
|
permanent.moveToExile(source.getSourceId(), "Sudden Disappearance", source.getSourceId(), game);
|
||||||
}
|
}
|
||||||
AtEndOfTurnDelayedTriggeredAbility delayedAbility = new AtEndOfTurnDelayedTriggeredAbility(new ReturnFromExileEffect(source.getSourceId(), Constants.Zone.BATTLEFIELD));
|
AtEndOfTurnDelayedTriggeredAbility delayedAbility = new AtEndOfTurnDelayedTriggeredAbility(new ReturnFromExileEffect(source.getSourceId(), Constants.Zone.BATTLEFIELD));
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ class SoulscourEffect extends OneShotEffect<SoulscourEffect> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter)) {
|
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) {
|
||||||
permanent.destroy(source.getId(), game, false);
|
permanent.destroy(source.getId(), game, false);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ class BalefireDragonEffect extends OneShotEffect<BalefireDragonEffect> {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
int amount = (Integer)getValue("damage");
|
int amount = (Integer)getValue("damage");
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
for (Permanent creature: game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId())) {
|
for (Permanent creature: game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId(), game)) {
|
||||||
creature.damage(amount, source.getSourceId(), game, true, false);
|
creature.damage(amount, source.getSourceId(), game, true, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ public class BlasphemousAct extends CardImpl<BlasphemousAct> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void adjustCosts(Ability ability, Game game) {
|
public void adjustCosts(Ability ability, Game game) {
|
||||||
int creatureCount = game.getState().getBattlefield().getAllActivePermanents(new FilterCreaturePermanent()).size();
|
int creatureCount = game.getState().getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), game).size();
|
||||||
int cost = 8 - creatureCount;
|
int cost = 8 - creatureCount;
|
||||||
String adjustedCost = "{R}";
|
String adjustedCost = "{R}";
|
||||||
if (cost > 0) {
|
if (cost > 0) {
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ class ControlFiveVampiresCost extends CostImpl<ControlFiveVampiresCost> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
|
public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
|
||||||
return game.getBattlefield().contains(filter, controllerId, 5);
|
return game.getBattlefield().contains(filter, controllerId, 5, game);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -27,14 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.innistrad;
|
package mage.sets.innistrad;
|
||||||
|
|
||||||
import java.util.UUID;
|
import mage.Constants.*;
|
||||||
import mage.Constants.CardType;
|
|
||||||
import mage.Constants.Duration;
|
|
||||||
import mage.Constants.Layer;
|
|
||||||
import mage.Constants.Outcome;
|
|
||||||
import mage.Constants.Rarity;
|
|
||||||
import mage.Constants.SubLayer;
|
|
||||||
import mage.Constants.Zone;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
|
|
@ -47,6 +40,8 @@ import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.TargetPlayer;
|
import mage.target.TargetPlayer;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author BetaSteward
|
* @author BetaSteward
|
||||||
|
|
@ -98,7 +93,7 @@ class CurseOfDeathsHoldEffect extends ContinuousEffectImpl<CurseOfDeathsHoldEffe
|
||||||
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
||||||
Player player = game.getPlayer(enchantment.getAttachedTo());
|
Player player = game.getPlayer(enchantment.getAttachedTo());
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
for (Permanent perm: game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId())) {
|
for (Permanent perm: game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId(), game)) {
|
||||||
perm.addPower(-1);
|
perm.addPower(-1);
|
||||||
perm.addToughness(-1);
|
perm.addToughness(-1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ class HalfZombiesCount implements DynamicValue {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int calculate(Game game, Ability sourceAbility) {
|
public int calculate(Game game, Ability sourceAbility) {
|
||||||
int amount = game.getBattlefield().countAll(filter, sourceAbility.getControllerId()) / 2;
|
int amount = game.getBattlefield().countAll(filter, sourceAbility.getControllerId(), game) / 2;
|
||||||
return amount;
|
return amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ class EvilTwinFilter extends FilterCreaturePermanent<EvilTwinFilter> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean match(Permanent permanent, UUID sourceId, UUID playerId, Game game) {
|
public boolean match(Permanent permanent, UUID sourceId, UUID playerId, Game game) {
|
||||||
if (!super.match(permanent))
|
if (!super.match(permanent, game))
|
||||||
return notFilter;
|
return notFilter;
|
||||||
|
|
||||||
Permanent twin = game.getPermanent(sourceId);
|
Permanent twin = game.getPermanent(sourceId);
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ class FullMoonsRiseEffect extends OneShotEffect<FullMoonsRiseEffect> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId())) {
|
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
||||||
ReplacementEffect effect = new RegenerateTargetEffect();
|
ReplacementEffect effect = new RegenerateTargetEffect();
|
||||||
effect.setTargetPointer(new FixedTarget(permanent.getId()));
|
effect.setTargetPointer(new FixedTarget(permanent.getId()));
|
||||||
game.addEffect(effect, source);
|
game.addEffect(effect, source);
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,6 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.innistrad;
|
package mage.sets.innistrad;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Outcome;
|
import mage.Constants.Outcome;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
|
|
@ -50,6 +47,10 @@ import mage.players.Player;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
import mage.target.TargetPlayer;
|
import mage.target.TargetPlayer;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author North
|
* @author North
|
||||||
|
|
@ -108,7 +109,7 @@ class LilianaOfTheVeilEffect extends OneShotEffect<LilianaOfTheVeilEffect> {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
Player targetPlayer = game.getPlayer(source.getFirstTarget());
|
Player targetPlayer = game.getPlayer(source.getFirstTarget());
|
||||||
if (player != null && targetPlayer != null) {
|
if (player != null && targetPlayer != null) {
|
||||||
int count = game.getBattlefield().countAll(new FilterPermanent(), targetPlayer.getId());
|
int count = game.getBattlefield().countAll(new FilterPermanent(), targetPlayer.getId(), game);
|
||||||
TargetPermanent target = new TargetPermanent(0, count, new FilterPermanent("permanents to put in the first pile"), false);
|
TargetPermanent target = new TargetPermanent(0, count, new FilterPermanent("permanents to put in the first pile"), false);
|
||||||
List<Permanent> pile1 = new ArrayList<Permanent>();
|
List<Permanent> pile1 = new ArrayList<Permanent>();
|
||||||
if (player.choose(Outcome.Neutral, target, source.getSourceId(), game)) {
|
if (player.choose(Outcome.Neutral, target, source.getSourceId(), game)) {
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ class MemorysJourneyTarget extends TargetCard<MemorysJourneyTarget> {
|
||||||
if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD) {
|
if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD) {
|
||||||
UUID firstTarget = source.getFirstTarget();
|
UUID firstTarget = source.getFirstTarget();
|
||||||
if (firstTarget != null && game.getPlayer(firstTarget).getGraveyard().contains(id)) {
|
if (firstTarget != null && game.getPlayer(firstTarget).getGraveyard().contains(id)) {
|
||||||
return filter.match(card);
|
return filter.match(card, game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,6 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.innistrad;
|
package mage.sets.innistrad;
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.Constants;
|
import mage.Constants;
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
|
|
@ -43,6 +41,9 @@ import mage.cards.CardImpl;
|
||||||
import mage.filter.FilterPermanent;
|
import mage.filter.FilterPermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author North
|
* @author North
|
||||||
|
|
@ -86,7 +87,7 @@ class NightRevelersCondition implements Condition {
|
||||||
|
|
||||||
Set<UUID> opponents = game.getOpponents(source.getControllerId());
|
Set<UUID> opponents = game.getOpponents(source.getControllerId());
|
||||||
for (UUID opponentId : opponents) {
|
for (UUID opponentId : opponents) {
|
||||||
conditionApplies |= game.getBattlefield().countAll(filter, opponentId) > 0;
|
conditionApplies |= game.getBattlefield().countAll(filter, opponentId, game) > 0;
|
||||||
}
|
}
|
||||||
return conditionApplies;
|
return conditionApplies;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ import mage.Constants.Rarity;
|
||||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.filter.FilterPermanent;
|
import mage.filter.FilterPermanent;
|
||||||
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
|
|
||||||
|
|
@ -74,8 +75,8 @@ class FilterTheMonstrous extends FilterPermanent<FilterTheMonstrous> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean match(Permanent permanent) {
|
public boolean match(Permanent permanent, Game game) {
|
||||||
if (!super.match(permanent))
|
if (!super.match(permanent, game))
|
||||||
return notFilter;
|
return notFilter;
|
||||||
|
|
||||||
if (!permanent.getCardType().contains(CardType.CREATURE))
|
if (!permanent.getCardType().contains(CardType.CREATURE))
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ class UnbreathingHordeEffect1 extends OneShotEffect<UnbreathingHordeEffect1> {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null && player != null) {
|
if (permanent != null && player != null) {
|
||||||
int amount = game.getBattlefield().countAll(filter1, source.getControllerId()) - 1;
|
int amount = game.getBattlefield().countAll(filter1, source.getControllerId(), game) - 1;
|
||||||
amount += player.getGraveyard().count(filter2, game);
|
amount += player.getGraveyard().count(filter2, game);
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||||
|
|
|
||||||
|
|
@ -27,15 +27,17 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.innistrad;
|
package mage.sets.innistrad;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.filter.FilterPermanent;
|
import mage.filter.FilterPermanent;
|
||||||
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author nantuko
|
* @author nantuko
|
||||||
|
|
@ -74,8 +76,8 @@ class FilterSpiritOrEnchantment extends FilterPermanent<FilterSpiritOrEnchantmen
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean match(Permanent permanent) {
|
public boolean match(Permanent permanent, Game game) {
|
||||||
if (!super.match(permanent))
|
if (!super.match(permanent, game))
|
||||||
return notFilter;
|
return notFilter;
|
||||||
|
|
||||||
if (!permanent.getCardType().contains(CardType.ENCHANTMENT) && !permanent.hasSubtype("Spirit"))
|
if (!permanent.getCardType().contains(CardType.ENCHANTMENT) && !permanent.hasSubtype("Spirit"))
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,6 @@
|
||||||
|
|
||||||
package mage.sets.magic2010;
|
package mage.sets.magic2010;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Outcome;
|
import mage.Constants.Outcome;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
|
|
@ -44,6 +42,9 @@ import mage.players.Player;
|
||||||
import mage.target.TargetPlayer;
|
import mage.target.TargetPlayer;
|
||||||
import mage.target.common.TargetCardInLibrary;
|
import mage.target.common.TargetCardInLibrary;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
|
|
@ -87,7 +88,7 @@ class HauntingEchoesEffect extends OneShotEffect<HauntingEchoesEffect> {
|
||||||
Player targetPlayer = game.getPlayer(source.getFirstTarget());
|
Player targetPlayer = game.getPlayer(source.getFirstTarget());
|
||||||
if (targetPlayer != null) {
|
if (targetPlayer != null) {
|
||||||
for (Card card: targetPlayer.getGraveyard().getCards(game)) {
|
for (Card card: targetPlayer.getGraveyard().getCards(game)) {
|
||||||
if (!filter.match(card)) {
|
if (!filter.match(card, game)) {
|
||||||
card.moveToExile(null, "", source.getId(), game);
|
card.moveToExile(null, "", source.getId(), game);
|
||||||
|
|
||||||
FilterCard filterCard = new FilterCard("cards named " + card.getName());
|
FilterCard filterCard = new FilterCard("cards named " + card.getName());
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,6 @@
|
||||||
|
|
||||||
package mage.sets.magic2010;
|
package mage.sets.magic2010;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Outcome;
|
import mage.Constants.Outcome;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
|
|
@ -52,6 +49,10 @@ import mage.game.permanent.token.WolfToken;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
|
|
@ -114,8 +115,8 @@ class MasterOfTheWildHuntEffect extends OneShotEffect<MasterOfTheWildHuntEffect>
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
List<UUID> wolves = new ArrayList<UUID>();
|
List<UUID> wolves = new ArrayList<UUID>();
|
||||||
Permanent target = game.getPermanent(source.getFirstTarget());
|
Permanent target = game.getPermanent(source.getFirstTarget());
|
||||||
if (target != null && game.getBattlefield().countAll(filter, source.getControllerId()) > 0) {
|
if (target != null && game.getBattlefield().countAll(filter, source.getControllerId(), game) > 0) {
|
||||||
for (Permanent permanent: game.getBattlefield().getAllActivePermanents(filter, source.getControllerId())) {
|
for (Permanent permanent: game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
||||||
permanent.tap(game);
|
permanent.tap(game);
|
||||||
target.damage(permanent.getToughness().getValue(), permanent.getId(), game, true, false);
|
target.damage(permanent.getToughness().getValue(), permanent.getId(), game, true, false);
|
||||||
wolves.add(permanent.getId());
|
wolves.add(permanent.getId());
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ class PlanarCleansingEffect extends OneShotEffect<PlanarCleansingEffect> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter)) {
|
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) {
|
||||||
permanent.destroy(source.getId(), game, false);
|
permanent.destroy(source.getId(), game, false);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ class SerpentOfTheEndlessSeaEffect extends ReplacementEffectImpl<SerpentOfTheEnd
|
||||||
FilterPermanent filter = new FilterPermanent();
|
FilterPermanent filter = new FilterPermanent();
|
||||||
filter.getSubtype().add("Island");
|
filter.getSubtype().add("Island");
|
||||||
|
|
||||||
if (game.getBattlefield().countAll(filter, event.getTargetId()) == 0) {
|
if (game.getBattlefield().countAll(filter, event.getTargetId(), game) == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ class SleepEffect extends OneShotEffect<SleepEffect> {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(source.getFirstTarget());
|
Player player = game.getPlayer(source.getFirstTarget());
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
for (Permanent creature: game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId())) {
|
for (Permanent creature: game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId(), game)) {
|
||||||
creature.tap(game);
|
creature.tap(game);
|
||||||
game.addEffect(new SleepEffect2(creature.getId()), source);
|
game.addEffect(new SleepEffect2(creature.getId()), source);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ class TempestOfLightEffect extends OneShotEffect<TempestOfLightEffect> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter)) {
|
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) {
|
||||||
permanent.destroy(source.getId(), game, false);
|
permanent.destroy(source.getId(), game, false);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ class HarborSerpentEffect extends RestrictionEffect<HarborSerpentEffect> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||||
if (game.getBattlefield().countAll(filter) < 5) {
|
if (game.getBattlefield().countAll(filter, game) < 5) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,6 @@
|
||||||
|
|
||||||
package mage.sets.magic2011;
|
package mage.sets.magic2011;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Outcome;
|
import mage.Constants.Outcome;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
|
|
@ -45,6 +43,9 @@ import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
|
|
@ -82,7 +83,7 @@ class MassPolymorphEffect extends OneShotEffect<MassPolymorphEffect> {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
int count;
|
int count;
|
||||||
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getControllerId());
|
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game);
|
||||||
count = creatures.size();
|
count = creatures.size();
|
||||||
for (Permanent creature: creatures) {
|
for (Permanent creature: creatures) {
|
||||||
creature.moveToExile(null, null, source.getId(), game);
|
creature.moveToExile(null, null, source.getId(), game);
|
||||||
|
|
|
||||||
|
|
@ -28,13 +28,7 @@
|
||||||
|
|
||||||
package mage.sets.magic2011;
|
package mage.sets.magic2011;
|
||||||
|
|
||||||
import java.util.UUID;
|
import mage.Constants.*;
|
||||||
import mage.Constants.CardType;
|
|
||||||
import mage.Constants.Duration;
|
|
||||||
import mage.Constants.Layer;
|
|
||||||
import mage.Constants.Outcome;
|
|
||||||
import mage.Constants.Rarity;
|
|
||||||
import mage.Constants.SubLayer;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
import mage.abilities.keyword.TrampleAbility;
|
import mage.abilities.keyword.TrampleAbility;
|
||||||
|
|
@ -43,6 +37,8 @@ import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
|
|
@ -85,11 +81,11 @@ class OverwhelmingStampedeEffect extends ContinuousEffectImpl<OverwhelmingStampe
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||||
int maxPower = 0;
|
int maxPower = 0;
|
||||||
for (Permanent perm: game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getControllerId())) {
|
for (Permanent perm: game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game)) {
|
||||||
if (perm.getPower().getValue() > maxPower)
|
if (perm.getPower().getValue() > maxPower)
|
||||||
maxPower = perm.getPower().getValue();
|
maxPower = perm.getPower().getValue();
|
||||||
}
|
}
|
||||||
for (Permanent perm: game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getControllerId())) {
|
for (Permanent perm: game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game)) {
|
||||||
switch (layer) {
|
switch (layer) {
|
||||||
case PTChangingEffects_7:
|
case PTChangingEffects_7:
|
||||||
if (sublayer == SubLayer.ModifyPT_7c) {
|
if (sublayer == SubLayer.ModifyPT_7c) {
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,7 @@ class AdaptiveAutomatonBoostControlledEffect extends ContinuousEffectImpl<Adapti
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
String subtype = (String) game.getState().getValue(permanent.getId() + "_type");
|
String subtype = (String) game.getState().getValue(permanent.getId() + "_type");
|
||||||
if (subtype != null) {
|
if (subtype != null) {
|
||||||
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, source.getControllerId())) {
|
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
||||||
if (!perm.getId().equals(source.getSourceId()) && perm.hasSubtype(subtype)) {
|
if (!perm.getId().equals(source.getSourceId()) && perm.hasSubtype(subtype)) {
|
||||||
perm.addPower(1);
|
perm.addPower(1);
|
||||||
perm.addToughness(1);
|
perm.addToughness(1);
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,6 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.magic2012;
|
package mage.sets.magic2012;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Outcome;
|
import mage.Constants.Outcome;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
|
|
@ -45,6 +42,10 @@ import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.common.TargetCardInLibrary;
|
import mage.target.common.TargetCardInLibrary;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author North
|
* @author North
|
||||||
|
|
@ -95,7 +96,7 @@ class DoublingChantEffect extends OneShotEffect<DoublingChantEffect> {
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getControllerId());
|
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game);
|
||||||
for (Permanent creature : creatures) {
|
for (Permanent creature : creatures) {
|
||||||
final String creatureName = creature.getName();
|
final String creatureName = creature.getName();
|
||||||
if (!namesFiltered.contains(creatureName)) {
|
if (!namesFiltered.contains(creatureName)) {
|
||||||
|
|
|
||||||
|
|
@ -27,11 +27,6 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.magic2012;
|
package mage.sets.magic2012;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import mage.Constants;
|
import mage.Constants;
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
|
|
@ -40,16 +35,16 @@ import mage.abilities.Mode;
|
||||||
import mage.abilities.effects.ContinuousEffect;
|
import mage.abilities.effects.ContinuousEffect;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.continious.GainControlTargetEffect;
|
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.filter.common.FilterNonlandPermanent;
|
import mage.filter.common.FilterNonlandPermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
|
||||||
import mage.players.PlayerList;
|
import mage.players.PlayerList;
|
||||||
import mage.players.Players;
|
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author nantuko
|
* @author nantuko
|
||||||
|
|
@ -94,7 +89,7 @@ class ScrambleverseEffect extends OneShotEffect<ScrambleverseEffect> {
|
||||||
int count = players.size();
|
int count = players.size();
|
||||||
if (count > 1) {
|
if (count > 1) {
|
||||||
FilterNonlandPermanent nonLand = new FilterNonlandPermanent();
|
FilterNonlandPermanent nonLand = new FilterNonlandPermanent();
|
||||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(nonLand)) {
|
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(nonLand, game)) {
|
||||||
ContinuousEffect effect = new ScrambleverseControlEffect(players.get(random.nextInt(count)));
|
ContinuousEffect effect = new ScrambleverseControlEffect(players.get(random.nextInt(count)));
|
||||||
effect.setTargetPointer(new FixedTarget(permanent.getId()));
|
effect.setTargetPointer(new FixedTarget(permanent.getId()));
|
||||||
game.addEffect(effect, source);
|
game.addEffect(effect, source);
|
||||||
|
|
|
||||||
|
|
@ -27,13 +27,10 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.magic2012;
|
package mage.sets.magic2012;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import mage.Constants;
|
import mage.Constants;
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.CreateTokenEffect;
|
import mage.abilities.effects.common.CreateTokenEffect;
|
||||||
|
|
@ -44,6 +41,8 @@ import mage.game.Game;
|
||||||
import mage.game.permanent.token.SoldierToken;
|
import mage.game.permanent.token.SoldierToken;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author nantuko
|
* @author nantuko
|
||||||
*/
|
*/
|
||||||
|
|
@ -86,14 +85,14 @@ class TimelyReinforcementsEffect extends OneShotEffect<TimelyReinforcementsEffec
|
||||||
boolean lessCreatures = false;
|
boolean lessCreatures = false;
|
||||||
boolean lessLife = false;
|
boolean lessLife = false;
|
||||||
FilterPermanent filter= new FilterCreaturePermanent();
|
FilterPermanent filter= new FilterCreaturePermanent();
|
||||||
int count = game.getBattlefield().countAll(filter, controller.getId());
|
int count = game.getBattlefield().countAll(filter, controller.getId(), game);
|
||||||
for (UUID uuid : game.getOpponents(controller.getId())) {
|
for (UUID uuid : game.getOpponents(controller.getId())) {
|
||||||
Player opponent = game.getPlayer(uuid);
|
Player opponent = game.getPlayer(uuid);
|
||||||
if (opponent != null) {
|
if (opponent != null) {
|
||||||
if (opponent.getLife() > controller.getLife()) {
|
if (opponent.getLife() > controller.getLife()) {
|
||||||
lessLife = true;
|
lessLife = true;
|
||||||
}
|
}
|
||||||
if (game.getBattlefield().countAll(filter, uuid) > count) {
|
if (game.getBattlefield().countAll(filter, uuid, game) > count) {
|
||||||
lessCreatures = true;
|
lessCreatures = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,14 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.mirrodinbesieged;
|
package mage.sets.mirrodinbesieged;
|
||||||
|
|
||||||
import java.util.List;
|
import mage.Constants.*;
|
||||||
import java.util.UUID;
|
|
||||||
import mage.Constants.CardType;
|
|
||||||
import mage.Constants.Duration;
|
|
||||||
import mage.Constants.Layer;
|
|
||||||
import mage.Constants.Outcome;
|
|
||||||
import mage.Constants.Rarity;
|
|
||||||
import mage.Constants.SubLayer;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.CantBlockAbility;
|
import mage.abilities.common.CantBlockAbility;
|
||||||
import mage.abilities.condition.common.MetalcraftCondition;
|
import mage.abilities.condition.common.MetalcraftCondition;
|
||||||
|
|
@ -48,6 +41,9 @@ import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.TargetPlayer;
|
import mage.target.TargetPlayer;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author North
|
* @author North
|
||||||
|
|
@ -96,7 +92,7 @@ class ConcussiveBoltEffect extends ContinuousEffectImpl {
|
||||||
int affectedTargets = 0;
|
int affectedTargets = 0;
|
||||||
Player player = game.getPlayer(source.getFirstTarget());
|
Player player = game.getPlayer(source.getFirstTarget());
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId());
|
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId(), game);
|
||||||
for (Permanent permanent : permanents) {
|
for (Permanent permanent : permanents) {
|
||||||
permanent.addAbility(CantBlockAbility.getInstance(), game);
|
permanent.addAbility(CantBlockAbility.getInstance(), game);
|
||||||
affectedTargets++;
|
affectedTargets++;
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ class ThopterAssemblyTriggeredAbility extends TriggeredAbilityImpl<ThopterAssemb
|
||||||
filter.getSubtype().add("Thopter");
|
filter.getSubtype().add("Thopter");
|
||||||
filter.setScopeSubtype(Filter.ComparisonScope.Any);
|
filter.setScopeSubtype(Filter.ComparisonScope.Any);
|
||||||
filter.setAnother(true);
|
filter.setAnother(true);
|
||||||
if (!game.getBattlefield().contains(filter, controllerId, 1)) {
|
if (!game.getBattlefield().contains(filter, controllerId, 1, game)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ class CagedSunEffect2 extends ContinuousEffectImpl<CagedSunEffect2> {
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
ObjectColor color = (ObjectColor) game.getState().getValue(permanent.getId() + "_color");
|
ObjectColor color = (ObjectColor) game.getState().getValue(permanent.getId() + "_color");
|
||||||
if (color != null) {
|
if (color != null) {
|
||||||
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, source.getControllerId())) {
|
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
||||||
if (perm.getColor().contains(color)) {
|
if (perm.getColor().contains(color)) {
|
||||||
perm.addPower(1);
|
perm.addPower(1);
|
||||||
perm.addToughness(1);
|
perm.addToughness(1);
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ class UnwindingClockEffect extends ContinuousEffectImpl<UnwindingClockEffect> {
|
||||||
if (!applied && layer.equals(Layer.RulesEffects)) {
|
if (!applied && layer.equals(Layer.RulesEffects)) {
|
||||||
if (!game.getActivePlayerId().equals(source.getControllerId()) && game.getStep().getType() == PhaseStep.UNTAP) {
|
if (!game.getActivePlayerId().equals(source.getControllerId()) && game.getStep().getType() == PhaseStep.UNTAP) {
|
||||||
game.getState().setValue(source.getSourceId() + "applied", true);
|
game.getState().setValue(source.getSourceId() + "applied", true);
|
||||||
for (Permanent artifact: game.getBattlefield().getAllActivePermanents(filter, source.getControllerId())) {
|
for (Permanent artifact: game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
||||||
boolean untap = true;
|
boolean untap = true;
|
||||||
for (RestrictionEffect effect : game.getContinuousEffects().getApplicableRestrictionEffects(artifact, game)) {
|
for (RestrictionEffect effect : game.getContinuousEffects().getApplicableRestrictionEffects(artifact, game)) {
|
||||||
untap &= effect.canBeUntapped(artifact, game);
|
untap &= effect.canBeUntapped(artifact, game);
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.newphyrexia;
|
package mage.sets.newphyrexia;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Outcome;
|
import mage.Constants.Outcome;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
|
|
@ -39,6 +38,8 @@ import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author North
|
* @author North
|
||||||
|
|
@ -84,8 +85,8 @@ class WarReportEffect extends OneShotEffect<WarReportEffect> {
|
||||||
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());
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
int lifeToGain = game.getBattlefield().countAll(new FilterCreaturePermanent());
|
int lifeToGain = game.getBattlefield().countAll(new FilterCreaturePermanent(), game);
|
||||||
lifeToGain += game.getBattlefield().countAll(new FilterArtifactPermanent());
|
lifeToGain += game.getBattlefield().countAll(new FilterArtifactPermanent(), game);
|
||||||
player.gainLife(lifeToGain, game);
|
player.gainLife(lifeToGain, game);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ class XenograftAddSubtypeEffect extends ContinuousEffectImpl<XenograftAddSubtype
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
String subtype = (String) game.getState().getValue(source.getSourceId() + "_XenograftType");
|
String subtype = (String) game.getState().getValue(source.getSourceId() + "_XenograftType");
|
||||||
if (subtype != null) {
|
if (subtype != null) {
|
||||||
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getControllerId());
|
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game);
|
||||||
for (Permanent permanent : permanents) {
|
for (Permanent permanent : permanents) {
|
||||||
if (permanent != null && !permanent.getSubtype().contains(subtype)) {
|
if (permanent != null && !permanent.getSubtype().contains(subtype)) {
|
||||||
permanent.getSubtype().add(subtype);
|
permanent.getSubtype().add(subtype);
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ class AkromasVengeanceEffect extends OneShotEffect<AkromasVengeanceEffect> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter)) {
|
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) {
|
||||||
permanent.destroy(source.getId(), game, false);
|
permanent.destroy(source.getId(), game, false);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ class BroodBirthingEffect extends OneShotEffect<BroodBirthingEffect> {
|
||||||
filter.setScopeSubtype(ComparisonScope.All);
|
filter.setScopeSubtype(ComparisonScope.All);
|
||||||
|
|
||||||
EldraziSpawnToken token = new EldraziSpawnToken();
|
EldraziSpawnToken token = new EldraziSpawnToken();
|
||||||
int count = game.getBattlefield().countAll(filter, source.getControllerId()) > 0 ? 3 : 1;
|
int count = game.getBattlefield().countAll(filter, source.getControllerId(), game) > 0 ? 3 : 1;
|
||||||
token.putOntoBattlefield(count, game, source.getSourceId(), source.getControllerId());
|
token.putOntoBattlefield(count, game, source.getSourceId(), source.getControllerId());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ class DawnglareInvokerEffect extends OneShotEffect<DawnglareInvokerEffect> {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(source.getFirstTarget());
|
Player player = game.getPlayer(source.getFirstTarget());
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
List<Permanent> allCreatures = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId());
|
List<Permanent> allCreatures = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId(), game);
|
||||||
for (Permanent creature : allCreatures) {
|
for (Permanent creature : allCreatures) {
|
||||||
creature.tap(game);
|
creature.tap(game);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,6 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.riseoftheeldrazi;
|
package mage.sets.riseoftheeldrazi;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Outcome;
|
import mage.Constants.Outcome;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
|
|
@ -41,6 +39,9 @@ import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.game.permanent.token.Token;
|
import mage.game.permanent.token.Token;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author North
|
* @author North
|
||||||
|
|
@ -85,7 +86,7 @@ class HellionEruptionEffect extends OneShotEffect<HellionEruptionEffect> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getControllerId());
|
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game);
|
||||||
for (Permanent permanent : permanents) {
|
for (Permanent permanent : permanents) {
|
||||||
permanent.sacrifice(source.getSourceId(), game);
|
permanent.sacrifice(source.getSourceId(), game);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ public class KhalniHydra extends CardImpl<KhalniHydra> {
|
||||||
@Override
|
@Override
|
||||||
public void adjustCosts(Ability ability, Game game) {
|
public void adjustCosts(Ability ability, Game game) {
|
||||||
super.adjustCosts(ability, game);
|
super.adjustCosts(ability, game);
|
||||||
int reductionAmount = game.getBattlefield().getAllActivePermanents(filter).size();
|
int reductionAmount = game.getBattlefield().getAllActivePermanents(filter, game).size();
|
||||||
Iterator<ManaCost> iter = ability.getManaCostsToPay().iterator();
|
Iterator<ManaCost> iter = ability.getManaCostsToPay().iterator();
|
||||||
|
|
||||||
while ( reductionAmount > 0 && iter.hasNext() ) {
|
while ( reductionAmount > 0 && iter.hasNext() ) {
|
||||||
|
|
|
||||||
|
|
@ -27,23 +27,22 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.riseoftheeldrazi;
|
package mage.sets.riseoftheeldrazi;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
import mage.Constants.Zone;
|
import mage.Constants.Zone;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.common.CounterTargetEffect;
|
import mage.abilities.effects.common.CounterTargetEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.filter.Filter;
|
|
||||||
import mage.filter.FilterSpell;
|
import mage.filter.FilterSpell;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.stack.Spell;
|
import mage.game.stack.Spell;
|
||||||
import mage.game.stack.StackObject;
|
import mage.game.stack.StackObject;
|
||||||
import mage.target.TargetObject;
|
import mage.target.TargetObject;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Rafbill
|
* @author Rafbill
|
||||||
|
|
@ -144,7 +143,7 @@ class TargetSpellTargetingControlledPermanent extends
|
||||||
public boolean canTarget(UUID id, Ability source, Game game) {
|
public boolean canTarget(UUID id, Ability source, Game game) {
|
||||||
Spell spell = game.getStack().getSpell(id);
|
Spell spell = game.getStack().getSpell(id);
|
||||||
if (spell != null) {
|
if (spell != null) {
|
||||||
return filter.match(spell);
|
return filter.match(spell, game);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -161,7 +160,7 @@ class TargetSpellTargetingControlledPermanent extends
|
||||||
if (stackObject instanceof Spell
|
if (stackObject instanceof Spell
|
||||||
&& game.getPlayer(sourceControllerId).getInRange()
|
&& game.getPlayer(sourceControllerId).getInRange()
|
||||||
.contains(stackObject.getControllerId())
|
.contains(stackObject.getControllerId())
|
||||||
&& filter.match((Spell) stackObject)
|
&& filter.match((Spell) stackObject, game)
|
||||||
&& ((Spell) stackObject).getSpellAbility().getTargets()
|
&& ((Spell) stackObject).getSpellAbility().getTargets()
|
||||||
.isChosen()
|
.isChosen()
|
||||||
&& game.getPermanent(((Spell) stackObject)
|
&& game.getPermanent(((Spell) stackObject)
|
||||||
|
|
@ -191,7 +190,7 @@ class TargetSpellTargetingControlledPermanent extends
|
||||||
if (stackObject instanceof Spell
|
if (stackObject instanceof Spell
|
||||||
&& game.getPlayer(sourceControllerId).getInRange()
|
&& game.getPlayer(sourceControllerId).getInRange()
|
||||||
.contains(stackObject.getControllerId())
|
.contains(stackObject.getControllerId())
|
||||||
&& filter.match((Spell) stackObject)
|
&& filter.match((Spell) stackObject, game)
|
||||||
&& ((Spell) stackObject).getSpellAbility().getTargets()
|
&& ((Spell) stackObject).getSpellAbility().getTargets()
|
||||||
.isChosen()
|
.isChosen()
|
||||||
&& game.getPermanent(((Spell) stackObject)
|
&& game.getPermanent(((Spell) stackObject)
|
||||||
|
|
|
||||||
|
|
@ -180,7 +180,7 @@ class SarkhanTheMadDragonDamageEffect extends OneShotEffect<SarkhanTheMadDragonD
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
List<Permanent> dragons = game.getBattlefield().getAllActivePermanents(filter);
|
List<Permanent> dragons = game.getBattlefield().getAllActivePermanents(filter, game);
|
||||||
Player player = game.getPlayer(source.getTargets().getFirstTarget());
|
Player player = game.getPlayer(source.getTargets().getFirstTarget());
|
||||||
if ( player != null && dragons != null && !dragons.isEmpty() ) {
|
if ( player != null && dragons != null && !dragons.isEmpty() ) {
|
||||||
for ( Permanent dragon : dragons ) {
|
for ( Permanent dragon : dragons ) {
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@
|
||||||
|
|
||||||
package mage.sets.riseoftheeldrazi;
|
package mage.sets.riseoftheeldrazi;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
|
@ -39,6 +38,8 @@ import mage.game.Game;
|
||||||
import mage.game.stack.StackObject;
|
import mage.game.stack.StackObject;
|
||||||
import mage.target.TargetSpell;
|
import mage.target.TargetSpell;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
|
|
@ -79,7 +80,7 @@ class UnifiedWillEffect extends CounterTargetEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
StackObject stackObject = game.getStack().getStackObject(source.getFirstTarget());
|
StackObject stackObject = game.getStack().getStackObject(source.getFirstTarget());
|
||||||
if (stackObject != null) {
|
if (stackObject != null) {
|
||||||
if (game.getBattlefield().countAll(filter, source.getControllerId()) > game.getBattlefield().countAll(filter, stackObject.getControllerId())) {
|
if (game.getBattlefield().countAll(filter, source.getControllerId(), game) > game.getBattlefield().countAll(filter, stackObject.getControllerId(), game)) {
|
||||||
return game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game);
|
return game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ class VeneratedTeacherEffect extends OneShotEffect<VeneratedTeacherEffect> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(filter, source.getControllerId());
|
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game);
|
||||||
if (!permanents.isEmpty()) {
|
if (!permanents.isEmpty()) {
|
||||||
for (Permanent permanent : permanents) {
|
for (Permanent permanent : permanents) {
|
||||||
for (Ability ability : permanent.getAbilities()) {
|
for (Ability ability : permanent.getAbilities()) {
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.scarsofmirrodin;
|
package mage.sets.scarsofmirrodin;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Outcome;
|
import mage.Constants.Outcome;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
|
|
@ -46,6 +45,8 @@ import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.common.TargetOpponent;
|
import mage.target.common.TargetOpponent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
|
|
@ -96,7 +97,7 @@ class CerebralEruptionEffect1 extends OneShotEffect<CerebralEruptionEffect1> {
|
||||||
game.getState().setValue(source.getId().toString(), card);
|
game.getState().setValue(source.getId().toString(), card);
|
||||||
int damage = card.getManaCost().convertedManaCost();
|
int damage = card.getManaCost().convertedManaCost();
|
||||||
player.damage(damage, source.getId(), game, false, true);
|
player.damage(damage, source.getId(), game, false, true);
|
||||||
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, player.getId())) {
|
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, player.getId(), game)) {
|
||||||
perm.damage(damage, source.getId(), game, true, false);
|
perm.damage(damage, source.getId(), game, true, false);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ class ContagionEngineEffect extends OneShotEffect<ContagionEngineEffect> {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player target = game.getPlayer(source.getFirstTarget());
|
Player target = game.getPlayer(source.getFirstTarget());
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
for (Permanent p : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), target.getId())) {
|
for (Permanent p : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), target.getId(), game)) {
|
||||||
p.addCounters(CounterType.M1M1.createInstance(), game);
|
p.addCounters(CounterType.M1M1.createInstance(), game);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -28,12 +28,9 @@
|
||||||
|
|
||||||
package mage.sets.scarsofmirrodin;
|
package mage.sets.scarsofmirrodin;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import mage.Constants;
|
import mage.Constants;
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
import mage.MageInt;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.LoyaltyAbility;
|
import mage.abilities.LoyaltyAbility;
|
||||||
import mage.abilities.common.EntersBattlefieldAbility;
|
import mage.abilities.common.EntersBattlefieldAbility;
|
||||||
|
|
@ -49,6 +46,8 @@ import mage.game.permanent.PermanentToken;
|
||||||
import mage.game.permanent.token.SoldierToken;
|
import mage.game.permanent.token.SoldierToken;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Loki
|
* @author Loki
|
||||||
|
|
@ -90,7 +89,7 @@ class ElspethTirelFirstEffect extends OneShotEffect<ElspethTirelFirstEffect> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
int amount = game.getBattlefield().countAll(new FilterCreaturePermanent(), source.getControllerId());
|
int amount = game.getBattlefield().countAll(new FilterCreaturePermanent(), source.getControllerId(), game);
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
player.gainLife(amount, game);
|
player.gainLife(amount, game);
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,7 @@ class PrecursorGolemCopySpellEffect extends OneShotEffect<PrecursorGolemCopySpel
|
||||||
if (spell != null) {
|
if (spell != null) {
|
||||||
SpellAbility sa = spell.getSpellAbility();
|
SpellAbility sa = spell.getSpellAbility();
|
||||||
UUID targetedGolem = (UUID) getValue("targetedGolem");
|
UUID targetedGolem = (UUID) getValue("targetedGolem");
|
||||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filterGolem)) {
|
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filterGolem, game)) {
|
||||||
if (permanent.getId().equals(targetedGolem)) {
|
if (permanent.getId().equals(targetedGolem)) {
|
||||||
continue; // copy only for other golems
|
continue; // copy only for other golems
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ public class ScrapdiverSerpent extends CardImpl<ScrapdiverSerpent> {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
UUID defendingPlayer = game.getCombat().getDefendingPlayer(source.getSourceId());
|
UUID defendingPlayer = game.getCombat().getDefendingPlayer(source.getSourceId());
|
||||||
if (defendingPlayer != null) {
|
if (defendingPlayer != null) {
|
||||||
return game.getBattlefield().countAll(filter, defendingPlayer) > 0;
|
return game.getBattlefield().countAll(filter, defendingPlayer, game) > 0;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ class SameNameAsExiledCountValue implements DynamicValue {
|
||||||
if (permanent != null && permanent.getImprinted().size() > 0) {
|
if (permanent != null && permanent.getImprinted().size() > 0) {
|
||||||
FilterPermanent filterPermanent = new FilterPermanent();
|
FilterPermanent filterPermanent = new FilterPermanent();
|
||||||
filterPermanent.getName().add(game.getCard(permanent.getImprinted().get(0)).getName());
|
filterPermanent.getName().add(game.getCard(permanent.getImprinted().get(0)).getName());
|
||||||
value = game.getBattlefield().countAll(filterPermanent);
|
value = game.getBattlefield().countAll(filterPermanent, game);
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,6 @@ import mage.game.stack.StackObject;
|
||||||
import mage.target.TargetObject;
|
import mage.target.TargetObject;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
@ -124,7 +123,7 @@ public class TurnAside extends CardImpl<TurnAside> {
|
||||||
public boolean canChoose(UUID sourceControllerId, Game game) {
|
public boolean canChoose(UUID sourceControllerId, Game game) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (StackObject stackObject : game.getStack()) {
|
for (StackObject stackObject : game.getStack()) {
|
||||||
if (stackObject instanceof Spell && game.getPlayer(sourceControllerId).getInRange().contains(stackObject.getControllerId()) && filter.match((Spell) stackObject)) {
|
if (stackObject instanceof Spell && game.getPlayer(sourceControllerId).getInRange().contains(stackObject.getControllerId()) && filter.match((Spell) stackObject, game)) {
|
||||||
if (targetsMyPermanent(stackObject.getId(), sourceControllerId, game)) {
|
if (targetsMyPermanent(stackObject.getId(), sourceControllerId, game)) {
|
||||||
count++;
|
count++;
|
||||||
if (count >= this.minNumberOfTargets)
|
if (count >= this.minNumberOfTargets)
|
||||||
|
|
@ -139,7 +138,7 @@ public class TurnAside extends CardImpl<TurnAside> {
|
||||||
public Set<UUID> possibleTargets(UUID sourceControllerId, Game game) {
|
public Set<UUID> possibleTargets(UUID sourceControllerId, Game game) {
|
||||||
Set<UUID> possibleTargets = new HashSet<UUID>();
|
Set<UUID> possibleTargets = new HashSet<UUID>();
|
||||||
for (StackObject stackObject : game.getStack()) {
|
for (StackObject stackObject : game.getStack()) {
|
||||||
if (stackObject instanceof Spell && game.getPlayer(sourceControllerId).getInRange().contains(stackObject.getControllerId()) && filter.match((Spell) stackObject)) {
|
if (stackObject instanceof Spell && game.getPlayer(sourceControllerId).getInRange().contains(stackObject.getControllerId()) && filter.match((Spell) stackObject, game)) {
|
||||||
if (targetsMyPermanent(stackObject.getId(), sourceControllerId, game)) {
|
if (targetsMyPermanent(stackObject.getId(), sourceControllerId, game)) {
|
||||||
|
|
||||||
possibleTargets.add(stackObject.getId());
|
possibleTargets.add(stackObject.getId());
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ class ControlTwoOrMoreBlackPermanentsCost extends CostImpl<ControlTwoOrMoreBlack
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
|
public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
|
||||||
return game.getBattlefield().contains(filter, controllerId, 2);
|
return game.getBattlefield().contains(filter, controllerId, 2, game);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ class ElspethKnightErrantEffect extends ContinuousEffectImpl<ElspethKnightErrant
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, source.getControllerId())) {
|
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
||||||
perm.addAbility(IndestructibleAbility.getInstance(), game);
|
perm.addAbility(IndestructibleAbility.getInstance(), game);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@
|
||||||
|
|
||||||
package mage.sets.shardsofalara;
|
package mage.sets.shardsofalara;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Outcome;
|
import mage.Constants.Outcome;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
|
|
@ -43,6 +42,8 @@ import mage.filter.common.FilterLandPermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.target.common.TargetCardInLibrary;
|
import mage.target.common.TargetCardInLibrary;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
|
|
@ -99,9 +100,9 @@ class KnightOfTheWhiteOrchidAbility extends ZoneChangeTriggeredAbility<KnightOfT
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkInterveningIfClause(Game game) {
|
public boolean checkInterveningIfClause(Game game) {
|
||||||
int numLands = game.getBattlefield().countAll(filter2, this.controllerId);
|
int numLands = game.getBattlefield().countAll(filter2, this.controllerId, game);
|
||||||
for (UUID opponentId: game.getOpponents(this.controllerId)) {
|
for (UUID opponentId: game.getOpponents(this.controllerId)) {
|
||||||
if (numLands < game.getBattlefield().countAll(filter2, opponentId)) {
|
if (numLands < game.getBattlefield().countAll(filter2, opponentId, game)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,15 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.shardsofalara;
|
package mage.sets.shardsofalara;
|
||||||
|
|
||||||
import java.util.List;
|
import mage.Constants.*;
|
||||||
import java.util.UUID;
|
|
||||||
import mage.Constants.CardType;
|
|
||||||
import mage.Constants.Duration;
|
|
||||||
import mage.Constants.Layer;
|
|
||||||
import mage.Constants.Outcome;
|
|
||||||
import mage.Constants.Rarity;
|
|
||||||
import mage.Constants.SubLayer;
|
|
||||||
import mage.Constants.Zone;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.LoyaltyAbility;
|
import mage.abilities.LoyaltyAbility;
|
||||||
import mage.abilities.common.EntersBattlefieldAbility;
|
import mage.abilities.common.EntersBattlefieldAbility;
|
||||||
|
|
@ -57,6 +49,9 @@ import mage.players.Player;
|
||||||
import mage.target.common.TargetArtifactPermanent;
|
import mage.target.common.TargetArtifactPermanent;
|
||||||
import mage.target.common.TargetCardInLibrary;
|
import mage.target.common.TargetCardInLibrary;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author North
|
* @author North
|
||||||
|
|
@ -157,7 +152,7 @@ class TezzeretTheSeekerEffect3 extends ContinuousEffectImpl<TezzeretTheSeekerEff
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||||
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(new FilterArtifactPermanent(), source.getControllerId());
|
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(new FilterArtifactPermanent(), source.getControllerId(), game);
|
||||||
for (Permanent permanent : permanents) {
|
for (Permanent permanent : permanents) {
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
switch (layer) {
|
switch (layer) {
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ class TranquilityEffect extends OneShotEffect<TranquilityEffect> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter)) {
|
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) {
|
||||||
permanent.destroy(source.getId(), game, false);
|
permanent.destroy(source.getId(), game, false);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@
|
||||||
|
|
||||||
package mage.sets.worldwake;
|
package mage.sets.worldwake;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
import mage.Constants.Zone;
|
import mage.Constants.Zone;
|
||||||
|
|
@ -47,6 +46,8 @@ import mage.filter.common.FilterLandPermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.target.common.TargetNonBasicLandPermanent;
|
import mage.target.common.TargetNonBasicLandPermanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
|
|
@ -98,7 +99,7 @@ class TectonicEdgeCost extends CostImpl<TectonicEdgeCost> {
|
||||||
@Override
|
@Override
|
||||||
public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
|
public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
|
||||||
for (UUID opponentId: game.getOpponents(controllerId)) {
|
for (UUID opponentId: game.getOpponents(controllerId)) {
|
||||||
if (game.getBattlefield().countAll(filter, opponentId) > 3) {
|
if (game.getBattlefield().countAll(filter, opponentId, game) > 3) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,15 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.zendikar;
|
package mage.sets.zendikar;
|
||||||
|
|
||||||
import java.util.List;
|
import mage.Constants.*;
|
||||||
import java.util.UUID;
|
|
||||||
import mage.Constants.CardType;
|
|
||||||
import mage.Constants.Duration;
|
|
||||||
import mage.Constants.Layer;
|
|
||||||
import mage.Constants.Outcome;
|
|
||||||
import mage.Constants.Rarity;
|
|
||||||
import mage.Constants.SubLayer;
|
|
||||||
import mage.Constants.Zone;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
|
@ -45,6 +37,9 @@ import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author North
|
* @author North
|
||||||
|
|
@ -106,7 +101,7 @@ class ArmamentMasterEffect extends ContinuousEffectImpl<ArmamentMasterEffect> {
|
||||||
public void init(Ability source, Game game) {
|
public void init(Ability source, Game game) {
|
||||||
super.init(source, game);
|
super.init(source, game);
|
||||||
if (this.affectedObjectsSet) {
|
if (this.affectedObjectsSet) {
|
||||||
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(filter, source.getControllerId());
|
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game);
|
||||||
for (Permanent perm : permanents) {
|
for (Permanent perm : permanents) {
|
||||||
if (!perm.getId().equals(source.getSourceId())) {
|
if (!perm.getId().equals(source.getSourceId())) {
|
||||||
objects.add(perm.getId());
|
objects.add(perm.getId());
|
||||||
|
|
@ -118,7 +113,7 @@ class ArmamentMasterEffect extends ContinuousEffectImpl<ArmamentMasterEffect> {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
int count = countEquipment(game, source);
|
int count = countEquipment(game, source);
|
||||||
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(filter, source.getControllerId());
|
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game);
|
||||||
for (Permanent perm : permanents) {
|
for (Permanent perm : permanents) {
|
||||||
if (!this.affectedObjectsSet || objects.contains(perm.getId())) {
|
if (!this.affectedObjectsSet || objects.contains(perm.getId())) {
|
||||||
if (!perm.getId().equals(source.getSourceId())) {
|
if (!perm.getId().equals(source.getSourceId())) {
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.zendikar;
|
package mage.sets.zendikar;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
import mage.Constants.Zone;
|
import mage.Constants.Zone;
|
||||||
|
|
@ -43,6 +42,8 @@ import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.target.common.TargetCardInYourGraveyard;
|
import mage.target.common.TargetCardInYourGraveyard;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author North
|
* @author North
|
||||||
|
|
@ -105,7 +106,7 @@ class EmeriaTheSkyRuinTriggeredAbility extends TriggeredAbilityImpl<EmeriaTheSky
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkInterveningIfClause(Game game) {
|
public boolean checkInterveningIfClause(Game game) {
|
||||||
return game.getBattlefield().countAll(filter, this.controllerId) >= 7;
|
return game.getBattlefield().countAll(filter, this.controllerId, game) >= 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ class FeastOfBloodCost extends CostImpl<FeastOfBloodCost> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
|
public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
|
||||||
return game.getBattlefield().contains(filter, controllerId, 2);
|
return game.getBattlefield().contains(filter, controllerId, 2, game);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ class MalakirBloodwitchEffect extends OneShotEffect<MalakirBloodwitchEffect> {
|
||||||
|
|
||||||
FilterControlledPermanent filter = new FilterControlledPermanent("Vampire");
|
FilterControlledPermanent filter = new FilterControlledPermanent("Vampire");
|
||||||
filter.getSubtype().add("Vampire");
|
filter.getSubtype().add("Vampire");
|
||||||
int amount = game.getBattlefield().countAll(filter, source.getControllerId());
|
int amount = game.getBattlefield().countAll(filter, source.getControllerId(), game);
|
||||||
Set<UUID> opponents = game.getOpponents(source.getControllerId());
|
Set<UUID> opponents = game.getOpponents(source.getControllerId());
|
||||||
|
|
||||||
int total = 0;
|
int total = 0;
|
||||||
|
|
|
||||||
|
|
@ -27,14 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.zendikar;
|
package mage.sets.zendikar;
|
||||||
|
|
||||||
import java.util.List;
|
import mage.Constants.*;
|
||||||
import java.util.UUID;
|
|
||||||
import mage.Constants.CardType;
|
|
||||||
import mage.Constants.Duration;
|
|
||||||
import mage.Constants.Layer;
|
|
||||||
import mage.Constants.Outcome;
|
|
||||||
import mage.Constants.Rarity;
|
|
||||||
import mage.Constants.SubLayer;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.condition.common.KickedCondition;
|
import mage.abilities.condition.common.KickedCondition;
|
||||||
import mage.abilities.costs.mana.KickerManaCost;
|
import mage.abilities.costs.mana.KickerManaCost;
|
||||||
|
|
@ -46,6 +39,9 @@ import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.TargetPlayer;
|
import mage.target.TargetPlayer;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author North
|
* @author North
|
||||||
|
|
@ -107,7 +103,7 @@ class MarshCasualtiesEffect extends ContinuousEffectImpl<MarshCasualtiesEffect>
|
||||||
public void init(Ability source, Game game) {
|
public void init(Ability source, Game game) {
|
||||||
super.init(source, game);
|
super.init(source, game);
|
||||||
if (this.affectedObjectsSet) {
|
if (this.affectedObjectsSet) {
|
||||||
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getFirstTarget());
|
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getFirstTarget(), game);
|
||||||
for (Permanent creature : creatures) {
|
for (Permanent creature : creatures) {
|
||||||
objects.add(creature.getId());
|
objects.add(creature.getId());
|
||||||
}
|
}
|
||||||
|
|
@ -116,7 +112,7 @@ class MarshCasualtiesEffect extends ContinuousEffectImpl<MarshCasualtiesEffect>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getFirstTarget());
|
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getFirstTarget(), game);
|
||||||
for (Permanent creature : creatures) {
|
for (Permanent creature : creatures) {
|
||||||
if (!this.affectedObjectsSet || objects.contains(creature.getId())) {
|
if (!this.affectedObjectsSet || objects.contains(creature.getId())) {
|
||||||
creature.addPower(power);
|
creature.addPower(power);
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ class MindlessNullEffect extends RestrictionEffect<MindlessNullEffect> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||||
if (game.getBattlefield().countAll(filter, source.getControllerId()) == 0) {
|
if (game.getBattlefield().countAll(filter, source.getControllerId(), game) == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ class NissaRevaneGainLifeEffect extends OneShotEffect<NissaRevaneGainLifeEffect>
|
||||||
@Override
|
@Override
|
||||||
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());
|
||||||
int life = 2 * game.getBattlefield().countAll(filter);
|
int life = 2 * game.getBattlefield().countAll(filter, game);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
player.gainLife(life, game);
|
player.gainLife(life, game);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ class ScuteMobAbility extends TriggeredAbilityImpl<ScuteMobAbility> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkInterveningIfClause(Game game) {
|
public boolean checkInterveningIfClause(Game game) {
|
||||||
return game.getBattlefield().countAll(filter, this.controllerId) >= 5;
|
return game.getBattlefield().countAll(filter, this.controllerId, game) >= 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import mage.abilities.Abilities;
|
||||||
import mage.abilities.AbilitiesImpl;
|
import mage.abilities.AbilitiesImpl;
|
||||||
import mage.abilities.keyword.LifelinkAbility;
|
import mage.abilities.keyword.LifelinkAbility;
|
||||||
import mage.filter.Filter;
|
import mage.filter.Filter;
|
||||||
import org.junit.Assert;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
|
|
||||||
|
|
@ -352,7 +351,18 @@ public class SoulbondKeywordTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testExileAndReturnBack() {
|
public void testExileAndReturnBack() {
|
||||||
//TODO: Soulbond + Soulshift
|
addCard(Constants.Zone.HAND, playerA, "Elite Vanguard");
|
||||||
Assert.assertTrue(false);
|
addCard(Constants.Zone.BATTLEFIELD, playerA, "Trusted Forcemage");
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerA, "Plains", 2);
|
||||||
|
|
||||||
|
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Elite Vanguard");
|
||||||
|
castSpell(1, Constants.PhaseStep.POSTCOMBAT_MAIN, playerA, "Cloudshift", "Trusted Forcemage");
|
||||||
|
|
||||||
|
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertPermanentCount(playerA, "Trusted Forcemage", 1);
|
||||||
|
assertPowerToughness(playerA, "Trusted Forcemage", 3, 3);
|
||||||
|
assertPowerToughness(playerA, "Elite Vanguard", 3, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue