The bigger looking ones from more indentation

This commit is contained in:
tool4EvEr
2022-11-25 21:28:59 +01:00
parent 0146e0c72e
commit 9fabf6086c
20 changed files with 912 additions and 941 deletions

View File

@@ -12,7 +12,6 @@ import forge.game.card.Card;
import forge.game.card.CardLists;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.spellability.TargetRestrictions;
import forge.game.zone.ZoneType;
import forge.util.Lang;
import forge.util.Localizer;
@@ -36,12 +35,14 @@ public class ActivateAbilityEffect extends SpellAbilityEffect {
@Override
public void resolve(SpellAbility sa) {
final TargetRestrictions tgt = sa.getTargetRestrictions();
final boolean isManaAb = sa.hasParam("ManaAbility");
// TODO: improve ai and fix corner cases
for (final Player p : getTargetPlayers(sa)) {
if ((tgt == null) || p.canBeTargetedBy(sa)) {
if (!p.isInGame()) {
continue;
}
List<Card> list = CardLists.getType(p.getCardsIn(ZoneType.Battlefield), sa.getParamOrDefault("Type", "Card"));
for (Card c : list) {
List<SpellAbility> possibleAb = Lists.newArrayList(c.getAllPossibleAbilities(p, true));
@@ -57,6 +58,5 @@ public class ActivateAbilityEffect extends SpellAbilityEffect {
}
}
}
}
}

View File

@@ -1,7 +1,5 @@
package forge.game.ability.effects;
import java.util.List;
import forge.game.Game;
import forge.game.ability.AbilityFactory;
import forge.game.ability.AbilityKey;
@@ -15,6 +13,7 @@ import forge.game.trigger.Trigger;
import forge.game.trigger.TriggerHandler;
import forge.game.trigger.TriggerType;
import forge.game.zone.ZoneType;
import forge.util.Lang;
import forge.util.Localizer;
public class AddTurnEffect extends SpellAbilityEffect {
@@ -24,11 +23,7 @@ public class AddTurnEffect extends SpellAbilityEffect {
final StringBuilder sb = new StringBuilder();
final int numTurns = AbilityUtils.calculateAmount(sa.getHostCard(), sa.getParam("NumTurns"), sa);
List<Player> tgtPlayers = getTargetPlayers(sa);
for (final Player player : tgtPlayers) {
sb.append(player).append(" ");
}
sb.append(Lang.joinHomogenous(getTargetPlayers(sa)));
sb.append("takes ");
sb.append(numTurns > 1 ? numTurns : "an");
@@ -45,10 +40,10 @@ public class AddTurnEffect extends SpellAbilityEffect {
public void resolve(SpellAbility sa) {
final int numTurns = AbilityUtils.calculateAmount(sa.getHostCard(), sa.getParam("NumTurns"), sa);
List<Player> tgtPlayers = getTargetPlayers(sa);
for (final Player p : tgtPlayers) {
if (!sa.usesTargeting() || p.canBeTargetedBy(sa)) {
for (final Player p : getTargetPlayers(sa)) {
if (!p.isInGame()) {
continue;
}
for (int i = 0; i < numTurns; i++) {
ExtraTurn extra = p.getGame().getPhaseHandler().addExtraTurn(p);
if (sa.hasParam("ExtraTurnDelayedTrigger")) {
@@ -71,7 +66,6 @@ public class AddTurnEffect extends SpellAbilityEffect {
}
}
}
}
public static void createCantSetSchemesInMotionEffect(SpellAbility sa) {
final Card hostCard = sa.getHostCard();

View File

@@ -18,7 +18,6 @@ import forge.game.event.GameEventCombatChanged;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.spellability.SpellAbilityStackInstance;
import forge.game.spellability.TargetRestrictions;
import forge.util.CardTranslation;
import forge.util.Localizer;
import forge.util.collect.FCollection;
@@ -42,7 +41,6 @@ public class ChangeCombatantsEffect extends SpellAbilityEffect {
boolean isCombatChanged = false;
final Player activator = sa.getActivatingPlayer();
final Game game = activator.getGame();
final TargetRestrictions tgt = sa.getTargetRestrictions();
// TODO: may expand this effect for defined blocker (False Orders, General Jarkeld, Sorrow's Path, Ydwen Efreet)
for (final Card c : getTargetCards(sa)) {
String cardString = CardTranslation.getTranslatedName(c.getName()) + " (" + c.getId() + ")";
@@ -51,7 +49,7 @@ public class ChangeCombatantsEffect extends SpellAbilityEffect {
Localizer.getInstance().getMessage("lblChangeCombatantOption", cardString), null)) {
continue;
}
if ((tgt == null) || c.canBeTargetedBy(sa)) {
final Combat combat = game.getCombat();
final GameEntity originalDefender = combat.getDefenderByAttacker(c);
final FCollection<GameEntity> defs = new FCollection<>();
@@ -61,7 +59,7 @@ public class ChangeCombatantsEffect extends SpellAbilityEffect {
Map<String, Object> params = Maps.newHashMap();
params.put("Attacker", c);
final GameEntity defender = sa.getActivatingPlayer().getController().chooseSingleEntityForEffect(defs, sa, title, false, params);
final GameEntity defender = activator.getController().chooseSingleEntityForEffect(defs, sa, title, false, params);
if (originalDefender != null && !originalDefender.equals(defender)) {
AttackingBand ab = combat.getBandOfAttacker(c);
if (ab != null) {
@@ -84,7 +82,6 @@ public class ChangeCombatantsEffect extends SpellAbilityEffect {
isCombatChanged = true;
}
}
}
if (isCombatChanged) {
game.updateCombatForView();

View File

@@ -19,7 +19,6 @@ import forge.game.card.CardCollection;
import forge.game.card.CardLists;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.spellability.TargetRestrictions;
import forge.util.Aggregates;
import forge.util.Localizer;
@@ -41,9 +40,6 @@ public class ChooseCardNameEffect extends SpellAbilityEffect {
public void resolve(SpellAbility sa) {
final Card host = sa.getHostCard();
final TargetRestrictions tgt = sa.getTargetRestrictions();
final List<Player> tgtPlayers = getTargetPlayers(sa);
String valid = "Card";
String validDesc = null;
String message = null;
@@ -68,8 +64,10 @@ public class ChooseCardNameEffect extends SpellAbilityEffect {
}
}
for (final Player p : tgtPlayers) {
if ((tgt == null) || p.canBeTargetedBy(sa)) {
for (final Player p : getTargetPlayers(sa)) {
if (!p.isInGame()) {
continue;
}
String chosen = "";
//This section was used for Momir Avatar, which no longer uses it - commented out 7/28/2021
//if (randomChoice) {
@@ -166,6 +164,5 @@ public class ChooseCardNameEffect extends SpellAbilityEffect {
}
}
}
}
}

View File

@@ -12,7 +12,6 @@ import forge.game.ability.SpellAbilityEffect;
import forge.game.card.Card;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.spellability.TargetRestrictions;
import forge.util.Localizer;
import forge.util.MyRandom;
@@ -46,12 +45,12 @@ public class ChooseNumberEffect extends SpellAbilityEffect {
final String sMax = sa.getParamOrDefault("Max", "99");
final int max = AbilityUtils.calculateAmount(card, sMax, sa);
final List<Player> tgtPlayers = getTargetPlayers(sa);
final TargetRestrictions tgt = sa.getTargetRestrictions();
final Map<Player, Integer> chooseMap = Maps.newHashMap();
for (final Player p : tgtPlayers) {
if ((tgt == null) || p.canBeTargetedBy(sa)) {
for (final Player p : getTargetPlayers(sa)) {
if (!p.isInGame()) {
continue;
}
int chosen;
if (random) {
chosen = MyRandom.getRandom().nextInt((max - min) + 1) + min;
@@ -76,7 +75,6 @@ public class ChooseNumberEffect extends SpellAbilityEffect {
p.getGame().getAction().notifyOfValue(sa, card, Localizer.getInstance().getMessage("lblPlayerPickedChosen", p.getName(), chosen), p);
}
}
}
if (secretlyChoose) {
StringBuilder sb = new StringBuilder();
List<Player> highestNum = Lists.newArrayList();

View File

@@ -1,14 +1,12 @@
package forge.game.ability.effects;
import java.util.List;
import forge.game.ability.AbilityUtils;
import forge.game.ability.SpellAbilityEffect;
import forge.game.card.Card;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.spellability.TargetRestrictions;
import forge.util.Aggregates;
import forge.util.Lang;
import forge.util.Localizer;
import forge.util.collect.FCollectionView;
@@ -18,9 +16,8 @@ public class ChoosePlayerEffect extends SpellAbilityEffect {
protected String getStackDescription(SpellAbility sa) {
final StringBuilder sb = new StringBuilder();
for (final Player p : getTargetPlayers(sa)) {
sb.append(p).append(" ");
}
sb.append(Lang.joinHomogenous(getTargetPlayers(sa)));
sb.append("chooses a player.");
return sb.toString();
@@ -30,18 +27,16 @@ public class ChoosePlayerEffect extends SpellAbilityEffect {
public void resolve(SpellAbility sa) {
final Card card = sa.getHostCard();
final List<Player> tgtPlayers = getTargetPlayers(sa);
final TargetRestrictions tgt = sa.getTargetRestrictions();
final FCollectionView<Player> choices = sa.hasParam("Choices") ? AbilityUtils.getDefinedPlayers(
card, sa.getParam("Choices"), sa) : sa.getActivatingPlayer().getGame().getPlayersInTurnOrder();
final String choiceDesc = sa.hasParam("ChoiceTitle") ? sa.getParam("ChoiceTitle") : Localizer.getInstance().getMessage("lblChoosePlayer");
final boolean random = sa.hasParam("Random");
for (final Player p : tgtPlayers) {
if ((tgt == null) || p.canBeTargetedBy(sa)) {
for (final Player p : getTargetPlayers(sa)) {
if (!p.isInGame()) {
continue;
}
Player chosen;
if (random) {
chosen = choices.isEmpty() ? null : Aggregates.random(choices);
@@ -83,5 +78,4 @@ public class ChoosePlayerEffect extends SpellAbilityEffect {
}
}
}
}
}

View File

@@ -15,6 +15,7 @@ import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.spellability.SpellAbilityStackInstance;
import forge.game.zone.ZoneType;
import forge.util.Lang;
import forge.util.Localizer;
public class ChooseSourceEffect extends SpellAbilityEffect {
@@ -22,9 +23,8 @@ public class ChooseSourceEffect extends SpellAbilityEffect {
protected String getStackDescription(SpellAbility sa) {
final StringBuilder sb = new StringBuilder();
for (final Player p : getTargetPlayers(sa)) {
sb.append(p).append(" ");
}
sb.append(Lang.joinHomogenous(getTargetPlayers(sa)));
sb.append("chooses a source.");
return sb.toString();
@@ -129,8 +129,10 @@ public class ChooseSourceEffect extends SpellAbilityEffect {
final int validAmount = StringUtils.isNumeric(numericAmount) ? Integer.parseInt(numericAmount) : AbilityUtils.calculateAmount(host, numericAmount, sa);
for (final Player p : tgtPlayers) {
if (!p.isInGame()) {
continue;
}
final CardCollection chosen = new CardCollection();
if (!sa.usesTargeting() || p.canBeTargetedBy(sa)) {
for (int i = 0; i < validAmount; i++) {
final String choiceTitle = sa.hasParam("ChoiceTitle") ? sa.getParam("ChoiceTitle") : Localizer.getInstance().getMessage("lblChooseSource") + " ";
Card o = null;
@@ -146,5 +148,4 @@ public class ChooseSourceEffect extends SpellAbilityEffect {
}
}
}
}
}

View File

@@ -13,9 +13,9 @@ import forge.game.card.CardCollectionView;
import forge.game.card.CardFactoryUtil;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.spellability.TargetRestrictions;
import forge.game.zone.ZoneType;
import forge.util.Aggregates;
import forge.util.Lang;
public class ChooseTypeEffect extends SpellAbilityEffect {
@@ -24,9 +24,7 @@ public class ChooseTypeEffect extends SpellAbilityEffect {
final StringBuilder sb = new StringBuilder();
if (!sa.usesTargeting()) {
for (final Player p : getTargetPlayers(sa)) {
sb.append(p);
}
sb.append(Lang.joinHomogenous(getTargetPlayers(sa)));
sb.append(" chooses a ").append(sa.getParam("Type").toLowerCase()).append(" type.");
} else {
sb.append("Please improve the stack description.");
@@ -103,14 +101,11 @@ public class ChooseTypeEffect extends SpellAbilityEffect {
}
}
final TargetRestrictions tgt = sa.getTargetRestrictions();
if (validTypes.isEmpty() && sa.hasParam("Note")) {
// OK to end up with no choices/have nothing new to note
} else if (!validTypes.isEmpty()) {
for (final Player p : tgtPlayers) {
String choice;
if ((tgt == null) || p.canBeTargetedBy(sa)) {
Player noNotify = p;
if (sa.hasParam("AtRandom")) {
choice = Aggregates.random(validTypes);
@@ -127,7 +122,6 @@ public class ChooseTypeEffect extends SpellAbilityEffect {
}
p.getGame().getAction().notifyOfValue(sa, p, choice, noNotify);
}
}
} else {
throw new InvalidParameterException(sa.getHostCard() + "'s ability resulted in no types to choose from");
}

View File

@@ -453,7 +453,6 @@ public class CountersPutEffect extends SpellAbilityEffect {
}
counterAmount = sa.usesTargeting() && sa.isDividedAsYouChoose() ? sa.getDividedValue(gameCard)
: counterAmount;
if (!sa.usesTargeting() || gameCard.canBeTargetedBy(sa)) {
if (max != -1) {
counterAmount = Math.max(Math.min(max - gameCard.getCounters(counterType), counterAmount),
0);
@@ -570,7 +569,6 @@ public class CountersPutEffect extends SpellAbilityEffect {
if (sa.isDividedAsYouChoose() && !sa.usesTargeting()) {
counterRemain = counterRemain - counterAmount;
}
}
} else if (obj instanceof Player) {
// Add Counters to players!
Player pl = (Player) obj;

View File

@@ -103,8 +103,10 @@ public class CountersRemoveEffect extends SpellAbilityEffect {
boolean rememberAmount = sa.hasParam("RememberAmount");
for (final Player tgtPlayer : getTargetPlayers(sa)) {
if (!tgtPlayer.isInGame()) {
continue;
}
// Removing energy
if (!sa.usesTargeting() || tgtPlayer.canBeTargetedBy(sa)) {
if (type.equals("All")) {
for (Map.Entry<CounterType, Integer> e : Lists.newArrayList(tgtPlayer.getCounters().entrySet())) {
tgtPlayer.subtractCounter(e.getKey(), e.getValue());
@@ -120,7 +122,6 @@ public class CountersRemoveEffect extends SpellAbilityEffect {
}
}
}
}
CardCollectionView srcCards = null;
@@ -160,7 +161,6 @@ public class CountersRemoveEffect extends SpellAbilityEffect {
if (gameCard == null || !tgtCard.equalsWithTimestamp(gameCard)) {
continue;
}
if (!sa.usesTargeting() || gameCard.canBeTargetedBy(sa)) {
final Zone zone = game.getZoneOf(gameCard);
if (type.equals("All")) {
for (Map.Entry<CounterType, Integer> e : Lists.newArrayList(gameCard.getCounters().entrySet())) {
@@ -200,7 +200,6 @@ public class CountersRemoveEffect extends SpellAbilityEffect {
}
}
}
}
if (totalRemoved > 0 && rememberAmount) {
// TODO use SpellAbility Remember later

View File

@@ -69,13 +69,25 @@ public class DebuffEffect extends SpellAbilityEffect {
final long timestamp = game.getNextTimestamp();
for (final Card tgtC : getTargetCards(sa)) {
if (!tgtC.isInPlay()) {
continue;
}
if (tgtC.isPhasedOut()) {
continue;
}
// check if the object is still in game or if it was moved
Card gameCard = game.getCardState(tgtC, null);
// gameCard is LKI in that case, the card is not in game anymore
// or the timestamp did change
// this should check Self too
if (gameCard == null || !tgtC.equalsWithTimestamp(gameCard)) {
continue;
}
final List<String> addedKW = Lists.newArrayList();
final List<String> removedKW = Lists.newArrayList();
if (tgtC.isInPlay() && (!sa.usesTargeting() || tgtC.canBeTargetedBy(sa))) {
if (sa.hasParam("AllSuffixKeywords")) {
// this only for walk abilities, may to try better
if (sa.getParam("AllSuffixKeywords").equals("walk")) {
@@ -142,7 +154,7 @@ public class DebuffEffect extends SpellAbilityEffect {
removedKW.addAll(kws);
tgtC.addChangedCardKeywords(addedKW, removedKW, false, timestamp, 0);
}
if (!"Permanent".equals(sa.getParam("Duration"))) {
final GameCommand until = new GameCommand() {
private static final long serialVersionUID = 5387486776282932314L;
@@ -155,6 +167,6 @@ public class DebuffEffect extends SpellAbilityEffect {
addUntilCommand(sa, until);
}
}
} // debuffResolve
}
}

View File

@@ -122,10 +122,9 @@ public class DigUntilEffect extends SpellAbilityEffect {
CardCollectionView lastStateGraveyard = game.copyLastStateGraveyard();
for (final Player p : getTargetPlayers(sa)) {
if (p == null) {
if (p == null || !p.isInGame()) {
continue;
}
if (!sa.usesTargeting() || p.canBeTargetedBy(sa)) {
if (optional && !p.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantDigYourLibrary"), null)) {
continue;
}
@@ -261,7 +260,6 @@ public class DigUntilEffect extends SpellAbilityEffect {
p.shuffle(sa);
}
} // end foreach player
}
if (combatChanged) {
game.updateCombatForView();
game.fireEvent(new GameEventCombatChanged());

View File

@@ -37,7 +37,6 @@ public class ManifestEffect extends SpellAbilityEffect {
moveParams.put(AbilityKey.LastStateGraveyard, lastStateGraveyard);
for (final Player p : getTargetPlayers(sa, "DefinedPlayer")) {
if (sa.usesTargeting() || p.canBeTargetedBy(sa)) {
CardCollection tgtCards;
if (sa.hasParam("Choices") || sa.hasParam("ChoiceZone")) {
ZoneType choiceZone = ZoneType.Hand;
@@ -73,5 +72,4 @@ public class ManifestEffect extends SpellAbilityEffect {
}
}
}
}
}

View File

@@ -44,7 +44,10 @@ public class MillEffect extends SpellAbilityEffect {
moveParams.put(AbilityKey.LastStateGraveyard, sa.getLastStateGraveyard());
for (final Player p : getTargetPlayers(sa)) {
if (!sa.usesTargeting() || p.canBeTargetedBy(sa)) {
if (!p.isInGame()) {
continue;
}
if (sa.hasParam("Optional")) {
final String prompt = TextUtil.concatWithSpace(Localizer.getInstance().getMessage("lblDoYouWantPutLibraryCardsTo", destination.getTranslatedName()));
// CR 701.13b
@@ -83,7 +86,6 @@ public class MillEffect extends SpellAbilityEffect {
source.addImprintedCards(milled);
}
}
}
// run trigger if something got milled
table.triggerChangesZoneAll(game, sa);

View File

@@ -16,7 +16,6 @@ import forge.game.card.CardCollectionView;
import forge.game.card.CardLists;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.spellability.TargetRestrictions;
import forge.game.zone.ZoneType;
import forge.util.Aggregates;
import forge.util.Localizer;
@@ -56,7 +55,6 @@ public class MultiplePilesEffect extends SpellAbilityEffect {
final String valid = sa.getParamOrDefault("ValidCards", "");
final TargetRestrictions tgt = sa.getTargetRestrictions();
final List<Player> tgtPlayers = getTargetPlayers(sa);
// starting with the activator
int pSize = tgtPlayers.size();
@@ -66,7 +64,10 @@ public class MultiplePilesEffect extends SpellAbilityEffect {
}
for (final Player p : tgtPlayers) {
if ((tgt == null) || p.canBeTargetedBy(sa)) {
if (!p.isInGame()) {
continue;
}
CardCollection pool;
if (sa.hasParam("DefinedCards")) {
pool = AbilityUtils.getDefinedCards(source, sa.getParam("DefinedCards"), sa);
@@ -88,7 +89,6 @@ public class MultiplePilesEffect extends SpellAbilityEffect {
p.getGame().getAction().notifyOfValue(sa, p, pileList.toString(), p);
record.put(p, pileList);
}
}
if (randomChosen) {
for (Entry<Player, List<CardCollectionView>> ev : record.entrySet()) {
CardCollectionView chosen = Aggregates.random(ev.getValue());

View File

@@ -39,7 +39,7 @@ public class ProtectAllEffect extends SpellAbilityEffect {
}
return sb.toString();
} // protectStackDescription()
}
@Override
public void resolve(SpellAbility sa) {
@@ -83,11 +83,9 @@ public class ProtectAllEffect extends SpellAbilityEffect {
// Deal with permanents
final String valid = sa.getParamOrDefault("ValidCards", "");
if (!valid.equals("")) {
CardCollectionView list = game.getCardsIn(ZoneType.Battlefield);
list = CardLists.getValidCards(list, valid, sa.getActivatingPlayer(), host, sa);
CardCollectionView list = CardLists.getValidCards(game.getCardsIn(ZoneType.Battlefield), valid, sa.getActivatingPlayer(), host, sa);
for (final Card tgtC : list) {
if (tgtC.isInPlay()) {
tgtC.addChangedCardKeywords(gainsKWList, null, false, timestamp, 0, true);
if (!"Permanent".equals(sa.getParam("Duration"))) {
@@ -106,16 +104,12 @@ public class ProtectAllEffect extends SpellAbilityEffect {
}
}
}
}
// Deal with Players
final String players = sa.getParamOrDefault("ValidPlayers", "");
if (!players.equals("")) {
final List<Player> playerList = AbilityUtils.getDefinedPlayers(host, players, sa);
for (final Player player : playerList) {
for (final String gain : gains) {
player.addChangedKeywords(ImmutableList.of("Protection from " + gain), ImmutableList.of(), timestamp, 0);
}
for (final Player player : AbilityUtils.getDefinedPlayers(host, players, sa)) {
player.addChangedKeywords(gainsKWList, ImmutableList.of(), timestamp, 0);
if (!"Permanent".equals(sa.getParam("Duration"))) {
// If not Permanent, remove protection at EOT

View File

@@ -12,7 +12,6 @@ import forge.game.card.CardCollection;
import forge.game.combat.Combat;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.spellability.TargetRestrictions;
public class RemoveFromCombatEffect extends SpellAbilityEffect {
@@ -34,11 +33,13 @@ public class RemoveFromCombatEffect extends SpellAbilityEffect {
final Player activator = sa.getActivatingPlayer();
final Game game = activator.getGame();
final boolean rem = sa.hasParam("RememberRemovedFromCombat");
final TargetRestrictions tgt = sa.getTargetRestrictions();
for (final Card c : getTargetCards(sa)) {
final Combat combat = game.getPhaseHandler().getCombat();
if (combat != null && (tgt == null || c.canBeTargetedBy(sa))) {
for (final Card c : getTargetCards(sa)) {
if (combat == null || !c.isInPlay()) {
continue;
}
// Unblock creatures that were blocked only by this card (e.g. Ydwen Efreet)
if (sa.hasParam("UnblockCreaturesBlockedOnlyBy")) {
CardCollection attackers = AbilityUtils.getDefinedCards(sa.getHostCard(), sa.getParam("UnblockCreaturesBlockedOnlyBy"), sa);
@@ -67,5 +68,4 @@ public class RemoveFromCombatEffect extends SpellAbilityEffect {
}
}
}
}
}

View File

@@ -29,7 +29,9 @@ public class RevealEffect extends SpellAbilityEffect {
int cnt = sa.hasParam("NumCards") ? AbilityUtils.calculateAmount(host, sa.getParam("NumCards"), sa) : 1;
for (final Player p : getTargetPlayers(sa)) {
if (!sa.usesTargeting() || p.canBeTargetedBy(sa)) {
if (!p.isInGame()) {
continue;
}
final CardCollectionView cardsInHand = p.getZone(ZoneType.Hand).getCards();
if (cardsInHand.isEmpty()) {
continue;
@@ -102,7 +104,6 @@ public class RevealEffect extends SpellAbilityEffect {
}
}
}
}
@Override
protected String getStackDescription(SpellAbility sa) {

View File

@@ -6,7 +6,6 @@ import forge.game.ability.SpellAbilityEffect;
import forge.game.card.*;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.spellability.TargetRestrictions;
import forge.game.zone.ZoneType;
import forge.util.Lang;
import forge.util.Localizer;
@@ -36,12 +35,12 @@ public class RevealHandEffect extends SpellAbilityEffect {
@Override
public void resolve(SpellAbility sa) {
final Card host = sa.getHostCard();
final TargetRestrictions tgt = sa.getTargetRestrictions();
final boolean optional = sa.hasParam("Optional");
for (final Player p : getTargetPlayers(sa)) {
if ((tgt == null) || p.canBeTargetedBy(sa)) {
if (!p.isInGame()) {
continue;
}
if (optional && !p.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantRevealYourHand"), null)) {
continue;
}
@@ -65,5 +64,4 @@ public class RevealHandEffect extends SpellAbilityEffect {
}
}
}
}
}

View File

@@ -11,7 +11,6 @@ import forge.game.card.CardCollectionView;
import forge.game.card.CardLists;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.spellability.TargetRestrictions;
import forge.game.zone.ZoneType;
import forge.util.Lang;
import forge.util.Localizer;
@@ -26,15 +25,11 @@ public class TwoPilesEffect extends SpellAbilityEffect {
protected String getStackDescription(SpellAbility sa) {
final StringBuilder sb = new StringBuilder();
final List<Player> tgtPlayers = getTargetPlayers(sa);
final String valid = sa.getParamOrDefault("ValidCards", "");
sb.append("Separate all ").append(valid).append(" cards ");
for (final Player p : tgtPlayers) {
sb.append(p).append(" ");
}
sb.append(Lang.joinHomogenous(getTargetPlayers(sa)));
sb.append("controls into two piles.");
return sb.toString();
}
@@ -55,7 +50,6 @@ public class TwoPilesEffect extends SpellAbilityEffect {
final String valid = sa.getParamOrDefault("ValidCards", "Card");
final TargetRestrictions tgt = sa.getTargetRestrictions();
final List<Player> tgtPlayers = getTargetPlayers(sa);
Player separator = card.getController();
@@ -75,7 +69,10 @@ public class TwoPilesEffect extends SpellAbilityEffect {
}
for (final Player p : tgtPlayers) {
if ((tgt == null) || p.canBeTargetedBy(sa)) {
if (!p.isInGame()) {
continue;
}
CardCollectionView pool0;
if (sa.hasParam("DefinedCards")) {
pool0 = AbilityUtils.getDefinedCards(card, sa.getParam("DefinedCards"), sa);
@@ -186,7 +183,6 @@ public class TwoPilesEffect extends SpellAbilityEffect {
card.addRemembered(tempRemembered);
}
}
}
if (!sa.hasParam("KeepRemembered")) {
// prior to addition of "DefinedPiles" param, TwoPilesEffect cleared remembered objects in the
// Chosen/Unchosen subability resolutions, so this preserves that