Misc cleanup (#7009)

This commit is contained in:
tool4ever
2025-02-13 15:51:19 +01:00
committed by GitHub
parent 53fca12a57
commit 11913085ef
42 changed files with 69 additions and 102 deletions

View File

@@ -705,7 +705,7 @@ public class GameAction {
StaticAbility stAb = eff.addStaticAbility(AbilityUtils.getSVar(cause, cause.getParam("StaticEffect")));
stAb.setActiveZone(EnumSet.of(ZoneType.Command));
// needed for ETB lookahead like Bronzehide Lion
stAb.putParam("AffectedZone", "Battlefield,Hand,Graveyard,Exile,Stack,Library,Command");
stAb.putParam("AffectedZone", "All");
SpellAbilityEffect.addForgetOnMovedTrigger(eff, "Battlefield");
game.getAction().moveToCommand(eff, cause);
}

View File

@@ -107,10 +107,8 @@ public class ChangeZoneAllEffect extends SpellAbilityEffect {
final Zone originZone = game.getZoneOf(c);
// Fizzle spells so that they are removed from stack (e.g. Summary Dismissal)
if (sa.hasParam("Fizzle")) {
if (originZone.is(ZoneType.Exile) || originZone.is(ZoneType.Hand) || originZone.is(ZoneType.Stack)) {
game.getStack().remove(c);
}
if (originZone.is(ZoneType.Stack)) {
game.getStack().remove(c);
}
if (remLKI) {

View File

@@ -558,22 +558,15 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
continue;
}
if (originZone.is(ZoneType.Stack)) {
game.getStack().remove(gameCard);
}
Card movedCard = null;
Map<AbilityKey, Object> moveParams = AbilityKey.newMap();
AbilityKey.addCardZoneTableParams(moveParams, triggerList);
if (destination.equals(ZoneType.Library)) {
// If a card is moved to library from the stack, remove its spells from the stack
if (sa.hasParam("Fizzle")) {
// TODO only AI still targets as card, try to remove it
if (gameCard.isInZone(ZoneType.Exile) || gameCard.isInZone(ZoneType.Hand) || gameCard.isInZone(ZoneType.Stack)) {
// This only fizzles spells, not anything else.
game.getStack().remove(gameCard);
}
}
movedCard = game.getAction().moveToLibrary(gameCard, libraryPosition, sa, moveParams);
} else if (destination.equals(ZoneType.Battlefield)) {
if (destination.equals(ZoneType.Battlefield)) {
moveParams.put(AbilityKey.SimultaneousETB, tgtCards);
if (sa.isReplacementAbility()) {
ReplacementEffect re = sa.getReplacementEffect();
@@ -725,15 +718,6 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
commandCards.add(movedCard); //add to list to reveal the commandzone cards
}
// If a card is Exiled from the stack, remove its spells from the stack
if (sa.hasParam("Fizzle")) {
if (gameCard.isInZone(ZoneType.Exile) || gameCard.isInZone(ZoneType.Hand)
|| gameCard.isInZone(ZoneType.Stack) || gameCard.isInZone(ZoneType.Command)) {
// This only fizzles spells, not anything else.
game.getStack().remove(gameCard);
}
}
if (sa.hasParam("WithCountersType")) {
CounterType cType = CounterType.getType(sa.getParam("WithCountersType"));
int cAmount = AbilityUtils.calculateAmount(hostCard, sa.getParamOrDefault("WithCountersAmount", "1"), sa);

View File

@@ -32,6 +32,7 @@ public class ManaEffect extends SpellAbilityEffect {
@Override
public void resolve(SpellAbility sa) {
final Card card = sa.getHostCard();
final Game game = card.getGame();
final AbilityManaPart abMana = sa.getManaPart();
final List<Player> tgtPlayers = getDefinedPlayersOrTargeted(sa);
final Player activator = sa.getActivatingPlayer();
@@ -39,10 +40,7 @@ public class ManaEffect extends SpellAbilityEffect {
// Spells are not undoable
sa.setUndoable(sa.isAbility() && sa.isUndoable() && tgtPlayers.size() < 2 && !sa.hasParam("ActivationLimit"));
final boolean optional = sa.hasParam("Optional");
final Game game = activator.getGame();
if (optional && !activator.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantAddMana"), null)) {
if (sa.hasParam("Optional") && !activator.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantAddMana"), null)) {
return;
}

View File

@@ -344,10 +344,8 @@ public class StaticAbility extends CardTraitBase implements IIdentifiable, Clone
if (zone == null || !this.validHostZones.contains(zone.getZoneType())) {
return false;
}
} else {
if (!getHostCard().isInPlay()) { // default
return false;
}
} else if (!getHostCard().isInPlay()) { // default
return false;
}
}