[M20] added Thunderkin Awakener

This commit is contained in:
Oleg Agafonov 2019-06-29 18:03:12 +04:00
parent 606c0ae61a
commit 46d030d37a
4 changed files with 181 additions and 17 deletions

View file

@ -0,0 +1,131 @@
package mage.cards.t;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.InfoEffect;
import mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlTargetEffect;
import mage.abilities.effects.common.SacrificeTargetEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.mageobject.ToughnessPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCardInYourGraveyard;
import mage.target.targetadjustment.TargetAdjuster;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
* @author JayDi85
*/
public final class ThunderkinAwakener extends CardImpl {
public ThunderkinAwakener(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}");
this.subtype.add(SubType.ELEMENTAL);
this.subtype.add(SubType.SHAMAN);
this.power = new MageInt(1);
this.toughness = new MageInt(2);
// Haste
this.addAbility(HasteAbility.getInstance());
// Whenever Thunderkin Awakener attacks, choose target Elemental creature card in your graveyard
// with toughness less than Thunderkin Awakeners toughness. Return that card to the battlefield tapped and attacking.
// Sacrifice it at the beginning of the next end step.
Ability ability = new AttacksTriggeredAbility(new ThunderkinAwakenerEffect(), false);
ability.setTargetAdjuster(ThunderkinAwakenerAdjuster.instance);
this.addAbility(ability);
}
public ThunderkinAwakener(final ThunderkinAwakener card) {
super(card);
}
@Override
public ThunderkinAwakener copy() {
return new ThunderkinAwakener(this);
}
}
enum ThunderkinAwakenerAdjuster implements TargetAdjuster {
instance;
@Override
public void adjustTargets(Ability ability, Game game) {
// target Elemental creature card in your graveyard with toughness less than Thunderkin Awakeners toughness
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(ability.getSourceId());
if (sourcePermanent != null) {
int xValue = sourcePermanent.getToughness().getValue();
FilterCard filter = new FilterCreatureCard("creature card in your graveyard with toughness less than Thunderkin Awakeners toughness");
filter.add(new SubtypePredicate(SubType.ELEMENTAL));
filter.add(new ToughnessPredicate(ComparisonType.FEWER_THAN, xValue + 1));
ability.getTargets().clear();
ability.addTarget(new TargetCardInYourGraveyard(filter));
}
}
}
class ThunderkinAwakenerEffect extends OneShotEffect {
public ThunderkinAwakenerEffect() {
super(Outcome.Benefit);
staticText = "choose target Elemental creature card in your graveyard with toughness less than Thunderkin Awakeners toughness."
+ " Return that card to the battlefield tapped and attacking. Sacrifice it at the beginning of the next end step";
}
public ThunderkinAwakenerEffect(final ThunderkinAwakenerEffect effect) {
super(effect);
}
@Override
public ThunderkinAwakenerEffect copy() {
return new ThunderkinAwakenerEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Card creatureCard = game.getCard(this.getTargetPointer().getFirst(game, source));
if (controller != null && creatureCard != null) {
// Return that card to the battlefield tapped and attacking
Effect effect = new ReturnToBattlefieldUnderYourControlTargetEffect(false, true, true);
effect.setTargetPointer(new FixedTarget(creatureCard.getId()));
effect.apply(game, source);
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (permanent != null) {
// Sacrifice it at the beginning of the next end step
SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect("Sacrifice " + permanent.getName(), source.getControllerId());
sacrificeEffect.setTargetPointer(new FixedTarget(permanent, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect);
game.addDelayedTriggeredAbility(delayedAbility, source);
// info
InfoEffect.addInfoToPermanent(game, source, permanent, "<i><b>Warning</b>: It will be sacrificed at the beginning of the next end step<i>");
}
return true;
}
return false;
}
}

View file

@ -309,6 +309,7 @@ public final class CoreSet2020 extends ExpansionSet {
cards.add(new SetCardInfo("Thornwood Falls", 258, Rarity.COMMON, mage.cards.t.ThornwoodFalls.class));
cards.add(new SetCardInfo("Thought Distortion", 117, Rarity.UNCOMMON, mage.cards.t.ThoughtDistortion.class));
cards.add(new SetCardInfo("Thrashing Brontodon", 197, Rarity.UNCOMMON, mage.cards.t.ThrashingBrontodon.class));
cards.add(new SetCardInfo("Thunderkin Awakener", 162, Rarity.RARE, mage.cards.t.ThunderkinAwakener.class));
cards.add(new SetCardInfo("Tomebound Lich", 219, Rarity.UNCOMMON, mage.cards.t.TomeboundLich.class));
cards.add(new SetCardInfo("Tranquil Cove", 259, Rarity.COMMON, mage.cards.t.TranquilCove.class));
cards.add(new SetCardInfo("Twinblade Paladin", 285, Rarity.UNCOMMON, mage.cards.t.TwinbladePaladin.class));