diff --git a/Mage.Sets/src/mage/cards/p/PhabineBosssConfidant.java b/Mage.Sets/src/mage/cards/p/PhabineBosssConfidant.java index 9d759799046..80e780d9dc3 100644 --- a/Mage.Sets/src/mage/cards/p/PhabineBosssConfidant.java +++ b/Mage.Sets/src/mage/cards/p/PhabineBosssConfidant.java @@ -5,6 +5,8 @@ import mage.abilities.Ability; import mage.abilities.common.BeginningOfCombatTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.dynamicvalue.common.ParleyCount; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DrawCardAllEffect; @@ -94,7 +96,7 @@ class PhabineBosssConfidantParleyEffect extends OneShotEffect { return false; } - int landCount = ParleyCount.getInstance().calculate(game, source, this); + int nonLandCount = ParleyCount.getInstance().calculate(game, source, this); int nonEmptyLibraries = 0; for (UUID playerID : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerID); @@ -102,16 +104,17 @@ class PhabineBosssConfidantParleyEffect extends OneShotEffect { nonEmptyLibraries++; } } - int nonLandCount = nonEmptyLibraries - landCount; + int landCount = nonEmptyLibraries - nonLandCount; if (landCount > 0) { Token citizenToken = new CitizenGreenWhiteToken(); citizenToken.putOntoBattlefield(landCount, game, source, source.getControllerId(), false, false); + game.applyEffects(); } if (nonLandCount > 0) { - Effect boostEffect = new BoostControlledEffect(nonLandCount, nonLandCount, Duration.EndOfTurn); - boostEffect.apply(game, source); + BoostControlledEffect boostEffect = new BoostControlledEffect(nonLandCount, nonLandCount, Duration.EndOfTurn); + game.addEffect(boostEffect, source); } return true; diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/ncc/PhabineBosssConfidantTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/ncc/PhabineBosssConfidantTest.java new file mode 100644 index 00000000000..b6a1aa2b14d --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/ncc/PhabineBosssConfidantTest.java @@ -0,0 +1,38 @@ +package org.mage.test.cards.single.ncc; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestCommander4Players; + +/** + * {@link mage.cards.p.PhabineBosssConfidant Phabine, Boss's Confidant} + * {3}{R}{G}{W} + * Legendary Creature — Cat Advisor + * Creature tokens you control have haste. + * Parley — At the beginning of combat on your turn, each player reveals the top card of their library. + * For each land card revealed this way, you create a 1/1 green and white Citizen creature token. + * Then creatures you control get +1/+1 until end of turn for each nonland card revealed this way. + * Then each player draws a card. + */ +public class PhabineBosssConfidantTest extends CardTestCommander4Players { + String phabineBosssConfidant = "Phabine, Boss's Confidant"; + + /** + * Reported bug: https://github.com/magefree/mage/issues/9603 + * The "creatures you control get +1/+1 until end of turn" part of Phabine's trigger never works. + */ + @Test + public void boostWorks() { + addCard(Zone.BATTLEFIELD, playerA, phabineBosssConfidant); + // Creature to trigger the +1/+1 part of the effect + addCard(Zone.LIBRARY, playerB, "Silvercoat Lion"); + + skipInitShuffling(); + setStopAt(1, PhaseStep.POSTCOMBAT_MAIN); + execute(); + + assertPermanentCount(playerA, "Citizen Token", 3); + assertPowerToughness(playerA, "Citizen Token", 2, 2); + } +} diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/ParleyCount.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/ParleyCount.java index 666724c0c42..c22df30a266 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/ParleyCount.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/ParleyCount.java @@ -16,6 +16,8 @@ import mage.players.Player; /** * Don't use this for continuous effects because it applies a reveal effect! * + * Calculate returns the number of nonland cards revealed. + * * @author LevelX2 */ public class ParleyCount implements DynamicValue, MageSingleton {