mirror of
https://github.com/magefree/mage.git
synced 2025-12-28 14:32:06 -08:00
add workaround for vanishing issue
This commit is contained in:
parent
715fca1399
commit
2f0077e3cf
19 changed files with 23 additions and 22 deletions
|
|
@ -9,6 +9,7 @@ import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
|||
import mage.abilities.effects.common.SacrificeSourceEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.abilities.effects.common.counter.RemoveCounterSourceEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
|
|
@ -25,17 +26,17 @@ public class VanishingAbility extends EntersBattlefieldAbility {
|
|||
private static final Condition condition = new SourceHasCounterCondition(CounterType.TIME);
|
||||
private final int amount;
|
||||
|
||||
public VanishingAbility(int amount) {
|
||||
public VanishingAbility(Card card, int amount) {
|
||||
super(new AddCountersSourceEffect(CounterType.TIME.createInstance(amount)));
|
||||
this.amount = amount;
|
||||
this.addSubAbility(new ConditionalInterveningIfTriggeredAbility(
|
||||
card.addAbility(new ConditionalInterveningIfTriggeredAbility(
|
||||
new BeginningOfUpkeepTriggeredAbility(
|
||||
new RemoveCounterSourceEffect(CounterType.TIME.createInstance()),
|
||||
TargetController.YOU, false
|
||||
), condition, "At the beginning of your upkeep, if this permanent " +
|
||||
"has a time counter on it, remove a time counter from it."
|
||||
).setRuleVisible(false));
|
||||
this.addSubAbility(new VanishingTriggeredAbility());
|
||||
card.addAbility(new VanishingTriggeredAbility());
|
||||
}
|
||||
|
||||
private VanishingAbility(final VanishingAbility ability) {
|
||||
|
|
@ -83,7 +84,7 @@ class VanishingTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (!CounterType.TIME.getName().equals(event.getData())) {
|
||||
if (!CounterType.TIME.getName().equals(event.getData()) || !event.getSourceId().equals(getSourceId())) {
|
||||
return false;
|
||||
}
|
||||
Permanent permanent = getSourcePermanentIfItStillExists(game);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue