fix more calls to respect range of influence

This commit is contained in:
xenohedron 2024-06-02 03:19:40 -04:00
parent 3497facd6b
commit cce9547efb
7 changed files with 28 additions and 53 deletions

View file

@ -12,6 +12,7 @@ import mage.abilities.mana.WhiteManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -72,7 +73,7 @@ public final class Conversion extends CardImpl {
@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
for (Permanent land : game.getBattlefield().getAllActivePermanents(CardType.LAND, game)) {
for (Permanent land : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_LAND, source.getControllerId(), source, game)) {
switch (layer) {
case TypeChangingEffects_4:
if (land.hasSubtype(SubType.MOUNTAIN, game)) {

View file

@ -12,6 +12,7 @@ import mage.abilities.mana.WhiteManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.List;
@ -68,7 +69,7 @@ public final class Glaciers extends CardImpl {
@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
for (Permanent land : game.getBattlefield().getAllActivePermanents(CardType.LAND, game)) {
for (Permanent land : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_LAND, source.getControllerId(), source, game)) {
switch (layer) {
case TypeChangingEffects_4:
// the land mana ability is intrinsic, so apply at this layer not layer 6

View file

@ -21,6 +21,7 @@ import mage.choices.ChoiceBasicLandType;
import mage.choices.ChoiceImpl;
import mage.constants.*;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -77,7 +78,7 @@ class IllusionaryTerrainEffect extends ContinuousEffectImpl {
Player controller = game.getPlayer(source.getControllerId());
SubType firstChoice = SubType.byDescription((String) game.getState().getValue(source.getSourceId().toString() + "firstChoice"));
SubType secondChoice = SubType.byDescription((String) game.getState().getValue(source.getSourceId().toString() + "secondChoice"));
List<Permanent> lands = game.getBattlefield().getAllActivePermanents(CardType.LAND, game);
List<Permanent> lands = game.getBattlefield().getActivePermanents(StaticFilters.FILTER_LAND, source.getControllerId(), source, game);
if (controller != null
&& firstChoice != null
&& secondChoice != null) {

View file

@ -12,6 +12,7 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
@ -57,17 +58,15 @@ class InsurrectionEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
boolean result = false;
ContinuousEffect gainControl = new GainControlTargetEffect(Duration.EndOfTurn);
ContinuousEffect gainHaste = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
for (Permanent creature : game.getBattlefield().getAllActivePermanents(CardType.CREATURE, game)) {
for (Permanent creature : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), source, game)) {
creature.untap(game);
gainControl.setTargetPointer(new FixedTarget(creature.getId(), game));
gainHaste.setTargetPointer(new FixedTarget(creature.getId(), game));
game.addEffect(gainControl, source);
game.addEffect(gainHaste, source);
result = true;
}
return result;
return true;
}
}

View file

@ -12,6 +12,7 @@ import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -82,7 +83,7 @@ class KudzuEffect extends OneShotEffect {
if (game.getState().getZone(enchantedLand.getId()) == Zone.BATTLEFIELD) { // if 2 or more Kudzu's were on a land
enchantedLand.destroy(source, game, false);
}
if (!game.getBattlefield().getAllActivePermanents(CardType.LAND, game).isEmpty()) { //lands are available on the battlefield
if (game.getBattlefield().contains(StaticFilters.FILTER_LAND, source, game, 1)) { //lands are available on the battlefield
Target target = new TargetLandPermanent();
target.withNotTarget(true); //not a target, it is chosen
Card kudzuCard = game.getCard(source.getSourceId());

View file

@ -1,26 +1,26 @@
package mage.cards.k;
import java.util.Set;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.common.SagaAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
import mage.abilities.effects.common.DamageAllEffect;
import mage.abilities.effects.common.DamagePlayersEffect;
import mage.abilities.effects.common.ExileSagaAndReturnTransformedEffect;
import mage.abilities.keyword.TransformAbility;
import mage.constants.*;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.counters.CounterType;
import mage.filter.common.FilterPlaneswalkerPermanent;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.stack.Spell;
import mage.players.Player;
import java.util.UUID;
/**
*
@ -28,6 +28,11 @@ import mage.players.Player;
*/
public final class KumanoFacesKakkazan extends CardImpl {
private static final FilterPlaneswalkerPermanent filter = new FilterPlaneswalkerPermanent();
static {
filter.add(TargetController.OPPONENT.getControllerPredicate());
}
public KumanoFacesKakkazan(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{R}");
@ -38,7 +43,10 @@ public final class KumanoFacesKakkazan extends CardImpl {
SagaAbility sagaAbility = new SagaAbility(this);
// I Kumano Faces Kakkazan deals 1 damage to each opponent and each planeswalker they control.
sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_I, new KumanoFacesKakkazanDamageEffect());
sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_I,
new DamagePlayersEffect(1, TargetController.OPPONENT),
new DamageAllEffect(1, filter).setText("and each planeswalker they control")
);
// II When you cast your next creature spell this turn, that creature enters the battlefield with an additional +1/+1 counter on it.
sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_II, new CreateDelayedTriggeredAbilityEffect(new KumanoFacesKakkazanTriggeredAbility()));
@ -60,43 +68,6 @@ public final class KumanoFacesKakkazan extends CardImpl {
}
}
class KumanoFacesKakkazanDamageEffect extends OneShotEffect {
KumanoFacesKakkazanDamageEffect() {
super(Outcome.Damage);
this.staticText = "{this} deals 1 damage to each opponent and each planeswalker they control";
}
private KumanoFacesKakkazanDamageEffect(final KumanoFacesKakkazanDamageEffect effect) {
super(effect);
}
@Override
public KumanoFacesKakkazanDamageEffect copy() {
return new KumanoFacesKakkazanDamageEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Set<UUID> opponents = game.getOpponents(source.getControllerId());
if (opponents.isEmpty()) {
return false;
}
for (UUID opponentId : opponents) {
Player opponent = game.getPlayer(opponentId);
if (opponent != null) {
opponent.damage(1, source, game);
}
}
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(CardType.PLANESWALKER, game)) {
if (opponents.contains(permanent.getControllerId())) {
permanent.damage(1, source, game);
}
}
return true;
}
}
class KumanoFacesKakkazanTriggeredAbility extends DelayedTriggeredAbility {
KumanoFacesKakkazanTriggeredAbility() {

View file

@ -14,6 +14,7 @@ import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.Filter;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -87,7 +88,7 @@ class SteamVinesEffect extends OneShotEffect {
landsController.damage(1, source.getSourceId(), source, game);
}
}
if (!game.getBattlefield().getAllActivePermanents(CardType.LAND, game).isEmpty()) { //lands are available on the battlefield
if (game.getBattlefield().contains(StaticFilters.FILTER_LAND, source, game, 1)) { //lands are available on the battlefield
Target target = new TargetLandPermanent();
target.withNotTarget(true); //not a target, it is chosen
Card steamVinesCard = game.getCard(source.getSourceId());