mirror of
https://github.com/magefree/mage.git
synced 2026-01-24 04:09:54 -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue