mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
Fixed a problem that tokens that came into play with modified attributes (P/T e.g. from Master of Etherium) were seen for triggered abilities (e.g. Sword of the Meek ) with unmodified attributes.
This commit is contained in:
parent
06f9e3db19
commit
0ccaca4a3b
8 changed files with 106 additions and 14 deletions
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
|
@ -28,8 +28,6 @@
|
|||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.*;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||
|
@ -37,6 +35,7 @@ import mage.abilities.effects.common.continuous.BoostControlledEffect;
|
|||
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
|
@ -58,13 +57,17 @@ public class MasterOfEtherium extends CardImpl {
|
|||
}
|
||||
|
||||
public MasterOfEtherium(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{2}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{2}{U}");
|
||||
this.subtype.add("Vedalken");
|
||||
this.subtype.add("Wizard");
|
||||
|
||||
this.power = new MageInt(0);
|
||||
this.toughness = new MageInt(0);
|
||||
|
||||
// Master of Etherium's power and toughness are each equal to the number of artifacts you control.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetPowerToughnessSourceEffect(new PermanentsOnBattlefieldCount(filterCounted), Duration.EndOfGame)));
|
||||
|
||||
// Other artifact creatures you control get +1/+1.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, filterBoosted, true)));
|
||||
}
|
||||
|
||||
|
|
|
@ -28,8 +28,6 @@
|
|||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SpellCastControllerTriggeredAbility;
|
||||
|
@ -38,6 +36,7 @@ import mage.abilities.costs.mana.GenericManaCost;
|
|||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.filter.common.FilterArtifactSpell;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.token.MyrToken;
|
||||
|
@ -47,19 +46,21 @@ import mage.game.permanent.token.MyrToken;
|
|||
* @author Loki, North
|
||||
*/
|
||||
public class Myrsmith extends CardImpl {
|
||||
public Myrsmith (UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{W}");
|
||||
|
||||
public Myrsmith(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}");
|
||||
this.subtype.add("Human");
|
||||
this.subtype.add("Artificer");
|
||||
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(1);
|
||||
|
||||
// Whenever you cast an artifact spell, you may pay {1}. If you do, put a 1/1 colorless Myr artifact creature token onto the battlefield.
|
||||
FilterArtifactSpell filter = new FilterArtifactSpell("an artifact spell");
|
||||
this.addAbility(new SpellCastControllerTriggeredAbility(new MyrsmithEffect(), filter, false));
|
||||
}
|
||||
|
||||
public Myrsmith (final Myrsmith card) {
|
||||
public Myrsmith(final Myrsmith card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
@ -70,6 +71,7 @@ public class Myrsmith extends CardImpl {
|
|||
}
|
||||
|
||||
class MyrsmithEffect extends CreateTokenEffect {
|
||||
|
||||
public MyrsmithEffect() {
|
||||
super(new MyrToken());
|
||||
staticText = "you may pay {1}. If you do, create a 1/1 colorless Myr artifact creature token";
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* 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.abilities.equipped;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.permanent.Permanent;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class SwordOfTheMeekTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* Played a game vs. the AI when I noticed the following:
|
||||
*
|
||||
* Had Master of Etherium and Myrsmith in play, Sword of the Meek in the
|
||||
* graveyard. I cast an artifact spell, Myrsmith triggers. I pay {1} to get
|
||||
* a Myr token which enters the battlefield as a 2/2 (due to Master of
|
||||
* Etherium), but Sword of the Meek triggers regardless and I can have it
|
||||
* enter the battlefield attached to the token. Also, Myrsmith's trigger
|
||||
* wasn't optional, it didn't ask whether I wanted to pay or not.
|
||||
*/
|
||||
@Test
|
||||
public void testEquipAlive() {
|
||||
// Master of Etherium's power and toughness are each equal to the number of artifacts you control.
|
||||
// Other artifact creatures you control get +1/+1.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Master of Etherium", 1); // Creature 1/1
|
||||
|
||||
// Whenever you cast an artifact spell, you may pay . If you do, put a 1/1 colorless Myr artifact creature token onto the battlefield.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Myrsmith", 1); // Creature 1/1
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
|
||||
addCard(Zone.HAND, playerA, "Chromatic Star");
|
||||
|
||||
// Equipped creature gets +1/+2.
|
||||
// Equip {2}
|
||||
// Whenever a 1/1 creature enters the battlefield under your control, you may return Sword of the Meek from your graveyard to the battlefield, then attach it to that creature.
|
||||
addCard(Zone.GRAVEYARD, playerA, "Sword of the Meek");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Chromatic Star");
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Chromatic Star", 1);
|
||||
|
||||
assertPermanentCount(playerA, "Myr", 1);
|
||||
assertPowerToughness(playerA, "Myr", 2, 2);
|
||||
assertPermanentCount(playerA, "Sword of the Meek", 0);
|
||||
assertPowerToughness(playerA, "Master of Etherium", 3, 3);
|
||||
|
||||
Permanent myr = getPermanent("Myr", playerA.getId());
|
||||
Assert.assertTrue("Myr may not have any attachments", myr.getAttachments().isEmpty());
|
||||
}
|
||||
|
||||
}
|
|
@ -54,6 +54,7 @@ public class ReflectingPoolTest extends CardTestPlayerBase {
|
|||
addCard(Zone.HAND, playerA, "Crumbling Vestige", 1);
|
||||
|
||||
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Crumbling Vestige");
|
||||
setChoice(playerA, "Red");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
|
|
|
@ -97,6 +97,7 @@ public class CreateTokenEffect extends OneShotEffect {
|
|||
token.putOntoBattlefield(value, game, source.getSourceId(), source.getControllerId(), tapped, attacking);
|
||||
this.lastAddedTokenId = token.getLastAddedToken();
|
||||
this.lastAddedTokenIds = token.getLastAddedTokenIds();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -146,7 +146,6 @@ public class BoostControlledEffect extends ContinuousEffectImpl {
|
|||
perm.addToughness(toughness.calculate(game, source, this));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -544,11 +544,10 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
// 608.2e
|
||||
public void processAction(Game game) {
|
||||
game.getState().handleSimultaneousEvent(game);
|
||||
applyEffects(game);
|
||||
game.applyEffects();
|
||||
}
|
||||
|
||||
public void applyEffects(Game game) {
|
||||
game.resetShortLivingLKI();
|
||||
for (Player player : players.values()) {
|
||||
player.reset();
|
||||
}
|
||||
|
@ -563,13 +562,13 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
public void removeEocEffects(Game game) {
|
||||
effects.removeEndOfCombatEffects();
|
||||
delayed.removeEndOfCombatAbilities();
|
||||
applyEffects(game);
|
||||
game.applyEffects();
|
||||
}
|
||||
|
||||
public void removeEotEffects(Game game) {
|
||||
effects.removeEndOfTurnEffects();
|
||||
delayed.removeEndOfTurnAbilities();
|
||||
applyEffects(game);
|
||||
game.applyEffects();
|
||||
}
|
||||
|
||||
public void addEffect(ContinuousEffect effect, Ability source) {
|
||||
|
|
|
@ -234,6 +234,7 @@ public class Token extends MageObjectImpl {
|
|||
}
|
||||
|
||||
}
|
||||
game.getState().applyEffects(game); // Needed to do it here without LKIReset i.e. do get SwordOfTheMeekTest running correctly.
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue