[J22] Implement Alandra, Sky Dreamer (#10219)

* Alandra Sky Dreamer
DrawSecondCardTriggeredAbility refactored into DrawCardTriggeredAbility
DynamicValue support for DrawCardTriggeredAbility
DynamicValue support for BoostAllOfChosenSubtypeEffect

* cardNumber as int
static use of cardwatcher

* removing spaces

* FaerieMastermind and ZimoneAndDina using the new generic DrawCardTriggeredAbility

* AlandraSkyDreamer and DrawCardTriggeredAbility test

* renaming DrawCardTriggeredAbility to DrawNthCardTriggeredAbility

* merging the boost effects into a single ability

* merging two effects to the same ability

* text added to effects

---------

Co-authored-by: drago <drago@192.168.1.72>
This commit is contained in:
amoscatelli 2023-04-17 15:12:18 +02:00 committed by GitHub
parent c270d282d0
commit 6059422afc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 214 additions and 78 deletions

View file

@ -0,0 +1,80 @@
package mage.cards.a;
import mage.MageInt;
import mage.abilities.common.DrawNthCardTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.game.permanent.token.DrakeToken;
import java.util.UUID;
import mage.abilities.dynamicvalue.common.CardsInControllerHandCount;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.constants.Duration;
import mage.filter.common.FilterCreaturePermanent;
/**
* @author amoscatelli
*/
public final class AlandraSkyDreamer extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent(SubType.DRAKE, "Drakes");
public AlandraSkyDreamer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}{U}");
addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.MERFOLK);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(2);
this.toughness = new MageInt(4);
// Whenever you draw your second card earch turn, create a 2/2 blue Drake creature token with flying.
this.addAbility(
new DrawNthCardTriggeredAbility(
new CreateTokenEffect(
new DrakeToken()
),
false,
2
)
);
// Whenever you draw your fifth card each turn, Alandra, Sky Dreamer and Drakes you control each get +X/+X until end of turn, where X is the number of cards in your hand.
DrawNthCardTriggeredAbility drawNthCardTriggeredAbility = new DrawNthCardTriggeredAbility(
new BoostSourceEffect(
CardsInControllerHandCount.instance,
CardsInControllerHandCount.instance,
Duration.EndOfTurn
).setText("{this}"),
false,
5
);
drawNthCardTriggeredAbility.addEffect(
new BoostControlledEffect(
CardsInControllerHandCount.instance,
CardsInControllerHandCount.instance,
Duration.EndOfTurn,
filter,
false
).setText("and Drakes you control each get +X/+X until end of turn, where X is the number of cards in your hand")
);
this.addAbility(
drawNthCardTriggeredAbility
);
}
private AlandraSkyDreamer(final AlandraSkyDreamer card) {
super(card);
}
@Override
public AlandraSkyDreamer copy() {
return new AlandraSkyDreamer(this);
}
}

View file

