@Override public String getRule() { StringBuilder sbRule = new StringBuilder("Flashback"); if (!costs.isEmpty()) { sbRule.append("—"); } else { sbRule.append(' '); } if (!manaCosts.isEmpty()) { sbRule.append(manaCosts.getText()); } if (!costs.isEmpty()) { if (!manaCosts.isEmpty()) { sbRule.append(", "); } sbRule.append(costs.getText()); sbRule.append('.'); } if (abilityName != null) { sbRule.append(' '); sbRule.append(abilityName); } sbRule.append(" <i>(You may cast this card from your graveyard for its flashback cost. Then exile it.)</i>"); return sbRule.toString(); }
StringBuilder sbRule = threadLocalBuilder.get(); if (all || this.abilityType != AbilityType.SPELL) { if (!manaCosts.isEmpty()) { sbRule.append(manaCosts.getText());
.append(")</i>"); if (card.getManaCost().isEmpty()) { setRuleAtTheTop(true);
public List<Permanent> getAvailableManaProducersWithCost(Game game) { List<Permanent> result = new ArrayList<>(); for (Permanent permanent : game.getBattlefield().getAllActivePermanents(playerId)) { Boolean canUse = null; for (ActivatedManaAbilityImpl ability : permanent.getAbilities().getActivatedManaAbilities(Zone.BATTLEFIELD)) { if (canUse == null) { canUse = permanent.canUseActivatedAbilities(game); } if (canUse && ability.canActivate(playerId, game).canActivate() && !ability.getManaCosts().isEmpty()) { result.add(permanent); break; } } } return result; }
@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; }
boolean canAdd = false; for (ActivatedManaAbilityImpl ability : permanent.getAbilities().getActivatedManaAbilities(Zone.BATTLEFIELD)) { if (!ability.getManaCosts().isEmpty()) { canAdd = false; break; boolean canAdd = false; for (ActivatedManaAbilityImpl ability : card.getAbilities(game).getActivatedManaAbilities(Zone.HAND)) { if (!ability.getManaCosts().isEmpty()) { canAdd = false; break;
if (!ability.getManaCosts().isEmpty()) { withCost = true; break;
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 ActivationStatus canActivate(UUID playerId, Game game) { ActivationStatus activationStatus = super.canActivate(playerId, game); if (activationStatus.canActivate()) { Card card = game.getCard(getSourceId()); if (card != null) { // Cards with no Mana Costs cant't be flashbacked (e.g. Ancestral Vision) if (card.getManaCost().isEmpty()) { return ActivationStatus.getFalse(); } // Flashback can never cast a split card by Fuse, because Fuse only works from hand if (card.isSplitCard()) { if (((SplitCard) card).getLeftHalfCard().getName().equals(abilityName)) { return ((SplitCard) card).getLeftHalfCard().getSpellAbility().canActivate(playerId, game); } else if (((SplitCard) card).getRightHalfCard().getName().equals(abilityName)) { return ((SplitCard) card).getRightHalfCard().getSpellAbility().canActivate(playerId, game); } } return card.getSpellAbility().canActivate(playerId, game); } } return activationStatus; }
List<Mana> netManas = abilities.get(0).getNetMana(game); if (ability.getManaCosts().isEmpty()) { if (netManas.size() == 1) { addMana(netManas.get(0)); List<Mana> netManas = ability.getNetMana(game); if (ability.getManaCosts().isEmpty()) { for (Mana netMana : netManas) { if (!hasTapCost || checkTappedForManaReplacement(ability, game, netMana)) {
@Override public boolean apply(Game game, Ability source) { Permanent djinn = game.getPermanent(source.getSourceId()); if (djinn == null) { return false; } for (StackObject stackObject : game.getStack()) { // only spells cast, so no copies of spells if ((stackObject instanceof Spell) && !stackObject.isCopy() && stackObject.isControlledBy(source.getControllerId()) && djinn.isControlledBy(source.getControllerId()) // verify that the controller of the djinn cast that spell && !stackObject.getManaCost().isEmpty()) { //handle cases like Ancestral Vision Spell spell = (Spell) stackObject; if (filter.match(stackObject, game)) { ReplicateAbility replicateAbility = replicateAbilities.computeIfAbsent(spell.getId(), k -> new ReplicateAbility(spell.getCard(), spell.getSpellAbility().getManaCosts().getText())); game.getState().addOtherAbility(spell.getCard(), replicateAbility, false); // Do not copy because paid and # of activations state is handled in the baility } } } if (game.getStack().isEmpty()) { replicateAbilities.clear(); } return true; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = source.getSourceObject(game); if (controller != null && sourceObject != null && controller.getLibrary().hasCards()) { Library library = controller.getLibrary(); Card card = library.getFromTop(game); if (card != null) { boolean exiledCardWasCast = false; controller.moveCardsToExile(card, source, game, true, source.getSourceId(), sourceObject.getIdName()); if (!card.getManaCost().isEmpty() && !card.isLand()) { if (controller.chooseUse(Outcome.Benefit, "Cast " + card.getName() + "? (You still pay the costs)", source, game)) { exiledCardWasCast = controller.cast(card.getSpellAbility(), game, false, new MageObjectReference(sourceObject, game)); } } if (!exiledCardWasCast) { new DamagePlayersEffect(Outcome.Damage, new StaticValue(2), TargetController.OPPONENT).apply(game, source); } } return true; } return false; } }
if (copy instanceof SpellAbility && copy.getManaCosts().isEmpty() && copy.getCosts().isEmpty()) {
if (getAbilityType() == AbilityType.SPELL && (getManaCostsToPay().isEmpty() && getCosts().isEmpty()) && !noMana) { return false;
adjustedCost.addAll(manaCostToCheckForGeneric); if (adjustedCost.isEmpty()) { adjustedCost.add(new GenericManaCost(0)); // neede to check if cost was reduced to 0