mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 03:22:00 -08:00
* Ral Zarek - Fixed target handling of ability one.
This commit is contained in:
parent
317ba7fd87
commit
ce94e573e4
2 changed files with 27 additions and 43 deletions
|
|
@ -31,19 +31,23 @@ import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.LoyaltyAbility;
|
import mage.abilities.LoyaltyAbility;
|
||||||
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
|
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
|
||||||
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.DamageTargetEffect;
|
import mage.abilities.effects.common.DamageTargetEffect;
|
||||||
|
import mage.abilities.effects.common.TapTargetEffect;
|
||||||
|
import mage.abilities.effects.common.UntapTargetEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.filter.FilterPermanent;
|
import mage.filter.FilterPermanent;
|
||||||
|
import mage.filter.predicate.mageobject.AnotherTargetPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
|
||||||
import mage.game.turn.TurnMod;
|
import mage.game.turn.TurnMod;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
import mage.target.common.TargetCreatureOrPlayer;
|
import mage.target.common.TargetCreatureOrPlayer;
|
||||||
|
import mage.target.targetpointer.SecondTargetPointer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -51,6 +55,12 @@ import mage.target.common.TargetCreatureOrPlayer;
|
||||||
*/
|
*/
|
||||||
public class RalZarek extends CardImpl {
|
public class RalZarek extends CardImpl {
|
||||||
|
|
||||||
|
private static final FilterPermanent secondFilter = new FilterPermanent("another target permanent");
|
||||||
|
|
||||||
|
static {
|
||||||
|
secondFilter.add(new AnotherTargetPredicate(2));
|
||||||
|
}
|
||||||
|
|
||||||
public RalZarek(UUID ownerId) {
|
public RalZarek(UUID ownerId) {
|
||||||
super(ownerId, 94, "Ral Zarek", Rarity.MYTHIC, new CardType[]{CardType.PLANESWALKER}, "{2}{U}{R}");
|
super(ownerId, 94, "Ral Zarek", Rarity.MYTHIC, new CardType[]{CardType.PLANESWALKER}, "{2}{U}{R}");
|
||||||
this.expansionSetCode = "DGM";
|
this.expansionSetCode = "DGM";
|
||||||
|
|
@ -59,8 +69,17 @@ public class RalZarek extends CardImpl {
|
||||||
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(4));
|
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(4));
|
||||||
|
|
||||||
// +1: Tap target permanent, then untap another target permanent.
|
// +1: Tap target permanent, then untap another target permanent.
|
||||||
LoyaltyAbility ability1 = new LoyaltyAbility(new RalZarekTapUntapEffect(), 1);
|
LoyaltyAbility ability1 = new LoyaltyAbility(new TapTargetEffect(), 1);
|
||||||
ability1.addTarget(new TargetPermanent(2, 2, new FilterPermanent(), false));
|
TargetPermanent firstTarget = new TargetPermanent();
|
||||||
|
firstTarget.setTargetTag(1);
|
||||||
|
ability1.addTarget(firstTarget);
|
||||||
|
Effect effect = new UntapTargetEffect();
|
||||||
|
effect.setText(", then untap another target permanent");
|
||||||
|
effect.setTargetPointer(new SecondTargetPointer());
|
||||||
|
ability1.addEffect(effect);
|
||||||
|
TargetPermanent secondTarget = new TargetPermanent(secondFilter);
|
||||||
|
secondTarget.setTargetTag(2);
|
||||||
|
ability1.addTarget(secondTarget);
|
||||||
this.addAbility(ability1);
|
this.addAbility(ability1);
|
||||||
|
|
||||||
// -2: Ral Zarek deals 3 damage to target creature or player.
|
// -2: Ral Zarek deals 3 damage to target creature or player.
|
||||||
|
|
@ -83,45 +102,6 @@ public class RalZarek extends CardImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class RalZarekTapUntapEffect extends OneShotEffect {
|
|
||||||
|
|
||||||
public RalZarekTapUntapEffect() {
|
|
||||||
super(Outcome.Tap);
|
|
||||||
this.staticText = "Tap target permanent, then untap another target permanent";
|
|
||||||
}
|
|
||||||
|
|
||||||
public RalZarekTapUntapEffect(final RalZarekTapUntapEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RalZarekTapUntapEffect copy() {
|
|
||||||
return new RalZarekTapUntapEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
|
||||||
if (player != null) {
|
|
||||||
int i = 0;
|
|
||||||
for (UUID targetId : source.getTargets().get(0).getTargets()) {
|
|
||||||
i++;
|
|
||||||
Permanent permanent = game.getPermanent(targetId);
|
|
||||||
if (permanent != null) {
|
|
||||||
if (i == 1) {
|
|
||||||
permanent.tap(game);
|
|
||||||
}
|
|
||||||
if (i == 2) {
|
|
||||||
permanent.untap(game);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class RalZarekExtraTurnsEffect extends OneShotEffect {
|
class RalZarekExtraTurnsEffect extends OneShotEffect {
|
||||||
|
|
||||||
public RalZarekExtraTurnsEffect() {
|
public RalZarekExtraTurnsEffect() {
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,10 @@ public class AnotherTargetPredicate implements ObjectSourcePlayerPredicate<Objec
|
||||||
|
|
||||||
private final int targetTag;
|
private final int targetTag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param targetTag tag of the target the filter belongs to
|
||||||
|
*/
|
||||||
public AnotherTargetPredicate(int targetTag) {
|
public AnotherTargetPredicate(int targetTag) {
|
||||||
this.targetTag = targetTag;
|
this.targetTag = targetTag;
|
||||||
}
|
}
|
||||||
|
|
@ -58,7 +62,7 @@ public class AnotherTargetPredicate implements ObjectSourcePlayerPredicate<Objec
|
||||||
if (target.getTargetTag() > 0 // target is included in the target group to check
|
if (target.getTargetTag() > 0 // target is included in the target group to check
|
||||||
&& target.getTargetTag() != targetTag // it's not the target of this predicate
|
&& target.getTargetTag() != targetTag // it's not the target of this predicate
|
||||||
&& target.getTargets().contains(input.getObject().getId())) { // if the uuid already is used for another target in the group it's not allowed here
|
&& target.getTargets().contains(input.getObject().getId())) { // if the uuid already is used for another target in the group it's not allowed here
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue