mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
* Sidisi, Brood Tyrant - Fixed that the second ability did wrongly trigger, if Sidisi left battlefield before first ability did resolve.
This commit is contained in:
parent
4785ebd5f8
commit
9aa02f3d6f
14 changed files with 119 additions and 32 deletions
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.sets.gatecrash;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DiesAttachedTriggeredAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
|
@ -41,11 +42,10 @@ import mage.constants.Rarity;
|
|||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.SoldierToken;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
|
|
|
@ -58,9 +58,6 @@ public class SidisiBroodTyrant extends CardImpl {
|
|||
this.subtype.add("Naga");
|
||||
this.subtype.add("Shaman");
|
||||
|
||||
this.color.setBlue(true);
|
||||
this.color.setGreen(true);
|
||||
this.color.setBlack(true);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
|
@ -123,8 +120,7 @@ class SidisiBroodTyrantTriggeredAbility extends ZoneChangeTriggeredAbility {
|
|||
UUID lastStackObjectId = null;
|
||||
|
||||
public SidisiBroodTyrantTriggeredAbility() {
|
||||
super(Zone.LIBRARY, Zone.GRAVEYARD, new CreateTokenEffect(new ZombieToken("KTK")), "", false);
|
||||
this.zone = Zone.BATTLEFIELD;
|
||||
super(Zone.BATTLEFIELD, Zone.LIBRARY, Zone.GRAVEYARD, new CreateTokenEffect(new ZombieToken("KTK")), "", false);
|
||||
}
|
||||
|
||||
public SidisiBroodTyrantTriggeredAbility(final SidisiBroodTyrantTriggeredAbility ability) {
|
||||
|
|
|
@ -99,7 +99,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Pine Walker");
|
||||
setChoice(playerA, "Yes"); // cast it face down as 2/2 creature
|
||||
|
||||
attack(3, playerA, "");
|
||||
attack(3, playerA, "face down creature");
|
||||
|
||||
activateAbility(3, PhaseStep.POSTCOMBAT_MAIN, playerA, "{4}{G}: Turn this face-down permanent face up.");
|
||||
setStopAt(3, PhaseStep.END_TURN);
|
||||
|
@ -133,8 +133,8 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Icefeather Aven");
|
||||
setChoice(playerA, "Yes"); // cast it face down as 2/2 creature
|
||||
|
||||
attack(3, playerA, "");
|
||||
attack(3, playerA, "");
|
||||
attack(3, playerA, "face down creature");
|
||||
attack(3, playerA, "face down creature");
|
||||
activateAbility(3, PhaseStep.DECLARE_BLOCKERS, playerA, "{1}{G}{U}: Turn this face-down permanent face up.");
|
||||
setChoice(playerA, "No"); // Don't use return permanent to hand effect
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
|||
public class DeflectingPalmTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* Tests if a damage spell is selected as source the damge is prevented and is dealt to the controller of the damage spell
|
||||
* Tests if a damage spell is selected as source the damage is prevented and is dealt to the controller of the damage spell
|
||||
*/
|
||||
@Test
|
||||
public void testPreventDamageFromSpell() {
|
||||
|
|
|
@ -36,7 +36,10 @@ public class GutterGrimeTest extends CardTestPlayerBase {
|
|||
|
||||
@Test
|
||||
public void testScenario2() {
|
||||
// Creature tokens you control get +1/+1 and have vigilance.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Intangible Virtue");
|
||||
// Whenever a nontoken creature you control dies, put a slime counter on Gutter Grime, then put a green Ooze creature token onto
|
||||
// the battlefield with "This creature's power and toughness are each equal to the number of slime counters on Gutter Grime."
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Gutter Grime");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Runeclaw Bear", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
|
||||
|
@ -44,8 +47,15 @@ public class GutterGrimeTest extends CardTestPlayerBase {
|
|||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Runeclaw Bear");
|
||||
|
||||
setStopAt(3, PhaseStep.END_TURN);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerA, "Runeclaw Bear", 1);
|
||||
assertGraveyardCount(playerA, "Lightning Bolt", 1);
|
||||
assertPermanentCount(playerA, "Gutter Grime", 1);
|
||||
assertPermanentCount(playerA, "Intangible Virtue", 1);
|
||||
|
||||
assertPermanentCount(playerA, "Ooze", 1);
|
||||
assertPowerToughness(playerA, "Ooze", 2, 2, Filter.ComparisonScope.Any);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,6 @@ public class ServantOfTheScaleTest extends CardTestPlayerBase {
|
|||
assertPermanentCount(playerA, "Silvercoat Lion", 1);
|
||||
assertPowerToughness(playerA, "Silvercoat Lion", 3,3);
|
||||
|
||||
assertGraveyardCount(playerB, "Lightning Bolt", 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package org.mage.test.cards.triggers.dies;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class SidisiBroodTyrantTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* Tests that if Sidisi, Brood Tyrant leaves the battlefield
|
||||
* before it's first ability resolves, there will be no Zombie token added to the battlefield
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
public void testDiesTriggeredAbility() {
|
||||
// {1}{B}{G}{U}
|
||||
// Whenever Sidisi, Brood Tyrant enters the battlefield or attacks, put the top three cards of your library into your graveyard
|
||||
// Whenever one or more creature cards are put into your graveyard from your library, put a 2/2 black Zombie creature token onto the battlefield.
|
||||
addCard(Zone.HAND, playerA, "Sidisi, Brood Tyrant");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
|
||||
addCard(Zone.LIBRARY, playerA, "Silvercoat Lion", 2);
|
||||
skipInitShuffling();
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain");
|
||||
addCard(Zone.HAND, playerB, "Lightning Bolt");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sidisi, Brood Tyrant");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", "Sidisi, Brood Tyrant", "Whenever {this} enters the battlefield");
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerB, "Lightning Bolt", 1);
|
||||
assertGraveyardCount(playerA, "Sidisi, Brood Tyrant", 1);
|
||||
|
||||
assertGraveyardCount(playerA, 4);
|
||||
assertPermanentCount(playerA, "Zombie", 0);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -48,7 +48,7 @@ public class LastKnownInformationTest extends CardTestPlayerBase {
|
|||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Lightning Bolt", "Safehold Elite");
|
||||
// choose triggered ability order
|
||||
playerA.addChoice("When enchanted creature dies");
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Lightning Bolt", "Safehold Elite", "When enchanted creature dies, put X 1/1 red and white Soldier creature token with haste onto the battlefield, where X is its power");
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Lightning Bolt", "Safehold Elite", "When enchanted creature dies");
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
|
|
@ -76,7 +76,8 @@ public class TriggeredAbilities extends ConcurrentHashMap<String, TriggeredAbili
|
|||
if (!game.getContinuousEffects().preventedByRuleModification(event, ability, game, false)) {
|
||||
if (object != null) {
|
||||
boolean controllerSet = false;
|
||||
if (!ability.getZone().equals(Zone.COMMAND) && (event.getType().equals(EventType.ZONE_CHANGE) || event.getType().equals(EventType.DESTROYED_PERMANENT))) {
|
||||
if (!ability.getZone().equals(Zone.COMMAND) && event.getTargetId() != null && event.getTargetId().equals(ability.getSourceId())
|
||||
&& (event.getType().equals(EventType.ZONE_CHANGE) || event.getType().equals(EventType.DESTROYED_PERMANENT))) {
|
||||
// need to check if object was face down for dies and destroy events because the ability triggers in the new zone, zone counter -1 is used
|
||||
Permanent permanent = (Permanent) game.getLastKnownInformation(ability.getSourceId(), Zone.BATTLEFIELD, ability.getSourceObjectZoneChangeCounter() - 1);
|
||||
if (permanent != null) {
|
||||
|
|
|
@ -173,7 +173,7 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge
|
|||
* leaves the zone and returns again before the ability resolves.) The most common zone-change
|
||||
* triggers are enters-the-battlefield triggers and leaves-the-battlefield triggers.
|
||||
*/
|
||||
if (event != null) {
|
||||
if (event != null && event.getTargetId() != null && event.getTargetId().equals(getSourceId())) {
|
||||
switch (event.getType()) {
|
||||
case ZONE_CHANGE:
|
||||
if (source == null && ((ZoneChangeEvent)event).getTarget() != null) {
|
||||
|
|
|
@ -66,13 +66,7 @@ public class PutTopCardOfLibraryIntoGraveControllerEffect extends OneShotEffect
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
int cardsCount = Math.min(numberCards, controller.getLibrary().size());
|
||||
for (int i = 0; i < cardsCount; i++) {
|
||||
Card card = controller.getLibrary().removeFromTop(game);
|
||||
if (card != null) {
|
||||
controller.moveCardToGraveyardWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
|
||||
}
|
||||
}
|
||||
controller.moveCardsToGraveyardWithInfo(controller.getLibrary().getTopCards(game, numberCards), source, game, Zone.LIBRARY);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -76,13 +76,7 @@ public class SetPowerToughnessSourceEffect extends ContinuousEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
MageObject mageObject;
|
||||
if (source.getZone() == Zone.BATTLEFIELD) {
|
||||
mageObject = source.getSourceObjectIfItStillExists(game);
|
||||
} else {
|
||||
mageObject = game.getObject(source.getSourceId()); // there are character definig abilities (e.g. P/T Nightmare) that have to work also for P/T of cards
|
||||
}
|
||||
|
||||
MageObject mageObject = game.getObject(source.getSourceId());
|
||||
if (mageObject == null) {
|
||||
if (duration.equals(Duration.Custom)) {
|
||||
discard();
|
||||
|
|
|
@ -787,7 +787,7 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
}
|
||||
|
||||
/**
|
||||
* Onl used for diagnostic purposes of tests
|
||||
* Only used for diagnostic purposes of tests
|
||||
* @return
|
||||
*/
|
||||
public TriggeredAbilities getTriggers() {
|
||||
|
|
|
@ -79,6 +79,13 @@ public class GameEvent {
|
|||
AT_END_OF_TURN,
|
||||
|
||||
//player events
|
||||
/* ZONE_CHANGE
|
||||
targetId id of the zone chaning object
|
||||
sourceId sourceId of the ability with the object moving effect
|
||||
playerId controller of the moved object
|
||||
amount not used for this event
|
||||
flag not used for this event
|
||||
*/
|
||||
ZONE_CHANGE,
|
||||
DRAW_CARD, DREW_CARD,
|
||||
MIRACLE_CARD_REVEALED,
|
||||
|
@ -142,7 +149,17 @@ public class GameEvent {
|
|||
TURNFACEDOWN, TURNEDFACEDOWN,
|
||||
DAMAGE_CREATURE, DAMAGED_CREATURE,
|
||||
DAMAGE_PLANESWALKER, DAMAGED_PLANESWALKER,
|
||||
DESTROY_PERMANENT, DESTROYED_PERMANENT,
|
||||
DESTROY_PERMANENT,
|
||||
|
||||
/* DESTROYED_PERMANENT
|
||||
targetId id of the destroyed creature
|
||||
sourceId sourceId of the ability with the destroy effect
|
||||
playerId controller of the creature
|
||||
amount not used for this event
|
||||
flag true if no regeneration is allowed
|
||||
*/
|
||||
DESTROYED_PERMANENT,
|
||||
|
||||
SACRIFICE_PERMANENT, SACRIFICED_PERMANENT,
|
||||
FIGHTED_PERMANENT,
|
||||
EXPLOITED_CREATURE,
|
||||
|
|
Loading…
Reference in a new issue