mirror of
https://github.com/correl/mage.git
synced 2024-11-25 11:09:53 +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 java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
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.OneShotEffect;
|
||||||
import mage.abilities.effects.common.CastSourceTriggeredAbility;
|
import mage.abilities.effects.common.*;
|
||||||
import mage.abilities.effects.common.CopyEffect;
|
|
||||||
import mage.abilities.effects.common.RevealHandTargetEffect;
|
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
|
@ -15,11 +17,13 @@ import mage.filter.StaticFilters;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.TargetCard;
|
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 {
|
public final class ZamWesell extends CardImpl {
|
||||||
|
|
||||||
|
@ -31,10 +35,7 @@ public final class ZamWesell extends CardImpl {
|
||||||
this.toughness = new MageInt(2);
|
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.
|
// 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 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.", "");
|
||||||
Ability ability = new CastSourceTriggeredAbility(new RevealHandTargetEffect());
|
|
||||||
ability.addEffect(new ZamWesselEffect());
|
|
||||||
ability.addTarget(new TargetOpponent());
|
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ class ZamWesselEffect extends OneShotEffect {
|
||||||
|
|
||||||
public ZamWesselEffect() {
|
public ZamWesselEffect() {
|
||||||
super(Outcome.Benefit);
|
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) {
|
public ZamWesselEffect(final ZamWesselEffect effect) {
|
||||||
|
@ -66,21 +67,25 @@ class ZamWesselEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player you = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null) {
|
TargetPlayer targetOpponent = new TargetOpponent();
|
||||||
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
|
if (you.chooseTarget(Outcome.Benefit, targetOpponent, source, game)) {
|
||||||
if (targetPlayer != null) {
|
Player targetPlayer = game.getPlayer(targetOpponent.getFirstTarget());
|
||||||
TargetCard targetCard = new TargetCard(0, 1, Zone.HAND, StaticFilters.FILTER_CARD_CREATURE);
|
if (targetPlayer != null && you != null) {
|
||||||
controller.choose(outcome, targetPlayer.getHand(), targetCard, game);
|
if (!targetPlayer.getHand().isEmpty()) {
|
||||||
Card copyFromCard = game.getCard(targetCard.getFirstTarget());
|
TargetCard target = new TargetCard(0, 1, Zone.HAND, StaticFilters.FILTER_CARD_CREATURE);
|
||||||
if (copyFromCard != null) {
|
if (you.chooseTarget(Outcome.Benefit, targetPlayer.getHand(), target, source, game)) {
|
||||||
game.informPlayers(controller.getLogName() + " chooses to copy " + copyFromCard.getName());
|
Card card = game.getCard(target.getFirstTarget());
|
||||||
CopyEffect copyEffect = new CopyEffect(Duration.Custom, copyFromCard, source.getSourceId());
|
if (card != null) {
|
||||||
|
ContinuousEffect copyEffect = new CopyEffect(Duration.EndOfGame, card.getMainCard(), source.getSourceId());
|
||||||
|
copyEffect.setTargetPointer(new FixedTarget(source.getSourceId(), game));
|
||||||
game.addEffect(copyEffect, source);
|
game.addEffect(copyEffect, source);
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue