APISonar


mage.counters.CounterType.TIME

> mage > counters > CounterType > TIME
mage APIs counters APIs CounterType APIs TIME APIs

Example 1
public TimeBomb(UUID ownerId) {
        super(ownerId, 223, "Time Bomb", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{4}");
        this.expansionSetCode = "ME2";

        // At the beginning of your upkeep, put a time counter on Time Bomb.
        this.addAbility(new BeginningOfUpkeepTriggeredAbility(new AddCountersSourceEffect(CounterType.TIME.createInstance(), true), TargetController.YOU, false));

        // {1}, {tap}, Sacrifice Time Bomb: Time Bomb deals damage equal to the number of time counters on it to each creature and each player.
        Effect effect = new DamageEverythingEffect(new CountersCount(CounterType.TIME), new FilterCreaturePermanent());
        effect.setText("{this} deals damage equal to the number of time counters on it to each creature and each player");
        Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new GenericManaCost(1));
        ability.addCost(new TapSourceCost());
        ability.addCost(new SacrificeSourceCost());
        this.addAbility(ability);
    }
Example 2
public boolean apply(Game game, Ability source) {
        Permanent p = game.getPermanent(source.getSourceId());
        if (p != null) {
            int amount = p.getCounters(game).getCount(CounterType.TIME);
            if (amount > 0) {
                p.removeCounters(CounterType.TIME.createInstance(), game);
                game.informPlayers("Removed a time counter from " + p.getLogName() + " (" + amount + " left)");
            }
            return true;
        }
        return false;
    }
Example 3
public FilterPermanentOrSuspendedCard(String name) {
        super(name);
        permanentFilter = new FilterPermanent();
        cardFilter = new FilterCard();
        cardFilter.add(new AbilityPredicate(SuspendAbility.class));
        cardFilter.add(new CounterCardPredicate(CounterType.TIME));
    }
Example 4
public boolean canActivate(UUID playerId, Game game) {
        Card card = game.getCard(this.getSourceId());
        if(super.canActivate(playerId, game) && card != null && card.getCounters(game).getCount(CounterType.TIME) > 0){
            return true;
        }
        return false;
    }
Example 5
public void adjustCosts(Ability ability, Game game) {
        if (ability instanceof ActivatedAbility && !ability.getChoices().isEmpty()) {
            ability.getCosts().clear();
            Choice targetChoice = ability.getChoices().get(0);
            if (targetChoice.getChoice().equals("Permanent")) {
                ability.addCost(new RemoveCounterCost(new TargetControlledCreaturePermanent(), CounterType.TIME));
            }
            if (targetChoice.getChoice().equals("Suspended Card")) {
                ability.addCost(new RemoveCounterFromCardCost(new TargetCardInExile(1,1,filter, null, true), CounterType.TIME));
            }
        }
    }
Example 6
public boolean checkTrigger(GameEvent event, Game game) {
        if (super.checkTrigger(event, game)) {
            Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
            if (!permanent.getCounters(game).containsKey(CounterType.TIME) || permanent.getCounters(game).getCount(CounterType.TIME) == 0) {
                return true;
            }
        }
        return false;
    }