mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
ensure cards are bought in the correct quantity too
This commit is contained in:
@@ -319,7 +319,7 @@ public final class CEditorQuestCardShop extends ACEditorBase<InventoryItem, Deck
|
|||||||
final CardPrinted card = (CardPrinted) item;
|
final CardPrinted card = (CardPrinted) item;
|
||||||
this.getTableDeck().addCard(card, qty);
|
this.getTableDeck().addCard(card, qty);
|
||||||
this.getTableCatalog().removeCard(item, qty);
|
this.getTableCatalog().removeCard(item, qty);
|
||||||
this.questData.getCards().buyCard(card, value);
|
this.questData.getCards().buyCard(card, qty, value);
|
||||||
|
|
||||||
} else if (item instanceof OpenablePack) {
|
} else if (item instanceof OpenablePack) {
|
||||||
for (int i = 0; qty > i; ++i) {
|
for (int i = 0; qty > i; ++i) {
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ public final class QuestUtilCards {
|
|||||||
*/
|
*/
|
||||||
public void addAllCards(final Iterable<CardPrinted> newCards) {
|
public void addAllCards(final Iterable<CardPrinted> newCards) {
|
||||||
for (final CardPrinted card : newCards) {
|
for (final CardPrinted card : newCards) {
|
||||||
this.addSingleCard(card);
|
this.addSingleCard(card, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,11 +177,11 @@ public final class QuestUtilCards {
|
|||||||
* @param card
|
* @param card
|
||||||
* the card
|
* the card
|
||||||
*/
|
*/
|
||||||
public void addSingleCard(final CardPrinted card) {
|
public void addSingleCard(final CardPrinted card, int qty) {
|
||||||
this.qa.getCardPool().add(card);
|
this.qa.getCardPool().add(card, qty);
|
||||||
|
|
||||||
// register card into that list so that it would appear as a new one.
|
// register card into that list so that it would appear as a new one.
|
||||||
this.qa.getNewCardList().add(card);
|
this.qa.getNewCardList().add(card, qty);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Predicate<CardPrinted> RARE_PREDICATE = IPaperCard.Predicates.Presets.IS_RARE_OR_MYTHIC;
|
private static final Predicate<CardPrinted> RARE_PREDICATE = IPaperCard.Predicates.Presets.IS_RARE_OR_MYTHIC;
|
||||||
@@ -207,7 +207,7 @@ public final class QuestUtilCards {
|
|||||||
final Predicate<CardPrinted> myFilter = applyFormatFilter(QuestUtilCards.RARE_PREDICATE);
|
final Predicate<CardPrinted> myFilter = applyFormatFilter(QuestUtilCards.RARE_PREDICATE);
|
||||||
|
|
||||||
final CardPrinted card = Aggregates.random(Iterables.filter(CardDb.instance().getAllCards(), myFilter));
|
final CardPrinted card = Aggregates.random(Iterables.filter(CardDb.instance().getAllCards(), myFilter));
|
||||||
this.addSingleCard(card);
|
this.addSingleCard(card, 1);
|
||||||
return card;
|
return card;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,11 +250,12 @@ public final class QuestUtilCards {
|
|||||||
* @param value
|
* @param value
|
||||||
* the value
|
* the value
|
||||||
*/
|
*/
|
||||||
public void buyCard(final CardPrinted card, final int value) {
|
public void buyCard(final CardPrinted card, int qty, final int value) {
|
||||||
if (this.qa.getCredits() >= value) {
|
int totalCost = qty * value;
|
||||||
this.qa.setCredits(this.qa.getCredits() - value);
|
if (this.qa.getCredits() >= totalCost) {
|
||||||
this.qa.getShopList().remove(card);
|
this.qa.setCredits(this.qa.getCredits() - totalCost);
|
||||||
this.addSingleCard(card);
|
this.qa.getShopList().remove(card, qty);
|
||||||
|
this.addSingleCard(card, qty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user