Merge pull request #6386 from dracontes/rb-sld-2-marvel

SLD: Marvel x MTG Superdrop
This commit is contained in:
Paul Hammerton
2024-10-20 13:30:03 +01:00
committed by GitHub
13 changed files with 102 additions and 38 deletions

View File

@@ -177,12 +177,18 @@ public class GameEntityCounterTable extends ForwardingTable<Optional<Player>, Ga
value = Math.min(value, Integer.parseInt(cause.getParam("MaxFromEffect")) - gm.getKey().getCounters(ec.getKey()));
}
gm.getKey().addCounterInternal(ec.getKey(), value, e.getKey().orNull(), true, result, runParams);
if (remember && ec.getValue() >= 1) {
if (remember && ec.getValue() > 0) {
cause.getHostCard().addRemembered(gm.getKey());
}
}
}
}
int totalAdded = totalValues();
if (totalAdded > 0 && cause != null && cause.hasParam("RememberAmount")) {
cause.getHostCard().addRemembered(totalAdded);
}
result.triggerCountersPutAll(game);
return !result.isEmpty();
}

View File

@@ -116,12 +116,6 @@ public class CountersPutAllEffect extends SpellAbilityEffect {
}
table.replaceCounterEffect(game, sa, true);
//for cards like Agitator Ant/Spectacular Showdown that care if counters were actually put on,
// instead use "RememberPut" this checks after replacement
if (sa.hasParam("RememberCards")) { // remembers whether counters actually placed or not
host.addRemembered(table.columnKeySet());
}
}
}

View File

@@ -591,18 +591,14 @@ public class CountersPutEffect extends SpellAbilityEffect {
final Card card = sa.getHostCard();
final Game game = card.getGame();
final Player activator = sa.getActivatingPlayer();
String amount = sa.getParamOrDefault("CounterNum", "1");
boolean rememberAmount = sa.hasParam("RememberAmount");
final String amount = sa.getParamOrDefault("CounterNum", "1");
final int counterAmount = AbilityUtils.calculateAmount(card, amount, sa);
Player placer = activator;
if (sa.hasParam("Placer")) {
final String pstr = sa.getParam("Placer");
placer = AbilityUtils.getDefinedPlayers(card, pstr, sa).get(0);
placer = AbilityUtils.getDefinedPlayers(card, sa.getParam("Placer"), sa).get(0);
}
int counterAmount = AbilityUtils.calculateAmount(card, amount, sa);
GameEntityCounterTable table = new GameEntityCounterTable();
if (sa.hasParam("TriggeredCounterMap")) {
@@ -648,12 +644,6 @@ public class CountersPutEffect extends SpellAbilityEffect {
table.replaceCounterEffect(game, sa, true);
int totalAdded = table.totalValues();
if (totalAdded > 0 && rememberAmount) {
// TODO use SpellAbility Remember later
card.addRemembered(totalAdded);
}
if (sa.hasParam("RemovePhase")) {
for (Map.Entry<GameEntity, Map<CounterType, Integer>> e : table.row(Optional.of(placer)).entrySet()) {
for (Map.Entry<CounterType, Integer> ce : e.getValue().entrySet()) {

View File

@@ -17,9 +17,8 @@
*/
package forge.game.cost;
import java.util.List;
import forge.game.card.Card;
import forge.game.card.CardCollection;
import forge.game.card.CardLists;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
@@ -70,27 +69,27 @@ public class CostUnattach extends CostPartWithList {
*/
@Override
public final boolean canPay(final SpellAbility ability, final Player payer, final boolean effect) {
return findCardToUnattach(ability.getHostCard(), payer, ability) != null;
return !findCardToUnattach(ability.getHostCard(), payer, ability).isEmpty();
}
public Card findCardToUnattach(final Card source, Player activator, SpellAbility ability) {
public CardCollection findCardToUnattach(final Card source, Player activator, SpellAbility ability) {
CardCollection attachees = new CardCollection();
if (payCostFromSource()) {
if (source.isEquipping()) {
return source;
attachees.add(source);
}
} else if (getType().equals("OriginalHost")) {
Card originalEquipment = ability.getOriginalHost();
if (originalEquipment.isEquipping()) {
return originalEquipment;
attachees.add(originalEquipment);
}
} else {
List<Card> attachees = CardLists.getValidCards(source.getEquippedBy(), this.getType(), activator, source, ability);
if (attachees.size() > 0) {
// Just pick the first one, although maybe give a dialog
return attachees.get(0);
attachees.addAll(source.getEquippedBy());
if (!getType().contains("X") || ability.getXManaCostPaid() != null) {
attachees = CardLists.getValidCards(attachees, this.getType(), activator, source, ability);
}
}
return null;
return attachees;
}
/* (non-Javadoc)