mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
Legacy's Allure modified so its ability can be copied
This commit is contained in:
parent
602eee1928
commit
bd415215f5
4 changed files with 21 additions and 26 deletions
|
|
@ -37,15 +37,12 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.TargetAdjustment;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.Counter;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.PowerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
/**
|
||||
|
|
@ -53,39 +50,24 @@ import mage.target.common.TargetCreaturePermanent;
|
|||
*/
|
||||
public class LegacysAllure extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with power less than or equal to the number of treasure counters on {this}");
|
||||
|
||||
public LegacysAllure(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{U}{U}");
|
||||
|
||||
// At the beginning of your upkeep, you may put a treasure counter on Legacy's Allure.
|
||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new AddCountersSourceEffect(new Counter("treasure")), TargetController.YOU, true));
|
||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD,
|
||||
new AddCountersSourceEffect(CounterType.TREASURE.createInstance(), true), TargetController.YOU, true));
|
||||
|
||||
//TODO: Make ability properly copiable
|
||||
// Sacrifice Legacy's Allure: Gain control of target creature with power less than or equal to the number of treasure counters on Legacy's Allure.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainControlTargetEffect(Duration.EndOfGame, true), new SacrificeSourceCost());
|
||||
ability.addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("creature with power less than or equal to the number of treasure counters on " + getLogName())));
|
||||
originalId = ability.getOriginalId();
|
||||
ability.addTarget(new TargetCreaturePermanent(0, 0, filter, false));
|
||||
ability.setTargetAdjustment(TargetAdjustment.TREASURE_COUNTER_POWER);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
public LegacysAllure(final LegacysAllure card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
Permanent sourcePermanent = game.getPermanent(ability.getSourceId());
|
||||
if (sourcePermanent != null) {
|
||||
int numbCounters = sourcePermanent.getCounters(game).getCount("treasure");
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with power less than or equal to the number of treasure counters on " + getLogName());
|
||||
filter.add(new PowerPredicate(ComparisonType.FEWER_THAN, numbCounters + 1));
|
||||
ability.getTargets().clear();
|
||||
ability.getTargets().add(new TargetCreaturePermanent(filter));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ import mage.counters.Counters;
|
|||
import mage.filter.FilterCard;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
||||
import mage.filter.predicate.mageobject.NamePredicate;
|
||||
|
|
@ -61,6 +62,7 @@ import mage.target.TargetCard;
|
|||
import mage.target.TargetPermanent;
|
||||
import mage.target.TargetSpell;
|
||||
import mage.target.common.TargetCardInOpponentsGraveyard;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.util.GameLog;
|
||||
import mage.util.SubTypeList;
|
||||
import mage.watchers.Watcher;
|
||||
|
|
@ -405,6 +407,16 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
ability.addTarget(new TargetPermanent(0, xValue, permanentFilter, false));
|
||||
}
|
||||
break;
|
||||
case TREASURE_COUNTER_POWER:
|
||||
sourcePermanent = game.getPermanentOrLKIBattlefield(ability.getSourceId());
|
||||
if (sourcePermanent != null) {
|
||||
xValue = sourcePermanent.getCounters(game).getCount(CounterType.TREASURE);
|
||||
FilterCreaturePermanent filter2 = new FilterCreaturePermanent("creature with power less than or equal to the number of treasure counters on {this}");
|
||||
filter2.add(new PowerPredicate(ComparisonType.FEWER_THAN, xValue + 1));
|
||||
ability.getTargets().clear();
|
||||
ability.getTargets().add(new TargetCreaturePermanent(filter2));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,5 +6,5 @@ package mage.constants;
|
|||
*/
|
||||
public enum TargetAdjustment {
|
||||
|
||||
NONE, X_TARGETS, X_CMC_EQUAL_PERM, X_CMC_EQUAL_GY_CARD, X_POWER_LEQ, CHOSEN_NAME, CHOSEN_COLOR, VERSE_COUNTER_TARGETS
|
||||
NONE, X_TARGETS, X_CMC_EQUAL_PERM, X_CMC_EQUAL_GY_CARD, X_POWER_LEQ, CHOSEN_NAME, CHOSEN_COLOR, VERSE_COUNTER_TARGETS, TREASURE_COUNTER_POWER
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,6 +122,7 @@ public enum CounterType {
|
|||
TIME("time"),
|
||||
TOWER("tower"),
|
||||
TRAP("trap"),
|
||||
TREASURE("treasure"),
|
||||
UNITY("unity"),
|
||||
VELOCITY("velocity"),
|
||||
VERSE("verse"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue