mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
Changed used battlefield.count or battlefield.getActivePermanents methods to take player range into account.
This commit is contained in:
parent
efe277621e
commit
127e63ce0d
33 changed files with 80 additions and 82 deletions
|
@ -92,7 +92,7 @@ class DesolationAngelEntersBattlefieldEffect extends OneShotEffect<DesolationAng
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Card p = game.getCard(source.getSourceId());
|
Card p = game.getCard(source.getSourceId());
|
||||||
boolean kicked = KickedCondition.getInstance().apply(game, source);
|
boolean kicked = KickedCondition.getInstance().apply(game, source);
|
||||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterLandPermanent(),game)) {
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterLandPermanent(), source.getControllerId(), source.getSourceId(), game)) {
|
||||||
if ((!kicked && permanent.getControllerId() == source.getControllerId())
|
if ((!kicked && permanent.getControllerId() == source.getControllerId())
|
||||||
|| kicked) {
|
|| kicked) {
|
||||||
permanent.destroy(source.getSourceId(), game, false);
|
permanent.destroy(source.getSourceId(), game, false);
|
||||||
|
|
|
@ -28,9 +28,8 @@
|
||||||
package mage.sets.apocalypse;
|
package mage.sets.apocalypse;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.Constants;
|
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
|
import mage.Constants.Outcome;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
@ -51,7 +50,10 @@ public class TranquilPath extends CardImpl<TranquilPath> {
|
||||||
super(ownerId, 89, "Tranquil Path", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{4}{G}");
|
super(ownerId, 89, "Tranquil Path", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{4}{G}");
|
||||||
this.expansionSetCode = "APC";
|
this.expansionSetCode = "APC";
|
||||||
this.color.setGreen(true);
|
this.color.setGreen(true);
|
||||||
|
|
||||||
|
// Destroy all enchantments.
|
||||||
this.getSpellAbility().addEffect(new TranquilPathEffect());
|
this.getSpellAbility().addEffect(new TranquilPathEffect());
|
||||||
|
// Draw a card.
|
||||||
this.getSpellAbility().addEffect(new DrawCardControllerEffect(1));
|
this.getSpellAbility().addEffect(new DrawCardControllerEffect(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +76,7 @@ class TranquilPathEffect extends OneShotEffect<TranquilPathEffect> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public TranquilPathEffect() {
|
public TranquilPathEffect() {
|
||||||
super(Constants.Outcome.DestroyPermanent);
|
super(Outcome.DestroyPermanent);
|
||||||
staticText = "Destroy all enchantments";
|
staticText = "Destroy all enchantments";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +86,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, game)) {
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
permanent.destroy(source.getId(), game, false);
|
permanent.destroy(source.getId(), game, false);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -34,16 +34,16 @@ import mage.Constants.Rarity;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.keyword.FlyingAbility;
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.filter.common.FilterCreatureCard;
|
import mage.filter.common.FilterCreatureCard;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.game.Game;
|
|
||||||
import mage.abilities.effects.OneShotEffect;
|
|
||||||
import mage.cards.Card;
|
|
||||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||||
import mage.players.Player;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.players.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -105,7 +105,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, game)) {
|
for (Permanent zombie : game.getBattlefield().getActivePermanents(filterZombie, source.getControllerId(), source.getSourceId(), 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,9 +27,11 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.avacynrestored;
|
package mage.sets.avacynrestored;
|
||||||
|
|
||||||
import mage.Constants;
|
import java.util.UUID;
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
|
import mage.Constants.Outcome;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
|
import mage.Constants.Zone;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
@ -39,7 +41,6 @@ import mage.filter.common.FilterNonlandPermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -73,7 +74,7 @@ public class DevastationTide extends CardImpl<DevastationTide> {
|
||||||
class DevastationTideEffect extends OneShotEffect<DevastationTideEffect> {
|
class DevastationTideEffect extends OneShotEffect<DevastationTideEffect> {
|
||||||
|
|
||||||
public DevastationTideEffect() {
|
public DevastationTideEffect() {
|
||||||
super(Constants.Outcome.ReturnToHand);
|
super(Outcome.ReturnToHand);
|
||||||
staticText = "Return all nonland permanents to their owners' hands";
|
staticText = "Return all nonland permanents to their owners' hands";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,8 +84,8 @@ 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(), game)) {
|
for (Permanent creature : game.getBattlefield().getActivePermanents(new FilterNonlandPermanent(), source.getControllerId(), source.getSourceId(), game)) {
|
||||||
creature.moveToZone(Constants.Zone.HAND, source.getSourceId(), game, true);
|
creature.moveToZone(Zone.HAND, source.getSourceId(), game, true);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class AuraBarbs extends CardImpl<AuraBarbs> {
|
||||||
FilterPermanent filterEnchantments = new FilterPermanent();
|
FilterPermanent filterEnchantments = new FilterPermanent();
|
||||||
filterEnchantments.add(new CardTypePredicate(CardType.ENCHANTMENT));
|
filterEnchantments.add(new CardTypePredicate(CardType.ENCHANTMENT));
|
||||||
|
|
||||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filterEnchantments, game)) {
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(filterEnchantments, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
Player controller = game.getPlayer(permanent.getControllerId());
|
Player controller = game.getPlayer(permanent.getControllerId());
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
controller.damage(2, permanent.getId(), game, false, true);
|
controller.damage(2, permanent.getId(), game, false, true);
|
||||||
|
@ -92,7 +92,7 @@ public class AuraBarbs extends CardImpl<AuraBarbs> {
|
||||||
}
|
}
|
||||||
|
|
||||||
filterEnchantments.add(new SubtypePredicate("Aura"));
|
filterEnchantments.add(new SubtypePredicate("Aura"));
|
||||||
for (Permanent auraEnchantment : game.getBattlefield().getAllActivePermanents(filterEnchantments, game)) {
|
for (Permanent auraEnchantment : game.getBattlefield().getActivePermanents(filterEnchantments, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
if (auraEnchantment.getAttachedTo() != null) {
|
if (auraEnchantment.getAttachedTo() != null) {
|
||||||
Permanent attachedToCreature = game.getPermanent(auraEnchantment.getAttachedTo());
|
Permanent attachedToCreature = game.getPermanent(auraEnchantment.getAttachedTo());
|
||||||
if (attachedToCreature != null && attachedToCreature.getCardType().contains(CardType.CREATURE)) {
|
if (attachedToCreature != null && attachedToCreature.getCardType().contains(CardType.CREATURE)) {
|
||||||
|
|
|
@ -84,7 +84,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, game)) {
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
permanent.moveToExile(null, null,source.getId(), game);
|
permanent.moveToExile(null, null,source.getId(), game);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -104,7 +104,7 @@ class PatronOfTheOrochiEffect extends OneShotEffect<PatronOfTheOrochiEffect> {
|
||||||
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 permanent: game.getBattlefield().getAllActivePermanents(filter, game)) {
|
for (Permanent permanent: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
permanent.untap(game);
|
permanent.untap(game);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -87,7 +87,7 @@ class ReduceToDreamsEffect extends OneShotEffect<ReduceToDreamsEffect> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
for (Permanent creature : game.getBattlefield().getAllActivePermanents(filter, game)) {
|
for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
creature.moveToZone(Constants.Zone.HAND, source.getSourceId(), game, true);
|
creature.moveToZone(Constants.Zone.HAND, source.getSourceId(), game, true);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -35,6 +35,7 @@ import mage.Constants.Rarity;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
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.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
@ -85,7 +86,7 @@ class WretchedBanquetEffect extends OneShotEffect<WretchedBanquetEffect> {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent targetCreature = game.getPermanent(source.getFirstTarget());
|
Permanent targetCreature = game.getPermanent(source.getFirstTarget());
|
||||||
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(CardType.CREATURE);
|
List<Permanent> creatures = game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), source.getSourceId(), game);
|
||||||
|
|
||||||
int minPower = targetCreature.getPower().getValue() + 1;
|
int minPower = targetCreature.getPower().getValue() + 1;
|
||||||
for (Permanent creature : creatures) {
|
for (Permanent creature : creatures) {
|
||||||
|
|
|
@ -86,7 +86,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, game)) {
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
permanent.destroy(source.getId(), game, false);
|
permanent.destroy(source.getId(), game, false);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -36,21 +36,20 @@ import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.StateTriggeredAbility;
|
import mage.abilities.StateTriggeredAbility;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.effects.common.SacrificeSourceEffect;
|
|
||||||
import mage.cards.CardImpl;
|
|
||||||
import mage.filter.FilterPermanent;
|
|
||||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
|
||||||
import mage.abilities.common.SkipUntapOptionalAbility;
|
import mage.abilities.common.SkipUntapOptionalAbility;
|
||||||
import mage.abilities.condition.Condition;
|
import mage.abilities.condition.Condition;
|
||||||
import mage.abilities.condition.common.ControlsPermanentCondition;
|
import mage.abilities.condition.common.ControlsPermanentCondition;
|
||||||
import mage.abilities.costs.common.TapSourceCost;
|
import mage.abilities.costs.common.TapSourceCost;
|
||||||
import mage.abilities.decorator.ConditionalContinousEffect;
|
import mage.abilities.decorator.ConditionalContinousEffect;
|
||||||
|
import mage.abilities.effects.common.SacrificeSourceEffect;
|
||||||
import mage.abilities.effects.common.continious.GainControlTargetEffect;
|
import mage.abilities.effects.common.continious.GainControlTargetEffect;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.filter.FilterPermanent;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.filter.common.FilterLandPermanent;
|
import mage.filter.common.FilterLandPermanent;
|
||||||
import mage.filter.predicate.Predicate;
|
import mage.filter.predicate.Predicate;
|
||||||
import mage.filter.predicate.mageobject.CardIdPredicate;
|
import mage.filter.predicate.mageobject.CardIdPredicate;
|
||||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
@ -110,14 +109,14 @@ public class Seasinger extends CardImpl<Seasinger> {
|
||||||
}
|
}
|
||||||
|
|
||||||
class ControllerControlsIslandPredicate implements Predicate<Permanent> {
|
class ControllerControlsIslandPredicate implements Predicate<Permanent> {
|
||||||
|
public static final FilterLandPermanent filter = new FilterLandPermanent("Island");
|
||||||
|
{
|
||||||
|
filter.add(new SubtypePredicate("Island"));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Permanent input, Game game) {
|
public boolean apply(Permanent input, Game game) {
|
||||||
FilterLandPermanent islandControlledByTargetCreatureController = new FilterLandPermanent("Island");
|
return (game.getBattlefield().countAll(filter, input.getControllerId(), game) > 0);
|
||||||
islandControlledByTargetCreatureController.add(new SubtypePredicate("Island"));
|
|
||||||
UUID controllerId = input.getControllerId();
|
|
||||||
islandControlledByTargetCreatureController.add(new ControllerIdPredicate(controllerId));
|
|
||||||
return !game.getBattlefield().getAllActivePermanents(islandControlledByTargetCreatureController, game).isEmpty();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -143,12 +142,7 @@ class SeasingerTriggeredAbility extends StateTriggeredAbility<SeasingerTriggered
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
for (Permanent perm : game.getBattlefield().getAllActivePermanents(controllerId)) {
|
return (game.getBattlefield().countAll(ControllerControlsIslandPredicate.filter, controllerId, game) == 0);
|
||||||
if (perm.getSubtype().contains("Island")) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.innistrad;
|
package mage.sets.innistrad;
|
||||||
|
|
||||||
|
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.Rarity;
|
import mage.Constants.Rarity;
|
||||||
|
@ -37,8 +39,6 @@ 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 nantuko
|
* @author nantuko
|
||||||
|
@ -59,7 +59,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(), game).size();
|
int creatureCount = game.getState().getBattlefield().count(new FilterCreaturePermanent(), ability.getSourceId(), ability.getControllerId(), game);
|
||||||
int cost = 8 - creatureCount;
|
int cost = 8 - creatureCount;
|
||||||
String adjustedCost = "{R}";
|
String adjustedCost = "{R}";
|
||||||
if (cost > 0) {
|
if (cost > 0) {
|
||||||
|
|
|
@ -80,7 +80,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, game)) {
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
permanent.destroy(source.getId(), game, false);
|
permanent.destroy(source.getId(), game, false);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -82,7 +82,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, game)) {
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
permanent.destroy(source.getId(), game, false);
|
permanent.destroy(source.getId(), game, false);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -89,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, game)) {
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(nonLand, source.getControllerId(), source.getSourceId(), 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);
|
||||||
|
|
|
@ -33,13 +33,16 @@ import mage.Constants.CardType;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
import mage.Constants.TargetController;
|
import mage.Constants.TargetController;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.effects.ContinuousEffect;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||||
import mage.abilities.effects.common.continious.BoostSourceEffect;
|
import mage.abilities.effects.common.continious.BoostAllEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
|
import mage.filter.predicate.Predicates;
|
||||||
|
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||||
|
import mage.filter.predicate.permanent.PermanentIdPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
@ -80,12 +83,6 @@ public class PublicExecution extends CardImpl<PublicExecution> {
|
||||||
|
|
||||||
class PublicExecutionEffect extends OneShotEffect<PublicExecutionEffect> {
|
class PublicExecutionEffect extends OneShotEffect<PublicExecutionEffect> {
|
||||||
|
|
||||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("each other creature an opponent controls");
|
|
||||||
|
|
||||||
static {
|
|
||||||
filter.add(new ControllerPredicate(TargetController.NOT_YOU));
|
|
||||||
}
|
|
||||||
|
|
||||||
public PublicExecutionEffect() {
|
public PublicExecutionEffect() {
|
||||||
super(Constants.Outcome.Benefit);
|
super(Constants.Outcome.Benefit);
|
||||||
staticText = "Each other creature that player controls gets -2/-0 until end of turn";
|
staticText = "Each other creature that player controls gets -2/-0 until end of turn";
|
||||||
|
@ -101,11 +98,11 @@ class PublicExecutionEffect extends OneShotEffect<PublicExecutionEffect> {
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
UUID opponent = target.getControllerId();
|
UUID opponent = target.getControllerId();
|
||||||
if (opponent != null) {
|
if (opponent != null) {
|
||||||
for (Permanent creature : game.getBattlefield().getAllActivePermanents(filter, game)) {
|
FilterCreaturePermanent filter = new FilterCreaturePermanent("each other creature that player controls");
|
||||||
if (creature != null && creature.getControllerId() == opponent && creature != target) {
|
filter.add(new ControllerIdPredicate(opponent));
|
||||||
creature.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BoostSourceEffect(-2, 0, Constants.Duration.EndOfTurn)), game);
|
filter.add(Predicates.not(new PermanentIdPredicate(target.getId())));
|
||||||
}
|
ContinuousEffect effect = new BoostAllEffect(-2,0, Constants.Duration.EndOfTurn, filter, false);
|
||||||
}
|
game.addEffect(effect, source);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ class WorldfireEffect extends OneShotEffect<WorldfireEffect> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) {
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
permanent.moveToExile(id, "all permanents", id, game);
|
permanent.moveToExile(id, "all permanents", id, game);
|
||||||
}
|
}
|
||||||
for (UUID playerId : game.getPlayerList()) {
|
for (UUID playerId : game.getPlayerList()) {
|
||||||
|
|
|
@ -89,7 +89,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, game)) {
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
permanent.destroy(source.getId(), game, false);
|
permanent.destroy(source.getId(), game, false);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -96,7 +96,7 @@ class CyclonicRiftEffect extends OneShotEffect<CyclonicRiftEffect> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
for (Permanent creature : game.getBattlefield().getAllActivePermanents(filter, game)) {
|
for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
if (!creature.getControllerId().equals(source.getControllerId())) {
|
if (!creature.getControllerId().equals(source.getControllerId())) {
|
||||||
creature.moveToZone(Constants.Zone.HAND, source.getSourceId(), game, true);
|
creature.moveToZone(Constants.Zone.HAND, source.getSourceId(), game, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@ public class RakdosCharm extends CardImpl<RakdosCharm> {
|
||||||
FilterPermanent filterEnchantments = new FilterPermanent();
|
FilterPermanent filterEnchantments = new FilterPermanent();
|
||||||
filterEnchantments.add(new CardTypePredicate(CardType.CREATURE));
|
filterEnchantments.add(new CardTypePredicate(CardType.CREATURE));
|
||||||
|
|
||||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filterEnchantments, game)) {
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(filterEnchantments, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
Player controller = game.getPlayer(permanent.getControllerId());
|
Player controller = game.getPlayer(permanent.getControllerId());
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
controller.damage(1, permanent.getId(), game, false, true);
|
controller.damage(1, permanent.getId(), game, false, true);
|
||||||
|
|
|
@ -106,7 +106,7 @@ class TeleportalEffect extends OneShotEffect<TeleportalEffect> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
for (Permanent creature : game.getBattlefield().getAllActivePermanents(filter, game)) {
|
for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
UnblockableTargetEffect effect = new UnblockableTargetEffect();
|
UnblockableTargetEffect effect = new UnblockableTargetEffect();
|
||||||
effect.setTargetPointer(new FixedTarget(creature.getId()));
|
effect.setTargetPointer(new FixedTarget(creature.getId()));
|
||||||
game.addEffect(effect, source);
|
game.addEffect(effect, source);
|
||||||
|
|
|
@ -77,15 +77,17 @@ 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, game).size();
|
int reductionAmount = game.getBattlefield().count(filter, ability.getSourceId(), ability.getControllerId(), game);
|
||||||
Iterator<ManaCost> iter = ability.getManaCostsToPay().iterator();
|
Iterator<ManaCost> iter = ability.getManaCostsToPay().iterator();
|
||||||
|
|
||||||
while ( reductionAmount > 0 && iter.hasNext() ) {
|
while ( reductionAmount > 0 && iter.hasNext() ) {
|
||||||
iter.next();
|
ManaCost manaCost = iter.next();
|
||||||
|
if (manaCost.getMana().getGreen() > 0) { // in case another effect adds additional mana cost
|
||||||
iter.remove();
|
iter.remove();
|
||||||
reductionAmount--;
|
reductionAmount--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public KhalniHydra copy() {
|
public KhalniHydra copy() {
|
||||||
|
|
|
@ -182,7 +182,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, game);
|
List<Permanent> dragons = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), 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 ) {
|
||||||
|
|
|
@ -175,7 +175,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, game)) {
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(filterGolem, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
if (permanent.getId().equals(targetedGolem)) {
|
if (permanent.getId().equals(targetedGolem)) {
|
||||||
continue; // copy only for other golems
|
continue; // copy only for other golems
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,7 @@ class EvacuationEffect extends OneShotEffect<EvacuationEffect> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
for (Permanent creature : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), game)) {
|
for (Permanent creature : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), source.getSourceId(), game)) {
|
||||||
creature.moveToZone(Constants.Zone.HAND, source.getSourceId(), game, true);
|
creature.moveToZone(Constants.Zone.HAND, source.getSourceId(), game, true);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -174,7 +174,7 @@ class UntapAllCreatureEffect extends OneShotEffect<UntapAllCreatureEffect> {
|
||||||
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 land: game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), game)) {
|
for (Permanent land: game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), source.getSourceId(), game)) {
|
||||||
land.untap(game);
|
land.untap(game);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -82,7 +82,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, game)) {
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
permanent.destroy(source.getId(), game, false);
|
permanent.destroy(source.getId(), game, false);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -80,7 +80,7 @@ class RebuildEffect extends OneShotEffect<RebuildEffect> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
for (Permanent creature : game.getBattlefield().getAllActivePermanents(new FilterArtifactPermanent(), game)) {
|
for (Permanent creature : game.getBattlefield().getActivePermanents(new FilterArtifactPermanent(), source.getControllerId(), source.getSourceId(), game)) {
|
||||||
creature.moveToZone(Constants.Zone.HAND, source.getSourceId(), game, true);
|
creature.moveToZone(Constants.Zone.HAND, source.getSourceId(), game, true);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -35,6 +35,7 @@ import mage.Constants.Rarity;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.filter.common.FilterLandPermanent;
|
||||||
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.Player;
|
||||||
|
@ -77,8 +78,8 @@ class AcidicSoilEffect extends OneShotEffect<AcidicSoilEffect> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(CardType.LAND);
|
List<Permanent> permanents = game.getBattlefield().getActivePermanents(new FilterLandPermanent(), source.getControllerId(), source.getSourceId(), game);
|
||||||
for (UUID playerId : game.getPlayerList()) {
|
for (UUID playerId : game.getPlayer(source.getControllerId()).getInRange()) {
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
int amount = 0;
|
int amount = 0;
|
||||||
|
|
|
@ -85,7 +85,7 @@ class HibernationEffect extends OneShotEffect<HibernationEffect> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) {
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
permanent.moveToZone(Constants.Zone.HAND, source.getSourceId(), game, true);
|
permanent.moveToZone(Constants.Zone.HAND, source.getSourceId(), game, true);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -85,7 +85,7 @@ class HushEffect extends OneShotEffect<HushEffect> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) {
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
permanent.destroy(source.getId(), game, false);
|
permanent.destroy(source.getId(), game, false);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -103,7 +103,7 @@ class StoneIdolTrapCostReductionEffect extends CostModificationEffectImpl<StoneI
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source, Ability abilityToModify) {
|
public boolean apply(Game game, Ability source, Ability abilityToModify) {
|
||||||
int reductionAmount = game.getBattlefield().getAllActivePermanents(filter, game).size();
|
int reductionAmount = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(),game);
|
||||||
CardUtil.adjustCost(abilityToModify, reductionAmount);
|
CardUtil.adjustCost(abilityToModify, reductionAmount);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class BoostOpponentsEffect extends ContinuousEffectImpl<BoostOpponentsEff
|
||||||
super.init(source, game);
|
super.init(source, game);
|
||||||
if (this.affectedObjectsSet) {
|
if (this.affectedObjectsSet) {
|
||||||
Set<UUID> opponents = game.getOpponents(source.getControllerId());
|
Set<UUID> opponents = game.getOpponents(source.getControllerId());
|
||||||
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, game)) {
|
for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
if (opponents.contains(perm.getControllerId())) {
|
if (opponents.contains(perm.getControllerId())) {
|
||||||
objects.add(perm.getId());
|
objects.add(perm.getId());
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ public class BoostOpponentsEffect extends ContinuousEffectImpl<BoostOpponentsEff
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Set<UUID> opponents = game.getOpponents(source.getControllerId());
|
Set<UUID> opponents = game.getOpponents(source.getControllerId());
|
||||||
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, game)) {
|
for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
if (!this.affectedObjectsSet || objects.contains(perm.getId())) {
|
if (!this.affectedObjectsSet || objects.contains(perm.getId())) {
|
||||||
if (opponents.contains(perm.getControllerId())) {
|
if (opponents.contains(perm.getControllerId())) {
|
||||||
perm.addPower(power);
|
perm.addPower(power);
|
||||||
|
|
Loading…
Reference in a new issue