mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
fixed Lazav, the Multifarious ability
This commit is contained in:
parent
3686d7461b
commit
f250a73e9e
2 changed files with 21 additions and 24 deletions
|
@ -16,18 +16,18 @@ import mage.constants.SuperType;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.predicate.other.OwnerPredicate;
|
||||
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.PermanentCard;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInGraveyard;
|
||||
import mage.target.targetadjustment.XCMCGraveyardAdjuster;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.util.functions.ApplyToPermanent;
|
||||
|
||||
|
@ -37,12 +37,6 @@ import mage.util.functions.ApplyToPermanent;
|
|||
*/
|
||||
public final class LazavTheMultifarious extends CardImpl {
|
||||
|
||||
private static final FilterCard filter = new FilterCreatureCard("creature card in your graveyard with converted mana cost X");
|
||||
|
||||
static {
|
||||
filter.add(new OwnerPredicate(TargetController.YOU));
|
||||
}
|
||||
|
||||
public LazavTheMultifarious(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{U}{B}");
|
||||
|
||||
|
@ -61,8 +55,7 @@ public final class LazavTheMultifarious extends CardImpl {
|
|||
new LazavTheMultifariousEffect(),
|
||||
new ManaCostsImpl("{X}")
|
||||
);
|
||||
ability.addTarget(new TargetCardInGraveyard(filter));
|
||||
ability.setTargetAdjuster(XCMCGraveyardAdjuster.instance);
|
||||
ability.setTargetAdjuster(LazavTheMultifariousAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
@ -76,6 +69,19 @@ public final class LazavTheMultifarious extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum LazavTheMultifariousAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
FilterCard filterCard = new FilterCreatureCard("creature card with converted mana cost " + xValue + " in your graveyard");
|
||||
filterCard.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||
ability.getTargets().clear();
|
||||
ability.getTargets().add(new TargetCardInYourGraveyard(filterCard));
|
||||
}
|
||||
}
|
||||
|
||||
class LazavTheMultifariousEffect extends OneShotEffect {
|
||||
|
||||
LazavTheMultifariousEffect() {
|
||||
|
@ -124,20 +130,13 @@ class LazavTheMultifariousEffect extends OneShotEffect {
|
|||
|
||||
class LazavTheMultifariousApplier extends ApplyToPermanent {
|
||||
|
||||
private static final FilterCard filter = new FilterCreatureCard("creature card in your graveyard with converted mana cost X");
|
||||
|
||||
static {
|
||||
filter.add(new OwnerPredicate(TargetController.YOU));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) {
|
||||
Ability ability = new SimpleActivatedAbility(
|
||||
new LazavTheMultifariousEffect(),
|
||||
new ManaCostsImpl("{X}")
|
||||
);
|
||||
ability.addTarget(new TargetCardInGraveyard(filter));
|
||||
ability.setTargetAdjuster(XCMCGraveyardAdjuster.instance);
|
||||
ability.setTargetAdjuster(LazavTheMultifariousAdjuster.instance);
|
||||
permanent.getAbilities().add(ability);
|
||||
permanent.setName("Lazav, the Multifarious");
|
||||
permanent.addSuperType(SuperType.LEGENDARY);
|
||||
|
@ -150,8 +149,7 @@ class LazavTheMultifariousApplier extends ApplyToPermanent {
|
|||
new LazavTheMultifariousEffect(),
|
||||
new ManaCostsImpl("{X}")
|
||||
);
|
||||
ability.addTarget(new TargetCardInGraveyard(filter));
|
||||
ability.setTargetAdjuster(XCMCGraveyardAdjuster.instance);
|
||||
ability.setTargetAdjuster(LazavTheMultifariousAdjuster.instance);
|
||||
mageObject.getAbilities().add(ability);
|
||||
mageObject.setName("Lazav, the Multifarious");
|
||||
mageObject.addSuperType(SuperType.LEGENDARY);
|
||||
|
|
|
@ -52,8 +52,7 @@ public final class RunawaySteamKin extends CardImpl {
|
|||
|
||||
// Remove three +1/+1 counters from Runaway Steam-Kin: Add {R}{R}{R}.
|
||||
this.addAbility(new SimpleManaAbility(
|
||||
Zone.BATTLEFIELD,
|
||||
Mana.RedMana(3),
|
||||
Zone.BATTLEFIELD, Mana.RedMana(3),
|
||||
new RemoveCountersSourceCost(CounterType.P1P1.createInstance(3))
|
||||
));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue