Added failing ignore test for #7655

This commit is contained in:
Alex Vasile 2022-07-17 13:23:58 -04:00
parent 137f02f31b
commit 8878dc5cc7
2 changed files with 72 additions and 35 deletions

View file

@ -12,6 +12,7 @@ import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.util.CardUtil; import mage.util.CardUtil;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.mage.test.player.TestPlayer; import org.mage.test.player.TestPlayer;
import org.mage.test.serverside.base.CardTestPlayerBase; import org.mage.test.serverside.base.CardTestPlayerBase;
@ -750,6 +751,40 @@ public class CopySpellTest extends CardTestPlayerBase {
//cardsMustHaveSameZoneAndZCC(originalCard.getRightHalfCard(), copiedCard.getRightHalfCard(), "right"); //cardsMustHaveSameZoneAndZCC(originalCard.getRightHalfCard(), copiedCard.getRightHalfCard(), "right");
} }
/**
* Reported bug: https://github.com/magefree/mage/issues/7655
* Thieving Skydiver is kicked and then copied, but the copied version does not let you gain control of anything.
*/
@Test
@Ignore
public void copySpellWithKicker() {
// When Thieving Skydiver enters the battlefield, if it was kicked, gain control of target artifact with mana value X or less.
// If that artifact is an Equipment, attach it to Thieving Skydiver.
addCard(Zone.HAND, playerA, "Thieving Skydiver");
// Copy target creature spell you control, except it isnt legendary if the spell is legendary.
addCard(Zone.HAND, playerA, "Double Major");
addCard(Zone.BATTLEFIELD, playerA, "Island", 3); // Original price, + 1 kicker, + 1 for Double Major
addCard(Zone.BATTLEFIELD, playerA, "Forest", 3);
addCard(Zone.BATTLEFIELD, playerB, "Sol Ring", 2);
setStrictChooseMode(true);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Thieving Skydiver");
setChoice(playerA, "Yes");
setChoice(playerA, "X=1");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Double Major", "Thieving Skydiver", "Thieving Skydiver");
addTarget(playerA, "Sol Ring"); // Choice for copy
addTarget(playerA, "Sol Ring"); // Choice for original
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerA, "Sol Ring", 2); // 1 taken by original, one by copy
assertPermanentCount(playerB, "Sol Ring", 0);
}
private void abilitySourceMustBeSame(Card card, String infoPrefix) { private void abilitySourceMustBeSame(Card card, String infoPrefix) {
Set<UUID> partIds = CardUtil.getObjectParts(card); Set<UUID> partIds = CardUtil.getObjectParts(card);

View file

@ -231,46 +231,48 @@ public class KickerAbility extends StaticAbility implements OptionalAdditionalSo
@Override @Override
public void addOptionalAdditionalCosts(Ability ability, Game game) { public void addOptionalAdditionalCosts(Ability ability, Game game) {
if (ability instanceof SpellAbility) { if (!(ability instanceof SpellAbility)) {
Player player = game.getPlayer(ability.getControllerId()); return;
if (player != null) { }
this.resetKicker(); Player player = game.getPlayer(ability.getControllerId());
for (OptionalAdditionalCost kickerCost : kickerCosts) { if (player == null) {
boolean again = true; return;
while (player.canRespond() && again) { }
String times = ""; this.resetKicker();
if (kickerCost.isRepeatable()) { for (OptionalAdditionalCost kickerCost : kickerCosts) {
int activatedCount = getKickedCounterStrict(game, ability, kickerCost.getText(true)); boolean again = true;
times = (activatedCount + 1) + (activatedCount == 0 ? " time " : " times "); while (player.canRespond() && again) {
} String times = "";
// TODO: add AI support to find max number of possible activations (from available mana) if (kickerCost.isRepeatable()) {
// canPay checks only single mana available, not total mana usage int activatedCount = getKickedCounterStrict(game, ability, kickerCost.getText(true));
if (kickerCost.canPay(ability, this, ability.getControllerId(), game) times = (activatedCount + 1) + (activatedCount == 0 ? " time " : " times ");
&& player.chooseUse(/*Outcome.Benefit*/Outcome.AIDontUseIt, }
"Pay " + times + kickerCost.getText(false) + " ?", ability, game)) { // TODO: add AI support to find max number of possible activations (from available mana)
this.activateKicker(kickerCost, ability, game); // canPay checks only single mana available, not total mana usage
if (kickerCost instanceof Costs) { if (kickerCost.canPay(ability, this, ability.getControllerId(), game)
// as multiple costs && player.chooseUse(/*Outcome.Benefit*/Outcome.AIDontUseIt,
for (Iterator itKickerCost = ((Costs) kickerCost).iterator(); itKickerCost.hasNext(); ) { "Pay " + times + kickerCost.getText(false) + " ?", ability, game)) {
Object kickerCostObject = itKickerCost.next(); this.activateKicker(kickerCost, ability, game);
if ((kickerCostObject instanceof Costs)) { if (kickerCost instanceof Costs) {
for (@SuppressWarnings("unchecked") Iterator<Cost> itDetails // as multiple costs
= ((Costs) kickerCostObject).iterator(); itDetails.hasNext(); ) { for (Iterator itKickerCost = ((Costs) kickerCost).iterator(); itKickerCost.hasNext(); ) {
addKickerCostsToAbility(itDetails.next(), ability, game); Object kickerCostObject = itKickerCost.next();
} if ((kickerCostObject instanceof Costs)) {
} else { for (@SuppressWarnings("unchecked") Iterator<Cost> itDetails
addKickerCostsToAbility((Cost) kickerCostObject, ability, game); = ((Costs) kickerCostObject).iterator(); itDetails.hasNext(); ) {
} addKickerCostsToAbility(itDetails.next(), ability, game);
} }
} else { } else {
// as single cost addKickerCostsToAbility((Cost) kickerCostObject, ability, game);
addKickerCostsToAbility(kickerCost, ability, game);
} }
again = kickerCost.isRepeatable();
} else {
again = false;
} }
} else {
// as single cost
addKickerCostsToAbility(kickerCost, ability, game);
} }
again = kickerCost.isRepeatable();
} else {
again = false;
} }
} }
} }