mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
remove more null literals where overloads that pass null exist
This commit is contained in:
@@ -612,11 +612,8 @@ public class GameAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final Card moveToStack(final Card c, SpellAbility cause) {
|
public final Card moveToStack(final Card c, SpellAbility cause) {
|
||||||
return moveToStack(c, cause, null);
|
|
||||||
}
|
|
||||||
public final Card moveToStack(final Card c, SpellAbility cause, Map<String, Object> params) {
|
|
||||||
final Zone stack = game.getStackZone();
|
final Zone stack = game.getStackZone();
|
||||||
return moveTo(stack, c, cause, params);
|
return moveTo(stack, c, cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Card moveToGraveyard(final Card c, SpellAbility cause) {
|
public final Card moveToGraveyard(final Card c, SpellAbility cause) {
|
||||||
@@ -638,12 +635,8 @@ public class GameAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final Card moveToPlay(final Card c, SpellAbility cause) {
|
public final Card moveToPlay(final Card c, SpellAbility cause) {
|
||||||
return moveToPlay(c, cause, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final Card moveToPlay(final Card c, SpellAbility cause, Map<String, Object> params) {
|
|
||||||
final PlayerZone play = c.getController().getZone(ZoneType.Battlefield);
|
final PlayerZone play = c.getController().getZone(ZoneType.Battlefield);
|
||||||
return moveTo(play, c, cause, params);
|
return moveTo(play, c, cause, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Card moveToPlay(final Card c, final Player p, SpellAbility cause) {
|
public final Card moveToPlay(final Card c, final Player p, SpellAbility cause) {
|
||||||
@@ -685,15 +678,11 @@ public class GameAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final Card moveToVariantDeck(Card c, ZoneType zone, int deckPosition, SpellAbility cause) {
|
public final Card moveToVariantDeck(Card c, ZoneType zone, int deckPosition, SpellAbility cause) {
|
||||||
return moveToVariantDeck(c, zone, deckPosition, cause, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final Card moveToVariantDeck(Card c, ZoneType zone, int deckPosition, SpellAbility cause, Map<String, Object> params) {
|
|
||||||
final PlayerZone deck = c.getOwner().getZone(zone);
|
final PlayerZone deck = c.getOwner().getZone(zone);
|
||||||
if (deckPosition == -1 || deckPosition > deck.size()) {
|
if (deckPosition == -1 || deckPosition > deck.size()) {
|
||||||
deckPosition = deck.size();
|
deckPosition = deck.size();
|
||||||
}
|
}
|
||||||
return changeZone(game.getZoneOf(c), deck, c, deckPosition, cause, params);
|
return changeZone(game.getZoneOf(c), deck, c, deckPosition, cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Card exile(final Card c, SpellAbility cause) {
|
public final Card exile(final Card c, SpellAbility cause) {
|
||||||
@@ -729,16 +718,16 @@ public class GameAction {
|
|||||||
public final Card moveTo(final ZoneType name, final Card c, final int libPosition, SpellAbility cause) {
|
public final Card moveTo(final ZoneType name, final Card c, final int libPosition, SpellAbility cause) {
|
||||||
// Call specific functions to set PlayerZone, then move onto moveTo
|
// Call specific functions to set PlayerZone, then move onto moveTo
|
||||||
switch(name) {
|
switch(name) {
|
||||||
case Hand: return moveToHand(c, cause, null);
|
case Hand: return moveToHand(c, cause);
|
||||||
case Library: return moveToLibrary(c, libPosition, cause, null);
|
case Library: return moveToLibrary(c, libPosition, cause);
|
||||||
case Battlefield: return moveToPlay(c, cause, null);
|
case Battlefield: return moveToPlay(c, cause);
|
||||||
case Graveyard: return moveToGraveyard(c, cause, null);
|
case Graveyard: return moveToGraveyard(c, cause);
|
||||||
case Exile: return exile(c, cause, null);
|
case Exile: return exile(c, cause);
|
||||||
case Stack: return moveToStack(c, cause, null);
|
case Stack: return moveToStack(c, cause);
|
||||||
case PlanarDeck: return moveToVariantDeck(c, ZoneType.PlanarDeck, libPosition, cause, null);
|
case PlanarDeck: return moveToVariantDeck(c, ZoneType.PlanarDeck, libPosition, cause);
|
||||||
case SchemeDeck: return moveToVariantDeck(c, ZoneType.SchemeDeck, libPosition, cause, null);
|
case SchemeDeck: return moveToVariantDeck(c, ZoneType.SchemeDeck, libPosition, cause);
|
||||||
default: // sideboard will also get there
|
default: // sideboard will also get there
|
||||||
return moveTo(c.getOwner().getZone(name), c, cause, null);
|
return moveTo(c.getOwner().getZone(name), c, cause);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,15 @@ public enum AbilityKey {
|
|||||||
Attackers("Attackers"),
|
Attackers("Attackers"),
|
||||||
AttackingPlayer("AttackingPlayer"),
|
AttackingPlayer("AttackingPlayer"),
|
||||||
AttackedTarget("AttackedTarget"),
|
AttackedTarget("AttackedTarget"),
|
||||||
Player("Player");
|
Card("Card"),
|
||||||
|
Cause("Cause"),
|
||||||
|
Destination("Destination"),
|
||||||
|
Player("Player"),
|
||||||
|
IndividualCostPaymentInstance("IndividualCostPaymentInstance"),
|
||||||
|
Origin("Origin"),
|
||||||
|
SpellAbilityStackInstance("SpellAbilityStackInstance")
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
private String key;
|
private String key;
|
||||||
|
|
||||||
|
|||||||
@@ -470,7 +470,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
movedCard = game.getAction().moveToLibrary(tgtC, libraryPosition, sa, null);
|
movedCard = game.getAction().moveToLibrary(tgtC, libraryPosition, sa);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (destination.equals(ZoneType.Battlefield)) {
|
if (destination.equals(ZoneType.Battlefield)) {
|
||||||
@@ -967,7 +967,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
|||||||
Card movedCard = null;
|
Card movedCard = null;
|
||||||
final Zone originZone = game.getZoneOf(c);
|
final Zone originZone = game.getZoneOf(c);
|
||||||
if (destination.equals(ZoneType.Library)) {
|
if (destination.equals(ZoneType.Library)) {
|
||||||
movedCard = game.getAction().moveToLibrary(c, libraryPos, sa, null);
|
movedCard = game.getAction().moveToLibrary(c, libraryPos, sa);
|
||||||
}
|
}
|
||||||
else if (destination.equals(ZoneType.Battlefield)) {
|
else if (destination.equals(ZoneType.Battlefield)) {
|
||||||
if (sa.hasParam("Tapped")) {
|
if (sa.hasParam("Tapped")) {
|
||||||
@@ -1108,7 +1108,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
|||||||
movedCard.setTimestamp(ts);
|
movedCard.setTimestamp(ts);
|
||||||
}
|
}
|
||||||
else if (destination.equals(ZoneType.Exile)) {
|
else if (destination.equals(ZoneType.Exile)) {
|
||||||
movedCard = game.getAction().exile(c, sa, null);
|
movedCard = game.getAction().exile(c, sa);
|
||||||
if (!c.isToken()) {
|
if (!c.isToken()) {
|
||||||
Card host = sa.getOriginalHost();
|
Card host = sa.getOriginalHost();
|
||||||
if (host == null) {
|
if (host == null) {
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ public class CopyPermanentEffect extends SpellAbilityEffect {
|
|||||||
|
|
||||||
// Temporarily register triggers of an object created with CopyPermanent
|
// Temporarily register triggers of an object created with CopyPermanent
|
||||||
//game.getTriggerHandler().registerActiveTrigger(copy, false);
|
//game.getTriggerHandler().registerActiveTrigger(copy, false);
|
||||||
final Card copyInPlay = game.getAction().moveToPlay(t, sa, null);
|
final Card copyInPlay = game.getAction().moveToPlay(t, sa);
|
||||||
|
|
||||||
if (copyInPlay.getZone() != null) {
|
if (copyInPlay.getZone() != null) {
|
||||||
triggerList.put(ZoneType.None, copyInPlay.getZone().getZoneType(), copyInPlay);
|
triggerList.put(ZoneType.None, copyInPlay.getZone().getZoneType(), copyInPlay);
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ public class CostAdjustment {
|
|||||||
cardsToDelveOut.add(c);
|
cardsToDelveOut.add(c);
|
||||||
} else if (!test) {
|
} else if (!test) {
|
||||||
sa.getHostCard().addDelved(c);
|
sa.getHostCard().addDelved(c);
|
||||||
final Card d = game.getAction().exile(c, null, null);
|
final Card d = game.getAction().exile(c, null);
|
||||||
table.put(ZoneType.Graveyard, d.getZone().getZoneType(), d);
|
table.put(ZoneType.Graveyard, d.getZone().getZoneType(), d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public abstract class AbstractMulligan {
|
|||||||
CardCollection toMulligan = new CardCollection(player.getCardsIn(ZoneType.Hand));
|
CardCollection toMulligan = new CardCollection(player.getCardsIn(ZoneType.Hand));
|
||||||
revealPreMulligan(toMulligan);
|
revealPreMulligan(toMulligan);
|
||||||
for (final Card c : toMulligan) {
|
for (final Card c : toMulligan) {
|
||||||
player.getGame().getAction().moveToLibrary(c, null, null);
|
player.getGame().getAction().moveToLibrary(c, null);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Thread.sleep(100); //delay for a tiny bit to give UI a chance catch up
|
Thread.sleep(100); //delay for a tiny bit to give UI a chance catch up
|
||||||
|
|||||||
@@ -1308,7 +1308,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
|||||||
|
|
||||||
if (toGrave != null) {
|
if (toGrave != null) {
|
||||||
for(Card c : toGrave) {
|
for(Card c : toGrave) {
|
||||||
getGame().getAction().moveToGraveyard(c, cause, null);
|
getGame().getAction().moveToGraveyard(c, cause);
|
||||||
numToGrave++;
|
numToGrave++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1316,7 +1316,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
|||||||
if (toTop != null) {
|
if (toTop != null) {
|
||||||
Collections.reverse(toTop); // the last card in list will become topmost in library, have to revert thus.
|
Collections.reverse(toTop); // the last card in list will become topmost in library, have to revert thus.
|
||||||
for(Card c : toTop) {
|
for(Card c : toTop) {
|
||||||
getGame().getAction().moveToLibrary(c, cause, null);
|
getGame().getAction().moveToLibrary(c, cause);
|
||||||
numToTop++;
|
numToTop++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1399,7 +1399,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c = game.getAction().moveToHand(c, null, null);
|
c = game.getAction().moveToHand(c, null);
|
||||||
drawn.add(c);
|
drawn.add(c);
|
||||||
|
|
||||||
if (topCardRevealed) {
|
if (topCardRevealed) {
|
||||||
@@ -1574,16 +1574,16 @@ public class Player extends GameEntity implements Comparable<Player> {
|
|||||||
sb.append(this).append(" discards ").append(c);
|
sb.append(this).append(" discards ").append(c);
|
||||||
final Card newCard;
|
final Card newCard;
|
||||||
if (discardToTopOfLibrary) {
|
if (discardToTopOfLibrary) {
|
||||||
newCard = game.getAction().moveToLibrary(c, 0, sa, null);
|
newCard = game.getAction().moveToLibrary(c, 0, sa);
|
||||||
sb.append(" to the library");
|
sb.append(" to the library");
|
||||||
// Play the Discard sound
|
// Play the Discard sound
|
||||||
}
|
}
|
||||||
else if (discardMadness) {
|
else if (discardMadness) {
|
||||||
newCard = game.getAction().exile(c, sa, null);
|
newCard = game.getAction().exile(c, sa);
|
||||||
sb.append(" with Madness");
|
sb.append(" with Madness");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
newCard = game.getAction().moveToGraveyard(c, sa, null);
|
newCard = game.getAction().moveToGraveyard(c, sa);
|
||||||
// Play the Discard sound
|
// Play the Discard sound
|
||||||
}
|
}
|
||||||
if (table != null) {
|
if (table != null) {
|
||||||
|
|||||||
@@ -2433,9 +2433,9 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
|||||||
TextUtil.concatWithSpace("Should", forgeCard.toString(), "be added to the top or to the bottom of the library?"), true, Arrays.asList("Top", "Bottom"));
|
TextUtil.concatWithSpace("Should", forgeCard.toString(), "be added to the top or to the bottom of the library?"), true, Arrays.asList("Top", "Bottom"));
|
||||||
}
|
}
|
||||||
if (lastTopOfTheLibrary) {
|
if (lastTopOfTheLibrary) {
|
||||||
game.getAction().moveToLibrary(forgeCard, null, null);
|
game.getAction().moveToLibrary(forgeCard, null);
|
||||||
} else {
|
} else {
|
||||||
game.getAction().moveToBottomOfLibrary(forgeCard, null, null);
|
game.getAction().moveToBottomOfLibrary(forgeCard, null);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
game.getAction().moveTo(targetZone, forgeCard, null);
|
game.getAction().moveTo(targetZone, forgeCard, null);
|
||||||
|
|||||||
Reference in New Issue
Block a user