[NCC] Fixed Phabine, Boss's Confidant not working properly (and added hint to ParleyCount). Closes #9603.

This commit is contained in:
Alex Vasile 2022-11-04 22:28:49 -04:00
parent 6fd3ea4fc7
commit 6f0cdc6032
3 changed files with 47 additions and 4 deletions

View file

@ -5,6 +5,8 @@ import mage.abilities.Ability;
import mage.abilities.common.BeginningOfCombatTriggeredAbility; import mage.abilities.common.BeginningOfCombatTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.common.ParleyCount; 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.Effect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DrawCardAllEffect; import mage.abilities.effects.common.DrawCardAllEffect;
@ -94,7 +96,7 @@ class PhabineBosssConfidantParleyEffect extends OneShotEffect {
return false; return false;
} }
int landCount = ParleyCount.getInstance().calculate(game, source, this); int nonLandCount = ParleyCount.getInstance().calculate(game, source, this);
int nonEmptyLibraries = 0; int nonEmptyLibraries = 0;
for (UUID playerID : game.getState().getPlayersInRange(controller.getId(), game)) { for (UUID playerID : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerID); Player player = game.getPlayer(playerID);
@ -102,16 +104,17 @@ class PhabineBosssConfidantParleyEffect extends OneShotEffect {
nonEmptyLibraries++; nonEmptyLibraries++;
} }
} }
int nonLandCount = nonEmptyLibraries - landCount; int landCount = nonEmptyLibraries - nonLandCount;
if (landCount > 0) { if (landCount > 0) {
Token citizenToken = new CitizenGreenWhiteToken(); Token citizenToken = new CitizenGreenWhiteToken();
citizenToken.putOntoBattlefield(landCount, game, source, source.getControllerId(), false, false); citizenToken.putOntoBattlefield(landCount, game, source, source.getControllerId(), false, false);
game.applyEffects();
} }
if (nonLandCount > 0) { if (nonLandCount > 0) {
Effect boostEffect = new BoostControlledEffect(nonLandCount, nonLandCount, Duration.EndOfTurn); BoostControlledEffect boostEffect = new BoostControlledEffect(nonLandCount, nonLandCount, Duration.EndOfTurn);
boostEffect.apply(game, source); game.addEffect(boostEffect, source);
} }
return true; return true;

View file

@ -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);
}
}

View file

@ -16,6 +16,8 @@ import mage.players.Player;
/** /**
* Don't use this for continuous effects because it applies a reveal effect! * Don't use this for continuous effects because it applies a reveal effect!
* *
* Calculate returns the number of nonland cards revealed.
*
* @author LevelX2 * @author LevelX2
*/ */
public class ParleyCount implements DynamicValue, MageSingleton { public class ParleyCount implements DynamicValue, MageSingleton {