mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
* Some fixes to tests and sacrifice cost.
This commit is contained in:
parent
e77817b67a
commit
88e744c04c
6 changed files with 28 additions and 25 deletions
|
|
@ -28,8 +28,6 @@
|
|||
package mage.sets.darkascension;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.*;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
||||
|
|
@ -41,6 +39,7 @@ import mage.abilities.effects.common.ExileFromZoneTargetEffect;
|
|||
import mage.abilities.effects.common.RegenerateSourceEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
|
|
@ -56,7 +55,7 @@ public class FiendOfTheShadows extends CardImpl {
|
|||
|
||||
private UUID exileId = UUID.randomUUID();
|
||||
|
||||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("a human");
|
||||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("a Human");
|
||||
|
||||
static {
|
||||
filter.add(new SubtypePredicate("Human"));
|
||||
|
|
@ -118,12 +117,12 @@ class FiendOfTheShadowsEffect extends AsThoughEffectImpl {
|
|||
@Override
|
||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||
if (affectedControllerId.equals(source.getControllerId())) {
|
||||
ExileZone zone = game.getExile().getExileZone(exileId);
|
||||
if (zone != null && zone.contains(objectId)) {
|
||||
return true;
|
||||
}
|
||||
ExileZone zone = game.getExile().getExileZone(exileId);
|
||||
if (zone != null && zone.contains(objectId)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,11 +56,10 @@ import mage.target.common.TargetCreaturePermanent;
|
|||
*/
|
||||
public class AmbushCommander extends CardImpl {
|
||||
|
||||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("an Elf");
|
||||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("Elf", "an Elf");
|
||||
private static final FilterControlledPermanent filter2 = new FilterControlledPermanent("Forests you control");
|
||||
|
||||
static {
|
||||
filter.add(new SubtypePredicate("Elf"));
|
||||
filter2.add(new SubtypePredicate("Forest"));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -210,6 +210,7 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
assertPowerToughness(playerA, "Foundry Street Denizen", 1, 1);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
I casted a Silence the Believers on a manifested card. It moved to the exile zone face-down.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
|||
|
||||
/**
|
||||
*
|
||||
* also tests regenerate and
|
||||
* tests that permanents with protection can be sacrificed
|
||||
*
|
||||
* also tests regenerate and tests that permanents with protection can be
|
||||
* sacrificed
|
||||
*
|
||||
* @author BetaSteward
|
||||
*/
|
||||
public class FiendOfTheShadowsTest extends CardTestPlayerBase {
|
||||
|
|
@ -17,11 +17,14 @@ public class FiendOfTheShadowsTest extends CardTestPlayerBase {
|
|||
@Test
|
||||
public void testCard() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "White Knight");
|
||||
// Whenever Fiend of the Shadows deals combat damage to a player, that player exiles a card from his or her hand. You may play that card for as long as it remains exiled.
|
||||
// Sacrifice a Human: Regenerate Fiend of the Shadows.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Fiend of the Shadows");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain");
|
||||
addCard(Zone.HAND, playerB, "Lightning Bolt");
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sacrifice a human: Regenerate {this}.");
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sacrifice a Human: Regenerate {this}.");
|
||||
addTarget(playerA, "White Knight");
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Lightning Bolt", "Fiend of the Shadows");
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
|
|
@ -29,8 +32,9 @@ public class FiendOfTheShadowsTest extends CardTestPlayerBase {
|
|||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
assertPermanentCount(playerA, "Fiend of the Shadows", 1);
|
||||
assertPermanentCount(playerA, "White Knight", 0);
|
||||
assertGraveyardCount(playerB, "Lightning Bolt", 1);
|
||||
assertPermanentCount(playerA, "Fiend of the Shadows", 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public class RemoveFromCombatTest extends CardTestPlayerBase {
|
|||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4);
|
||||
addCard(Zone.HAND, playerA, "Lightning Blast", 1);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Forest", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Elvish Mystic", 1);
|
||||
|
||||
// Forests you control are 1/1 green Elf creatures that are still lands.
|
||||
|
|
@ -60,7 +60,8 @@ public class RemoveFromCombatTest extends CardTestPlayerBase {
|
|||
addCard(Zone.BATTLEFIELD, playerB, "Stomping Ground");
|
||||
|
||||
attack(2, playerB, "Stomping Ground");
|
||||
activateAbility(2, PhaseStep.DECLARE_ATTACKERS, playerB, "{1}{G},Sacrifice an Elf: Target creature gets +3/+3", "Stomping Ground");
|
||||
activateAbility(2, PhaseStep.DECLARE_ATTACKERS, playerB, "{1}{G}", "Stomping Ground");
|
||||
setChoice(playerB, "Elvish Mystic");
|
||||
castSpell(2, PhaseStep.DECLARE_BLOCKERS, playerA, "Lightning Blast", "Ambush Commander");
|
||||
setStopAt(2, PhaseStep.COMBAT_DAMAGE);
|
||||
execute();
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ package mage.abilities.costs.common;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.ActivatedAbilityImpl;
|
||||
import mage.abilities.costs.Cost;
|
||||
|
|
@ -52,7 +51,7 @@ public class SacrificeTargetCost extends CostImpl {
|
|||
public SacrificeTargetCost(TargetControlledPermanent target) {
|
||||
this.addTarget(target);
|
||||
target.setNotTarget(true); // sacrifice is never targeted
|
||||
this.text = "sacrifice a " + target.getTargetName();
|
||||
this.text = "sacrifice " + (target.getTargetName().startsWith("an") || target.getTargetName().startsWith("a ") ? "" : "a ") + target.getTargetName();
|
||||
target.setTargetName(target.getTargetName() + " (to sacrifice)");
|
||||
}
|
||||
|
||||
|
|
@ -100,14 +99,14 @@ public class SacrificeTargetCost extends CostImpl {
|
|||
activator = controllerId;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int validTargets = 0;
|
||||
for (Permanent permanent :game.getBattlefield().getAllActivePermanents(((TargetControlledPermanent)targets.get(0)).getFilter(), controllerId, game)) {
|
||||
if(game.getPlayer(activator).canPaySacrificeCost(permanent, sourceId, controllerId, game)) {
|
||||
validTargets++;
|
||||
}
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(((TargetControlledPermanent) targets.get(0)).getFilter(), controllerId, game)) {
|
||||
if (game.getPlayer(activator).canPaySacrificeCost(permanent, sourceId, controllerId, game)) {
|
||||
validTargets++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return validTargets > 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue