mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
Merge branch 'patch' into 'master'
Update CostMill See merge request core-developers/forge!2910
This commit is contained in:
@@ -330,7 +330,7 @@ public class AiCostDecision extends CostDecisionMakerBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CardCollectionView topLib = player.getCardsIn(ZoneType.Library, c);
|
CardCollectionView topLib = player.getCardsIn(ZoneType.Library, c);
|
||||||
return topLib.size() < c ? null : PaymentDecision.card(topLib);
|
return topLib.size() < c ? null : PaymentDecision.number(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ package forge.game.cost;
|
|||||||
|
|
||||||
import forge.game.ability.AbilityUtils;
|
import forge.game.ability.AbilityUtils;
|
||||||
import forge.game.card.Card;
|
import forge.game.card.Card;
|
||||||
|
import forge.game.card.CardCollection;
|
||||||
|
import forge.game.card.CardZoneTable;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.spellability.SpellAbility;
|
import forge.game.spellability.SpellAbility;
|
||||||
import forge.game.zone.PlayerZone;
|
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
|
* 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>
|
* 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.
|
* Serializables need a version ID.
|
||||||
@@ -49,18 +51,6 @@ public class CostMill extends CostPartWithList {
|
|||||||
@Override
|
@Override
|
||||||
public int paymentOrder() { return 10; }
|
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)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
@@ -112,12 +102,12 @@ public class CostMill extends CostPartWithList {
|
|||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see forge.card.cost.CostPartWithList#executePayment(forge.card.spellability.SpellAbility, forge.Card)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Card doPayment(SpellAbility ability, Card targetCard) {
|
public final boolean payAsDecided(final Player ai, final PaymentDecision decision, SpellAbility ability) {
|
||||||
return targetCard.getGame().getAction().moveToGraveyard(targetCard, null);
|
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) {
|
public <T> T accept(ICostVisitor<T> visitor) {
|
||||||
|
|||||||
@@ -581,19 +581,13 @@ public class HumanCostDecision extends CostDecisionMakerBase {
|
|||||||
Integer c = cost.convertAmount();
|
Integer c = cost.convertAmount();
|
||||||
|
|
||||||
if (c == null) {
|
if (c == null) {
|
||||||
final String sVar = ability.getSVar(amount);
|
c = AbilityUtils.calculateAmount(source, amount, ability);
|
||||||
// Generalize this
|
|
||||||
if (sVar.equals("XChoice")) {
|
|
||||||
c = chooseXValue(cost.getLKIList().size());
|
|
||||||
} else {
|
|
||||||
c = AbilityUtils.calculateAmount(source, amount, ability);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!player.getController().confirmPayment(cost, Localizer.getInstance().getMessage("lblMillNCardsFromYourLibraryConfirm", String.valueOf(c)), ability)) {
|
if (!player.getController().confirmPayment(cost, Localizer.getInstance().getMessage("lblMillNCardsFromYourLibraryConfirm", String.valueOf(c)), ability)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return PaymentDecision.card(player.getCardsIn(ZoneType.Library, c));
|
return PaymentDecision.number(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user