mirror of
https://github.com/correl/mage.git
synced 2024-11-25 03:00:11 +00:00
[SWS] fixed miss ability from Zam Wesell (#9799)
Co-authored-by: Daniel Eberhard <daniel.h.e@gmx.de>
This commit is contained in:
parent
716e7dc18d
commit
c5c5fa933a
1 changed files with 27 additions and 22 deletions
|
@ -3,10 +3,12 @@ package mage.cards.z;
|
|||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.condition.FixedCondition;
|
||||
import mage.abilities.condition.common.AttachedCondition;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CastSourceTriggeredAbility;
|
||||
import mage.abilities.effects.common.CopyEffect;
|
||||
import mage.abilities.effects.common.RevealHandTargetEffect;
|
||||
import mage.abilities.effects.common.*;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -15,11 +17,13 @@ import mage.filter.StaticFilters;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetOpponent;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.common.*;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Styxo
|
||||
* @author Styxo, Merlingilb
|
||||
*/
|
||||
public final class ZamWesell extends CardImpl {
|
||||
|
||||
|
@ -31,10 +35,7 @@ public final class ZamWesell extends CardImpl {
|
|||
this.toughness = new MageInt(2);
|
||||
|
||||
// When you cast Zam Wesell, target opponent reveals their hand. You may choose a creature card from it and have Zam Wesell enter the battlefield as a copy of that creature card.
|
||||
// TODO: Zam Wesell must be reworked to use on cast + etb abilities
|
||||
Ability ability = new CastSourceTriggeredAbility(new RevealHandTargetEffect());
|
||||
ability.addEffect(new ZamWesselEffect());
|
||||
ability.addTarget(new TargetOpponent());
|
||||
Ability ability = new EntersBattlefieldAbility(new ZamWesselEffect(), new FixedCondition(true), "When you cast {this}, target opponent reveals his or her hand. You may choose a creature card from it and have {this} enter the battlefield as a copy of that creature card.", "");
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
@ -52,7 +53,7 @@ class ZamWesselEffect extends OneShotEffect {
|
|||
|
||||
public ZamWesselEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "You may choose a creature card from it and have {this} enter the battlefield as a copy of that creature card";
|
||||
this.staticText = "";
|
||||
}
|
||||
|
||||
public ZamWesselEffect(final ZamWesselEffect effect) {
|
||||
|
@ -66,21 +67,25 @@ class ZamWesselEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
if (targetPlayer != null) {
|
||||
TargetCard targetCard = new TargetCard(0, 1, Zone.HAND, StaticFilters.FILTER_CARD_CREATURE);
|
||||
controller.choose(outcome, targetPlayer.getHand(), targetCard, game);
|
||||
Card copyFromCard = game.getCard(targetCard.getFirstTarget());
|
||||
if (copyFromCard != null) {
|
||||
game.informPlayers(controller.getLogName() + " chooses to copy " + copyFromCard.getName());
|
||||
CopyEffect copyEffect = new CopyEffect(Duration.Custom, copyFromCard, source.getSourceId());
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
TargetPlayer targetOpponent = new TargetOpponent();
|
||||
if (you.chooseTarget(Outcome.Benefit, targetOpponent, source, game)) {
|
||||
Player targetPlayer = game.getPlayer(targetOpponent.getFirstTarget());
|
||||
if (targetPlayer != null && you != null) {
|
||||
if (!targetPlayer.getHand().isEmpty()) {
|
||||
TargetCard target = new TargetCard(0, 1, Zone.HAND, StaticFilters.FILTER_CARD_CREATURE);
|
||||
if (you.chooseTarget(Outcome.Benefit, targetPlayer.getHand(), target, source, game)) {
|
||||
Card card = game.getCard(target.getFirstTarget());
|
||||
if (card != null) {
|
||||
ContinuousEffect copyEffect = new CopyEffect(Duration.EndOfGame, card.getMainCard(), source.getSourceId());
|
||||
copyEffect.setTargetPointer(new FixedTarget(source.getSourceId(), game));
|
||||
game.addEffect(copyEffect, source);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue