Fix Swallow Whole putting P1P1 on player

This commit is contained in:
tool4EvEr
2022-03-06 17:09:05 +01:00
parent a11bf3b99c
commit 1ae507f378
4 changed files with 41 additions and 38 deletions

View File

@@ -349,36 +349,7 @@ public class AbilityUtils {
cards.addAll(CardLists.getValidCards(candidates, validDefined, hostCard.getController(), hostCard, sa));
return cards;
} else {
CardCollection list = null;
if (sa instanceof SpellAbility) {
SpellAbility root = ((SpellAbility)sa).getRootAbility();
if (defined.startsWith("SacrificedCards")) {
list = root.getPaidList("SacrificedCards");
} else if (defined.startsWith("Sacrificed")) {
list = root.getPaidList("Sacrificed");
} else if (defined.startsWith("Revealed")) {
list = root.getPaidList("Revealed");
} else if (defined.startsWith("DiscardedCards")) {
list = root.getPaidList("DiscardedCards");
} else if (defined.startsWith("Discarded")) {
list = root.getPaidList("Discarded");
} else if (defined.startsWith("ExiledCards")) {
list = root.getPaidList("ExiledCards");
} else if (defined.startsWith("Exiled")) {
list = root.getPaidList("Exiled");
} else if (defined.startsWith("Milled")) {
list = root.getPaidList("Milled");
} else if (defined.startsWith("TappedCards")) {
list = root.getPaidList("TappedCards");
} else if (defined.startsWith("Tapped")) {
list = root.getPaidList("Tapped");
} else if (defined.startsWith("UntappedCards")) {
list = root.getPaidList("UntappedCards");
} else if (defined.startsWith("Untapped")) {
list = root.getPaidList("Untapped");
}
}
CardCollection list = getPaidCards(sa, defined);
if (list != null) {
cards.addAll(list);
}
@@ -1004,7 +975,7 @@ public class AbilityUtils {
final Player player = sa instanceof SpellAbility ? ((SpellAbility)sa).getActivatingPlayer() : card.getController();
if (defined.equals("Self") || defined.equals("ThisTargetedCard")) {
if (defined.equals("Self") || defined.equals("ThisTargetedCard") || getPaidCards(sa, defined) != null) {
// do nothing, Self is for Cards, not Players
} else if (defined.equals("TargetedOrController")) {
players.addAll(getDefinedPlayers(card, "Targeted", sa));
@@ -3864,6 +3835,39 @@ public class AbilityUtils {
return someCards;
}
public static CardCollection getPaidCards(CardTraitBase sa, String defined) {
CardCollection list = null;
if (sa instanceof SpellAbility) {
SpellAbility root = ((SpellAbility)sa).getRootAbility();
if (defined.startsWith("SacrificedCards")) {
list = root.getPaidList("SacrificedCards");
} else if (defined.startsWith("Sacrificed")) {
list = root.getPaidList("Sacrificed");
} else if (defined.startsWith("Revealed")) {
list = root.getPaidList("Revealed");
} else if (defined.startsWith("DiscardedCards")) {
list = root.getPaidList("DiscardedCards");
} else if (defined.startsWith("Discarded")) {
list = root.getPaidList("Discarded");
} else if (defined.startsWith("ExiledCards")) {
list = root.getPaidList("ExiledCards");
} else if (defined.startsWith("Exiled")) {
list = root.getPaidList("Exiled");
} else if (defined.startsWith("Milled")) {
list = root.getPaidList("Milled");
} else if (defined.startsWith("TappedCards")) {
list = root.getPaidList("TappedCards");
} else if (defined.startsWith("Tapped")) {
list = root.getPaidList("Tapped");
} else if (defined.startsWith("UntappedCards")) {
list = root.getPaidList("UntappedCards");
} else if (defined.startsWith("Untapped")) {
list = root.getPaidList("Untapped");
}
}
return list;
}
public static int getNumberOfTypes(final Card card) {
EnumSet<CardType.CoreType> types = EnumSet.noneOf(CardType.CoreType.class);
Iterables.addAll(types, card.getType().getCoreTypes());

View File

@@ -135,6 +135,11 @@ public class CountersPutEffect extends SpellAbilityEffect {
boolean existingCounter = sa.hasParam("CounterType") && sa.getParam("CounterType").equals("ExistingCounter");
boolean eachExistingCounter = sa.hasParam("EachExistingCounter");
if (sa.hasParam("Optional") && !pc.confirmAction
(sa, null, Localizer.getInstance().getMessage("lblDoYouWantPutCounter"))) {
return;
}
List<GameEntity> tgtObjects = Lists.newArrayList();
int divrem = 0;
if (sa.hasParam("Bolster")) {
@@ -198,11 +203,6 @@ public class CountersPutEffect extends SpellAbilityEffect {
}
}
if (sa.hasParam("Optional") && !pc.confirmAction
(sa, null, Localizer.getInstance().getMessage("lblDoYouWantPutCounter"))) {
return;
}
int counterRemain = counterAmount;
if (sa.hasParam("DividedRandomly")) {
CardCollection targets = new CardCollection();

View File

@@ -12,7 +12,6 @@ import forge.gui.FThreads;
import forge.gui.interfaces.IButton;
import forge.model.FModel;
import forge.screens.LoadingOverlay;
import forge.screens.home.HomeScreen;
import forge.toolbox.FEvent;
import forge.toolbox.FEvent.FEventHandler;
import forge.toolbox.FLabel;

View File

@@ -2,6 +2,6 @@ Name:Swallow Whole
ManaCost:W
Types:Sorcery
A:SP$ ChangeZone | Cost$ W tapXType<1/Creature> | ValidTgts$ Creature.tapped | TgtPrompt$ Select target tapped creature | Origin$ Battlefield | Destination$ Exile | SubAbility$ DBPutCounter | SpellDescription$ As an additional cost to cast this spell, tap an untapped creature you control. Exile target tapped creature.
SVar:DBPutCounter:DB$ PutCounter | Defined$ Tapped | CounterType$ P1P1 | CounterNum$ 1 | SpellDescription$ Put a +1/+1 counter on the creature tapped to cast this spell.
SVar:DBPutCounter:DB$ PutCounter | Defined$ Tapped | CounterType$ P1P1 | SpellDescription$ Put a +1/+1 counter on the creature tapped to cast this spell.
DeckHas:Ability$Counters
Oracle:As an additional cost to cast this spell, tap an untapped creature you control.\nExile target tapped creature. Put a +1/+1 counter on the creature tapped to pay this spell's additional cost.