public SpellCostReductionSourceEffect(ManaCosts<ManaCost> manaCostsToReduce, Condition condition) { super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.REDUCE_COST); this.amount = 0; this.manaCostsToReduce = manaCostsToReduce; this.condition = condition; StringBuilder sb = new StringBuilder(); sb.append("{this} costs "); for (String manaSymbol : manaCostsToReduce.getSymbols()) { sb.append(manaSymbol); } sb.append(" less to if ").append(this.condition.toString()); this.staticText = sb.toString(); }
public SpellsCostIncreasementControllerEffect(FilterCard filter, ManaCosts<ManaCost> manaCostsToReduce) { super(Duration.WhileOnBattlefield, Outcome.Detriment, CostModificationType.INCREASE_COST); this.filter = filter; this.amount = 0; this.manaCostsToIncrease = manaCostsToReduce; StringBuilder sb = new StringBuilder(); sb.append(filter.getMessage()).append(" you cast cost "); for (String manaSymbol : manaCostsToReduce.getSymbols()) { sb.append(manaSymbol); } sb.append(" more to cast"); this.staticText = sb.toString(); }
public SpellsCostReductionControllerEffect(FilterCard filter, ManaCosts<ManaCost> manaCostsToReduce) { super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.REDUCE_COST); this.filter = filter; this.amount = 0; this.manaCostsToReduce = manaCostsToReduce; this.upTo = false; StringBuilder sb = new StringBuilder(); sb.append(filter.getMessage()).append(" you cast cost "); for (String manaSymbol : manaCostsToReduce.getSymbols()) { sb.append(manaSymbol); } sb.append(" less to cast. This effect reduces only the amount of colored mana you pay."); this.staticText = sb.toString(); }
/** * 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; }
public AbilityView(Ability ability, String sourceName, CardView sourceCard) { this.id = ability.getId(); this.name = "Ability"; this.sourceName = sourceName; this.sourceCard = sourceCard; this.rules = new ArrayList<>(); rules.add(ability.getRule()); this.power = ""; this.toughness = ""; this.loyalty = ""; this.cardTypes = EnumSet.noneOf(CardType.class); this.subTypes = new SubTypeList(); this.superTypes =EnumSet.noneOf(SuperType.class); this.color = new ObjectColor(); this.manaCost = ability.getManaCosts().getSymbols(); }
/** * Checks if the mana symbols in the card all match the allowed colors for this pool. * @param card the spell card to check. * @return if all the mana symbols fit the chosen colors. */ private boolean cardFitsChosenColors(Card card) { for (String symbol : card.getManaCost().getSymbols()) { boolean found = false; symbol = symbol.replace("{", "").replace("}", ""); if (isColoredManaSymbol(symbol)) { for (ColoredManaSymbol allowed : allowedColors) { if (symbol.contains(allowed.toString())) { found = true; break; } } if (!found) { return false; } } if (symbol.equals("C") && !colorlessAllowed) { return false; } } return true; }
int multicolor = 0; Set<String> colors = new HashSet<>(); for (String symbol : card.getManaCost().getSymbols()) { int count = 0; symbol = symbol.replace("{", "").replace("}", "");
for (String symbol : picked.card.getManaCost().getSymbols()) { symbol = symbol.replace("{", "").replace("}", ""); if (RateCard.isColoredMana(symbol)) {
private ObjectColor getColorFromManaCostHack(ManaCosts costs) { ObjectColor c = new ObjectColor(); List<String> symbols = costs.getSymbols(); for (String symbol : symbols) { if (symbol.contains("W")) { c.setWhite(true); } else if (symbol.contains("U")) { c.setBlue(true); } else if (symbol.contains("B")) { c.setBlack(true); } else if (symbol.contains("R")) { c.setRed(true); } else if (symbol.contains("G")) { c.setGreen(true); } } return c; }
if (allowedColors == null) { int colorPenalty = 0; for (String symbol : card.getManaCost().getSymbols()) { if (isColoredMana(symbol)) { colorPenalty++; for (String symbol : card.getManaCost().getSymbols()) { int count = 0; symbol = symbol.replace("{", "").replace("}", "");
for (String symbol : spell.getManaCost().getSymbols()) { symbol = symbol.replace("{", "").replace("}", ""); if (isColoredManaSymbol(symbol)) {
rule.append(card.getLeftSplitName()); rule.append("</b></td><td align='right' valign='top' style='width:"); rule.append(card.getLeftSplitCosts().getSymbols().size() * GUISizeHelper.symbolTooltipSize + 1); rule.append("px'>"); rule.append(card.getLeftSplitCosts().getText()); rule.append(card.getRightSplitName()); rule.append("</b></td><td align='right' valign='top' style='width:"); rule.append(card.getRightSplitCosts().getSymbols().size() * GUISizeHelper.symbolTooltipSize + 1); rule.append("px'>"); rule.append(card.getRightSplitCosts().getText());
public ModernSplitCardRenderer(CardView view, boolean isTransformed) { super(view, isTransformed); rightHalf.manaCostString = ManaSymbols.getStringManaCost(cardView.getRightSplitCosts().getSymbols()); leftHalf.manaCostString = ManaSymbols.getStringManaCost(cardView.getLeftSplitCosts().getSymbols()); rightHalf.color = getColorFromManaCostHack(cardView.getRightSplitCosts()); leftHalf.color = getColorFromManaCostHack(cardView.getLeftSplitCosts()); parseRules(view.getRightSplitRules(), rightHalf.keywords, rightHalf.rules); parseRules(view.getLeftSplitRules(), leftHalf.keywords, leftHalf.rules); rightHalf.typeLineString = cardView.getRightSplitTypeLine(); leftHalf.typeLineString = cardView.getLeftSplitTypeLine(); rightHalf.name = cardView.getRightSplitName(); leftHalf.name = cardView.getLeftSplitName(); isFuse = view.getRules().stream().anyMatch(rule -> rule.contains("Fuse")); isAftermath = view.getRightSplitRules().stream().anyMatch(rule -> rule.contains("Aftermath")); // It's easier for rendering to swap the card halves here because for aftermath cards // they "rotate" in opposite directions making consquence and normal split cards // have the "right" vs "left" as the top half. if (!isAftermath()) { HalfCardProps tmp = leftHalf; leftHalf = rightHalf; rightHalf = tmp; } }
for (final Card card : deck.getCards()) { for (String symbol : card.getManaCost().getSymbols()) { int count = 0; symbol = symbol.replace("{", "").replace("}", "");
this.superTypes = ability.getSuperType(); this.color = ability.getColor(game); this.manaCost = ability.getManaCost().getSymbols(); this.cardTypes = ability.getCardType(); this.subTypes = ability.getSubtype(game); this.superTypes = ability.getSuperType(); this.color = ability.getColor(game); this.manaCost = ability.getManaCost().getSymbols(); this.power = ability.getPower().toString(); this.toughness = ability.getToughness().toString();
this.setSubtypes(card.getSubtype(null).stream().map(SubType::toString).collect(Collectors.toList())); this.setSuperTypes(card.getSuperType()); this.setManaCosts(card.getManaCost().getSymbols());
this.superTypes = object.getSuperType(); this.color = object.getColor(null); this.manaCost = object.getManaCost().getSymbols(); this.convertedManaCost = object.getManaCost().convertedManaCost(); if (object instanceof PermanentToken) {
CardView(Token token) { super(token.getId(), "", "0", false, "", ""); this.isToken = true; this.id = token.getId(); this.name = token.getName(); this.displayName = token.getName(); this.rules = token.getAbilities().getRules(this.name); this.power = token.getPower().toString(); this.toughness = token.getToughness().toString(); this.loyalty = ""; this.startingLoyalty = ""; this.cardTypes = token.getCardType(); this.subTypes = token.getSubtype(null); this.superTypes = token.getSuperType(); this.color = token.getColor(null); this.frameColor = token.getFrameColor(null); this.frameStyle = token.getFrameStyle(); this.manaCost = token.getManaCost().getSymbols(); this.rarity = Rarity.SPECIAL; this.type = token.getTokenType(); this.tokenDescriptor = token.getTokenDescriptor(); this.tokenSetCode = token.getOriginalExpansionSetCode(); }
this.rules = card.getRules(game); this.manaCost = card.getManaCost().getSymbols(); this.convertedManaCost = card.getManaCost().convertedManaCost();