[TDM] Implement Lie in Wait (#13494)

* Implemented Lie in Wait

* code refactor

* improve ability
This commit is contained in:
androosss 2025-04-07 14:31:16 +02:00 committed by GitHub
parent 9613bae684
commit b84143bfca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 87 additions and 0 deletions

View file

@ -0,0 +1,86 @@
package mage.cards.l;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.common.TargetCardInYourGraveyard;
import mage.target.targetpointer.EachTargetPointer;
/**
*
* @author androosss
*/
public final class LieInWait extends CardImpl {
public LieInWait(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{B}{G}{U}");
// Return target creature card from your graveyard to your hand. Lie in Wait deals damage equal to that card's power to target creature.
this.getSpellAbility().addEffect(new LieInWaitTargetEffect());
this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_CREATURE));
this.getSpellAbility().addTarget(new TargetPermanent(StaticFilters.FILTER_PERMANENT_CREATURE));
}
private LieInWait(final LieInWait card) {
super(card);
}
@Override
public LieInWait copy() {
return new LieInWait(this);
}
}
class LieInWaitTargetEffect extends OneShotEffect {
LieInWaitTargetEffect() {
super(Outcome.Benefit);
staticText = "Return target creature card from your graveyard to your hand. "
+ "{this} deals damage equal to that card's power to target creature";
setTargetPointer(new EachTargetPointer());
}
private LieInWaitTargetEffect(final LieInWaitTargetEffect effect) {
super(effect);
}
@Override
public LieInWaitTargetEffect copy() {
return new LieInWaitTargetEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
List<UUID> targets = getTargetPointer().getTargets(game, source);
Card card = game.getCard(targets.get(0));
if (card == null) {
return false;
}
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
boolean result = card.moveToZone(Zone.HAND, source, game,false);
if (result && targets.size() >= 2) {
int power = card.getPower().getValue();
Permanent permanent = game.getPermanent(targets.get(1));
permanent.damage(power, source, game);
}
return result;
}
}

View file

@ -132,6 +132,7 @@ public final class TarkirDragonstorm extends ExpansionSet {
cards.add(new SetCardInfo("Knockout Maneuver", 147, Rarity.UNCOMMON, mage.cards.k.KnockoutManeuver.class));
cards.add(new SetCardInfo("Kotis, the Fangkeeper", 202, Rarity.RARE, mage.cards.k.KotisTheFangkeeper.class));
cards.add(new SetCardInfo("Krotiq Nestguard", 148, Rarity.COMMON, mage.cards.k.KrotiqNestguard.class));
cards.add(new SetCardInfo("Lie in Wait", 203, Rarity.UNCOMMON, mage.cards.l.LieInWait.class));
cards.add(new SetCardInfo("Lightfoot Technique", 14, Rarity.COMMON, mage.cards.l.LightfootTechnique.class));
cards.add(new SetCardInfo("Lotuslight Dancers", 204, Rarity.RARE, mage.cards.l.LotuslightDancers.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Lotuslight Dancers", 363, Rarity.RARE, mage.cards.l.LotuslightDancers.class, NON_FULL_USE_VARIOUS));