mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
commit
778ec735de
8 changed files with 67 additions and 20 deletions
|
@ -137,7 +137,7 @@ class KaradorGhostChieftainContinuousEffect extends ContinuousEffectImpl {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
if (!game.getActivePlayerId().equals(player.getId())) {
|
||||
if (game.getActivePlayerId() == null || !game.getActivePlayerId().equals(player.getId())) {
|
||||
return false;
|
||||
}
|
||||
for (Card card : player.getGraveyard().getCards(new FilterCreatureCard(), game)) {
|
||||
|
|
|
@ -60,7 +60,7 @@ public class ReaperKing extends CardImpl {
|
|||
public ReaperKing(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{2/W}{2/U}{2/B}{2/R}{2/G}");
|
||||
addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add("Scarecrow");
|
||||
this.subtype.add(SubType.SCARECROW);
|
||||
|
||||
this.power = new MageInt(6);
|
||||
this.toughness = new MageInt(6);
|
||||
|
|
|
@ -36,6 +36,7 @@ import mage.counters.CounterType;
|
|||
import mage.filter.StaticFilters;
|
||||
import mage.game.permanent.Permanent;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
|
@ -139,8 +140,9 @@ public class LandTypeChangingEffectsTest extends CardTestPlayerBase {
|
|||
String canopyvista = "Canopy Vista";
|
||||
|
||||
/*
|
||||
NOTE: this test is currently failing due to bug in code. See issue #3072
|
||||
TODO: NOTE: this test is currently failing due to bug in code. See issue #3072
|
||||
*/
|
||||
@Ignore
|
||||
@Test
|
||||
public void testBloodMoonBeforeUrborg() {
|
||||
// Blood Moon 2R
|
||||
|
@ -171,8 +173,9 @@ public class LandTypeChangingEffectsTest extends CardTestPlayerBase {
|
|||
}
|
||||
|
||||
/*
|
||||
NOTE: this test is currently failing due to bug in code. See issue #3072
|
||||
TODO: NOTE: this test is currently failing due to bug in code. See issue #3072
|
||||
*/
|
||||
@Ignore
|
||||
@Test
|
||||
public void testBloodMoonAfterUrborg() {
|
||||
// Blood Moon 2R
|
||||
|
|
|
@ -100,6 +100,34 @@ public class PrimordialTest extends CardTestMultiPlayerBase {
|
|||
assertGraveyardCount(playerD, "Pillarfield Ox", 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* I'm almost certain now about how this happens: when Sepulchral Primordial
|
||||
* enters the battlefield, and there's at least one opponent without a
|
||||
* creature in the graveyard, the ability doesn't trigger at all. It should
|
||||
* trigger at least for the players with creatures in the yard.
|
||||
*/
|
||||
@Test
|
||||
public void SepulchralPrimordialFromGraveyardEmptyGraveTest() {
|
||||
// When Sepulchral Primordial enters the battlefield, for each opponent, you may put up to one
|
||||
// target creature card from that player's graveyard onto the battlefield under your control.
|
||||
addCard(Zone.HAND, playerA, "Sepulchral Primordial"); // {5}{B}{B}
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 7);
|
||||
|
||||
// Player order: A -> D -> C -> B
|
||||
addCard(Zone.GRAVEYARD, playerC, "Walking Corpse"); // Not in Range
|
||||
addCard(Zone.GRAVEYARD, playerD, "Pillarfield Ox");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sepulchral Primordial");
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Sepulchral Primordial", 1);
|
||||
assertPermanentCount(playerA, "Walking Corpse", 0);
|
||||
assertPermanentCount(playerA, "Pillarfield Ox", 1);
|
||||
assertGraveyardCount(playerC, "Walking Corpse", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Diluvian Primordial ETB trigger never happened in a 3 player FFA
|
||||
* commander game. He just resolved, no ETB trigger occurred.
|
||||
|
|
|
@ -37,6 +37,7 @@ import mage.abilities.costs.VariableCost;
|
|||
import mage.abilities.costs.common.PayLifeCost;
|
||||
import mage.abilities.mana.ManaOptions;
|
||||
import mage.constants.ColoredManaSymbol;
|
||||
import mage.constants.ManaType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.Filter;
|
||||
import mage.game.Game;
|
||||
|
@ -293,16 +294,16 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M
|
|||
}
|
||||
|
||||
// Mono Hybrid mana costs
|
||||
// First try only to pay colored mana with the pool
|
||||
// First try only to pay colored mana or conditional colored mana with the pool
|
||||
for (ManaCost cost : this) {
|
||||
if (!cost.isPaid() && cost instanceof MonoHybridManaCost) {
|
||||
if (((cost.containsColor(ColoredManaSymbol.W)) && pool.getWhite() > 0)
|
||||
|| ((cost.containsColor(ColoredManaSymbol.B)) && pool.getBlack() > 0)
|
||||
|| ((cost.containsColor(ColoredManaSymbol.R)) && pool.getRed() > 0)
|
||||
|| ((cost.containsColor(ColoredManaSymbol.G)) && pool.getGreen() > 0)
|
||||
|| ((cost.containsColor(ColoredManaSymbol.U)) && pool.getBlue() > 0)) {
|
||||
if (((cost.containsColor(ColoredManaSymbol.W)) && (pool.getWhite() > 0 || pool.ConditionalManaHasManaType(ManaType.WHITE)))
|
||||
|| ((cost.containsColor(ColoredManaSymbol.B)) && (pool.getBlack() > 0 || pool.ConditionalManaHasManaType(ManaType.BLACK)))
|
||||
|| ((cost.containsColor(ColoredManaSymbol.R)) && (pool.getRed() > 0 || pool.ConditionalManaHasManaType(ManaType.RED)))
|
||||
|| ((cost.containsColor(ColoredManaSymbol.G)) && (pool.getGreen() > 0 || pool.ConditionalManaHasManaType(ManaType.GREEN)))
|
||||
|| ((cost.containsColor(ColoredManaSymbol.U)) && (pool.getBlue() > 0) || pool.ConditionalManaHasManaType(ManaType.BLUE))) {
|
||||
cost.assignPayment(game, ability, pool, costToPay);
|
||||
if (pool.isEmpty()) {
|
||||
if (pool.isEmpty() && pool.getConditionalMana().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -414,6 +414,17 @@ public class ManaPool implements Serializable {
|
|||
return conditionalMana;
|
||||
}
|
||||
|
||||
public boolean ConditionalManaHasManaType(ManaType manaType) {
|
||||
for (ManaPoolItem item : manaItems) {
|
||||
if (item.isConditional()) {
|
||||
if (item.getConditionalMana().get(manaType) > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int count() {
|
||||
int x = 0;
|
||||
for (ManaPoolItem item : manaItems) {
|
||||
|
|
|
@ -27,6 +27,10 @@
|
|||
*/
|
||||
package mage.target;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
import mage.MageItem;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.Cards;
|
||||
|
@ -36,11 +40,6 @@ import mage.game.Game;
|
|||
import mage.game.events.GameEvent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
@ -88,6 +87,9 @@ public class TargetCard extends TargetObject {
|
|||
@Override
|
||||
public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||
int possibleTargets = 0;
|
||||
if (getNumberOfTargets() == 0) { // if 0 target is valid, the canChoose is always true
|
||||
return true;
|
||||
}
|
||||
for (UUID playerId : game.getState().getPlayersInRange(sourceControllerId, game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
package mage.target.common;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.target.TargetCard;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
|
||||
|
||||
public class TargetCardInOpponentsGraveyard extends TargetCard {
|
||||
|
@ -55,7 +54,7 @@ public class TargetCardInOpponentsGraveyard extends TargetCard {
|
|||
public boolean canChoose(UUID sourceControllerId, Game game) {
|
||||
return canChoose(null, sourceControllerId, game);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if there are enough {@link Card} that can be chosen.
|
||||
*
|
||||
|
@ -67,6 +66,9 @@ public class TargetCardInOpponentsGraveyard extends TargetCard {
|
|||
@Override
|
||||
public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||
int possibleTargets = 0;
|
||||
if (getNumberOfTargets() == 0) { // if 0 target is valid, the canChoose is always true
|
||||
return true;
|
||||
}
|
||||
for (UUID playerId: game.getState().getPlayersInRange(sourceControllerId, game)) {
|
||||
if (!playerId.equals(sourceControllerId)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
|
|
Loading…
Reference in a new issue