Merge branch 'patch' into 'master'

Update CostMill

See merge request core-developers/forge!2910
This commit is contained in:
swordshine
2020-06-26 04:36:53 +00:00
3 changed files with 11 additions and 27 deletions

View File

@@ -330,7 +330,7 @@ public class AiCostDecision extends CostDecisionMakerBase {
}
CardCollectionView topLib = player.getCardsIn(ZoneType.Library, c);
return topLib.size() < c ? null : PaymentDecision.card(topLib);
return topLib.size() < c ? null : PaymentDecision.number(c);
}
@Override

View File

@@ -19,6 +19,8 @@ package forge.game.cost;
import forge.game.ability.AbilityUtils;
import forge.game.card.Card;
import forge.game.card.CardCollection;
import forge.game.card.CardZoneTable;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.zone.PlayerZone;
@@ -29,7 +31,7 @@ import forge.game.zone.ZoneType;
* your graveyard as a cost. This Cost doesn't appear on very many cards, but
* might appear in more in the future. This will show up in the form of Mill<1>
*/
public class CostMill extends CostPartWithList {
public class CostMill extends CostPart {
/**
* Serializables need a version ID.
@@ -49,18 +51,6 @@ public class CostMill extends CostPartWithList {
@Override
public int paymentOrder() { return 10; }
/* (non-Javadoc)
* @see forge.card.cost.CostPartWithList#getHashForList()
*/
@Override
public String getHashForLKIList() {
return "Milled";
}
@Override
public String getHashForCardList() {
return "MilledCards";
}
/*
* (non-Javadoc)
*
@@ -112,12 +102,12 @@ public class CostMill extends CostPartWithList {
return sb.toString();
}
/* (non-Javadoc)
* @see forge.card.cost.CostPartWithList#executePayment(forge.card.spellability.SpellAbility, forge.Card)
*/
@Override
protected Card doPayment(SpellAbility ability, Card targetCard) {
return targetCard.getGame().getAction().moveToGraveyard(targetCard, null);
public final boolean payAsDecided(final Player ai, final PaymentDecision decision, SpellAbility ability) {
CardZoneTable table = new CardZoneTable();
ability.getPaidHash().put("Milled", (CardCollection) ai.mill(decision.c, ZoneType.Graveyard, false, ability, table));
table.triggerChangesZoneAll(ai.getGame());
return true;
}
public <T> T accept(ICostVisitor<T> visitor) {

View File

@@ -581,19 +581,13 @@ public class HumanCostDecision extends CostDecisionMakerBase {
Integer c = cost.convertAmount();
if (c == null) {
final String sVar = ability.getSVar(amount);
// Generalize this
if (sVar.equals("XChoice")) {
c = chooseXValue(cost.getLKIList().size());
} else {
c = AbilityUtils.calculateAmount(source, amount, ability);
}
c = AbilityUtils.calculateAmount(source, amount, ability);
}
if (!player.getController().confirmPayment(cost, Localizer.getInstance().getMessage("lblMillNCardsFromYourLibraryConfirm", String.valueOf(c)), ability)) {
return null;
}
return PaymentDecision.card(player.getCardsIn(ZoneType.Library, c));
return PaymentDecision.number(c);
}
@Override