Find that many methods are always passed null for their params and so start removeing those params since they are getting in the way of my intended refactor.

This commit is contained in:
Ryan1729
2019-09-08 21:34:41 -06:00
parent 25031e5d4e
commit 2f45d0050b
3 changed files with 25 additions and 33 deletions

View File

@@ -79,7 +79,7 @@ public class GameAction {
return changeZone(zoneFrom, zoneTo, c, position, cause, null);
}
public Card changeZone(final Zone zoneFrom, Zone zoneTo, final Card c, Integer position, SpellAbility cause, Map<String, Object> params) {
private Card changeZone(final Zone zoneFrom, Zone zoneTo, final Card c, Integer position, SpellAbility cause, Map<String, Object> params) {
if (c.isCopiedSpell() || (c.isImmutable() && zoneTo.is(ZoneType.Exile))) {
// Remove Effect from command immediately, this is essential when some replacement
// effects happen during the resolving of a spellability ("the next time ..." effect)
@@ -529,17 +529,17 @@ public class GameAction {
return moveTo(zoneTo, c, cause, null);
}
public final Card moveTo(final Zone zoneTo, Card c, SpellAbility cause, Map<String, Object> params) {
// FThreads.assertExecutedByEdt(false); // This code must never be executed from EDT,
// use FThreads.invokeInNewThread to run code in a pooled thread
return moveTo(zoneTo, c, null, cause, params);
}
public final Card moveTo(final Zone zoneTo, Card c, Integer position, SpellAbility cause) {
return moveTo(zoneTo, c, position, cause, null);
}
public final Card moveTo(final Zone zoneTo, Card c, Integer position, SpellAbility cause, Map<String, Object> params) {
private Card moveTo(final Zone zoneTo, Card c, SpellAbility cause, Map<String, Object> params) {
// FThreads.assertExecutedByEdt(false); // This code must never be executed from EDT,
// use FThreads.invokeInNewThread to run code in a pooled thread
return moveTo(zoneTo, c, null, cause, params);
}
private Card moveTo(final Zone zoneTo, Card c, Integer position, SpellAbility cause, Map<String, Object> params) {
// Ideally move to should never be called without a prevZone
// Remove card from Current Zone, if it has one
final Zone zoneFrom = game.getZoneOf(c);
@@ -723,30 +723,22 @@ public class GameAction {
}
public final Card moveTo(final ZoneType name, final Card c, SpellAbility cause) {
return moveTo(name, c, cause, null);
}
public final Card moveTo(final ZoneType name, final Card c, SpellAbility cause, Map<String, Object> params) {
return moveTo(name, c, 0, cause, params);
return moveTo(name, c, 0, cause);
}
public final Card moveTo(final ZoneType name, final Card c, final int libPosition, SpellAbility cause) {
return moveTo(name, c, libPosition, cause, null);
}
public final Card moveTo(final ZoneType name, final Card c, final int libPosition, SpellAbility cause, Map<String, Object> params) {
// Call specific functions to set PlayerZone, then move onto moveTo
switch(name) {
case Hand: return moveToHand(c, cause, params);
case Library: return moveToLibrary(c, libPosition, cause, params);
case Battlefield: return moveToPlay(c, cause, params);
case Graveyard: return moveToGraveyard(c, cause, params);
case Exile: return exile(c, cause, params);
case Stack: return moveToStack(c, cause, params);
case PlanarDeck: return moveToVariantDeck(c, ZoneType.PlanarDeck, libPosition, cause, params);
case SchemeDeck: return moveToVariantDeck(c, ZoneType.SchemeDeck, libPosition, cause, params);
case Hand: return moveToHand(c, cause, null);
case Library: return moveToLibrary(c, libPosition, cause, null);
case Battlefield: return moveToPlay(c, cause, null);
case Graveyard: return moveToGraveyard(c, cause, null);
case Exile: return exile(c, cause, null);
case Stack: return moveToStack(c, cause, null);
case PlanarDeck: return moveToVariantDeck(c, ZoneType.PlanarDeck, libPosition, cause, null);
case SchemeDeck: return moveToVariantDeck(c, ZoneType.SchemeDeck, libPosition, cause, null);
default: // sideboard will also get there
return moveTo(c.getOwner().getZone(name), c, cause, params);
return moveTo(c.getOwner().getZone(name), c, cause, null);
}
}

View File

@@ -534,7 +534,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
}
movedCard = game.getAction().moveTo(
tgtC.getController().getZone(destination), tgtC, sa, null);
tgtC.getController().getZone(destination), tgtC, sa);
if (sa.hasParam("Unearth")) {
movedCard.setUnearthed(true);
movedCard.addChangedCardKeywords(Lists.newArrayList("Haste"), null, false, false,
@@ -591,7 +591,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
}
tgtC.setExiledWith(host);
}
movedCard = game.getAction().moveTo(destination, tgtC, sa, null);
movedCard = game.getAction().moveTo(destination, tgtC, sa);
// If a card is Exiled from the stack, remove its spells from the stack
if (sa.hasParam("Fizzle")) {
if (tgtC.isInZone(ZoneType.Exile) || tgtC.isInZone(ZoneType.Hand)
@@ -1096,7 +1096,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
c.addFaceupCommand(unanimate);
}
}
movedCard = game.getAction().moveTo(c.getController().getZone(destination), c, sa, null);
movedCard = game.getAction().moveTo(c.getController().getZone(destination), c, sa);
if (sa.hasParam("Tapped")) {
movedCard.setTapped(true);
}
@@ -1121,7 +1121,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
}
}
else {
movedCard = game.getAction().moveTo(destination, c, sa, null);
movedCard = game.getAction().moveTo(destination, c, sa);
}
movedCards.add(movedCard);

View File

@@ -136,7 +136,7 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
// on the stack zone, move there
if (ability.isSpell()) {
if (!source.isCopiedSpell() && !source.isInZone(ZoneType.Stack)) {
ability.setHostCard(game.getAction().moveToStack(source, ability, null));
ability.setHostCard(game.getAction().moveToStack(source, ability));
}
}