mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
Add MDFC support to CardCriteria and use it for ZNR
This commit is contained in:
parent
a4ced51058
commit
d357f4a0b0
2 changed files with 29 additions and 6 deletions
|
@ -1,8 +1,9 @@
|
||||||
package mage.sets;
|
package mage.sets;
|
||||||
|
|
||||||
import mage.cards.Card;
|
|
||||||
import mage.cards.ExpansionSet;
|
import mage.cards.ExpansionSet;
|
||||||
import mage.cards.ModalDoubleFacesCard;
|
import mage.cards.repository.CardCriteria;
|
||||||
|
import mage.cards.repository.CardInfo;
|
||||||
|
import mage.cards.repository.CardRepository;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.constants.SetType;
|
import mage.constants.SetType;
|
||||||
|
|
||||||
|
@ -28,7 +29,9 @@ public final class ZendikarRising extends ExpansionSet {
|
||||||
this.numBoosterCommon = 10;
|
this.numBoosterCommon = 10;
|
||||||
this.numBoosterUncommon = 3;
|
this.numBoosterUncommon = 3;
|
||||||
this.numBoosterRare = 1;
|
this.numBoosterRare = 1;
|
||||||
this.ratioBoosterMythic = 7.4;
|
this.ratioBoosterMythic = 8;
|
||||||
|
this.ratioBoosterSpecialRare = 5.5;
|
||||||
|
this.ratioBoosterSpecialMythic = 5.4; // 5 mythic MDFCs, 11 rare MDFCs
|
||||||
this.maxCardNumberInBooster = 280;
|
this.maxCardNumberInBooster = 280;
|
||||||
|
|
||||||
cards.add(new SetCardInfo("Acquisitions Expert", 89, Rarity.UNCOMMON, mage.cards.a.AcquisitionsExpert.class));
|
cards.add(new SetCardInfo("Acquisitions Expert", 89, Rarity.UNCOMMON, mage.cards.a.AcquisitionsExpert.class));
|
||||||
|
@ -425,8 +428,13 @@ public final class ZendikarRising extends ExpansionSet {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean boosterIsValid(List<Card> booster) {
|
protected List<CardInfo> findSpecialCardsByRarity(Rarity rarity) {
|
||||||
return super.boosterIsValid(booster)
|
List<CardInfo> cardInfos = super.findSpecialCardsByRarity(rarity);
|
||||||
&& booster.stream().filter(ModalDoubleFacesCard.class::isInstance).count() == 1;
|
cardInfos.addAll(CardRepository.instance.findCards(new CardCriteria()
|
||||||
|
.setCodes(this.code)
|
||||||
|
.rarities(rarity)
|
||||||
|
.modalDoubleFaced(true)
|
||||||
|
.maxCardNumber(maxCardNumberInBooster)));
|
||||||
|
return cardInfos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ public class CardCriteria {
|
||||||
private final List<SubType> subtypes;
|
private final List<SubType> subtypes;
|
||||||
private final List<Rarity> rarities;
|
private final List<Rarity> rarities;
|
||||||
private Boolean doubleFaced;
|
private Boolean doubleFaced;
|
||||||
|
private Boolean modalDoubleFaced;
|
||||||
private boolean black;
|
private boolean black;
|
||||||
private boolean blue;
|
private boolean blue;
|
||||||
private boolean green;
|
private boolean green;
|
||||||
|
@ -100,6 +101,11 @@ public class CardCriteria {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CardCriteria modalDoubleFaced(boolean modalDoubleFaced) {
|
||||||
|
this.modalDoubleFaced = modalDoubleFaced;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public CardCriteria name(String name) {
|
public CardCriteria name(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
return this;
|
return this;
|
||||||
|
@ -215,6 +221,11 @@ public class CardCriteria {
|
||||||
clausesCount++;
|
clausesCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (modalDoubleFaced != null) {
|
||||||
|
where.eq("modalDoubleFacesCard", modalDoubleFaced);
|
||||||
|
clausesCount++;
|
||||||
|
}
|
||||||
|
|
||||||
for (Rarity rarity : rarities) {
|
for (Rarity rarity : rarities) {
|
||||||
where.eq("rarity", rarity);
|
where.eq("rarity", rarity);
|
||||||
}
|
}
|
||||||
|
@ -412,6 +423,10 @@ public class CardCriteria {
|
||||||
return doubleFaced;
|
return doubleFaced;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getModalDoubleFaced() {
|
||||||
|
return modalDoubleFaced;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isBlack() {
|
public boolean isBlack() {
|
||||||
return black;
|
return black;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue