mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 03:22:00 -08:00
Added handling to make it possible that a transformable card can enter the battlefield transformed.
This commit is contained in:
parent
d8df53dde7
commit
27929cccba
3 changed files with 17 additions and 0 deletions
|
|
@ -18,6 +18,12 @@ public class TwoFacedCardEffectsTest extends CardTestPlayerBase {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testEffectTurnedOffOnTransform() {
|
public void testEffectTurnedOffOnTransform() {
|
||||||
|
// Other Human creatures you control get +1/+1.
|
||||||
|
// At the beginning of each upkeep, if no spells were cast last turn, transform Mayor of Avabruck.
|
||||||
|
// Howlpack Alpha (transformed side) ----------------
|
||||||
|
// Each other creature you control that's a Werewolf or a Wolf gets +1/+1.
|
||||||
|
// At the beginning of your end step, put a 2/2 green Wolf creature token onto the battlefield.
|
||||||
|
// At the beginning of each upkeep, if a player cast two or more spells last turn, transform Howlpack Alpha.
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Mayor of Avabruck");
|
addCard(Zone.BATTLEFIELD, playerA, "Mayor of Avabruck");
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Wolfir Avenger");
|
addCard(Zone.BATTLEFIELD, playerA, "Wolfir Avenger");
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Elite Inquisitor");
|
addCard(Zone.BATTLEFIELD, playerA, "Elite Inquisitor");
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,9 @@ public class TransformAbility extends SimpleStaticAbility {
|
||||||
public static final String NO_SPELLS_TRANSFORM_RULE = "At the beginning of each upkeep, if no spells were cast last turn, transform {this}.";
|
public static final String NO_SPELLS_TRANSFORM_RULE = "At the beginning of each upkeep, if no spells were cast last turn, transform {this}.";
|
||||||
public static final String TWO_OR_MORE_SPELLS_TRANSFORM_RULE = "At the beginning of each upkeep, if a player cast two or more spells last turn, transform {this}.";
|
public static final String TWO_OR_MORE_SPELLS_TRANSFORM_RULE = "At the beginning of each upkeep, if a player cast two or more spells last turn, transform {this}.";
|
||||||
|
|
||||||
|
// this state value controlls if a permanent enters the battlefield already transformed
|
||||||
|
public static final String VALUE_KEY_ENTER_TRANSFORMED = "EnterTransformed";
|
||||||
|
|
||||||
public TransformAbility() {
|
public TransformAbility() {
|
||||||
super(Zone.BATTLEFIELD, new TransformEffect());
|
super(Zone.BATTLEFIELD, new TransformEffect());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.costs.mana.ManaCost;
|
import mage.abilities.costs.mana.ManaCost;
|
||||||
import mage.abilities.costs.mana.ManaCosts;
|
import mage.abilities.costs.mana.ManaCosts;
|
||||||
|
import mage.abilities.keyword.TransformAbility;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.LevelerCard;
|
import mage.cards.LevelerCard;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
|
|
@ -65,6 +66,13 @@ public class PermanentCard extends PermanentImpl {
|
||||||
if (card instanceof LevelerCard) {
|
if (card instanceof LevelerCard) {
|
||||||
maxLevelCounters = ((LevelerCard) card).getMaxLevelCounters();
|
maxLevelCounters = ((LevelerCard) card).getMaxLevelCounters();
|
||||||
}
|
}
|
||||||
|
if (canTransform()) {
|
||||||
|
if (game.getState().getValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + getId()) != null) {
|
||||||
|
game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + getId(), null);
|
||||||
|
setTransformed(true);
|
||||||
|
TransformAbility.transform(this, getSecondCardFace(), game);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PermanentCard(final PermanentCard permanent) {
|
public PermanentCard(final PermanentCard permanent) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue