mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
Merge branch 'practical' into 'master'
Practical Research and support See merge request core-developers/forge!4323
This commit is contained in:
@@ -530,7 +530,14 @@ public class PlayerControllerAi extends PlayerController {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CardCollectionView chooseCardsToDiscardUnlessType(int num, CardCollectionView hand, String uType, SpellAbility sa) {
|
public CardCollectionView chooseCardsToDiscardUnlessType(int num, CardCollectionView hand, String uType, SpellAbility sa) {
|
||||||
final CardCollectionView cardsOfType = CardLists.getType(hand, uType);
|
String [] splitUTypes = uType.split(",");
|
||||||
|
CardCollection cardsOfType = new CardCollection();
|
||||||
|
for (String part : splitUTypes) {
|
||||||
|
CardCollection partCards = CardLists.getType(hand, part);
|
||||||
|
if (!partCards.isEmpty()) {
|
||||||
|
cardsOfType.addAll(partCards);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!cardsOfType.isEmpty()) {
|
if (!cardsOfType.isEmpty()) {
|
||||||
Card toDiscard = Aggregates.itemWithMin(cardsOfType, CardPredicates.Accessors.fnGetCmc);
|
Card toDiscard = Aggregates.itemWithMin(cardsOfType, CardPredicates.Accessors.fnGetCmc);
|
||||||
return new CardCollection(toDiscard);
|
return new CardCollection(toDiscard);
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
Name:Practical Research
|
||||||
|
ManaCost:3 U R
|
||||||
|
Types:Instant
|
||||||
|
A:SP$ Draw | NumCards$ 4 | SubAbility$ DBDiscard | StackDescription$ SpellDescription | SpellDescription$ Draw four cards.
|
||||||
|
SVar:DBDiscard:DB$ Discard | Defined$ You | NumCards$ 2 | Mode$ TgtChoose | UnlessType$ Instant,Sorcery | StackDescription$ SpellDescription | SpellDescription$ Then discard two cards unless you discard an instant or sorcery card.
|
||||||
|
DeckHas:Ability$Discard
|
||||||
|
DeckHints:Type$Instant|Sorcery
|
||||||
|
Oracle:Draw four cards. Then discard two cards unless you discard an instant or sorcery card.
|
||||||
@@ -1149,6 +1149,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
|||||||
@Override
|
@Override
|
||||||
public CardCollectionView chooseCardsToDiscardUnlessType(final int num, final CardCollectionView hand,
|
public CardCollectionView chooseCardsToDiscardUnlessType(final int num, final CardCollectionView hand,
|
||||||
final String uType, final SpellAbility sa) {
|
final String uType, final SpellAbility sa) {
|
||||||
|
String [] splitUTypes = uType.split(",");
|
||||||
final InputSelectEntitiesFromList<Card> target = new InputSelectEntitiesFromList<Card>(this, num, num, hand,
|
final InputSelectEntitiesFromList<Card> target = new InputSelectEntitiesFromList<Card>(this, num, num, hand,
|
||||||
sa) {
|
sa) {
|
||||||
private static final long serialVersionUID = -5774108410928795591L;
|
private static final long serialVersionUID = -5774108410928795591L;
|
||||||
@@ -1156,14 +1157,26 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
|||||||
@Override
|
@Override
|
||||||
protected boolean hasAllTargets() {
|
protected boolean hasAllTargets() {
|
||||||
for (final Card c : selected) {
|
for (final Card c : selected) {
|
||||||
if (c.getType().hasStringType(uType)) {
|
for (String part : splitUTypes) {
|
||||||
return true;
|
if (c.getType().hasStringType(part)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return super.hasAllTargets();
|
return super.hasAllTargets();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
target.setMessage(localizer.getMessage("lblSelectNCardsToDiscardUnlessDiscarduType", uType));
|
int n=1;
|
||||||
|
StringBuilder promptType = new StringBuilder();
|
||||||
|
for (String part : splitUTypes) {
|
||||||
|
if (n==1) {
|
||||||
|
promptType.append(part);
|
||||||
|
} else {
|
||||||
|
promptType.append(" or ").append(part);
|
||||||
|
}
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
target.setMessage(localizer.getMessage("lblSelectNCardsToDiscardUnlessDiscarduType", promptType));
|
||||||
target.showAndWait();
|
target.showAndWait();
|
||||||
return new CardCollection(target.getSelected());
|
return new CardCollection(target.getSelected());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user