@Override public ManaCosts<ManaCost> getManaCost() { return sourceObject.getManaCost(); }
@Override public ManaCosts<ManaCost> getManaCost() { return card.getManaCost(); }
public int getConvertedCost() { return this.card.getManaCost().convertedManaCost(); }
/** * Return number of different color mana symbols in manacost. * * @param card * @return */ public static int getDifferentColorManaCount(Card card) { Set<String> symbols = new HashSet<>(); for (String symbol : card.getManaCost().getSymbols()) { if (isColoredMana(symbol)) { symbols.add(symbol); } } return symbols.size(); } }
/** * Return number of color mana symbols in manacost. * * @param card * @return */ public static int getColorManaCount(Card card) { int count = 0; for (String symbol : card.getManaCost().getSymbols()) { if (isColoredMana(symbol)) { count++; } } return count; }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { int chroma = 0; for (Card card : revealed.getCards(game)) { chroma += card.getManaCost().getMana().getBlue(); } return chroma; }
@Override public boolean applies(GameEvent event, Ability source, Game game) { Card card = game.getCard(event.getSourceId()); if (card != null && !card.isCreature() && card.getManaCost().getText().contains("X")) { return true; } return false; }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { chroma = 0; for (Card card : game.getBattlefield().getAllActivePermanents(new FilterControlledPermanent(), sourceAbility.getControllerId(), game)) { chroma += card.getManaCost().getMana().getRed(); } return chroma; }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { chroma = 0; Player you = game.getPlayer(sourceAbility.getControllerId()); if (you == null) { return 0; } for (Card card : you.getGraveyard().getCards(game)) { chroma += card.getManaCost().getMana().getBlack(); } return chroma; }
public CastCommanderAbility(Card card) { super(card.getManaCost(), card.getName(), Zone.COMMAND, SpellAbilityType.BASE); this.costs = card.getSpellAbility().getCosts().copy(); this.timing = TimingRule.SORCERY; this.usesStack = true; this.controllerId = card.getOwnerId(); this.sourceId = card.getId(); }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { chroma = 0; for (Card card : game.getBattlefield().getAllActivePermanents(new FilterControlledPermanent(), sourceAbility.getControllerId(), game)) { chroma += card.getManaCost().getMana().getGreen(); } return chroma; }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { chroma = 0; for (Card card : game.getBattlefield().getAllActivePermanents(new FilterControlledPermanent(), sourceAbility.getControllerId(), game)) { chroma += card.getManaCost().getMana().getRed(); } return chroma; }
@Override public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { Card cardOnTop = game.getCard(objectId); if (cardOnTop != null && affectedControllerId.equals(source.getControllerId()) && cardOnTop.isOwnedBy(source.getControllerId()) && (!cardOnTop.getManaCost().isEmpty() || cardOnTop.isLand()) && filter.match(cardOnTop, game)) { Player player = game.getPlayer(cardOnTop.getOwnerId()); if (player != null && cardOnTop.equals(player.getLibrary().getFromTop(game))) { return true; } } return false; }
@Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getPlayerId().equals(this.controllerId)) { Spell spell = (Spell) game.getStack().getStackObject(event.getTargetId()); if (spell != null) { for (ManaCost cost : spell.getCard().getManaCost()) { if (cost instanceof PhyrexianManaCost) { ((DamageTargetEffect)getEffects().get(0)).setAmount(new StaticValue(spell.getConvertedManaCost())); return true; } } } } return false; }
private boolean spliceSpellCanBeActivated(Ability source, Game game) { // check if spell can be activated (protection problem not solved because effect will be used from the base spell?) Card card = game.getCard(source.getSourceId()); if (card != null) { if (card.getManaCost().isEmpty()) { // e.g. Evermind return card.getSpellAbility().spellCanBeActivatedRegularlyNow(source.getControllerId(), game); } else { return card.getSpellAbility().canActivate(source.getControllerId(), game).canActivate(); } } return false; } }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { Card card = game.getCard(targetPointer.getFirst(game, source)); if (card != null) { FlashbackAbility ability = new FlashbackAbility(card.getManaCost(), TimingRule.SORCERY); ability.setSourceId(card.getId()); ability.setControllerId(card.getOwnerId()); game.getState().addOtherAbility(card, ability); return true; } } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { for (UUID cardId : controller.getGraveyard()) { Card card = game.getCard(cardId); if (card != null && card.isCreature()) { ScavengeAbility ability = new ScavengeAbility(new ManaCostsImpl(card.getManaCost().getText())); ability.setSourceId(cardId); ability.setControllerId(card.getOwnerId()); game.getState().addOtherAbility(card, ability); } } return true; } return false; }
@Override public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { if (targets.choose(Outcome.Exile, controllerId, sourceId, game)) { Player controller = game.getPlayer(controllerId); if (controller != null) { Card card = controller.getGraveyard().get(targets.getFirstTarget(), game); if (card != null && controller.moveCards(card, Zone.EXILED, ability, game)) { ability.getEffects().get(0).setTargetPointer(new FixedTarget(card.getId(), game.getState().getZoneChangeCounter(card.getId()))); paid = card.getManaCost().pay(ability, game, sourceId, controllerId, noMana); } } } return paid; }
public JumpStartAbility(Card card) { super(card.getManaCost(), card.getName() + " with jump-start", Zone.GRAVEYARD, SpellAbilityType.BASE_ALTERNATE); this.getCosts().addAll(card.getSpellAbility().getCosts().copy()); Cost cost = new DiscardTargetCost(new TargetCardInHand()); cost.setText(""); this.addCost(cost); this.getEffects().addAll(card.getSpellAbility().getEffects().copy()); this.getTargets().addAll(card.getSpellAbility().getTargets().copy()); this.spellAbilityType = SpellAbilityType.BASE_ALTERNATE; this.timing = card.getSpellAbility().getTiming(); }
public RetraceAbility(Card card) { super(card.getManaCost(), card.getName() + " with retrace", Zone.GRAVEYARD, SpellAbilityType.BASE_ALTERNATE); this.getCosts().addAll(card.getSpellAbility().getCosts().copy()); Cost cost = new DiscardTargetCost(new TargetCardInHand(new FilterLandCard())); cost.setText(""); this.addCost(cost); this.getEffects().addAll(card.getSpellAbility().getEffects().copy()); this.getTargets().addAll(card.getSpellAbility().getTargets().copy()); this.spellAbilityType = SpellAbilityType.BASE_ALTERNATE; this.timing = card.getSpellAbility().getTiming(); }