@ -2,7 +2,7 @@ package mage.cards.b;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DrawSecondCardTriggeredAbility;
import mage.abilities.common.DrawNthCardTriggeredAbility;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.keyword.FirstStrikeAbility;
@ -27,9 +27,9 @@ public final class BloodhazeWolverine extends CardImpl {
this.toughness = new MageInt(1);
// Whenever you draw your second card each turn, Bloodhaze Wolverine gets +1/+1 and gains first strike until end of turn.
Ability ability = new DrawSecondCardTriggeredAbility(new BoostSourceEffect(
Ability ability = new DrawNthCardTriggeredAbility(new BoostSourceEffect(
1, 1, Duration.EndOfTurn
).setText("{this} gets +1/+1"), false);
).setText("{this} gets +1/+1"), false, 2);
ability.addEffect(new GainAbilitySourceEffect(
FirstStrikeAbility.getInstance(), Duration.EndOfTurn
).setText("and gains first strike until end of turn"));

View file

@ -2,7 +2,7 @@ package mage.cards.d;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.DrawSecondCardTriggeredAbility;
import mage.abilities.common.DrawNthCardTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.ReturnSourceFromGraveyardToHandEffect;
import mage.abilities.effects.keyword.SurveilEffect;
@ -31,7 +31,7 @@ public final class DoggedDetective extends CardImpl {
this.addAbility(new EntersBattlefieldTriggeredAbility(new SurveilEffect(2)));
// Whenever an opponent draws their second card each turn, you may return Dogged Detective from your graveyard to your hand.
this.addAbility(new DrawSecondCardTriggeredAbility(Zone.GRAVEYARD, new ReturnSourceFromGraveyardToHandEffect(), true, TargetController.OPPONENT));
this.addAbility(new DrawNthCardTriggeredAbility(Zone.GRAVEYARD, new ReturnSourceFromGraveyardToHandEffect(), true, TargetController.OPPONENT, 2));
}
private DoggedDetective(final DoggedDetective card) {

View file

@ -1,7 +1,7 @@
package mage.cards.e;
import mage.MageInt;
import mage.abilities.common.DrawSecondCardTriggeredAbility;
import mage.abilities.common.DrawNthCardTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.dynamicvalue.common.OpponentsCount;
import mage.abilities.effects.common.CreateTokenEffect;
@ -34,8 +34,8 @@ public final class EtherealInvestigator extends CardImpl {
this.addAbility(new EntersBattlefieldTriggeredAbility(new InvestigateEffect(OpponentsCount.instance)));
// Whenever you draw your second card each turn, create a 1/1 white Spirit creature token with flying.
this.addAbility(new DrawSecondCardTriggeredAbility(
new CreateTokenEffect(new SpiritWhiteToken()), false
this.addAbility(new DrawNthCardTriggeredAbility(
new CreateTokenEffect(new SpiritWhiteToken()), false, 2
));
}

View file

@ -1,7 +1,7 @@
package mage.cards.f;
import mage.MageInt;
import mage.abilities.common.DrawSecondCardTriggeredAbility;
import mage.abilities.common.DrawNthCardTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.DrawCardAllEffect;
@ -32,10 +32,10 @@ public class FaerieMastermind extends CardImpl {
this.addAbility(FlyingAbility.getInstance());
//Whenever an opponent draws their second card each turn, you draw a card.
this.addAbility(new DrawSecondCardTriggeredAbility(
this.addAbility(new DrawNthCardTriggeredAbility(
new DrawCardSourceControllerEffect(1)
.setText("you draw a card"),
false, TargetController.OPPONENT
false, TargetController.OPPONENT, 2
));
//{3}{U}: Each player draws a card.

View file

@ -1,7 +1,7 @@
package mage.cards.f;
import mage.MageInt;
import mage.abilities.common.DrawSecondCardTriggeredAbility;
import mage.abilities.common.DrawNthCardTriggeredAbility;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.FlashAbility;
import mage.abilities.keyword.FlyingAbility;
@ -33,8 +33,8 @@ public final class FaerieVandal extends CardImpl {
this.addAbility(FlyingAbility.getInstance());
// Whenever you draw your second card each turn, put a +1/+1 counter on Faerie Vandal.
this.addAbility(new DrawSecondCardTriggeredAbility(
new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false
this.addAbility(new DrawNthCardTriggeredAbility(
new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false, 2
));
}

View file

@ -2,7 +2,7 @@ package mage.cards.g;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DrawSecondCardTriggeredAbility;
import mage.abilities.common.DrawNthCardTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.CyclingDiscardCost;
import mage.abilities.costs.mana.GenericManaCost;
@ -40,7 +40,7 @@ public final class GaviNestWarden extends CardImpl {
this.addAbility(new SimpleStaticAbility(new CyclingZeroCostEffect()), new GaviNestWardenWatcher());
// Whenever you draw your second card each turn, create a 2/2 red and white Dinosaur Cat creature token.
this.addAbility(new DrawSecondCardTriggeredAbility(new CreateTokenEffect(new DinosaurCatToken()), false));
this.addAbility(new DrawNthCardTriggeredAbility(new CreateTokenEffect(new DinosaurCatToken()), false, 2));
}
private GaviNestWarden(final GaviNestWarden card) {

View file

@ -4,7 +4,7 @@ import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesSourceTriggeredAbility;
import mage.abilities.common.DrawSecondCardTriggeredAbility;
import mage.abilities.common.DrawNthCardTriggeredAbility;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.LoseLifeOpponentsEffect;
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect;
@ -41,7 +41,7 @@ public final class GixianPuppeteer extends CardImpl {
this.toughness = new MageInt(3);
// Whenever you draw your second card each turn, each opponent loses 2 life and you gain 2 life.
Ability ability = new DrawSecondCardTriggeredAbility(new LoseLifeOpponentsEffect(2), false);
Ability ability = new DrawNthCardTriggeredAbility(new LoseLifeOpponentsEffect(2), false, 2);
ability.addEffect(new GainLifeEffect(2).concatBy("and"));
this.addAbility(ability);

View file

@ -4,7 +4,7 @@ import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.DiesSourceTriggeredAbility;
import mage.abilities.common.DrawSecondCardTriggeredAbility;
import mage.abilities.common.DrawNthCardTriggeredAbility;
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.FlyingAbility;
@ -52,7 +52,7 @@ public final class GurglingAnointer extends CardImpl {
this.addAbility(FlyingAbility.getInstance());
// Whenever you draw your second card each turn, put a +1/+1 counter on Gurgling Anointer.
this.addAbility(new DrawSecondCardTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false));
this.addAbility(new DrawNthCardTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false, 2));
// When Gurgling Anointer dies, return another target creature card with mana value less than or equal to Gurgling Anointer's power from your graveyard to the battlefield.
Ability ability = new DiesSourceTriggeredAbility(new ReturnFromGraveyardToBattlefieldTargetEffect());

View file

@ -1,6 +1,6 @@
package mage.cards.i;
import mage.abilities.common.DrawSecondCardTriggeredAbility;
import mage.abilities.common.DrawNthCardTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CreateTokenEffect;
@ -21,7 +21,7 @@ public final class ImprobableAlliance extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{U}{R}");
// Whenever you draw your second card each turn, create a 1/1 blue Faerie creature token with flying.
this.addAbility(new DrawSecondCardTriggeredAbility(new CreateTokenEffect(new FaerieToken()), false));
this.addAbility(new DrawNthCardTriggeredAbility(new CreateTokenEffect(new FaerieToken()), false, 2));
// {4}{U}{R}: Draw a card, then discard a card.
this.addAbility(new SimpleActivatedAbility(

View file

@ -2,7 +2,7 @@ package mage.cards.i;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DrawSecondCardTriggeredAbility;
import mage.abilities.common.DrawNthCardTriggeredAbility;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -26,7 +26,7 @@ public final class IrencragPyromancer extends CardImpl {
this.toughness = new MageInt(4);
// Whenever you draw your second card each turn, Irencrag Pyromancer deals 3 damage to any target.
Ability ability = new DrawSecondCardTriggeredAbility(new DamageTargetEffect(3), false);
Ability ability = new DrawNthCardTriggeredAbility(new DamageTargetEffect(3), false, 2);
ability.addTarget(new TargetAnyTarget());
this.addAbility(ability);
}

View file

@ -2,7 +2,7 @@ package mage.cards.j;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.DrawSecondCardTriggeredAbility;
import mage.abilities.common.DrawNthCardTriggeredAbility;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.combat.CantBeBlockedAllEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
@ -31,8 +31,8 @@ public final class JaceArcaneStrategist extends CardImpl {
this.setStartingLoyalty(4);
// Whenever you draw your second card each turn, put a +1/+1 counter on target creature you control.
Ability ability = new DrawSecondCardTriggeredAbility(
new AddCountersTargetEffect(CounterType.P1P1.createInstance()), false
Ability ability = new DrawNthCardTriggeredAbility(
new AddCountersTargetEffect(CounterType.P1P1.createInstance()), false, 2
);
ability.addTarget(new TargetControlledCreaturePermanent());
this.addAbility(ability);

View file

@ -2,7 +2,7 @@ package mage.cards.j;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.DrawSecondCardTriggeredAbility;
import mage.abilities.common.DrawNthCardTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;

View file

@ -1,7 +1,7 @@
package mage.cards.j;
import mage.MageInt;
import mage.abilities.common.DrawSecondCardTriggeredAbility;
import mage.abilities.common.DrawNthCardTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.CardsInControllerHandCount;
@ -33,7 +33,7 @@ public final class JolraelMwonvuliRecluse extends CardImpl {
this.toughness = new MageInt(2);
// Whenever you draw your second card each turn, create a 2/2 green Cat creature token.
this.addAbility(new DrawSecondCardTriggeredAbility(new CreateTokenEffect(new GreenCat2Token()), false));
this.addAbility(new DrawNthCardTriggeredAbility(new CreateTokenEffect(new GreenCat2Token()), false, 2));
// {4}{G}{G}: Until end of turn, creatures you control have base power and toughness X/X, where X is the number of cards in your hand.
this.addAbility(new SimpleActivatedAbility(new SetBasePowerToughnessAllEffect(

View file

@ -1,7 +1,7 @@
package mage.cards.l;
import mage.MageInt;
import mage.abilities.common.DrawSecondCardTriggeredAbility;
import mage.abilities.common.DrawNthCardTriggeredAbility;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -25,8 +25,8 @@ public final class LatNamAdept extends CardImpl {
this.toughness = new MageInt(3);
// Whenever you draw your second card each turn, put a +1/+1 counter on Lat-Nam Adept.
this.addAbility(new DrawSecondCardTriggeredAbility(
new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false
this.addAbility(new DrawNthCardTriggeredAbility(
new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false, 2
));
}

View file

@ -1,7 +1,7 @@
package mage.cards.m;
import mage.MageInt;
import mage.abilities.common.DrawSecondCardTriggeredAbility;
import mage.abilities.common.DrawNthCardTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -24,7 +24,7 @@ public final class MadRatter extends CardImpl {
this.toughness = new MageInt(2);
// Whenever you draw your second card each turn, create two 1/1 black Rat creature tokens.
this.addAbility(new DrawSecondCardTriggeredAbility(new CreateTokenEffect(new RatToken(), 2), false));
this.addAbility(new DrawNthCardTriggeredAbility(new CreateTokenEffect(new RatToken(), 2), false, 2));
}
private MadRatter(final MadRatter card) {

View file

@ -1,7 +1,7 @@
package mage.cards.m;
import mage.abilities.Ability;
import mage.abilities.common.DrawSecondCardTriggeredAbility;
import mage.abilities.common.DrawNthCardTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continuous.BoostEquippedEffect;
@ -29,9 +29,9 @@ public final class MantleOfTides extends CardImpl {
this.addAbility(new SimpleStaticAbility(new BoostEquippedEffect(1, 2)));
// Whenever you draw your second card each turn, attach Mantle of Tides to target creature you control.
Ability ability = new DrawSecondCardTriggeredAbility(new AttachEffect(
Ability ability = new DrawNthCardTriggeredAbility(new AttachEffect(
Outcome.Benefit, "attach {this} to target creature you control"
), false);
), false, 2);
ability.addTarget(new TargetControlledCreaturePermanent());
this.addAbility(ability);

View file

@ -3,7 +3,7 @@ package mage.cards.m;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesCreatureTriggeredAbility;
import mage.abilities.common.DrawSecondCardTriggeredAbility;
import mage.abilities.common.DrawNthCardTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.Card;
@ -41,8 +41,8 @@ public final class MinnWilyIllusionist extends CardImpl {
this.toughness = new MageInt(3);
// Whenever you draw your second card each turn, create a 1/1 blue Illusion creature token with "This creature gets +1/+0 for each other Illusion you control."
this.addAbility(new DrawSecondCardTriggeredAbility(
new CreateTokenEffect(new MinnWilyIllusionistToken()), false
this.addAbility(new DrawNthCardTriggeredAbility(
new CreateTokenEffect(new MinnWilyIllusionistToken()), false, 2
));
// Whenever an Illusion you control dies, you may put a permanent card with mana value less than or equal to that creature's power from your hand onto the battlefield.

View file

@ -1,7 +1,7 @@
package mage.cards.m;
import mage.MageInt;
import mage.abilities.common.DrawSecondCardTriggeredAbility;
import mage.abilities.common.DrawNthCardTriggeredAbility;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
@ -25,8 +25,8 @@ public final class MysticSkyfish extends CardImpl {
this.toughness = new MageInt(1);
// Whenever you draw your second card each turn, Mystic Skyfish gains flying until end of turn.
this.addAbility(new DrawSecondCardTriggeredAbility(
new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.EndOfTurn), false)
this.addAbility(new DrawNthCardTriggeredAbility(
new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.EndOfTurn), false, 2)
);
}

View file

@ -1,7 +1,7 @@
package mage.cards.s;
import mage.MageInt;
import mage.abilities.common.DrawSecondCardTriggeredAbility;
import mage.abilities.common.DrawNthCardTriggeredAbility;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
@ -28,7 +28,7 @@ public final class SteelgazeGriffin extends CardImpl {
this.addAbility(FlyingAbility.getInstance());
// When you draw your second card each turn, Steelgaze Griffin gets +2/+0 until end of turn.
this.addAbility(new DrawSecondCardTriggeredAbility(new BoostSourceEffect(2, 0, Duration.EndOfTurn), false));
this.addAbility(new DrawNthCardTriggeredAbility(new BoostSourceEffect(2, 0, Duration.EndOfTurn), false, 2));
}
private SteelgazeGriffin(final SteelgazeGriffin card) {

View file

@ -2,7 +2,7 @@ package mage.cards.t;
import mage.MageInt;
import mage.abilities.common.CastSecondSpellTriggeredAbility;
import mage.abilities.common.DrawSecondCardTriggeredAbility;
import mage.abilities.common.DrawNthCardTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.CardImpl;
@ -30,10 +30,10 @@ public final class TheCouncilOfFour extends CardImpl {
this.toughness = new MageInt(8);
// Whenever a player draws their second card during their turn, you draw a card.
this.addAbility(new DrawSecondCardTriggeredAbility(
this.addAbility(new DrawNthCardTriggeredAbility(
new DrawCardSourceControllerEffect(1)
.setText("you draw a card"),
false, TargetController.ACTIVE
false, TargetController.ACTIVE, 2
));
// Whenever a player casts their second spell during their turn, you create a 2/2 white Knight creature token.

View file

@ -2,7 +2,7 @@ package mage.cards.t;
import mage.MageInt;
import mage.abilities.common.DiesSourceTriggeredAbility;
import mage.abilities.common.DrawSecondCardTriggeredAbility;
import mage.abilities.common.DrawNthCardTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
@ -28,8 +28,8 @@ public final class ThopterMechanic extends CardImpl {
this.toughness = new MageInt(1);
// Whenever you draw your second card each turn, put a +1/+1 counter on Thopter Mechanic.
this.addAbility(new DrawSecondCardTriggeredAbility(
new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false
this.addAbility(new DrawNthCardTriggeredAbility(
new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false, 2
));
// When Thopter Mechanic dies, create a 1/1 colorless Thopter artifact creature token with flying.

View file

@ -2,7 +2,7 @@ package mage.cards.z;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DrawSecondCardTriggeredAbility;
import mage.abilities.common.DrawNthCardTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.costs.common.TapSourceCost;
@ -36,7 +36,7 @@ public final class ZimoneAndDina extends CardImpl {
this.toughness = new MageInt(4);
// Whenever you draw your second card each turn, target opponent loses 2 life and you gain 2 life.
Ability ability = new DrawSecondCardTriggeredAbility(new LoseLifeTargetEffect(2), false);
Ability ability = new DrawNthCardTriggeredAbility(new LoseLifeTargetEffect(2), false, 2);
ability.addEffect(new GainLifeEffect(2).concatBy("and"));
ability.addTarget(new TargetOpponent());
this.addAbility(ability);

View file

@ -32,6 +32,7 @@ public final class Jumpstart2022 extends ExpansionSet {
cards.add(new SetCardInfo("Aftershock", 129, Rarity.COMMON, mage.cards.a.Aftershock.class));
cards.add(new SetCardInfo("Ajani's Pridemate", 142, Rarity.UNCOMMON, mage.cards.a.AjanisPridemate.class));
cards.add(new SetCardInfo("Ajani, Strength of the Pride", 141, Rarity.MYTHIC, mage.cards.a.AjaniStrengthOfThePride.class));
cards.add(new SetCardInfo("Alandra, Sky Dreamer", 9, Rarity.RARE, mage.cards.a.AlandraSkyDreamer.class));
cards.add(new SetCardInfo("Alchemist's Vial", 753, Rarity.COMMON, mage.cards.a.AlchemistsVial.class));
cards.add(new SetCardInfo("Alley Strangler", 375, Rarity.COMMON, mage.cards.a.AlleyStrangler.class));
cards.add(new SetCardInfo("Alseid of Life's Bounty", 143, Rarity.UNCOMMON, mage.cards.a.AlseidOfLifesBounty.class));

View file

@ -0,0 +1,48 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.mage.test.cards.triggers;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
public class AlandraSkyDreamerTest extends CardTestPlayerBase {
@Test
public void testDraw2() {
addCard(Zone.HAND, playerA, "Inspiration");
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
addCard(Zone.BATTLEFIELD, playerA, "Alandra, Sky Dreamer", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Inspiration", playerA);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertHandCount(playerA, 2);
assertPermanentCount(playerA, "Drake Token", 1);
assertPowerToughness(playerA, "Drake Token", 2, 2);
assertPowerToughness(playerA, "Alandra, Sky Dreamer", 2, 4);
}
@Test
public void testDraw5() {
addCard(Zone.HAND, playerA, "Inspiration");
addCard(Zone.HAND, playerA, "Ancestral Recall");
addCard(Zone.BATTLEFIELD, playerA, "Island", 5);
addCard(Zone.BATTLEFIELD, playerA, "Alandra, Sky Dreamer", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Inspiration", playerA);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Ancestral Recall", playerA);
setStopAt(1, PhaseStep.END_TURN);
execute();
int drawnCards = 5;
assertHandCount(playerA, drawnCards);
assertPermanentCount(playerA, "Drake Token", 1);
assertPowerToughness(playerA, "Drake Token", 2 + drawnCards, 2 + drawnCards);
assertPowerToughness(playerA, "Alandra, Sky Dreamer", 2 + drawnCards, 4 + drawnCards);
}
}

View file

@ -18,32 +18,35 @@ import java.util.*;
/**
* @author TheElk801
*/
public class DrawSecondCardTriggeredAbility extends TriggeredAbilityImpl {
public class DrawNthCardTriggeredAbility extends TriggeredAbilityImpl {
private static final Hint hint = new ValueHint(
"Cards drawn this turn", CardsDrawnThisTurnDynamicValue.instance
);
private final TargetController targetController;
private final int cardNumber;
public DrawSecondCardTriggeredAbility(Effect effect, boolean optional) {
this(effect, optional, TargetController.YOU);
public DrawNthCardTriggeredAbility(Effect effect, boolean optional, int cardNumber) {
this(effect, optional, TargetController.YOU, cardNumber);
}
public DrawSecondCardTriggeredAbility(Effect effect, boolean optional, TargetController targetController) {
this(Zone.BATTLEFIELD, effect, optional, targetController);
public DrawNthCardTriggeredAbility(Effect effect, boolean optional, TargetController targetController, int cardNumber) {
this(Zone.BATTLEFIELD, effect, optional, targetController, cardNumber);
}
public DrawSecondCardTriggeredAbility(Zone zone, Effect effect, boolean optional, TargetController targetController) {
public DrawNthCardTriggeredAbility(Zone zone, Effect effect, boolean optional, TargetController targetController, int cardNumber) {
super(zone, effect, optional);
this.addWatcher(new DrawSecondCardWatcher());
this.addWatcher(new DrawCardWatcher());
this.targetController = targetController;
this.cardNumber = cardNumber;
this.addHint(hint);
setTriggerPhrase(generateTriggerPhrase());
}
private DrawSecondCardTriggeredAbility(final DrawSecondCardTriggeredAbility ability) {
private DrawNthCardTriggeredAbility(final DrawNthCardTriggeredAbility ability) {
super(ability);
this.targetController = ability.targetController;
this.cardNumber = ability.cardNumber;
}
@Override
@ -73,7 +76,7 @@ public class DrawSecondCardTriggeredAbility extends TriggeredAbilityImpl {
default:
throw new IllegalArgumentException("TargetController " + targetController + " not supported");
}
return DrawSecondCardWatcher.checkEvent(event.getPlayerId(), event, game);
return DrawCardWatcher.checkEvent(event.getPlayerId(), event, game, cardNumber);
}
public String generateTriggerPhrase() {
@ -90,17 +93,16 @@ public class DrawSecondCardTriggeredAbility extends TriggeredAbilityImpl {
}
@Override
public DrawSecondCardTriggeredAbility copy() {
return new DrawSecondCardTriggeredAbility(this);
public DrawNthCardTriggeredAbility copy() {
return new DrawNthCardTriggeredAbility(this);
}
}
class DrawSecondCardWatcher extends Watcher {
class DrawCardWatcher extends Watcher {
private final Set<UUID> drewOnce = new HashSet<>();
private final Map<UUID, UUID> secondDrawMap = new HashMap<>();
private final Map<UUID, List<UUID>> drawMap = new HashMap<>();
DrawSecondCardWatcher() {
DrawCardWatcher() {
super(WatcherScope.GAME);
}
@ -109,21 +111,21 @@ class DrawSecondCardWatcher extends Watcher {
if (event.getType() != GameEvent.EventType.DREW_CARD) {
return;
}
if (drewOnce.contains(event.getPlayerId())) {
secondDrawMap.putIfAbsent(event.getPlayerId(), event.getId());
} else {
drewOnce.add(event.getPlayerId());
if (!drawMap.containsKey(event.getPlayerId())) {
drawMap.putIfAbsent(event.getPlayerId(), new ArrayList<>());
}
drawMap.get(event.getPlayerId()).add(event.getId());
}
@Override
public void reset() {
super.reset();
drewOnce.clear();
secondDrawMap.clear();
drawMap.clear();
}
static boolean checkEvent(UUID playerId, GameEvent event, Game game) {
return event.getId().equals(game.getState().getWatcher(DrawSecondCardWatcher.class).secondDrawMap.getOrDefault(playerId, null));
static boolean checkEvent(UUID playerId, GameEvent event, Game game, int cardNumber) {
Map<UUID, List<UUID>> drawMap = game.getState().getWatcher(DrawCardWatcher.class).drawMap;
return drawMap.containsKey(playerId) && Objects.equals(drawMap.get(playerId).size(), cardNumber) && event.getId().equals(drawMap.get(playerId).get(cardNumber - 1));
}
}

View file

@ -1,6 +1,7 @@
package mage.abilities.effects.common.continuous;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.common.ChooseCreatureTypeEffect;
import mage.constants.Duration;
import mage.constants.SubType;
@ -23,6 +24,10 @@ public class BoostAllOfChosenSubtypeEffect extends BoostAllEffect {
super(power, toughness, duration, filter, excludeSource);
}
public BoostAllOfChosenSubtypeEffect(DynamicValue power, DynamicValue toughness, Duration duration, FilterCreaturePermanent filter, boolean excludeSource) {
super(power, toughness, duration, filter, excludeSource);
}
public BoostAllOfChosenSubtypeEffect(final BoostAllOfChosenSubtypeEffect effect) {
super(effect);
this.subtype = effect.subtype;