Merge branch 'patch' into 'master'

Add Ormos, Archive Keeper

See merge request core-developers/forge!2927
This commit is contained in:
swordshine
2020-06-29 01:00:15 +00:00
9 changed files with 67 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ import java.util.List;
import java.util.Map;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.Lists;
import forge.card.CardType;
@@ -23,6 +24,7 @@ import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.spellability.SpellAbilityStackInstance;
import forge.game.zone.ZoneType;
import forge.util.Aggregates;
import forge.util.TextUtil;
import forge.util.collect.FCollectionView;
@@ -105,6 +107,24 @@ public class AiCostDecision extends CostDecisionMakerBase {
}
return PaymentDecision.card(randomSubset);
}
else if (type.equals("DifferentNames")) {
CardCollection differentNames = new CardCollection();
CardCollection discardMe = CardLists.filter(hand, CardPredicates.hasSVar("DiscardMe"));
while (c > 0) {
Card chosen;
if (!discardMe.isEmpty()) {
chosen = Aggregates.random(discardMe);
discardMe = CardLists.filter(discardMe, Predicates.not(CardPredicates.sharesNameWith(chosen)));
} else {
final Card worst = ComputerUtilCard.getWorstAI(hand);
chosen = worst != null ? worst : Aggregates.random(hand);
}
differentNames.add(chosen);
hand = CardLists.filter(hand, Predicates.not(CardPredicates.sharesNameWith(chosen)));
c--;
}
return PaymentDecision.card(differentNames);
}
else {
final AiController aic = ((PlayerControllerAi)player.getController()).getAi();

View File

@@ -18,6 +18,9 @@
package forge.game.cost;
import java.util.Map;
import java.util.Set;
import com.google.common.collect.Sets;
import forge.game.ability.AbilityKey;
import forge.game.card.Card;
@@ -83,6 +86,9 @@ public class CostDiscard extends CostPartWithList {
else if (this.getType().equals("LastDrawn")) {
sb.append("the last card you drew this turn");
}
else if (this.getType().equals("DifferentNames")) {
sb.append(Cost.convertAmountTypeToWords(i, this.getAmount(), "Card")).append(" with different names");
}
else {
final StringBuilder desc = new StringBuilder();
@@ -129,6 +135,13 @@ public class CostDiscard extends CostPartWithList {
final Card c = payer.getLastDrawnCard();
return handList.contains(c);
}
else if (type.equals("DifferentNames")) {
Set<String> cardNames = Sets.newHashSet();
for (Card c : handList) {
cardNames.add(c.getName());
}
return amount != null && cardNames.size() >= amount;
}
else {
boolean sameName = false;
if (type.contains("+WithSameName")) {

View File

@@ -0,0 +1,10 @@
Name:Ormos, Archive Keeper
ManaCost:4 U U
Types:Legendary Creature Sphinx
PT:5/5
K:Flying
R:Event$ Draw | ActiveZones$ Battlefield | ValidPlayer$ You | IsPresent$ Card.YouOwn | PresentZone$ Library | PresentCompare$ EQ0 | ReplaceWith$ AddCounters | Description$ If you would draw a card while your library has no cards in it, instead put five +1/+1 counters on CARDNAME.
SVar:AddCounters:DB$ PutCounter | CounterType$ P1P1 | CounterNum$ 5 | Defined$ Self
A:AB$ Draw | Cost$ 1 U U Discard<3/DifferentNames> | NumCards$ 5 | SpellDescription$ Draw five cards.
AI:RemoveDeck:All
Oracle:Flying\nIf you would draw a card while your library has no cards in it, instead put five +1/+1 counters on Ormos, Archive Keeper.\n{1}{U}{U}, Discard three cards with different names: Draw five cards.

View File

@@ -2174,6 +2174,7 @@ lblConquestName=Eroberung-Name
#HumanCostDecision.java
lblChooseXValueForCard={0} - Wähle Wert für X
lblSelectOneSameNameCardToDiscardAlreadyChosen=Wähle eine Karte mit dem gleichen Namen zum Abwerfen. Bereits gewählt:
lblSelectOneDifferentNameCardToDiscardAlreadyChosen=Select one of the cards with a different name to discard. Already chosen:
lblSelectNMoreTargetTypeCardToDiscard=Wähle {0} weitere {1} zum Abwerfen.
lblDoYouWantCardDealNDamageToYou=Möchtest du, daß {0} dir {1} Schaden zufügt?
lblDrawNCardsConfirm=Ziehe {0} Karte(n)?

View File

@@ -2174,6 +2174,7 @@ lblConquestName=Conquest Name
#HumanCostDecision.java
lblChooseXValueForCard={0} - Choose a Value for X
lblSelectOneSameNameCardToDiscardAlreadyChosen=Select one of the cards with the same name to discard. Already chosen:
lblSelectOneDifferentNameCardToDiscardAlreadyChosen=Select one of the cards with a different name to discard. Already chosen:
lblSelectNMoreTargetTypeCardToDiscard=Select {0} more {1} to discard.
lblDoYouWantCardDealNDamageToYou=Do you want {0} to deal {1} damage to you?
lblDrawNCardsConfirm=Draw {0} Card(s)?

View File

@@ -2174,6 +2174,7 @@ lblConquestName=Nombre de la Conquista
#HumanCostDecision.java
lblChooseXValueForCard={0} - Elige un Valor para X
lblSelectOneSameNameCardToDiscardAlreadyChosen=Selecciona una de las cartas con el mismo nombre para descartarla. Ya elegida:
lblSelectOneDifferentNameCardToDiscardAlreadyChosen=Selecciona una de las cartas con un nombre diferente para descartarla. Ya elegida:
lblSelectNMoreTargetTypeCardToDiscard=Selecciona {0} {1} más para descartar.
lblDoYouWantCardDealNDamageToYou=¿Quieres que {0} te haga {1} de daño?
lblDrawNCardsConfirm=¿Robar {0} Carta(s)?

View File

@@ -2174,6 +2174,7 @@ lblConquestName=Conquest Name
#HumanCostDecision.java
lblChooseXValueForCard={0} - Choose a Value for X
lblSelectOneSameNameCardToDiscardAlreadyChosen=Select one of the cards with the same name to discard. Already chosen:
lblSelectOneDifferentNameCardToDiscardAlreadyChosen=Select one of the cards with a different name to discard. Already chosen:
lblSelectNMoreTargetTypeCardToDiscard=Select {0} more {1} to discard.
lblDoYouWantCardDealNDamageToYou=Do you want {0} to deal {1} damage to you?
lblDrawNCardsConfirm=Draw {0} Card(s)?

View File

@@ -2173,7 +2173,8 @@ lblHistoriiansWillRecallYourConquestAs=史学家将会将你的征服记为:
lblConquestName=征服名
#HumanCostDecision.java
lblChooseXValueForCard={0} - 为X选择一个值
lblSelectOneSameNameCardToDiscardAlreadyChosen=选择一个具有相同名称的牌弃掉。已选择
lblSelectOneSameNameCardToDiscardAlreadyChosen=选择一个具有相同名称的牌弃掉。已选择:
lblSelectOneDifferentNameCardToDiscardAlreadyChosen=选择一个具有不同名称的牌弃掉。已选择:
lblSelectNMoreTargetTypeCardToDiscard=再选择{0}张{1}弃掉
lblDoYouWantCardDealNDamageToYou=你想要{0}对你造成{1}点伤害吗?
lblDrawNCardsConfirm=抓{0}张牌?

View File

@@ -9,6 +9,7 @@ import java.util.Map;
import java.util.Map.Entry;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import forge.card.CardType;
@@ -127,6 +128,23 @@ public class HumanCostDecision extends CostDecisionMakerBase {
}
return PaymentDecision.card(randomSubset);
}
if (discardType.equals("DifferentNames")) {
final CardCollection discarded = new CardCollection();
while (c > 0) {
final InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, 1, 1, hand, ability);
inp.setMessage(Localizer.getInstance().getMessage("lblSelectOneDifferentNameCardToDiscardAlreadyChosen") + discarded);
inp.setCancelAllowed(true);
inp.showAndWait();
if (inp.hasCancelled()) {
return null;
}
final Card first = inp.getFirstSelected();
discarded.add(first);
hand = CardLists.filter(hand, Predicates.not(CardPredicates.sharesNameWith(first)));
c--;
}
return PaymentDecision.card(discarded);
}
if (discardType.contains("+WithSameName")) {
final String type = TextUtil.fastReplace(discardType, "+WithSameName", "");
hand = CardLists.getValidCards(hand, type.split(";"), player, source, ability);